Added checking for mmap.

This commit is contained in:
Hidenori Takeshima 2000-11-25 23:54:12 +00:00 committed by Alexandre Julliard
parent 01af00a518
commit a85b0a6d41
6 changed files with 106 additions and 57 deletions

111
configure vendored
View File

@ -5378,6 +5378,7 @@ for ac_func in \
getsockopt \
inet_network \
memmove \
mmap \
rfork \
select \
sendmsg \
@ -5396,12 +5397,12 @@ for ac_func in \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5400: checking for $ac_func" >&5
echo "configure:5401: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5405 "configure"
#line 5406 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5424,7 +5425,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -5501,17 +5502,17 @@ for ac_hdr in \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:5505: checking for $ac_hdr" >&5
echo "configure:5506: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5510 "configure"
#line 5511 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5516: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5538,12 +5539,12 @@ fi
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
echo "configure:5542: checking whether stat file-mode macros are broken" >&5
echo "configure:5543: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5547 "configure"
#line 5548 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -5596,12 +5597,12 @@ fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:5600: checking for working const" >&5
echo "configure:5601: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5605 "configure"
#line 5606 "configure"
#include "confdefs.h"
int main() {
@ -5650,7 +5651,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:5654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -5671,21 +5672,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
echo "configure:5675: checking for inline" >&5
echo "configure:5676: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
#line 5682 "configure"
#line 5683 "configure"
#include "confdefs.h"
int main() {
} int $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:5689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@ -5711,12 +5712,12 @@ EOF
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:5715: checking for ANSI C header files" >&5
echo "configure:5716: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5720 "configure"
#line 5721 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -5724,7 +5725,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5741,7 +5742,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 5745 "configure"
#line 5746 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -5759,7 +5760,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 5763 "configure"
#line 5764 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -5780,7 +5781,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 5784 "configure"
#line 5785 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -5791,7 +5792,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:5795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:5796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -5815,12 +5816,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:5819: checking for size_t" >&5
echo "configure:5820: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5824 "configure"
#line 5825 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -5848,7 +5849,7 @@ EOF
fi
echo $ac_n "checking size of long long""... $ac_c" 1>&6
echo "configure:5852: checking size of long long" >&5
echo "configure:5853: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -5856,7 +5857,7 @@ else
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
#line 5860 "configure"
#line 5861 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@ -5867,7 +5868,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:5871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@ -5889,12 +5890,12 @@ EOF
echo $ac_n "checking "whether we can use re-entrant gethostbyname_r Linux style"""... $ac_c" 1>&6
echo "configure:5893: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
echo "configure:5894: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5898 "configure"
#line 5899 "configure"
#include "confdefs.h"
#include <netdb.h>
@ -5915,7 +5916,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:5919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_gethostbyname_r_6=yes
else
@ -5941,12 +5942,12 @@ EOF
if test "$ac_cv_header_linux_joystick_h" = "yes"
then
echo $ac_n "checking "whether linux/joystick.h uses the Linux 2.2+ API"""... $ac_c" 1>&6
echo "configure:5945: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
echo "configure:5946: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5950 "configure"
#line 5951 "configure"
#include "confdefs.h"
#include <sys/ioctl.h>
@ -5961,7 +5962,7 @@ int main() {
/*empty*/
; return 0; }
EOF
if { (eval echo configure:5965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_joystick_22_api=yes
else
@ -5988,12 +5989,12 @@ fi
if test "$ac_cv_header_sys_vfs_h" = "yes"
then
echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6
echo "configure:5992: checking "whether sys/vfs.h defines statfs"" >&5
echo "configure:5993: checking "whether sys/vfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5997 "configure"
#line 5998 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6010,7 +6011,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_vfs_has_statfs=yes
else
@ -6037,12 +6038,12 @@ fi
if test "$ac_cv_header_sys_statfs_h" = "yes"
then
echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6
echo "configure:6041: checking "whether sys/statfs.h defines statfs"" >&5
echo "configure:6042: checking "whether sys/statfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6046 "configure"
#line 6047 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6057,7 +6058,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_statfs_has_statfs=yes
else
@ -6084,12 +6085,12 @@ fi
if test "$ac_cv_header_sys_mount_h" = "yes"
then
echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6
echo "configure:6088: checking "whether sys/mount.h defines statfs"" >&5
echo "configure:6089: checking "whether sys/mount.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6093 "configure"
#line 6094 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6104,7 +6105,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_mount_has_statfs=yes
else
@ -6130,7 +6131,7 @@ fi
echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6
echo "configure:6134: checking "for statfs.f_bfree"" >&5
echo "configure:6135: checking "for statfs.f_bfree"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6139,7 +6140,7 @@ else
wine_cv_statfs_bfree=no
else
cat > conftest.$ac_ext <<EOF
#line 6143 "configure"
#line 6144 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6166,7 +6167,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bfree=yes
else
@ -6190,7 +6191,7 @@ EOF
fi
echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6
echo "configure:6194: checking "for statfs.f_bavail"" >&5
echo "configure:6195: checking "for statfs.f_bavail"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -6199,7 +6200,7 @@ else
wine_cv_statfs_bavail=no
else
cat > conftest.$ac_ext <<EOF
#line 6203 "configure"
#line 6204 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -6226,7 +6227,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:6230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bavail=yes
else
@ -6251,12 +6252,12 @@ fi
echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6
echo "configure:6255: checking "for msg_accrights in struct msghdr"" >&5
echo "configure:6256: checking "for msg_accrights in struct msghdr"" >&5
if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6260 "configure"
#line 6261 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -6264,7 +6265,7 @@ int main() {
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
if { (eval echo configure:6268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_msg_accrights="yes"
else
@ -6287,12 +6288,12 @@ fi
echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6
echo "configure:6291: checking "for sun_len in struct sockaddr_un"" >&5
echo "configure:6292: checking "for sun_len in struct sockaddr_un"" >&5
if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6296 "configure"
#line 6297 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -6301,7 +6302,7 @@ int main() {
static struct sockaddr_un addr; addr.sun_len = 1
; return 0; }
EOF
if { (eval echo configure:6305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_sun_len="yes"
else
@ -6324,12 +6325,12 @@ fi
echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6
echo "configure:6328: checking "whether we need to define __i386__"" >&5
echo "configure:6329: checking "whether we need to define __i386__"" >&5
if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 6333 "configure"
#line 6334 "configure"
#include "confdefs.h"
#if (defined(i386) || defined(__i386)) && !defined(__i386__)
yes

View File

@ -719,6 +719,7 @@ AC_CHECK_FUNCS(\
getsockopt \
inet_network \
memmove \
mmap \
rfork \
select \
sendmsg \

View File

@ -203,6 +203,9 @@
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the mmap function. */
#undef HAVE_MMAP
/* Define if you have the openpty function. */
#undef HAVE_OPENPTY

View File

@ -38,7 +38,6 @@ char* g_lpstrFileName = NULL;
char* g_lpstrInputFile = NULL;
int b_to_binary = 0;
int b_force_overwrite = 0;
LPBYTE p_in_file = NULL;
static char* errorOpenFile = "Unable to open file.\n";
static char* errorRCFormat = "Unexpexted syntax in rc file line %i\n";
@ -102,9 +101,11 @@ void parse_options(int argc, char **argv)
int insert_hex (char * infile, FILE * outfile)
{
#ifdef HAVE_MMAP
unsigned int i;
int fd;
struct stat st;
LPBYTE p_in_file = NULL;
if( (fd = open( infile, O_RDONLY))==-1 )
{
@ -129,7 +130,46 @@ int insert_hex (char * infile, FILE * outfile)
fprintf (outfile, "'\n}");
munmap(p_in_file, st.st_size);
close(fd);
return 1;
return 1;
#else /* HAVE_MMAP */
FILE* fp;
struct stat st;
unsigned int i;
int c;
fp = fopen( infile, "r" );
if ( fp == NULL )
{
fprintf(stderr, errorOpenFile );
exit(1);
}
if (fstat(fileno(fp), &st) == -1)
{
fprintf(stderr, errorOpenFile );
fclose(fp);
exit(1);
}
fprintf (outfile, "{\n '");
i = 0;
while (1)
{
c = fgetc(fp);
if ( c == EOF )
{
fprintf(stderr, errorOpenFile );
fclose(fp);
exit(1);
}
fprintf(outfile, "%02X", c);
if (++i >= st.st_size) break;
fprintf(outfile, "%s", (i == (i & 0xfffffff0)) ? "'\n '" :" ");
}
fprintf (outfile, "'\n}");
fclose(fp);
return 1;
#endif /* HAVE_MMAP */
}
int convert_to_res ()

View File

@ -145,7 +145,9 @@ void load_res16_file( const char *name )
if ((fd = open( name, O_RDONLY )) == -1) fatal_perror( "Cannot open %s", name );
if ((fstat( fd, &st ) == -1)) fatal_perror( "Cannot stat %s", name );
if (!st.st_size) fatal_error( "%s is an empty file\n" );
#ifdef HAVE_MMAP
if ((base = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 )) == (void*)-1)
#endif /* HAVE_MMAP */
{
base = xmalloc( st.st_size );
if (read( fd, base, st.st_size ) != st.st_size)

View File

@ -187,7 +187,9 @@ void load_res32_file( const char *name )
if ((fd = open( name, O_RDONLY )) == -1) fatal_perror( "Cannot open %s", name );
if ((fstat( fd, &st ) == -1)) fatal_perror( "Cannot stat %s", name );
if (!st.st_size) fatal_error( "%s is an empty file\n" );
#ifdef HAVE_MMAP
if ((base = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 )) == (void*)-1)
#endif /* HAVE_MMAP */
{
base = xmalloc( st.st_size );
if (read( fd, base, st.st_size ) != st.st_size)