Use MZ_Current() instead of pModule->lpDosTask. Cleaned up the RMCB32
[wine.git] / configure.in
blob360f95755ded284e47950e27831c78e5ec2ac061
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" -a "$ac_cv_header_GL_glext_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 presense 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)
269                 if test $ac_cv_lib_GL_glXCreateContext = "yes"
270                 then
271                         AC_CHECK_LIB(GL,glXGetProcAddressARB,AC_DEFINE(HAVE_GLX_GETPROCADDRESS),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
273                         if test $ac_cv_lib_GL_glXGetProcAddressARB = "yes"
274                         then
275                                AC_CACHE_CHECK("for OpenGL extension functions prototypes", wine_cv_extension_prototypes,
276                                   AC_TRY_COMPILE([#include <GL/gl.h>
277                                                   #include <GL/glext.h>],
278                                                  [PFNGLCOLORTABLEEXTPROC test_proc;],
279                                                  [wine_cv_extension_prototypes="yes"],
280                                                  [wine_cv_extension_prototypes="no"]
281                                   )
282                                 )
283                                 if test $wine_cv_extension_prototypes = "yes"
284                                 then
285                                         AC_DEFINE(HAVE_GLEXT_PROTOTYPES)
286                                 fi
288                                 AC_DEFINE(HAVE_OPENGL)
289                                 OPENGL32_DLL=opengl32
290                                 OPENGLFILES='$(OPENGLFILES)'
291                         fi
292                 fi
293              fi
294          fi
295     fi
297     CPPFLAGS="$ac_save_CPPFLAGS"
298     X_DLLS='$(X_DLLS)'
299     XFILES='$(XFILES)'
300 else
301     XLIB=""
302     X_CFLAGS=""
303     X_LIBS=""
306 dnl **** Check which curses lib to use ***
307 if test "$CURSES" = "yes"
308 then
309     AC_CHECK_HEADERS(ncurses.h)
310     if test "$ac_cv_header_ncurses_h" = "yes"
311     then 
312         AC_CHECK_LIB(ncurses,waddch)
313     fi
314     if test "$ac_cv_lib_ncurses_waddch" = "yes"
315     then
316         AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
317         AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
318     else
319         AC_CHECK_HEADERS(curses.h)
320         if test "$ac_cv_header_curses_h" = "yes"
321         then    
322             AC_CHECK_LIB(curses,waddch)
323             if test "$ac_cv_lib_curses_waddch" = "yes"
324             then
325                 AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
326                 AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
327             fi
328         fi
329     fi
332 dnl **** Check for IPX (currently Linux only) ****
333 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
334  AC_TRY_COMPILE(
335    [#include <sys/socket.h>
336     #include <netipx/ipx.h>],
337    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
338    [ac_cv_c_ipx_gnu="yes"],
339    [ac_cv_c_ipx_gnu="no"])
341 if test "$ac_cv_c_ipx_gnu" = "yes"
342 then
343     AC_DEFINE(HAVE_IPX_GNU)
346 if test "$ac_cv_c_ipx_gnu" = "no"
347 then
348  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
349   AC_TRY_COMPILE(
350     [#include <sys/socket.h>
351      #include <asm/types.h>
352      #include <linux/ipx.h>],
353     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
354     [ac_cv_c_ipx_linux="yes"],
355     [ac_cv_c_ipx_linux="no"])
356   )
357   if test "$ac_cv_c_ipx_linux" = "yes"
358   then
359       AC_DEFINE(HAVE_IPX_LINUX)
360   fi
363 dnl **** Check for Open Sound System ****
364 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
366 AC_CACHE_CHECK("for Open Sound System",
367         ac_cv_c_opensoundsystem,
368         AC_TRY_COMPILE([
369         #if defined(HAVE_SYS_SOUNDCARD_H)
370                 #include <sys/soundcard.h>
371         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
372                 #include <machine/soundcard.h>
373         #elif defined(HAVE_SOUNDCARD_H)
374                 #include <soundcard.h>
375         #endif
376         ],[
378 /* check for one of the Open Sound System specific SNDCTL_ defines */
379 #if !defined(SNDCTL_DSP_STEREO)
380 #error No open sound system
381 #endif
382 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
384 if test "$ac_cv_c_opensoundsystem" = "yes"
385 then
386     AC_DEFINE(HAVE_OSS)
389 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
390         ac_cv_c_opensoundsystem_midi,
391         AC_TRY_COMPILE([
392         #if defined(HAVE_SYS_SOUNDCARD_H)
393                 #include <sys/soundcard.h>
394         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
395                 #include <machine/soundcard.h>
396         #elif defined(HAVE_SOUNDCARD_H)
397                 #include <soundcard.h>
398         #endif
399         ],[
401 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
402 #if !defined(SNDCTL_SEQ_SYNC)
403 #error No open sound system MIDI interface
404 #endif
405 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
407 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
408 then
409     AC_DEFINE(HAVE_OSS_MIDI)
412 dnl **** If ln -s doesn't work, use cp instead ****
413 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
415 dnl **** Check for gcc strength-reduce bug ****
417 if test "x${GCC}" = "xyes"
418 then
419   CFLAGS="$CFLAGS -Wall"
420   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
421                   AC_TRY_RUN([
422 int main(void) {
423   static int Array[[3]];
424   unsigned int B = 3;
425   int i;
426   for(i=0; i<B; i++) Array[[i]] = i - 3;
427   exit( Array[[1]] != -2 );
429     ac_cv_c_gcc_strength_bug="no",
430     ac_cv_c_gcc_strength_bug="yes",
431     ac_cv_c_gcc_strength_bug="yes") )
432   if test "$ac_cv_c_gcc_strength_bug" = "yes"
433   then
434     CFLAGS="$CFLAGS -fno-strength-reduce"
435   fi
438 dnl **** Check for underscore on external symbols ****
440 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
441                ac_cv_c_extern_prefix,
442 [saved_libs=$LIBS
443 LIBS="conftest_asm.s $LIBS"
444 cat > conftest_asm.s <<EOF
445         .globl _ac_test
446 _ac_test:
447         .long 0
449 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
450             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
451 LIBS=$saved_libs])
452 if test "$ac_cv_c_extern_prefix" = "yes"
453 then
454   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
457 dnl **** Check for .string in assembler ****
459 AC_CACHE_CHECK("whether assembler accepts .string",
460                ac_cv_c_asm_string,
461 [saved_libs=$LIBS
462 LIBS="conftest_asm.s $LIBS"
463 cat > conftest_asm.s <<EOF
464         .string "test"
466 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
467 LIBS=$saved_libs])
468 if test "$ac_cv_c_asm_string" = "yes"
469 then
470   AC_DEFINE(HAVE_ASM_STRING)
473 dnl **** Check for working dll ****
475 LDSHARED=""
476 if test "$LIBEXT" = "so"
477 then
478   AC_CACHE_CHECK("whether we can build a Linux dll",
479                  ac_cv_c_dll_linux,
480   [saved_cflags=$CFLAGS
481   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
482   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
483   CFLAGS=$saved_cflags
484   ])
485   if test "$ac_cv_c_dll_linux" = "yes"
486   then
487     LDSHARED="\$(CC) -shared -Wl,-soname,\$(SONAME),-rpath,\$(libdir)"
488   else
489     AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
490                  ac_cv_c_dll_unixware,
491     [saved_cflags=$CFLAGS
492     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0"
493     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
494     CFLAGS=$saved_cflags
495     ])
496     if test "$ac_cv_c_dll_unixware" = "yes"
497     then
498       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/\$(SONAME)"
499     else
500       AC_CACHE_CHECK("whether we can build a NetBSD dll",
501                    ac_cv_c_dll_netbsd,
502       [saved_cflags=$CFLAGS
503       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
504       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
505       CFLAGS=$saved_cflags
506       ])
507       if test "$ac_cv_c_dll_netbsd" = "yes"
508       then
509         LDSHARED="ld -Bshareable -Bforcearchive"
510       fi
511     fi
512   fi
513   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
514   then
515     LIBEXT="a"
516   fi
519 DLLFLAGS=""
521 if test "$LIBEXT" = "so"; then
522     DLLFLAGS="-fPIC"
523     DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode"
524 else
525     DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode \$(X_LIBS) \$(XLIB)"
526     AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)],
527                    ac_cv_c_whole_archive,
528             [saved_cflags=$CFLAGS
529             CFLAGS="$CFLAGS -Wl,--whole-archive -Wl,--no-whole-archive"
530             AC_TRY_LINK(,[return 1],ac_cv_c_whole_archive="yes",ac_cv_c_whole_archive="no")
531             CFLAGS=$saved_cflags
532             ])
533     if test "$ac_cv_c_whole_archive" = "yes"
534     then
535         DLL_LINK="-Wl,--whole-archive $DLL_LINK -Wl,--no-whole-archive"
536     else
537         AC_CACHE_CHECK([whether the linker supports -z {all,default}extract (Linux)],
538                        ac_cv_c_allextract,
539                 [saved_cflags=$CFLAGS
540                 CFLAGS="$CFLAGS -Wl,-z,allextract -Wl,-z,defaultextract"
541                 AC_TRY_LINK(,[return 1],ac_cv_c_allextract="yes",ac_cv_c_allextract="no")
542                 CFLAGS=$saved_cflags
543                 ])
544         if test "$ac_cv_c_allextract" = "yes"
545         then
546             DLL_LINK="-Wl,-z,allextract $DLL_LINK -Wl,-z,defaultextract"
547         fi
548     fi
551 AC_SUBST(DLL_LINK)
552 AC_SUBST(DLLFLAGS)
553 AC_SUBST(LDSHARED)
554 AC_SUBST(LIBEXT)
556 dnl **** Check for reentrant libc ****
558 dnl For cross-compiling we blindly assume that libc is reentrant. This is
559 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
561 wine_cv_libc_reentrant=no 
562 dnl 
563 dnl Linux style errno location
564 dnl 
565 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
566   [AC_TRY_RUN([int myerrno = 0;
567 char buf[256];
568 int *__errno_location(){return &myerrno;}
569 main(){connect(0,buf,255); exit(!myerrno);}],
570   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
571   wine_cv_libc_r__errno_location=yes )
573 if test "$wine_cv_libc_r__errno_location" = "yes"
574 then
575     AC_DEFINE(HAVE__ERRNO_LOCATION)
576     wine_cv_libc_reentrant=__errno_location 
579 dnl FreeBSD style errno location
580 dnl 
581 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
582   [AC_TRY_RUN([int myerrno = 0;
583 char buf[256];
584 int *__error(){return &myerrno;}
585 main(){connect(0,buf,255); exit(!myerrno);}],
586     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
587     wine_cv_libc_r__error=yes )
589 if test "$wine_cv_libc_r__error" = "yes"
590 then
591     AC_DEFINE(HAVE__ERROR)
592     wine_cv_libc_reentrant=__error 
595 dnl Solaris style errno location
596 dnl 
597 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
598   [AC_TRY_RUN([int myerrno = 0;
599 char buf[256];
600 int *___errno(){return &myerrno;}
601 main(){connect(0,buf,255); exit(!myerrno);}],
602     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
603     wine_cv_libc_r___errno=yes )
605 if test "$wine_cv_libc_r___errno" = "yes"
606 then
607     AC_DEFINE(HAVE___ERRNO)
608     wine_cv_libc_reentrant=___errno 
611 dnl UnixWare style errno location
612 dnl 
613 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
614   [AC_TRY_RUN([int myerrno = 0;
615 char buf[256];
616 int *__thr_errno(){return &myerrno;}
617 main(){connect(0,buf,255); exit(!myerrno);}],
618     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
619     wine_cv_libc_r__thr_errno=yes )
621 if test "$wine_cv_libc_r__thr_errno" = "yes"
622 then
623     AC_DEFINE(HAVE__THR_ERRNO)
624     wine_cv_libc_reentrant=__thr_errno 
626 if test "$wine_cv_libc_reentrant" = "no" 
627 then
628   AC_DEFINE(NO_REENTRANT_LIBC)
631 dnl **** Check for reentrant X libraries ****
633 dnl This may fail to determine whether X libraries are reentrant if
634 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
635 dnl is possible with the --without-reentrant-x option.
637 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
638 then
639 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
640   [ if test "x$with_reentrant_x" = "xno" 
641     then
642         wine_cv_x_reentrant=no
643     else
644         libX11_check=none
645         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
646             if test -r $dir/libX11.so; then
647                 libX11_check="-D $dir/libX11.so"
648                 break 1
649             fi
650             if test -r $dir/libX11.a; then
651                 libX11_check="$dir/libX11.a"
652                 break 1
653             fi
654         done
655         if test "$libX11_check" != "none"; then
656             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
657             then
658                 wine_cv_x_reentrant=yes
659             else
660                 wine_cv_x_reentrant=no
661             fi
662         else
663             wine_cv_x_reentrant=unknown
664         fi
665     fi ] )
666 else
667     wine_cv_x_reentrant=no
669 if test "$wine_cv_x_reentrant" = "no"
670 then
671   AC_DEFINE(NO_REENTRANT_X11)
674 dnl **** Check for endianness ****
676 AC_C_BIGENDIAN
678 dnl **** Check for functions ****
680 AC_FUNC_ALLOCA()
681 AC_CHECK_FUNCS(\
682         __libc_fork \
683         _lwp_create \
684         clone \
685         getnetbyaddr \
686         getnetbyname \
687         getpagesize \
688         getprotobyname \
689         getprotobynumber \
690         getservbyport \
691         getsockopt \
692         inet_network \
693         memmove \
694         rfork \
695         select \
696         sendmsg \
697         settimeofday \
698         sigaltstack \
699         statfs \
700         strcasecmp \
701         strerror \
702         strncasecmp \
703         tcgetattr \
704         timegm \
705         usleep \
706         vfscanf \
707         wait4 \
708         waitpid \
711 dnl **** Check for header files ****
713 AC_CHECK_HEADERS(\
714         a.out.h \
715         a_out.h \
716         arpa/inet.h \
717         arpa/nameser.h \
718         elf.h \
719         float.h \
720         libio.h \
721         libutil.h \
722         link.h \
723         linux/cdrom.h \
724         linux/joystick.h \
725         linux/ucdrom.h \
726         net/if.h \
727         netinet/in.h \
728         netinet/tcp.h \
729         pty.h \
730         resolv.h \
731         sched.h \
732         socket.h \
733         strings.h \
734         sys/cdio.h \
735         sys/errno.h \
736         sys/file.h \
737         sys/filio.h \
738         sys/ipc.h \
739         sys/lwp.h \
740         sys/mman.h \
741         sys/modem.h \
742         sys/mount.h \
743         sys/msg.h \
744         sys/param.h \
745         sys/reg.h \
746         sys/signal.h \
747         sys/shm.h \
748         sys/socket.h \
749         sys/sockio.h \
750         sys/statfs.h \
751         sys/strtio.h \
752         sys/syscall.h \
753         sys/wait.h \
754         sys/v86.h \
755         sys/v86intr.h \
756         sys/vfs.h \
757         sys/vm86.h \
758         syscall.h \
759         ucontext.h \
760         wctype.h \
762 AC_HEADER_STAT()
764 dnl **** Check for types ****
766 AC_C_CONST()
767 AC_C_INLINE()
768 AC_TYPE_SIZE_T()
769 AC_CHECK_SIZEOF(long long,0)
771 if test "$ac_cv_header_linux_joystick_h" = "yes"
772 then
773    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
774         wine_cv_linux_joystick_22_api,
775         AC_TRY_COMPILE([
776         #include <sys/ioctl.h>
777         #include <linux/joystick.h>
779         struct js_event blub;
780         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
781         #error "no 2.2 header"
782         #endif
783         ],/*empty*/,
784         wine_cv_linux_joystick_22_api=yes,
785         wine_cv_linux_joystick_22_api=no,
786         wine_cv_linux_joystick_22_api=no
787         )
788    )
789    if test "$wine_cv_linux_joystick_22_api" = "yes"
790    then
791       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
792    fi
795 dnl **** statfs checks ****
797 if test "$ac_cv_header_sys_vfs_h" = "yes"
798 then
799     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
800                     wine_cv_sys_vfs_has_statfs,
801         AC_TRY_COMPILE([
802         #include <sys/types.h>
803         #ifdef HAVE_SYS_PARAM_H
804         # include <sys/param.h>
805         #endif
806         #include <sys/vfs.h>
807         ],[
808                 struct statfs stfs;
810                 memset(&stfs,0,sizeof(stfs));
811         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
812         )
813     )
814     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
815     then
816       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
817     fi
820 if test "$ac_cv_header_sys_statfs_h" = "yes"
821 then
822     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
823                     wine_cv_sys_statfs_has_statfs,
824         AC_TRY_COMPILE([
825         #include <sys/types.h>
826         #ifdef HAVE_SYS_PARAM_H
827         # include <sys/param.h>
828         #endif
829         #include <sys/statfs.h>
830         ],[
831                 struct statfs stfs;
832         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
833         )
834     )
835     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
836     then
837       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
838     fi
841 if test "$ac_cv_header_sys_mount_h" = "yes"
842 then
843     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
844                     wine_cv_sys_mount_has_statfs,
845         AC_TRY_COMPILE([
846         #include <sys/types.h>
847         #ifdef HAVE_SYS_PARAM_H
848         # include <sys/param.h>
849         #endif
850         #include <sys/mount.h>
851         ],[
852                 struct statfs stfs;
853         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
854         )
855     )
856     if test "$wine_cv_sys_mount_has_statfs" = "yes"
857     then
858       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
859     fi
862 dnl **** FIXME: what about mixed cases, where we need two of them? ***
864 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
865   [ if test "x$statfs_bfree" = "xno"
866     then
867         wine_cv_statfs_bfree=no
868     else
869         AC_TRY_COMPILE([
870         #include <sys/types.h>
871         #ifdef HAVE_SYS_PARAM_H
872         # include <sys/param.h>
873         #endif
874         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
875         # include <sys/mount.h>
876         #else
877         # ifdef STATFS_DEFINED_BY_SYS_VFS
878         #  include <sys/vfs.h>
879         # else
880         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
881         #   include <sys/statfs.h>
882         #  endif
883         # endif
884         #endif
885         ],[
886                 struct statfs stfs;
888                 stfs.f_bfree++;
889         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
890         )
891     fi ] )
892 if test "$wine_cv_statfs_bfree" = "yes"
893 then
894   AC_DEFINE(STATFS_HAS_BFREE)
897 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
898   [ if test "x$statfs_bavail" = "xno"
899     then
900         wine_cv_statfs_bavail=no
901     else
902         AC_TRY_COMPILE([
903         #include <sys/types.h>
904         #ifdef HAVE_SYS_PARAM_H
905         # include <sys/param.h>
906         #endif
907         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
908         # include <sys/mount.h>
909         #else
910         # ifdef STATFS_DEFINED_BY_SYS_VFS
911         #  include <sys/vfs.h>
912         # else
913         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
914         #   include <sys/statfs.h>
915         #  endif
916         # endif
917         #endif
918         ],[
919                 struct statfs stfs;
921                 stfs.f_bavail++;
922         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
923         )
924     fi ] )
925 if test "$wine_cv_statfs_bavail" = "yes"
926 then
927   AC_DEFINE(STATFS_HAS_BAVAIL)
930 dnl *** check for file descriptor passing with msg_accrights
932 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
933  AC_TRY_COMPILE([#include <sys/types.h>
934 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
935                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
936 if test "$ac_cv_c_msg_accrights" = "yes"
937 then
938     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
941 dnl *** Check for the sun_len member in struct sockaddr_un
943 AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sun_len,
944  AC_TRY_COMPILE([#include <sys/types.h>
945 #include <sys/socket.h>
946 #include <sys/un.h>], [static struct sockaddr_un addr; addr.sun_len = 1],
947                 ac_cv_c_sun_len="yes", ac_cv_c_sun_len="no"))
948 if test "$ac_cv_c_sun_len" = "yes"
949 then
950     AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)
953 dnl *** check for the need to define __i386__
955 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
956  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
958 #endif],
959  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
960 if test "$ac_cv_cpp_def_i386" = "yes"
961 then
962     CFLAGS="$CFLAGS -D__i386__"
963     LINTFLAGS="$LINTFLAGS -D__i386__"
966 dnl $GCC is set by autoconf
967 GCC_NO_BUILTIN=""
968 if test "$GCC" = "yes"
969 then
970     GCC_NO_BUILTIN="-fno-builtin"
972 AC_SUBST(GCC_NO_BUILTIN)
974 dnl **** Generate output files ****
976 AC_OUTPUT_COMMANDS([
977 extra_subdirs="\
978 dlls/ddraw/d3ddevice \
979 dlls/ddraw/dclipper \
980 dlls/ddraw/ddraw \
981 dlls/ddraw/direct3d \
982 dlls/ddraw/dpalette \
983 dlls/ddraw/dsurface \
984 dlls/kernel/messages \
986 for i in $extra_subdirs; do [ -d $i ] || (echo "creating $i" && mkdir $i); done ])
988 MAKE_RULES=Make.rules
989 AC_SUBST_FILE(MAKE_RULES)
991 MAKE_DLL_RULES=dlls/Makedll.rules
992 AC_SUBST_FILE(MAKE_DLL_RULES)
994 AC_OUTPUT([
995 Make.rules
996 Makefile
997 console/Makefile
998 controls/Makefile
999 debugger/Makefile
1000 dlls/Makedll.rules
1001 dlls/Makefile
1002 dlls/advapi32/Makefile
1003 dlls/avifil32/Makefile
1004 dlls/comctl32/Makefile
1005 dlls/commdlg/Makefile
1006 dlls/crtdll/Makefile
1007 dlls/dciman32/Makefile
1008 dlls/ddraw/Makefile
1009 dlls/dinput/Makefile
1010 dlls/dplay/Makefile
1011 dlls/dplayx/Makefile
1012 dlls/dsound/Makefile
1013 dlls/gdi/Makefile
1014 dlls/icmp/Makefile
1015 dlls/imagehlp/Makefile
1016 dlls/imm32/Makefile
1017 dlls/kernel/Makefile
1018 dlls/lzexpand/Makefile
1019 dlls/mpr/Makefile
1020 dlls/msacm/Makefile
1021 dlls/msnet32/Makefile
1022 dlls/msvideo/Makefile
1023 dlls/ntdll/Makefile
1024 dlls/odbc32/Makefile
1025 dlls/ole32/Makefile
1026 dlls/oleaut32/Makefile
1027 dlls/olecli/Makefile
1028 dlls/oledlg/Makefile
1029 dlls/olepro32/Makefile
1030 dlls/olesvr/Makefile
1031 dlls/opengl32/Makefile
1032 dlls/psapi/Makefile
1033 dlls/rasapi32/Makefile
1034 dlls/richedit/Makefile
1035 dlls/rpcrt4/Makefile
1036 dlls/serialui/Makefile
1037 dlls/setupapi/Makefile
1038 dlls/shell32/Makefile
1039 dlls/shfolder/Makefile
1040 dlls/shlwapi/Makefile
1041 dlls/tapi32/Makefile
1042 dlls/ttydrv/Makefile
1043 dlls/ttydrv/Makefile
1044 dlls/urlmon/Makefile
1045 dlls/user/Makefile
1046 dlls/version/Makefile
1047 dlls/win32s/Makefile
1048 dlls/winaspi/Makefile
1049 dlls/wineps/Makefile
1050 dlls/wininet/Makefile
1051 dlls/winmm/Makefile
1052 dlls/winmm/joystick/Makefile
1053 dlls/winmm/mcianim/Makefile
1054 dlls/winmm/mciavi/Makefile
1055 dlls/winmm/mcicda/Makefile
1056 dlls/winmm/mciseq/Makefile
1057 dlls/winmm/mciwave/Makefile
1058 dlls/winmm/midimap/Makefile
1059 dlls/winmm/wavemap/Makefile
1060 dlls/winmm/wineoss/Makefile
1061 dlls/winsock/Makefile
1062 dlls/winspool/Makefile
1063 dlls/wow32/Makefile
1064 dlls/wsock32/Makefile
1065 dlls/x11drv/Makefile
1066 documentation/Makefile
1067 documentation/wine.conf.man
1068 documentation/wine.man
1069 files/Makefile
1070 graphics/Makefile
1071 graphics/enhmetafiledrv/Makefile
1072 graphics/metafiledrv/Makefile
1073 graphics/ttydrv/Makefile
1074 graphics/win16drv/Makefile
1075 graphics/x11drv/Makefile
1076 if1632/Makefile
1077 include/Makefile
1078 library/Makefile
1079 libtest/Makefile
1080 loader/Makefile
1081 loader/ne/Makefile
1082 loader/dos/Makefile
1083 memory/Makefile
1084 misc/Makefile
1085 miscemu/Makefile
1086 msdos/Makefile
1087 objects/Makefile
1088 ole/Makefile
1089 programs/Makefile
1090 programs/clock/Makefile
1091 programs/cmdlgtst/Makefile
1092 programs/control/Makefile
1093 programs/avitools/Makefile
1094 programs/osversioncheck/Makefile
1095 programs/notepad/Makefile
1096 programs/progman/Makefile
1097 programs/regtest/Makefile
1098 programs/regapi/Makefile
1099 programs/view/Makefile
1100 programs/wcmd/Makefile
1101 programs/winemine/Makefile
1102 programs/winhelp/Makefile
1103 programs/winver/Makefile
1104 relay32/Makefile
1105 resources/Makefile
1106 scheduler/Makefile
1107 server/Makefile
1108 tools/Makefile
1109 tools/cvdump/Makefile
1110 tools/winebuild/Makefile
1111 tools/wrc/Makefile
1112 tools/wmc/Makefile
1113 tsx11/Makefile
1114 unicode/Makefile
1115 win32/Makefile
1116 windows/Makefile
1117 windows/ttydrv/Makefile
1118 windows/x11drv/Makefile ])
1120 if test "$have_x" = "no"
1121 then
1122   echo
1123   echo "*** Warning: X development files not found. Wine will be built without"
1124   echo "*** X support, which currently does not work, and would probably not be"
1125   echo "*** what you want anyway. You will need to install devel packages of"
1126   echo "*** Xlib/Xfree86 and Xpm at the very least."
1127 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1128 then
1129   echo
1130   echo "*** Warning: Xpm development files not found. Wine will be built without"
1131   echo "*** Xpm support, which currently does not work. You will need to install"
1132   echo "*** devel packages of Xpm."
1135 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1136 then
1137   echo
1138   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1139   echo "*** terminal resize support. Consider upgrading ncurses."
1142 if test "$wine_cv_libc_reentrant" = "no" 
1143 then
1144   echo
1145   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1146   echo "*** thread support. Consider upgrading libc to a more recent"
1147   echo "*** reentrant version of libc."
1150 if test "$wine_cv_opengl_version_OK" = "no"
1151 then
1152   echo
1153   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1154   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1157 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "normal"
1158 then
1159   echo
1160   echo "*** Warning: the OpenGL version you have installed relies on libpthread for"
1161   echo "*** thread-safety. To prevent crashes, OpenGL support has been removed."
1162   echo "*** A fix for glibc 2.1.3 that seem to work is included in this version of Wine,"
1163   echo "*** start configure with '--enable-opengl' to force OpenGL support."
1166 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "yes"
1167 then
1168   echo
1169   echo "*** Warning: you explicitely linked in a thread-safe OpenGL version. If you"
1170   echo "*** experience unusual crashes on DirectDraw games, try first to disable OpenGL"
1171   echo "*** support before reporting bugs."
1175 echo
1176 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1177 echo
1179 dnl Local Variables:
1180 dnl comment-start: "dnl "
1181 dnl comment-end: ""
1182 dnl comment-start-skip: "\\bdnl\\b\\s *"
1183 dnl compile-command: "autoconf"
1184 dnl End: