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