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