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