Fixed potential buffer overflows (spotted by Francois Gouget).
[wine/multimedia.git] / configure.in
blob05a3b6a60c7e3dfca6c8927b844d83bea6c7dce1
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 MAIN_TARGET=emu
17 LIB_TARGET=libwine.a
18 ALT_LINK="-L\$(TOPOBJDIR) -lwine"
19 TRACE_MSGS=yes  # the TRACE() macro
20 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
22 AC_ARG_ENABLE(emulator,
23 [  --disable-emulator      build only the Wine library, not the emulator],
24 [if test "$enableval" = "no"; then MAIN_TARGET="lib"; fi])
26 AC_ARG_ENABLE(dll,
27 [  --enable-dll            build the Wine library as a DLL],
28 [if test "$enableval" = "no"; then : ; else LIB_TARGET="libwine.so.1.0"; fi])
30 AC_ARG_ENABLE(lib,
31 [  --disable-lib           build the Wine without building libwine.a],
32 [if test "$enableval" = "no"; then ALT_LINK="\$(LIBOBJS) \$(X11OBJS)"; LIB_TARGET=""; fi])
34 AC_ARG_ENABLE(debug,
35 [  --disable-debug         compile out all debugging messages],
36 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
38 AC_ARG_ENABLE(trace,
39 [  --disable-trace         compile out TRACE messages],
40 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
42 AC_ARG_WITH(reentrant-x,
43 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
45 AC_SUBST(MAIN_TARGET)
46 AC_SUBST(LIB_TARGET)
47 AC_SUBST(ALT_LINK)
48 AC_SUBST(OPTIONS)
50 if test "$DEBUG_MSGS" = "no"
51 then
52     AC_DEFINE(NO_DEBUG_MSGS)
53     AC_DEFINE(NO_TRACE_MSGS)
54 else
55     if test "$TRACE_MSGS" = "no"
56     then
57         AC_DEFINE(NO_TRACE_MSGS)
58     fi
61 dnl **** Check for some programs ****
63 AC_PROG_MAKE_SET
64 AC_PROG_CC
65 AC_PROG_CPP
66 AC_PATH_XTRA
67 AC_PROG_YACC
68 AC_PROG_LEX
69 AC_PROG_RANLIB
70 AC_PROG_INSTALL
71 AC_PROG_LN_S
72 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
73 AC_PATH_PROG(LDCONFIG, ldconfig, false, /sbin:/usr/sbin:$PATH)
75 dnl Check for lint
76 AC_CHECK_PROGS(LINT, lclint lint)
77 if test "$LINT" = "lint"
78 then
79   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
80   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
82 AC_SUBST(LINT)
83 AC_SUBST(LINTFLAGS)
85 dnl **** Check for some libraries ****
87 dnl Check for -lm for BeOS
88 AC_CHECK_LIB(m,sqrt)
89 dnl Check for -li386 for NetBSD and OpenBSD
90 AC_CHECK_LIB(i386,i386_set_ldt)
91 dnl Check for -lossaudio for NetBSD
92 AC_CHECK_LIB(ossaudio,_oss_ioctl)
93 dnl Check for -lw for Solaris
94 AC_CHECK_LIB(w,iswalnum)
95 dnl Check for -lnsl for Solaris
96 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))
97 dnl Check for -lsocket for Solaris
98 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
99 dnl Check for -lxpg4 for FreeBSD
100 AC_CHECK_LIB(xpg4,setrunelocale)
101 dnl Check for -lmmap for OS/2
102 AC_CHECK_LIB(mmap,mmap)
103 dnl Check for openpty
104 AC_CHECK_FUNCS(openpty,,
105         AC_CHECK_LIB(util,openpty,
106                 AC_DEFINE(HAVE_OPENPTY)
107                 LIBS="$LIBS -lutil"
108         ))
110 AC_CHECK_HEADERS(dlfcn.h,
111         AC_CHECK_FUNCS(dlopen,
112                 AC_DEFINE(HAVE_DL_API),
113                 AC_CHECK_LIB(dl,dlopen,
114                         AC_DEFINE(HAVE_DL_API)
115                         LIBS="$LIBS -ldl"
116                 )
117         )
119 AC_SUBST(XLIB)
120 if test "$have_x" = "yes"
121 then
122     XLIB="-lXext -lX11"
123     ac_save_CPPFLAGS="$CPPFLAGS"
124     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
126     dnl Check for -lXpm
127     AC_CHECK_HEADERS(X11/xpm.h)
128     if test "$ac_cv_header_X11_xpm_h" = "yes"
129     then 
130         AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
131     else
132         echo "When compiling with X support, you need the Xpm library, or"
133         echo "WINE will not work. This Xpm library is within the following RPM,"
134         echo "which you need to install:"
135         echo "Redhat            :       xpm, xpm-devel"
136         echo "Caldera OpenLinux :       xpm, xpm-devel, xpm-devel-static"
137         echo "SuSE:                     xpm"
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)
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,XDGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA2) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
157          AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
158     fi
160     dnl Check for XFree86 VMODE extension
161     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86vmode.h)
162     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
163     then 
164         AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11)
165     fi
167     dnl Check for the presence of Mesa
168     AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/osmesa.h)
169     if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
170     then
171         dnl Check for some problems due to old Mesa versions
172         AC_CACHE_CHECK("for up-to-date Mesa version", wine_cv_mesa_version_OK,
173           AC_TRY_COMPILE(
174             [#include <GL/gl.h>],
175             [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
176             [wine_cv_mesa_version_OK="yes"],
177             [wine_cv_mesa_version_OK="no"]
178           )
179         )
181         if test "$wine_cv_mesa_version_OK" = "yes"
182         then
183             dnl Check for the presense of the library
184             AC_CHECK_LIB(GL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lGL",,$X_LIBS -lXext -lX11 -lm)
185             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
186             then
187                 AC_CHECK_LIB(MesaGL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm)
188             fi
189         fi
190     fi
192     CPPFLAGS="$ac_save_CPPFLAGS"
193 else
194     XLIB=""
195     X_CFLAGS=""
196     X_LIBS=""
199 dnl **** Check which curses lib to use ***
200 AC_CHECK_HEADERS(ncurses.h)
201 if test "$ac_cv_header_ncurses_h" = "yes"
202 then 
203     AC_CHECK_LIB(ncurses,waddch)
205 if test "$ac_cv_lib_ncurses_waddch" = "yes"
206 then
207     AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
208     AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
209 else
210     AC_CHECK_HEADERS(curses.h)
211     if test "$ac_cv_header_curses_h" = "yes"
212     then    
213        AC_CHECK_LIB(curses,waddch)
214        AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
215        AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
216     fi
219 dnl **** Check for IPX (currently Linux only) ****
220 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
221  AC_TRY_COMPILE(
222    [#include <sys/socket.h>
223     #include <netipx/ipx.h>],
224    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
225    [AC_DEFINE(HAVE_IPX_GNU)
226     ac_cv_c_ipx_gnu="yes"],
227    [ac_cv_c_ipx_gnu="no"])
230 if test "$ac_cv_c_ipx_gnu" = "no"
231 then
232  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
233   AC_TRY_COMPILE(
234     [#include <sys/socket.h>
235      #include <asm/types.h>
236      #include <linux/ipx.h>],
237     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
238     [AC_DEFINE(HAVE_IPX_LINUX)
239      ac_cv_c_ipx_linux="yes"],
240     [ac_cv_c_ipx_linux="no"])
241   )
244 dnl **** Check for Open Sound System ****
245 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
247 AC_CACHE_CHECK("for Open Sound System",
248         ac_cv_c_opensoundsystem,
249         AC_TRY_COMPILE([
250         #if defined(HAVE_SYS_SOUNDCARD_H)
251                 #include <sys/soundcard.h>
252         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
253                 #include <machine/soundcard.h>
254         #elif defined(HAVE_SOUNDCARD_H)
255                 #include <soundcard.h>
256         #endif
257         ],[
259 /* check for one of the Open Sound System specific SNDCTL_ defines */
260 #if !defined(SNDCTL_DSP_STEREO)
261 #error No open sound system
262 #endif
263 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
265 if test "$ac_cv_c_opensoundsystem" = "yes"
266 then
267     AC_DEFINE(HAVE_OSS)
270 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
271         ac_cv_c_opensoundsystem_midi,
272         AC_TRY_COMPILE([
273         #if defined(HAVE_SYS_SOUNDCARD_H)
274                 #include <sys/soundcard.h>
275         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
276                 #include <machine/soundcard.h>
277         #elif defined(HAVE_SOUNDCARD_H)
278                 #include <soundcard.h>
279         #endif
280         ],[
282 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
283 #if !defined(SNDCTL_SEQ_SYNC)
284 #error No open sound system MIDI interface
285 #endif
286 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
288 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
289 then
290     AC_DEFINE(HAVE_OSS_MIDI)
293 dnl **** If ln -s doesn't work, use cp instead ****
294 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
296 dnl **** Check for gcc strength-reduce bug ****
298 if test "x${GCC}" = "xyes"
299 then
300   CFLAGS="$CFLAGS -Wall"
301   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
302                   AC_TRY_RUN([
303 int main(void) {
304   static int Array[[3]];
305   unsigned int B = 3;
306   int i;
307   for(i=0; i<B; i++) Array[[i]] = i - 3;
308   exit( Array[[1]] != -2 );
310     ac_cv_c_gcc_strength_bug="no",
311     ac_cv_c_gcc_strength_bug="yes",
312     ac_cv_c_gcc_strength_bug="yes") )
313   if test "$ac_cv_c_gcc_strength_bug" = "yes"
314   then
315     CFLAGS="$CFLAGS -fno-strength-reduce"
316   fi
319 dnl **** Check for underscore on external symbols ****
321 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
322                ac_cv_c_extern_prefix,
323 [saved_libs=$LIBS
324 LIBS="conftest_asm.s $LIBS"
325 cat > conftest_asm.s <<EOF
326         .globl _ac_test
327 _ac_test:
328         .long 0
330 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
331             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
332 LIBS=$saved_libs])
333 if test "$ac_cv_c_extern_prefix" = "yes"
334 then
335   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
338 dnl **** Check for .string in assembler ****
340 AC_CACHE_CHECK("whether assembler accepts .string",
341                ac_cv_c_asm_string,
342 [saved_libs=$LIBS
343 LIBS="conftest_asm.s $LIBS"
344 cat > conftest_asm.s <<EOF
345         .string "test"
347 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
348 LIBS=$saved_libs])
349 if test "$ac_cv_c_asm_string" = "yes"
350 then
351   AC_DEFINE(HAVE_ASM_STRING)
354 dnl **** Check for working dll ****
356 DLLFLAGS=""
357 BUILDFLAGS=""
358 LDSHARED=""
359 if test "$LIB_TARGET" = "libwine.so.1.0"
360 then
361   AC_CACHE_CHECK("whether we can build a Linux dll",
362                  ac_cv_c_dll_linux,
363   [saved_cflags=$CFLAGS
364   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
365   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
366   CFLAGS=$saved_cflags
367   ])
368   if test "$ac_cv_c_dll_linux" = "yes"
369   then
370     BUILDFLAGS="-pic"
371     DLLFLAGS="-fPIC"
372     LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so,-rpath,\$(libdir)"
373   else
374     AC_CACHE_CHECK("whether we can build a UnixWare dll",
375                  ac_cv_c_dll_unixware,
376     [saved_cflags=$CFLAGS
377     CFLAGS="$CFLAGS -fPIC -Wl,-G,conftest.so.1.0"
378     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
379     CFLAGS=$saved_cflags
380     ])
381     if test "$ac_cv_c_dll_unixware" = "yes"
382     then
383       BUILDFLAGS="-pic"
384       DLLFLAGS="-fPIC"
385       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/libwine.so"
386     else
387       AC_CACHE_CHECK("whether we can build a NetBSD dll",
388                    ac_cv_c_dll_netbsd,
389       [saved_cflags=$CFLAGS
390       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
391       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
392       CFLAGS=$saved_cflags
393       ])
394       if test "$ac_cv_c_dll_netbsd" = "yes"
395       then
396         BUILDFLAGS="-pic"
397         DLLFLAGS="-fPIC"
398         LDSHARED="ld -Bshareable -Bforcearchive"
399       fi
400     fi
401   fi
402   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
403   then
404     LIB_TARGET="libwine.a"
405   fi
407 AC_SUBST(BUILDFLAGS)
408 AC_SUBST(DLLFLAGS)
409 AC_SUBST(LDSHARED)
411 dnl **** Check for reentrant libc ****
413 dnl For cross-compiling we blindly assume that libc is reentrant. This is
414 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
416 wine_cv_libc_reentrant=no 
417 dnl 
418 dnl Linux style errno location
419 dnl 
420 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
421   [AC_TRY_RUN([int myerrno = 0;
422 char buf[256];
423 int *__errno_location(){return &myerrno;}
424 main(){connect(0,buf,255); exit(!myerrno);}],
425   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
426   wine_cv_libc_r__errno_location=yes )
428 if test "$wine_cv_libc_r__errno_location" = "yes"
429 then
430     AC_DEFINE(HAVE__ERRNO_LOCATION)
431     wine_cv_libc_reentrant=__errno_location 
434 dnl FreeBSD style errno location
435 dnl 
436 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
437   [AC_TRY_RUN([int myerrno = 0;
438 char buf[256];
439 int *__error(){return &myerrno;}
440 main(){connect(0,buf,255); exit(!myerrno);}],
441     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
442     wine_cv_libc_r__error=yes )
444 if test "$wine_cv_libc_r__error" = "yes"
445 then
446     AC_DEFINE(HAVE__ERROR)
447     wine_cv_libc_reentrant=__error 
450 dnl Solaris style errno location
451 dnl 
452 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
453   [AC_TRY_RUN([int myerrno = 0;
454 char buf[256];
455 int *___errno(){return &myerrno;}
456 main(){connect(0,buf,255); exit(!myerrno);}],
457     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
458     wine_cv_libc_r___errno=yes )
460 if test "$wine_cv_libc_r___errno" = "yes"
461 then
462     AC_DEFINE(HAVE___ERRNO)
463     wine_cv_libc_reentrant=___errno 
466 dnl UnixWare style errno location
467 dnl 
468 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
469   [AC_TRY_RUN([int myerrno = 0;
470 char buf[256];
471 int *__thr_errno(){return &myerrno;}
472 main(){connect(0,buf,255); exit(!myerrno);}],
473     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
474     wine_cv_libc_r__thr_errno=yes )
476 if test "$wine_cv_libc_r__thr_errno" = "yes"
477 then
478     AC_DEFINE(HAVE__THR_ERRNO)
479     wine_cv_libc_reentrant=__thr_errno 
481 if test "$wine_cv_libc_reentrant" = "no" 
482 then
483   AC_DEFINE(NO_REENTRANT_LIBC)
486 dnl **** Check for reentrant X libraries ****
488 dnl This may fail to determine whether X libraries are reentrant if
489 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
490 dnl is possible with the --without-reentrant-x option.
492 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
493 then
494 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
495   [ if test "x$with_reentrant_x" = "xno" 
496     then
497         wine_cv_x_reentrant=no
498     else
499         libX11_check=none
500         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
501             if test -r $dir/libX11.so; then
502                 libX11_check="-D $dir/libX11.so"
503                 break 1
504             fi
505             if test -r $dir/libX11.a; then
506                 libX11_check="$dir/libX11.a"
507                 break 1
508             fi
509         done
510         if test "$libX11_check" != "none"; then
511             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
512             then
513                 wine_cv_x_reentrant=yes
514             else
515                 wine_cv_x_reentrant=no
516             fi
517         else
518             wine_cv_x_reentrant=unknown
519         fi
520     fi ] )
521 else
522     wine_cv_x_reentrant=no
524 if test "$wine_cv_x_reentrant" = "no"
525 then
526   AC_DEFINE(NO_REENTRANT_X11)
529 dnl **** Check for endianness ****
531 AC_C_BIGENDIAN
533 dnl **** Check for functions ****
535 AC_FUNC_ALLOCA()
536 AC_CHECK_FUNCS(\
537         _lwp_create \
538         clone \
539         getnetbyaddr \
540         getnetbyname \
541         getpagesize \
542         getprotobyname \
543         getprotobynumber \
544         getservbyport \
545         getsockopt \
546         inet_network \
547         memmove \
548         rfork \
549         select \
550         sendmsg \
551         settimeofday \
552         sigaltstack \
553         statfs \
554         strcasecmp \
555         strerror \
556         strncasecmp \
557         tcgetattr \
558         timegm \
559         usleep \
560         vfscanf \
561         wait4 \
562         waitpid \
565 dnl **** Check for header files ****
567 AC_CHECK_HEADERS(\
568         a.out.h \
569         a_out.h \
570         arpa/inet.h \
571         arpa/nameser.h \
572         curses.h \
573         elf.h \
574         float.h \
575         libio.h \
576         link.h \
577         linux/cdrom.h \
578         linux/joystick.h \
579         linux/ucdrom.h \
580         ncurses.h \
581         net/if.h \
582         netinet/in.h \
583         netinet/tcp.h \
584         pty.h \
585         resolv.h \
586         sched.h \
587         socket.h \
588         strings.h \
589         sys/cdio.h \
590         sys/errno.h \
591         sys/file.h \
592         sys/filio.h \
593         sys/ipc.h \
594         sys/lwp.h \
595         sys/mman.h \
596         sys/modem.h \
597         sys/mount.h \
598         sys/msg.h \
599         sys/param.h \
600         sys/signal.h \
601         sys/shm.h \
602         sys/socket.h \
603         sys/sockio.h \
604         sys/statfs.h \
605         sys/strtio.h \
606         sys/syscall.h \
607         sys/wait.h \
608         sys/v86.h \
609         sys/v86intr.h \
610         sys/vfs.h \
611         sys/vm86.h \
612         syscall.h \
613         ucontext.h \
614         wctype.h \
616 AC_HEADER_STAT()
618 dnl **** Check for types ****
620 AC_C_CONST()
621 AC_C_INLINE()
622 AC_TYPE_SIZE_T()
623 AC_CHECK_SIZEOF(long long,0)
625 if test "$ac_cv_header_linux_joystick_h" = "yes"
626 then
627    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
628         wine_cv_linux_joystick_22_api,
629         AC_TRY_COMPILE([
630         #include <sys/ioctl.h>
631         #include <linux/joystick.h>
633         struct js_event blub;
634         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
635         #error "no 2.2 header"
636         #endif
637         ],/*empty*/,
638         wine_cv_linux_joystick_22_api=yes,
639         wine_cv_linux_joystick_22_api=no,
640         wine_cv_linux_joystick_22_api=no
641         )
642    )
643    if test "$wine_cv_linux_joystick_22_api"
644    then
645       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
646    fi
649 dnl **** statfs checks ****
651 if test "$ac_cv_header_sys_vfs_h" = "yes"
652 then
653     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
654                     wine_cv_sys_vfs_has_statfs,
655         AC_TRY_COMPILE([
656         #include <sys/types.h>
657         #ifdef HAVE_SYS_PARAM_H
658         # include <sys/param.h>
659         #endif
660         #include <sys/vfs.h>
661         ],[
662                 struct statfs stfs;
664                 memset(&stfs,0,sizeof(stfs));
665         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
666         )
667     )
668     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
669     then
670       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
671     fi
674 if test "$ac_cv_header_sys_statfs_h" = "yes"
675 then
676     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
677                     wine_cv_sys_statfs_has_statfs,
678         AC_TRY_COMPILE([
679         #include <sys/types.h>
680         #ifdef HAVE_SYS_PARAM_H
681         # include <sys/param.h>
682         #endif
683         #include <sys/statfs.h>
684         ],[
685                 struct statfs stfs;
686         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
687         )
688     )
689     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
690     then
691       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
692     fi
695 if test "$ac_cv_header_sys_mount_h" = "yes"
696 then
697     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
698                     wine_cv_sys_mount_has_statfs,
699         AC_TRY_COMPILE([
700         #include <sys/types.h>
701         #ifdef HAVE_SYS_PARAM_H
702         # include <sys/param.h>
703         #endif
704         #include <sys/mount.h>
705         ],[
706                 struct statfs stfs;
707         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
708         )
709     )
710     if test "$wine_cv_sys_mount_has_statfs" = "yes"
711     then
712       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
713     fi
716 dnl **** FIXME: what about mixed cases, where we need two of them? ***
718 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
719   [ if test "x$statfs_bfree" = "xno"
720     then
721         wine_cv_statfs_bfree=no
722     else
723         AC_TRY_COMPILE([
724         #include <sys/types.h>
725         #ifdef HAVE_SYS_PARAM_H
726         # include <sys/param.h>
727         #endif
728         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
729         # include <sys/mount.h>
730         #else
731         # ifdef STATFS_DEFINED_BY_SYS_VFS
732         #  include <sys/vfs.h>
733         # else
734         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
735         #   include <sys/statfs.h>
736         #  endif
737         # endif
738         #endif
739         ],[
740                 struct statfs stfs;
742                 stfs.f_bfree++;
743         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
744         )
745     fi ] )
746 if test "$wine_cv_statfs_bfree" = "yes"
747 then
748   AC_DEFINE(STATFS_HAS_BFREE)
751 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
752   [ if test "x$statfs_bavail" = "xno"
753     then
754         wine_cv_statfs_bavail=no
755     else
756         AC_TRY_COMPILE([
757         #include <sys/types.h>
758         #ifdef HAVE_SYS_PARAM_H
759         # include <sys/param.h>
760         #endif
761         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
762         # include <sys/mount.h>
763         #else
764         # ifdef STATFS_DEFINED_BY_SYS_VFS
765         #  include <sys/vfs.h>
766         # else
767         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
768         #   include <sys/statfs.h>
769         #  endif
770         # endif
771         #endif
772         ],[
773                 struct statfs stfs;
775                 stfs.f_bavail++;
776         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
777         )
778     fi ] )
779 if test "$wine_cv_statfs_bavail" = "yes"
780 then
781   AC_DEFINE(STATFS_HAS_BAVAIL)
784 dnl *** check for working sigaltstack
785 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
787 AC_CACHE_CHECK("for working sigaltstack",
788         ac_cv_c_working_sigaltstack,
789         AC_TRY_RUN([
790         #include <stdio.h>
791         #include <time.h> /* <sys/time.h> ? bad magic without end */
792         #include <sys/types.h>
793         #include <sys/signal.h>
794         #ifdef HAVE_SYS_PARAM_H
795         # include <sys/param.h>
796         #endif
797         #ifdef HAVE_SYSCALL_H
798         # include <syscall.h>
799         #else
800         # ifdef HAVE_SYS_SYSCALL_H
801         #  include <sys/syscall.h>
802         # endif
803         #endif
804         
805         unsigned char *xaltstack;
807         int
808         main(int argc,char **argv) {
809             struct sigaltstack  ss;
811             xaltstack = malloc(16384);
812             ss.ss_sp    = xaltstack;
813             ss.ss_size  = 16384;
814             ss.ss_flags = 0;
815             if (sigaltstack(&ss, NULL) < 0) {
816                 /* this catches the glibc case */
817                 perror("sigaltstack");
818                 return (1); /* aka exit(1) aka fail */
819             }
820             /* assume it works. */
821             return 0; /* OK */
822         }
823         ],
824         ac_cv_c_working_sigaltstack="yes",
825         ac_cv_c_working_sigaltstack="no",
826         ac_cv_c_working_sigaltstack="no"
829 if test "$ac_cv_c_working_sigaltstack" = "yes"
830 then
831     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
835 dnl *** check for file descriptor passing with msg_accrights
837 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
838  AC_TRY_COMPILE([#include <sys/types.h>
839 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
840                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
841 if test "$ac_cv_c_msg_accrights" = "yes"
842 then
843     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
846 dnl *** check for the need to define __i386__
848 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
849  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
851 #endif],
852  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
853 if test "$ac_cv_cpp_def_i386" = "yes"
854 then
855     CFLAGS="$CFLAGS -D__i386__"
856     LINTFLAGS="$LINTFLAGS -D__i386__"
859 dnl $GCC is set by autoconf
860 GCC_NO_BUILTIN=""
861 if test "$GCC" = "yes"
862 then
863     GCC_NO_BUILTIN="-fno-builtin"
865 AC_SUBST(GCC_NO_BUILTIN)
867 dnl **** Generate output files ****
869 MAKE_RULES=Make.rules
870 AC_SUBST_FILE(MAKE_RULES)
872 AC_OUTPUT([
873 Make.rules
874 Makefile
875 console/Makefile
876 controls/Makefile
877 debugger/Makefile
878 dlls/Makefile
879 dlls/advapi32/Makefile
880 dlls/avifil32/Makefile
881 dlls/comctl32/Makefile
882 dlls/commdlg/Makefile
883 dlls/crtdll/Makefile
884 dlls/dciman32/Makefile
885 dlls/display/Makefile
886 dlls/dplayx/Makefile
887 dlls/dsound/Makefile
888 dlls/icmp/Makefile
889 dlls/imagehlp/Makefile
890 dlls/imm32/Makefile
891 dlls/lzexpand/Makefile
892 dlls/mouse/Makefile
893 dlls/mpr/Makefile
894 dlls/msacm/Makefile
895 dlls/msacm32/Makefile
896 dlls/msnet32/Makefile
897 dlls/msvideo/Makefile
898 dlls/ntdll/Makefile
899 dlls/odbc32/Makefile
900 dlls/ole32/Makefile
901 dlls/oleaut32/Makefile
902 dlls/olecli/Makefile
903 dlls/oledlg/Makefile
904 dlls/olesvr/Makefile
905 dlls/psapi/Makefile
906 dlls/rasapi32/Makefile
907 dlls/shell32/Makefile
908 dlls/sound/Makefile
909 dlls/stress/Makefile
910 dlls/tapi32/Makefile
911 dlls/ver/Makefile
912 dlls/version/Makefile
913 dlls/win32s/Makefile
914 dlls/win87em/Makefile
915 dlls/winaspi/Makefile
916 dlls/windebug/Makefile
917 dlls/wing/Makefile
918 dlls/winmm/Makefile
919 dlls/winmm/mcianim/Makefile
920 dlls/winmm/mciavi/Makefile
921 dlls/winmm/mcicda/Makefile
922 dlls/winmm/mciseq/Makefile
923 dlls/winmm/mciwave/Makefile
924 dlls/winmm/midimap/Makefile
925 dlls/winmm/wavemap/Makefile
926 dlls/winmm/wineoss/Makefile
927 dlls/winspool/Makefile
928 dlls/wnaspi32/Makefile
929 documentation/Makefile
930 documentation/wine.conf.man
931 documentation/wine.man
932 files/Makefile
933 graphics/Makefile
934 graphics/enhmetafiledrv/Makefile
935 graphics/metafiledrv/Makefile
936 graphics/psdrv/Makefile
937 graphics/ttydrv/Makefile
938 graphics/win16drv/Makefile
939 graphics/x11drv/Makefile
940 if1632/Makefile
941 include/Makefile
942 library/Makefile
943 libtest/Makefile
944 loader/Makefile
945 loader/ne/Makefile
946 loader/dos/Makefile
947 memory/Makefile
948 misc/Makefile
949 miscemu/Makefile
950 msdos/Makefile
951 objects/Makefile
952 ole/Makefile
953 programs/Makefile
954 programs/clock/Makefile
955 programs/cmdlgtst/Makefile
956 programs/control/Makefile
957 programs/avitools/Makefile
958 programs/osversioncheck/Makefile
959 programs/notepad/Makefile
960 programs/progman/Makefile
961 programs/regtest/Makefile
962 programs/regapi/Makefile
963 programs/view/Makefile
964 programs/wcmd/Makefile
965 programs/winhelp/Makefile
966 programs/winver/Makefile
967 rc/Makefile
968 relay32/Makefile
969 resources/Makefile
970 scheduler/Makefile
971 server/Makefile
972 tools/Makefile
973 tools/wrc/Makefile
974 tsx11/Makefile
975 win32/Makefile
976 windows/Makefile
977 windows/ttydrv/Makefile
978 windows/x11drv/Makefile ])
980 if test "$have_x" = "no"
981 then
982   echo
983   echo "*** Warning: X development files not found. Wine will be built without"
984   echo "*** X support, which currently does not work, and would probably not be"
985   echo "*** what you want anyway. You will need to install devel packages of"
986   echo "*** Xlib/Xfree86 and Xpm at the very least."
987 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
988 then
989   echo
990   echo "*** Warning: Xpm development files not found. Wine will be built without"
991   echo "*** Xpm support, which currently does not work. You will need to install"
992   echo "*** devel packages of Xpm."
995 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
996 then
997   echo
998   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
999   echo "*** terminal resize support. Consider upgrading ncurses."
1002 if test "$wine_cv_libc_reentrant" = "no" 
1003 then
1004   echo
1005   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1006   echo "*** thread support. Consider upgrading libc to a more recent"
1007   echo "*** reentrant version of libc."
1010 if test "$wine_cv_mesa_version_OK" = "no"
1011 then
1012   echo
1013   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1014   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
1017 echo
1018 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1019 echo
1021 dnl Local Variables:
1022 dnl comment-start: "dnl "
1023 dnl comment-end: ""
1024 dnl comment-start-skip: "\\bdnl\\b\\s *"
1025 dnl compile-command: "autoconf"
1026 dnl End: