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