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