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