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