Added missing goto in switch statement.
[wine.git] / configure.in
blobba6346cb22501df02e62e57942bcdd300c0995f7
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)
9 # We want these before the checks, so the checks can modify their values.
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
13 dnl **** Command-line arguments ****
15 dnl Default values
16 EMU_TARGET=wine
17 LIBEXT=so       # library type .so or .a
18 TRACE_MSGS=yes  # the TRACE() macro
19 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
21 AC_ARG_ENABLE(emulator,
22 [  --disable-emulator      build only the Wine library, not the emulator],
23 [if test "$enableval" = "no"; then EMU_TARGET=""; fi])
25 AC_ARG_ENABLE(dll,
26 [  --disable-dll           build static libraries instead of DLLs],
27 [if test "$enableval" = "no"; then LIBEXT="a"; fi])
29 AC_ARG_ENABLE(debug,
30 [  --disable-debug         compile out all debugging messages],
31 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
33 AC_ARG_ENABLE(trace,
34 [  --disable-trace         compile out TRACE messages],
35 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
37 AC_ARG_WITH(reentrant-x,
38 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
40 AC_SUBST(EMU_TARGET)
41 AC_SUBST(OPTIONS)
43 if test "$DEBUG_MSGS" = "no"
44 then
45     AC_DEFINE(NO_DEBUG_MSGS)
46     AC_DEFINE(NO_TRACE_MSGS)
47 else
48     if test "$TRACE_MSGS" = "no"
49     then
50         AC_DEFINE(NO_TRACE_MSGS)
51     fi
54 dnl **** Check for some programs ****
56 AC_PROG_MAKE_SET
57 AC_PROG_CC
58 AC_PROG_CPP
59 AC_PATH_XTRA
60 AC_PROG_YACC
61 AC_PROG_LEX
62 AC_PROG_RANLIB
63 AC_PROG_INSTALL
64 AC_PROG_LN_S
65 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
66 AC_PATH_PROG(LDCONFIG, ldconfig, true, /sbin:/usr/sbin:$PATH)
68 dnl Check for lint
69 AC_CHECK_PROGS(LINT, lclint lint)
70 if test "$LINT" = "lint"
71 then
72   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
73   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
75 AC_SUBST(LINT)
76 AC_SUBST(LINTFLAGS)
78 dnl **** Check for some libraries ****
80 dnl Check for -lm for BeOS
81 AC_CHECK_LIB(m,sqrt)
82 dnl Check for -li386 for NetBSD and OpenBSD
83 AC_CHECK_LIB(i386,i386_set_ldt)
84 dnl Check for -lossaudio for NetBSD
85 AC_CHECK_LIB(ossaudio,_oss_ioctl)
86 dnl Check for -lw for Solaris
87 AC_CHECK_LIB(w,iswalnum)
88 dnl Check for -lnsl for Solaris
89 AC_CHECK_FUNCS(gethostbyname,, AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl", AC_CHECK_LIB(socket, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl", , -lnsl), -lsocket))
90 dnl Check for -lsocket for Solaris
91 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
92 dnl Check for -lxpg4 for FreeBSD
93 AC_CHECK_LIB(xpg4,setrunelocale)
94 dnl Check for -lmmap for OS/2
95 AC_CHECK_LIB(mmap,mmap)
96 dnl Check for openpty
97 AC_CHECK_FUNCS(openpty,,
98         AC_CHECK_LIB(util,openpty,
99                 AC_DEFINE(HAVE_OPENPTY)
100                 LIBS="$LIBS -lutil"
101         ))
103 AC_CHECK_HEADERS(dlfcn.h,
104         AC_CHECK_FUNCS(dlopen,
105                 AC_DEFINE(HAVE_DL_API),
106                 AC_CHECK_LIB(dl,dlopen,
107                         AC_DEFINE(HAVE_DL_API)
108                         LIBS="$LIBS -ldl"
109                 )
110         )
112 AC_SUBST(XLIB)
113 if test "$have_x" = "yes"
114 then
115     XLIB="-lXext -lX11"
116     ac_save_CPPFLAGS="$CPPFLAGS"
117     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
119     dnl Check for -lXpm
120     AC_CHECK_HEADERS(X11/xpm.h)
121     if test "$ac_cv_header_X11_xpm_h" = "yes"
122     then 
123         AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
124     else
125         echo "When compiling with X support, you need the Xpm library, or"
126         echo "WINE will not work. This Xpm library is within the following RPM,"
127         echo "which you need to install:"
128         echo "Redhat            :       xpm, xpm-devel"
129         echo "Caldera OpenLinux :       xpm, xpm-devel, xpm-devel-static"
130         echo "SuSE:                     xpm"
131         echo
132         echo "Or get the sources from ftp.x.org and all its mirror sites from "
133         echo "the directory /contrib/libraries."
134         echo
135         exit 1
136     fi
139     dnl Check for X Shm extension
140     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/XShm.h)
141     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_XShm_h" = "yes"
142     then 
143         AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
144     fi
145     dnl Check for XFree86 DGA / DGA 2.0 extension
146     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86dga.h)
147     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86dga_h" = "yes"
148     then 
149          AC_CHECK_LIB(Xxf86dga,
150                       XDGAQueryExtension,
151                       AC_DEFINE(HAVE_LIBXXF86DGA2) AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
152          if test "$ac_cv_lib_Xxf86dga_XDGAQueryExtension" = "no"
153          then
154            AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
155          fi
156     fi
158     dnl Check for XFree86 VMODE extension
159     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86vmode.h)
160     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
161     then 
162         AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
163     fi
165     dnl Check for the presence of Mesa
166     AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/osmesa.h)
167     if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
168     then
169         dnl Check for some problems due to old Mesa versions
170         AC_CACHE_CHECK("for up-to-date Mesa version", wine_cv_mesa_version_OK,
171           AC_TRY_COMPILE(
172             [#include <GL/gl.h>],
173             [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
174             [wine_cv_mesa_version_OK="yes"],
175             [wine_cv_mesa_version_OK="no"]
176           )
177         )
179         if test "$wine_cv_mesa_version_OK" = "yes"
180         then
181             dnl Check for the presense of the library
182             AC_CHECK_LIB(GL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lGL",,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
183             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
184             then
185                 AC_CHECK_LIB(MesaGL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
186             fi
188             dnl Check for the Color Table and Paletted Texture extensions
189             AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
190               AC_TRY_COMPILE(
191                 [#include <GL/gl.h>],
192                 [GLenum test = GL_COLOR_INDEX8_EXT;],
193                 [AC_DEFINE(HAVE_GL_COLOR_TABLE)],
194               )
195             )
196             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
197             then
198                 AC_CHECK_LIB(MesaGL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
199             else
200                 AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
201             fi
202         fi
203     fi
205     CPPFLAGS="$ac_save_CPPFLAGS"
206 else
207     XLIB=""
208     X_CFLAGS=""
209     X_LIBS=""
212 dnl **** Check which curses lib to use ***
213 AC_CHECK_HEADERS(ncurses.h)
214 if test "$ac_cv_header_ncurses_h" = "yes"
215 then 
216     AC_CHECK_LIB(ncurses,waddch)
218 if test "$ac_cv_lib_ncurses_waddch" = "yes"
219 then
220     AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
221     AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
222 else
223     AC_CHECK_HEADERS(curses.h)
224     if test "$ac_cv_header_curses_h" = "yes"
225     then    
226        AC_CHECK_LIB(curses,waddch)
227        AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
228        AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
229     fi
232 dnl **** Check for IPX (currently Linux only) ****
233 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
234  AC_TRY_COMPILE(
235    [#include <sys/socket.h>
236     #include <netipx/ipx.h>],
237    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
238    [ac_cv_c_ipx_gnu="yes"],
239    [ac_cv_c_ipx_gnu="no"])
241 if test "$ac_cv_c_ipx_gnu" = "yes"
242 then
243     AC_DEFINE(HAVE_IPX_GNU)
246 if test "$ac_cv_c_ipx_gnu" = "no"
247 then
248  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
249   AC_TRY_COMPILE(
250     [#include <sys/socket.h>
251      #include <asm/types.h>
252      #include <linux/ipx.h>],
253     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
254     [ac_cv_c_ipx_linux="yes"],
255     [ac_cv_c_ipx_linux="no"])
256   )
257   if test "$ac_cv_c_ipx_linux" = "yes"
258   then
259       AC_DEFINE(HAVE_IPX_LINUX)
260   fi
263 dnl **** Check for Open Sound System ****
264 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
266 AC_CACHE_CHECK("for Open Sound System",
267         ac_cv_c_opensoundsystem,
268         AC_TRY_COMPILE([
269         #if defined(HAVE_SYS_SOUNDCARD_H)
270                 #include <sys/soundcard.h>
271         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
272                 #include <machine/soundcard.h>
273         #elif defined(HAVE_SOUNDCARD_H)
274                 #include <soundcard.h>
275         #endif
276         ],[
278 /* check for one of the Open Sound System specific SNDCTL_ defines */
279 #if !defined(SNDCTL_DSP_STEREO)
280 #error No open sound system
281 #endif
282 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
284 if test "$ac_cv_c_opensoundsystem" = "yes"
285 then
286     AC_DEFINE(HAVE_OSS)
289 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
290         ac_cv_c_opensoundsystem_midi,
291         AC_TRY_COMPILE([
292         #if defined(HAVE_SYS_SOUNDCARD_H)
293                 #include <sys/soundcard.h>
294         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
295                 #include <machine/soundcard.h>
296         #elif defined(HAVE_SOUNDCARD_H)
297                 #include <soundcard.h>
298         #endif
299         ],[
301 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
302 #if !defined(SNDCTL_SEQ_SYNC)
303 #error No open sound system MIDI interface
304 #endif
305 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
307 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
308 then
309     AC_DEFINE(HAVE_OSS_MIDI)
312 dnl **** If ln -s doesn't work, use cp instead ****
313 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
315 dnl **** Check for gcc strength-reduce bug ****
317 if test "x${GCC}" = "xyes"
318 then
319   CFLAGS="$CFLAGS -Wall"
320   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
321                   AC_TRY_RUN([
322 int main(void) {
323   static int Array[[3]];
324   unsigned int B = 3;
325   int i;
326   for(i=0; i<B; i++) Array[[i]] = i - 3;
327   exit( Array[[1]] != -2 );
329     ac_cv_c_gcc_strength_bug="no",
330     ac_cv_c_gcc_strength_bug="yes",
331     ac_cv_c_gcc_strength_bug="yes") )
332   if test "$ac_cv_c_gcc_strength_bug" = "yes"
333   then
334     CFLAGS="$CFLAGS -fno-strength-reduce"
335   fi
338 dnl **** Check for underscore on external symbols ****
340 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
341                ac_cv_c_extern_prefix,
342 [saved_libs=$LIBS
343 LIBS="conftest_asm.s $LIBS"
344 cat > conftest_asm.s <<EOF
345         .globl _ac_test
346 _ac_test:
347         .long 0
349 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
350             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
351 LIBS=$saved_libs])
352 if test "$ac_cv_c_extern_prefix" = "yes"
353 then
354   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
357 dnl **** Check for .string in assembler ****
359 AC_CACHE_CHECK("whether assembler accepts .string",
360                ac_cv_c_asm_string,
361 [saved_libs=$LIBS
362 LIBS="conftest_asm.s $LIBS"
363 cat > conftest_asm.s <<EOF
364         .string "test"
366 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
367 LIBS=$saved_libs])
368 if test "$ac_cv_c_asm_string" = "yes"
369 then
370   AC_DEFINE(HAVE_ASM_STRING)
373 dnl **** Check for working dll ****
375 LDSHARED=""
376 if test "$LIBEXT" = "so"
377 then
378   AC_CACHE_CHECK("whether we can build a Linux dll",
379                  ac_cv_c_dll_linux,
380   [saved_cflags=$CFLAGS
381   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
382   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
383   CFLAGS=$saved_cflags
384   ])
385   if test "$ac_cv_c_dll_linux" = "yes"
386   then
387     LDSHARED="\$(CC) -shared -Wl,-soname,\$(SONAME),-rpath,\$(libdir)"
388   else
389     AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
390                  ac_cv_c_dll_unixware,
391     [saved_cflags=$CFLAGS
392     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0"
393     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
394     CFLAGS=$saved_cflags
395     ])
396     if test "$ac_cv_c_dll_unixware" = "yes"
397     then
398       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/\$(SONAME)"
399     else
400       AC_CACHE_CHECK("whether we can build a NetBSD dll",
401                    ac_cv_c_dll_netbsd,
402       [saved_cflags=$CFLAGS
403       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
404       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
405       CFLAGS=$saved_cflags
406       ])
407       if test "$ac_cv_c_dll_netbsd" = "yes"
408       then
409         LDSHARED="ld -Bshareable -Bforcearchive"
410       fi
411     fi
412   fi
413   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
414   then
415     LIBEXT="a"
416   fi
419 DLLFLAGS=""
420 BUILDFLAGS=""
421 DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine"
423 if test "$LIBEXT" = "so"; then
424     BUILDFLAGS="-pic"
425     DLLFLAGS="-fPIC"
426 else
427     AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)],
428                    ac_cv_c_whole_archive,
429             [saved_cflags=$CFLAGS
430             CFLAGS="$CFLAGS -Wl,--whole-archive -Wl,--no-whole-archive"
431             AC_TRY_LINK(,[return 1],ac_cv_c_whole_archive="yes",ac_cv_c_whole_archive="no")
432             CFLAGS=$saved_cflags
433             ])
434     if test "$ac_cv_c_whole_archive" = "yes"
435     then
436         DLL_LINK="-Wl,--whole-archive $DLL_LINK -Wl,--no-whole-archive"
437     else
438         AC_CACHE_CHECK([whether the linker supports -z {all,default}extract (Linux)],
439                        ac_cv_c_allextract,
440                 [saved_cflags=$CFLAGS
441                 CFLAGS="$CFLAGS -Wl,-z,allextract -Wl,-z,defaultextract"
442                 AC_TRY_LINK(,[return 1],ac_cv_c_allextract="yes",ac_cv_c_allextract="no")
443                 CFLAGS=$saved_cflags
444                 ])
445         if test "$ac_cv_c_allextract" = "yes"
446         then
447             DLL_LINK="-Wl,-z,allextract $DLL_LINK -Wl,-z,defaultextract"
448         fi
449     fi
452 AC_SUBST(DLL_LINK)
453 AC_SUBST(BUILDFLAGS)
454 AC_SUBST(DLLFLAGS)
455 AC_SUBST(LDSHARED)
456 AC_SUBST(LIBEXT)
458 dnl **** Check for reentrant libc ****
460 dnl For cross-compiling we blindly assume that libc is reentrant. This is
461 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
463 wine_cv_libc_reentrant=no 
464 dnl 
465 dnl Linux style errno location
466 dnl 
467 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
468   [AC_TRY_RUN([int myerrno = 0;
469 char buf[256];
470 int *__errno_location(){return &myerrno;}
471 main(){connect(0,buf,255); exit(!myerrno);}],
472   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
473   wine_cv_libc_r__errno_location=yes )
475 if test "$wine_cv_libc_r__errno_location" = "yes"
476 then
477     AC_DEFINE(HAVE__ERRNO_LOCATION)
478     wine_cv_libc_reentrant=__errno_location 
481 dnl FreeBSD style errno location
482 dnl 
483 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
484   [AC_TRY_RUN([int myerrno = 0;
485 char buf[256];
486 int *__error(){return &myerrno;}
487 main(){connect(0,buf,255); exit(!myerrno);}],
488     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
489     wine_cv_libc_r__error=yes )
491 if test "$wine_cv_libc_r__error" = "yes"
492 then
493     AC_DEFINE(HAVE__ERROR)
494     wine_cv_libc_reentrant=__error 
497 dnl Solaris style errno location
498 dnl 
499 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
500   [AC_TRY_RUN([int myerrno = 0;
501 char buf[256];
502 int *___errno(){return &myerrno;}
503 main(){connect(0,buf,255); exit(!myerrno);}],
504     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
505     wine_cv_libc_r___errno=yes )
507 if test "$wine_cv_libc_r___errno" = "yes"
508 then
509     AC_DEFINE(HAVE___ERRNO)
510     wine_cv_libc_reentrant=___errno 
513 dnl UnixWare style errno location
514 dnl 
515 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
516   [AC_TRY_RUN([int myerrno = 0;
517 char buf[256];
518 int *__thr_errno(){return &myerrno;}
519 main(){connect(0,buf,255); exit(!myerrno);}],
520     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
521     wine_cv_libc_r__thr_errno=yes )
523 if test "$wine_cv_libc_r__thr_errno" = "yes"
524 then
525     AC_DEFINE(HAVE__THR_ERRNO)
526     wine_cv_libc_reentrant=__thr_errno 
528 if test "$wine_cv_libc_reentrant" = "no" 
529 then
530   AC_DEFINE(NO_REENTRANT_LIBC)
533 dnl **** Check for reentrant X libraries ****
535 dnl This may fail to determine whether X libraries are reentrant if
536 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
537 dnl is possible with the --without-reentrant-x option.
539 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
540 then
541 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
542   [ if test "x$with_reentrant_x" = "xno" 
543     then
544         wine_cv_x_reentrant=no
545     else
546         libX11_check=none
547         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
548             if test -r $dir/libX11.so; then
549                 libX11_check="-D $dir/libX11.so"
550                 break 1
551             fi
552             if test -r $dir/libX11.a; then
553                 libX11_check="$dir/libX11.a"
554                 break 1
555             fi
556         done
557         if test "$libX11_check" != "none"; then
558             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
559             then
560                 wine_cv_x_reentrant=yes
561             else
562                 wine_cv_x_reentrant=no
563             fi
564         else
565             wine_cv_x_reentrant=unknown
566         fi
567     fi ] )
568 else
569     wine_cv_x_reentrant=no
571 if test "$wine_cv_x_reentrant" = "no"
572 then
573   AC_DEFINE(NO_REENTRANT_X11)
576 dnl **** Check for endianness ****
578 AC_C_BIGENDIAN
580 dnl **** Check for functions ****
582 AC_FUNC_ALLOCA()
583 AC_CHECK_FUNCS(\
584         _lwp_create \
585         clone \
586         getnetbyaddr \
587         getnetbyname \
588         getpagesize \
589         getprotobyname \
590         getprotobynumber \
591         getservbyport \
592         getsockopt \
593         inet_network \
594         memmove \
595         rfork \
596         select \
597         sendmsg \
598         settimeofday \
599         sigaltstack \
600         statfs \
601         strcasecmp \
602         strerror \
603         strncasecmp \
604         tcgetattr \
605         timegm \
606         usleep \
607         vfscanf \
608         wait4 \
609         waitpid \
612 dnl **** Check for header files ****
614 AC_CHECK_HEADERS(\
615         a.out.h \
616         a_out.h \
617         arpa/inet.h \
618         arpa/nameser.h \
619         curses.h \
620         elf.h \
621         float.h \
622         libio.h \
623         link.h \
624         linux/cdrom.h \
625         linux/joystick.h \
626         linux/ucdrom.h \
627         ncurses.h \
628         net/if.h \
629         netinet/in.h \
630         netinet/tcp.h \
631         pty.h \
632         resolv.h \
633         sched.h \
634         socket.h \
635         strings.h \
636         sys/cdio.h \
637         sys/errno.h \
638         sys/file.h \
639         sys/filio.h \
640         sys/ipc.h \
641         sys/lwp.h \
642         sys/mman.h \
643         sys/modem.h \
644         sys/mount.h \
645         sys/msg.h \
646         sys/param.h \
647         sys/reg.h \
648         sys/signal.h \
649         sys/shm.h \
650         sys/socket.h \
651         sys/sockio.h \
652         sys/statfs.h \
653         sys/strtio.h \
654         sys/syscall.h \
655         sys/wait.h \
656         sys/v86.h \
657         sys/v86intr.h \
658         sys/vfs.h \
659         sys/vm86.h \
660         syscall.h \
661         ucontext.h \
662         wctype.h \
664 AC_HEADER_STAT()
666 dnl **** Check for types ****
668 AC_C_CONST()
669 AC_C_INLINE()
670 AC_TYPE_SIZE_T()
671 AC_CHECK_SIZEOF(long long,0)
673 if test "$ac_cv_header_linux_joystick_h" = "yes"
674 then
675    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
676         wine_cv_linux_joystick_22_api,
677         AC_TRY_COMPILE([
678         #include <sys/ioctl.h>
679         #include <linux/joystick.h>
681         struct js_event blub;
682         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
683         #error "no 2.2 header"
684         #endif
685         ],/*empty*/,
686         wine_cv_linux_joystick_22_api=yes,
687         wine_cv_linux_joystick_22_api=no,
688         wine_cv_linux_joystick_22_api=no
689         )
690    )
691    if test "$wine_cv_linux_joystick_22_api"
692    then
693       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
694    fi
697 dnl **** statfs checks ****
699 if test "$ac_cv_header_sys_vfs_h" = "yes"
700 then
701     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
702                     wine_cv_sys_vfs_has_statfs,
703         AC_TRY_COMPILE([
704         #include <sys/types.h>
705         #ifdef HAVE_SYS_PARAM_H
706         # include <sys/param.h>
707         #endif
708         #include <sys/vfs.h>
709         ],[
710                 struct statfs stfs;
712                 memset(&stfs,0,sizeof(stfs));
713         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
714         )
715     )
716     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
717     then
718       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
719     fi
722 if test "$ac_cv_header_sys_statfs_h" = "yes"
723 then
724     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
725                     wine_cv_sys_statfs_has_statfs,
726         AC_TRY_COMPILE([
727         #include <sys/types.h>
728         #ifdef HAVE_SYS_PARAM_H
729         # include <sys/param.h>
730         #endif
731         #include <sys/statfs.h>
732         ],[
733                 struct statfs stfs;
734         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
735         )
736     )
737     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
738     then
739       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
740     fi
743 if test "$ac_cv_header_sys_mount_h" = "yes"
744 then
745     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
746                     wine_cv_sys_mount_has_statfs,
747         AC_TRY_COMPILE([
748         #include <sys/types.h>
749         #ifdef HAVE_SYS_PARAM_H
750         # include <sys/param.h>
751         #endif
752         #include <sys/mount.h>
753         ],[
754                 struct statfs stfs;
755         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
756         )
757     )
758     if test "$wine_cv_sys_mount_has_statfs" = "yes"
759     then
760       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
761     fi
764 dnl **** FIXME: what about mixed cases, where we need two of them? ***
766 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
767   [ if test "x$statfs_bfree" = "xno"
768     then
769         wine_cv_statfs_bfree=no
770     else
771         AC_TRY_COMPILE([
772         #include <sys/types.h>
773         #ifdef HAVE_SYS_PARAM_H
774         # include <sys/param.h>
775         #endif
776         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
777         # include <sys/mount.h>
778         #else
779         # ifdef STATFS_DEFINED_BY_SYS_VFS
780         #  include <sys/vfs.h>
781         # else
782         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
783         #   include <sys/statfs.h>
784         #  endif
785         # endif
786         #endif
787         ],[
788                 struct statfs stfs;
790                 stfs.f_bfree++;
791         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
792         )
793     fi ] )
794 if test "$wine_cv_statfs_bfree" = "yes"
795 then
796   AC_DEFINE(STATFS_HAS_BFREE)
799 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
800   [ if test "x$statfs_bavail" = "xno"
801     then
802         wine_cv_statfs_bavail=no
803     else
804         AC_TRY_COMPILE([
805         #include <sys/types.h>
806         #ifdef HAVE_SYS_PARAM_H
807         # include <sys/param.h>
808         #endif
809         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
810         # include <sys/mount.h>
811         #else
812         # ifdef STATFS_DEFINED_BY_SYS_VFS
813         #  include <sys/vfs.h>
814         # else
815         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
816         #   include <sys/statfs.h>
817         #  endif
818         # endif
819         #endif
820         ],[
821                 struct statfs stfs;
823                 stfs.f_bavail++;
824         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
825         )
826     fi ] )
827 if test "$wine_cv_statfs_bavail" = "yes"
828 then
829   AC_DEFINE(STATFS_HAS_BAVAIL)
832 dnl *** check for working sigaltstack
833 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
835 AC_CACHE_CHECK("for working sigaltstack",
836         ac_cv_c_working_sigaltstack,
837         AC_TRY_RUN([
838         #include <stdio.h>
839         #include <time.h> /* <sys/time.h> ? bad magic without end */
840         #include <sys/types.h>
841         #include <sys/signal.h>
842         #ifdef HAVE_SYS_PARAM_H
843         # include <sys/param.h>
844         #endif
845         #ifdef HAVE_SYSCALL_H
846         # include <syscall.h>
847         #else
848         # ifdef HAVE_SYS_SYSCALL_H
849         #  include <sys/syscall.h>
850         # endif
851         #endif
852         
853         unsigned char *xaltstack;
855         int
856         main(int argc,char **argv) {
857             struct sigaltstack  ss;
859             xaltstack = malloc(16384);
860             ss.ss_sp    = xaltstack;
861             ss.ss_size  = 16384;
862             ss.ss_flags = 0;
863             if (sigaltstack(&ss, NULL) < 0) {
864                 /* this catches the glibc case */
865                 perror("sigaltstack");
866                 return (1); /* aka exit(1) aka fail */
867             }
868             /* assume it works. */
869             return 0; /* OK */
870         }
871         ],
872         ac_cv_c_working_sigaltstack="yes",
873         ac_cv_c_working_sigaltstack="no",
874         ac_cv_c_working_sigaltstack="no"
877 if test "$ac_cv_c_working_sigaltstack" = "yes"
878 then
879     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
883 dnl *** check for file descriptor passing with msg_accrights
885 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
886  AC_TRY_COMPILE([#include <sys/types.h>
887 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
888                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
889 if test "$ac_cv_c_msg_accrights" = "yes"
890 then
891     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
894 dnl *** check for the need to define __i386__
896 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
897  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
899 #endif],
900  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
901 if test "$ac_cv_cpp_def_i386" = "yes"
902 then
903     CFLAGS="$CFLAGS -D__i386__"
904     LINTFLAGS="$LINTFLAGS -D__i386__"
907 dnl $GCC is set by autoconf
908 GCC_NO_BUILTIN=""
909 if test "$GCC" = "yes"
910 then
911     GCC_NO_BUILTIN="-fno-builtin"
913 AC_SUBST(GCC_NO_BUILTIN)
915 dnl **** Generate output files ****
917 MAKE_RULES=Make.rules
918 AC_SUBST_FILE(MAKE_RULES)
920 AC_OUTPUT([
921 Make.rules
922 Makefile
923 console/Makefile
924 controls/Makefile
925 debugger/Makefile
926 dlls/Makefile
927 dlls/advapi32/Makefile
928 dlls/avifil32/Makefile
929 dlls/comctl32/Makefile
930 dlls/commdlg/Makefile
931 dlls/crtdll/Makefile
932 dlls/dciman32/Makefile
933 dlls/display/Makefile
934 dlls/dplayx/Makefile
935 dlls/dsound/Makefile
936 dlls/icmp/Makefile
937 dlls/imagehlp/Makefile
938 dlls/imm32/Makefile
939 dlls/lzexpand/Makefile
940 dlls/mouse/Makefile
941 dlls/mpr/Makefile
942 dlls/msacm/Makefile
943 dlls/msacm32/Makefile
944 dlls/msnet32/Makefile
945 dlls/msvideo/Makefile
946 dlls/ntdll/Makefile
947 dlls/odbc32/Makefile
948 dlls/ole32/Makefile
949 dlls/oleaut32/Makefile
950 dlls/olecli/Makefile
951 dlls/oledlg/Makefile
952 dlls/olepro32/Makefile
953 dlls/olesvr/Makefile
954 dlls/psapi/Makefile
955 dlls/rasapi32/Makefile
956 dlls/setupx/Makefile
957 dlls/shell32/Makefile
958 dlls/sound/Makefile
959 dlls/stress/Makefile
960 dlls/tapi32/Makefile
961 dlls/version/Makefile
962 dlls/win32s/Makefile
963 dlls/win87em/Makefile
964 dlls/winaspi/Makefile
965 dlls/windebug/Makefile
966 dlls/wing/Makefile
967 dlls/winmm/Makefile
968 dlls/winmm/mcianim/Makefile
969 dlls/winmm/mciavi/Makefile
970 dlls/winmm/mcicda/Makefile
971 dlls/winmm/mciseq/Makefile
972 dlls/winmm/mciwave/Makefile
973 dlls/winmm/midimap/Makefile
974 dlls/winmm/wavemap/Makefile
975 dlls/winmm/wineoss/Makefile
976 dlls/winsock/Makefile
977 dlls/winspool/Makefile
978 dlls/wnaspi32/Makefile
979 documentation/Makefile
980 documentation/wine.conf.man
981 documentation/wine.man
982 files/Makefile
983 graphics/Makefile
984 graphics/enhmetafiledrv/Makefile
985 graphics/metafiledrv/Makefile
986 graphics/psdrv/Makefile
987 graphics/ttydrv/Makefile
988 graphics/win16drv/Makefile
989 graphics/x11drv/Makefile
990 if1632/Makefile
991 include/Makefile
992 library/Makefile
993 libtest/Makefile
994 loader/Makefile
995 loader/ne/Makefile
996 loader/dos/Makefile
997 memory/Makefile
998 misc/Makefile
999 miscemu/Makefile
1000 msdos/Makefile
1001 objects/Makefile
1002 ole/Makefile
1003 programs/Makefile
1004 programs/clock/Makefile
1005 programs/cmdlgtst/Makefile
1006 programs/control/Makefile
1007 programs/avitools/Makefile
1008 programs/osversioncheck/Makefile
1009 programs/notepad/Makefile
1010 programs/progman/Makefile
1011 programs/regtest/Makefile
1012 programs/regapi/Makefile
1013 programs/view/Makefile
1014 programs/wcmd/Makefile
1015 programs/winhelp/Makefile
1016 programs/winver/Makefile
1017 rc/Makefile
1018 relay32/Makefile
1019 resources/Makefile
1020 scheduler/Makefile
1021 server/Makefile
1022 tools/Makefile
1023 tools/wrc/Makefile
1024 tsx11/Makefile
1025 win32/Makefile
1026 windows/Makefile
1027 windows/ttydrv/Makefile
1028 windows/x11drv/Makefile ])
1030 if test "$have_x" = "no"
1031 then
1032   echo
1033   echo "*** Warning: X development files not found. Wine will be built without"
1034   echo "*** X support, which currently does not work, and would probably not be"
1035   echo "*** what you want anyway. You will need to install devel packages of"
1036   echo "*** Xlib/Xfree86 and Xpm at the very least."
1037 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1038 then
1039   echo
1040   echo "*** Warning: Xpm development files not found. Wine will be built without"
1041   echo "*** Xpm support, which currently does not work. You will need to install"
1042   echo "*** devel packages of Xpm."
1045 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1046 then
1047   echo
1048   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1049   echo "*** terminal resize support. Consider upgrading ncurses."
1052 if test "$wine_cv_libc_reentrant" = "no" 
1053 then
1054   echo
1055   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1056   echo "*** thread support. Consider upgrading libc to a more recent"
1057   echo "*** reentrant version of libc."
1060 if test "$wine_cv_mesa_version_OK" = "no"
1061 then
1062   echo
1063   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1064   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
1067 echo
1068 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1069 echo
1071 dnl Local Variables:
1072 dnl comment-start: "dnl "
1073 dnl comment-end: ""
1074 dnl comment-start-skip: "\\bdnl\\b\\s *"
1075 dnl compile-command: "autoconf"
1076 dnl End: