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