Added rules for message compiler .mc files.
[wine/hacks.git] / configure.in
blob0b0a53eb9f1aa91d7d335ce6df281beee5b6af64
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 XFree86 DGA / DGA 2.0 extension
181         AC_CHECK_HEADERS(X11/extensions/xf86dga.h,
182             [ dnl *** If X11/extensions/xf86dga.h exists, check 
183               dnl *** for XDGAQueryExtension()...
184               AC_CHECK_LIB(Xxf86dga, XDGAQueryExtension,
185                 [ dnl *** If found...
186                   AC_DEFINE(HAVE_LIBXXF86DGA2)
187                   AC_DEFINE(HAVE_LIBXXF86DGA)
188                   X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
189                   DGA_SRCS='$(DGA_SRCS)'
190                   DGA2_SRCS='$(DGA2_SRCS)'
191                ],
192                 [ dnl *** If not found, look for XF86DGAQueryExtension()
193                   dnl *** instead (DGA 2.0 not found)...
194                   AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,
195                     [ AC_DEFINE(HAVE_LIBXXF86DGA)
196                       X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
197                       DGA_SRCS='$(DGA_SRCS)'
198                     ],,
199                     $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
200                   )
201                 ],
202                 $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
203               )
204             ],
205             AC_MSG_WARN([DGA extension not found!!])
206         )
208         dnl *** Check for XFree86 VMODE extension
209         AC_CHECK_HEADERS(X11/extensions/xf86vmode.h,
210             [ dnl *** If X11/extensions/xf86vmode.h exists...
211                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
212                   [ AC_DEFINE(HAVE_LIBXXF86VM)
213                      X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
214                   ],,
215                   $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
216                 )
217             ],
218             AC_MSG_WARN([XFree86 VMODE extension not found!!])
219         )
220       ]
221     ) dnl *** End of X11/Xlib.h check
223     dnl Check for the presence of OpenGL
224     if test $OPENGL = "yes" -o $OPENGL = "normal"
225     then
226         AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/glext.h)
227         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"
228         then
229             dnl Check for some problems due to old Mesa versions
230             AC_CACHE_CHECK("for up-to-date OpenGL version", wine_cv_opengl_version_OK,
231               AC_TRY_COMPILE(
232                 [#include <GL/gl.h>],
233                 [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
234                 [wine_cv_opengl_version_OK="yes"],
235                 [wine_cv_opengl_version_OK="no"]
236               )
237             )
239             dnl Check for the thread-safety of the OpenGL library
240             AC_CACHE_CHECK("for thread-safe OpenGL version", 
241                            wine_cv_opengl_version_threadsafe,
242               [saved_libs=$LIBS
243                LIBS="$X_LIBS -lGL"
244                AC_TRY_LINK([],[pthread_getspecific();],
245                               [wine_cv_opengl_version_threadsafe="yes"],
246                               [wine_cv_opengl_version_threadsafe="no"])
247                LIBS=$saved_libs]
248             )
250             if test "$wine_cv_opengl_version_OK" = "yes" -a \( "$wine_cv_opengl_version_threadsafe" = "no" -o $OPENGL = "yes" \)
251             then
252                 dnl Check for the presense of the library
253                 AC_CHECK_LIB(GL,glXCreateContext,
254                              X_PRE_LIBS="$X_PRE_LIBS -lGL"
255                              MESA_SRCS='$(MESA_SRCS)'
256                              ,,
257                              $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
259                 if test $ac_cv_lib_GL_glXCreateContext = "yes"
260                 then
261                         AC_CHECK_LIB(GL,glXGetProcAddressARB,AC_DEFINE(HAVE_GLX_GETPROCADDRESS),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
263                         if test $ac_cv_lib_GL_glXGetProcAddressARB = "yes"
264                         then
265                                AC_CACHE_CHECK("for OpenGL extension functions prototypes", wine_cv_extension_prototypes,
266                                   AC_TRY_COMPILE([#include <GL/gl.h>
267                                                   #include <GL/glext.h>],
268                                                  [PFNGLCOLORTABLEEXTPROC test_proc;],
269                                                  [AC_DEFINE(HAVE_GLEXT_PROTOTYPES)
270                                                   wine_cv_extension_prototypes="yes"],
271                                                  [wine_cv_extension_prototypes="no"]
272                                   )
273                                 )
275                                 AC_DEFINE(HAVE_OPENGL)
276                                 OPENGL32_DLL=opengl32
277                                 OPENGLFILES='$(OPENGLFILES)'
278                         fi
279                 fi
280              fi
281          fi
282     fi
284     CPPFLAGS="$ac_save_CPPFLAGS"
285     X_DLLS='$(X_DLLS)'
286     XFILES='$(XFILES)'
287 else
288     XLIB=""
289     X_CFLAGS=""
290     X_LIBS=""
293 dnl **** Check which curses lib to use ***
294 if test "$CURSES" = "yes"
295 then
296     AC_CHECK_HEADERS(ncurses.h)
297     if test "$ac_cv_header_ncurses_h" = "yes"
298     then 
299         AC_CHECK_LIB(ncurses,waddch)
300     fi
301     if test "$ac_cv_lib_ncurses_waddch" = "yes"
302     then
303         AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
304         AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
305     else
306         AC_CHECK_HEADERS(curses.h)
307         if test "$ac_cv_header_curses_h" = "yes"
308         then    
309             AC_CHECK_LIB(curses,waddch)
310             if test "$ac_cv_lib_curses_waddch" = "yes"
311             then
312                 AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
313                 AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
314             fi
315         fi
316     fi
319 dnl **** Check for IPX (currently Linux only) ****
320 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
321  AC_TRY_COMPILE(
322    [#include <sys/socket.h>
323     #include <netipx/ipx.h>],
324    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
325    [ac_cv_c_ipx_gnu="yes"],
326    [ac_cv_c_ipx_gnu="no"])
328 if test "$ac_cv_c_ipx_gnu" = "yes"
329 then
330     AC_DEFINE(HAVE_IPX_GNU)
333 if test "$ac_cv_c_ipx_gnu" = "no"
334 then
335  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
336   AC_TRY_COMPILE(
337     [#include <sys/socket.h>
338      #include <asm/types.h>
339      #include <linux/ipx.h>],
340     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
341     [ac_cv_c_ipx_linux="yes"],
342     [ac_cv_c_ipx_linux="no"])
343   )
344   if test "$ac_cv_c_ipx_linux" = "yes"
345   then
346       AC_DEFINE(HAVE_IPX_LINUX)
347   fi
350 dnl **** Check for Open Sound System ****
351 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
353 AC_CACHE_CHECK("for Open Sound System",
354         ac_cv_c_opensoundsystem,
355         AC_TRY_COMPILE([
356         #if defined(HAVE_SYS_SOUNDCARD_H)
357                 #include <sys/soundcard.h>
358         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
359                 #include <machine/soundcard.h>
360         #elif defined(HAVE_SOUNDCARD_H)
361                 #include <soundcard.h>
362         #endif
363         ],[
365 /* check for one of the Open Sound System specific SNDCTL_ defines */
366 #if !defined(SNDCTL_DSP_STEREO)
367 #error No open sound system
368 #endif
369 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
371 if test "$ac_cv_c_opensoundsystem" = "yes"
372 then
373     AC_DEFINE(HAVE_OSS)
376 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
377         ac_cv_c_opensoundsystem_midi,
378         AC_TRY_COMPILE([
379         #if defined(HAVE_SYS_SOUNDCARD_H)
380                 #include <sys/soundcard.h>
381         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
382                 #include <machine/soundcard.h>
383         #elif defined(HAVE_SOUNDCARD_H)
384                 #include <soundcard.h>
385         #endif
386         ],[
388 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
389 #if !defined(SNDCTL_SEQ_SYNC)
390 #error No open sound system MIDI interface
391 #endif
392 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
394 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
395 then
396     AC_DEFINE(HAVE_OSS_MIDI)
399 dnl **** If ln -s doesn't work, use cp instead ****
400 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
402 dnl **** Check for gcc strength-reduce bug ****
404 if test "x${GCC}" = "xyes"
405 then
406   CFLAGS="$CFLAGS -Wall"
407   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
408                   AC_TRY_RUN([
409 int main(void) {
410   static int Array[[3]];
411   unsigned int B = 3;
412   int i;
413   for(i=0; i<B; i++) Array[[i]] = i - 3;
414   exit( Array[[1]] != -2 );
416     ac_cv_c_gcc_strength_bug="no",
417     ac_cv_c_gcc_strength_bug="yes",
418     ac_cv_c_gcc_strength_bug="yes") )
419   if test "$ac_cv_c_gcc_strength_bug" = "yes"
420   then
421     CFLAGS="$CFLAGS -fno-strength-reduce"
422   fi
425 dnl **** Check for underscore on external symbols ****
427 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
428                ac_cv_c_extern_prefix,
429 [saved_libs=$LIBS
430 LIBS="conftest_asm.s $LIBS"
431 cat > conftest_asm.s <<EOF
432         .globl _ac_test
433 _ac_test:
434         .long 0
436 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
437             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
438 LIBS=$saved_libs])
439 if test "$ac_cv_c_extern_prefix" = "yes"
440 then
441   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
444 dnl **** Check for .string in assembler ****
446 AC_CACHE_CHECK("whether assembler accepts .string",
447                ac_cv_c_asm_string,
448 [saved_libs=$LIBS
449 LIBS="conftest_asm.s $LIBS"
450 cat > conftest_asm.s <<EOF
451         .string "test"
453 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
454 LIBS=$saved_libs])
455 if test "$ac_cv_c_asm_string" = "yes"
456 then
457   AC_DEFINE(HAVE_ASM_STRING)
460 dnl **** Check for working dll ****
462 LDSHARED=""
463 if test "$LIBEXT" = "so"
464 then
465   AC_CACHE_CHECK("whether we can build a Linux dll",
466                  ac_cv_c_dll_linux,
467   [saved_cflags=$CFLAGS
468   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
469   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
470   CFLAGS=$saved_cflags
471   ])
472   if test "$ac_cv_c_dll_linux" = "yes"
473   then
474     LDSHARED="\$(CC) -shared -Wl,-soname,\$(SONAME),-rpath,\$(libdir)"
475   else
476     AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
477                  ac_cv_c_dll_unixware,
478     [saved_cflags=$CFLAGS
479     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0"
480     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
481     CFLAGS=$saved_cflags
482     ])
483     if test "$ac_cv_c_dll_unixware" = "yes"
484     then
485       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/\$(SONAME)"
486     else
487       AC_CACHE_CHECK("whether we can build a NetBSD dll",
488                    ac_cv_c_dll_netbsd,
489       [saved_cflags=$CFLAGS
490       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
491       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
492       CFLAGS=$saved_cflags
493       ])
494       if test "$ac_cv_c_dll_netbsd" = "yes"
495       then
496         LDSHARED="ld -Bshareable -Bforcearchive"
497       fi
498     fi
499   fi
500   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
501   then
502     LIBEXT="a"
503   fi
506 DLLFLAGS=""
508 if test "$LIBEXT" = "so"; then
509     DLLFLAGS="-fPIC"
510     DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine"
511 else
512     DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine \$(X_LIBS) \$(XLIB)"
513     AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)],
514                    ac_cv_c_whole_archive,
515             [saved_cflags=$CFLAGS
516             CFLAGS="$CFLAGS -Wl,--whole-archive -Wl,--no-whole-archive"
517             AC_TRY_LINK(,[return 1],ac_cv_c_whole_archive="yes",ac_cv_c_whole_archive="no")
518             CFLAGS=$saved_cflags
519             ])
520     if test "$ac_cv_c_whole_archive" = "yes"
521     then
522         DLL_LINK="-Wl,--whole-archive $DLL_LINK -Wl,--no-whole-archive"
523     else
524         AC_CACHE_CHECK([whether the linker supports -z {all,default}extract (Linux)],
525                        ac_cv_c_allextract,
526                 [saved_cflags=$CFLAGS
527                 CFLAGS="$CFLAGS -Wl,-z,allextract -Wl,-z,defaultextract"
528                 AC_TRY_LINK(,[return 1],ac_cv_c_allextract="yes",ac_cv_c_allextract="no")
529                 CFLAGS=$saved_cflags
530                 ])
531         if test "$ac_cv_c_allextract" = "yes"
532         then
533             DLL_LINK="-Wl,-z,allextract $DLL_LINK -Wl,-z,defaultextract"
534         fi
535     fi
538 AC_SUBST(DLL_LINK)
539 AC_SUBST(DLLFLAGS)
540 AC_SUBST(LDSHARED)
541 AC_SUBST(LIBEXT)
543 dnl **** Check for reentrant libc ****
545 dnl For cross-compiling we blindly assume that libc is reentrant. This is
546 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
548 wine_cv_libc_reentrant=no 
549 dnl 
550 dnl Linux style errno location
551 dnl 
552 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
553   [AC_TRY_RUN([int myerrno = 0;
554 char buf[256];
555 int *__errno_location(){return &myerrno;}
556 main(){connect(0,buf,255); exit(!myerrno);}],
557   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
558   wine_cv_libc_r__errno_location=yes )
560 if test "$wine_cv_libc_r__errno_location" = "yes"
561 then
562     AC_DEFINE(HAVE__ERRNO_LOCATION)
563     wine_cv_libc_reentrant=__errno_location 
566 dnl FreeBSD style errno location
567 dnl 
568 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
569   [AC_TRY_RUN([int myerrno = 0;
570 char buf[256];
571 int *__error(){return &myerrno;}
572 main(){connect(0,buf,255); exit(!myerrno);}],
573     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
574     wine_cv_libc_r__error=yes )
576 if test "$wine_cv_libc_r__error" = "yes"
577 then
578     AC_DEFINE(HAVE__ERROR)
579     wine_cv_libc_reentrant=__error 
582 dnl Solaris style errno location
583 dnl 
584 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
585   [AC_TRY_RUN([int myerrno = 0;
586 char buf[256];
587 int *___errno(){return &myerrno;}
588 main(){connect(0,buf,255); exit(!myerrno);}],
589     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
590     wine_cv_libc_r___errno=yes )
592 if test "$wine_cv_libc_r___errno" = "yes"
593 then
594     AC_DEFINE(HAVE___ERRNO)
595     wine_cv_libc_reentrant=___errno 
598 dnl UnixWare style errno location
599 dnl 
600 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
601   [AC_TRY_RUN([int myerrno = 0;
602 char buf[256];
603 int *__thr_errno(){return &myerrno;}
604 main(){connect(0,buf,255); exit(!myerrno);}],
605     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
606     wine_cv_libc_r__thr_errno=yes )
608 if test "$wine_cv_libc_r__thr_errno" = "yes"
609 then
610     AC_DEFINE(HAVE__THR_ERRNO)
611     wine_cv_libc_reentrant=__thr_errno 
613 if test "$wine_cv_libc_reentrant" = "no" 
614 then
615   AC_DEFINE(NO_REENTRANT_LIBC)
618 dnl **** Check for reentrant X libraries ****
620 dnl This may fail to determine whether X libraries are reentrant if
621 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
622 dnl is possible with the --without-reentrant-x option.
624 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
625 then
626 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
627   [ if test "x$with_reentrant_x" = "xno" 
628     then
629         wine_cv_x_reentrant=no
630     else
631         libX11_check=none
632         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
633             if test -r $dir/libX11.so; then
634                 libX11_check="-D $dir/libX11.so"
635                 break 1
636             fi
637             if test -r $dir/libX11.a; then
638                 libX11_check="$dir/libX11.a"
639                 break 1
640             fi
641         done
642         if test "$libX11_check" != "none"; then
643             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
644             then
645                 wine_cv_x_reentrant=yes
646             else
647                 wine_cv_x_reentrant=no
648             fi
649         else
650             wine_cv_x_reentrant=unknown
651         fi
652     fi ] )
653 else
654     wine_cv_x_reentrant=no
656 if test "$wine_cv_x_reentrant" = "no"
657 then
658   AC_DEFINE(NO_REENTRANT_X11)
661 dnl **** Check for endianness ****
663 AC_C_BIGENDIAN
665 dnl **** Check for functions ****
667 AC_FUNC_ALLOCA()
668 AC_CHECK_FUNCS(\
669         __libc_fork \
670         _lwp_create \
671         clone \
672         getnetbyaddr \
673         getnetbyname \
674         getpagesize \
675         getprotobyname \
676         getprotobynumber \
677         getservbyport \
678         getsockopt \
679         inet_network \
680         memmove \
681         rfork \
682         select \
683         sendmsg \
684         settimeofday \
685         sigaltstack \
686         statfs \
687         strcasecmp \
688         strerror \
689         strncasecmp \
690         tcgetattr \
691         timegm \
692         usleep \
693         vfscanf \
694         wait4 \
695         waitpid \
698 dnl **** Check for header files ****
700 AC_CHECK_HEADERS(\
701         a.out.h \
702         a_out.h \
703         arpa/inet.h \
704         arpa/nameser.h \
705         elf.h \
706         float.h \
707         libio.h \
708         libutil.h \
709         link.h \
710         linux/cdrom.h \
711         linux/joystick.h \
712         linux/ucdrom.h \
713         net/if.h \
714         netinet/in.h \
715         netinet/tcp.h \
716         pty.h \
717         resolv.h \
718         sched.h \
719         socket.h \
720         strings.h \
721         sys/cdio.h \
722         sys/errno.h \
723         sys/file.h \
724         sys/filio.h \
725         sys/ipc.h \
726         sys/lwp.h \
727         sys/mman.h \
728         sys/modem.h \
729         sys/mount.h \
730         sys/msg.h \
731         sys/param.h \
732         sys/reg.h \
733         sys/signal.h \
734         sys/shm.h \
735         sys/socket.h \
736         sys/sockio.h \
737         sys/statfs.h \
738         sys/strtio.h \
739         sys/syscall.h \
740         sys/wait.h \
741         sys/v86.h \
742         sys/v86intr.h \
743         sys/vfs.h \
744         sys/vm86.h \
745         syscall.h \
746         ucontext.h \
747         wctype.h \
749 AC_HEADER_STAT()
751 dnl **** Check for types ****
753 AC_C_CONST()
754 AC_C_INLINE()
755 AC_TYPE_SIZE_T()
756 AC_CHECK_SIZEOF(long long,0)
758 if test "$ac_cv_header_linux_joystick_h" = "yes"
759 then
760    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
761         wine_cv_linux_joystick_22_api,
762         AC_TRY_COMPILE([
763         #include <sys/ioctl.h>
764         #include <linux/joystick.h>
766         struct js_event blub;
767         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
768         #error "no 2.2 header"
769         #endif
770         ],/*empty*/,
771         wine_cv_linux_joystick_22_api=yes,
772         wine_cv_linux_joystick_22_api=no,
773         wine_cv_linux_joystick_22_api=no
774         )
775    )
776    if test "$wine_cv_linux_joystick_22_api" = "yes"
777    then
778       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
779    fi
782 dnl **** statfs checks ****
784 if test "$ac_cv_header_sys_vfs_h" = "yes"
785 then
786     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
787                     wine_cv_sys_vfs_has_statfs,
788         AC_TRY_COMPILE([
789         #include <sys/types.h>
790         #ifdef HAVE_SYS_PARAM_H
791         # include <sys/param.h>
792         #endif
793         #include <sys/vfs.h>
794         ],[
795                 struct statfs stfs;
797                 memset(&stfs,0,sizeof(stfs));
798         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
799         )
800     )
801     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
802     then
803       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
804     fi
807 if test "$ac_cv_header_sys_statfs_h" = "yes"
808 then
809     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
810                     wine_cv_sys_statfs_has_statfs,
811         AC_TRY_COMPILE([
812         #include <sys/types.h>
813         #ifdef HAVE_SYS_PARAM_H
814         # include <sys/param.h>
815         #endif
816         #include <sys/statfs.h>
817         ],[
818                 struct statfs stfs;
819         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
820         )
821     )
822     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
823     then
824       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
825     fi
828 if test "$ac_cv_header_sys_mount_h" = "yes"
829 then
830     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
831                     wine_cv_sys_mount_has_statfs,
832         AC_TRY_COMPILE([
833         #include <sys/types.h>
834         #ifdef HAVE_SYS_PARAM_H
835         # include <sys/param.h>
836         #endif
837         #include <sys/mount.h>
838         ],[
839                 struct statfs stfs;
840         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
841         )
842     )
843     if test "$wine_cv_sys_mount_has_statfs" = "yes"
844     then
845       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
846     fi
849 dnl **** FIXME: what about mixed cases, where we need two of them? ***
851 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
852   [ if test "x$statfs_bfree" = "xno"
853     then
854         wine_cv_statfs_bfree=no
855     else
856         AC_TRY_COMPILE([
857         #include <sys/types.h>
858         #ifdef HAVE_SYS_PARAM_H
859         # include <sys/param.h>
860         #endif
861         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
862         # include <sys/mount.h>
863         #else
864         # ifdef STATFS_DEFINED_BY_SYS_VFS
865         #  include <sys/vfs.h>
866         # else
867         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
868         #   include <sys/statfs.h>
869         #  endif
870         # endif
871         #endif
872         ],[
873                 struct statfs stfs;
875                 stfs.f_bfree++;
876         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
877         )
878     fi ] )
879 if test "$wine_cv_statfs_bfree" = "yes"
880 then
881   AC_DEFINE(STATFS_HAS_BFREE)
884 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
885   [ if test "x$statfs_bavail" = "xno"
886     then
887         wine_cv_statfs_bavail=no
888     else
889         AC_TRY_COMPILE([
890         #include <sys/types.h>
891         #ifdef HAVE_SYS_PARAM_H
892         # include <sys/param.h>
893         #endif
894         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
895         # include <sys/mount.h>
896         #else
897         # ifdef STATFS_DEFINED_BY_SYS_VFS
898         #  include <sys/vfs.h>
899         # else
900         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
901         #   include <sys/statfs.h>
902         #  endif
903         # endif
904         #endif
905         ],[
906                 struct statfs stfs;
908                 stfs.f_bavail++;
909         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
910         )
911     fi ] )
912 if test "$wine_cv_statfs_bavail" = "yes"
913 then
914   AC_DEFINE(STATFS_HAS_BAVAIL)
917 dnl *** check for file descriptor passing with msg_accrights
919 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
920  AC_TRY_COMPILE([#include <sys/types.h>
921 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
922                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
923 if test "$ac_cv_c_msg_accrights" = "yes"
924 then
925     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
928 dnl *** Check for the sun_len member in struct sockaddr_un
930 AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sun_len,
931  AC_TRY_COMPILE([#include <sys/types.h>
932 #include <sys/socket.h>
933 #include <sys/un.h>], [static struct sockaddr_un addr; addr.sun_len = 1],
934                 ac_cv_c_sun_len="yes", ac_cv_c_sun_len="no"))
935 if test "$ac_cv_c_sun_len" = "yes"
936 then
937     AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)
940 dnl *** check for the need to define __i386__
942 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
943  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
945 #endif],
946  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
947 if test "$ac_cv_cpp_def_i386" = "yes"
948 then
949     CFLAGS="$CFLAGS -D__i386__"
950     LINTFLAGS="$LINTFLAGS -D__i386__"
953 dnl $GCC is set by autoconf
954 GCC_NO_BUILTIN=""
955 if test "$GCC" = "yes"
956 then
957     GCC_NO_BUILTIN="-fno-builtin"
959 AC_SUBST(GCC_NO_BUILTIN)
961 dnl **** Generate output files ****
963 AC_OUTPUT_COMMANDS([
964 extra_subdirs="\
965 dlls/ddraw/d3ddevice \
966 dlls/ddraw/dclipper \
967 dlls/ddraw/ddraw \
968 dlls/ddraw/direct3d \
969 dlls/ddraw/dpalette \
970 dlls/ddraw/dsurface \
972 for i in $extra_subdirs; do [ -d $i ] || (echo "creating $i" && mkdir $i); done ])
974 MAKE_RULES=Make.rules
975 AC_SUBST_FILE(MAKE_RULES)
977 MAKE_DLL_RULES=dlls/Makedll.rules
978 AC_SUBST_FILE(MAKE_DLL_RULES)
980 AC_OUTPUT([
981 Make.rules
982 Makefile
983 console/Makefile
984 controls/Makefile
985 debugger/Makefile
986 dlls/Makedll.rules
987 dlls/Makefile
988 dlls/advapi32/Makefile
989 dlls/avifil32/Makefile
990 dlls/comctl32/Makefile
991 dlls/commdlg/Makefile
992 dlls/crtdll/Makefile
993 dlls/dciman32/Makefile
994 dlls/ddraw/Makefile
995 dlls/dinput/Makefile
996 dlls/dplay/Makefile
997 dlls/dplayx/Makefile
998 dlls/dsound/Makefile
999 dlls/gdi/Makefile
1000 dlls/icmp/Makefile
1001 dlls/imagehlp/Makefile
1002 dlls/imm32/Makefile
1003 dlls/kernel/Makefile
1004 dlls/lzexpand/Makefile
1005 dlls/mpr/Makefile
1006 dlls/msacm/Makefile
1007 dlls/msnet32/Makefile
1008 dlls/msvideo/Makefile
1009 dlls/ntdll/Makefile
1010 dlls/odbc32/Makefile
1011 dlls/ole32/Makefile
1012 dlls/oleaut32/Makefile
1013 dlls/olecli/Makefile
1014 dlls/oledlg/Makefile
1015 dlls/olepro32/Makefile
1016 dlls/olesvr/Makefile
1017 dlls/opengl32/Makefile
1018 dlls/psapi/Makefile
1019 dlls/rasapi32/Makefile
1020 dlls/richedit/Makefile
1021 dlls/rpcrt4/Makefile
1022 dlls/serialui/Makefile
1023 dlls/setupapi/Makefile
1024 dlls/setupx/Makefile
1025 dlls/shell32/Makefile
1026 dlls/shfolder/Makefile
1027 dlls/shlwapi/Makefile
1028 dlls/sound/Makefile
1029 dlls/stress/Makefile
1030 dlls/tapi32/Makefile
1031 dlls/ttydrv/Makefile
1032 dlls/ttydrv/Makefile
1033 dlls/urlmon/Makefile
1034 dlls/user/Makefile
1035 dlls/version/Makefile
1036 dlls/win32s/Makefile
1037 dlls/winaspi/Makefile
1038 dlls/wineps/Makefile
1039 dlls/wininet/Makefile
1040 dlls/winmm/Makefile
1041 dlls/winmm/joystick/Makefile
1042 dlls/winmm/mcianim/Makefile
1043 dlls/winmm/mciavi/Makefile
1044 dlls/winmm/mcicda/Makefile
1045 dlls/winmm/mciseq/Makefile
1046 dlls/winmm/mciwave/Makefile
1047 dlls/winmm/midimap/Makefile
1048 dlls/winmm/wavemap/Makefile
1049 dlls/winmm/wineoss/Makefile
1050 dlls/winsock/Makefile
1051 dlls/winspool/Makefile
1052 dlls/wow32/Makefile
1053 dlls/wsock32/Makefile
1054 dlls/x11drv/Makefile
1055 documentation/Makefile
1056 documentation/wine.conf.man
1057 documentation/wine.man
1058 files/Makefile
1059 graphics/Makefile
1060 graphics/enhmetafiledrv/Makefile
1061 graphics/metafiledrv/Makefile
1062 graphics/ttydrv/Makefile
1063 graphics/win16drv/Makefile
1064 graphics/x11drv/Makefile
1065 if1632/Makefile
1066 include/Makefile
1067 library/Makefile
1068 libtest/Makefile
1069 loader/Makefile
1070 loader/ne/Makefile
1071 loader/dos/Makefile
1072 memory/Makefile
1073 misc/Makefile
1074 miscemu/Makefile
1075 msdos/Makefile
1076 objects/Makefile
1077 ole/Makefile
1078 programs/Makefile
1079 programs/clock/Makefile
1080 programs/cmdlgtst/Makefile
1081 programs/control/Makefile
1082 programs/avitools/Makefile
1083 programs/osversioncheck/Makefile
1084 programs/notepad/Makefile
1085 programs/progman/Makefile
1086 programs/regtest/Makefile
1087 programs/regapi/Makefile
1088 programs/view/Makefile
1089 programs/wcmd/Makefile
1090 programs/winemine/Makefile
1091 programs/winhelp/Makefile
1092 programs/winver/Makefile
1093 relay32/Makefile
1094 resources/Makefile
1095 scheduler/Makefile
1096 server/Makefile
1097 tools/Makefile
1098 tools/cvdump/Makefile
1099 tools/winebuild/Makefile
1100 tools/wrc/Makefile
1101 tools/wmc/Makefile
1102 tsx11/Makefile
1103 unicode/Makefile
1104 win32/Makefile
1105 windows/Makefile
1106 windows/ttydrv/Makefile
1107 windows/x11drv/Makefile ])
1109 if test "$have_x" = "no"
1110 then
1111   echo
1112   echo "*** Warning: X development files not found. Wine will be built without"
1113   echo "*** X support, which currently does not work, and would probably not be"
1114   echo "*** what you want anyway. You will need to install devel packages of"
1115   echo "*** Xlib/Xfree86 and Xpm at the very least."
1116 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1117 then
1118   echo
1119   echo "*** Warning: Xpm development files not found. Wine will be built without"
1120   echo "*** Xpm support, which currently does not work. You will need to install"
1121   echo "*** devel packages of Xpm."
1124 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1125 then
1126   echo
1127   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1128   echo "*** terminal resize support. Consider upgrading ncurses."
1131 if test "$wine_cv_libc_reentrant" = "no" 
1132 then
1133   echo
1134   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1135   echo "*** thread support. Consider upgrading libc to a more recent"
1136   echo "*** reentrant version of libc."
1139 if test "$wine_cv_opengl_version_OK" = "no"
1140 then
1141   echo
1142   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1143   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1146 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "normal"
1147 then
1148   echo
1149   echo "*** Warning: the OpenGL version you have installed relies on libpthread for"
1150   echo "*** thread-safety. To prevent crashes, OpenGL support has been removed."
1151   echo "*** A fix for glibc 2.1.3 that seem to work is included in this version of Wine,"
1152   echo "*** start configure with '--enable-opengl' to force OpenGL support."
1155 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "yes"
1156 then
1157   echo
1158   echo "*** Warning: you explicitely linked in a thread-safe OpenGL version. If you"
1159   echo "*** experience unusual crashes on DirectDraw games, try first to disable OpenGL"
1160   echo "*** support before reporting bugs."
1164 echo
1165 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1166 echo
1168 dnl Local Variables:
1169 dnl comment-start: "dnl "
1170 dnl comment-end: ""
1171 dnl comment-start-skip: "\\bdnl\\b\\s *"
1172 dnl compile-command: "autoconf"
1173 dnl End: