- Made FillRect behave like it does on Windows
[wine.git] / configure.in
blob2bbcf2124867fa70afcaab204b109b10e6451287
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Author: Michael Patra   <micky@marie.physik.tu-berlin.de>
3 dnl                         <patra@itp1.physik.tu-berlin.de>
4 AC_REVISION([configure.in 1.00])
5 AC_INIT(controls/edit.c)                
6 AC_CONFIG_HEADER(include/config.h)
7 AC_CONFIG_AUX_DIR(tools)
9 # We want these before the checks, so the checks can modify their values.
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
13 dnl **** Command-line arguments ****
15 dnl Default values
16 MAIN_TARGET=emu
17 LIB_TARGET=libwine.a
18 ALT_LINK="-L\$(TOPOBJDIR) -lwine"
19 TRACE_MSGS=yes  # the TRACE() macro
20 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
22 AC_ARG_ENABLE(emulator,
23 [  --disable-emulator      build only the Wine library, not the emulator],
24 [if test "$enableval" = "no"; then MAIN_TARGET="lib"; fi])
26 AC_ARG_ENABLE(dll,
27 [  --enable-dll            build the Wine library as a DLL],
28 [if test "$enableval" = "no"; then : ; else LIB_TARGET="libwine.so.1.0"; fi])
30 AC_ARG_ENABLE(lib,
31 [  --disable-lib           build the Wine without building libwine.a],
32 [if test "$enableval" = "no"; then ALT_LINK="\$(LIBOBJS) \$(X11OBJS)"; LIB_TARGET=""; fi])
34 AC_ARG_ENABLE(debug,
35 [  --disable-debug         compile out all debugging messages],
36 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
38 AC_ARG_ENABLE(trace,
39 [  --disable-trace         compile out TRACE messages],
40 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
42 AC_ARG_WITH(reentrant-x,
43 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
45 AC_SUBST(MAIN_TARGET)
46 AC_SUBST(LIB_TARGET)
47 AC_SUBST(ALT_LINK)
48 AC_SUBST(OPTIONS)
50 if test "$DEBUG_MSGS" = "no"
51 then
52     AC_DEFINE(NO_DEBUG_MSGS)
53     AC_DEFINE(NO_TRACE_MSGS)
54 else
55     if test "$TRACE_MSGS" = "no"
56     then
57         AC_DEFINE(NO_TRACE_MSGS)
58     fi
61 dnl **** Check for some programs ****
63 AC_PROG_MAKE_SET
64 AC_PROG_CC
65 AC_PROG_CPP
66 AC_PATH_XTRA
67 AC_PROG_YACC
68 AC_PROG_LEX
69 AC_PROG_RANLIB
70 AC_PROG_INSTALL
71 AC_PROG_LN_S
72 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
73 AC_PATH_PROG(LDCONFIG, ldconfig, false, /sbin:/usr/sbin:$PATH)
75 dnl Check for lint
76 AC_CHECK_PROGS(LINT, lclint lint)
77 if test "$LINT" = "lint"
78 then
79   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
80   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
82 AC_SUBST(LINT)
83 AC_SUBST(LINTFLAGS)
85 dnl **** Check for some libraries ****
87 dnl Check for -lm for BeOS
88 AC_CHECK_LIB(m,sqrt)
89 dnl Check for -li386 for NetBSD and OpenBSD
90 AC_CHECK_LIB(i386,i386_set_ldt)
91 dnl Check for -lossaudio for NetBSD
92 AC_CHECK_LIB(ossaudio,_oss_ioctl)
93 dnl Check for -lw for Solaris
94 AC_CHECK_LIB(w,iswalnum)
95 dnl Check for -lnsl for Solaris
96 AC_CHECK_FUNCS(gethostbyname,, AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl", AC_CHECK_LIB(socket, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl", , -lnsl), -lsocket))
97 dnl Check for -lsocket for Solaris
98 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
99 dnl Check for -lxpg4 for FreeBSD
100 AC_CHECK_LIB(xpg4,setrunelocale)
101 dnl Check for -lmmap for OS/2
102 AC_CHECK_LIB(mmap,mmap)
103 dnl Check for openpty
104 AC_CHECK_FUNCS(openpty,,
105         AC_CHECK_LIB(util,openpty,
106                 AC_DEFINE(HAVE_OPENPTY)
107                 LIBS="$LIBS -lutil"
108         ))
110 AC_CHECK_HEADERS(dlfcn.h,
111         AC_CHECK_FUNCS(dlopen,
112                 AC_DEFINE(HAVE_DL_API),
113                 AC_CHECK_LIB(dl,dlopen,
114                         AC_DEFINE(HAVE_DL_API)
115                         LIBS="$LIBS -ldl"
116                 )
117         )
119 AC_SUBST(XLIB)
120 if test "$have_x" = "yes"
121 then
122     XLIB="-lXext -lX11"
123     ac_save_CPPFLAGS="$CPPFLAGS"
124     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
126     dnl Check for -lXpm
127     AC_CHECK_HEADERS(X11/xpm.h)
128     if test "$ac_cv_header_X11_xpm_h" = "yes"
129     then 
130         AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
131     else
132         echo "When compiling with X support, you need the Xpm library, or"
133         echo "WINE will not work. This Xpm library is within the following RPM,"
134         echo "which you need to install:"
135         echo "Redhat            :       xpm, xpm-devel"
136         echo "Caldera OpenLinux :       xpm, xpm-devel, xpm-devel-static"
137         echo "SuSE:                     xpm"
138         echo
139         echo "Or get the sources from ftp.x.org and all its mirror sites from "
140         echo "the directory /contrib/libraries."
141         echo
142         exit 1
143     fi
146     dnl Check for X Shm extension
147     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/XShm.h)
148     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_XShm_h" = "yes"
149     then 
150         AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
151     fi
152     dnl Check for XFree86 DGA / DGA 2.0 extension
153     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86dga.h)
154     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86dga_h" = "yes"
155     then 
156          AC_CHECK_LIB(Xxf86dga,XDGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA2) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
157          if test "$ac_cv_lib_Xxf86dga_XDGAQueryExtension" = "no"
158          then
159            AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
160          fi
161     fi
163     dnl Check for XFree86 VMODE extension
164     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86vmode.h)
165     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
166     then 
167         AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11)
168     fi
170     dnl Check for the presence of Mesa
171     AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/osmesa.h)
172     if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
173     then
174         dnl Check for some problems due to old Mesa versions
175         AC_CACHE_CHECK("for up-to-date Mesa version", wine_cv_mesa_version_OK,
176           AC_TRY_COMPILE(
177             [#include <GL/gl.h>],
178             [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
179             [wine_cv_mesa_version_OK="yes"],
180             [wine_cv_mesa_version_OK="no"]
181           )
182         )
184         if test "$wine_cv_mesa_version_OK" = "yes"
185         then
186             dnl Check for the presense of the library
187             AC_CHECK_LIB(GL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lGL",,$X_LIBS -lXext -lX11 -lm)
188             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
189             then
190                 AC_CHECK_LIB(MesaGL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm)
191             fi
193             dnl Check for the Color Table and Paletted Texture extensions
194             AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
195               AC_TRY_COMPILE(
196                 [#include <GL/gl.h>],
197                 [GLenum test = GL_COLOR_INDEX8_EXT;],
198                 [AC_DEFINE(HAVE_GL_COLOR_TABLE)],
199               )
200             )
201             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
202             then
203                 AC_CHECK_LIB(MesaGL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm)
204             else
205                 AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm)
206             fi
207         fi
208     fi
210     CPPFLAGS="$ac_save_CPPFLAGS"
211 else
212     XLIB=""
213     X_CFLAGS=""
214     X_LIBS=""
217 dnl **** Check which curses lib to use ***
218 AC_CHECK_HEADERS(ncurses.h)
219 if test "$ac_cv_header_ncurses_h" = "yes"
220 then 
221     AC_CHECK_LIB(ncurses,waddch)
223 if test "$ac_cv_lib_ncurses_waddch" = "yes"
224 then
225     AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
226     AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
227 else
228     AC_CHECK_HEADERS(curses.h)
229     if test "$ac_cv_header_curses_h" = "yes"
230     then    
231        AC_CHECK_LIB(curses,waddch)
232        AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
233        AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
234     fi
237 dnl **** Check for IPX (currently Linux only) ****
238 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
239  AC_TRY_COMPILE(
240    [#include <sys/socket.h>
241     #include <netipx/ipx.h>],
242    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
243    [AC_DEFINE(HAVE_IPX_GNU)
244     ac_cv_c_ipx_gnu="yes"],
245    [ac_cv_c_ipx_gnu="no"])
248 if test "$ac_cv_c_ipx_gnu" = "no"
249 then
250  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
251   AC_TRY_COMPILE(
252     [#include <sys/socket.h>
253      #include <asm/types.h>
254      #include <linux/ipx.h>],
255     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
256     [AC_DEFINE(HAVE_IPX_LINUX)
257      ac_cv_c_ipx_linux="yes"],
258     [ac_cv_c_ipx_linux="no"])
259   )
262 dnl **** Check for Open Sound System ****
263 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
265 AC_CACHE_CHECK("for Open Sound System",
266         ac_cv_c_opensoundsystem,
267         AC_TRY_COMPILE([
268         #if defined(HAVE_SYS_SOUNDCARD_H)
269                 #include <sys/soundcard.h>
270         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
271                 #include <machine/soundcard.h>
272         #elif defined(HAVE_SOUNDCARD_H)
273                 #include <soundcard.h>
274         #endif
275         ],[
277 /* check for one of the Open Sound System specific SNDCTL_ defines */
278 #if !defined(SNDCTL_DSP_STEREO)
279 #error No open sound system
280 #endif
281 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
283 if test "$ac_cv_c_opensoundsystem" = "yes"
284 then
285     AC_DEFINE(HAVE_OSS)
288 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
289         ac_cv_c_opensoundsystem_midi,
290         AC_TRY_COMPILE([
291         #if defined(HAVE_SYS_SOUNDCARD_H)
292                 #include <sys/soundcard.h>
293         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
294                 #include <machine/soundcard.h>
295         #elif defined(HAVE_SOUNDCARD_H)
296                 #include <soundcard.h>
297         #endif
298         ],[
300 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
301 #if !defined(SNDCTL_SEQ_SYNC)
302 #error No open sound system MIDI interface
303 #endif
304 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
306 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
307 then
308     AC_DEFINE(HAVE_OSS_MIDI)
311 dnl **** If ln -s doesn't work, use cp instead ****
312 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
314 dnl **** Check for gcc strength-reduce bug ****
316 if test "x${GCC}" = "xyes"
317 then
318   CFLAGS="$CFLAGS -Wall"
319   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
320                   AC_TRY_RUN([
321 int main(void) {
322   static int Array[[3]];
323   unsigned int B = 3;
324   int i;
325   for(i=0; i<B; i++) Array[[i]] = i - 3;
326   exit( Array[[1]] != -2 );
328     ac_cv_c_gcc_strength_bug="no",
329     ac_cv_c_gcc_strength_bug="yes",
330     ac_cv_c_gcc_strength_bug="yes") )
331   if test "$ac_cv_c_gcc_strength_bug" = "yes"
332   then
333     CFLAGS="$CFLAGS -fno-strength-reduce"
334   fi
337 dnl **** Check for underscore on external symbols ****
339 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
340                ac_cv_c_extern_prefix,
341 [saved_libs=$LIBS
342 LIBS="conftest_asm.s $LIBS"
343 cat > conftest_asm.s <<EOF
344         .globl _ac_test
345 _ac_test:
346         .long 0
348 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
349             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
350 LIBS=$saved_libs])
351 if test "$ac_cv_c_extern_prefix" = "yes"
352 then
353   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
356 dnl **** Check for .string in assembler ****
358 AC_CACHE_CHECK("whether assembler accepts .string",
359                ac_cv_c_asm_string,
360 [saved_libs=$LIBS
361 LIBS="conftest_asm.s $LIBS"
362 cat > conftest_asm.s <<EOF
363         .string "test"
365 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
366 LIBS=$saved_libs])
367 if test "$ac_cv_c_asm_string" = "yes"
368 then
369   AC_DEFINE(HAVE_ASM_STRING)
372 dnl **** Check for working dll ****
374 DLLFLAGS=""
375 BUILDFLAGS=""
376 LDSHARED=""
377 if test "$LIB_TARGET" = "libwine.so.1.0"
378 then
379   AC_CACHE_CHECK("whether we can build a Linux dll",
380                  ac_cv_c_dll_linux,
381   [saved_cflags=$CFLAGS
382   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
383   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
384   CFLAGS=$saved_cflags
385   ])
386   if test "$ac_cv_c_dll_linux" = "yes"
387   then
388     BUILDFLAGS="-pic"
389     DLLFLAGS="-fPIC"
390     LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so,-rpath,\$(libdir)"
391   else
392     AC_CACHE_CHECK("whether we can build a UnixWare dll",
393                  ac_cv_c_dll_unixware,
394     [saved_cflags=$CFLAGS
395     CFLAGS="$CFLAGS -fPIC -Wl,-G,conftest.so.1.0"
396     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
397     CFLAGS=$saved_cflags
398     ])
399     if test "$ac_cv_c_dll_unixware" = "yes"
400     then
401       BUILDFLAGS="-pic"
402       DLLFLAGS="-fPIC"
403       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/libwine.so"
404     else
405       AC_CACHE_CHECK("whether we can build a NetBSD dll",
406                    ac_cv_c_dll_netbsd,
407       [saved_cflags=$CFLAGS
408       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
409       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
410       CFLAGS=$saved_cflags
411       ])
412       if test "$ac_cv_c_dll_netbsd" = "yes"
413       then
414         BUILDFLAGS="-pic"
415         DLLFLAGS="-fPIC"
416         LDSHARED="ld -Bshareable -Bforcearchive"
417       fi
418     fi
419   fi
420   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
421   then
422     LIB_TARGET="libwine.a"
423   fi
425 AC_SUBST(BUILDFLAGS)
426 AC_SUBST(DLLFLAGS)
427 AC_SUBST(LDSHARED)
429 dnl **** Check for reentrant libc ****
431 dnl For cross-compiling we blindly assume that libc is reentrant. This is
432 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
434 wine_cv_libc_reentrant=no 
435 dnl 
436 dnl Linux style errno location
437 dnl 
438 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
439   [AC_TRY_RUN([int myerrno = 0;
440 char buf[256];
441 int *__errno_location(){return &myerrno;}
442 main(){connect(0,buf,255); exit(!myerrno);}],
443   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
444   wine_cv_libc_r__errno_location=yes )
446 if test "$wine_cv_libc_r__errno_location" = "yes"
447 then
448     AC_DEFINE(HAVE__ERRNO_LOCATION)
449     wine_cv_libc_reentrant=__errno_location 
452 dnl FreeBSD style errno location
453 dnl 
454 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
455   [AC_TRY_RUN([int myerrno = 0;
456 char buf[256];
457 int *__error(){return &myerrno;}
458 main(){connect(0,buf,255); exit(!myerrno);}],
459     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
460     wine_cv_libc_r__error=yes )
462 if test "$wine_cv_libc_r__error" = "yes"
463 then
464     AC_DEFINE(HAVE__ERROR)
465     wine_cv_libc_reentrant=__error 
468 dnl Solaris style errno location
469 dnl 
470 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
471   [AC_TRY_RUN([int myerrno = 0;
472 char buf[256];
473 int *___errno(){return &myerrno;}
474 main(){connect(0,buf,255); exit(!myerrno);}],
475     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
476     wine_cv_libc_r___errno=yes )
478 if test "$wine_cv_libc_r___errno" = "yes"
479 then
480     AC_DEFINE(HAVE___ERRNO)
481     wine_cv_libc_reentrant=___errno 
484 dnl UnixWare style errno location
485 dnl 
486 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
487   [AC_TRY_RUN([int myerrno = 0;
488 char buf[256];
489 int *__thr_errno(){return &myerrno;}
490 main(){connect(0,buf,255); exit(!myerrno);}],
491     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
492     wine_cv_libc_r__thr_errno=yes )
494 if test "$wine_cv_libc_r__thr_errno" = "yes"
495 then
496     AC_DEFINE(HAVE__THR_ERRNO)
497     wine_cv_libc_reentrant=__thr_errno 
499 if test "$wine_cv_libc_reentrant" = "no" 
500 then
501   AC_DEFINE(NO_REENTRANT_LIBC)
504 dnl **** Check for reentrant X libraries ****
506 dnl This may fail to determine whether X libraries are reentrant if
507 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
508 dnl is possible with the --without-reentrant-x option.
510 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
511 then
512 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
513   [ if test "x$with_reentrant_x" = "xno" 
514     then
515         wine_cv_x_reentrant=no
516     else
517         libX11_check=none
518         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
519             if test -r $dir/libX11.so; then
520                 libX11_check="-D $dir/libX11.so"
521                 break 1
522             fi
523             if test -r $dir/libX11.a; then
524                 libX11_check="$dir/libX11.a"
525                 break 1
526             fi
527         done
528         if test "$libX11_check" != "none"; then
529             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
530             then
531                 wine_cv_x_reentrant=yes
532             else
533                 wine_cv_x_reentrant=no
534             fi
535         else
536             wine_cv_x_reentrant=unknown
537         fi
538     fi ] )
539 else
540     wine_cv_x_reentrant=no
542 if test "$wine_cv_x_reentrant" = "no"
543 then
544   AC_DEFINE(NO_REENTRANT_X11)
547 dnl **** Check for endianness ****
549 AC_C_BIGENDIAN
551 dnl **** Check for functions ****
553 AC_FUNC_ALLOCA()
554 AC_CHECK_FUNCS(\
555         _lwp_create \
556         clone \
557         getnetbyaddr \
558         getnetbyname \
559         getpagesize \
560         getprotobyname \
561         getprotobynumber \
562         getservbyport \
563         getsockopt \
564         inet_network \
565         memmove \
566         rfork \
567         select \
568         sendmsg \
569         settimeofday \
570         sigaltstack \
571         statfs \
572         strcasecmp \
573         strerror \
574         strncasecmp \
575         tcgetattr \
576         timegm \
577         usleep \
578         vfscanf \
579         wait4 \
580         waitpid \
583 dnl **** Check for header files ****
585 AC_CHECK_HEADERS(\
586         a.out.h \
587         a_out.h \
588         arpa/inet.h \
589         arpa/nameser.h \
590         curses.h \
591         elf.h \
592         float.h \
593         libio.h \
594         link.h \
595         linux/cdrom.h \
596         linux/joystick.h \
597         linux/ucdrom.h \
598         ncurses.h \
599         net/if.h \
600         netinet/in.h \
601         netinet/tcp.h \
602         pty.h \
603         resolv.h \
604         sched.h \
605         socket.h \
606         strings.h \
607         sys/cdio.h \
608         sys/errno.h \
609         sys/file.h \
610         sys/filio.h \
611         sys/ipc.h \
612         sys/lwp.h \
613         sys/mman.h \
614         sys/modem.h \
615         sys/mount.h \
616         sys/msg.h \
617         sys/param.h \
618         sys/signal.h \
619         sys/shm.h \
620         sys/socket.h \
621         sys/sockio.h \
622         sys/statfs.h \
623         sys/strtio.h \
624         sys/syscall.h \
625         sys/wait.h \
626         sys/v86.h \
627         sys/v86intr.h \
628         sys/vfs.h \
629         sys/vm86.h \
630         syscall.h \
631         ucontext.h \
632         wctype.h \
634 AC_HEADER_STAT()
636 dnl **** Check for types ****
638 AC_C_CONST()
639 AC_C_INLINE()
640 AC_TYPE_SIZE_T()
641 AC_CHECK_SIZEOF(long long,0)
643 if test "$ac_cv_header_linux_joystick_h" = "yes"
644 then
645    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
646         wine_cv_linux_joystick_22_api,
647         AC_TRY_COMPILE([
648         #include <sys/ioctl.h>
649         #include <linux/joystick.h>
651         struct js_event blub;
652         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
653         #error "no 2.2 header"
654         #endif
655         ],/*empty*/,
656         wine_cv_linux_joystick_22_api=yes,
657         wine_cv_linux_joystick_22_api=no,
658         wine_cv_linux_joystick_22_api=no
659         )
660    )
661    if test "$wine_cv_linux_joystick_22_api"
662    then
663       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
664    fi
667 dnl **** statfs checks ****
669 if test "$ac_cv_header_sys_vfs_h" = "yes"
670 then
671     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
672                     wine_cv_sys_vfs_has_statfs,
673         AC_TRY_COMPILE([
674         #include <sys/types.h>
675         #ifdef HAVE_SYS_PARAM_H
676         # include <sys/param.h>
677         #endif
678         #include <sys/vfs.h>
679         ],[
680                 struct statfs stfs;
682                 memset(&stfs,0,sizeof(stfs));
683         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
684         )
685     )
686     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
687     then
688       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
689     fi
692 if test "$ac_cv_header_sys_statfs_h" = "yes"
693 then
694     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
695                     wine_cv_sys_statfs_has_statfs,
696         AC_TRY_COMPILE([
697         #include <sys/types.h>
698         #ifdef HAVE_SYS_PARAM_H
699         # include <sys/param.h>
700         #endif
701         #include <sys/statfs.h>
702         ],[
703                 struct statfs stfs;
704         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
705         )
706     )
707     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
708     then
709       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
710     fi
713 if test "$ac_cv_header_sys_mount_h" = "yes"
714 then
715     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
716                     wine_cv_sys_mount_has_statfs,
717         AC_TRY_COMPILE([
718         #include <sys/types.h>
719         #ifdef HAVE_SYS_PARAM_H
720         # include <sys/param.h>
721         #endif
722         #include <sys/mount.h>
723         ],[
724                 struct statfs stfs;
725         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
726         )
727     )
728     if test "$wine_cv_sys_mount_has_statfs" = "yes"
729     then
730       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
731     fi
734 dnl **** FIXME: what about mixed cases, where we need two of them? ***
736 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
737   [ if test "x$statfs_bfree" = "xno"
738     then
739         wine_cv_statfs_bfree=no
740     else
741         AC_TRY_COMPILE([
742         #include <sys/types.h>
743         #ifdef HAVE_SYS_PARAM_H
744         # include <sys/param.h>
745         #endif
746         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
747         # include <sys/mount.h>
748         #else
749         # ifdef STATFS_DEFINED_BY_SYS_VFS
750         #  include <sys/vfs.h>
751         # else
752         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
753         #   include <sys/statfs.h>
754         #  endif
755         # endif
756         #endif
757         ],[
758                 struct statfs stfs;
760                 stfs.f_bfree++;
761         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
762         )
763     fi ] )
764 if test "$wine_cv_statfs_bfree" = "yes"
765 then
766   AC_DEFINE(STATFS_HAS_BFREE)
769 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
770   [ if test "x$statfs_bavail" = "xno"
771     then
772         wine_cv_statfs_bavail=no
773     else
774         AC_TRY_COMPILE([
775         #include <sys/types.h>
776         #ifdef HAVE_SYS_PARAM_H
777         # include <sys/param.h>
778         #endif
779         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
780         # include <sys/mount.h>
781         #else
782         # ifdef STATFS_DEFINED_BY_SYS_VFS
783         #  include <sys/vfs.h>
784         # else
785         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
786         #   include <sys/statfs.h>
787         #  endif
788         # endif
789         #endif
790         ],[
791                 struct statfs stfs;
793                 stfs.f_bavail++;
794         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
795         )
796     fi ] )
797 if test "$wine_cv_statfs_bavail" = "yes"
798 then
799   AC_DEFINE(STATFS_HAS_BAVAIL)
802 dnl *** check for working sigaltstack
803 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
805 AC_CACHE_CHECK("for working sigaltstack",
806         ac_cv_c_working_sigaltstack,
807         AC_TRY_RUN([
808         #include <stdio.h>
809         #include <time.h> /* <sys/time.h> ? bad magic without end */
810         #include <sys/types.h>
811         #include <sys/signal.h>
812         #ifdef HAVE_SYS_PARAM_H
813         # include <sys/param.h>
814         #endif
815         #ifdef HAVE_SYSCALL_H
816         # include <syscall.h>
817         #else
818         # ifdef HAVE_SYS_SYSCALL_H
819         #  include <sys/syscall.h>
820         # endif
821         #endif
822         
823         unsigned char *xaltstack;
825         int
826         main(int argc,char **argv) {
827             struct sigaltstack  ss;
829             xaltstack = malloc(16384);
830             ss.ss_sp    = xaltstack;
831             ss.ss_size  = 16384;
832             ss.ss_flags = 0;
833             if (sigaltstack(&ss, NULL) < 0) {
834                 /* this catches the glibc case */
835                 perror("sigaltstack");
836                 return (1); /* aka exit(1) aka fail */
837             }
838             /* assume it works. */
839             return 0; /* OK */
840         }
841         ],
842         ac_cv_c_working_sigaltstack="yes",
843         ac_cv_c_working_sigaltstack="no",
844         ac_cv_c_working_sigaltstack="no"
847 if test "$ac_cv_c_working_sigaltstack" = "yes"
848 then
849     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
853 dnl *** check for file descriptor passing with msg_accrights
855 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
856  AC_TRY_COMPILE([#include <sys/types.h>
857 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
858                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
859 if test "$ac_cv_c_msg_accrights" = "yes"
860 then
861     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
864 dnl *** check for the need to define __i386__
866 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
867  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
869 #endif],
870  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
871 if test "$ac_cv_cpp_def_i386" = "yes"
872 then
873     CFLAGS="$CFLAGS -D__i386__"
874     LINTFLAGS="$LINTFLAGS -D__i386__"
877 dnl $GCC is set by autoconf
878 GCC_NO_BUILTIN=""
879 if test "$GCC" = "yes"
880 then
881     GCC_NO_BUILTIN="-fno-builtin"
883 AC_SUBST(GCC_NO_BUILTIN)
885 dnl **** Generate output files ****
887 MAKE_RULES=Make.rules
888 AC_SUBST_FILE(MAKE_RULES)
890 AC_OUTPUT([
891 Make.rules
892 Makefile
893 console/Makefile
894 controls/Makefile
895 debugger/Makefile
896 dlls/Makefile
897 dlls/advapi32/Makefile
898 dlls/avifil32/Makefile
899 dlls/comctl32/Makefile
900 dlls/commdlg/Makefile
901 dlls/crtdll/Makefile
902 dlls/dciman32/Makefile
903 dlls/display/Makefile
904 dlls/dplayx/Makefile
905 dlls/dsound/Makefile
906 dlls/icmp/Makefile
907 dlls/imagehlp/Makefile
908 dlls/imm32/Makefile
909 dlls/lzexpand/Makefile
910 dlls/mouse/Makefile
911 dlls/mpr/Makefile
912 dlls/msacm/Makefile
913 dlls/msacm32/Makefile
914 dlls/msnet32/Makefile
915 dlls/msvideo/Makefile
916 dlls/ntdll/Makefile
917 dlls/odbc32/Makefile
918 dlls/ole32/Makefile
919 dlls/oleaut32/Makefile
920 dlls/olecli/Makefile
921 dlls/oledlg/Makefile
922 dlls/olesvr/Makefile
923 dlls/psapi/Makefile
924 dlls/rasapi32/Makefile
925 dlls/shell32/Makefile
926 dlls/sound/Makefile
927 dlls/stress/Makefile
928 dlls/tapi32/Makefile
929 dlls/ver/Makefile
930 dlls/version/Makefile
931 dlls/win32s/Makefile
932 dlls/win87em/Makefile
933 dlls/winaspi/Makefile
934 dlls/windebug/Makefile
935 dlls/wing/Makefile
936 dlls/winmm/Makefile
937 dlls/winmm/mcianim/Makefile
938 dlls/winmm/mciavi/Makefile
939 dlls/winmm/mcicda/Makefile
940 dlls/winmm/mciseq/Makefile
941 dlls/winmm/mciwave/Makefile
942 dlls/winmm/midimap/Makefile
943 dlls/winmm/wavemap/Makefile
944 dlls/winmm/wineoss/Makefile
945 dlls/winspool/Makefile
946 dlls/wnaspi32/Makefile
947 documentation/Makefile
948 documentation/wine.conf.man
949 documentation/wine.man
950 files/Makefile
951 graphics/Makefile
952 graphics/enhmetafiledrv/Makefile
953 graphics/metafiledrv/Makefile
954 graphics/psdrv/Makefile
955 graphics/ttydrv/Makefile
956 graphics/win16drv/Makefile
957 graphics/x11drv/Makefile
958 if1632/Makefile
959 include/Makefile
960 library/Makefile
961 libtest/Makefile
962 loader/Makefile
963 loader/ne/Makefile
964 loader/dos/Makefile
965 memory/Makefile
966 misc/Makefile
967 miscemu/Makefile
968 msdos/Makefile
969 objects/Makefile
970 ole/Makefile
971 programs/Makefile
972 programs/clock/Makefile
973 programs/cmdlgtst/Makefile
974 programs/control/Makefile
975 programs/avitools/Makefile
976 programs/osversioncheck/Makefile
977 programs/notepad/Makefile
978 programs/progman/Makefile
979 programs/regtest/Makefile
980 programs/regapi/Makefile
981 programs/view/Makefile
982 programs/wcmd/Makefile
983 programs/winhelp/Makefile
984 programs/winver/Makefile
985 rc/Makefile
986 relay32/Makefile
987 resources/Makefile
988 scheduler/Makefile
989 server/Makefile
990 tools/Makefile
991 tools/wrc/Makefile
992 tsx11/Makefile
993 win32/Makefile
994 windows/Makefile
995 windows/ttydrv/Makefile
996 windows/x11drv/Makefile ])
998 if test "$have_x" = "no"
999 then
1000   echo
1001   echo "*** Warning: X development files not found. Wine will be built without"
1002   echo "*** X support, which currently does not work, and would probably not be"
1003   echo "*** what you want anyway. You will need to install devel packages of"
1004   echo "*** Xlib/Xfree86 and Xpm at the very least."
1005 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1006 then
1007   echo
1008   echo "*** Warning: Xpm development files not found. Wine will be built without"
1009   echo "*** Xpm support, which currently does not work. You will need to install"
1010   echo "*** devel packages of Xpm."
1013 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1014 then
1015   echo
1016   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1017   echo "*** terminal resize support. Consider upgrading ncurses."
1020 if test "$wine_cv_libc_reentrant" = "no" 
1021 then
1022   echo
1023   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1024   echo "*** thread support. Consider upgrading libc to a more recent"
1025   echo "*** reentrant version of libc."
1028 if test "$wine_cv_mesa_version_OK" = "no"
1029 then
1030   echo
1031   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1032   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
1035 echo
1036 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1037 echo
1039 dnl Local Variables:
1040 dnl comment-start: "dnl "
1041 dnl comment-end: ""
1042 dnl comment-start-skip: "\\bdnl\\b\\s *"
1043 dnl compile-command: "autoconf"
1044 dnl End: