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