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