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