Fix the case of floats in VarBstrFromR4, VarBstrFromR8 and
[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(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>]))
22
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=""
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
40 dnl **** Check for some programs ****
41
42 AC_CANONICAL_HOST
43 AC_PROG_MAKE_SET
44 AC_PROG_CC
45 AC_PROG_CPP
46
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)
63
64 AC_PATH_XTRA
65 AC_PROG_YACC
66 AC_PROG_LEX
67
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.])
74 fi
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.])
79 fi
80
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
97
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'
104 fi
105 AC_SUBST(LINT)
106 AC_SUBST(LINTFLAGS)
107
108 dnl Check for db2html
109 AC_CHECK_PROGS(DB2HTML, docbook2html db2html, false)
110 AC_SUBST(DB2HTML)
111
112 dnl Check for db2pdf
113 AC_CHECK_PROGS(DB2PDF, docbook2pdf db2pdf, false)
114 AC_SUBST(DB2PDF)
115
116 dnl Check for db2ps
117 AC_CHECK_PROGS(DB2PS, docbook2ps db2ps, false)
118 AC_SUBST(DB2PS)
119
120 dnl **** Check for some libraries ****
121
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)
140
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     )
148 )
149
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"])]))
158
159
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"
174
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>])
187
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>])
197
198         dnl *** Check for Xutil
199         AC_CHECK_HEADERS(X11/Xutil.h,,,
200             [#include <X11/Xlib.h>])
201
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])
214
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>])
240
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>])
253
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>])
266
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
271
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
280
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             )
294
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)
302
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])
307
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)
312
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
332
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
344
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])])
353
354     CPPFLAGS="$ac_save_CPPFLAGS"
355     XFILES='$(XFILES)'
356 else
357     XLIB=""
358     X_CFLAGS=""
359     X_LIBS=""
360 fi
361
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"
378 fi
379 AC_SUBST(CURSESLIBS)
380
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"
403 fi
404 AC_SUBST(SANELIBS)
405 AC_SUBST(SANEINCL)
406
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
456 fi
457 AC_SUBST(FREETYPEINCL)
458
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"])
466  )
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])
470 fi
471
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"])
481  )
482 if test "$ac_cv_c_va_copy" = "yes"
483 then
484     AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
485 fi
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"])
494  )
495 if test "$ac_cv_c___va_copy" = "yes"
496 then
497     AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
498 fi
499
500 dnl **** Check for IPX (currently Linux only) ****
501 AC_CACHE_CHECK([for GNU style IPX support], ac_cv_c_ipx_gnu,
502  AC_TRY_COMPILE(
503    [#include <sys/types.h>
504     #ifdef HAVE_SYS_SOCKET_H
505     # include <sys/socket.h>
506     #endif
507     #include <netipx/ipx.h>],
508    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
509    [ac_cv_c_ipx_gnu="yes"],
510    [ac_cv_c_ipx_gnu="no"])
511  )
512 if test "$ac_cv_c_ipx_gnu" = "yes"
513 then
514     AC_DEFINE(HAVE_IPX_GNU, 1, [Define if IPX should use netipx/ipx.h from libc])
515 fi
516
517 if test "$ac_cv_c_ipx_gnu" = "no"
518 then
519  AC_CACHE_CHECK([for linux style IPX support], ac_cv_c_ipx_linux,
520   AC_TRY_COMPILE(
521     [#include <sys/types.h>
522      #ifdef HAVE_SYS_SOCKET_H
523      # include <sys/socket.h>
524      #endif
525      #include <asm/types.h>
526      #include <linux/ipx.h>],
527     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
528     [ac_cv_c_ipx_linux="yes"],
529     [ac_cv_c_ipx_linux="no"])
530   )
531   if test "$ac_cv_c_ipx_linux" = "yes"
532   then
533       AC_DEFINE(HAVE_IPX_LINUX, 1, [Define if IPX includes are taken from Linux kernel])
534   fi
535 fi
536
537 dnl **** Check for Open Sound System ****
538 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
539
540 AC_CACHE_CHECK([for Open Sound System],
541         ac_cv_c_opensoundsystem,
542         AC_TRY_COMPILE([
543         #if defined(HAVE_SYS_SOUNDCARD_H)
544                 #include <sys/soundcard.h>
545         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
546                 #include <machine/soundcard.h>
547         #elif defined(HAVE_SOUNDCARD_H)
548                 #include <soundcard.h>
549         #endif
550         ],[
551
552 /* check for one of the Open Sound System specific SNDCTL_ defines */
553 #if !defined(SNDCTL_DSP_STEREO)
554 #error No open sound system
555 #endif
556 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
557
558 if test "$ac_cv_c_opensoundsystem" = "yes"
559 then
560     AC_DEFINE(HAVE_OSS, 1, [Define if you have the Open Sound system])
561 fi
562
563 AC_CACHE_CHECK([for Open Sound System/MIDI interface],
564         ac_cv_c_opensoundsystem_midi,
565         AC_TRY_COMPILE([
566         #if defined(HAVE_SYS_SOUNDCARD_H)
567                 #include <sys/soundcard.h>
568         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
569                 #include <machine/soundcard.h>
570         #elif defined(HAVE_SOUNDCARD_H)
571                 #include <soundcard.h>
572         #endif
573         ],[
574
575 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
576 #if !defined(SNDCTL_SEQ_SYNC)
577 #error No open sound system MIDI interface
578 #endif
579 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
580
581 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
582 then
583     AC_DEFINE(HAVE_OSS_MIDI, 1, [Define if you have the Open Sound system (MIDI interface)])
584 fi
585
586 dnl **** Check for aRts Sound Server ****
587 AC_PATH_PROG(ARTSCCONFIG, artsc-config)
588 AC_CACHE_CHECK([for aRts Sound server],
589         ac_cv_c_artsserver,
590         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"';
591         then
592             ac_cv_c_artsserver=no
593         else
594             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
595             ARTSC_LIBS=`$ARTSCCONFIG --libs`
596             ac_cv_c_artsserver=no
597             save_CFLAGS="$CFLAGS"
598             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
599             AC_TRY_COMPILE([
600              #include <artsc.h>
601             ],[
602              arts_stream_t stream;
603             ],[
604             ac_cv_c_artsserver=yes
605             ])
606             CFLAGS="$save_CFLAGS"
607         fi)
608
609 if test "$ac_cv_c_artsserver" = "yes"
610 then
611     AC_SUBST(ARTSLIBS, $ARTSC_LIBS)
612     AC_SUBST(ARTSINCL, $ARTSC_CFLAGS)
613
614     AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])
615 fi
616
617 dnl **** Check for ALSA ****
618 AC_SUBST(ALSALIBS,"")
619 AC_CHECK_HEADERS(alsa/asoundlib.h sys/asoundlib.h, break)
620 if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes"
621 then
622     AC_CHECK_LIB(asound,snd_pcm_open,
623         AC_DEFINE(HAVE_ALSA,1,[Define if you have ALSA including devel headers])
624         ALSALIBS="-lasound")
625 fi
626
627 dnl **** Check for libaudioio (which can be used to get solaris audio support) ****
628
629 AC_SUBST(AUDIOIOLIBS,"")
630 AC_CHECK_HEADERS(libaudioio.h,
631     [AC_CHECK_LIB(audioio,AudioIOGetVersion,
632                   [AUDIOIOLIBS="-laudioio"
633                    AC_DEFINE(HAVE_LIBAUDIOIO, 1, [Define if you have libaudioIO])])])
634
635 dnl **** Check for broken glibc mmap64 ****
636
637 AC_CACHE_CHECK( [whether mmap64 works defined as mmap], ac_cv_mmap64_works,
638         AC_TRY_RUN([
639                 #define _FILE_OFFSET_BITS 64
640                 #include <stdio.h>
641                 #include <unistd.h>
642                 #include <fcntl.h>
643                 #include <sys/mman.h>
644                 #include <errno.h>
645
646                 int main(int argc,char **argv) {
647                         int fd = open("conftest.map",O_CREAT|O_RDWR,0600);
648                         if (fd == -1) exit(1);
649
650                         unlink("conftest.map");
651
652                         write(fd,"test",4);
653
654                         if ((-1 == mmap(0,4,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0)) &&
655                             (errno == EINVAL)
656                         ) {
657                                 exit(1);
658                         }
659                         close(fd);
660                         fprintf(stderr,"success!\n");
661                         exit(0);
662                 }
663
664         ],
665     ac_cv_mmap64_works="yes",
666     ac_cv_mmap64_works="no",
667     ac_cv_mmap64_works="no") )
668
669 if test "$ac_cv_mmap64_works" = "yes"
670 then
671     AC_DEFINE(_FILE_OFFSET_BITS, 64, [Set this to 64 to enable 64-bit file support on Linux])
672 fi
673
674 dnl **** Check for gcc strength-reduce bug ****
675
676 if test "x${GCC}" = "xyes"
677 then
678   CFLAGS="$CFLAGS -Wall"
679   AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
680                   AC_TRY_RUN([
681 int     L[[4]] = {0,1,2,3};
682 int main(void) {
683   static int Array[[3]];
684   unsigned int B = 3;
685   int i;
686   for(i=0; i<B; i++) Array[[i]] = i - 3;
687   for(i=0; i<4 - 1; i++) L[[i]] = L[[i + 1]];
688   L[[i]] = 4;
689
690   exit( Array[[1]] != -2 || L[[2]] != 3);
691 }],
692     ac_cv_c_gcc_strength_bug="no",
693     ac_cv_c_gcc_strength_bug="yes",
694     ac_cv_c_gcc_strength_bug="yes") )
695   if test "$ac_cv_c_gcc_strength_bug" = "yes"
696   then
697     CFLAGS="$CFLAGS -fno-strength-reduce"
698   fi
699
700   dnl Check for -mpreferred-stack-boundary
701   AC_CACHE_CHECK([for gcc -mpreferred-stack-boundary=2 support], ac_cv_c_gcc_stack_boundary,
702       [WINE_TRY_CFLAGS([-mpreferred-stack-boundary=2],
703                       ac_cv_c_gcc_stack_boundary="yes",ac_cv_c_gcc_stack_boundary="no")])
704   if test "$ac_cv_c_gcc_stack_boundary" = "yes"
705   then
706     CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
707   fi
708
709   dnl Check for -gstabs+ option
710   AC_CACHE_CHECK([for gcc -gstabs+ support], ac_cv_c_gcc_gstabs,
711       [WINE_TRY_CFLAGS([-gstabs+],ac_cv_c_gcc_gstabs="yes", ac_cv_c_gcc_gstabs="no")])
712   if test "$ac_cv_c_gcc_gstabs" = "yes"
713   then
714     CFLAGS="$CFLAGS -gstabs+"
715   fi
716 fi
717
718 dnl **** Check how to define a function in assembly code ****
719
720 AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def,
721   WINE_TRY_ASM_LINK(
722       ["\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"],,,
723       ac_cv_asm_func_def=".def",
724     [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"],,,
725       ac_cv_asm_func_def=".type @function",
726     [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"],,,
727       ac_cv_asm_func_def=".type 2",
728       ac_cv_asm_func_def="unknown")])]))
729
730 AH_TEMPLATE(__ASM_FUNC,[Define to a macro to generate an assembly function directive])
731 case "$ac_cv_asm_func_def" in
732   ".def")
733      AC_DEFINE([__ASM_FUNC(name)], [".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"]) ;;
734   ".type @function")
735      AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",@function"]) ;;
736   ".type 2")
737      AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",2"]) ;;
738   *)
739      AC_DEFINE([__ASM_FUNC(name)], [""]) ;;
740 esac
741
742 dnl **** Check for underscore on external symbols ****
743
744 AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_extern_prefix,
745     WINE_TRY_ASM_LINK([".globl _ac_test\n_ac_test:\t.long 0"],
746                       [extern int ac_test;],
747                       [if (ac_test) return 1],
748                       ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no"))
749
750 AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
751 if test "$ac_cv_c_extern_prefix" = "yes"
752 then
753   AC_DEFINE([__ASM_NAME(name)], ["_" name])
754 else
755   AC_DEFINE([__ASM_NAME(name)], [name])
756 fi
757
758 dnl **** Check for .string in assembler ****
759
760 AC_CACHE_CHECK([whether assembler accepts .string], ac_cv_c_asm_string,
761     WINE_TRY_ASM_LINK([".data\n\t.string \"test\"\n\t.text"],,,
762                       ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no"))
763 if test "$ac_cv_c_asm_string" = "yes"
764 then
765   AC_DEFINE(HAVE_ASM_STRING, 1, [Define to use .string instead of .ascii])
766 fi
767
768 dnl **** Check for working dll ****
769
770 AC_SUBST(DLLEXT,"")
771 AC_SUBST(DLLFLAGS,"")
772 AC_SUBST(DLLIBS,"")
773 AC_SUBST(LDDLLFLAGS,"")
774 AC_SUBST(LDSHARED,"")
775 AC_SUBST(LIBEXT,"so")
776 AC_SUBST(IMPLIBEXT,"def")
777
778 case $host_os in
779   cygwin*|mingw32*)
780     AC_CHECK_TOOL(DLLTOOL,dlltool,false)
781     AC_CHECK_TOOL(DLLWRAP,dllwrap,false)
782     if test "$DLLWRAP" = "false"; then
783       LIBEXT="a"
784     else
785       dnl FIXME - check whether dllwrap works correctly...
786       LIBEXT="dll"
787     fi
788     IMPLIBEXT="a"
789     ;;
790   *)
791     AC_CHECK_HEADERS(dlfcn.h,
792         [AC_CHECK_FUNCS(dlopen,,
793             [AC_CHECK_LIB(dl,dlopen,
794                          [AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen])
795                           DLLIBS="-ldl"],
796                          [LIBEXT="a"])])],
797         [LIBEXT="a"])
798
799     if test "$LIBEXT" = "so"
800     then
801       DLLFLAGS="-fPIC"
802       DLLEXT=".so"
803       AC_CACHE_CHECK([whether we can build a GNU style ELF dll], ac_cv_c_dll_gnuelf,
804           [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic],
805                            ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")])
806       if test "$ac_cv_c_dll_gnuelf" = "yes"
807       then
808         LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
809         LDDLLFLAGS="-Wl,-Bsymbolic"
810         AC_CACHE_CHECK([whether the linker accepts -z defs], ac_cv_c_dll_zdefs,
811           [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-Bsymbolic,-z,defs],
812                            ac_cv_c_dll_zdefs="yes",ac_cv_c_dll_zdefs="no")])
813         if test "$ac_cv_c_dll_zdefs" = "yes"
814         then
815           LDDLLFLAGS="$LDDLLFLAGS,-z,defs"
816         fi
817       else
818         AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll, ac_cv_c_dll_unixware,
819             [WINE_TRY_CFLAGS([-fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic],
820                              ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
821         if test "$ac_cv_c_dll_unixware" = "yes"
822         then
823           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
824           LDDLLFLAGS="-Wl,-B,symbolic"
825         fi
826       fi
827     fi
828
829     dnl Check for cross compiler to build test programs
830     AC_SUBST(CROSSTEST,"")
831     if test "$cross_compiling" = "no"
832     then
833       AC_CHECK_PROGS(CROSSCC,i586-mingw32msvc-gcc,false)
834       AC_CHECK_PROGS(DLLTOOL,i586-mingw32msvc-dlltool,false)
835       if test "$CROSSCC" != "false"; then CROSSTEST="\$(CROSSTEST)"; fi
836     fi
837     ;;
838 esac
839
840 if test "$LIBEXT" = "a"; then
841   AC_MSG_ERROR(
842 [could not find a way to build shared libraries.
843 It is currently not possible to build Wine without shared library
844 (.so) support to allow transparent switch between .so and .dll files.
845 If you are using Linux, you will need a newer binutils.]
846 )
847 fi
848
849 case $build_os in
850   cygwin*|mingw32*)
851     AC_SUBST(LDPATH,"PATH=\"\$(TOOLSDIR)/library:\$(TOOLSDIR)/unicode:\$\$PATH\"") ;;
852   *)
853     AC_SUBST(LDPATH,"LD_LIBRARY_PATH=\"\$(TOOLSDIR)/library:\$(TOOLSDIR)/unicode:\$\$LD_LIBRARY_PATH\"") ;;
854 esac
855
856 dnl Mingw needs explicit msvcrt for linking libwine
857 AC_SUBST(CRTLIBS,"")
858 case $host_os in
859   mingw32*)
860     CRTLIBS="-lmsvcrt" ;;
861 esac
862
863 dnl **** Get the soname for libraries that we load dynamically ****
864
865 if test "$LIBEXT" = "so"
866 then
867   WINE_GET_SONAME(X11,XCreateWindow,[$X_LIBS $X_EXTRA_LIBS])
868   WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
869   WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
870   WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS])
871   WINE_GET_SONAME(GL,glXQueryExtension,[$X_LIBS $X_EXTRA_LIBS])
872   WINE_GET_SONAME(cups,cupsGetDefault)
873   WINE_GET_SONAME(jack,jack_client_new)
874 fi
875
876
877 dnl **** Check for reentrant libc ****
878
879 wine_cv_libc_reentrant=no
880 dnl Linux style errno location
881 WINE_CHECK_ERRNO([__errno_location], [wine_cv_libc_reentrant=__errno_location],
882   dnl FreeBSD style errno location
883   WINE_CHECK_ERRNO([__error], [wine_cv_libc_reentrant=__error],
884     dnl Solaris style errno location
885     WINE_CHECK_ERRNO([___errno], [wine_cv_libc_reentrant=___errno],
886       dnl UnixWare style errno location
887       WINE_CHECK_ERRNO([__thr_errno], [wine_cv_libc_reentrant=__thr_errno],
888         dnl NetBSD style errno location
889         WINE_CHECK_ERRNO([__errno], [wine_cv_libc_reentrant=__errno])
890 ))))
891
892 if test "$wine_cv_libc_reentrant" != "no"
893 then
894   AC_DEFINE_UNQUOTED(ERRNO_LOCATION,$wine_cv_libc_reentrant,
895                      [Define to the name of the function returning errno for reentrant libc])
896 fi
897
898 dnl **** Check for reentrant X libraries ****
899 dnl
900 dnl This may fail to determine whether X libraries are reentrant if
901 dnl AC_PATH_XTRA does not set x_libraries.
902
903 if test "$have_x" = "yes"
904 then
905 AC_CACHE_CHECK( [for reentrant X libraries], wine_cv_x_reentrant,
906     [libX11_check=none
907     for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
908         if test -r $dir/libX11.so; then
909             libX11_check="-D $dir/libX11.so"
910             break
911         fi
912         if test -r $dir/libX11.a; then
913             libX11_check="$dir/libX11.a"
914             break
915         fi
916     done
917     if test "$libX11_check" != "none"; then
918         if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
919         then
920             wine_cv_x_reentrant=yes
921         else
922             wine_cv_x_reentrant=no
923         fi
924     else
925         wine_cv_x_reentrant=unknown
926     fi])
927 fi
928
929 dnl **** Check for functions ****
930
931 AC_FUNC_ALLOCA()
932 AC_CHECK_FUNCS(\
933         _lwp_create \
934         _pclose \
935         _popen \
936         _snprintf \
937         _stricmp \
938         _strnicmp \
939         chsize \
940         clone \
941         ecvt \
942         fcvt \
943         finite \
944         fpclass \
945         ftruncate \
946         ftruncate64 \
947         gcvt \
948         getnetbyaddr \
949         getnetbyname \
950         getopt_long \
951         getpagesize \
952         getprotobyname \
953         getprotobynumber \
954         getpwuid \
955         getservbyport \
956         getsockopt \
957         inet_network \
958         lseek64 \
959         lstat \
960         memmove \
961         mkstemp \
962         mmap \
963         pclose \
964         popen \
965         pread \
966         pthread_getspecific \
967         pthread_key_create \
968         pthread_mutex_lock \
969         pthread_mutex_unlock \
970         pthread_setspecific \
971         pwrite \
972         rfork \
973         select \
974         sendmsg \
975         settimeofday \
976         sigaltstack \
977         snprintf \
978         statfs \
979         strcasecmp \
980         strerror \
981         strncasecmp \
982         tcgetattr \
983         timegm \
984         usleep \
985         vfscanf \
986         wait4 \
987         waitpid \
988 )
989
990 dnl **** Check for header files ****
991
992 AC_CHECK_HEADERS(\
993         arpa/inet.h \
994         arpa/nameser.h \
995         cups/cups.h \
996         direct.h \
997         elf.h \
998         float.h \
999         getopt.h \
1000         ieeefp.h \
1001         io.h \
1002         jack/jack.h \
1003         libio.h \
1004         libutil.h \
1005         link.h \
1006         linux/cdrom.h \
1007         linux/hdreg.h \
1008         linux/input.h \
1009         linux/joystick.h \
1010         linux/major.h \
1011         linux/param.h \
1012         linux/serial.h \
1013         linux/ucdrom.h \
1014         netdb.h \
1015         netinet/in.h \
1016         netinet/in_systm.h \
1017         netinet/tcp.h \
1018         pty.h \
1019         pwd.h \
1020         sched.h \
1021         scsi/sg.h \
1022         socket.h \
1023         stdint.h \
1024         strings.h \
1025         sys/cdio.h \
1026         sys/errno.h \
1027         sys/file.h \
1028         sys/filio.h \
1029         sys/inttypes.h \
1030         sys/ioctl.h \
1031         sys/ipc.h \
1032         sys/link.h \
1033         sys/lwp.h \
1034         sys/mman.h \
1035         sys/modem.h \
1036         sys/msg.h \
1037         sys/param.h \
1038         sys/poll.h \
1039         sys/ptrace.h \
1040         sys/reg.h \
1041         sys/shm.h \
1042         sys/signal.h \
1043         sys/socket.h \
1044         sys/sockio.h \
1045         sys/statfs.h \
1046         sys/strtio.h \
1047         sys/syscall.h \
1048         sys/sysctl.h \
1049         sys/time.h \
1050         sys/times.h \
1051         sys/uio.h \
1052         sys/un.h \
1053         sys/v86.h \
1054         sys/v86intr.h \
1055         sys/vfs.h \
1056         sys/vm86.h \
1057         sys/wait.h \
1058         syscall.h \
1059         termios.h \
1060         unistd.h \
1061         utime.h \
1062 )
1063 AC_HEADER_STAT()
1064
1065 dnl **** Checks for headers that depend on other ones ****
1066
1067 AC_CHECK_HEADERS(sys/mount.h sys/user.h,,,
1068     [#include <sys/types.h>
1069      #if HAVE_SYS_PARAM_H
1070      # include <sys/param.h>
1071      #endif])
1072
1073 AC_CHECK_HEADERS(net/if.h,,,
1074     [#include <sys/types.h>
1075      #if HAVE_SYS_SOCKET_H
1076      # include <sys/socket.h>
1077      #endif])
1078
1079 AC_CHECK_HEADERS(netinet/ip.h,,,
1080     [#include <sys/types.h>
1081      #if HAVE_SYS_SOCKET_H
1082      # include <sys/socket.h>
1083      #endif
1084      #if HAVE_NETINET_IN_SYSTM_H
1085      # include <netinet/in_systm.h>
1086      #endif])
1087
1088 AC_CHECK_HEADERS(resolv.h,,,
1089     [#include <sys/types.h>
1090      #if HAVE_SYS_SOCKET_H
1091      # include <sys/socket.h>
1092      #endif])
1093
1094 AC_CHECK_HEADERS(ucontext.h,,,[#include <signal.h>])
1095
1096 dnl **** Check for types ****
1097
1098 AC_C_CONST
1099 AC_C_INLINE
1100 AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t])
1101 AC_CHECK_SIZEOF(long long,0)
1102
1103 AC_CACHE_CHECK([whether linux/input.h is for real],
1104         wine_cv_linux_input_h,
1105         AC_TRY_COMPILE([
1106             #include <linux/input.h>
1107         ] , [
1108             int foo = EVIOCGBIT(EV_ABS,42);
1109             int bar = BTN_PINKIE;
1110             int fortytwo = 42;
1111         ],
1112         wine_cv_linux_input_h=yes,
1113         wine_cv_linux_input_h=no,
1114         no
1115         )
1116     )
1117     if test "$wine_cv_linux_input_h" = "yes"
1118     then
1119         AC_DEFINE(HAVE_CORRECT_LINUXINPUT_H, 1,
1120                   [Define if we have linux/input.h AND it contains the INPUT event API])
1121     fi
1122
1123
1124 AC_CACHE_CHECK([whether we can use re-entrant gethostbyname_r Linux style],
1125         wine_cv_linux_gethostbyname_r_6,
1126         AC_TRY_COMPILE([
1127 #include <netdb.h>
1128         ], [
1129     char *name=NULL;
1130     struct hostent he;
1131     struct hostent *result;
1132     char *buf=NULL;
1133     int bufsize=0;
1134     int res,errnr;
1135     char *addr=NULL;
1136     int addrlen=0;
1137     int addrtype=0;
1138     res=gethostbyname_r(name,&he,buf,bufsize,&result,&errnr);
1139     res=gethostbyaddr_r(addr, addrlen, addrtype,&he,buf,bufsize,&result,&errnr);
1140     ],
1141         wine_cv_linux_gethostbyname_r_6=yes,
1142         wine_cv_linux_gethostbyname_r_6=no
1143         )
1144    )
1145    if test "$wine_cv_linux_gethostbyname_r_6" = "yes"
1146    then
1147       AC_DEFINE(HAVE_LINUX_GETHOSTBYNAME_R_6, 1,
1148                 [Define if Linux-style gethostbyname_r and gethostbyaddr_r are available])
1149    fi
1150
1151 if test "$ac_cv_header_linux_joystick_h" = "yes"
1152 then
1153    AC_CACHE_CHECK([whether linux/joystick.h uses the Linux 2.2+ API],
1154         wine_cv_linux_joystick_22_api,
1155         AC_TRY_COMPILE([
1156         #include <sys/ioctl.h>
1157         #include <linux/joystick.h>
1158
1159         struct js_event blub;
1160         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
1161         #error "no 2.2 header"
1162         #endif
1163         ],/*empty*/,
1164         wine_cv_linux_joystick_22_api=yes,
1165         wine_cv_linux_joystick_22_api=no,
1166         wine_cv_linux_joystick_22_api=no
1167         )
1168    )
1169    if test "$wine_cv_linux_joystick_22_api" = "yes"
1170    then
1171       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API, 1,
1172                 [Define if <linux/joystick.h> defines the Linux 2.2 joystick API])
1173    fi
1174 fi
1175
1176 dnl **** statfs checks ****
1177
1178 if test "$ac_cv_header_sys_vfs_h" = "yes"
1179 then
1180     AC_CACHE_CHECK( [whether sys/vfs.h defines statfs],
1181                     wine_cv_sys_vfs_has_statfs,
1182         AC_TRY_COMPILE([
1183         #include <sys/types.h>
1184         #ifdef HAVE_SYS_PARAM_H
1185         # include <sys/param.h>
1186         #endif
1187         #include <sys/vfs.h>
1188         ],[
1189                 struct statfs stfs;
1190
1191                 memset(&stfs,0,sizeof(stfs));
1192         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
1193         )
1194     )
1195     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
1196     then
1197       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS, 1,
1198                 [Define if the struct statfs is defined by <sys/vfs.h>])
1199     fi
1200 fi
1201
1202 if test "$ac_cv_header_sys_statfs_h" = "yes"
1203 then
1204     AC_CACHE_CHECK( [whether sys/statfs.h defines statfs],
1205                     wine_cv_sys_statfs_has_statfs,
1206         AC_TRY_COMPILE([
1207         #include <sys/types.h>
1208         #ifdef HAVE_SYS_PARAM_H
1209         # include <sys/param.h>
1210         #endif
1211         #include <sys/statfs.h>
1212         ],[
1213                 struct statfs stfs;
1214         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
1215         )
1216     )
1217     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
1218     then
1219       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS, 1,
1220                 [Define if the struct statfs is defined by <sys/statfs.h>])
1221     fi
1222 fi
1223
1224 if test "$ac_cv_header_sys_mount_h" = "yes"
1225 then
1226     AC_CACHE_CHECK( [whether sys/mount.h defines statfs],
1227                     wine_cv_sys_mount_has_statfs,
1228         AC_TRY_COMPILE([
1229         #include <sys/types.h>
1230         #ifdef HAVE_SYS_PARAM_H
1231         # include <sys/param.h>
1232         #endif
1233         #include <sys/mount.h>
1234         ],[
1235                 struct statfs stfs;
1236         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
1237         )
1238     )
1239     if test "$wine_cv_sys_mount_has_statfs" = "yes"
1240     then
1241       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT, 1,
1242                 [Define if the struct statfs is defined by <sys/mount.h>])
1243     fi
1244 fi
1245
1246 dnl **** FIXME: what about mixed cases, where we need two of them? ***
1247
1248 WINE_CHECK_STRUCT_MEMBER(statfs,f_bfree,
1249 [#include <sys/types.h>
1250 #ifdef HAVE_SYS_PARAM_H
1251 # include <sys/param.h>
1252 #endif
1253 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
1254 # include <sys/mount.h>
1255 #else
1256 # ifdef STATFS_DEFINED_BY_SYS_VFS
1257 #  include <sys/vfs.h>
1258 # else
1259 #  ifdef STATFS_DEFINED_BY_SYS_STATFS
1260 #   include <sys/statfs.h>
1261 #  endif
1262 # endif
1263 #endif],
1264     [AC_DEFINE(STATFS_HAS_BFREE, 1, [Define if the struct statfs has the member bfree])])
1265
1266 WINE_CHECK_STRUCT_MEMBER(statfs,f_bavail,
1267 [#include <sys/types.h>
1268 #ifdef HAVE_SYS_PARAM_H
1269 # include <sys/param.h>
1270 #endif
1271 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
1272 # include <sys/mount.h>
1273 #else
1274 # ifdef STATFS_DEFINED_BY_SYS_VFS
1275 #  include <sys/vfs.h>
1276 # else
1277 #  ifdef STATFS_DEFINED_BY_SYS_STATFS
1278 #   include <sys/statfs.h>
1279 #  endif
1280 # endif
1281 #endif],
1282     [AC_DEFINE(STATFS_HAS_BAVAIL, 1, [Define if the struct statfs has the member bavail])])
1283
1284 dnl Check for file descriptor passing with msg_accrights
1285 WINE_CHECK_STRUCT_MEMBER(msghdr,msg_accrights,
1286 [#include <sys/types.h>
1287 #ifdef HAVE_SYS_SOCKET_H
1288 # include <sys/socket.h>
1289 #endif],
1290     [AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS, 1, [Define if struct msghdr contains msg_accrights])])
1291
1292 dnl Check for the sa_len member in struct sockaddr
1293 WINE_CHECK_STRUCT_MEMBER(sockaddr,sa_len,
1294 [#include <sys/types.h>
1295 #ifdef HAVE_SYS_SOCKET_H
1296 # include <sys/socket.h>
1297 #endif],
1298     [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if struct sockaddr contains sa_len])])
1299
1300 dnl Check for the sun_len member in struct sockaddr_un
1301 WINE_CHECK_STRUCT_MEMBER(sockaddr_un,sun_len,
1302 [#include <sys/types.h>
1303 #ifdef HAVE_SYS_SOCKET_H
1304 # include <sys/socket.h>
1305 #endif
1306 #ifdef HAVE_SYS_UN_H
1307 # include <sys/un.h>
1308 #endif],
1309     [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN, 1, [Define if struct sockaddr_un contains sun_len])])
1310
1311 dnl *** check for the need to define platform-specific symbols
1312
1313 case $host_cpu in
1314   *i[[3456789]]86*) WINE_CHECK_DEFINE([__i386__]) ;;
1315   *alpha*)          WINE_CHECK_DEFINE([__ALPHA__]) ;;
1316   *sparc*)          WINE_CHECK_DEFINE([__sparc__]) ;;
1317 esac
1318
1319 case $host_vendor in
1320   *sun*) WINE_CHECK_DEFINE([__sun__]) ;;
1321 esac
1322
1323 dnl **** Generate output files ****
1324
1325 AH_TOP([#define __WINE_CONFIG_H])
1326
1327 WINE_CONFIG_EXTRA_DIR(controls)
1328 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/d3ddevice)
1329 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dclipper)
1330 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/ddraw)
1331 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/direct3d)
1332 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dpalette)
1333 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dsurface)
1334 WINE_CONFIG_EXTRA_DIR(dlls/dinput/joystick)
1335 WINE_CONFIG_EXTRA_DIR(dlls/dinput/keyboard)
1336 WINE_CONFIG_EXTRA_DIR(dlls/dinput/mouse)
1337 WINE_CONFIG_EXTRA_DIR(dlls/gdi/enhmfdrv)
1338 WINE_CONFIG_EXTRA_DIR(dlls/gdi/mfdrv)
1339 WINE_CONFIG_EXTRA_DIR(dlls/gdi/win16drv)
1340 WINE_CONFIG_EXTRA_DIR(dlls/kernel/messages)
1341 WINE_CONFIG_EXTRA_DIR(dlls/user/dde)
1342 WINE_CONFIG_EXTRA_DIR(dlls/user/resources)
1343 WINE_CONFIG_EXTRA_DIR(dlls/wineps/data)
1344 WINE_CONFIG_EXTRA_DIR(files)
1345 WINE_CONFIG_EXTRA_DIR(graphics)
1346 WINE_CONFIG_EXTRA_DIR(graphics/x11drv)
1347 WINE_CONFIG_EXTRA_DIR(if1632)
1348 WINE_CONFIG_EXTRA_DIR(include/wine)
1349 WINE_CONFIG_EXTRA_DIR(loader)
1350 WINE_CONFIG_EXTRA_DIR(loader/ne)
1351 WINE_CONFIG_EXTRA_DIR(memory)
1352 WINE_CONFIG_EXTRA_DIR(misc)
1353 WINE_CONFIG_EXTRA_DIR(msdos)
1354 WINE_CONFIG_EXTRA_DIR(objects)
1355 WINE_CONFIG_EXTRA_DIR(programs/regapi/tests)
1356 WINE_CONFIG_EXTRA_DIR(programs/regedit/tests)
1357 WINE_CONFIG_EXTRA_DIR(relay32)
1358 WINE_CONFIG_EXTRA_DIR(scheduler)
1359 WINE_CONFIG_EXTRA_DIR(win32)
1360 WINE_CONFIG_EXTRA_DIR(windows)
1361
1362 MAKE_RULES=Make.rules
1363 AC_SUBST_FILE(MAKE_RULES)
1364
1365 MAKE_DLL_RULES=dlls/Makedll.rules
1366 AC_SUBST_FILE(MAKE_DLL_RULES)
1367
1368 MAKE_TEST_RULES=dlls/Maketest.rules
1369 AC_SUBST_FILE(MAKE_TEST_RULES)
1370
1371 MAKE_PROG_RULES=programs/Makeprog.rules
1372 AC_SUBST_FILE(MAKE_PROG_RULES)
1373
1374 AC_CONFIG_FILES([
1375 Make.rules
1376 dlls/Makedll.rules
1377 dlls/Maketest.rules
1378 programs/Makeprog.rules
1379 Makefile
1380 dlls/Makefile
1381 dlls/advapi32/Makefile
1382 dlls/advapi32/tests/Makefile
1383 dlls/avicap32/Makefile
1384 dlls/avifil32/Makefile
1385 dlls/cabinet/Makefile
1386 dlls/comcat/Makefile
1387 dlls/comctl32/Makefile
1388 dlls/commdlg/Makefile
1389 dlls/crtdll/Makefile
1390 dlls/crypt32/Makefile
1391 dlls/ctl3d/Makefile
1392 dlls/d3d8/Makefile
1393 dlls/d3dx8/Makefile
1394 dlls/dciman32/Makefile
1395 dlls/ddraw/Makefile
1396 dlls/devenum/Makefile
1397 dlls/dinput/Makefile
1398 dlls/dinput8/Makefile
1399 dlls/dplay/Makefile
1400 dlls/dplayx/Makefile
1401 dlls/dsound/Makefile
1402 dlls/dsound/tests/Makefile
1403 dlls/gdi/Makefile
1404 dlls/gdi/tests/Makefile
1405 dlls/glu32/Makefile
1406 dlls/icmp/Makefile
1407 dlls/imagehlp/Makefile
1408 dlls/imm32/Makefile
1409 dlls/kernel/Makefile
1410 dlls/kernel/tests/Makefile
1411 dlls/lzexpand/Makefile
1412 dlls/mapi32/Makefile
1413 dlls/mpr/Makefile
1414 dlls/msacm/Makefile
1415 dlls/msacm/imaadp32/Makefile
1416 dlls/msacm/msadp32/Makefile
1417 dlls/msacm/msg711/Makefile
1418 dlls/msacm/winemp3/Makefile
1419 dlls/msdmo/Makefile
1420 dlls/msimg32/Makefile
1421 dlls/msisys/Makefile
1422 dlls/msnet32/Makefile
1423 dlls/msvcrt/Makefile
1424 dlls/msvcrt/tests/Makefile
1425 dlls/msvcrt20/Makefile
1426 dlls/msvideo/Makefile
1427 dlls/msvideo/msrle32/Makefile
1428 dlls/netapi32/Makefile
1429 dlls/netapi32/tests/Makefile
1430 dlls/ntdll/Makefile
1431 dlls/ntdll/tests/Makefile
1432 dlls/odbc32/Makefile
1433 dlls/ole32/Makefile
1434 dlls/oleaut32/Makefile
1435 dlls/oleaut32/tests/Makefile
1436 dlls/olecli/Makefile
1437 dlls/oledlg/Makefile
1438 dlls/olepro32/Makefile
1439 dlls/olesvr/Makefile
1440 dlls/opengl32/Makefile
1441 dlls/psapi/Makefile
1442 dlls/qcap/Makefile
1443 dlls/quartz/Makefile
1444 dlls/rasapi32/Makefile
1445 dlls/richedit/Makefile
1446 dlls/rpcrt4/Makefile
1447 dlls/rpcrt4/tests/Makefile
1448 dlls/serialui/Makefile
1449 dlls/setupapi/Makefile
1450 dlls/shdocvw/Makefile
1451 dlls/shell32/Makefile
1452 dlls/shell32/tests/Makefile
1453 dlls/shfolder/Makefile
1454 dlls/shlwapi/Makefile
1455 dlls/shlwapi/tests/Makefile
1456 dlls/snmpapi/Makefile
1457 dlls/sti/Makefile
1458 dlls/tapi32/Makefile
1459 dlls/ttydrv/Makefile
1460 dlls/twain/Makefile
1461 dlls/url/Makefile
1462 dlls/urlmon/Makefile
1463 dlls/urlmon/tests/Makefile
1464 dlls/user/Makefile
1465 dlls/user/tests/Makefile
1466 dlls/version/Makefile
1467 dlls/win32s/Makefile
1468 dlls/winaspi/Makefile
1469 dlls/winedos/Makefile
1470 dlls/wineps/Makefile
1471 dlls/wininet/Makefile
1472 dlls/wininet/tests/Makefile
1473 dlls/winmm/Makefile
1474 dlls/winmm/joystick/Makefile
1475 dlls/winmm/mcianim/Makefile
1476 dlls/winmm/mciavi/Makefile
1477 dlls/winmm/mcicda/Makefile
1478 dlls/winmm/mciseq/Makefile
1479 dlls/winmm/mciwave/Makefile
1480 dlls/winmm/midimap/Makefile
1481 dlls/winmm/tests/Makefile
1482 dlls/winmm/wavemap/Makefile
1483 dlls/winmm/winealsa/Makefile
1484 dlls/winmm/winearts/Makefile
1485 dlls/winmm/wineaudioio/Makefile
1486 dlls/winmm/winenas/Makefile
1487 dlls/winmm/winejack/Makefile
1488 dlls/winmm/wineoss/Makefile
1489 dlls/winnls/Makefile
1490 dlls/winsock/Makefile
1491 dlls/winsock/tests/Makefile
1492 dlls/winspool/Makefile
1493 dlls/wintab32/Makefile
1494 dlls/wintrust/Makefile
1495 dlls/wow32/Makefile
1496 dlls/wsock32/Makefile
1497 dlls/x11drv/Makefile
1498 documentation/Makefile
1499 include/Makefile
1500 library/Makefile
1501 miscemu/Makefile
1502 ole/Makefile
1503 programs/Makefile
1504 programs/avitools/Makefile
1505 programs/clock/Makefile
1506 programs/cmdlgtst/Makefile
1507 programs/control/Makefile
1508 programs/expand/Makefile
1509 programs/notepad/Makefile
1510 programs/osversioncheck/Makefile
1511 programs/progman/Makefile
1512 programs/regapi/Makefile
1513 programs/regedit/Makefile
1514 programs/regsvr32/Makefile
1515 programs/regtest/Makefile
1516 programs/rpcss/Makefile
1517 programs/rundll32/Makefile
1518 programs/uninstaller/Makefile
1519 programs/view/Makefile
1520 programs/wcmd/Makefile
1521 programs/wineboot/Makefile
1522 programs/wineconsole/Makefile
1523 programs/winedbg/Makefile
1524 programs/winefile/Makefile
1525 programs/winemine/Makefile
1526 programs/winepath/Makefile
1527 programs/winhelp/Makefile
1528 programs/winver/Makefile
1529 server/Makefile
1530 tools/Makefile
1531 tools/widl/Makefile
1532 tools/winapi/Makefile
1533 tools/winebuild/Makefile
1534 tools/winedump/Makefile
1535 tools/wmc/Makefile
1536 tools/wpp/Makefile
1537 tools/wrc/Makefile
1538 unicode/Makefile])
1539
1540 AC_OUTPUT
1541
1542 if test "$have_x" = "no"
1543 then
1544   echo
1545   echo "*** Warning: X development files not found. Wine will be built without"
1546   echo "*** X support, which currently does not work, and would probably not be"
1547   echo "*** what you want anyway. You will need to install devel packages of"
1548   echo "*** Xlib/Xfree86 at the very least."
1549 fi
1550
1551 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1552 then
1553   echo
1554   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1555   echo "*** terminal resize support. Consider upgrading ncurses."
1556 fi
1557
1558 if test "$wine_cv_libc_reentrant" = "no"
1559 then
1560   echo
1561   echo "*** Warning: non-reentrant libc detected. Wine will be built without"
1562   echo "*** threading support. Consider upgrading libc to a more recent"
1563   echo "*** reentrant version of libc."
1564 fi
1565
1566 if test "$have_x" = "yes" -a "$wine_cv_x_reentrant" != "yes"
1567 then
1568   echo
1569   echo "*** Warning: non-reentrant X11 library detected. Multi-threaded"
1570   echo "*** applications won't work properly. You should upgrade your X11 library."
1571 fi
1572
1573 if test "$wine_cv_opengl_version_OK" = "no"
1574 then
1575   echo
1576   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1577   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1578 fi
1579
1580 if test "$wine_cv_msg_freetype" = "yes"
1581 then
1582   echo
1583   echo "*** Note: Your system appears to have the FreeType 2 runtime libraries"
1584   echo "*** installed, but 'freetype-config' is not in your PATH. Install the"
1585   echo "*** freetype-devel package (or its equivalent on your distribution) to"
1586   echo "*** enable Wine to use TrueType fonts."
1587 fi
1588
1589 echo
1590 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1591 echo
1592
1593 dnl Local Variables:
1594 dnl comment-start: "dnl "
1595 dnl comment-end: ""
1596 dnl comment-start-skip: "\\bdnl\\b\\s *"
1597 dnl compile-command: "autoconf"
1598 dnl End: