Fixed off-by-one ordinals in MPR.
[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 dnl **** If ln -s doesn't work, use cp instead ****
238 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
239
240 dnl **** Check for gcc strength-reduce bug ****
241
242 if test "x${GCC}" = "xyes"
243 then
244   CFLAGS="$CFLAGS -Wall"
245   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
246                   AC_TRY_RUN([
247 int main(void) {
248   static int Array[[3]];
249   unsigned int B = 3;
250   int i;
251   for(i=0; i<B; i++) Array[[i]] = i - 3;
252   exit( Array[[1]] != -2 );
253 }],
254     ac_cv_c_gcc_strength_bug="no",
255     ac_cv_c_gcc_strength_bug="yes",
256     ac_cv_c_gcc_strength_bug="yes") )
257   if test "$ac_cv_c_gcc_strength_bug" = "yes"
258   then
259     CFLAGS="$CFLAGS -fno-strength-reduce"
260   fi
261 fi
262
263 dnl **** Check for underscore on external symbols ****
264
265 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
266                ac_cv_c_extern_prefix,
267 [saved_libs=$LIBS
268 LIBS="conftest_asm.s $LIBS"
269 cat > conftest_asm.s <<EOF
270         .globl _ac_test
271 _ac_test:
272         .long 0
273 EOF
274 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
275             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
276 LIBS=$saved_libs])
277 if test "$ac_cv_c_extern_prefix" = "yes"
278 then
279   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
280 fi
281
282 dnl **** Check for .string in assembler ****
283
284 AC_CACHE_CHECK("whether assembler accepts .string",
285                ac_cv_c_asm_string,
286 [saved_libs=$LIBS
287 LIBS="conftest_asm.s $LIBS"
288 cat > conftest_asm.s <<EOF
289         .string "test"
290 EOF
291 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
292 LIBS=$saved_libs])
293 if test "$ac_cv_c_asm_string" = "yes"
294 then
295   AC_DEFINE(HAVE_ASM_STRING)
296 fi
297
298 dnl **** Check for working dll ****
299
300 DLLFLAGS=""
301 LDSHARED=""
302 if test "$LIB_TARGET" = "libwine.so.1.0"
303 then
304   AC_CACHE_CHECK("whether we can build a Linux dll",
305                  ac_cv_c_dll_linux,
306   [saved_cflags=$CFLAGS
307   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
308   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
309   CFLAGS=$saved_cflags
310   ])
311   if test "$ac_cv_c_dll_linux" = "yes"
312   then
313     DLLFLAGS="-fPIC"
314     LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so"
315   else
316     AC_CACHE_CHECK("whether we can build a NetBSD dll",
317                    ac_cv_c_dll_netbsd,
318     [saved_cflags=$CFLAGS
319     CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
320     AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
321     CFLAGS=$saved_cflags
322     ])
323     if test "$ac_cv_c_dll_netbsd" = "yes"
324     then
325       DLLFLAGS="-fPIC"
326       LDSHARED="ld -Bshareable -Bforcearchive"
327     fi
328   fi
329   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
330   then
331     LIB_TARGET="libwine.a"
332   fi
333 fi
334 AC_SUBST(DLLFLAGS)
335 AC_SUBST(LDSHARED)
336
337 dnl **** Check for reentrant libc ****
338 dnl
339 dnl For cross-compiling we blindly assume that libc is reentrant. This is
340 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
341
342 wine_cv_libc_reentrant=no 
343 dnl 
344 dnl Linux style errno location
345 dnl 
346 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
347   [AC_TRY_RUN([int myerrno = 0;
348 char buf[256];
349 int *__errno_location(){return &myerrno;}
350 main(){connect(0,buf,255); exit(!myerrno);}],
351   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
352   wine_cv_libc_r__errno_location=yes )
353 ])
354 if test "$wine_cv_libc_r__errno_location" = "yes"
355 then
356     AC_DEFINE(HAVE__ERRNO_LOCATION)
357     wine_cv_libc_reentrant=__errno_location 
358 fi
359 dnl
360 dnl FreeBSD style errno location
361 dnl 
362 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
363   [AC_TRY_RUN([int myerrno = 0;
364 char buf[256];
365 int *__error(){return &myerrno;}
366 main(){connect(0,buf,255); exit(!myerrno);}],
367     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
368     wine_cv_libc_r__error=yes )
369 ])
370 if test "$wine_cv_libc_r__error" = "yes"
371 then
372     AC_DEFINE(HAVE__ERROR)
373     wine_cv_libc_reentrant=__error 
374 fi
375 dnl
376 dnl Solaris style errno location
377 dnl 
378 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
379   [AC_TRY_RUN([int myerrno = 0;
380 char buf[256];
381 int *___errno(){return &myerrno;}
382 main(){connect(0,buf,255); exit(!myerrno);}],
383     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
384     wine_cv_libc_r___errno=yes )
385 ])
386 if test "$wine_cv_libc_r___errno" = "yes"
387 then
388     AC_DEFINE(HAVE___ERRNO)
389     wine_cv_libc_reentrant=___errno 
390 fi
391 if test "$wine_cv_libc_reentrant" = "no" 
392 then
393   AC_DEFINE(NO_REENTRANT_LIBC)
394 fi
395
396 dnl **** Check for reentrant X libraries ****
397 dnl
398 dnl This may fail to determine whether X libraries are reentrant if
399 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
400 dnl is possible with the --without-reentrant-x option.
401
402 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
403 then
404 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
405   [ if test "x$with_reentrant_x" = "xno" 
406     then
407         wine_cv_x_reentrant=no
408     else
409         libX11_check=none
410         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
411             if test -r $dir/libX11.so; then
412                 libX11_check="-D $dir/libX11.so"
413                 break 1
414             fi
415             if test -r $dir/libX11.a; then
416                 libX11_check="$dir/libX11.a"
417                 break 1
418             fi
419         done
420         if test "$libX11_check" != "none"; then
421             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
422             then
423                 wine_cv_x_reentrant=yes
424             else
425                 wine_cv_x_reentrant=no
426             fi
427         else
428             wine_cv_x_reentrant=unknown
429         fi
430     fi ] )
431 else
432     wine_cv_x_reentrant=no
433 fi
434 if test "$wine_cv_x_reentrant" = "no"
435 then
436   AC_DEFINE(NO_REENTRANT_X11)
437 fi
438
439 dnl **** Check for functions ****
440
441 AC_CHECK_FUNCS(\
442         _lwp_create \
443         clone \
444         getpagesize \
445         memmove \
446         rfork \
447         sendmsg \
448         sigaltstack \
449         strerror \
450         stricmp \
451         tcgetattr \
452         timegm \
453         usleep \
454         vfscanf \
455         wait4 \
456         waitpid \
457 )
458
459 dnl **** Check for header files ****
460
461 AC_CHECK_HEADERS(\
462         arpa/nameser.h \
463         curses.h \
464         elf.h \
465         float.h \
466         libio.h \
467         linux/cdrom.h \
468         linux/ucdrom.h \
469         ncurses.h \
470         net/if.h \
471         netinet/in.h \
472         resolv.h \
473         strings.h \
474         sys/cdio.h \
475         sys/file.h \
476         sys/filio.h \
477         sys/lwp.h \
478         sys/modem.h \
479         sys/mount.h \
480         sys/param.h \
481         sys/sockio.h \
482         sys/statfs.h \
483         sys/strtio.h \
484         sys/syscall.h \
485         sys/vfs.h \
486         syscall.h \
487         ucontext.h \
488         unistd.h \
489         wctype.h \
490 )
491 AC_HEADER_STAT()
492
493 dnl **** Check for types ****
494
495 AC_C_CONST()
496 AC_C_INLINE()
497 AC_TYPE_SIZE_T()
498 AC_CHECK_SIZEOF(long long,0)
499
500 dnl **** statfs checks ****
501
502 if test "$ac_cv_header_sys_vfs_h" = "yes"
503 then
504     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
505                     wine_cv_sys_vfs_has_statfs,
506         AC_TRY_COMPILE([
507         #include <sys/types.h>
508         #ifdef HAVE_SYS_PARAM_H
509         # include <sys/param.h>
510         #endif
511         #include <sys/vfs.h>
512         ],[
513                 struct statfs stfs;
514
515                 memset(&stfs,0,sizeof(stfs));
516         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
517         )
518     )
519     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
520     then
521       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
522     fi
523 fi
524
525 if test "$ac_cv_header_sys_statfs_h" = "yes"
526 then
527     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
528                     wine_cv_sys_statfs_has_statfs,
529         AC_TRY_COMPILE([
530         #include <sys/types.h>
531         #ifdef HAVE_SYS_PARAM_H
532         # include <sys/param.h>
533         #endif
534         #include <sys/statfs.h>
535         ],[
536                 struct statfs stfs;
537         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
538         )
539     )
540     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
541     then
542       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
543     fi
544 fi
545
546 if test "$ac_cv_header_sys_mount_h" = "yes"
547 then
548     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
549                     wine_cv_sys_mount_has_statfs,
550         AC_TRY_COMPILE([
551         #include <sys/types.h>
552         #ifdef HAVE_SYS_PARAM_H
553         # include <sys/param.h>
554         #endif
555         #include <sys/mount.h>
556         ],[
557                 struct statfs stfs;
558         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
559         )
560     )
561     if test "$wine_cv_sys_mount_has_statfs" = "yes"
562     then
563       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
564     fi
565 fi
566
567 dnl **** FIXME: what about mixed cases, where we need two of them? ***
568
569 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
570   [ if test "x$statfs_bfree" = "xno"
571     then
572         wine_cv_statfs_bfree=no
573     else
574         AC_TRY_COMPILE([
575         #include <sys/types.h>
576         #ifdef HAVE_SYS_PARAM_H
577         # include <sys/param.h>
578         #endif
579         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
580         # include <sys/mount.h>
581         #else
582         # ifdef STATFS_DEFINED_BY_SYS_VFS
583         #  include <sys/vfs.h>
584         # else
585         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
586         #   include <sys/statfs.h>
587         #  endif
588         # endif
589         #endif
590         ],[
591                 struct statfs stfs;
592
593                 stfs.f_bfree++;
594         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
595         )
596     fi ] )
597 if test "$wine_cv_statfs_bfree" = "yes"
598 then
599   AC_DEFINE(STATFS_HAS_BFREE)
600 fi
601
602 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
603   [ if test "x$statfs_bavail" = "xno"
604     then
605         wine_cv_statfs_bavail=no
606     else
607         AC_TRY_COMPILE([
608         #include <sys/types.h>
609         #ifdef HAVE_SYS_PARAM_H
610         # include <sys/param.h>
611         #endif
612         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
613         # include <sys/mount.h>
614         #else
615         # ifdef STATFS_DEFINED_BY_SYS_VFS
616         #  include <sys/vfs.h>
617         # else
618         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
619         #   include <sys/statfs.h>
620         #  endif
621         # endif
622         #endif
623         ],[
624                 struct statfs stfs;
625
626                 stfs.f_bavail++;
627         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
628         )
629     fi ] )
630 if test "$wine_cv_statfs_bavail" = "yes"
631 then
632   AC_DEFINE(STATFS_HAS_BAVAIL)
633 fi
634
635 dnl *** check for working sigaltstack
636 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
637
638 AC_CACHE_CHECK("for working sigaltstack",
639         ac_cv_c_working_sigaltstack,
640         AC_TRY_RUN([
641         #include <stdio.h>
642         #include <time.h> /* <sys/time.h> ? bad magic without end */
643         #include <sys/types.h>
644         #include <sys/signal.h>
645         #ifdef HAVE_SYS_PARAM_H
646         # include <sys/param.h>
647         #endif
648         #ifdef HAVE_SYSCALL_H
649         # include <syscall.h>
650         #else
651         # ifdef HAVE_SYS_SYSCALL_H
652         #  include <sys/syscall.h>
653         # endif
654         #endif
655         
656         unsigned char *xaltstack;
657
658         int
659         main(int argc,char **argv) {
660             struct sigaltstack  ss;
661
662             xaltstack = malloc(16384);
663             ss.ss_sp    = xaltstack;
664             ss.ss_size  = 16384;
665             ss.ss_flags = 0;
666             if (sigaltstack(&ss, NULL) < 0) {
667                 /* this catches the glibc case */
668                 perror("sigaltstack");
669                 return (1); /* aka exit(1) aka fail */
670             }
671             /* assume it works. */
672             return 0; /* OK */
673         }
674         ],
675         ac_cv_c_working_sigaltstack="yes",
676         ac_cv_c_working_sigaltstack="no",
677         ac_cv_c_working_sigaltstack="no"
678 ))
679
680 if test "$ac_cv_c_working_sigaltstack" = "yes"
681 then
682     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
683 fi
684
685
686 dnl *** check for file descriptor passing with msg_accrights
687
688 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
689  AC_TRY_COMPILE([#include <sys/types.h>
690 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
691                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
692 if test "$ac_cv_c_msg_accrights" = "yes"
693 then
694     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
695 fi
696
697 dnl $GCC is set by autoconf
698 GCC_NO_BUILTIN=""
699 if test "$GCC" = "yes"
700 then
701     GCC_NO_BUILTIN="-fno-builtin"
702 fi
703 AC_SUBST(GCC_NO_BUILTIN)
704
705 dnl **** Generate output files ****
706
707 MAKE_RULES=Make.rules
708 AC_SUBST_FILE(MAKE_RULES)
709
710 AC_OUTPUT([
711 Make.rules
712 Makefile
713 console/Makefile
714 controls/Makefile
715 debugger/Makefile
716 dlls/Makefile
717 dlls/advapi32/Makefile
718 dlls/avifil32/Makefile
719 dlls/comctl32/Makefile
720 dlls/commdlg/Makefile
721 dlls/imagehlp/Makefile
722 dlls/msacm/Makefile
723 dlls/msacm32/Makefile
724 dlls/ntdll/Makefile
725 dlls/psapi/Makefile
726 dlls/rasapi32/Makefile
727 dlls/shell32/Makefile
728 dlls/tapi32/Makefile
729 dlls/ver/Makefile
730 dlls/version/Makefile
731 dlls/winaspi/Makefile
732 dlls/wnaspi32/Makefile
733 documentation/Makefile
734 files/Makefile
735 graphics/Makefile
736 graphics/enhmetafiledrv/Makefile
737 graphics/metafiledrv/Makefile
738 graphics/psdrv/Makefile
739 graphics/ttydrv/Makefile
740 graphics/win16drv/Makefile
741 graphics/x11drv/Makefile
742 if1632/Makefile
743 include/Makefile
744 ipc/Makefile
745 library/Makefile
746 libtest/Makefile
747 loader/Makefile
748 loader/ne/Makefile
749 loader/dos/Makefile
750 memory/Makefile
751 misc/Makefile
752 miscemu/Makefile
753 msdos/Makefile
754 multimedia/Makefile
755 objects/Makefile
756 ole/Makefile
757 programs/Makefile
758 programs/clock/Makefile
759 programs/cmdlgtst/Makefile
760 programs/control/Makefile
761 programs/avitools/Makefile
762 programs/notepad/Makefile
763 programs/progman/Makefile
764 programs/regtest/Makefile
765 programs/regapi/Makefile
766 programs/view/Makefile
767 programs/winhelp/Makefile
768 programs/winver/Makefile
769 rc/Makefile
770 relay32/Makefile
771 resources/Makefile
772 scheduler/Makefile
773 server/Makefile
774 tools/Makefile
775 tools/wrc/Makefile
776 tsx11/Makefile
777 win32/Makefile
778 windows/Makefile
779 windows/ttydrv/Makefile
780 windows/x11drv/Makefile ])
781
782 if test "$have_x" = "no"
783 then
784   echo
785   echo "*** Warning: X development files not found. Wine will be built without"
786   echo "*** X support, which currently does not work, and would probably not be"
787   echo "*** what you want anyway. You will need to install devel packages of"
788   echo "*** Xlib/Xfree86 and Xpm at the very least."
789 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
790 then
791   echo
792   echo "*** Warning: Xpm development files not found. Wine will be built without"
793   echo "*** Xpm support, which currently does not work. You will need to install"
794   echo "*** devel packages of Xpm."
795 fi
796
797 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
798 then
799   echo
800   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
801   echo "*** terminal resize support. Consider upgrading ncurses."
802 fi
803
804 if test "$wine_cv_libc_reentrant" = "no" 
805 then
806   echo
807   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
808   echo "*** thread support. Consider upgrading libc to a more recent"
809   echo "*** reentrant version of libc."
810 fi
811
812 if test "$wine_cv_mesa_version_OK" = "no"
813 then
814   echo
815   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
816   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
817 fi
818
819 echo
820 echo "Configure finished.  Do 'make depend && make' to compile Wine."
821 echo
822
823 dnl Local Variables:
824 dnl comment-start: "dnl "
825 dnl comment-end: ""
826 dnl comment-start-skip: "\\bdnl\\b\\s *"
827 dnl compile-command: "autoconf"
828 dnl End: