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