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