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