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