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