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