Converted to the new debug interface.
[wine] / configure.in
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)
8
9 # We want these before the checks, so the checks can modify their values.
10 LIBS="$LIBS -lm"
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
12
13 dnl **** Command-line arguments ****
14
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.
21
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])
25
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])
29
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])
33
34 dnl AC_ARG_WITH(ipc,
35 dnl [  --enable-ipc            use inter-process communication for DDE],
36 dnl [if test "$enableval" = "no"; then : ; else OPTIONS="-DCONFIG_IPC"; fi])
37
38 AC_ARG_ENABLE(debug,
39 [  --disable-debug         compile out all debugging messages],
40 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
41
42 AC_ARG_ENABLE(trace,
43 [  --disable-trace         compile out TRACE messages],
44 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
45
46 AC_ARG_WITH(reentrant-x,
47 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
48
49 AC_SUBST(MAIN_TARGET)
50 AC_SUBST(LIB_TARGET)
51 AC_SUBST(ALT_LINK)
52 AC_SUBST(OPTIONS)
53
54 if test "$DEBUG_MSGS" = "no"
55 then
56     AC_DEFINE(NO_DEBUG_MSGS)
57     AC_DEFINE(NO_TRACE_MSGS)
58 else
59     if test "$TRACE_MSGS" = "no"
60     then
61         AC_DEFINE(NO_TRACE_MSGS)
62     fi
63 fi
64
65 dnl **** Check for some programs ****
66
67 AC_PROG_MAKE_SET
68 AC_PROG_CC
69 AC_PROG_CPP
70 AC_PATH_XTRA
71 AC_PROG_YACC
72 AC_PROG_LEX
73 AC_PROG_RANLIB
74 AC_PROG_INSTALL
75 AC_PROG_LN_S
76 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
77 AC_PATH_PROG(LDCONFIG, ldconfig, false, /sbin:/usr/sbin:$PATH)
78
79 dnl **** Check for some libraries ****
80
81 dnl Check for -li386 for NetBSD and OpenBSD
82 AC_CHECK_LIB(i386,i386_set_ldt)
83 dnl Check for -lossaudio for NetBSD
84 AC_CHECK_LIB(ossaudio,_oss_ioctl)
85 dnl Check for -lw for Solaris
86 AC_CHECK_LIB(w,iswalnum)
87 dnl Check for -lnsl for Solaris
88 AC_CHECK_FUNCS(gethostbyname,,AC_CHECK_LIB(nsl,gethostbyname))
89 dnl Check for -lsocket for Solaris
90 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
91 dnl Check for -lxpg4 for FreeBSD
92 AC_CHECK_LIB(xpg4,setrunelocale)
93 dnl Check for -lmmap for OS/2
94 AC_CHECK_LIB(mmap,mmap)
95
96 AC_CHECK_HEADERS(dlfcn.h,
97         AC_CHECK_FUNCS(dlopen,
98                 AC_DEFINE(HAVE_DL_API),
99                 AC_CHECK_LIB(dl,dlopen,
100                         AC_DEFINE(HAVE_DL_API)
101                         LIBS="$LIBS -ldl"
102                 )
103         )
104 )
105 AC_SUBST(XLIB)
106 if test "$have_x" = "yes"
107 then
108     XLIB="-lXext -lX11"
109     ac_save_CPPFLAGS="$CPPFLAGS"
110     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
111
112     dnl Check for -lXpm
113     AC_CHECK_HEADERS(X11/xpm.h)
114     if test "$ac_cv_header_X11_xpm_h" = "yes"
115     then 
116         AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
117     fi
118
119     dnl Check for X Shm extension
120     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/XShm.h)
121     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_XShm_h" = "yes"
122     then 
123         AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
124     fi
125     dnl Check for XFree86 DGA extension
126     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86dga.h)
127     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86dga_h" = "yes"
128     then 
129          AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
130     fi
131
132     dnl Check for XFree86 VMODE extension
133     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86vmode.h)
134     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
135     then 
136         AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11)
137     fi
138
139     dnl Check for the presence of Mesa
140     AC_CHECK_HEADERS(GL/gl.h GL/osmesa.h)
141     if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_osmesa_h" = "yes"
142     then
143         dnl Check for some problems due to old Mesa versions
144         AC_CACHE_CHECK("for up-to-date Mesa version", wine_cv_mesa_version_OK,
145           AC_TRY_COMPILE(
146             [#include <GL/gl.h>],
147             [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
148             [wine_cv_mesa_version_OK="yes"],
149             [wine_cv_mesa_version_OK="no"]
150           )
151         )
152
153         if test "$wine_cv_mesa_version_OK" = "yes"
154         then
155             dnl Check for the presense of the library
156             AC_CHECK_LIB(MesaGL,OSMesaCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm)
157         fi
158     fi
159
160     CPPFLAGS="$ac_save_CPPFLAGS"
161 else
162     XLIB=""
163     X_CFLAGS=""
164     X_LIBS=""
165 fi
166
167 dnl **** Check which curses lib to use ***
168 AC_CHECK_HEADERS(ncurses.h)
169 if test "$ac_cv_header_ncurses_h" = "yes"
170 then 
171     AC_CHECK_LIB(ncurses,waddch)
172 fi
173 if test "$ac_cv_lib_ncurses_waddch" = "yes"
174 then
175     AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
176     AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
177 else
178     AC_CHECK_HEADERS(curses.h)
179     if test "$ac_cv_header_curses_h" = "yes"
180     then    
181        AC_CHECK_LIB(curses,waddch)
182        AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
183        AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
184     fi
185 fi
186
187 dnl **** Check for IPX (currently Linux only) ****
188 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
189  AC_TRY_COMPILE(
190    [#include <sys/socket.h>
191     #include <netipx/ipx.h>],
192    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
193    [AC_DEFINE(HAVE_IPX_GNU)
194     ac_cv_c_ipx_gnu="yes"],
195    [ac_cv_c_ipx_gnu="no"])
196  )
197
198 if test "$ac_cv_c_ipx_gnu" = "no"
199 then
200  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
201   AC_TRY_COMPILE(
202     [#include <sys/socket.h>
203      #include <asm/types.h>
204      #include <linux/ipx.h>],
205     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
206     [AC_DEFINE(HAVE_IPX_LINUX)
207      ac_cv_c_ipx_linux="yes"],
208     [ac_cv_c_ipx_linux="no"])
209   )
210 fi
211
212 dnl **** Check for Open Sound System ****
213 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
214
215 AC_CACHE_CHECK("for Open Sound System",
216         ac_cv_c_opensoundsystem,
217         AC_TRY_COMPILE([
218         #if defined(HAVE_SYS_SOUNDCARD_H)
219                 #include <sys/soundcard.h>
220         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
221                 #include <machine/soundcard.h>
222         #elif defined(HAVE_SOUNDCARD_H)
223                 #include <soundcard.h>
224         #endif
225         ],[
226
227 /* check for one of the Open Sound System specific SNDCTL_ defines */
228 #if !defined(SNDCTL_DSP_STEREO)
229 #error No open sound system
230 #endif
231 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
232
233 if test "$ac_cv_c_opensoundsystem" = "yes"
234 then
235     AC_DEFINE(HAVE_OSS)
236 fi
237
238 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
239         ac_cv_c_opensoundsystem_midi,
240         AC_TRY_COMPILE([
241         #if defined(HAVE_SYS_SOUNDCARD_H)
242                 #include <sys/soundcard.h>
243         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
244                 #include <machine/soundcard.h>
245         #elif defined(HAVE_SOUNDCARD_H)
246                 #include <soundcard.h>
247         #endif
248         ],[
249
250 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
251 #if !defined(SNDCTL_SEQ_SYNC)
252 #error No open sound system MIDI interface
253 #endif
254 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
255
256 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
257 then
258     AC_DEFINE(HAVE_OSS_MIDI)
259 fi
260
261 dnl **** If ln -s doesn't work, use cp instead ****
262 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
263
264 dnl **** Check for gcc strength-reduce bug ****
265
266 if test "x${GCC}" = "xyes"
267 then
268   CFLAGS="$CFLAGS -Wall"
269   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
270                   AC_TRY_RUN([
271 int main(void) {
272   static int Array[[3]];
273   unsigned int B = 3;
274   int i;
275   for(i=0; i<B; i++) Array[[i]] = i - 3;
276   exit( Array[[1]] != -2 );
277 }],
278     ac_cv_c_gcc_strength_bug="no",
279     ac_cv_c_gcc_strength_bug="yes",
280     ac_cv_c_gcc_strength_bug="yes") )
281   if test "$ac_cv_c_gcc_strength_bug" = "yes"
282   then
283     CFLAGS="$CFLAGS -fno-strength-reduce"
284   fi
285 fi
286
287 dnl **** Check for underscore on external symbols ****
288
289 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
290                ac_cv_c_extern_prefix,
291 [saved_libs=$LIBS
292 LIBS="conftest_asm.s $LIBS"
293 cat > conftest_asm.s <<EOF
294         .globl _ac_test
295 _ac_test:
296         .long 0
297 EOF
298 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
299             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
300 LIBS=$saved_libs])
301 if test "$ac_cv_c_extern_prefix" = "yes"
302 then
303   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
304 fi
305
306 dnl **** Check for .string in assembler ****
307
308 AC_CACHE_CHECK("whether assembler accepts .string",
309                ac_cv_c_asm_string,
310 [saved_libs=$LIBS
311 LIBS="conftest_asm.s $LIBS"
312 cat > conftest_asm.s <<EOF
313         .string "test"
314 EOF
315 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
316 LIBS=$saved_libs])
317 if test "$ac_cv_c_asm_string" = "yes"
318 then
319   AC_DEFINE(HAVE_ASM_STRING)
320 fi
321
322 dnl **** Check for working dll ****
323
324 DLLFLAGS=""
325 LDSHARED=""
326 if test "$LIB_TARGET" = "libwine.so.1.0"
327 then
328   AC_CACHE_CHECK("whether we can build a Linux dll",
329                  ac_cv_c_dll_linux,
330   [saved_cflags=$CFLAGS
331   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
332   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
333   CFLAGS=$saved_cflags
334   ])
335   if test "$ac_cv_c_dll_linux" = "yes"
336   then
337     DLLFLAGS="-fPIC"
338     LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so"
339   else
340     AC_CACHE_CHECK("whether we can build a NetBSD dll",
341                    ac_cv_c_dll_netbsd,
342     [saved_cflags=$CFLAGS
343     CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
344     AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
345     CFLAGS=$saved_cflags
346     ])
347     if test "$ac_cv_c_dll_netbsd" = "yes"
348     then
349       DLLFLAGS="-fPIC"
350       LDSHARED="ld -Bshareable -Bforcearchive"
351     fi
352   fi
353   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
354   then
355     LIB_TARGET="libwine.a"
356   fi
357 fi
358 AC_SUBST(DLLFLAGS)
359 AC_SUBST(LDSHARED)
360
361 dnl **** Check for reentrant libc ****
362 dnl
363 dnl For cross-compiling we blindly assume that libc is reentrant. This is
364 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
365
366 wine_cv_libc_reentrant=no 
367 dnl 
368 dnl Linux style errno location
369 dnl 
370 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
371   [AC_TRY_RUN([int myerrno = 0;
372 char buf[256];
373 int *__errno_location(){return &myerrno;}
374 main(){connect(0,buf,255); exit(!myerrno);}],
375   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
376   wine_cv_libc_r__errno_location=yes )
377 ])
378 if test "$wine_cv_libc_r__errno_location" = "yes"
379 then
380     AC_DEFINE(HAVE__ERRNO_LOCATION)
381     wine_cv_libc_reentrant=__errno_location 
382 fi
383 dnl
384 dnl FreeBSD style errno location
385 dnl 
386 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
387   [AC_TRY_RUN([int myerrno = 0;
388 char buf[256];
389 int *__error(){return &myerrno;}
390 main(){connect(0,buf,255); exit(!myerrno);}],
391     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
392     wine_cv_libc_r__error=yes )
393 ])
394 if test "$wine_cv_libc_r__error" = "yes"
395 then
396     AC_DEFINE(HAVE__ERROR)
397     wine_cv_libc_reentrant=__error 
398 fi
399 dnl
400 dnl Solaris style errno location
401 dnl 
402 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
403   [AC_TRY_RUN([int myerrno = 0;
404 char buf[256];
405 int *___errno(){return &myerrno;}
406 main(){connect(0,buf,255); exit(!myerrno);}],
407     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
408     wine_cv_libc_r___errno=yes )
409 ])
410 if test "$wine_cv_libc_r___errno" = "yes"
411 then
412     AC_DEFINE(HAVE___ERRNO)
413     wine_cv_libc_reentrant=___errno 
414 fi
415 if test "$wine_cv_libc_reentrant" = "no" 
416 then
417   AC_DEFINE(NO_REENTRANT_LIBC)
418 fi
419
420 dnl **** Check for reentrant X libraries ****
421 dnl
422 dnl This may fail to determine whether X libraries are reentrant if
423 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
424 dnl is possible with the --without-reentrant-x option.
425
426 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
427 then
428 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
429   [ if test "x$with_reentrant_x" = "xno" 
430     then
431         wine_cv_x_reentrant=no
432     else
433         libX11_check=none
434         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
435             if test -r $dir/libX11.so; then
436                 libX11_check="-D $dir/libX11.so"
437                 break 1
438             fi
439             if test -r $dir/libX11.a; then
440                 libX11_check="$dir/libX11.a"
441                 break 1
442             fi
443         done
444         if test "$libX11_check" != "none"; then
445             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
446             then
447                 wine_cv_x_reentrant=yes
448             else
449                 wine_cv_x_reentrant=no
450             fi
451         else
452             wine_cv_x_reentrant=unknown
453         fi
454     fi ] )
455 else
456     wine_cv_x_reentrant=no
457 fi
458 if test "$wine_cv_x_reentrant" = "no"
459 then
460   AC_DEFINE(NO_REENTRANT_X11)
461 fi
462
463 dnl **** Check for functions ****
464
465 AC_FUNC_ALLOCA()
466 AC_CHECK_FUNCS(\
467         _lwp_create \
468         clone \
469         getpagesize \
470         memmove \
471         rfork \
472         sendmsg \
473         sigaltstack \
474         strerror \
475         stricmp \
476         tcgetattr \
477         timegm \
478         usleep \
479         vfscanf \
480         wait4 \
481         waitpid \
482 )
483
484 dnl **** Check for header files ****
485
486 AC_CHECK_HEADERS(\
487         arpa/nameser.h \
488         curses.h \
489         elf.h \
490         float.h \
491         libio.h \
492         linux/cdrom.h \
493         linux/ucdrom.h \
494         ncurses.h \
495         net/if.h \
496         netinet/in.h \
497         resolv.h \
498         strings.h \
499         sys/cdio.h \
500         sys/file.h \
501         sys/filio.h \
502         sys/lwp.h \
503         sys/modem.h \
504         sys/mount.h \
505         sys/param.h \
506         sys/sockio.h \
507         sys/statfs.h \
508         sys/strtio.h \
509         sys/syscall.h \
510         sys/vfs.h \
511         syscall.h \
512         ucontext.h \
513         unistd.h \
514         wctype.h \
515 )
516 AC_HEADER_STAT()
517
518 dnl **** Check for types ****
519
520 AC_C_CONST()
521 AC_C_INLINE()
522 AC_TYPE_SIZE_T()
523 AC_CHECK_SIZEOF(long long,0)
524
525 dnl **** statfs checks ****
526
527 if test "$ac_cv_header_sys_vfs_h" = "yes"
528 then
529     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
530                     wine_cv_sys_vfs_has_statfs,
531         AC_TRY_COMPILE([
532         #include <sys/types.h>
533         #ifdef HAVE_SYS_PARAM_H
534         # include <sys/param.h>
535         #endif
536         #include <sys/vfs.h>
537         ],[
538                 struct statfs stfs;
539
540                 memset(&stfs,0,sizeof(stfs));
541         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
542         )
543     )
544     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
545     then
546       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
547     fi
548 fi
549
550 if test "$ac_cv_header_sys_statfs_h" = "yes"
551 then
552     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
553                     wine_cv_sys_statfs_has_statfs,
554         AC_TRY_COMPILE([
555         #include <sys/types.h>
556         #ifdef HAVE_SYS_PARAM_H
557         # include <sys/param.h>
558         #endif
559         #include <sys/statfs.h>
560         ],[
561                 struct statfs stfs;
562         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
563         )
564     )
565     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
566     then
567       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
568     fi
569 fi
570
571 if test "$ac_cv_header_sys_mount_h" = "yes"
572 then
573     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
574                     wine_cv_sys_mount_has_statfs,
575         AC_TRY_COMPILE([
576         #include <sys/types.h>
577         #ifdef HAVE_SYS_PARAM_H
578         # include <sys/param.h>
579         #endif
580         #include <sys/mount.h>
581         ],[
582                 struct statfs stfs;
583         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
584         )
585     )
586     if test "$wine_cv_sys_mount_has_statfs" = "yes"
587     then
588       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
589     fi
590 fi
591
592 dnl **** FIXME: what about mixed cases, where we need two of them? ***
593
594 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
595   [ if test "x$statfs_bfree" = "xno"
596     then
597         wine_cv_statfs_bfree=no
598     else
599         AC_TRY_COMPILE([
600         #include <sys/types.h>
601         #ifdef HAVE_SYS_PARAM_H
602         # include <sys/param.h>
603         #endif
604         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
605         # include <sys/mount.h>
606         #else
607         # ifdef STATFS_DEFINED_BY_SYS_VFS
608         #  include <sys/vfs.h>
609         # else
610         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
611         #   include <sys/statfs.h>
612         #  endif
613         # endif
614         #endif
615         ],[
616                 struct statfs stfs;
617
618                 stfs.f_bfree++;
619         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
620         )
621     fi ] )
622 if test "$wine_cv_statfs_bfree" = "yes"
623 then
624   AC_DEFINE(STATFS_HAS_BFREE)
625 fi
626
627 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
628   [ if test "x$statfs_bavail" = "xno"
629     then
630         wine_cv_statfs_bavail=no
631     else
632         AC_TRY_COMPILE([
633         #include <sys/types.h>
634         #ifdef HAVE_SYS_PARAM_H
635         # include <sys/param.h>
636         #endif
637         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
638         # include <sys/mount.h>
639         #else
640         # ifdef STATFS_DEFINED_BY_SYS_VFS
641         #  include <sys/vfs.h>
642         # else
643         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
644         #   include <sys/statfs.h>
645         #  endif
646         # endif
647         #endif
648         ],[
649                 struct statfs stfs;
650
651                 stfs.f_bavail++;
652         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
653         )
654     fi ] )
655 if test "$wine_cv_statfs_bavail" = "yes"
656 then
657   AC_DEFINE(STATFS_HAS_BAVAIL)
658 fi
659
660 dnl *** check for working sigaltstack
661 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
662
663 AC_CACHE_CHECK("for working sigaltstack",
664         ac_cv_c_working_sigaltstack,
665         AC_TRY_RUN([
666         #include <stdio.h>
667         #include <time.h> /* <sys/time.h> ? bad magic without end */
668         #include <sys/types.h>
669         #include <sys/signal.h>
670         #ifdef HAVE_SYS_PARAM_H
671         # include <sys/param.h>
672         #endif
673         #ifdef HAVE_SYSCALL_H
674         # include <syscall.h>
675         #else
676         # ifdef HAVE_SYS_SYSCALL_H
677         #  include <sys/syscall.h>
678         # endif
679         #endif
680         
681         unsigned char *xaltstack;
682
683         int
684         main(int argc,char **argv) {
685             struct sigaltstack  ss;
686
687             xaltstack = malloc(16384);
688             ss.ss_sp    = xaltstack;
689             ss.ss_size  = 16384;
690             ss.ss_flags = 0;
691             if (sigaltstack(&ss, NULL) < 0) {
692                 /* this catches the glibc case */
693                 perror("sigaltstack");
694                 return (1); /* aka exit(1) aka fail */
695             }
696             /* assume it works. */
697             return 0; /* OK */
698         }
699         ],
700         ac_cv_c_working_sigaltstack="yes",
701         ac_cv_c_working_sigaltstack="no",
702         ac_cv_c_working_sigaltstack="no"
703 ))
704
705 if test "$ac_cv_c_working_sigaltstack" = "yes"
706 then
707     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
708 fi
709
710
711 dnl *** check for file descriptor passing with msg_accrights
712
713 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
714  AC_TRY_COMPILE([#include <sys/types.h>
715 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
716                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
717 if test "$ac_cv_c_msg_accrights" = "yes"
718 then
719     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
720 fi
721
722 dnl *** check for the need to define __i386__
723
724 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
725  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
726 yes
727 #endif],
728  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
729 if test "$ac_cv_cpp_def_i386" = "yes"
730 then
731     CFLAGS="$CFLAGS -D__i386__"
732 fi
733
734 dnl $GCC is set by autoconf
735 GCC_NO_BUILTIN=""
736 if test "$GCC" = "yes"
737 then
738     GCC_NO_BUILTIN="-fno-builtin"
739 fi
740 AC_SUBST(GCC_NO_BUILTIN)
741
742 dnl **** Generate output files ****
743
744 MAKE_RULES=Make.rules
745 AC_SUBST_FILE(MAKE_RULES)
746
747 AC_OUTPUT([
748 Make.rules
749 Makefile
750 console/Makefile
751 controls/Makefile
752 debugger/Makefile
753 dlls/Makefile
754 dlls/advapi32/Makefile
755 dlls/avifil32/Makefile
756 dlls/comctl32/Makefile
757 dlls/commdlg/Makefile
758 dlls/imagehlp/Makefile
759 dlls/msacm/Makefile
760 dlls/msacm32/Makefile
761 dlls/ntdll/Makefile
762 dlls/psapi/Makefile
763 dlls/rasapi32/Makefile
764 dlls/shell32/Makefile
765 dlls/tapi32/Makefile
766 dlls/ver/Makefile
767 dlls/version/Makefile
768 dlls/winaspi/Makefile
769 dlls/winspool/Makefile
770 dlls/wnaspi32/Makefile
771 documentation/Makefile
772 documentation/wine.man
773 files/Makefile
774 graphics/Makefile
775 graphics/enhmetafiledrv/Makefile
776 graphics/metafiledrv/Makefile
777 graphics/psdrv/Makefile
778 graphics/ttydrv/Makefile
779 graphics/win16drv/Makefile
780 graphics/x11drv/Makefile
781 if1632/Makefile
782 include/Makefile
783 ipc/Makefile
784 library/Makefile
785 libtest/Makefile
786 loader/Makefile
787 loader/ne/Makefile
788 loader/dos/Makefile
789 memory/Makefile
790 misc/Makefile
791 miscemu/Makefile
792 msdos/Makefile
793 multimedia/Makefile
794 objects/Makefile
795 ole/Makefile
796 programs/Makefile
797 programs/clock/Makefile
798 programs/cmdlgtst/Makefile
799 programs/control/Makefile
800 programs/avitools/Makefile
801 programs/notepad/Makefile
802 programs/progman/Makefile
803 programs/regtest/Makefile
804 programs/regapi/Makefile
805 programs/view/Makefile
806 programs/wcmd/Makefile
807 programs/winhelp/Makefile
808 programs/winver/Makefile
809 rc/Makefile
810 relay32/Makefile
811 resources/Makefile
812 scheduler/Makefile
813 server/Makefile
814 tools/Makefile
815 tools/wrc/Makefile
816 tsx11/Makefile
817 win32/Makefile
818 windows/Makefile
819 windows/ttydrv/Makefile
820 windows/x11drv/Makefile ])
821
822 if test "$have_x" = "no"
823 then
824   echo
825   echo "*** Warning: X development files not found. Wine will be built without"
826   echo "*** X support, which currently does not work, and would probably not be"
827   echo "*** what you want anyway. You will need to install devel packages of"
828   echo "*** Xlib/Xfree86 and Xpm at the very least."
829 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
830 then
831   echo
832   echo "*** Warning: Xpm development files not found. Wine will be built without"
833   echo "*** Xpm support, which currently does not work. You will need to install"
834   echo "*** devel packages of Xpm."
835 fi
836
837 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
838 then
839   echo
840   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
841   echo "*** terminal resize support. Consider upgrading ncurses."
842 fi
843
844 if test "$wine_cv_libc_reentrant" = "no" 
845 then
846   echo
847   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
848   echo "*** thread support. Consider upgrading libc to a more recent"
849   echo "*** reentrant version of libc."
850 fi
851
852 if test "$wine_cv_mesa_version_OK" = "no"
853 then
854   echo
855   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
856   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
857 fi
858
859 echo
860 echo "Configure finished.  Do 'make depend && make' to compile Wine."
861 echo
862
863 dnl Local Variables:
864 dnl comment-start: "dnl "
865 dnl comment-end: ""
866 dnl comment-start-skip: "\\bdnl\\b\\s *"
867 dnl compile-command: "autoconf"
868 dnl End: