Get HCU name from unix user name.
[wine.git] / configure.in
blobf597f9b8366f44a0aec541ce9cc6f44e00a23cfa
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 MAIN_TARGET=emu
17 LIB_TYPE=dll    # one of static, dll, nolib
18 TRACE_MSGS=yes  # the TRACE() macro
19 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
21 AC_ARG_ENABLE(emulator,
22 [  --disable-emulator      build only the Wine library, not the emulator],
23 [if test "$enableval" = "no"; then MAIN_TARGET="lib"; fi])
25 AC_ARG_ENABLE(dll,
26 [  --disable-dll           build static libraries instead of DLLs],
27 [if test "$enableval" = "no"; then LIB_TYPE="static"; fi])
29 AC_ARG_ENABLE(lib,
30 [  --disable-lib           build the Wine without building libwine.a],
31 [if test "$enableval" = "no"; then LIB_TYPE="nolib"; fi])
33 AC_ARG_ENABLE(debug,
34 [  --disable-debug         compile out all debugging messages],
35 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
37 AC_ARG_ENABLE(trace,
38 [  --disable-trace         compile out TRACE messages],
39 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
41 AC_ARG_WITH(reentrant-x,
42 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
44 AC_SUBST(MAIN_TARGET)
45 AC_SUBST(OPTIONS)
47 if test "$DEBUG_MSGS" = "no"
48 then
49     AC_DEFINE(NO_DEBUG_MSGS)
50     AC_DEFINE(NO_TRACE_MSGS)
51 else
52     if test "$TRACE_MSGS" = "no"
53     then
54         AC_DEFINE(NO_TRACE_MSGS)
55     fi
58 dnl **** Check for some programs ****
60 AC_PROG_MAKE_SET
61 AC_PROG_CC
62 AC_PROG_CPP
63 AC_PATH_XTRA
64 AC_PROG_YACC
65 AC_PROG_LEX
66 AC_PROG_RANLIB
67 AC_PROG_INSTALL
68 AC_PROG_LN_S
69 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
70 AC_PATH_PROG(LDCONFIG, ldconfig, false, /sbin:/usr/sbin:$PATH)
72 dnl Check for lint
73 AC_CHECK_PROGS(LINT, lclint lint)
74 if test "$LINT" = "lint"
75 then
76   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
77   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
79 AC_SUBST(LINT)
80 AC_SUBST(LINTFLAGS)
82 dnl **** Check for some libraries ****
84 dnl Check for -lm for BeOS
85 AC_CHECK_LIB(m,sqrt)
86 dnl Check for -li386 for NetBSD and OpenBSD
87 AC_CHECK_LIB(i386,i386_set_ldt)
88 dnl Check for -lossaudio for NetBSD
89 AC_CHECK_LIB(ossaudio,_oss_ioctl)
90 dnl Check for -lw for Solaris
91 AC_CHECK_LIB(w,iswalnum)
92 dnl Check for -lnsl for Solaris
93 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))
94 dnl Check for -lsocket for Solaris
95 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
96 dnl Check for -lxpg4 for FreeBSD
97 AC_CHECK_LIB(xpg4,setrunelocale)
98 dnl Check for -lmmap for OS/2
99 AC_CHECK_LIB(mmap,mmap)
100 dnl Check for openpty
101 AC_CHECK_FUNCS(openpty,,
102         AC_CHECK_LIB(util,openpty,
103                 AC_DEFINE(HAVE_OPENPTY)
104                 LIBS="$LIBS -lutil"
105         ))
107 AC_CHECK_HEADERS(dlfcn.h,
108         AC_CHECK_FUNCS(dlopen,
109                 AC_DEFINE(HAVE_DL_API),
110                 AC_CHECK_LIB(dl,dlopen,
111                         AC_DEFINE(HAVE_DL_API)
112                         LIBS="$LIBS -ldl"
113                 )
114         )
116 AC_SUBST(XLIB)
117 if test "$have_x" = "yes"
118 then
119     XLIB="-lXext -lX11"
120     ac_save_CPPFLAGS="$CPPFLAGS"
121     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
123     dnl Check for -lXpm
124     AC_CHECK_HEADERS(X11/xpm.h)
125     if test "$ac_cv_header_X11_xpm_h" = "yes"
126     then 
127         AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
128     else
129         echo "When compiling with X support, you need the Xpm library, or"
130         echo "WINE will not work. This Xpm library is within the following RPM,"
131         echo "which you need to install:"
132         echo "Redhat            :       xpm, xpm-devel"
133         echo "Caldera OpenLinux :       xpm, xpm-devel, xpm-devel-static"
134         echo "SuSE:                     xpm"
135         echo
136         echo "Or get the sources from ftp.x.org and all its mirror sites from "
137         echo "the directory /contrib/libraries."
138         echo
139         exit 1
140     fi
143     dnl Check for X Shm extension
144     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/XShm.h)
145     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_XShm_h" = "yes"
146     then 
147         AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
148     fi
149     dnl Check for XFree86 DGA / DGA 2.0 extension
150     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86dga.h)
151     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86dga_h" = "yes"
152     then 
153          AC_CHECK_LIB(Xxf86dga,
154                       XDGAQueryExtension,
155                       AC_DEFINE(HAVE_LIBXXF86DGA2) AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
156          if test "$ac_cv_lib_Xxf86dga_XDGAQueryExtension" = "no"
157          then
158            AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
159          fi
160     fi
162     dnl Check for XFree86 VMODE extension
163     AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/xf86vmode.h)
164     if test "$ac_cv_header_X11_Xlib_h" = "yes" -a "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
165     then 
166         AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
167     fi
169     dnl Check for the presence of Mesa
170     AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/osmesa.h)
171     if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
172     then
173         dnl Check for some problems due to old Mesa versions
174         AC_CACHE_CHECK("for up-to-date Mesa version", wine_cv_mesa_version_OK,
175           AC_TRY_COMPILE(
176             [#include <GL/gl.h>],
177             [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
178             [wine_cv_mesa_version_OK="yes"],
179             [wine_cv_mesa_version_OK="no"]
180           )
181         )
183         if test "$wine_cv_mesa_version_OK" = "yes"
184         then
185             dnl Check for the presense of the library
186             AC_CHECK_LIB(GL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lGL",,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
187             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
188             then
189                 AC_CHECK_LIB(MesaGL,glXCreateContext,AC_DEFINE(HAVE_LIBMESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
190             fi
192             dnl Check for the Color Table and Paletted Texture extensions
193             AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
194               AC_TRY_COMPILE(
195                 [#include <GL/gl.h>],
196                 [GLenum test = GL_COLOR_INDEX8_EXT;],
197                 [AC_DEFINE(HAVE_GL_COLOR_TABLE)],
198               )
199             )
200             if test "$ac_cv_lib_GL_glXCreateContext" = "no"
201             then
202                 AC_CHECK_LIB(MesaGL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
203             else
204                 AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
205             fi
206         fi
207     fi
209     CPPFLAGS="$ac_save_CPPFLAGS"
210 else
211     XLIB=""
212     X_CFLAGS=""
213     X_LIBS=""
216 dnl **** Check which curses lib to use ***
217 AC_CHECK_HEADERS(ncurses.h)
218 if test "$ac_cv_header_ncurses_h" = "yes"
219 then 
220     AC_CHECK_LIB(ncurses,waddch)
222 if test "$ac_cv_lib_ncurses_waddch" = "yes"
223 then
224     AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
225     AC_CHECK_LIB(ncurses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
226 else
227     AC_CHECK_HEADERS(curses.h)
228     if test "$ac_cv_header_curses_h" = "yes"
229     then    
230        AC_CHECK_LIB(curses,waddch)
231        AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
232        AC_CHECK_LIB(curses,getbkgd,AC_DEFINE(HAVE_GETBKGD))
233     fi
236 dnl **** Check for IPX (currently Linux only) ****
237 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
238  AC_TRY_COMPILE(
239    [#include <sys/socket.h>
240     #include <netipx/ipx.h>],
241    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
242    [ac_cv_c_ipx_gnu="yes"],
243    [ac_cv_c_ipx_gnu="no"])
245 if test "$ac_cv_c_ipx_gnu" = "yes"
246 then
247     AC_DEFINE(HAVE_IPX_GNU)
250 if test "$ac_cv_c_ipx_gnu" = "no"
251 then
252  AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
253   AC_TRY_COMPILE(
254     [#include <sys/socket.h>
255      #include <asm/types.h>
256      #include <linux/ipx.h>],
257     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
258     [ac_cv_c_ipx_linux="yes"],
259     [ac_cv_c_ipx_linux="no"])
260   )
261   if test "$ac_cv_c_ipx_linux" = "yes"
262   then
263       AC_DEFINE(HAVE_IPX_LINUX)
264   fi
267 dnl **** Check for Open Sound System ****
268 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
270 AC_CACHE_CHECK("for Open Sound System",
271         ac_cv_c_opensoundsystem,
272         AC_TRY_COMPILE([
273         #if defined(HAVE_SYS_SOUNDCARD_H)
274                 #include <sys/soundcard.h>
275         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
276                 #include <machine/soundcard.h>
277         #elif defined(HAVE_SOUNDCARD_H)
278                 #include <soundcard.h>
279         #endif
280         ],[
282 /* check for one of the Open Sound System specific SNDCTL_ defines */
283 #if !defined(SNDCTL_DSP_STEREO)
284 #error No open sound system
285 #endif
286 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
288 if test "$ac_cv_c_opensoundsystem" = "yes"
289 then
290     AC_DEFINE(HAVE_OSS)
293 AC_CACHE_CHECK("for Open Sound System/MIDI interface",
294         ac_cv_c_opensoundsystem_midi,
295         AC_TRY_COMPILE([
296         #if defined(HAVE_SYS_SOUNDCARD_H)
297                 #include <sys/soundcard.h>
298         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
299                 #include <machine/soundcard.h>
300         #elif defined(HAVE_SOUNDCARD_H)
301                 #include <soundcard.h>
302         #endif
303         ],[
305 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
306 #if !defined(SNDCTL_SEQ_SYNC)
307 #error No open sound system MIDI interface
308 #endif
309 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
311 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
312 then
313     AC_DEFINE(HAVE_OSS_MIDI)
316 dnl **** If ln -s doesn't work, use cp instead ****
317 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
319 dnl **** Check for gcc strength-reduce bug ****
321 if test "x${GCC}" = "xyes"
322 then
323   CFLAGS="$CFLAGS -Wall"
324   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
325                   AC_TRY_RUN([
326 int main(void) {
327   static int Array[[3]];
328   unsigned int B = 3;
329   int i;
330   for(i=0; i<B; i++) Array[[i]] = i - 3;
331   exit( Array[[1]] != -2 );
333     ac_cv_c_gcc_strength_bug="no",
334     ac_cv_c_gcc_strength_bug="yes",
335     ac_cv_c_gcc_strength_bug="yes") )
336   if test "$ac_cv_c_gcc_strength_bug" = "yes"
337   then
338     CFLAGS="$CFLAGS -fno-strength-reduce"
339   fi
342 dnl **** Check for underscore on external symbols ****
344 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
345                ac_cv_c_extern_prefix,
346 [saved_libs=$LIBS
347 LIBS="conftest_asm.s $LIBS"
348 cat > conftest_asm.s <<EOF
349         .globl _ac_test
350 _ac_test:
351         .long 0
353 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
354             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
355 LIBS=$saved_libs])
356 if test "$ac_cv_c_extern_prefix" = "yes"
357 then
358   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
361 dnl **** Check for .string in assembler ****
363 AC_CACHE_CHECK("whether assembler accepts .string",
364                ac_cv_c_asm_string,
365 [saved_libs=$LIBS
366 LIBS="conftest_asm.s $LIBS"
367 cat > conftest_asm.s <<EOF
368         .string "test"
370 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
371 LIBS=$saved_libs])
372 if test "$ac_cv_c_asm_string" = "yes"
373 then
374   AC_DEFINE(HAVE_ASM_STRING)
377 dnl **** Check for working dll ****
379 LDSHARED=""
380 if test "$LIB_TYPE" = "dll"
381 then
382   AC_CACHE_CHECK("whether we can build a Linux dll",
383                  ac_cv_c_dll_linux,
384   [saved_cflags=$CFLAGS
385   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
386   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
387   CFLAGS=$saved_cflags
388   ])
389   if test "$ac_cv_c_dll_linux" = "yes"
390   then
391     LDSHARED="\$(CC) -shared -Wl,-soname,\$(SONAME),-rpath,\$(libdir)"
392   else
393     AC_CACHE_CHECK("whether we can build a UnixWare dll",
394                  ac_cv_c_dll_unixware,
395     [saved_cflags=$CFLAGS
396     CFLAGS="$CFLAGS -fPIC -Wl,-G,conftest.so.1.0"
397     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
398     CFLAGS=$saved_cflags
399     ])
400     if test "$ac_cv_c_dll_unixware" = "yes"
401     then
402       LDSHARED="\$(CC) -Wl,-G,-h,\$(libdir)/\$(SONAME)"
403     else
404       AC_CACHE_CHECK("whether we can build a NetBSD dll",
405                    ac_cv_c_dll_netbsd,
406       [saved_cflags=$CFLAGS
407       CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
408       AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
409       CFLAGS=$saved_cflags
410       ])
411       if test "$ac_cv_c_dll_netbsd" = "yes"
412       then
413         LDSHARED="ld -Bshareable -Bforcearchive"
414       fi
415     fi
416   fi
417   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
418   then
419     LIB_TYPE="static"
420   fi
423 DLLFLAGS=""
424 BUILDFLAGS=""
425 LIBEXT="a"
427 if test "$LIB_TYPE" = "nolib"; then
428     ALT_LINK="\$(LIBOBJS) \$(X11OBJS)"
429     LIB_TARGET=""
430 else
431     ALT_LINK="-Wl,--whole-archive -L\$(TOPOBJDIR) -lwine -Wl,--no-whole-archive"
432     if test "$LIB_TYPE" = "dll"; then
433         LIB_TARGET="libwine.so"
434         BUILDFLAGS="-pic"
435         DLLFLAGS="-fPIC"
436         LIBEXT="so"
437     else
438         LIB_TARGET="libwine.a"
439     fi
442 AC_SUBST(LIB_TARGET)
443 AC_SUBST(LIB_TYPE)
444 AC_SUBST(ALT_LINK)
445 AC_SUBST(BUILDFLAGS)
446 AC_SUBST(DLLFLAGS)
447 AC_SUBST(LDSHARED)
448 AC_SUBST(LIBEXT)
450 dnl **** Check for reentrant libc ****
452 dnl For cross-compiling we blindly assume that libc is reentrant. This is
453 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
455 wine_cv_libc_reentrant=no 
456 dnl 
457 dnl Linux style errno location
458 dnl 
459 AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
460   [AC_TRY_RUN([int myerrno = 0;
461 char buf[256];
462 int *__errno_location(){return &myerrno;}
463 main(){connect(0,buf,255); exit(!myerrno);}],
464   wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
465   wine_cv_libc_r__errno_location=yes )
467 if test "$wine_cv_libc_r__errno_location" = "yes"
468 then
469     AC_DEFINE(HAVE__ERRNO_LOCATION)
470     wine_cv_libc_reentrant=__errno_location 
473 dnl FreeBSD style errno location
474 dnl 
475 AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
476   [AC_TRY_RUN([int myerrno = 0;
477 char buf[256];
478 int *__error(){return &myerrno;}
479 main(){connect(0,buf,255); exit(!myerrno);}],
480     wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
481     wine_cv_libc_r__error=yes )
483 if test "$wine_cv_libc_r__error" = "yes"
484 then
485     AC_DEFINE(HAVE__ERROR)
486     wine_cv_libc_reentrant=__error 
489 dnl Solaris style errno location
490 dnl 
491 AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
492   [AC_TRY_RUN([int myerrno = 0;
493 char buf[256];
494 int *___errno(){return &myerrno;}
495 main(){connect(0,buf,255); exit(!myerrno);}],
496     wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
497     wine_cv_libc_r___errno=yes )
499 if test "$wine_cv_libc_r___errno" = "yes"
500 then
501     AC_DEFINE(HAVE___ERRNO)
502     wine_cv_libc_reentrant=___errno 
505 dnl UnixWare style errno location
506 dnl 
507 AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
508   [AC_TRY_RUN([int myerrno = 0;
509 char buf[256];
510 int *__thr_errno(){return &myerrno;}
511 main(){connect(0,buf,255); exit(!myerrno);}],
512     wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
513     wine_cv_libc_r__thr_errno=yes )
515 if test "$wine_cv_libc_r__thr_errno" = "yes"
516 then
517     AC_DEFINE(HAVE__THR_ERRNO)
518     wine_cv_libc_reentrant=__thr_errno 
520 if test "$wine_cv_libc_reentrant" = "no" 
521 then
522   AC_DEFINE(NO_REENTRANT_LIBC)
525 dnl **** Check for reentrant X libraries ****
527 dnl This may fail to determine whether X libraries are reentrant if
528 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
529 dnl is possible with the --without-reentrant-x option.
531 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
532 then
533 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
534   [ if test "x$with_reentrant_x" = "xno" 
535     then
536         wine_cv_x_reentrant=no
537     else
538         libX11_check=none
539         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
540             if test -r $dir/libX11.so; then
541                 libX11_check="-D $dir/libX11.so"
542                 break 1
543             fi
544             if test -r $dir/libX11.a; then
545                 libX11_check="$dir/libX11.a"
546                 break 1
547             fi
548         done
549         if test "$libX11_check" != "none"; then
550             if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
551             then
552                 wine_cv_x_reentrant=yes
553             else
554                 wine_cv_x_reentrant=no
555             fi
556         else
557             wine_cv_x_reentrant=unknown
558         fi
559     fi ] )
560 else
561     wine_cv_x_reentrant=no
563 if test "$wine_cv_x_reentrant" = "no"
564 then
565   AC_DEFINE(NO_REENTRANT_X11)
568 dnl **** Check for endianness ****
570 AC_C_BIGENDIAN
572 dnl **** Check for functions ****
574 AC_FUNC_ALLOCA()
575 AC_CHECK_FUNCS(\
576         _lwp_create \
577         clone \
578         getnetbyaddr \
579         getnetbyname \
580         getpagesize \
581         getprotobyname \
582         getprotobynumber \
583         getservbyport \
584         getsockopt \
585         inet_network \
586         memmove \
587         rfork \
588         select \
589         sendmsg \
590         settimeofday \
591         sigaltstack \
592         statfs \
593         strcasecmp \
594         strerror \
595         strncasecmp \
596         tcgetattr \
597         timegm \
598         usleep \
599         vfscanf \
600         wait4 \
601         waitpid \
604 dnl **** Check for header files ****
606 AC_CHECK_HEADERS(\
607         a.out.h \
608         a_out.h \
609         arpa/inet.h \
610         arpa/nameser.h \
611         curses.h \
612         elf.h \
613         float.h \
614         libio.h \
615         link.h \
616         linux/cdrom.h \
617         linux/joystick.h \
618         linux/ucdrom.h \
619         ncurses.h \
620         net/if.h \
621         netinet/in.h \
622         netinet/tcp.h \
623         pty.h \
624         resolv.h \
625         sched.h \
626         socket.h \
627         strings.h \
628         sys/cdio.h \
629         sys/errno.h \
630         sys/file.h \
631         sys/filio.h \
632         sys/ipc.h \
633         sys/lwp.h \
634         sys/mman.h \
635         sys/modem.h \
636         sys/mount.h \
637         sys/msg.h \
638         sys/param.h \
639         sys/signal.h \
640         sys/shm.h \
641         sys/socket.h \
642         sys/sockio.h \
643         sys/statfs.h \
644         sys/strtio.h \
645         sys/syscall.h \
646         sys/wait.h \
647         sys/v86.h \
648         sys/v86intr.h \
649         sys/vfs.h \
650         sys/vm86.h \
651         syscall.h \
652         ucontext.h \
653         wctype.h \
655 AC_HEADER_STAT()
657 dnl **** Check for types ****
659 AC_C_CONST()
660 AC_C_INLINE()
661 AC_TYPE_SIZE_T()
662 AC_CHECK_SIZEOF(long long,0)
664 if test "$ac_cv_header_linux_joystick_h" = "yes"
665 then
666    AC_CACHE_CHECK("whether linux/joystick.h uses the Linux 2.2+ API",
667         wine_cv_linux_joystick_22_api,
668         AC_TRY_COMPILE([
669         #include <sys/ioctl.h>
670         #include <linux/joystick.h>
672         struct js_event blub;
673         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
674         #error "no 2.2 header"
675         #endif
676         ],/*empty*/,
677         wine_cv_linux_joystick_22_api=yes,
678         wine_cv_linux_joystick_22_api=no,
679         wine_cv_linux_joystick_22_api=no
680         )
681    )
682    if test "$wine_cv_linux_joystick_22_api"
683    then
684       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API)
685    fi
688 dnl **** statfs checks ****
690 if test "$ac_cv_header_sys_vfs_h" = "yes"
691 then
692     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
693                     wine_cv_sys_vfs_has_statfs,
694         AC_TRY_COMPILE([
695         #include <sys/types.h>
696         #ifdef HAVE_SYS_PARAM_H
697         # include <sys/param.h>
698         #endif
699         #include <sys/vfs.h>
700         ],[
701                 struct statfs stfs;
703                 memset(&stfs,0,sizeof(stfs));
704         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
705         )
706     )
707     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
708     then
709       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
710     fi
713 if test "$ac_cv_header_sys_statfs_h" = "yes"
714 then
715     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
716                     wine_cv_sys_statfs_has_statfs,
717         AC_TRY_COMPILE([
718         #include <sys/types.h>
719         #ifdef HAVE_SYS_PARAM_H
720         # include <sys/param.h>
721         #endif
722         #include <sys/statfs.h>
723         ],[
724                 struct statfs stfs;
725         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
726         )
727     )
728     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
729     then
730       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
731     fi
734 if test "$ac_cv_header_sys_mount_h" = "yes"
735 then
736     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
737                     wine_cv_sys_mount_has_statfs,
738         AC_TRY_COMPILE([
739         #include <sys/types.h>
740         #ifdef HAVE_SYS_PARAM_H
741         # include <sys/param.h>
742         #endif
743         #include <sys/mount.h>
744         ],[
745                 struct statfs stfs;
746         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
747         )
748     )
749     if test "$wine_cv_sys_mount_has_statfs" = "yes"
750     then
751       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
752     fi
755 dnl **** FIXME: what about mixed cases, where we need two of them? ***
757 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
758   [ if test "x$statfs_bfree" = "xno"
759     then
760         wine_cv_statfs_bfree=no
761     else
762         AC_TRY_COMPILE([
763         #include <sys/types.h>
764         #ifdef HAVE_SYS_PARAM_H
765         # include <sys/param.h>
766         #endif
767         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
768         # include <sys/mount.h>
769         #else
770         # ifdef STATFS_DEFINED_BY_SYS_VFS
771         #  include <sys/vfs.h>
772         # else
773         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
774         #   include <sys/statfs.h>
775         #  endif
776         # endif
777         #endif
778         ],[
779                 struct statfs stfs;
781                 stfs.f_bfree++;
782         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
783         )
784     fi ] )
785 if test "$wine_cv_statfs_bfree" = "yes"
786 then
787   AC_DEFINE(STATFS_HAS_BFREE)
790 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
791   [ if test "x$statfs_bavail" = "xno"
792     then
793         wine_cv_statfs_bavail=no
794     else
795         AC_TRY_COMPILE([
796         #include <sys/types.h>
797         #ifdef HAVE_SYS_PARAM_H
798         # include <sys/param.h>
799         #endif
800         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
801         # include <sys/mount.h>
802         #else
803         # ifdef STATFS_DEFINED_BY_SYS_VFS
804         #  include <sys/vfs.h>
805         # else
806         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
807         #   include <sys/statfs.h>
808         #  endif
809         # endif
810         #endif
811         ],[
812                 struct statfs stfs;
814                 stfs.f_bavail++;
815         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
816         )
817     fi ] )
818 if test "$wine_cv_statfs_bavail" = "yes"
819 then
820   AC_DEFINE(STATFS_HAS_BAVAIL)
823 dnl *** check for working sigaltstack
824 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
826 AC_CACHE_CHECK("for working sigaltstack",
827         ac_cv_c_working_sigaltstack,
828         AC_TRY_RUN([
829         #include <stdio.h>
830         #include <time.h> /* <sys/time.h> ? bad magic without end */
831         #include <sys/types.h>
832         #include <sys/signal.h>
833         #ifdef HAVE_SYS_PARAM_H
834         # include <sys/param.h>
835         #endif
836         #ifdef HAVE_SYSCALL_H
837         # include <syscall.h>
838         #else
839         # ifdef HAVE_SYS_SYSCALL_H
840         #  include <sys/syscall.h>
841         # endif
842         #endif
843         
844         unsigned char *xaltstack;
846         int
847         main(int argc,char **argv) {
848             struct sigaltstack  ss;
850             xaltstack = malloc(16384);
851             ss.ss_sp    = xaltstack;
852             ss.ss_size  = 16384;
853             ss.ss_flags = 0;
854             if (sigaltstack(&ss, NULL) < 0) {
855                 /* this catches the glibc case */
856                 perror("sigaltstack");
857                 return (1); /* aka exit(1) aka fail */
858             }
859             /* assume it works. */
860             return 0; /* OK */
861         }
862         ],
863         ac_cv_c_working_sigaltstack="yes",
864         ac_cv_c_working_sigaltstack="no",
865         ac_cv_c_working_sigaltstack="no"
868 if test "$ac_cv_c_working_sigaltstack" = "yes"
869 then
870     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
874 dnl *** check for file descriptor passing with msg_accrights
876 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
877  AC_TRY_COMPILE([#include <sys/types.h>
878 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
879                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
880 if test "$ac_cv_c_msg_accrights" = "yes"
881 then
882     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
885 dnl *** check for the need to define __i386__
887 AC_CACHE_CHECK("whether we need to define __i386__",ac_cv_cpp_def_i386,
888  AC_EGREP_CPP(yes,[#if (defined(i386) || defined(__i386)) && !defined(__i386__)
890 #endif],
891  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
892 if test "$ac_cv_cpp_def_i386" = "yes"
893 then
894     CFLAGS="$CFLAGS -D__i386__"
895     LINTFLAGS="$LINTFLAGS -D__i386__"
898 dnl $GCC is set by autoconf
899 GCC_NO_BUILTIN=""
900 if test "$GCC" = "yes"
901 then
902     GCC_NO_BUILTIN="-fno-builtin"
904 AC_SUBST(GCC_NO_BUILTIN)
906 dnl **** Generate output files ****
908 MAKE_RULES=Make.rules
909 AC_SUBST_FILE(MAKE_RULES)
911 AC_OUTPUT([
912 Make.rules
913 Makefile
914 console/Makefile
915 controls/Makefile
916 debugger/Makefile
917 dlls/Makefile
918 dlls/advapi32/Makefile
919 dlls/avifil32/Makefile
920 dlls/comctl32/Makefile
921 dlls/commdlg/Makefile
922 dlls/crtdll/Makefile
923 dlls/dciman32/Makefile
924 dlls/display/Makefile
925 dlls/dplayx/Makefile
926 dlls/dsound/Makefile
927 dlls/icmp/Makefile
928 dlls/imagehlp/Makefile
929 dlls/imm32/Makefile
930 dlls/lzexpand/Makefile
931 dlls/mouse/Makefile
932 dlls/mpr/Makefile
933 dlls/msacm/Makefile
934 dlls/msacm32/Makefile
935 dlls/msnet32/Makefile
936 dlls/msvideo/Makefile
937 dlls/ntdll/Makefile
938 dlls/odbc32/Makefile
939 dlls/ole32/Makefile
940 dlls/oleaut32/Makefile
941 dlls/olecli/Makefile
942 dlls/oledlg/Makefile
943 dlls/olesvr/Makefile
944 dlls/psapi/Makefile
945 dlls/rasapi32/Makefile
946 dlls/shell32/Makefile
947 dlls/sound/Makefile
948 dlls/stress/Makefile
949 dlls/tapi32/Makefile
950 dlls/version/Makefile
951 dlls/win32s/Makefile
952 dlls/win87em/Makefile
953 dlls/winaspi/Makefile
954 dlls/windebug/Makefile
955 dlls/wing/Makefile
956 dlls/winmm/Makefile
957 dlls/winmm/mcianim/Makefile
958 dlls/winmm/mciavi/Makefile
959 dlls/winmm/mcicda/Makefile
960 dlls/winmm/mciseq/Makefile
961 dlls/winmm/mciwave/Makefile
962 dlls/winmm/midimap/Makefile
963 dlls/winmm/wavemap/Makefile
964 dlls/winmm/wineoss/Makefile
965 dlls/winsock/Makefile
966 dlls/winspool/Makefile
967 dlls/wnaspi32/Makefile
968 documentation/Makefile
969 documentation/wine.conf.man
970 documentation/wine.man
971 files/Makefile
972 graphics/Makefile
973 graphics/enhmetafiledrv/Makefile
974 graphics/metafiledrv/Makefile
975 graphics/psdrv/Makefile
976 graphics/ttydrv/Makefile
977 graphics/win16drv/Makefile
978 graphics/x11drv/Makefile
979 if1632/Makefile
980 include/Makefile
981 library/Makefile
982 libtest/Makefile
983 loader/Makefile
984 loader/ne/Makefile
985 loader/dos/Makefile
986 memory/Makefile
987 misc/Makefile
988 miscemu/Makefile
989 msdos/Makefile
990 objects/Makefile
991 ole/Makefile
992 programs/Makefile
993 programs/clock/Makefile
994 programs/cmdlgtst/Makefile
995 programs/control/Makefile
996 programs/avitools/Makefile
997 programs/osversioncheck/Makefile
998 programs/notepad/Makefile
999 programs/progman/Makefile
1000 programs/regtest/Makefile
1001 programs/regapi/Makefile
1002 programs/view/Makefile
1003 programs/wcmd/Makefile
1004 programs/winhelp/Makefile
1005 programs/winver/Makefile
1006 rc/Makefile
1007 relay32/Makefile
1008 resources/Makefile
1009 scheduler/Makefile
1010 server/Makefile
1011 tools/Makefile
1012 tools/wrc/Makefile
1013 tsx11/Makefile
1014 win32/Makefile
1015 windows/Makefile
1016 windows/ttydrv/Makefile
1017 windows/x11drv/Makefile ])
1019 if test "$have_x" = "no"
1020 then
1021   echo
1022   echo "*** Warning: X development files not found. Wine will be built without"
1023   echo "*** X support, which currently does not work, and would probably not be"
1024   echo "*** what you want anyway. You will need to install devel packages of"
1025   echo "*** Xlib/Xfree86 and Xpm at the very least."
1026 elif test "$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = "no"
1027 then
1028   echo
1029   echo "*** Warning: Xpm development files not found. Wine will be built without"
1030   echo "*** Xpm support, which currently does not work. You will need to install"
1031   echo "*** devel packages of Xpm."
1034 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1035 then
1036   echo
1037   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1038   echo "*** terminal resize support. Consider upgrading ncurses."
1041 if test "$wine_cv_libc_reentrant" = "no" 
1042 then
1043   echo
1044   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
1045   echo "*** thread support. Consider upgrading libc to a more recent"
1046   echo "*** reentrant version of libc."
1049 if test "$wine_cv_mesa_version_OK" = "no"
1050 then
1051   echo
1052   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1053   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)"
1056 echo
1057 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1058 echo
1060 dnl Local Variables:
1061 dnl comment-start: "dnl "
1062 dnl comment-end: ""
1063 dnl comment-start-skip: "\\bdnl\\b\\s *"
1064 dnl compile-command: "autoconf"
1065 dnl End: