Abey George (of Macadamian/Corel)
[wine/multimedia.git] / configure.in
blob3aef0a730e2be5047fa9a89b70cffa2b496666cc
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Author: Michael Patra   <micky@marie.physik.tu-berlin.de>
3 dnl                         <patra@itp1.physik.tu-berlin.de>
4 AC_REVISION([configure.in 1.00])
5 AC_INIT(controls/edit.c)                
6 AC_CONFIG_HEADER(include/config.h)
7 AC_CONFIG_AUX_DIR(tools)
9 # We want these before the checks, so the checks can modify their values.
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
13 dnl **** Command-line arguments ****
15 dnl Default values
16 EMU_TARGET=wine
17 LIBEXT=so       # library type .so or .a
18 TRACE_MSGS=yes  # the TRACE() macro
19 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
20 CURSES=yes
21 OPENGL=normal
23 AC_ARG_ENABLE(emulator,
24 [  --disable-emulator      build only the Wine library, not the emulator],
25 [if test "$enableval" = "no"; then EMU_TARGET=""; fi])
27 AC_ARG_ENABLE(dll,
28 [  --disable-dll           build static libraries instead of DLLs],
29 [if test "$enableval" = "no"; then LIBEXT="a"; fi])
31 AC_ARG_ENABLE(debug,
32 [  --disable-debug         compile out all debugging messages],
33 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
35 AC_ARG_ENABLE(opengl,
36 [  --enable-opengl         force usage of OpenGL even if the latter is thread-safe],
37 [if test "$enableval" = "no"; then OPENGL="no"; elif test "$enableval" = "yes"; then OPENGL="yes"; fi])
39 AC_ARG_ENABLE(trace,
40 [  --disable-trace         compile out TRACE messages],
41 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
43 AC_ARG_WITH(curses,
44 [  --without-curses        do not use curses],
45 [if test "$withval" = "no"; then CURSES="no"; fi])
47 AC_ARG_WITH(reentrant-x,
48 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
50 AC_SUBST(EMU_TARGET)
51 AC_SUBST(OPTIONS)
53 if test "$DEBUG_MSGS" = "no"
54 then
55     AC_DEFINE(NO_DEBUG_MSGS)
56     AC_DEFINE(NO_TRACE_MSGS)
57 else
58     if test "$TRACE_MSGS" = "no"
59     then
60         AC_DEFINE(NO_TRACE_MSGS)
61     fi
64 dnl **** Check for some programs ****
66 AC_PROG_MAKE_SET
67 AC_PROG_CC
68 AC_PROG_CPP
69 AC_PATH_XTRA
70 AC_PROG_YACC
71 AC_PROG_LEX
72 AC_PROG_RANLIB
73 AC_PROG_INSTALL
74 AC_PROG_LN_S
75 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
76 AC_PATH_PROG(LDCONFIG, ldconfig, true, /sbin:/usr/sbin:$PATH)
78 dnl Check for lint
79 AC_CHECK_PROGS(LINT, lclint lint)
80 if test "$LINT" = "lint"
81 then
82   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
83   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
85 AC_SUBST(LINT)
86 AC_SUBST(LINTFLAGS)
88 dnl **** Check for some libraries ****
90 dnl Check for -lm for BeOS
91 AC_CHECK_LIB(m,sqrt)
92 dnl Check for -li386 for NetBSD and OpenBSD
93 AC_CHECK_LIB(i386,i386_set_ldt)
94 dnl Check for -lossaudio for NetBSD
95 AC_CHECK_LIB(ossaudio,_oss_ioctl)
96 dnl Check for -lw for Solaris
97 AC_CHECK_LIB(w,iswalnum)
98 dnl Check for -lnsl for Solaris
99 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))
100 dnl Check for -lsocket for Solaris
101 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
102 dnl Check for -lxpg4 for FreeBSD
103 AC_CHECK_LIB(xpg4,setrunelocale)
104 dnl Check for -lmmap for OS/2
105 AC_CHECK_LIB(mmap,mmap)
106 dnl Check for openpty
107 AC_CHECK_FUNCS(openpty,,
108         AC_CHECK_LIB(util,openpty,
109                 AC_DEFINE(HAVE_OPENPTY)
110                 LIBS="$LIBS -lutil"
111         ))
113 AC_CHECK_HEADERS(dlfcn.h,
114         AC_CHECK_FUNCS(dlopen,
115                 AC_DEFINE(HAVE_DL_API),
116                 AC_CHECK_LIB(dl,dlopen,
117                         AC_DEFINE(HAVE_DL_API)
118                         LIBS="$LIBS -ldl",
119                         LIBEXT="a"
120                 )
121         ),
122         LIBEXT="a"
124 AC_SUBST(XLIB)
125 AC_SUBST(X_DLLS)
126 X_DLLS=""
127 AC_SUBST(XFILES)
128 XFILES=""
129 AC_SUBST(OPENGLFILES)
130 OPENGLFILES=""
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                         dnl Check for the Color Table and Paletted Texture extensions
262                         AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
263                                        AC_TRY_COMPILE([#include <GL/gl.h>],
264                                        [GLenum test = GL_COLOR_INDEX8_EXT;],
265                                        [AC_DEFINE(HAVE_GL_COLOR_TABLE)],))
267                         AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
268                         AC_CHECK_LIB(GL,glXGetProcAddressARB,AC_DEFINE(HAVE_GLX_GETPROCADDRESS),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
270                         if test $ac_cv_lib_GL_glXGetProcAddressARB = "yes"
271                         then
272                                 AC_DEFINE(HAVE_OPENGL)
273                                 OPENGLFILES='$(OPENGLFILES)'
274                         fi
275                 fi
276              fi
277          fi
278     fi
280     CPPFLAGS="$ac_save_CPPFLAGS"
281     X_DLLS='$(X_DLLS)'
282     XFILES='$(XFILES)'
283 else
284     XLIB=""
285     X_CFLAGS=""
286     X_LIBS=""
289 dnl **** Check which curses lib to use ***
290 if test "$CURSES" = "yes"
291 then
292     AC_CHECK_HEADERS(ncurses.h)
293     if test "$ac_cv_header_ncurses_h" = "yes"
294     then 
295         AC_CHECK_LIB(ncurses,waddch)
296     fi
297     if test "$ac_cv_lib_ncurses_waddch" = "yes"
298     then
299         AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
300         AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
301     else
302         AC_CHECK_HEADERS(curses.h)
303         if test "$ac_cv_header_curses_h" = "yes"
304         then    
305             AC_CHECK_LIB(curses,waddch)
306             if test "$ac_cv_lib_curses_waddch" = "yes"
307             then
308                 AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
309                 AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
310             fi
311         fi
312     fi
315 dnl **** Check for IPX (currently Linux only) ****
316 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
317  AC_TRY_COMPILE(
318    [#include <sys/socket.h>
319     #include <netipx/ipx.h>],
320    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
321    [ac_cv_c_ipx_gnu="yes"],
322    [ac_cv_c_ipx_gnu="no"])
324 if test "$ac_cv_c_ipx_gnu" = "yes"
325 then
326     AC_DEFINE(HAVE_IPX_GNU)
329 if test "$ac_cv_c_ipx_gnu" = "no"
330 then
331  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
332   AC_TRY_COMPILE(
333     [#include <sys/socket.h>
334      #include <asm/types.h>
335      #include <linux/ipx.h>],
336     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
337     [ac_cv_c_ipx_linux="yes"],
338     [ac_cv_c_ipx_linux="no"])
339   )
340   if test "$ac_cv_c_ipx_linux" = "yes"
341   then
342       AC_DEFINE(HAVE_IPX_LINUX)
343   fi
346 dnl **** Check for Open Sound System ****
347 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
349 AC_CACHE_CHECK("for Open Sound System",
350         ac_cv_c_opensoundsystem,
351         AC_TRY_COMPILE([
352         #if defined(HAVE_SYS_SOUNDCARD_H)
353                 #include <sys/soundcard.h>
354         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
355                 #include <machine/soundcard.h>
356         #elif defined(HAVE_SOUNDCARD_H)
357                 #include <soundcard.h>
358         #endif
359         ],[
361 /* check for one of the Open Sound System specific SNDCTL_ defines */
362 #if !defined(SNDCTL_DSP_STEREO)
363 #error No open sound system
364 #endif
365 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
367 if test "$ac_cv_c_opensoundsystem" = "yes"
368 then
369     AC_DEFINE(HAVE_OSS)
372 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
373         ac_cv_c_opensoundsystem_midi,
374         AC_TRY_COMPILE([
375         #if defined(HAVE_SYS_SOUNDCARD_H)
376                 #include <sys/soundcard.h>
377         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
378                 #include <machine/soundcard.h>
379         #elif defined(HAVE_SOUNDCARD_H)
380                 #include <soundcard.h>
381         #endif
382         ],[
384 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
385 #if !defined(SNDCTL_SEQ_SYNC)
386 #error No open sound system MIDI interface
387 #endif
388 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
390 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
391 then
392     AC_DEFINE(HAVE_OSS_MIDI)
395 dnl **** If ln -s doesn't work, use cp instead ****
396 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
398 dnl **** Check for gcc strength-reduce bug ****
400 if test "x${GCC}" = "xyes"
401 then
402   CFLAGS="$CFLAGS -Wall"
403   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
404                   AC_TRY_RUN([
405 int main(void) {
406   static int Array[[3]];
407   unsigned int B = 3;
408   int i;
409   for(i=0; i<B; i++) Array[[i]] = i - 3;
410   exit( Array[[1]] != -2 );
412     ac_cv_c_gcc_strength_bug="no",
413     ac_cv_c_gcc_strength_bug="yes",
414     ac_cv_c_gcc_strength_bug="yes") )
415   if test "$ac_cv_c_gcc_strength_bug" = "yes"
416   then
417     CFLAGS="$CFLAGS -fno-strength-reduce"
418   fi
421 dnl **** Check for underscore on external symbols ****
423 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
424                ac_cv_c_extern_prefix,
425 [saved_libs=$LIBS
426 LIBS="conftest_asm.s $LIBS"
427 cat > conftest_asm.s <<EOF
428         .globl _ac_test
429 _ac_test:
430         .long 0
432 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
433             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
434 LIBS=$saved_libs])
435 if test "$ac_cv_c_extern_prefix" = "yes"
436 then
437   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
440 dnl **** Check for .string in assembler ****
442 AC_CACHE_CHECK("whether assembler accepts .string",
443                ac_cv_c_asm_string,
444 [saved_libs=$LIBS
445 LIBS="conftest_asm.s $LIBS"
446 cat > conftest_asm.s <<EOF
447         .string "test"
449 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
450 LIBS=$saved_libs])
451 if test "$ac_cv_c_asm_string" = "yes"
452 then
453   AC_DEFINE(HAVE_ASM_STRING)
456 dnl **** Check for working dll ****
458 LDSHARED=""
459 if test "$LIBEXT" = "so"
460 then
461   AC_CACHE_CHECK("whether we can build a Linux dll",
462                  ac_cv_c_dll_linux,
463   [saved_cflags=$CFLAGS
464   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
465   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
466   CFLAGS=$saved_cflags
467   ])
468   if test "$ac_cv_c_dll_linux" = "yes"
469   then
470     LDSHARED="\$(CC) -shared -Wl,-soname,\$(SONAME),-rpath,\$(libdir)"
471   else
472     AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
473                  ac_cv_c_dll_unixware,
474     [saved_cflags=$CFLAGS
475     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0"
476     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
477     CFLAGS=$saved_cflags
478     ])
479     if test "$ac_cv_c_dll_unixware" = "yes"
480     then
481       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/\$(SONAME)"
482     else
483       AC_CACHE_CHECK("whether we can build a NetBSD dll",
484                    ac_cv_c_dll_netbsd,
485       [saved_cflags=$CFLAGS
486       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
487       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
488       CFLAGS=$saved_cflags
489       ])
490       if test "$ac_cv_c_dll_netbsd" = "yes"
491       then
492         LDSHARED="ld -Bshareable -Bforcearchive"
493       fi
494     fi
495   fi
496   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
497   then
498     LIBEXT="a"
499   fi
502 DLLFLAGS=""
503 BUILDFLAGS=""
505 if test "$LIBEXT" = "so"; then
506     BUILDFLAGS="-pic"
507     DLLFLAGS="-fPIC"
508     DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine"
509 else
510     DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine \$(X_LIBS) \$(XLIB)"
511     AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)],
512                    ac_cv_c_whole_archive,
513             [saved_cflags=$CFLAGS
514             CFLAGS="$CFLAGS -Wl,--whole-archive -Wl,--no-whole-archive"
515             AC_TRY_LINK(,[return 1],ac_cv_c_whole_archive="yes",ac_cv_c_whole_archive="no")
516             CFLAGS=$saved_cflags
517             ])
518     if test "$ac_cv_c_whole_archive" = "yes"
519     then
520         DLL_LINK="-Wl,--whole-archive $DLL_LINK -Wl,--no-whole-archive"
521     else
522         AC_CACHE_CHECK([whether the linker supports -z {all,default}extract (Linux)],
523                        ac_cv_c_allextract,
524                 [saved_cflags=$CFLAGS
525                 CFLAGS="$CFLAGS -Wl,-z,allextract -Wl,-z,defaultextract"
526                 AC_TRY_LINK(,[return 1],ac_cv_c_allextract="yes",ac_cv_c_allextract="no")
527                 CFLAGS=$saved_cflags
528                 ])
529         if test "$ac_cv_c_allextract" = "yes"
530         then
531             DLL_LINK="-Wl,-z,allextract $DLL_LINK -Wl,-z,defaultextract"
532         fi
533     fi
536 AC_SUBST(DLL_LINK)
537 AC_SUBST(BUILDFLAGS)
538 AC_SUBST(DLLFLAGS)
539 AC_SUBST(LDSHARED)
540 AC_SUBST(LIBEXT)
542 dnl **** Check for reentrant libc ****
544 dnl For cross-compiling we blindly assume that libc is reentrant. This is
545 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
547 wine_cv_libc_reentrant=no 
548 dnl 
549 dnl Linux style errno location
550 dnl 
551 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
552   [AC_TRY_RUN([int myerrno = 0;
553 char buf[256];
554 int *__errno_location(){return &myerrno;}
555 main(){connect(0,buf,255); exit(!myerrno);}],
556   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
557   wine_cv_libc_r__errno_location=yes )
559 if test "$wine_cv_libc_r__errno_location" = "yes"
560 then
561     AC_DEFINE(HAVE__ERRNO_LOCATION)
562     wine_cv_libc_reentrant=__errno_location 
565 dnl FreeBSD style errno location
566 dnl 
567 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
568   [AC_TRY_RUN([int myerrno = 0;
569 char buf[256];
570 int *__error(){return &myerrno;}
571 main(){connect(0,buf,255); exit(!myerrno);}],
572     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
573     wine_cv_libc_r__error=yes )
575 if test "$wine_cv_libc_r__error" = "yes"
576 then
577     AC_DEFINE(HAVE__ERROR)
578     wine_cv_libc_reentrant=__error 
581 dnl Solaris style errno location
582 dnl 
583 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
584   [AC_TRY_RUN([int myerrno = 0;
585 char buf[256];
586 int *___errno(){return &myerrno;}
587 main(){connect(0,buf,255); exit(!myerrno);}],
588     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
589     wine_cv_libc_r___errno=yes )
591 if test "$wine_cv_libc_r___errno" = "yes"
592 then
593     AC_DEFINE(HAVE___ERRNO)
594     wine_cv_libc_reentrant=___errno 
597 dnl UnixWare style errno location
598 dnl 
599 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
600   [AC_TRY_RUN([int myerrno = 0;
601 char buf[256];
602 int *__thr_errno(){return &myerrno;}
603 main(){connect(0,buf,255); exit(!myerrno);}],
604     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
605     wine_cv_libc_r__thr_errno=yes )
607 if test "$wine_cv_libc_r__thr_errno" = "yes"
608 then
609     AC_DEFINE(HAVE__THR_ERRNO)
610     wine_cv_libc_reentrant=__thr_errno 
612 if test "$wine_cv_libc_reentrant" = "no" 
613 then
614   AC_DEFINE(NO_REENTRANT_LIBC)
617 dnl **** Check for reentrant X libraries ****
619 dnl This may fail to determine whether X libraries are reentrant if
620 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
621 dnl is possible with the --without-reentrant-x option.
623 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
624 then
625 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
626   [ if test "x$with_reentrant_x" = "xno" 
627     then
628         wine_cv_x_reentrant=no
629     else
630         libX11_check=none
631         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
632             if test -r $dir/libX11.so; then
633                 libX11_check="-D $dir/libX11.so"
634                 break 1
635             fi
636             if test -r $dir/libX11.a; then
637                 libX11_check="$dir/libX11.a"
638                 break 1
639             fi
640         done
641         if test "$libX11_check" != "none"; then
642             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
643             then
644                 wine_cv_x_reentrant=yes
645             else
646                 wine_cv_x_reentrant=no
647             fi
648         else
649             wine_cv_x_reentrant=unknown
650         fi
651     fi ] )
652 else
653     wine_cv_x_reentrant=no
655 if test "$wine_cv_x_reentrant" = "no"
656 then
657   AC_DEFINE(NO_REENTRANT_X11)
660 dnl **** Check for endianness ****
662 AC_C_BIGENDIAN
664 dnl **** Check for functions ****
666 AC_FUNC_ALLOCA()
667 AC_CHECK_FUNCS(\
668         __libc_fork \
669         _lwp_create \
670         clone \
671         getnetbyaddr \
672         getnetbyname \
673         getpagesize \
674         getprotobyname \
675         getprotobynumber \
676         getservbyport \
677         getsockopt \
678         inet_network \
679         memmove \
680         rfork \
681         select \
682         sendmsg \
683         settimeofday \
684         sigaltstack \
685         statfs \
686         strcasecmp \
687         strerror \
688         strncasecmp \
689         tcgetattr \
690         timegm \
691         usleep \
692         vfscanf \
693         wait4 \
694         waitpid \
697 dnl **** Check for header files ****
699 AC_CHECK_HEADERS(\
700         a.out.h \
701         a_out.h \
702         arpa/inet.h \
703         arpa/nameser.h \
704         elf.h \
705         float.h \
706         libio.h \
707         link.h \
708         linux/cdrom.h \
709         linux/joystick.h \
710         linux/ucdrom.h \
711         net/if.h \
712         netinet/in.h \
713         netinet/tcp.h \
714         pty.h \
715         resolv.h \
716         sched.h \
717         socket.h \
718         strings.h \
719         sys/cdio.h \
720         sys/errno.h \
721         sys/file.h \
722         sys/filio.h \
723         sys/ipc.h \
724         sys/lwp.h \
725         sys/mman.h \
726         sys/modem.h \
727         sys/mount.h \
728         sys/msg.h \
729         sys/param.h \
730         sys/reg.h \
731         sys/signal.h \
732         sys/shm.h \
733         sys/socket.h \
734         sys/sockio.h \
735         sys/statfs.h \
736         sys/strtio.h \
737         sys/syscall.h \
738         sys/wait.h \
739         sys/v86.h \
740         sys/v86intr.h \
741         sys/vfs.h \
742         sys/vm86.h \
743         syscall.h \
744         ucontext.h \
745         wctype.h \
747 AC_HEADER_STAT()
749 dnl **** Check for types ****
751 AC_C_CONST()
752 AC_C_INLINE()
753 AC_TYPE_SIZE_T()
754 AC_CHECK_SIZEOF(long long,0)
756 if test "$ac_cv_header_linux_joystick_h" = "yes"
757 then
758    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
759         wine_cv_linux_joystick_22_api,
760         AC_TRY_COMPILE([
761         #include <sys/ioctl.h>
762         #include <linux/joystick.h>
764         struct js_event blub;
765         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
766         #error "no 2.2 header"
767         #endif
768         ],/*empty*/,
769         wine_cv_linux_joystick_22_api=yes,
770         wine_cv_linux_joystick_22_api=no,
771         wine_cv_linux_joystick_22_api=no
772         )
773    )
774    if test "$wine_cv_linux_joystick_22_api" = "yes"
775    then
776       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
777    fi
780 dnl **** statfs checks ****
782 if test "$ac_cv_header_sys_vfs_h" = "yes"
783 then
784     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
785                     wine_cv_sys_vfs_has_statfs,
786         AC_TRY_COMPILE([
787         #include <sys/types.h>
788         #ifdef HAVE_SYS_PARAM_H
789         # include <sys/param.h>
790         #endif
791         #include <sys/vfs.h>
792         ],[
793                 struct statfs stfs;
795                 memset(&stfs,0,sizeof(stfs));
796         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
797         )
798     )
799     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
800     then
801       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
802     fi
805 if test "$ac_cv_header_sys_statfs_h" = "yes"
806 then
807     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
808                     wine_cv_sys_statfs_has_statfs,
809         AC_TRY_COMPILE([
810         #include <sys/types.h>
811         #ifdef HAVE_SYS_PARAM_H
812         # include <sys/param.h>
813         #endif
814         #include <sys/statfs.h>
815         ],[
816                 struct statfs stfs;
817         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
818         )
819     )
820     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
821     then
822       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
823     fi
826 if test "$ac_cv_header_sys_mount_h" = "yes"
827 then
828     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
829                     wine_cv_sys_mount_has_statfs,
830         AC_TRY_COMPILE([
831         #include <sys/types.h>
832         #ifdef HAVE_SYS_PARAM_H
833         # include <sys/param.h>
834         #endif
835         #include <sys/mount.h>
836         ],[
837                 struct statfs stfs;
838         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
839         )
840     )
841     if test "$wine_cv_sys_mount_has_statfs" = "yes"
842     then
843       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
844     fi
847 dnl **** FIXME: what about mixed cases, where we need two of them? ***
849 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
850   [ if test "x$statfs_bfree" = "xno"
851     then
852         wine_cv_statfs_bfree=no
853     else
854         AC_TRY_COMPILE([
855         #include <sys/types.h>
856         #ifdef HAVE_SYS_PARAM_H
857         # include <sys/param.h>
858         #endif
859         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
860         # include <sys/mount.h>
861         #else
862         # ifdef STATFS_DEFINED_BY_SYS_VFS
863         #  include <sys/vfs.h>
864         # else
865         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
866         #   include <sys/statfs.h>
867         #  endif
868         # endif
869         #endif
870         ],[
871                 struct statfs stfs;
873                 stfs.f_bfree++;
874         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
875         )
876     fi ] )
877 if test "$wine_cv_statfs_bfree" = "yes"
878 then
879   AC_DEFINE(STATFS_HAS_BFREE)
882 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
883   [ if test "x$statfs_bavail" = "xno"
884     then
885         wine_cv_statfs_bavail=no
886     else
887         AC_TRY_COMPILE([
888         #include <sys/types.h>
889         #ifdef HAVE_SYS_PARAM_H
890         # include <sys/param.h>
891         #endif
892         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
893         # include <sys/mount.h>
894         #else
895         # ifdef STATFS_DEFINED_BY_SYS_VFS
896         #  include <sys/vfs.h>
897         # else
898         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
899         #   include <sys/statfs.h>
900         #  endif
901         # endif
902         #endif
903         ],[
904                 struct statfs stfs;
906                 stfs.f_bavail++;
907         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
908         )
909     fi ] )
910 if test "$wine_cv_statfs_bavail" = "yes"
911 then
912   AC_DEFINE(STATFS_HAS_BAVAIL)
915 dnl *** check for file descriptor passing with msg_accrights
917 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
918  AC_TRY_COMPILE([#include <sys/types.h>
919 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
920                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
921 if test "$ac_cv_c_msg_accrights" = "yes"
922 then
923     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
926 dnl *** Check for the sun_len member in struct sockaddr_un
928 AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sun_len,
929  AC_TRY_COMPILE([#include <sys/types.h>
930 #include <sys/socket.h>
931 #include <sys/un.h>], [static struct sockaddr_un addr; addr.sun_len = 1],
932                 ac_cv_c_sun_len="yes", ac_cv_c_sun_len="no"))
933 if test "$ac_cv_c_sun_len" = "yes"
934 then
935     AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)
938 dnl *** check for the need to define __i386__
940 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
941  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
943 #endif],
944  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
945 if test "$ac_cv_cpp_def_i386" = "yes"
946 then
947     CFLAGS="$CFLAGS -D__i386__"
948     LINTFLAGS="$LINTFLAGS -D__i386__"
951 dnl $GCC is set by autoconf
952 GCC_NO_BUILTIN=""
953 if test "$GCC" = "yes"
954 then
955     GCC_NO_BUILTIN="-fno-builtin"
957 AC_SUBST(GCC_NO_BUILTIN)
959 dnl **** Generate output files ****
961 AC_OUTPUT_COMMANDS([
962 extra_subdirs="\
963 dlls/ddraw/d3ddevice \
964 dlls/ddraw/dclipper \
965 dlls/ddraw/ddraw \
966 dlls/ddraw/direct3d \
967 dlls/ddraw/dpalette \
968 dlls/ddraw/dsurface \
970 for i in $extra_subdirs; do [ -d $i ] || (echo "creating $i" && mkdir $i); done ])
972 MAKE_RULES=Make.rules
973 AC_SUBST_FILE(MAKE_RULES)
975 MAKE_DLL_RULES=dlls/Makedll.rules
976 AC_SUBST_FILE(MAKE_DLL_RULES)
978 AC_OUTPUT([
979 Make.rules
980 Makefile
981 console/Makefile
982 controls/Makefile
983 debugger/Makefile
984 dlls/Makedll.rules
985 dlls/Makefile
986 dlls/advapi32/Makefile
987 dlls/avifil32/Makefile
988 dlls/comctl32/Makefile
989 dlls/commdlg/Makefile
990 dlls/crtdll/Makefile
991 dlls/dciman32/Makefile
992 dlls/ddraw/Makefile
993 dlls/dinput/Makefile
994 dlls/display/Makefile
995 dlls/dplayx/Makefile
996 dlls/dsound/Makefile
997 dlls/gdi/Makefile
998 dlls/icmp/Makefile
999 dlls/imagehlp/Makefile
1000 dlls/imm32/Makefile
1001 dlls/lzexpand/Makefile
1002 dlls/mouse/Makefile
1003 dlls/mpr/Makefile
1004 dlls/msacm/Makefile
1005 dlls/msacm32/Makefile
1006 dlls/msnet32/Makefile
1007 dlls/msvideo/Makefile
1008 dlls/ntdll/Makefile
1009 dlls/odbc32/Makefile
1010 dlls/ole32/Makefile
1011 dlls/oleaut32/Makefile
1012 dlls/olecli/Makefile
1013 dlls/oledlg/Makefile
1014 dlls/olepro32/Makefile
1015 dlls/olesvr/Makefile
1016 dlls/opengl32/Makefile
1017 dlls/psapi/Makefile
1018 dlls/rasapi32/Makefile
1019 dlls/richedit/Makefile
1020 dlls/setupx/Makefile
1021 dlls/shell32/Makefile
1022 dlls/sound/Makefile
1023 dlls/stress/Makefile
1024 dlls/tapi32/Makefile
1025 dlls/ttydrv/Makefile
1026 dlls/urlmon/Makefile
1027 dlls/user/Makefile
1028 dlls/version/Makefile
1029 dlls/win32s/Makefile
1030 dlls/win87em/Makefile
1031 dlls/winaspi/Makefile
1032 dlls/windebug/Makefile
1033 dlls/wing/Makefile
1034 dlls/wininet/Makefile
1035 dlls/winmm/Makefile
1036 dlls/winmm/joystick/Makefile
1037 dlls/winmm/mcianim/Makefile
1038 dlls/winmm/mciavi/Makefile
1039 dlls/winmm/mcicda/Makefile
1040 dlls/winmm/mciseq/Makefile
1041 dlls/winmm/mciwave/Makefile
1042 dlls/winmm/midimap/Makefile
1043 dlls/winmm/wavemap/Makefile
1044 dlls/winmm/wineoss/Makefile
1045 dlls/winsock/Makefile
1046 dlls/winspool/Makefile
1047 dlls/ttydrv/Makefile
1048 dlls/x11drv/Makefile
1049 documentation/Makefile
1050 documentation/wine.conf.man
1051 documentation/wine.man
1052 files/Makefile
1053 graphics/Makefile
1054 graphics/enhmetafiledrv/Makefile
1055 graphics/metafiledrv/Makefile
1056 graphics/psdrv/Makefile
1057 graphics/ttydrv/Makefile
1058 graphics/win16drv/Makefile
1059 graphics/x11drv/Makefile
1060 if1632/Makefile
1061 include/Makefile
1062 library/Makefile
1063 libtest/Makefile
1064 loader/Makefile
1065 loader/ne/Makefile
1066 loader/dos/Makefile
1067 memory/Makefile
1068 misc/Makefile
1069 miscemu/Makefile
1070 msdos/Makefile
1071 objects/Makefile
1072 ole/Makefile
1073 programs/Makefile
1074 programs/clock/Makefile
1075 programs/cmdlgtst/Makefile
1076 programs/control/Makefile
1077 programs/avitools/Makefile
1078 programs/osversioncheck/Makefile
1079 programs/notepad/Makefile
1080 programs/progman/Makefile
1081 programs/regtest/Makefile
1082 programs/regapi/Makefile
1083 programs/view/Makefile
1084 programs/wcmd/Makefile
1085 programs/winemine/Makefile
1086 programs/winhelp/Makefile
1087 programs/winver/Makefile
1088 relay32/Makefile
1089 resources/Makefile
1090 scheduler/Makefile
1091 server/Makefile
1092 tools/Makefile
1093 tools/cvdump/Makefile
1094 tools/wrc/Makefile
1095 tsx11/Makefile
1096 win32/Makefile
1097 windows/Makefile
1098 windows/ttydrv/Makefile
1099 windows/x11drv/Makefile ])
1101 if test "$have_x" = "no"
1102 then
1103   echo
1104   echo "*** Warning: X development files not found. Wine will be built without"
1105   echo "*** X support, which currently does not work, and would probably not be"
1106   echo "*** what you want anyway. You will need to install devel packages of"
1107   echo "*** Xlib/Xfree86 and Xpm at the very least."
1108 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1109 then
1110   echo
1111   echo "*** Warning: Xpm development files not found. Wine will be built without"
1112   echo "*** Xpm support, which currently does not work. You will need to install"
1113   echo "*** devel packages of Xpm."
1116 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1117 then
1118   echo
1119   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1120   echo "*** terminal resize support. Consider upgrading ncurses."
1123 if test "$wine_cv_libc_reentrant" = "no" 
1124 then
1125   echo
1126   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1127   echo "*** thread support. Consider upgrading libc to a more recent"
1128   echo "*** reentrant version of libc."
1131 if test "$wine_cv_opengl_version_OK" = "no"
1132 then
1133   echo
1134   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1135   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1138 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "normal"
1139 then
1140   echo
1141   echo "*** Warning: the OpenGL version you have installed relies on libpthread for"
1142   echo "*** thread-safety. To prevent crashes, OpenGL support has been removed."
1143   echo "*** A fix for glibc 2.1.3 that seem to work is included in this version of Wine,"
1144   echo "*** start configure with '--enable-opengl' to force OpenGL support."
1147 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "yes"
1148 then
1149   echo
1150   echo "*** Warning: you explicitely linked in a thread-safe OpenGL version. If you"
1151   echo "*** experience unusual crashes on DirectDraw games, try first to disable OpenGL"
1152   echo "*** support before reporting bugs."
1156 echo
1157 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1158 echo
1160 dnl Local Variables:
1161 dnl comment-start: "dnl "
1162 dnl comment-end: ""
1163 dnl comment-start-skip: "\\bdnl\\b\\s *"
1164 dnl compile-command: "autoconf"
1165 dnl End: