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