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