Fixed invalid window refcount handling in RDW_Paint().
[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_FUNC_ALLOCA()
442 AC_CHECK_FUNCS(\
443         _lwp_create \
444         clone \
445         getpagesize \
446         memmove \
447         rfork \
448         sendmsg \
449         sigaltstack \
450         strerror \
451         stricmp \
452         tcgetattr \
453         timegm \
454         usleep \
455         vfscanf \
456         wait4 \
457         waitpid \
458 )
459
460 dnl **** Check for header files ****
461
462 AC_CHECK_HEADERS(\
463         arpa/nameser.h \
464         curses.h \
465         elf.h \
466         float.h \
467         libio.h \
468         linux/cdrom.h \
469         linux/ucdrom.h \
470         ncurses.h \
471         net/if.h \
472         netinet/in.h \
473         resolv.h \
474         strings.h \
475         sys/cdio.h \
476         sys/file.h \
477         sys/filio.h \
478         sys/lwp.h \
479         sys/modem.h \
480         sys/mount.h \
481         sys/param.h \
482         sys/sockio.h \
483         sys/statfs.h \
484         sys/strtio.h \
485         sys/syscall.h \
486         sys/vfs.h \
487         syscall.h \
488         ucontext.h \
489         unistd.h \
490         wctype.h \
491 )
492 AC_HEADER_STAT()
493
494 dnl **** Check for types ****
495
496 AC_C_CONST()
497 AC_C_INLINE()
498 AC_TYPE_SIZE_T()
499 AC_CHECK_SIZEOF(long long,0)
500
501 dnl **** statfs checks ****
502
503 if test "$ac_cv_header_sys_vfs_h" = "yes"
504 then
505     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
506                     wine_cv_sys_vfs_has_statfs,
507         AC_TRY_COMPILE([
508         #include <sys/types.h>
509         #ifdef HAVE_SYS_PARAM_H
510         # include <sys/param.h>
511         #endif
512         #include <sys/vfs.h>
513         ],[
514                 struct statfs stfs;
515
516                 memset(&stfs,0,sizeof(stfs));
517         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
518         )
519     )
520     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
521     then
522       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
523     fi
524 fi
525
526 if test "$ac_cv_header_sys_statfs_h" = "yes"
527 then
528     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
529                     wine_cv_sys_statfs_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/statfs.h>
536         ],[
537                 struct statfs stfs;
538         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
539         )
540     )
541     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
542     then
543       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
544     fi
545 fi
546
547 if test "$ac_cv_header_sys_mount_h" = "yes"
548 then
549     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
550                     wine_cv_sys_mount_has_statfs,
551         AC_TRY_COMPILE([
552         #include <sys/types.h>
553         #ifdef HAVE_SYS_PARAM_H
554         # include <sys/param.h>
555         #endif
556         #include <sys/mount.h>
557         ],[
558                 struct statfs stfs;
559         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
560         )
561     )
562     if test "$wine_cv_sys_mount_has_statfs" = "yes"
563     then
564       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
565     fi
566 fi
567
568 dnl **** FIXME: what about mixed cases, where we need two of them? ***
569
570 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
571   [ if test "x$statfs_bfree" = "xno"
572     then
573         wine_cv_statfs_bfree=no
574     else
575         AC_TRY_COMPILE([
576         #include <sys/types.h>
577         #ifdef HAVE_SYS_PARAM_H
578         # include <sys/param.h>
579         #endif
580         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
581         # include <sys/mount.h>
582         #else
583         # ifdef STATFS_DEFINED_BY_SYS_VFS
584         #  include <sys/vfs.h>
585         # else
586         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
587         #   include <sys/statfs.h>
588         #  endif
589         # endif
590         #endif
591         ],[
592                 struct statfs stfs;
593
594                 stfs.f_bfree++;
595         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
596         )
597     fi ] )
598 if test "$wine_cv_statfs_bfree" = "yes"
599 then
600   AC_DEFINE(STATFS_HAS_BFREE)
601 fi
602
603 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
604   [ if test "x$statfs_bavail" = "xno"
605     then
606         wine_cv_statfs_bavail=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_bavail++;
628         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
629         )
630     fi ] )
631 if test "$wine_cv_statfs_bavail" = "yes"
632 then
633   AC_DEFINE(STATFS_HAS_BAVAIL)
634 fi
635
636 dnl *** check for working sigaltstack
637 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
638
639 AC_CACHE_CHECK("for working sigaltstack",
640         ac_cv_c_working_sigaltstack,
641         AC_TRY_RUN([
642         #include <stdio.h>
643         #include <time.h> /* <sys/time.h> ? bad magic without end */
644         #include <sys/types.h>
645         #include <sys/signal.h>
646         #ifdef HAVE_SYS_PARAM_H
647         # include <sys/param.h>
648         #endif
649         #ifdef HAVE_SYSCALL_H
650         # include <syscall.h>
651         #else
652         # ifdef HAVE_SYS_SYSCALL_H
653         #  include <sys/syscall.h>
654         # endif
655         #endif
656         
657         unsigned char *xaltstack;
658
659         int
660         main(int argc,char **argv) {
661             struct sigaltstack  ss;
662
663             xaltstack = malloc(16384);
664             ss.ss_sp    = xaltstack;
665             ss.ss_size  = 16384;
666             ss.ss_flags = 0;
667             if (sigaltstack(&ss, NULL) < 0) {
668                 /* this catches the glibc case */
669                 perror("sigaltstack");
670                 return (1); /* aka exit(1) aka fail */
671             }
672             /* assume it works. */
673             return 0; /* OK */
674         }
675         ],
676         ac_cv_c_working_sigaltstack="yes",
677         ac_cv_c_working_sigaltstack="no",
678         ac_cv_c_working_sigaltstack="no"
679 ))
680
681 if test "$ac_cv_c_working_sigaltstack" = "yes"
682 then
683     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
684 fi
685
686
687 dnl *** check for file descriptor passing with msg_accrights
688
689 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
690  AC_TRY_COMPILE([#include <sys/types.h>
691 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
692                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
693 if test "$ac_cv_c_msg_accrights" = "yes"
694 then
695     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
696 fi
697
698 dnl *** check for the need to define __i386__
699
700 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
701  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
702 yes
703 #endif],
704  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
705 if test "$ac_cv_cpp_def_i386" = "yes"
706 then
707     CFLAGS="$CFLAGS -D__i386__"
708 fi
709
710 dnl $GCC is set by autoconf
711 GCC_NO_BUILTIN=""
712 if test "$GCC" = "yes"
713 then
714     GCC_NO_BUILTIN="-fno-builtin"
715 fi
716 AC_SUBST(GCC_NO_BUILTIN)
717
718 dnl **** Generate output files ****
719
720 MAKE_RULES=Make.rules
721 AC_SUBST_FILE(MAKE_RULES)
722
723 AC_OUTPUT([
724 Make.rules
725 Makefile
726 console/Makefile
727 controls/Makefile
728 debugger/Makefile
729 dlls/Makefile
730 dlls/advapi32/Makefile
731 dlls/avifil32/Makefile
732 dlls/comctl32/Makefile
733 dlls/commdlg/Makefile
734 dlls/imagehlp/Makefile
735 dlls/msacm/Makefile
736 dlls/msacm32/Makefile
737 dlls/ntdll/Makefile
738 dlls/psapi/Makefile
739 dlls/rasapi32/Makefile
740 dlls/shell32/Makefile
741 dlls/tapi32/Makefile
742 dlls/ver/Makefile
743 dlls/version/Makefile
744 dlls/winaspi/Makefile
745 dlls/wnaspi32/Makefile
746 documentation/Makefile
747 files/Makefile
748 graphics/Makefile
749 graphics/enhmetafiledrv/Makefile
750 graphics/metafiledrv/Makefile
751 graphics/psdrv/Makefile
752 graphics/ttydrv/Makefile
753 graphics/win16drv/Makefile
754 graphics/x11drv/Makefile
755 if1632/Makefile
756 include/Makefile
757 ipc/Makefile
758 library/Makefile
759 libtest/Makefile
760 loader/Makefile
761 loader/ne/Makefile
762 loader/dos/Makefile
763 memory/Makefile
764 misc/Makefile
765 miscemu/Makefile
766 msdos/Makefile
767 multimedia/Makefile
768 objects/Makefile
769 ole/Makefile
770 programs/Makefile
771 programs/clock/Makefile
772 programs/cmdlgtst/Makefile
773 programs/control/Makefile
774 programs/avitools/Makefile
775 programs/notepad/Makefile
776 programs/progman/Makefile
777 programs/regtest/Makefile
778 programs/regapi/Makefile
779 programs/view/Makefile
780 programs/winhelp/Makefile
781 programs/winver/Makefile
782 rc/Makefile
783 relay32/Makefile
784 resources/Makefile
785 scheduler/Makefile
786 server/Makefile
787 tools/Makefile
788 tools/wrc/Makefile
789 tsx11/Makefile
790 win32/Makefile
791 windows/Makefile
792 windows/ttydrv/Makefile
793 windows/x11drv/Makefile ])
794
795 if test "$have_x" = "no"
796 then
797   echo
798   echo "*** Warning: X development files not found. Wine will be built without"
799   echo "*** X support, which currently does not work, and would probably not be"
800   echo "*** what you want anyway. You will need to install devel packages of"
801   echo "*** Xlib/Xfree86 and Xpm at the very least."
802 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
803 then
804   echo
805   echo "*** Warning: Xpm development files not found. Wine will be built without"
806   echo "*** Xpm support, which currently does not work. You will need to install"
807   echo "*** devel packages of Xpm."
808 fi
809
810 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
811 then
812   echo
813   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
814   echo "*** terminal resize support. Consider upgrading ncurses."
815 fi
816
817 if test "$wine_cv_libc_reentrant" = "no" 
818 then
819   echo
820   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
821   echo "*** thread support. Consider upgrading libc to a more recent"
822   echo "*** reentrant version of libc."
823 fi
824
825 if test "$wine_cv_mesa_version_OK" = "no"
826 then
827   echo
828   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
829   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
830 fi
831
832 echo
833 echo "Configure finished.  Do 'make depend && make' to compile Wine."
834 echo
835
836 dnl Local Variables:
837 dnl comment-start: "dnl "
838 dnl comment-end: ""
839 dnl comment-start-skip: "\\bdnl\\b\\s *"
840 dnl compile-command: "autoconf"
841 dnl End: