Create two separate wine binaries, one using libpthread and one using
[wine] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Original author: Michael Patra
3 dnl See ChangeLog file for detailed change history.
4
5 m4_define(WINE_VERSION,regexp(m4_include(VERSION),[version \([-.0-9A-Za-z]+\)],[\1]))
6
7 AC_PREREQ(2.53)
8 AC_INIT([Wine],WINE_VERSION)
9 AC_CONFIG_SRCDIR(server/atom.c)
10 AC_CONFIG_HEADERS(include/config.h)
11 AC_CONFIG_AUX_DIR(tools)
12
13 dnl **** Command-line arguments ****
14
15 AC_ARG_ENABLE(win16, AC_HELP_STRING([--disable-win16],[do not include Win16 support]))
16 AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile out all debugging messages]))
17 AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE messages]))
18
19 AC_ARG_WITH(opengl,    AC_HELP_STRING([--without-opengl],[do not use OpenGL]))
20 AC_ARG_WITH(curses,    AC_HELP_STRING([--without-curses],[do not use curses]))
21 AC_ARG_WITH(nptl,      AC_HELP_STRING([--with-nptl],[use glibc NPTL threading support]))
22 AC_ARG_WITH(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>]))
23
24 AC_SUBST(WIN16_FILES,"\$(WIN16_FILES)")
25 AC_SUBST(WIN16_INSTALL,"\$(WIN16_INSTALL)")
26 if test "x$enable_win16" = "xno"
27 then
28   WIN16_FILES=""
29   WIN16_INSTALL=""
30 fi
31 if test "x$enable_debug" = "xno"
32 then
33     AC_DEFINE(NO_DEBUG_MSGS,1,[Define to disable all debug messages.])
34 fi
35 if test "x$enable_trace" = "xno" -o "x$enable_debug" = "xno"
36 then
37     AC_DEFINE(NO_TRACE_MSGS,1,[Define to disable trace messages.])
38 fi
39 if test "x$with_nptl" = "xyes"
40 then
41     AC_SUBST(MAIN_BINARY,"wine-pthread")
42 else
43     AC_SUBST(MAIN_BINARY,"wine-kthread")
44 fi
45
46 dnl **** Check for some programs ****
47
48 AC_CANONICAL_HOST
49 AC_PROG_MAKE_SET
50 AC_PROG_CC
51 AC_PROG_CPP
52
53 AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir,
54   [if test -z "$with_wine_tools"; then
55      if test "$cross_compiling" = "yes"; then
56        AC_MSG_ERROR([you must use the --with-wine-tools option when cross-compiling.])
57      else
58        wine_cv_toolsdir="\$(TOPOBJDIR)"
59      fi
60    elif test -d "$with_wine_tools/tools/winebuild"; then
61      case $with_wine_tools in
62        /*) wine_cv_toolsdir="$with_wine_tools" ;;
63        *)  wine_cv_toolsdir="\$(TOPOBJDIR)/$with_wine_tools" ;;
64      esac
65    else
66      AC_MSG_ERROR([could not find Wine tools in $with_wine_tools.])
67    fi])
68 AC_SUBST(TOOLSDIR,$wine_cv_toolsdir)
69
70 AC_PATH_XTRA
71 AC_PROG_YACC
72 AC_PROG_LEX
73
74 dnl **** Just additional warning checks, since AC_PROG just sets 'yacc' even
75 dnl **** without one present.
76 AC_CHECK_PROGS(XYACC,$YACC bison yacc,none)
77 if test "$XYACC" = "none"
78 then
79   AC_MSG_ERROR([no suitable bison/yacc found. Please install the 'bison' package.])
80 fi
81 AC_CHECK_PROGS(XLEX,$LEX flex lex,none)
82 if test "$XLEX" = "none"
83 then
84   AC_MSG_ERROR([no suitable lex found. Please install the 'flex' package.])
85 fi
86
87 AC_CHECK_TOOLS(AS,[gas as],as)
88 AC_CHECK_TOOL(LD,ld,ld)
89 AC_CHECK_TOOL(AR,ar,ar)
90 AC_PROG_RANLIB
91 AC_CHECK_TOOL(STRIP,strip,strip)
92 AC_CHECK_TOOL(WINDRES,windres,false)
93 AC_PROG_LN_S
94 WINE_PROG_LN
95 AC_PATH_PROG(LDCONFIG, ldconfig, true, [/sbin /usr/sbin $PATH])
96 AC_PROG_INSTALL
97 dnl Prepend src dir to install path dir if it's a relative path
98 case "$INSTALL" in
99   [[\\/$]]* | ?:[[\\/]]* ) ;;
100   *)  INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;;
101 esac
102
103 dnl Check for lint
104 AC_CHECK_PROGS(LINT, lclint lint)
105 if test "$LINT" = "lint"
106 then
107   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
108   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
109 fi
110 AC_SUBST(LINT)
111 AC_SUBST(LINTFLAGS)
112
113 dnl Check for db2html
114 AC_CHECK_PROGS(DB2HTML, docbook2html db2html, false)
115 AC_SUBST(DB2HTML)
116
117 dnl Check for db2pdf
118 AC_CHECK_PROGS(DB2PDF, docbook2pdf db2pdf, false)
119 AC_SUBST(DB2PDF)
120
121 dnl Check for db2ps
122 AC_CHECK_PROGS(DB2PS, docbook2ps db2ps, false)
123 AC_SUBST(DB2PS)
124
125 dnl Check for db2txt
126 AC_CHECK_PROGS(DB2TXT, docbook2txt db2txt, false)
127 AC_SUBST(DB2TXT)
128
129 dnl **** Check for some libraries ****
130
131 dnl Check for -lm
132 AC_CHECK_LIB(m,sqrt)
133 dnl Check for -li386 for NetBSD and OpenBSD
134 AC_CHECK_LIB(i386,i386_set_ldt)
135 dnl Check for -lossaudio for NetBSD
136 AC_CHECK_LIB(ossaudio,_oss_ioctl)
137 dnl Check for -lw for Solaris
138 AC_CHECK_FUNCS(iswalnum,,AC_CHECK_LIB(w,iswalnum))
139 dnl Check for -lnsl for Solaris
140 AC_CHECK_FUNCS(gethostbyname,,AC_CHECK_LIB(nsl,gethostbyname))
141 dnl Check for -lsocket for Solaris
142 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
143 dnl Check for -lresolv for Solaris
144 AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton))
145 dnl Check for -lxpg4 for FreeBSD
146 AC_CHECK_LIB(xpg4,_xpg4_setrunelocale)
147 dnl Check for -lpthread
148 AC_CHECK_LIB(pthread,pthread_create,AC_SUBST(LIBPTHREAD,"-lpthread"))
149
150 JPEGLIB=""
151 AC_SUBST(JPEGLIB)
152 AC_CHECK_HEADERS(jpeglib.h,
153     AC_CHECK_LIB(jpeg,jpeg_start_decompress,
154         AC_DEFINE(HAVE_LIBJPEG,1,[Define if you have libjpeg including devel headers])
155         JPEGLIB="-ljpeg"
156     )
157 )
158
159 AC_SUBST(GIFLIB,"")
160 AC_CHECK_HEADERS(gif_lib.h,
161     AC_CHECK_LIB(ungif,DGifOpen,
162         [AC_DEFINE(HAVE_LIBGIF,1,[Define if you have libgif/libungif including devel headers])
163          GIFLIB="-lungif"],
164         [AC_CHECK_LIB(gif,DGifOpen,
165                       [AC_DEFINE(HAVE_LIBGIF,1)
166                        GIFLIB="-lgif"])]))
167
168 AC_SUBST(XLIB)
169 AC_SUBST(XFILES)
170 XFILES=""
171 AC_SUBST(OPENGLFILES)
172 OPENGLFILES=""
173 AC_SUBST(GLU32FILES)
174 GLU32FILES=""
175 AC_SUBST(OPENGL_LIBS)
176 OPENGL_LIBS=""
177 if test "$have_x" = "yes"
178 then
179     XLIB="-lXext -lX11"
180     ac_save_CPPFLAGS="$CPPFLAGS"
181     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
182
183     dnl *** All of the following tests require X11/Xlib.h
184     AC_CHECK_HEADERS(X11/Xlib.h,
185       [
186         AC_CHECK_HEADERS([X11/XKBlib.h \
187                           X11/Xutil.h \
188                           X11/extensions/shape.h \
189                           X11/extensions/XShm.h \
190                           X11/extensions/Xrandr.h \
191                           X11/extensions/Xrender.h \
192                           X11/extensions/Xvlib.h \
193                           X11/extensions/xf86dga.h \
194                           X11/extensions/xf86vmode.h],,,
195                          [#include <X11/Xlib.h>
196                           #ifdef HAVE_X11_XUTIL_H
197                           # include <X11/Xutil.h>
198                           #endif])
199
200         dnl *** Check for X keyboard extension
201         if test "$ac_cv_header_X11_XKBlib_h" = "yes"
202         then
203               AC_CHECK_LIB(X11, XkbQueryExtension,
204               AC_DEFINE(HAVE_XKB, 1, [Define if you have the XKB extension]),,
205               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
206         fi
207
208         dnl *** Check for X Shm extension
209         if test "$ac_cv_header_X11_extensions_XShm_h" = "yes"
210         then
211               AC_CHECK_LIB(Xext, XShmQueryExtension,
212               AC_DEFINE(HAVE_LIBXXSHM, 1, [Define if you have the X Shm extension]),,
213               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
214         fi
215
216         dnl *** Check for X shape extension
217         if test "$ac_cv_header_X11_extensions_shape_h" = "yes"
218         then
219               AC_CHECK_LIB(Xext,XShapeQueryExtension,
220               AC_DEFINE(HAVE_LIBXSHAPE, 1, [Define if you have the X Shape extension]),,
221               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
222         fi
223
224         dnl *** Check for XFree86 DGA / DGA 2.0 extension
225         if test "$ac_cv_header_X11_extensions_xf86dga_h" = "yes"
226         then
227               AC_CHECK_LIB(Xxf86dga, XDGAQueryExtension,
228                 [ dnl *** If found...
229                   AC_DEFINE(HAVE_LIBXXF86DGA2, 1,
230                             [Define if you have the Xxf86dga library version 2])
231                   X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
232                ],
233                 [ dnl *** If not found, look for XF86DGAQueryExtension()
234                   dnl *** instead (DGA 2.0 not found)...
235                   AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,
236                     [ AC_DEFINE(HAVE_LIBXXF86DGA, 1,
237                                 [Define if you have the Xxf86dga library version 1])
238                       X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
239                     ],,
240                     $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
241                   )
242                 ],
243                 $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
244         fi
245
246         dnl *** Check for XFree86 VMODE extension
247         if test "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
248         then
249                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
250                   [ AC_DEFINE(HAVE_LIBXXF86VM, 1, [Define if you have the Xxf86vm library])
251                      X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
252                   ],,
253                   $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
254         fi
255
256         dnl *** Check for X RandR extension
257         if test "$ac_cv_header_X11_extensions_Xrandr_h" = "yes"
258         then
259                 AC_CHECK_LIB(Xrandr, XRRSetScreenConfigAndRate,
260                   [ AC_DEFINE(HAVE_LIBXRANDR, 1, [Define if you have the Xrandr library])
261                      X_PRE_LIBS="$X_PRE_LIBS -lXrandr -lXrender"
262                   ],,
263                   $X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS)
264         fi
265
266         dnl *** Check for XVideo extension supporting XvImages
267         if test "$ac_cv_header_X11_extensions_Xvlib_h" = "yes"
268         then
269                 AC_CHECK_LIB(Xv, XvShmCreateImage,
270                   [ AC_DEFINE(HAVE_XVIDEO, 1, [Define if the X libraries support XVideo])
271                      X_PRE_LIBS="$X_PRE_LIBS -lXv"
272                   ],,
273                   $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
274         fi
275       ]
276     ) dnl *** End of X11/Xlib.h check
277
278     dnl Check for the presence of OpenGL
279     if test "x$with_opengl" != "xno"
280     then
281         if test -f /usr/X11R6/lib/libGL.a -a ! -f /usr/X11R6/lib/libGL.so
282         then
283             AC_MSG_ERROR([/usr/X11R6/lib/libGL.a is present on your system.
284 This prevents linking to OpenGL. Delete the file and restart configure.])
285         fi
286
287         AC_CHECK_HEADERS(GL/gl.h GL/glx.h)
288         if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
289         then
290             AC_CHECK_HEADERS(GL/glext.h,,,[#include <GL/glx.h>])
291             dnl Check for some problems due to old Mesa versions
292             AC_CACHE_CHECK([for up-to-date OpenGL version], wine_cv_opengl_version_OK,
293               AC_TRY_COMPILE(
294                 [#include <GL/gl.h>],
295                 [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
296                 [wine_cv_opengl_version_OK="yes"],
297                 [wine_cv_opengl_version_OK="no"]
298               )
299             )
300
301             if test "$wine_cv_opengl_version_OK" = "yes"
302             then
303                 dnl Check for the presence of the library
304                 AC_CHECK_LIB(GL,glXCreateContext,
305                              OPENGL_LIBS="-lGL"
306                              ,,
307                              $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
308
309                 if test "$ac_cv_lib_GL_glXCreateContext" = "yes"
310                 then
311                         OPENGLFILES='$(OPENGLFILES)'
312                         AC_DEFINE(HAVE_OPENGL, 1, [Define if OpenGL is present on the system])
313
314                         AC_CHECK_LIB(GL,glXGetProcAddressARB,
315                                      AC_DEFINE(HAVE_GLX_GETPROCADDRESS, 1,
316                                                [Define if the OpenGL library supports the glXGetProcAddressARB call]),,
317                                      $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
318
319                         if test "$ac_cv_lib_GL_glXGetProcAddressARB" = "yes"
320                         then
321                                AC_CACHE_CHECK([for OpenGL extension functions prototypes], wine_cv_extension_prototypes,
322                                   [AC_TRY_COMPILE([#include <GL/gl.h>
323                                                   #ifdef HAVE_GL_GLEXT_H
324                                                   # include <GL/glext.h>
325                                                   #endif
326                                                   ],
327                                                  [PFNGLCOLORTABLEEXTPROC test_proc;],
328                                                  [wine_cv_extension_prototypes="yes"],
329                                                  [wine_cv_extension_prototypes="no"]
330                                   )]
331                                 )
332                                 if test "$wine_cv_extension_prototypes" = "yes"
333                                 then
334                                     AC_DEFINE(HAVE_GLEXT_PROTOTYPES, 1,
335                                               [Define if the OpenGL headers define extension typedefs])
336                                 fi
337                         fi
338
339                 fi
340                 dnl Check for GLU32 library.
341                 AC_CHECK_LIB(GLU,gluLookAt,
342                              [OPENGL_LIBS="$OPENGL_LIBS -lGLU"
343                              GLU32FILES='$(GLU32FILES)']
344                              ,,
345                              $OPENGL_LIBS $X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS
346                 )
347              fi
348          fi
349     fi
350
351     dnl **** Check for NAS ****
352     AC_SUBST(NASLIBS,"")
353     AC_CHECK_HEADERS(audio/audiolib.h,
354          [AC_CHECK_HEADERS(audio/soundlib.h,,,[#include <audio/audiolib.h>])
355           AC_CHECK_LIB(audio,AuCreateFlow,
356                        [AC_DEFINE(HAVE_NAS,1,[Define if you have NAS including devel headers])
357                         NASLIBS="-laudio -lXt $X_LIBS -lXext -lX11 $X_EXTRA_LIBS"],,
358                        [-lXt $X_LIBS -lXext -lX11 $X_EXTRA_LIBS])])
359
360     CPPFLAGS="$ac_save_CPPFLAGS"
361     XFILES='$(XFILES)'
362 else
363     XLIB=""
364     X_CFLAGS=""
365     X_LIBS=""
366 fi
367
368 dnl **** Check which curses lib to use ***
369 CURSESLIBS=""
370 if test "x$with_curses" != "xno"
371 then
372     AC_CHECK_HEADERS(ncurses.h,
373         [AC_CHECK_LIB(ncurses,waddch,
374             [AC_DEFINE(HAVE_LIBNCURSES, 1, [Define if you have the ncurses library (-lncurses)])
375              CURSESLIBS="-lncurses"],
376              [AC_CHECK_HEADERS(curses.h,
377                  [AC_CHECK_LIB(curses,waddch,
378                      [AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have the curses library (-lcurses)])
379                       CURSESLIBS="-lcurses"])])])])
380     saved_libs="$LIBS"
381     LIBS="$CURSESLIBS $LIBS"
382     AC_CHECK_FUNCS(getbkgd resizeterm)
383     LIBS="$saved_libs"
384 fi
385 AC_SUBST(CURSESLIBS)
386
387 dnl **** Check for SANE ****
388 AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
389 if test "$sane_devel" = "no"
390 then
391     SANELIBS=""
392     SANEINCL=""
393 else
394     SANELIBS="`$sane_devel --libs`"
395     SANEINCL="`$sane_devel --cflags`"
396     ac_save_CPPFLAGS="$CPPFLAGS"
397     ac_save_LIBS="$LIBS"
398     CPPFLAGS="$CPPFLAGS $SANEINCL"
399     LIBS="$LIBS $SANELIBS"
400     AC_CHECK_HEADER(sane/sane.h,
401                     [AC_CHECK_LIB(sane,sane_open,
402                                   [AC_DEFINE(HAVE_SANE, 1, [Define if we have SANE development environment])],
403                                   [SANELIBS=""
404                                   SANEINCL=""])],
405                     [SANELIBS=""
406                     SANEINCL=""])
407     LIBS="$ac_save_LIBS"
408     CPPFLAGS="$ac_save_CPPFLAGS"
409 fi
410 AC_SUBST(SANELIBS)
411 AC_SUBST(SANEINCL)
412
413 dnl **** Check for the ICU library ****
414 AC_CHECK_HEADERS(unicode/ubidi.h)
415 if test "$ac_cv_header_unicode_ubidi_h" = "yes"
416 then
417     AC_CACHE_CHECK([whether we can statically link the ICU libraries], ac_cv_lib_icu,
418         [saved_libs="$LIBS"
419          ICU_LIB_DIR="${ICU_LIB_DIR-/usr/lib}"
420          ICUUC_LIB="${ICUUC_LIB-$ICU_LIB_DIR/libicuuc.a}"
421          ICUDATA_LIB="${ICUDATA_LIB-$ICU_LIB_DIR/libicudata.a}"
422          LIBS="$LIBS $ICUUC_LIB $ICUDATA_LIB -lstdc++ -lgcc_s"
423          AC_TRY_LINK([#include <unicode/ubidi.h>],[ubidi_open()],
424                      [ac_cv_lib_icu="yes"],[ac_cv_lib_icu="no"])
425         LIBS="$saved_libs"])
426     if test "$ac_cv_lib_icu" = "yes"
427     then
428         AC_DEFINE(HAVE_ICU,1,[Define to 1 if the ICU libraries are installed])
429         AC_SUBST(ICULIBS,"$ICUUC_LIB $ICUDATA_LIB -lstdc++ -lgcc_s")
430     fi
431 fi
432
433 dnl **** Check for FreeType 2 ****
434 AC_CHECK_LIB(freetype,FT_Init_FreeType,ft_lib=yes,ft_lib=no,$X_LIBS)
435 if test "$ft_lib" = "no"
436 then
437     FREETYPEINCL=""
438     wine_cv_msg_freetype=no
439 else
440     AC_CHECK_PROG(ft_devel,freetype-config,freetype-config,no)
441     if test "$ft_devel" = "no"
442     then
443         AC_CHECK_PROG(ft_devel2,freetype2-config,freetype2-config,no)
444         if test "$ft_devel2" = "freetype2-config"
445         then
446                 ft_devel=$ft_devel2
447         fi
448     fi
449     if test "$ft_devel" = "no"
450     then
451         FREETYPEINCL=""
452         wine_cv_msg_freetype=yes
453     else
454         FREETYPEINCL=`$ft_devel --cflags`
455         ac_save_CPPFLAGS="$CPPFLAGS"
456         CPPFLAGS="$FREETYPEINCL $CPPFLAGS"
457         AC_CHECK_HEADERS(freetype/freetype.h \
458                          freetype/ftglyph.h \
459                          freetype/tttables.h \
460                          freetype/ftnames.h \
461                          freetype/ftsnames.h \
462                          freetype/ttnameid.h \
463                          freetype/ftoutln.h \
464                          freetype/internal/sfnt.h)
465         AC_TRY_CPP([#include <ft2build.h>
466                     #include <freetype/fttrigon.h>],
467                     [AC_DEFINE(HAVE_FREETYPE_FTTRIGON_H, 1,
468           [Define if you have the <freetype/fttrigon.h> header file.])
469                     wine_cv_fttrigon=yes],
470                     wine_cv_fttrigon=no)
471         CPPFLAGS="$ac_save_CPPFLAGS"
472         dnl Check that we have at least freetype/freetype.h
473         if test "$ac_cv_header_freetype_freetype_h" = "yes" -a "$wine_cv_fttrigon" = "yes"
474         then
475             AC_DEFINE(HAVE_FREETYPE, 1, [Define if FreeType 2 is installed])
476             wine_cv_msg_freetype=no
477         else
478             FREETYPEINCL=""
479             wine_cv_msg_freetype=yes
480         fi
481     fi
482 fi
483 AC_SUBST(FREETYPEINCL)
484
485 dnl **** Check for parport (currently Linux only) ****
486 AC_CACHE_CHECK([for parport header/ppdev.h], ac_cv_c_ppdev,
487  AC_TRY_COMPILE(
488    [#include <linux/ppdev.h>],
489    [ioctl (1,PPCLAIM,0)],
490    [ac_cv_c_ppdev="yes"],
491    [ac_cv_c_ppdev="no"])
492  )
493 if test "$ac_cv_c_ppdev" = "yes"
494 then
495     AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access])
496 fi
497
498 dnl **** Check for va_copy ****
499 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
500  AC_TRY_LINK(
501    [#include <stdarg.h>],
502    [va_list ap1, ap2;
503     va_copy(ap1,ap2);
504    ],
505    [ac_cv_c_va_copy="yes"],
506    [ac_cv_c_va_copy="no"])
507  )
508 if test "$ac_cv_c_va_copy" = "yes"
509 then
510     AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
511 fi
512 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
513  AC_TRY_LINK(
514    [#include <stdarg.h>],
515    [va_list ap1, ap2;
516     __va_copy(ap1,ap2);
517    ],
518    [ac_cv_c___va_copy="yes"],
519    [ac_cv_c___va_copy="no"])
520  )
521 if test "$ac_cv_c___va_copy" = "yes"
522 then
523     AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
524 fi
525
526 dnl **** Check for pthread_rwlock_t ****
527 AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE
528 #include <pthread.h>])
529
530 dnl **** Check for Open Sound System ****
531 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
532
533 AC_CACHE_CHECK([for Open Sound System],
534         ac_cv_c_opensoundsystem,
535         AC_TRY_COMPILE([
536         #if defined(HAVE_SYS_SOUNDCARD_H)
537                 #include <sys/soundcard.h>
538         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
539                 #include <machine/soundcard.h>
540         #elif defined(HAVE_SOUNDCARD_H)
541                 #include <soundcard.h>
542         #endif
543         ],[
544
545 /* check for one of the Open Sound System specific SNDCTL_ defines */
546 #if !defined(SNDCTL_DSP_STEREO)
547 #error No open sound system
548 #endif
549 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
550
551 if test "$ac_cv_c_opensoundsystem" = "yes"
552 then
553     AC_DEFINE(HAVE_OSS, 1, [Define if you have the Open Sound system])
554 fi
555
556 AC_CACHE_CHECK([for Open Sound System/MIDI interface],
557         ac_cv_c_opensoundsystem_midi,
558         AC_TRY_COMPILE([
559         #if defined(HAVE_SYS_SOUNDCARD_H)
560                 #include <sys/soundcard.h>
561         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
562                 #include <machine/soundcard.h>
563         #elif defined(HAVE_SOUNDCARD_H)
564                 #include <soundcard.h>
565         #endif
566         ],[
567
568 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
569 #if !defined(SNDCTL_SEQ_SYNC)
570 #error No open sound system MIDI interface
571 #endif
572 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
573
574 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
575 then
576     AC_DEFINE(HAVE_OSS_MIDI, 1, [Define if you have the Open Sound system (MIDI interface)])
577 fi
578
579 dnl **** Check for aRts Sound Server ****
580 AC_PATH_PROG(ARTSCCONFIG, artsc-config)
581 AC_CACHE_CHECK([for aRts Sound server],
582         ac_cv_c_artsserver,
583         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"';
584         then
585             ac_cv_c_artsserver=no
586         else
587             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
588             ARTSC_LIBS=`$ARTSCCONFIG --libs`
589             ac_cv_c_artsserver=no
590             save_CFLAGS="$CFLAGS"
591             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
592             AC_TRY_COMPILE([
593              #include <artsc.h>
594             ],[
595              arts_stream_t stream;
596             ],[
597             ac_cv_c_artsserver=yes
598             ])
599             CFLAGS="$save_CFLAGS"
600         fi)
601
602 if test "$ac_cv_c_artsserver" = "yes"
603 then
604     AC_SUBST(ARTSLIBS, $ARTSC_LIBS)
605     AC_SUBST(ARTSINCL, $ARTSC_CFLAGS)
606
607     AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])
608 fi
609
610 dnl **** Check for ALSA ****
611 AC_SUBST(ALSALIBS,"")
612 AC_CHECK_HEADERS(alsa/asoundlib.h sys/asoundlib.h, break)
613 if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes"
614 then
615     AC_CHECK_LIB(asound,snd_pcm_open,
616         AC_DEFINE(HAVE_ALSA,1,[Define if you have ALSA including devel headers])
617         ALSALIBS="-lasound")
618 fi
619
620 dnl **** Check for libaudioio (which can be used to get solaris audio support) ****
621
622 AC_SUBST(AUDIOIOLIBS,"")
623 AC_CHECK_HEADERS(libaudioio.h,
624     [AC_CHECK_LIB(audioio,AudioIOGetVersion,
625                   [AUDIOIOLIBS="-laudioio"
626                    AC_DEFINE(HAVE_LIBAUDIOIO, 1, [Define if you have libaudioIO])])])
627
628 dnl **** Check for capi4linux ****
629
630 AC_CHECK_HEADERS(capi20.h,[
631         AC_CHECK_HEADERS(linux/capi.h,[
632                 AC_CHECK_LIB(capi20,capi20_register,[
633                         AC_DEFINE(HAVE_CAPI4LINUX,1,[Define if you have capi4linux libs and headers])
634                         AC_SUBST(CAPI4LINUXLIBS,"-lcapi20")
635                 ])
636         ])
637 ])
638
639 dnl **** Check for broken glibc mmap64 ****
640
641 AC_CACHE_CHECK( [whether mmap64 works defined as mmap], ac_cv_mmap64_works,
642         AC_TRY_RUN([
643                 #define _FILE_OFFSET_BITS 64
644                 #include <stdio.h>
645                 #include <unistd.h>
646                 #include <fcntl.h>
647                 #include <sys/mman.h>
648                 #include <errno.h>
649
650                 int main(int argc,char **argv) {
651                         int fd = open("conftest.map",O_CREAT|O_RDWR,0600);
652                         if (fd == -1) exit(1);
653
654                         unlink("conftest.map");
655
656                         write(fd,"test",4);
657
658                         if ((-1 == mmap(0,4,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0)) &&
659                             (errno == EINVAL)
660                         ) {
661                                 exit(1);
662                         }
663                         close(fd);
664                         fprintf(stderr,"success!\n");
665                         exit(0);
666                 }
667
668         ],
669     ac_cv_mmap64_works="yes",
670     ac_cv_mmap64_works="no",
671     ac_cv_mmap64_works="no") )
672
673 if test "$ac_cv_mmap64_works" = "yes"
674 then
675     AC_DEFINE(_FILE_OFFSET_BITS, 64, [Set this to 64 to enable 64-bit file support on Linux])
676 fi
677
678 dnl **** Check for gcc specific options ****
679
680 AC_SUBST(EXTRACFLAGS,"")
681 if test "x${GCC}" = "xyes"
682 then
683   EXTRACFLAGS=-Wall
684
685   dnl Check for strength-reduce bug
686   AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
687                   AC_TRY_RUN([
688 int     L[[4]] = {0,1,2,3};
689 int main(void) {
690   static int Array[[3]];
691   unsigned int B = 3;
692   int i;
693   for(i=0; i<B; i++) Array[[i]] = i - 3;
694   for(i=0; i<4 - 1; i++) L[[i]] = L[[i + 1]];
695   L[[i]] = 4;
696
697   exit( Array[[1]] != -2 || L[[2]] != 3);
698 }],
699     ac_cv_c_gcc_strength_bug="no",
700     ac_cv_c_gcc_strength_bug="yes",
701     ac_cv_c_gcc_strength_bug="yes") )
702   if test "$ac_cv_c_gcc_strength_bug" = "yes"
703   then
704     EXTRACFLAGS="$EXTRACFLAGS -fno-strength-reduce"
705   fi
706
707   dnl Check for -mpreferred-stack-boundary
708   AC_CACHE_CHECK([for gcc -mpreferred-stack-boundary=2 support], ac_cv_c_gcc_stack_boundary,
709       [WINE_TRY_CFLAGS([-mpreferred-stack-boundary=2],
710                       ac_cv_c_gcc_stack_boundary="yes",ac_cv_c_gcc_stack_boundary="no")])
711   if test "$ac_cv_c_gcc_stack_boundary" = "yes"
712   then
713     EXTRACFLAGS="$EXTRACFLAGS -mpreferred-stack-boundary=2"
714   fi
715
716   dnl Check for -fno-strict-aliasing
717   AC_CACHE_CHECK([for gcc -fno-strict-aliasing support], ac_cv_c_gcc_no_strict_aliasing,
718       [WINE_TRY_CFLAGS([-fno-strict-aliasing],
719                       ac_cv_c_gcc_no_strict_aliasing="yes",ac_cv_c_gcc_no_strict_aliasing="no")])
720   if test "$ac_cv_c_gcc_no_strict_aliasing" = "yes"
721   then
722     EXTRACFLAGS="$EXTRACFLAGS -fno-strict-aliasing"
723   fi
724
725   dnl Check for -gstabs+ option
726   AC_CACHE_CHECK([for gcc -gstabs+ support], ac_cv_c_gcc_gstabs,
727       [WINE_TRY_CFLAGS([-gstabs+],ac_cv_c_gcc_gstabs="yes", ac_cv_c_gcc_gstabs="no")])
728   if test "$ac_cv_c_gcc_gstabs" = "yes"
729   then
730     EXTRACFLAGS="$EXTRACFLAGS -gstabs+"
731   fi
732
733   dnl Check for noisy string.h
734   saved_CFLAGS="$CFLAGS"
735   CFLAGS="$CFLAGS -Wpointer-arith -Werror"
736   AC_CACHE_CHECK([for broken string.h that generates warnings], ac_cv_c_string_h_warnings,
737       AC_TRY_COMPILE([#include <string.h>],[],
738                      [ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes]))
739   CFLAGS="$saved_CFLAGS"
740   if test "$ac_cv_c_string_h_warnings" = "no"
741   then
742     EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
743   fi
744 fi
745
746 dnl **** Check how to define a function in assembly code ****
747
748 AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def,
749   WINE_TRY_ASM_LINK(
750       ["\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"],,,
751       ac_cv_asm_func_def=".def",
752     [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"],,,
753       ac_cv_asm_func_def=".type @function",
754     [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"],,,
755       ac_cv_asm_func_def=".type 2",
756       ac_cv_asm_func_def="unknown")])]))
757
758 AH_TEMPLATE(__ASM_FUNC,[Define to a macro to generate an assembly function directive])
759 case "$ac_cv_asm_func_def" in
760   ".def")
761      AC_DEFINE([__ASM_FUNC(name)], [".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"]) ;;
762   ".type @function")
763      AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",@function"]) ;;
764   ".type 2")
765      AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",2"]) ;;
766   *)
767      AC_DEFINE([__ASM_FUNC(name)], [""]) ;;
768 esac
769
770 dnl **** Check for underscore on external symbols ****
771
772 AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_extern_prefix,
773     WINE_TRY_ASM_LINK([".globl _ac_test\n_ac_test:\t.long 0"],
774                       [extern int ac_test;],
775                       [if (ac_test) return 1],
776                       ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no"))
777
778 AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
779 if test "$ac_cv_c_extern_prefix" = "yes"
780 then
781   AC_DEFINE([__ASM_NAME(name)], ["_" name])
782 else
783   AC_DEFINE([__ASM_NAME(name)], [name])
784 fi
785
786 dnl **** Check how to do strings in assembler ****
787
788 AC_CACHE_CHECK([whether assembler accepts .string], ac_cv_c_asm_string,
789     WINE_TRY_ASM_LINK([".data\n\t.string \"test\"\n\t.text"],,,
790                       ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no"))
791 if test "$ac_cv_c_asm_string" = "yes"
792 then
793   AC_DEFINE(__ASM_STRING, [".string"], [Define to the assembler keyword used to specify an ASCII string])
794 else
795     AC_CACHE_CHECK([whether assembler accepts .asciz], ac_cv_c_asm_asciz,
796         WINE_TRY_ASM_LINK([".data\n\t.asciz \"test\"\n\t.text"],,,
797                       ac_cv_c_asm_asciz="yes",ac_cv_c_asm_asciz="no"))
798     if test "$ac_cv_c_asm_asciz" = "yes"
799     then
800       AC_DEFINE(__ASM_STRING, [".asciz"])
801     else
802       AC_DEFINE(__ASM_STRING, [".ascii"])
803     fi                                  
804 fi
805
806 dnl **** Check for .short in assembler ****
807
808 AC_CACHE_CHECK([whether assembler accepts .short], ac_cv_c_asm_short,
809     WINE_TRY_ASM_LINK([".data\n\t.short 1\n\t.text"],,,
810                       ac_cv_c_asm_short="yes",ac_cv_c_asm_short="no"))
811 if test "$ac_cv_c_asm_short" = "yes"
812 then
813   AC_DEFINE(__ASM_SHORT, [".short"], [Define to the assembler keyword used to specify a word value])
814 else
815   AC_DEFINE(__ASM_SHORT, [".half"])
816 fi
817
818 dnl **** Check for working dll ****
819
820 AC_SUBST(DLLEXT,"")
821 AC_SUBST(DLLFLAGS,"-D_REENTRANT")
822 AC_SUBST(DLLIBS,"")
823 AC_SUBST(LDSHARED,"")
824 AC_SUBST(LDDLL,"")
825 AC_SUBST(LIBEXT,"so")
826 AC_SUBST(IMPLIBEXT,"def")
827
828 case $host_os in
829   cygwin*|mingw32*)
830     AC_CHECK_TOOL(DLLTOOL,dlltool,false)
831     AC_CHECK_TOOL(DLLWRAP,dllwrap,false)
832     if test "$DLLWRAP" = "false"; then
833       LIBEXT="a"
834     else
835       dnl FIXME - check whether dllwrap works correctly...
836       LIBEXT="dll"
837     fi
838     IMPLIBEXT="a"
839     ;;
840   *)
841     AC_CHECK_HEADERS(dlfcn.h,
842         [AC_CHECK_FUNCS(dlopen,,
843             [AC_CHECK_LIB(dl,dlopen,
844                          [AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen])
845                           DLLIBS="-ldl"],
846                          [LIBEXT="a"])])],
847         [LIBEXT="a"])
848
849     if test "$LIBEXT" = "so"
850     then
851       DLLFLAGS="$DLLFLAGS -fPIC"
852       DLLEXT=".so"
853       AC_CACHE_CHECK([whether we can build a GNU style ELF dll], ac_cv_c_dll_gnuelf,
854           [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic],
855                            ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")])
856       if test "$ac_cv_c_dll_gnuelf" = "yes"
857       then
858         LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
859         LDDLL="\$(CC) -shared -Wl,-Bsymbolic"
860         AC_CACHE_CHECK([whether the linker accepts -z defs], ac_cv_c_dll_zdefs,
861           [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-Bsymbolic,-z,defs],
862                            ac_cv_c_dll_zdefs="yes",ac_cv_c_dll_zdefs="no")])
863         if test "$ac_cv_c_dll_zdefs" = "yes"
864         then
865           LDDLL="$LDDLL,-z,defs"
866         fi
867         AC_CACHE_CHECK([whether we can relocate the executable to 0x3c000000], ac_cv_ld_reloc_exec,
868           [saved_CFLAGS="$CFLAGS"
869            CFLAGS="$CFLAGS -Wl,--section-start,.interp=0x3c000100"
870            AC_TRY_RUN([#include <unistd.h>
871                        int main() { return (sbrk(32*1024*1024) == (void *)-1); }],
872                       ac_cv_ld_reloc_exec="yes",
873                       ac_cv_ld_reloc_exec="no",
874                       ac_cv_ld_reloc_exec="no")
875            CFLAGS="$saved_CFLAGS"])
876         if test "$ac_cv_ld_reloc_exec" = "yes"
877         then
878           AC_SUBST(LDEXECFLAGS,["-Wl,--section-start,.interp=0x3c000100"])
879         fi
880       else
881         AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll, ac_cv_c_dll_unixware,
882             [WINE_TRY_CFLAGS([-fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic],
883                              ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
884         if test "$ac_cv_c_dll_unixware" = "yes"
885         then
886           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
887           LDDLL="\$(CC) -Wl,-G,-B,symbolic"
888         fi
889       fi
890     fi
891
892     dnl Check for cross compiler to build test programs
893     AC_SUBST(CROSSTEST,"")
894     if test "$cross_compiling" = "no"
895     then
896       AC_CHECK_PROGS(CROSSCC,i586-mingw32msvc-gcc i386-mingw32-gcc,false)
897       AC_CHECK_PROGS(DLLTOOL,i586-mingw32msvc-dlltool i386-mingw32-dlltool,false)
898       AC_CHECK_PROGS(CROSSWINDRES,i586-mingw32msvc-windres i386-mingw32-windres,false)
899       if test "$CROSSCC" != "false"; then CROSSTEST="\$(CROSSTEST)"; fi
900     fi
901     ;;
902 esac
903
904 if test "$LIBEXT" = "a"; then
905   AC_MSG_ERROR(
906 [could not find a way to build shared libraries.
907 It is currently not possible to build Wine without shared library
908 (.so) support to allow transparent switch between .so and .dll files.
909 If you are using Linux, you will need a newer binutils.]
910 )
911 fi
912
913 case $build_os in
914   cygwin*|mingw32*)
915     AC_SUBST(LDPATH,"PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\"") ;;
916   *)
917     AC_SUBST(LDPATH,"LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\"") ;;
918 esac
919
920 dnl Mingw needs explicit msvcrt for linking libwine
921 AC_SUBST(CRTLIBS,"")
922 case $host_os in
923   mingw32*)
924     CRTLIBS="-lmsvcrt" ;;
925 esac
926
927 dnl **** Get the soname for libraries that we load dynamically ****
928
929 if test "$LIBEXT" = "so"
930 then
931   WINE_GET_SONAME(X11,XCreateWindow,[$X_LIBS $X_EXTRA_LIBS])
932   WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
933   WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
934   WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS])
935   WINE_GET_SONAME(GL,glXQueryExtension,[$X_LIBS $X_EXTRA_LIBS])
936   WINE_GET_SONAME(cups,cupsGetDefault)
937   WINE_GET_SONAME(jack,jack_client_new)
938   WINE_GET_SONAME(ssl,SSL_library_init)
939   WINE_GET_SONAME(crypto,BIO_new_socket)
940   WINE_GET_SONAME(ncurses,waddch)
941   WINE_GET_SONAME(curses,waddch)
942 fi
943
944
945 dnl **** Check for functions ****
946
947 AC_FUNC_ALLOCA()
948 AC_CHECK_FUNCS(\
949         _lwp_create \
950         _lwp_self \
951         _pclose \
952         _popen \
953         _snprintf \
954         _spawnvp \
955         _stricmp \
956         _strnicmp \
957         _vsnprintf \
958         chsize \
959         clone \
960         finite \
961         fpclass \
962         ftruncate \
963         ftruncate64 \
964         getnetbyaddr \
965         getnetbyname \
966         getopt_long \
967         getpagesize \
968         getprotobyname \
969         getprotobynumber \
970         getpwuid \
971         getservbyport \
972         gettimeofday \
973         inet_network \
974         lseek64 \
975         lstat \
976         memmove \
977         mmap \
978         pclose \
979         popen \
980         pread \
981         pwrite \
982         rfork \
983         select \
984         sendmsg \
985         settimeofday \
986         sigaltstack \
987         snprintf \
988         spawnvp \
989         statfs \
990         strcasecmp \
991         strerror \
992         strncasecmp \
993         tcgetattr \
994         timegm \
995         usleep \
996         vfscanf \
997         vsnprintf \
998         wait4 \
999         waitpid \
1000 )
1001
1002 dnl **** Check for header files ****
1003
1004 AC_CHECK_HEADERS(\
1005         arpa/inet.h \
1006         arpa/nameser.h \
1007         cups/cups.h \
1008         direct.h \
1009         elf.h \
1010         float.h \
1011         getopt.h \
1012         ieeefp.h \
1013         io.h \
1014         jack/jack.h \
1015         libio.h \
1016         libutil.h \
1017         link.h \
1018         linux/cdrom.h \
1019         linux/hdreg.h \
1020         linux/input.h \
1021         linux/joystick.h \
1022         linux/major.h \
1023         linux/param.h \
1024         linux/serial.h \
1025         linux/ucdrom.h \
1026         machine/cpu.h \
1027         netdb.h \
1028         netinet/in.h \
1029         netinet/in_systm.h \
1030         netinet/tcp.h \
1031         netinet/tcp_fsm.h \
1032         openssl/ssl.h \
1033         process.h \
1034         pthread.h \
1035         pty.h \
1036         pwd.h \
1037         regex.h \
1038         sched.h \
1039         scsi/sg.h \
1040         scsi/scsi.h \
1041         scsi/scsi_ioctl.h \
1042         socket.h \
1043         stdint.h \
1044         strings.h \
1045         sys/cdio.h \
1046         sys/errno.h \
1047         sys/file.h \
1048         sys/filio.h \
1049         sys/inttypes.h \
1050         sys/ioctl.h \
1051         sys/ipc.h \
1052         sys/link.h \
1053         sys/lwp.h \
1054         sys/mman.h \
1055         sys/modem.h \
1056         sys/msg.h \
1057         sys/param.h \
1058         sys/poll.h \
1059         sys/ptrace.h \
1060         sys/reg.h \
1061         sys/scsiio.h \
1062         sys/shm.h \
1063         sys/signal.h \
1064         sys/socket.h \
1065         sys/sockio.h \
1066         sys/statfs.h \
1067         sys/strtio.h \
1068         sys/syscall.h \
1069         sys/sysctl.h \
1070         sys/time.h \
1071         sys/times.h \
1072         sys/uio.h \
1073         sys/un.h \
1074         sys/v86.h \
1075         sys/v86intr.h \
1076         sys/vfs.h \
1077         sys/vm86.h \
1078         sys/wait.h \
1079         syscall.h \
1080         termios.h \
1081         unistd.h \
1082         utime.h \
1083         valgrind/memcheck.h
1084 )
1085 AC_HEADER_STAT()
1086
1087 dnl **** Checks for headers that depend on other ones ****
1088
1089 AC_CHECK_HEADERS(sys/mount.h sys/user.h,,,
1090     [#include <sys/types.h>
1091      #if HAVE_SYS_PARAM_H
1092      # include <sys/param.h>
1093      #endif])
1094
1095 AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h],,,
1096     [#include <sys/types.h>
1097      #if HAVE_SYS_SOCKET_H
1098      # include <sys/socket.h>
1099      #endif])
1100
1101 AC_CHECK_HEADERS([resolv.h],,,
1102     [#include <sys/types.h>
1103      #if HAVE_SYS_SOCKET_H
1104      # include <sys/socket.h>
1105      #endif
1106      #if HAVE_NETINET_IN_H
1107      # include <netinet/in.h>
1108      #endif
1109      #if HAVE_ARPA_NAMESER_H
1110      # include <arpa/nameser.h>
1111      #endif])
1112
1113 AC_CHECK_HEADERS(netinet/ip.h,,,
1114     [#include <sys/types.h>
1115      #if HAVE_SYS_SOCKET_H
1116      # include <sys/socket.h>
1117      #endif
1118      #if HAVE_NETINET_IN_SYSTM_H
1119      # include <netinet/in_systm.h>
1120      #endif])
1121
1122 AC_CHECK_HEADERS(ucontext.h,,,[#include <signal.h>])
1123
1124 dnl **** Check for IPX headers (currently Linux only) ****
1125
1126 AC_CACHE_CHECK([for GNU style IPX support], ac_cv_c_ipx_gnu,
1127  AC_TRY_COMPILE(
1128    [#include <sys/types.h>
1129     #ifdef HAVE_SYS_SOCKET_H
1130     # include <sys/socket.h>
1131     #endif
1132     #include <netipx/ipx.h>],
1133    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
1134    [ac_cv_c_ipx_gnu="yes"],
1135    [ac_cv_c_ipx_gnu="no"])
1136  )
1137 if test "$ac_cv_c_ipx_gnu" = "yes"
1138 then
1139     AC_DEFINE(HAVE_IPX_GNU, 1, [Define if IPX should use netipx/ipx.h from libc])
1140 fi
1141
1142 if test "$ac_cv_c_ipx_gnu" = "no"
1143 then
1144  AC_CACHE_CHECK([for linux style IPX support], ac_cv_c_ipx_linux,
1145   AC_TRY_COMPILE(
1146     [#include <sys/types.h>
1147      #ifdef HAVE_SYS_SOCKET_H
1148      # include <sys/socket.h>
1149      #endif
1150      #include <asm/types.h>
1151      #include <linux/ipx.h>],
1152     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
1153     [ac_cv_c_ipx_linux="yes"],
1154     [ac_cv_c_ipx_linux="no"])
1155   )
1156   if test "$ac_cv_c_ipx_linux" = "yes"
1157   then
1158       AC_DEFINE(HAVE_IPX_LINUX, 1, [Define if IPX includes are taken from Linux kernel])
1159   fi
1160 fi
1161
1162 dnl **** Check for types ****
1163
1164 AC_C_CONST
1165 AC_C_INLINE
1166 AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t])
1167 AC_CHECK_SIZEOF(long long,0)
1168
1169 AC_CACHE_CHECK([whether linux/input.h is for real],
1170         wine_cv_linux_input_h,
1171         AC_TRY_COMPILE([
1172             #include <linux/input.h>
1173         ] , [
1174             int foo = EVIOCGBIT(EV_ABS,42);
1175             int bar = BTN_PINKIE;
1176             int fortytwo = 42;
1177         ],
1178         wine_cv_linux_input_h=yes,
1179         wine_cv_linux_input_h=no,
1180         no
1181         )
1182     )
1183     if test "$wine_cv_linux_input_h" = "yes"
1184     then
1185         AC_DEFINE(HAVE_CORRECT_LINUXINPUT_H, 1,
1186                   [Define if we have linux/input.h AND it contains the INPUT event API])
1187     fi
1188
1189
1190 AC_CACHE_CHECK([whether we can use re-entrant gethostbyname_r Linux style],
1191         wine_cv_linux_gethostbyname_r_6,
1192         AC_TRY_COMPILE([
1193 #include <netdb.h>
1194         ], [
1195     char *name=NULL;
1196     struct hostent he;
1197     struct hostent *result;
1198     char *buf=NULL;
1199     int bufsize=0;
1200     int res,errnr;
1201     char *addr=NULL;
1202     int addrlen=0;
1203     int addrtype=0;
1204     res=gethostbyname_r(name,&he,buf,bufsize,&result,&errnr);
1205     res=gethostbyaddr_r(addr, addrlen, addrtype,&he,buf,bufsize,&result,&errnr);
1206     ],
1207         wine_cv_linux_gethostbyname_r_6=yes,
1208         wine_cv_linux_gethostbyname_r_6=no
1209         )
1210    )
1211    if test "$wine_cv_linux_gethostbyname_r_6" = "yes"
1212    then
1213       AC_DEFINE(HAVE_LINUX_GETHOSTBYNAME_R_6, 1,
1214                 [Define if Linux-style gethostbyname_r and gethostbyaddr_r are available])
1215    fi
1216
1217 if test "$ac_cv_header_linux_joystick_h" = "yes"
1218 then
1219    AC_CACHE_CHECK([whether linux/joystick.h uses the Linux 2.2+ API],
1220         wine_cv_linux_joystick_22_api,
1221         AC_TRY_COMPILE([
1222         #include <sys/ioctl.h>
1223         #include <linux/joystick.h>
1224
1225         struct js_event blub;
1226         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
1227         #error "no 2.2 header"
1228         #endif
1229         ],/*empty*/,
1230         wine_cv_linux_joystick_22_api=yes,
1231         wine_cv_linux_joystick_22_api=no,
1232         wine_cv_linux_joystick_22_api=no
1233         )
1234    )
1235    if test "$wine_cv_linux_joystick_22_api" = "yes"
1236    then
1237       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API, 1,
1238                 [Define if <linux/joystick.h> defines the Linux 2.2 joystick API])
1239    fi
1240 fi
1241
1242 dnl **** statfs checks ****
1243
1244 if test "$ac_cv_header_sys_vfs_h" = "yes"
1245 then
1246     AC_CACHE_CHECK( [whether sys/vfs.h defines statfs],
1247                     wine_cv_sys_vfs_has_statfs,
1248         AC_TRY_COMPILE([
1249         #include <sys/types.h>
1250         #ifdef HAVE_SYS_PARAM_H
1251         # include <sys/param.h>
1252         #endif
1253         #include <sys/vfs.h>
1254         ],[
1255                 struct statfs stfs;
1256
1257                 memset(&stfs,0,sizeof(stfs));
1258         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
1259         )
1260     )
1261     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
1262     then
1263       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS, 1,
1264                 [Define if the struct statfs is defined by <sys/vfs.h>])
1265     fi
1266 fi
1267
1268 if test "$ac_cv_header_sys_statfs_h" = "yes"
1269 then
1270     AC_CACHE_CHECK( [whether sys/statfs.h defines statfs],
1271                     wine_cv_sys_statfs_has_statfs,
1272         AC_TRY_COMPILE([
1273         #include <sys/types.h>
1274         #ifdef HAVE_SYS_PARAM_H
1275         # include <sys/param.h>
1276         #endif
1277         #include <sys/statfs.h>
1278         ],[
1279                 struct statfs stfs;
1280         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
1281         )
1282     )
1283     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
1284     then
1285       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS, 1,
1286                 [Define if the struct statfs is defined by <sys/statfs.h>])
1287     fi
1288 fi
1289
1290 if test "$ac_cv_header_sys_mount_h" = "yes"
1291 then
1292     AC_CACHE_CHECK( [whether sys/mount.h defines statfs],
1293                     wine_cv_sys_mount_has_statfs,
1294         AC_TRY_COMPILE([
1295         #include <sys/types.h>
1296         #ifdef HAVE_SYS_PARAM_H
1297         # include <sys/param.h>
1298         #endif
1299         #include <sys/mount.h>
1300         ],[
1301                 struct statfs stfs;
1302         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
1303         )
1304     )
1305     if test "$wine_cv_sys_mount_has_statfs" = "yes"
1306     then
1307       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT, 1,
1308                 [Define if the struct statfs is defined by <sys/mount.h>])
1309     fi
1310 fi
1311
1312 dnl **** FIXME: what about mixed cases, where we need two of them? ***
1313
1314 dnl Check for statfs members
1315 AC_CHECK_MEMBERS([struct statfs.f_bfree, struct statfs.f_bavail],,,
1316 [#include <sys/types.h>
1317 #ifdef HAVE_SYS_PARAM_H
1318 # include <sys/param.h>
1319 #endif
1320 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
1321 # include <sys/mount.h>
1322 #else
1323 # ifdef STATFS_DEFINED_BY_SYS_VFS
1324 #  include <sys/vfs.h>
1325 # else
1326 #  ifdef STATFS_DEFINED_BY_SYS_STATFS
1327 #   include <sys/statfs.h>
1328 #  endif
1329 # endif
1330 #endif])
1331
1332 dnl Check for socket structure members
1333 AC_CHECK_MEMBERS([struct msghdr.msg_accrights, struct sockaddr.sa_len, struct sockaddr_un.sun_len],,,
1334 [#include <sys/types.h>
1335 #ifdef HAVE_SYS_SOCKET_H
1336 # include <sys/socket.h>
1337 #endif
1338 #ifdef HAVE_SYS_UN_H
1339 # include <sys/un.h>
1340 #endif])
1341
1342 dnl Check for siginfo_t members
1343 AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
1344
1345 dnl Check for struct option
1346 AC_CHECK_MEMBERS([struct option.name],,,
1347 [#ifdef HAVE_GETOPT_H
1348 #include <getopt.h>
1349 #endif])
1350
1351 dnl Check for stat.st_blocks
1352 AC_CHECK_MEMBERS([struct stat.st_blocks])
1353
1354 dnl *** check for the need to define platform-specific symbols
1355
1356 case $host_cpu in
1357   *i[[3456789]]86*) WINE_CHECK_DEFINE([__i386__]) ;;
1358   *alpha*)          WINE_CHECK_DEFINE([__ALPHA__]) ;;
1359   *sparc*)          WINE_CHECK_DEFINE([__sparc__]) ;;
1360   *powerpc*)        WINE_CHECK_DEFINE([__powerpc__]) ;;
1361 esac
1362
1363 case $host_vendor in
1364   *sun*) WINE_CHECK_DEFINE([__sun__]) ;;
1365 esac
1366
1367 dnl **** Generate output files ****
1368
1369 AH_TOP([#define __WINE_CONFIG_H])
1370
1371 WINE_CONFIG_EXTRA_DIR(controls)
1372 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/d3ddevice)
1373 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dclipper)
1374 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/ddraw)
1375 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/direct3d)
1376 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dpalette)
1377 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dsurface)
1378 WINE_CONFIG_EXTRA_DIR(dlls/dinput/joystick)
1379 WINE_CONFIG_EXTRA_DIR(dlls/dinput/keyboard)
1380 WINE_CONFIG_EXTRA_DIR(dlls/dinput/mouse)
1381 WINE_CONFIG_EXTRA_DIR(dlls/gdi/enhmfdrv)
1382 WINE_CONFIG_EXTRA_DIR(dlls/gdi/mfdrv)
1383 WINE_CONFIG_EXTRA_DIR(dlls/kernel/messages)
1384 WINE_CONFIG_EXTRA_DIR(dlls/user/dde)
1385 WINE_CONFIG_EXTRA_DIR(dlls/user/resources)
1386 WINE_CONFIG_EXTRA_DIR(dlls/wineps/data)
1387 WINE_CONFIG_EXTRA_DIR(files)
1388 WINE_CONFIG_EXTRA_DIR(graphics)
1389 WINE_CONFIG_EXTRA_DIR(graphics/x11drv)
1390 WINE_CONFIG_EXTRA_DIR(include/wine)
1391 WINE_CONFIG_EXTRA_DIR(memory)
1392 WINE_CONFIG_EXTRA_DIR(misc)
1393 WINE_CONFIG_EXTRA_DIR(msdos)
1394 WINE_CONFIG_EXTRA_DIR(objects)
1395 WINE_CONFIG_EXTRA_DIR(programs/regapi/tests)
1396 WINE_CONFIG_EXTRA_DIR(programs/regedit/tests)
1397 WINE_CONFIG_EXTRA_DIR(windows)
1398
1399 MAKE_RULES=Make.rules
1400 AC_SUBST_FILE(MAKE_RULES)
1401
1402 MAKE_DLL_RULES=dlls/Makedll.rules
1403 AC_SUBST_FILE(MAKE_DLL_RULES)
1404
1405 MAKE_TEST_RULES=dlls/Maketest.rules
1406 AC_SUBST_FILE(MAKE_TEST_RULES)
1407
1408 MAKE_LIB_RULES=libs/Makelib.rules
1409 AC_SUBST_FILE(MAKE_LIB_RULES)
1410
1411 MAKE_PROG_RULES=programs/Makeprog.rules
1412 AC_SUBST_FILE(MAKE_PROG_RULES)
1413
1414 AC_CONFIG_FILES([
1415 Make.rules
1416 dlls/Makedll.rules
1417 dlls/Maketest.rules
1418 libs/Makelib.rules
1419 programs/Makeprog.rules
1420 Makefile
1421 dlls/Makefile
1422 dlls/advapi32/Makefile
1423 dlls/advapi32/tests/Makefile
1424 dlls/avicap32/Makefile
1425 dlls/avifil32/Makefile
1426 dlls/cabinet/Makefile
1427 dlls/capi2032/Makefile
1428 dlls/cfgmgr32/Makefile
1429 dlls/comcat/Makefile
1430 dlls/comctl32/Makefile
1431 dlls/comctl32/tests/Makefile
1432 dlls/commdlg/Makefile
1433 dlls/crtdll/Makefile
1434 dlls/crypt32/Makefile
1435 dlls/ctl3d/Makefile
1436 dlls/d3d8/Makefile
1437 dlls/d3d9/Makefile
1438 dlls/d3dim/Makefile
1439 dlls/d3dx8/Makefile
1440 dlls/dciman32/Makefile
1441 dlls/ddraw/Makefile
1442 dlls/devenum/Makefile
1443 dlls/dinput/Makefile
1444 dlls/dinput8/Makefile
1445 dlls/dmband/Makefile
1446 dlls/dmcompos/Makefile
1447 dlls/dmime/Makefile
1448 dlls/dmloader/Makefile
1449 dlls/dmscript/Makefile
1450 dlls/dmstyle/Makefile
1451 dlls/dmsynth/Makefile
1452 dlls/dmusic/Makefile
1453 dlls/dmusic32/Makefile
1454 dlls/dplay/Makefile
1455 dlls/dplayx/Makefile
1456 dlls/dpnhpast/Makefile
1457 dlls/dsound/Makefile
1458 dlls/dsound/tests/Makefile
1459 dlls/gdi/Makefile
1460 dlls/gdi/tests/Makefile
1461 dlls/glu32/Makefile
1462 dlls/icmp/Makefile
1463 dlls/imagehlp/Makefile
1464 dlls/imm32/Makefile
1465 dlls/iphlpapi/Makefile
1466 dlls/kernel/Makefile
1467 dlls/kernel/tests/Makefile
1468 dlls/lzexpand/Makefile
1469 dlls/mapi32/Makefile
1470 dlls/mpr/Makefile
1471 dlls/msacm/Makefile
1472 dlls/msacm/imaadp32/Makefile
1473 dlls/msacm/msadp32/Makefile
1474 dlls/msacm/msg711/Makefile
1475 dlls/msacm/winemp3/Makefile
1476 dlls/msdmo/Makefile
1477 dlls/mshtml/Makefile
1478 dlls/msi/Makefile
1479 dlls/msimg32/Makefile
1480 dlls/msisys/Makefile
1481 dlls/msnet32/Makefile
1482 dlls/msvcrt/Makefile
1483 dlls/msvcrt/tests/Makefile
1484 dlls/msvcrt20/Makefile
1485 dlls/msvcrtd/Makefile
1486 dlls/msvideo/Makefile
1487 dlls/msvideo/msrle32/Makefile
1488 dlls/mswsock/Makefile
1489 dlls/netapi32/Makefile
1490 dlls/netapi32/tests/Makefile
1491 dlls/ntdll/Makefile
1492 dlls/ntdll/tests/Makefile
1493 dlls/odbc32/Makefile
1494 dlls/ole32/Makefile
1495 dlls/oleacc/Makefile
1496 dlls/oleaut32/Makefile
1497 dlls/oleaut32/tests/Makefile
1498 dlls/olecli/Makefile
1499 dlls/oledlg/Makefile
1500 dlls/olepro32/Makefile
1501 dlls/olesvr/Makefile
1502 dlls/opengl32/Makefile
1503 dlls/psapi/Makefile
1504 dlls/qcap/Makefile
1505 dlls/quartz/Makefile
1506 dlls/rasapi32/Makefile
1507 dlls/richedit/Makefile
1508 dlls/rpcrt4/Makefile
1509 dlls/rpcrt4/tests/Makefile
1510 dlls/serialui/Makefile
1511 dlls/setupapi/Makefile
1512 dlls/shdocvw/Makefile
1513 dlls/shell32/Makefile
1514 dlls/shell32/tests/Makefile
1515 dlls/shfolder/Makefile
1516 dlls/shlwapi/Makefile
1517 dlls/shlwapi/tests/Makefile
1518 dlls/snmpapi/Makefile
1519 dlls/sti/Makefile
1520 dlls/tapi32/Makefile
1521 dlls/ttydrv/Makefile
1522 dlls/twain/Makefile
1523 dlls/url/Makefile
1524 dlls/urlmon/Makefile
1525 dlls/urlmon/tests/Makefile
1526 dlls/user/Makefile
1527 dlls/user/tests/Makefile
1528 dlls/uxtheme/Makefile
1529 dlls/version/Makefile
1530 dlls/win32s/Makefile
1531 dlls/winaspi/Makefile
1532 dlls/winedos/Makefile
1533 dlls/wineps/Makefile
1534 dlls/wininet/Makefile
1535 dlls/wininet/tests/Makefile
1536 dlls/winmm/Makefile
1537 dlls/winmm/joystick/Makefile
1538 dlls/winmm/mcianim/Makefile
1539 dlls/winmm/mciavi/Makefile
1540 dlls/winmm/mcicda/Makefile
1541 dlls/winmm/mciseq/Makefile
1542 dlls/winmm/mciwave/Makefile
1543 dlls/winmm/midimap/Makefile
1544 dlls/winmm/tests/Makefile
1545 dlls/winmm/wavemap/Makefile
1546 dlls/winmm/winealsa/Makefile
1547 dlls/winmm/winearts/Makefile
1548 dlls/winmm/wineaudioio/Makefile
1549 dlls/winmm/winenas/Makefile
1550 dlls/winmm/winejack/Makefile
1551 dlls/winmm/wineoss/Makefile
1552 dlls/winnls/Makefile
1553 dlls/winsock/Makefile
1554 dlls/winsock/tests/Makefile
1555 dlls/winspool/Makefile
1556 dlls/winspool/tests/Makefile
1557 dlls/wintab32/Makefile
1558 dlls/wintrust/Makefile
1559 dlls/wow32/Makefile
1560 dlls/wsock32/Makefile
1561 dlls/x11drv/Makefile
1562 documentation/Makefile
1563 include/Makefile
1564 libs/Makefile
1565 libs/port/Makefile
1566 libs/unicode/Makefile
1567 libs/uuid/Makefile
1568 libs/wine/Makefile
1569 libs/wpp/Makefile
1570 loader/Makefile
1571 programs/Makefile
1572 programs/avitools/Makefile
1573 programs/clock/Makefile
1574 programs/cmdlgtst/Makefile
1575 programs/control/Makefile
1576 programs/expand/Makefile
1577 programs/notepad/Makefile
1578 programs/osversioncheck/Makefile
1579 programs/progman/Makefile
1580 programs/regapi/Makefile
1581 programs/regedit/Makefile
1582 programs/regsvr32/Makefile
1583 programs/regtest/Makefile
1584 programs/rpcss/Makefile
1585 programs/rundll32/Makefile
1586 programs/start/Makefile
1587 programs/uninstaller/Makefile
1588 programs/view/Makefile
1589 programs/wcmd/Makefile
1590 programs/wineboot/Makefile
1591 programs/winecfg/Makefile
1592 programs/wineconsole/Makefile
1593 programs/winedbg/Makefile
1594 programs/winefile/Makefile
1595 programs/winemenubuilder/Makefile
1596 programs/winemine/Makefile
1597 programs/winepath/Makefile
1598 programs/winevdm/Makefile
1599 programs/winhelp/Makefile
1600 programs/winver/Makefile
1601 server/Makefile
1602 tools/Makefile
1603 tools/widl/Makefile
1604 tools/winapi/Makefile
1605 tools/winebuild/Makefile
1606 tools/winedump/Makefile
1607 tools/winegcc/Makefile
1608 tools/wmc/Makefile
1609 tools/wrc/Makefile])
1610
1611 AC_OUTPUT
1612
1613 if test "$have_x" = "no"
1614 then
1615   echo
1616   echo "*** Warning: X development files not found. Wine will be built without"
1617   echo "*** X support, which currently does not work, and would probably not be"
1618   echo "*** what you want anyway. You will need to install devel packages of"
1619   echo "*** Xlib/Xfree86 at the very least."
1620 fi
1621
1622 if test "$wine_cv_opengl_version_OK" = "no"
1623 then
1624   echo
1625   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1626   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1627 fi
1628
1629 if test "$wine_cv_msg_freetype" = "yes"
1630 then
1631   echo
1632   echo "*** Note: Your system appears to have the FreeType 2 runtime libraries"
1633   echo "*** installed, but 'freetype-config' is not in your PATH. Install the"
1634   echo "*** freetype-devel package (or its equivalent on your distribution) to"
1635   echo "*** enable Wine to use TrueType fonts."
1636 fi
1637
1638 echo
1639 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1640 echo
1641
1642 dnl Local Variables:
1643 dnl comment-start: "dnl "
1644 dnl comment-end: ""
1645 dnl comment-start-skip: "\\bdnl\\b\\s *"
1646 dnl compile-command: "autoconf"
1647 dnl End: