Make PROFILE_GetString account for default value in all cases.
[wine/wine-kai.git] / configure.ac
blob6bd8b7b0c81df4e6f0c73b5e84c2423387e4dd80
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Original author: Michael Patra
3 dnl See ChangeLog file for detailed change history.
5 m4_define(WINE_VERSION,regexp(m4_include(VERSION),[version \([-.0-9A-Za-z]+\)],[\1]))
7 AC_PREREQ(2.53)
8 AC_INIT([Wine],WINE_VERSION)
9 AC_CONFIG_SRCDIR(server/atom.c)         
10 AC_CONFIG_HEADERS(include/config.h)
11 AC_CONFIG_AUX_DIR(tools)
13 dnl **** Command-line arguments ****
15 dnl Default values
16 LIBEXT=so       # library type .so or .a
18 AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile out all debugging messages]))
19 AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE messages]))
20 AC_ARG_ENABLE(opengl,AC_HELP_STRING([--enable-opengl],[force usage of OpenGL even if the latter is thread-safe via pthread]))
21 AC_ARG_WITH(curses,     AC_HELP_STRING([--without-curses],[do not use curses]))
23 AC_SUBST(OPTIONS)
24 if test "x$enable_debug" = "xno"
25 then
26     AC_DEFINE(NO_DEBUG_MSGS,1,[Define to disable all debug messages.])
28 if test "x$enable_trace" = "xno" -o "x$enable_debug" = "xno"
29 then
30     AC_DEFINE(NO_TRACE_MSGS,1,[Define to disable trace messages.])
33 dnl **** Check for some programs ****
35 AC_CANONICAL_TARGET
36 AC_PROG_MAKE_SET
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PATH_XTRA
40 AC_PROG_YACC
41 AC_PROG_LEX
43 dnl **** Just additional warning checks, since AC_PROG just sets 'yacc' even
44 dnl **** without one present.
45 AC_CHECK_PROGS(XYACC,$YACC bison yacc,none)
46 if test "$XYACC" = "none"
47 then
48   AC_MSG_ERROR([no suitable bison/yacc found. Please install the 'bison' package.])
50 AC_CHECK_PROGS(XLEX,$LEX flex lex,none)
51 if test "$XLEX" = "none"
52 then
53   AC_MSG_ERROR([no suitable lex found. Please install the 'flex' package.])
55 AC_PROG_RANLIB
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AC_CHECK_PROG(C2MAN,c2man,c2man,\$(TOPSRCDIR)/tools/c2man.pl)
59 AC_PATH_PROG(LDCONFIG, ldconfig, true, [/sbin /usr/sbin $PATH])
61 dnl Check for lint
62 AC_CHECK_PROGS(LINT, lclint lint)
63 if test "$LINT" = "lint"
64 then
65   LINTFLAGS="$LINTFLAGS -errchk=%all,no%longptr64 -errhdr=%user -Ncheck=macro -Nlevel=4"
66   dnl LINTFLAGS='-D_SIZE_T "-Dsize_t=unsigned long" -errchk=longptr64'
68 AC_SUBST(LINT)
69 AC_SUBST(LINTFLAGS)
71 case $host_os in
72   *cygwin*) LDCOMBINE="ld -r --enable-stdcall-fixup" ;;
73          *) LDCOMBINE="ld -r" ;;
74 esac
75 AC_SUBST(LDCOMBINE)
77 dnl **** Check for some libraries ****
79 dnl Check for -lm
80 AC_CHECK_LIB(m,sqrt)
81 dnl Check for -li386 for NetBSD and OpenBSD
82 AC_CHECK_LIB(i386,i386_set_ldt)
83 dnl Check for -lossaudio for NetBSD
84 AC_CHECK_LIB(ossaudio,_oss_ioctl)
85 dnl Check for -lw for Solaris
86 AC_CHECK_FUNCS(iswalnum,,AC_CHECK_LIB(w,iswalnum))
87 dnl Check for -lnsl for Solaris
88 AC_CHECK_FUNCS(gethostbyname,,AC_CHECK_LIB(nsl,gethostbyname))
89 dnl Check for -lsocket for Solaris
90 AC_CHECK_FUNCS(connect,,AC_CHECK_LIB(socket,connect))
91 dnl Check for -lresolv for Solaris
92 AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton))
93 dnl Check for -lxpg4 for FreeBSD
94 AC_CHECK_LIB(xpg4,_xpg4_setrunelocale)
95 dnl Check for -lmmap for OS/2
96 AC_CHECK_LIB(mmap,mmap)
98 JPEGLIB=""
99 AC_SUBST(JPEGLIB)
100 AC_CHECK_HEADERS(jpeglib.h,
101     AC_CHECK_LIB(jpeg,jpeg_start_decompress,
102         AC_DEFINE(HAVE_LIBJPEG,1,[Define if you have libjpeg including devel headers])
103         JPEGLIB="-ljpeg"
104     )
108 AC_SUBST(XLIB)
109 AC_SUBST(XFILES)
110 XFILES=""
111 AC_SUBST(OPENGLFILES)
112 OPENGLFILES=""
113 AC_SUBST(GLU32FILES)
114 GLU32FILES=""
115 if test "$have_x" = "yes"
116 then
117     XLIB="-lXext -lX11"
118     ac_save_CPPFLAGS="$CPPFLAGS"
119     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
121     dnl *** All of the following tests require X11/Xlib.h
122     AC_CHECK_HEADERS(X11/Xlib.h,
123       [
124         dnl *** Check for X keyboard extension
125         AC_CHECK_HEADERS(X11/XKBlib.h,
126             [ dnl *** If X11/XKBlib.h exists...
127               AC_CHECK_LIB(X11, XkbQueryExtension,
128               AC_DEFINE(HAVE_XKB, 1, [Define if you have the XKB extension]),,
129               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
130             ],
131             AC_MSG_WARN([[Xkb extension not found, Wine will be built without it]])
132         )
134         dnl *** Check for X Shm extension
135         AC_CHECK_HEADERS(X11/extensions/XShm.h,
136             [ dnl *** If X11/extensions/XShm.h exists...
137               AC_CHECK_LIB(Xext, XShmQueryExtension,
138               AC_DEFINE(HAVE_LIBXXSHM, 1, [Define if you have the X Shm extension]),,
139               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
140             ],
141             AC_MSG_WARN([[XShm extension not found, Wine will be built without it]]),
142             [#include <X11/Xlib.h>])
144         dnl *** Check for X shape extension
145         AC_CHECK_HEADERS(X11/extensions/shape.h,
146             [ dnl *** If X11/extensions/shape.h exists...
147               AC_CHECK_LIB(Xext,XShapeQueryExtension,
148               AC_DEFINE(HAVE_LIBXSHAPE, 1, [Define if you have the X Shape extension]),,
149               $X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
150             ],
151             AC_MSG_WARN([[XShape extension not found, Wine will be built without it]]),
152             [#include <X11/Xlib.h>])
153         
154         dnl *** Check for XFree86 DGA / DGA 2.0 extension
155         AC_CHECK_HEADERS(X11/extensions/xf86dga.h,
156             [ dnl *** If X11/extensions/xf86dga.h exists, check 
157               dnl *** for XDGAQueryExtension()...
158               AC_CHECK_LIB(Xxf86dga, XDGAQueryExtension,
159                 [ dnl *** If found...
160                   AC_DEFINE(HAVE_LIBXXF86DGA2, 1,
161                             [Define if you have the Xxf86dga library version 2])
162                   X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
163                ],
164                 [ dnl *** If not found, look for XF86DGAQueryExtension()
165                   dnl *** instead (DGA 2.0 not found)...
166                   AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,
167                     [ AC_DEFINE(HAVE_LIBXXF86DGA, 1,
168                                 [Define if you have the Xxf86dga library version 1])
169                       X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
170                     ],,
171                     $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
172                   )
173                 ],
174                 $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
175               )
176             ],
177             AC_MSG_WARN([[DGA extension not found, Wine will be built without it]]),
178             [#include <X11/Xlib.h>])
180         dnl *** Check for XFree86 VMODE extension
181         AC_CHECK_HEADERS(X11/extensions/xf86vmode.h,
182             [ dnl *** If X11/extensions/xf86vmode.h exists...
183                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
184                   [ AC_DEFINE(HAVE_LIBXXF86VM, 1, [Define if you have the Xxf86vm library])
185                      X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
186                   ],,
187                   $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
188                 )
189             ],
190             AC_MSG_WARN([[XFree86 VMODE extension not found, Wine will be built without it]]),
191             [#include <X11/Xlib.h>])
193         dnl *** Check for XVideo extension supporting XvImages
194         AC_CHECK_HEADERS(X11/extensions/Xvlib.h,
195             [ dnl *** If X11/extensions/Xvlib.h exists...
196                 AC_CHECK_LIB(Xv, XvShmCreateImage,
197                   [ AC_DEFINE(HAVE_XVIDEO, 1, [Define if the X libraries support XVideo])
198                      X_PRE_LIBS="$X_PRE_LIBS -lXv"
199                   ],,
200                   $X_LIBS -lXext -lX11 $X_EXTRA_LIBS
201                 )
202             ],
203             AC_MSG_WARN([[XVideo extension not found, Wine will be built without it]]),
204             [#include <X11/Xlib.h>])
206         dnl *** Check for XRender include file
207         AC_CHECK_HEADERS(X11/extensions/Xrender.h,,,[#include <X11/Xlib.h>])
208       ]
209     ) dnl *** End of X11/Xlib.h check
211     dnl Check for the presence of OpenGL
212     if test "x$enable_opengl" != "xno"
213     then
214         if test -f /usr/X11R6/lib/libGL.a -a ! -f /usr/X11R6/lib/libGL.so
215         then
216             AC_MSG_ERROR([/usr/X11R6/lib/libGL.a is present on your system.
217 This prevents linking to OpenGL. Delete the file and restart configure.])
218         fi
220         AC_CHECK_HEADERS(GL/gl.h GL/glx.h)
221         if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
222         then
223             AC_CHECK_HEADERS(GL/glext.h,,,[#include <GL/glx.h>])
224             dnl Check for some problems due to old Mesa versions
225             AC_CACHE_CHECK([for up-to-date OpenGL version], wine_cv_opengl_version_OK,
226               AC_TRY_COMPILE(
227                 [#include <GL/gl.h>],
228                 [GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
229                 [wine_cv_opengl_version_OK="yes"],
230                 [wine_cv_opengl_version_OK="no"]
231               )
232             )
234             dnl Check for the thread-safety of the OpenGL library
235             AC_CACHE_CHECK([for thread-safe OpenGL version], 
236                            wine_cv_opengl_version_threadsafe,
237               [saved_libs=$LIBS
238                LIBS="$X_LIBS -lGL"
239                AC_TRY_LINK([],[pthread_getspecific();],
240                               [wine_cv_opengl_version_threadsafe="yes"],
241                               [wine_cv_opengl_version_threadsafe="no"])
242                LIBS=$saved_libs]
243             )
245             if test "$wine_cv_opengl_version_OK" = "yes" -a \( "$wine_cv_opengl_version_threadsafe" = "no" -o "x$enable_opengl" = "xyes" \)
246             then
247                 dnl Check for the presence of the library
248                 AC_CHECK_LIB(GL,glXCreateContext,
249                              X_PRE_LIBS="$X_PRE_LIBS -lGL"
250                              ,,
251                              $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
253                 if test "$ac_cv_lib_GL_glXCreateContext" = "yes"
254                 then
255                         OPENGLFILES='$(OPENGLFILES)'
256                         AC_DEFINE(HAVE_OPENGL, 1, [Define if OpenGL is present on the system])
258                         AC_CHECK_LIB(GL,glXGetProcAddressARB,
259                                      AC_DEFINE(HAVE_GLX_GETPROCADDRESS, 1,
260                                                [Define if the OpenGL library supports the glXGetProcAddressARB call]),,
261                                      $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
263                         if test "$ac_cv_lib_GL_glXGetProcAddressARB" = "yes"
264                         then
265                                AC_CACHE_CHECK([for OpenGL extension functions prototypes], wine_cv_extension_prototypes,
266                                   [AC_TRY_COMPILE([#include <GL/gl.h>
267                                                   #ifdef HAVE_GL_GLEXT_H
268                                                   # include <GL/glext.h>
269                                                   #endif
270                                                   ],
271                                                  [PFNGLCOLORTABLEEXTPROC test_proc;],
272                                                  [wine_cv_extension_prototypes="yes"],
273                                                  [wine_cv_extension_prototypes="no"]
274                                   )]
275                                 )
276                                 if test "$wine_cv_extension_prototypes" = "yes"
277                                 then
278                                     AC_DEFINE(HAVE_GLEXT_PROTOTYPES, 1,
279                                               [Define if the OpenGL headers define extension typedefs])
280                                 fi
281                         fi
283                 fi
284                 dnl Check for GLU32 library.
285                 AC_CHECK_LIB(GLU,gluLookAt,
286                              [X_PRE_LIBS="$X_PRE_LIBS -lGLU"
287                              GLU32FILES='$(GLU32FILES)']
288                              ,,
289                              $X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS
290                 )
291              fi
292          fi
293     fi
295     CPPFLAGS="$ac_save_CPPFLAGS"
296     XFILES='$(XFILES)'
297 else
298     XLIB=""
299     X_CFLAGS=""
300     X_LIBS=""
303 dnl **** Check which curses lib to use ***
304 CURSESLIBS=""
305 if test "x$with_curses" != "xno"
306 then
307     AC_CHECK_HEADERS(ncurses.h,
308         [AC_CHECK_LIB(ncurses,waddch,
309             [AC_DEFINE(HAVE_LIBNCURSES, 1, [Define if you have the ncurses library (-lncurses)])
310              CURSESLIBS="-lncurses"],
311              [AC_CHECK_HEADERS(curses.h,
312                  [AC_CHECK_LIB(curses,waddch,
313                      [AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have the curses library (-lcurses)])
314                       CURSESLIBS="-lcurses"])])])])
315     saved_libs="$LIBS"
316     LIBS="$CURSESLIBS $LIBS"
317     AC_CHECK_FUNCS(getbkgd resizeterm)
318     LIBS="$saved_libs"
320 AC_SUBST(CURSESLIBS)
322 CUPSLIBS=""
323 dnl **** Check for CUPS ****
324 wine_cv_warn_cups_h=no
325 AC_CHECK_LIB(cups,cupsGetPPD,
326         [AC_CHECK_HEADER(cups/cups.h,
327             [AC_DEFINE(HAVE_CUPS, 1, [Define if we have CUPS])
328             CUPSLIBS="-lcups"],
329             wine_cv_warn_cups_h=yes)]
331 AC_SUBST(CUPSLIBS)
333 dnl **** Check for SANE ****
334 AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
335 if test "$sane_devel" = "no"
336 then
337     SANELIBS=""
338     SANEINCL=""
339 else
340     SANELIBS="`$sane_devel --libs`"
341     SANEINCL="`$sane_devel --cflags`"
342     ac_save_CPPFLAGS="$CPPFLAGS"
343     ac_save_LIBS="$LIBS"
344     CPPFLAGS="$CPPFLAGS $SANEINCL"
345     LIBS="$LIBS $SANELIBS"
346     AC_CHECK_HEADER(sane/sane.h,
347                     [AC_CHECK_LIB(sane,sane_open,
348                                   [AC_DEFINE(HAVE_SANE, 1, [Define if we have SANE development environment])],
349                                   [SANELIBS=""
350                                   SANEINCL=""])],
351                     [SANELIBS=""
352                     SANEINCL=""])
353     LIBS="$ac_save_LIBS"
354     CPPFLAGS="$ac_save_CPPFLAGS"
356 AC_SUBST(SANELIBS)
357 AC_SUBST(SANEINCL)
359 dnl **** Check for FreeType 2 ****
360 AC_CHECK_LIB(freetype,FT_Init_FreeType,ft_lib=yes,ft_lib=no,$X_LIBS)
361 if test "$ft_lib" = "no"
362 then
363     FREETYPEINCL=""
364     wine_cv_msg_freetype=no
365 else
366     AC_CHECK_PROG(ft_devel,freetype-config,freetype-config,no)
367     if test "$ft_devel" = "no"
368     then
369         AC_CHECK_PROG(ft_devel2,freetype2-config,freetype2-config,no)
370         if test "$ft_devel2" = "freetype2-config"
371         then
372                 ft_devel=$ft_devel2
373         fi
374     fi
375     if test "$ft_devel" = "no"
376     then
377         FREETYPEINCL=""
378         wine_cv_msg_freetype=yes
379     else
380         FREETYPEINCL=`$ft_devel --cflags`
381         ac_save_CPPFLAGS="$CPPFLAGS"
382         CPPFLAGS="$FREETYPEINCL $CPPFLAGS"
383         AC_CHECK_HEADERS(freetype/freetype.h \
384                          freetype/ftglyph.h \
385                          freetype/tttables.h \
386                          freetype/ftnames.h \
387                          freetype/ftsnames.h \
388                          freetype/ttnameid.h \
389                          freetype/ftoutln.h \
390                          freetype/internal/sfnt.h)
391         AC_TRY_CPP([#include <ft2build.h>
392                     #include <freetype/fttrigon.h>],
393                     [AC_DEFINE(HAVE_FREETYPE_FTTRIGON_H, 1,
394           [Define if you have the <freetype/fttrigon.h> header file.])
395                     wine_cv_fttrigon=yes],
396                     wine_cv_fttrigon=no)
397         CPPFLAGS="$ac_save_CPPFLAGS"
398         dnl Check that we have at least freetype/freetype.h
399         if test "$ac_cv_header_freetype_freetype_h" = "yes" -a "$wine_cv_fttrigon" = "yes"
400         then
401             AC_DEFINE(HAVE_FREETYPE, 1, [Define if FreeType 2 is installed])
402             wine_cv_msg_freetype=no
403         else
404             FREETYPEINCL=""
405             wine_cv_msg_freetype=yes
406         fi
407     fi
409 AC_SUBST(FREETYPEINCL)
411 dnl **** Check for parport (currently Linux only) ****
412 AC_CACHE_CHECK([for parport header/ppdev.h], ac_cv_c_ppdev,
413  AC_TRY_COMPILE(
414    [#include <linux/ppdev.h>],
415    [ioctl (1,PPCLAIM,0)],
416    [ac_cv_c_ppdev="yes"],
417    [ac_cv_c_ppdev="no"])
419 if test "$ac_cv_c_ppdev" = "yes"
420 then
421     AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access])
424 dnl **** Check for IPX (currently Linux only) ****
425 AC_CACHE_CHECK([for GNU style IPX support], ac_cv_c_ipx_gnu,
426  AC_TRY_COMPILE(
427    [#include <sys/socket.h>
428     #include <netipx/ipx.h>],
429    [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
430    [ac_cv_c_ipx_gnu="yes"],
431    [ac_cv_c_ipx_gnu="no"])
433 if test "$ac_cv_c_ipx_gnu" = "yes"
434 then
435     AC_DEFINE(HAVE_IPX_GNU, 1, [Define if IPX should use netipx/ipx.h from libc])
438 if test "$ac_cv_c_ipx_gnu" = "no"
439 then
440  AC_CACHE_CHECK([for linux style IPX support], ac_cv_c_ipx_linux,
441   AC_TRY_COMPILE(
442     [#include <sys/socket.h>
443      #include <asm/types.h>
444      #include <linux/ipx.h>],
445     [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
446     [ac_cv_c_ipx_linux="yes"],
447     [ac_cv_c_ipx_linux="no"])
448   )
449   if test "$ac_cv_c_ipx_linux" = "yes"
450   then
451       AC_DEFINE(HAVE_IPX_LINUX, 1, [Define if IPX includes are taken from Linux kernel])
452   fi
455 dnl **** Check for Open Sound System ****
456 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
458 AC_CACHE_CHECK([for Open Sound System],
459         ac_cv_c_opensoundsystem,
460         AC_TRY_COMPILE([
461         #if defined(HAVE_SYS_SOUNDCARD_H)
462                 #include <sys/soundcard.h>
463         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
464                 #include <machine/soundcard.h>
465         #elif defined(HAVE_SOUNDCARD_H)
466                 #include <soundcard.h>
467         #endif
468         ],[
470 /* check for one of the Open Sound System specific SNDCTL_ defines */
471 #if !defined(SNDCTL_DSP_STEREO)
472 #error No open sound system
473 #endif
474 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
476 if test "$ac_cv_c_opensoundsystem" = "yes"
477 then
478     AC_DEFINE(HAVE_OSS, 1, [Define if you have the Open Sound system])
481 AC_CACHE_CHECK([for Open Sound System/MIDI interface],
482         ac_cv_c_opensoundsystem_midi,
483         AC_TRY_COMPILE([
484         #if defined(HAVE_SYS_SOUNDCARD_H)
485                 #include <sys/soundcard.h>
486         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
487                 #include <machine/soundcard.h>
488         #elif defined(HAVE_SOUNDCARD_H)
489                 #include <soundcard.h>
490         #endif
491         ],[
493 /* check for one of the Open Sound System specific SNDCTL_SEQ defines */
494 #if !defined(SNDCTL_SEQ_SYNC)
495 #error No open sound system MIDI interface
496 #endif
497 ],ac_cv_c_opensoundsystem_midi="yes",ac_cv_c_opensoundsystem_midi="no"))
499 if test "$ac_cv_c_opensoundsystem_midi" = "yes"
500 then
501     AC_DEFINE(HAVE_OSS_MIDI, 1, [Define if you have the Open Sound system (MIDI interface)])
504 dnl **** Check for aRts Sound Server ****
505 AC_PATH_PROG(ARTSCCONFIG, artsc-config)
506 AC_CACHE_CHECK([for aRts Sound server],
507         ac_cv_c_artsserver,
508         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"';
509         then
510             ac_cv_c_artsserver=no
511         else
512             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
513             ARTSC_LIBS=`$ARTSCCONFIG --libs`
514             ac_cv_c_artsserver=no
515             save_CFLAGS="$CFLAGS"
516             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
517             AC_TRY_COMPILE([
518              #include <artsc.h>
519             ],[
520              arts_stream_t stream;
521             ],[
522             ac_cv_c_artsserver=yes
523             ])
524             CFLAGS="$save_CFLAGS"
525         fi)
527 if test "$ac_cv_c_artsserver" = "yes"
528 then
529     AC_SUBST(ARTSLIBS, $ARTSC_LIBS)
530     AC_SUBST(ARTSINCL, $ARTSC_CFLAGS)
532     AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])
535 dnl **** Check for broken glibc mmap64 ****
537 AC_CACHE_CHECK( [whether mmap64 works defined as mmap], ac_cv_mmap64_works,
538         AC_TRY_RUN([
539                 #define _FILE_OFFSET_BITS 64
540                 #include <stdio.h>
541                 #include <unistd.h>
542                 #include <fcntl.h>
543                 #include <sys/mman.h>
544                 #include <errno.h>
546                 int main(int argc,char **argv) {
547                         int fd = open("conftest.map",O_CREAT|O_RDWR,0600);
548                         if (fd == -1) exit(1);
550                         unlink("conftest.map");
552                         write(fd,"test",4);
554                         if ((-1 == mmap(0,4,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0)) &&
555                             (errno == EINVAL)
556                         ) {
557                                 exit(1);
558                         }
559                         close(fd);
560                         fprintf(stderr,"success!\n");
561                         exit(0);
562                 }
564         ],
565     ac_cv_mmap64_works="yes",
566     ac_cv_mmap64_works="no",
567     ac_cv_mmap64_works="no") )
569 if test "$ac_cv_mmap64_works" = "yes"
570 then
571     AC_DEFINE(_FILE_OFFSET_BITS, 64, [Set this to 64 to enable 64-bit file support on Linux])
574 dnl **** Check for gcc strength-reduce bug ****
576 if test "x${GCC}" = "xyes"
577 then
578   CFLAGS="$CFLAGS -Wall"
579   AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
580                   AC_TRY_RUN([
581 int     L[[4]] = {0,1,2,3};
582 int main(void) {
583   static int Array[[3]];
584   unsigned int B = 3;
585   int i;
586   for(i=0; i<B; i++) Array[[i]] = i - 3;
587   for(i=0; i<4 - 1; i++) L[[i]] = L[[i + 1]];
588   L[[i]] = 4;
589   
590   exit( Array[[1]] != -2 || L[[2]] != 3);
592     ac_cv_c_gcc_strength_bug="no",
593     ac_cv_c_gcc_strength_bug="yes",
594     ac_cv_c_gcc_strength_bug="yes") )
595   if test "$ac_cv_c_gcc_strength_bug" = "yes"
596   then
597     CFLAGS="$CFLAGS -fno-strength-reduce"
598   fi
600   dnl Check for -mpreferred-stack-boundary
601   AC_CACHE_CHECK([for gcc -mpreferred-stack-boundary=2 support],
602                  ac_cv_c_gcc_stack_boundary,
603   [saved_cflags=$CFLAGS
604   CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
605   AC_TRY_COMPILE(,[return 0],ac_cv_c_gcc_stack_boundary="yes",ac_cv_c_gcc_stack_boundary="no")
606   CFLAGS=$saved_cflags
607   ])
608   if test "$ac_cv_c_gcc_stack_boundary" = "yes"
609   then
610     CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
611   fi
614 dnl **** Check if we need to place .type inside a .def directive ****
616 AC_CACHE_CHECK([whether .type must sit inside a .def directive],
617                ac_cv_c_type_in_def,
618 [saved_libs=$LIBS
619 LIBS="conftest_asm.s $LIBS"
620 cat > conftest_asm.s <<EOF
621         .globl _ac_test
622         .def _ac_test; .scl 2; .type 32; .endef
623 _ac_test:
624         .long 0
626 AC_TRY_LINK(,,ac_cv_c_type_in_def="yes",ac_cv_c_type_in_def="no")
627 LIBS=$saved_libs])
628 if test "$ac_cv_c_type_in_def" = "yes"
629 then
630   AC_DEFINE(NEED_TYPE_IN_DEF, 1, [Define if .type asm directive must be inside a .def directive])
633 dnl **** Check for underscore on external symbols ****
635 AC_CACHE_CHECK([whether external symbols need an underscore prefix],
636                ac_cv_c_extern_prefix,
637 [saved_libs=$LIBS
638 LIBS="conftest_asm.s $LIBS"
639 cat > conftest_asm.s <<EOF
640         .globl _ac_test
641 _ac_test:
642         .long 0
644 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
645             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
646 LIBS=$saved_libs])
647 if test "$ac_cv_c_extern_prefix" = "yes"
648 then
649   AC_DEFINE(NEED_UNDERSCORE_PREFIX, 1,
650             [Define if symbols declared in assembly code need an underscore prefix])
653 dnl **** Check whether stdcall symbols need to be decorated ****
655 AC_CACHE_CHECK([whether stdcall symbols need to be decorated],
656                ac_cv_c_stdcall_decoration,
657 [saved_libs=$LIBS
658 LIBS="conftest_asm.s $LIBS"
659 if test "$ac_cv_c_extern_prefix" = "yes"
660 then
661 cat > conftest_asm.s <<EOF
662         .globl _ac_test@0
663 _ac_test@0:
665 else
666 cat > conftest_asm.s <<EOF
667         .globl ac_test@0
668 ac_test@0:
671 AC_TRY_LINK([extern void __attribute__((__stdcall__)) ac_test(void);],
672             [ac_test(); return 0],
673             ac_cv_c_stdcall_decoration="yes",ac_cv_c_stdcall_decoration="no")
674 LIBS=$saved_libs])
675 if test "$ac_cv_c_stdcall_decoration" = "yes"
676 then
677   AC_DEFINE(NEED_STDCALL_DECORATION, 1,
678             [Define if stdcall symbols need to be decorated])
681 dnl **** Check for .string in assembler ****
683 AC_CACHE_CHECK([whether assembler accepts .string],
684                ac_cv_c_asm_string,
685 [saved_libs=$LIBS
686 LIBS="conftest_asm.s $LIBS"
687 cat > conftest_asm.s <<EOF
688         .string "test"
690 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
691 LIBS=$saved_libs])
692 if test "$ac_cv_c_asm_string" = "yes"
693 then
694   AC_DEFINE(HAVE_ASM_STRING, 1, [Define to use .string instead of .ascii])
697 dnl **** Check for working dll ****
699 LDSHARED=""
700 LDDLLFLAGS=""
701 DLLIBS=""
703 case $target_os in
704   cygwin|mingw32)
705     AC_CHECK_PROG(DLLWRAP,dllwrap,dllwrap,false)
706     if test "$DLLWRAP" = "dllwrap"; then
707       dnl FIXME - check whether dllwrap works correctly...
708       LIBEXT="dll"
709     else
710       LIBEXT="a"
711     fi
712     ;;
713   *)
714     AC_CHECK_HEADERS(dlfcn.h,
715         [AC_CHECK_FUNCS(dlopen,,
716             [AC_CHECK_LIB(dl,dlopen,
717                          [AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen])
718                           DLLIBS="-ldl"],
719                          [LIBEXT="a"])])],
720         [LIBEXT="a"])
722     if test "$LIBEXT" = "so"
723     then
724       AC_CACHE_CHECK([whether we can build a GNU style ELF dll],ac_cv_c_dll_gnuelf,
725       [saved_cflags=$CFLAGS
726       CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
727       AC_TRY_LINK(,[return 1],ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")
728       CFLAGS=$saved_cflags
729       ])
730       if test "$ac_cv_c_dll_gnuelf" = "yes"
731       then
732         LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
733         LDDLLFLAGS="-Wl,-Bsymbolic"
734       else
735         AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
736                      ac_cv_c_dll_unixware,
737         [saved_cflags=$CFLAGS
738         CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
739         AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
740         CFLAGS=$saved_cflags
741         ])
742         if test "$ac_cv_c_dll_unixware" = "yes"
743         then
744           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
745           LDDLLFLAGS="-Wl,-B,symbolic"
746         fi
747       fi
748     fi
749     ;;
750 esac
752 if test "$LIBEXT" = "a"; then
753   AC_MSG_ERROR(
754 [could not find a way to build shared libraries.
755 It is currently not possible to build Wine without shared library
756 (.so) support to allow transparent switch between .so and .dll files.
757 If you are using Linux, you will need a newer binutils.]
761 DLLFLAGS=""
762 LDPATH=""
764 if test "$LIBEXT" = "so"; then
765     DLLFLAGS="-fPIC"
766     DLLEXT=".so"
767     LDPATH="LD_LIBRARY_PATH=\"\$(TOPOBJDIR)/library:\$(TOPOBJDIR)/unicode:\$\$LD_LIBRARY_PATH\""
768 elif test "$LIBEXT" = "dll"; then
769     #DLLFLAGS="-fPIC" # -fPIC doesn't work(at least in cygwin-b20) - FIXME
770     DLLEXT=""
771     LDPATH="PATH=\"\$(TOPOBJDIR)/library:\$(TOPOBJDIR)/unicode:\$\$PATH\""
774 AC_SUBST(DLLIBS)
775 AC_SUBST(DLLFLAGS)
776 AC_SUBST(DLLEXT)
777 AC_SUBST(LDSHARED)
778 AC_SUBST(LDDLLFLAGS)
779 AC_SUBST(LIBEXT)
780 AC_SUBST(LDPATH)
782 dnl **** Check for reentrant libc ****
784 dnl For cross-compiling we blindly assume that libc is reentrant. This is
785 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
787 AC_DEFUN([WINE_CHECK_ERRNO],
789   AC_CACHE_CHECK(for reentrant libc: $1, wine_cv_libc_r_$1,
790   [AC_TRY_RUN([int myerrno = 0;
791 char buf[256];
792 int *$1(){return &myerrno;}
793 main(){connect(0,buf,255); exit(!myerrno);}],
794   wine_cv_libc_r_$1=yes, wine_cv_libc_r_$1=no,
795   wine_cv_libc_r_$1=yes )
797 if test "$wine_cv_libc_r_$1" = "yes"
798 then
799     wine_cv_libc_reentrant=$1 
803 wine_cv_libc_reentrant=no 
804 dnl Linux style errno location
805 WINE_CHECK_ERRNO(__errno_location)
806 dnl FreeBSD style errno location
807 WINE_CHECK_ERRNO(__error)
808 dnl Solaris style errno location
809 WINE_CHECK_ERRNO(___errno)
810 dnl UnixWare style errno location
811 WINE_CHECK_ERRNO(__thr_errno)
812 dnl NetBSD style errno location
813 WINE_CHECK_ERRNO(__errno)
815 if test "$wine_cv_libc_reentrant" != "no" 
816 then
817   AC_DEFINE_UNQUOTED(ERRNO_LOCATION,$wine_cv_libc_reentrant,
818                      [Define to the name of the function returning errno for reentrant libc])
821 dnl **** Check for reentrant X libraries ****
823 dnl This may fail to determine whether X libraries are reentrant if
824 dnl AC_PATH_XTRA does not set x_libraries.
826 if test "$have_x" = "yes"
827 then
828 AC_CACHE_CHECK( [for reentrant X libraries], wine_cv_x_reentrant,
829     [libX11_check=none
830     for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
831         if test -r $dir/libX11.so; then
832             libX11_check="-D $dir/libX11.so"
833             break
834         fi
835         if test -r $dir/libX11.a; then
836             libX11_check="$dir/libX11.a"
837             break
838         fi
839     done
840     if test "$libX11_check" != "none"; then
841         if nm $libX11_check | grep $wine_cv_libc_reentrant >/dev/null 2>&1
842         then
843             wine_cv_x_reentrant=yes
844         else
845             wine_cv_x_reentrant=no
846         fi
847     else
848         wine_cv_x_reentrant=unknown
849     fi])
852 dnl **** Check for functions ****
854 AC_FUNC_ALLOCA()
855 AC_CHECK_FUNCS(\
856         __libc_fork \
857         _lwp_create \
858         _pclose \
859         _popen \
860         _snprintf \
861         _stricmp \
862         _strnicmp \
863         chsize \
864         clone \
865         ecvt \
866         finite \
867         fpclass \
868         ftruncate \
869         ftruncate64 \
870         getnetbyaddr \
871         getnetbyname \
872         getpagesize \
873         getprotobyname \
874         getprotobynumber \
875         getservbyport \
876         getsockopt \
877         inet_network \
878         lseek64 \
879         lstat \
880         memmove \
881         mmap \
882         pclose \
883         popen \
884         pread \
885         pwrite \
886         rfork \
887         select \
888         sendmsg \
889         settimeofday \
890         sigaltstack \
891         snprintf \
892         statfs \
893         strcasecmp \
894         strerror \
895         strncasecmp \
896         tcgetattr \
897         timegm \
898         usleep \
899         vfscanf \
900         wait4 \
901         waitpid \
904 dnl **** Check for header files ****
906 AC_CHECK_HEADERS(\
907         arpa/inet.h \
908         arpa/nameser.h \
909         direct.h \
910         elf.h \
911         float.h \
912         ieeefp.h \
913         io.h \
914         libio.h \
915         libutil.h \
916         link.h \
917         linux/cdrom.h \
918         linux/hdreg.h \
919         linux/input.h \
920         linux/joystick.h \
921         linux/major.h \
922         linux/param.h \
923         linux/serial.h \
924         linux/ucdrom.h \
925         net/if.h \
926         netdb.h \
927         netinet/in.h \
928         netinet/in_systm.h \
929         netinet/ip.h \
930         netinet/tcp.h \
931         pty.h \
932         resolv.h \
933         sched.h \
934         scsi/sg.h \
935         socket.h \
936         stdint.h \
937         strings.h \
938         sys/cdio.h \
939         sys/errno.h \
940         sys/file.h \
941         sys/filio.h \
942         sys/inttypes.h \
943         sys/ipc.h \
944         sys/link.h \
945         sys/lwp.h \
946         sys/mman.h \
947         sys/modem.h \
948         sys/mount.h \
949         sys/msg.h \
950         sys/param.h \
951         sys/ptrace.h \
952         sys/reg.h \
953         sys/shm.h \
954         sys/signal.h \
955         sys/socket.h \
956         sys/sockio.h \
957         sys/statfs.h \
958         sys/strtio.h \
959         sys/syscall.h \
960         sys/sysctl.h \
961         sys/time.h \
962         sys/user.h \
963         sys/v86.h \
964         sys/v86intr.h \
965         sys/vfs.h \
966         sys/vm86.h \
967         sys/wait.h \
968         syscall.h \
969         ucontext.h \
970         unistd.h \
972 AC_HEADER_STAT()
974 dnl **** Check for types ****
976 AC_C_CONST
977 AC_C_INLINE
978 AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t])
979 AC_CHECK_SIZEOF(long long,0)
981 AC_CACHE_CHECK([whether linux/input.h is for real],
982         wine_cv_linux_input_h,
983         AC_TRY_COMPILE([
984             #include <linux/input.h>
985         ] , [
986             int foo = EVIOCGBIT(EV_ABS,42);
987             int bar = BTN_PINKIE;
988             int fortytwo = 42;
989         ],
990         wine_cv_linux_input_h=yes,
991         wine_cv_linux_input_h=no,
992         no
993         )
994     )
995     if test "$wine_cv_linux_input_h" = "yes"
996     then
997         AC_DEFINE(HAVE_CORRECT_LINUXINPUT_H, 1,
998                   [Define if we have linux/input.h AND it contains the INPUT event API])
999     fi
1001    
1002 AC_CACHE_CHECK([whether we can use re-entrant gethostbyname_r Linux style],
1003         wine_cv_linux_gethostbyname_r_6,
1004         AC_TRY_COMPILE([
1005 #include <netdb.h>
1006         ], [
1007     char *name=NULL;
1008     struct hostent he;
1009     struct hostent *result;
1010     char *buf=NULL;
1011     int bufsize=0;
1012     int res,errnr;
1013     char *addr=NULL;
1014     int addrlen=0;
1015     int addrtype=0;
1016     res=gethostbyname_r(name,&he,buf,bufsize,&result,&errnr);
1017     res=gethostbyaddr_r(addr, addrlen, addrtype,&he,buf,bufsize,&result,&errnr);
1018     ],
1019         wine_cv_linux_gethostbyname_r_6=yes,
1020         wine_cv_linux_gethostbyname_r_6=no
1021         )
1022    )
1023    if test "$wine_cv_linux_gethostbyname_r_6" = "yes"
1024    then
1025       AC_DEFINE(HAVE_LINUX_GETHOSTBYNAME_R_6, 1,
1026                 [Define if Linux-style gethostbyname_r and gethostbyaddr_r are available])
1027    fi
1029 if test "$ac_cv_header_linux_joystick_h" = "yes"
1030 then
1031    AC_CACHE_CHECK([whether linux/joystick.h uses the Linux 2.2+ API],
1032         wine_cv_linux_joystick_22_api,
1033         AC_TRY_COMPILE([
1034         #include <sys/ioctl.h>
1035         #include <linux/joystick.h>
1037         struct js_event blub;
1038         #if !defined(JS_EVENT_AXIS) || !defined(JS_EVENT_BUTTON)
1039         #error "no 2.2 header"
1040         #endif
1041         ],/*empty*/,
1042         wine_cv_linux_joystick_22_api=yes,
1043         wine_cv_linux_joystick_22_api=no,
1044         wine_cv_linux_joystick_22_api=no
1045         )
1046    )
1047    if test "$wine_cv_linux_joystick_22_api" = "yes"
1048    then
1049       AC_DEFINE(HAVE_LINUX_22_JOYSTICK_API, 1,
1050                 [Define if <linux/joystick.h> defines the Linux 2.2 joystick API])
1051    fi
1054 dnl **** statfs checks ****
1056 if test "$ac_cv_header_sys_vfs_h" = "yes"
1057 then
1058     AC_CACHE_CHECK( [whether sys/vfs.h defines statfs],
1059                     wine_cv_sys_vfs_has_statfs,
1060         AC_TRY_COMPILE([
1061         #include <sys/types.h>
1062         #ifdef HAVE_SYS_PARAM_H
1063         # include <sys/param.h>
1064         #endif
1065         #include <sys/vfs.h>
1066         ],[
1067                 struct statfs stfs;
1069                 memset(&stfs,0,sizeof(stfs));
1070         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
1071         )
1072     )
1073     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
1074     then
1075       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS, 1,
1076                 [Define if the struct statfs is defined by <sys/vfs.h>])
1077     fi
1080 if test "$ac_cv_header_sys_statfs_h" = "yes"
1081 then
1082     AC_CACHE_CHECK( [whether sys/statfs.h defines statfs],
1083                     wine_cv_sys_statfs_has_statfs,
1084         AC_TRY_COMPILE([
1085         #include <sys/types.h>
1086         #ifdef HAVE_SYS_PARAM_H
1087         # include <sys/param.h>
1088         #endif
1089         #include <sys/statfs.h>
1090         ],[
1091                 struct statfs stfs;
1092         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
1093         )
1094     )
1095     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
1096     then
1097       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS, 1,
1098                 [Define if the struct statfs is defined by <sys/statfs.h>])
1099     fi
1102 if test "$ac_cv_header_sys_mount_h" = "yes"
1103 then
1104     AC_CACHE_CHECK( [whether sys/mount.h defines statfs],
1105                     wine_cv_sys_mount_has_statfs,
1106         AC_TRY_COMPILE([
1107         #include <sys/types.h>
1108         #ifdef HAVE_SYS_PARAM_H
1109         # include <sys/param.h>
1110         #endif
1111         #include <sys/mount.h>
1112         ],[
1113                 struct statfs stfs;
1114         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
1115         )
1116     )
1117     if test "$wine_cv_sys_mount_has_statfs" = "yes"
1118     then
1119       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT, 1,
1120                 [Define if the struct statfs is defined by <sys/mount.h>])
1121     fi
1124 dnl *** Check for some structure members
1126 dnl Macro to check if a structure contains a specified member
1127 dnl Usage: WINE_CHECK_STRUCT_MEMBER(struct,member,[includes,[action-if-found,[action-if-not-found]]])
1129 AC_DEFUN([WINE_CHECK_STRUCT_MEMBER],
1130 [AC_CACHE_CHECK([for $2 in struct $1], ac_cv_c_$1_$2,
1131  AC_TRY_COMPILE([$3],[struct $1 s; s.$2 = 0],ac_cv_c_$1_$2="yes",ac_cv_c_$1_$2="no"))
1132 AS_IF([ test "x$ac_cv_c_$1_$2" = "xyes"],[$4],[$5])
1135 dnl **** FIXME: what about mixed cases, where we need two of them? ***
1137 WINE_CHECK_STRUCT_MEMBER(statfs,f_bfree,
1138 [#include <sys/types.h>
1139 #ifdef HAVE_SYS_PARAM_H
1140 # include <sys/param.h>
1141 #endif
1142 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
1143 # include <sys/mount.h>
1144 #else
1145 # ifdef STATFS_DEFINED_BY_SYS_VFS
1146 #  include <sys/vfs.h>
1147 # else
1148 #  ifdef STATFS_DEFINED_BY_SYS_STATFS
1149 #   include <sys/statfs.h>
1150 #  endif
1151 # endif
1152 #endif],
1153     [AC_DEFINE(STATFS_HAS_BFREE, 1, [Define if the struct statfs has the member bfree])])
1155 WINE_CHECK_STRUCT_MEMBER(statfs,f_bavail,
1156 [#include <sys/types.h>
1157 #ifdef HAVE_SYS_PARAM_H
1158 # include <sys/param.h>
1159 #endif
1160 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
1161 # include <sys/mount.h>
1162 #else
1163 # ifdef STATFS_DEFINED_BY_SYS_VFS
1164 #  include <sys/vfs.h>
1165 # else
1166 #  ifdef STATFS_DEFINED_BY_SYS_STATFS
1167 #   include <sys/statfs.h>
1168 #  endif
1169 # endif
1170 #endif],
1171     [AC_DEFINE(STATFS_HAS_BAVAIL, 1, [Define if the struct statfs has the member bavail])])
1173 dnl Check for file descriptor passing with msg_accrights
1174 WINE_CHECK_STRUCT_MEMBER(msghdr,msg_accrights,
1175 [#include <sys/types.h>
1176 #include <sys/socket.h>],
1177     [AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS, 1, [Define if struct msghdr contains msg_accrights])])
1179 dnl Check for the sa_len member in struct sockaddr
1180 WINE_CHECK_STRUCT_MEMBER(sockaddr,sa_len,
1181 [#include <sys/types.h>
1182 #include <sys/socket.h>],
1183     [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if struct sockaddr contains sa_len])])
1185 dnl Check for the sun_len member in struct sockaddr_un
1186 WINE_CHECK_STRUCT_MEMBER(sockaddr_un,sun_len,
1187 [#include <sys/types.h>
1188 #include <sys/socket.h>
1189 #include <sys/un.h>],
1190     [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN, 1, [Define if struct sockaddr_un contains sun_len])])
1192 dnl *** check for the need to define __i386__
1194 case $target_cpu in
1195   *i[3456789]86* )
1196     AC_CACHE_CHECK([whether we need to define __i386__],ac_cv_cpp_def_i386,
1197       AC_EGREP_CPP(yes,[#ifndef __i386__
1199 #endif],
1200  ac_cv_cpp_def_i386="yes", ac_cv_cpp_def_i386="no"))
1201     ;;
1202 esac
1203 if test "$ac_cv_cpp_def_i386" = "yes"
1204 then
1205     CFLAGS="$CFLAGS -D__i386__"
1206     LINTFLAGS="$LINTFLAGS -D__i386__"
1209 dnl **** Generate output files ****
1211 dnl Macro to create non-existent directories from config.status
1212 dnl Usage: WINE_CONFIG_EXTRA_DIR(dirname)
1213 AC_DEFUN([WINE_CONFIG_EXTRA_DIR],
1214 [AC_CONFIG_COMMANDS([$1],[test -d "$1" || (AC_MSG_NOTICE([creating $1]) && mkdir "$1")])])
1216 AH_TOP([#define __WINE_CONFIG_H])
1218 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/d3ddevice)
1219 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dclipper)
1220 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/ddraw)
1221 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/direct3d)
1222 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dpalette)
1223 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dsurface)
1224 WINE_CONFIG_EXTRA_DIR(dlls/dinput/joystick)
1225 WINE_CONFIG_EXTRA_DIR(dlls/dinput/keyboard)
1226 WINE_CONFIG_EXTRA_DIR(dlls/dinput/mouse)
1227 WINE_CONFIG_EXTRA_DIR(dlls/gdi/enhmfdrv)
1228 WINE_CONFIG_EXTRA_DIR(dlls/gdi/mfdrv)
1229 WINE_CONFIG_EXTRA_DIR(dlls/gdi/win16drv)
1230 WINE_CONFIG_EXTRA_DIR(dlls/kernel/messages)
1231 WINE_CONFIG_EXTRA_DIR(dlls/kernel/tests)
1232 WINE_CONFIG_EXTRA_DIR(dlls/oleaut32/tests)
1233 WINE_CONFIG_EXTRA_DIR(dlls/shlwapi/tests)
1234 WINE_CONFIG_EXTRA_DIR(dlls/user/dde)
1235 WINE_CONFIG_EXTRA_DIR(dlls/user/resources)
1236 WINE_CONFIG_EXTRA_DIR(dlls/user/tests)
1237 WINE_CONFIG_EXTRA_DIR(dlls/wineps/data)
1238 WINE_CONFIG_EXTRA_DIR(dlls/winsock/tests)
1239 WINE_CONFIG_EXTRA_DIR(include/wine)
1240 WINE_CONFIG_EXTRA_DIR(programs/regapi/tests)
1241 WINE_CONFIG_EXTRA_DIR(programs/winetest/tests)
1243 MAKE_RULES=Make.rules
1244 AC_SUBST_FILE(MAKE_RULES)
1246 MAKE_DLL_RULES=dlls/Makedll.rules
1247 AC_SUBST_FILE(MAKE_DLL_RULES)
1249 MAKE_PROG_RULES=programs/Makeprog.rules
1250 AC_SUBST_FILE(MAKE_PROG_RULES)
1252 AC_CONFIG_FILES([
1253 Make.rules
1254 dlls/Makedll.rules
1255 programs/Makeprog.rules
1256 Makefile
1257 controls/Makefile
1258 debugger/Makefile
1259 dlls/Makefile
1260 dlls/advapi32/Makefile
1261 dlls/avicap32/Makefile
1262 dlls/avifil32/Makefile
1263 dlls/comctl32/Makefile
1264 dlls/commdlg/Makefile
1265 dlls/crtdll/Makefile
1266 dlls/crypt32/Makefile
1267 dlls/dciman32/Makefile
1268 dlls/ddraw/Makefile
1269 dlls/devenum/Makefile
1270 dlls/dinput/Makefile
1271 dlls/dplay/Makefile
1272 dlls/dplayx/Makefile
1273 dlls/dsound/Makefile
1274 dlls/gdi/Makefile
1275 dlls/glu32/Makefile
1276 dlls/icmp/Makefile
1277 dlls/imagehlp/Makefile
1278 dlls/imm32/Makefile
1279 dlls/kernel/Makefile
1280 dlls/lzexpand/Makefile
1281 dlls/mapi32/Makefile
1282 dlls/mpr/Makefile
1283 dlls/msacm/Makefile
1284 dlls/msacm/imaadp32/Makefile
1285 dlls/msacm/msg711/Makefile
1286 dlls/msdmo/Makefile
1287 dlls/msimg32/Makefile
1288 dlls/msisys/Makefile
1289 dlls/msnet32/Makefile
1290 dlls/msrle32/Makefile
1291 dlls/msvcrt/Makefile
1292 dlls/msvcrt20/Makefile
1293 dlls/msvideo/Makefile
1294 dlls/netapi32/Makefile
1295 dlls/ntdll/Makefile
1296 dlls/odbc32/Makefile
1297 dlls/ole32/Makefile
1298 dlls/oleaut32/Makefile
1299 dlls/olecli/Makefile
1300 dlls/oledlg/Makefile
1301 dlls/olepro32/Makefile
1302 dlls/olesvr/Makefile
1303 dlls/opengl32/Makefile
1304 dlls/psapi/Makefile
1305 dlls/qcap/Makefile
1306 dlls/quartz/Makefile
1307 dlls/rasapi32/Makefile
1308 dlls/richedit/Makefile
1309 dlls/rpcrt4/Makefile
1310 dlls/serialui/Makefile
1311 dlls/setupapi/Makefile
1312 dlls/shdocvw/Makefile
1313 dlls/shell32/Makefile
1314 dlls/shfolder/Makefile
1315 dlls/shlwapi/Makefile
1316 dlls/snmpapi/Makefile
1317 dlls/sti/Makefile
1318 dlls/tapi32/Makefile
1319 dlls/ttydrv/Makefile
1320 dlls/twain/Makefile
1321 dlls/url/Makefile
1322 dlls/urlmon/Makefile
1323 dlls/user/Makefile
1324 dlls/version/Makefile
1325 dlls/win32s/Makefile
1326 dlls/winaspi/Makefile
1327 dlls/winedos/Makefile
1328 dlls/wineps/Makefile
1329 dlls/wininet/Makefile
1330 dlls/winmm/Makefile
1331 dlls/winmm/joystick/Makefile
1332 dlls/winmm/mcianim/Makefile
1333 dlls/winmm/mciavi/Makefile
1334 dlls/winmm/mcicda/Makefile
1335 dlls/winmm/mciseq/Makefile
1336 dlls/winmm/mciwave/Makefile
1337 dlls/winmm/midimap/Makefile
1338 dlls/winmm/wavemap/Makefile
1339 dlls/winmm/winearts/Makefile
1340 dlls/winmm/wineoss/Makefile
1341 dlls/winnls/Makefile
1342 dlls/winsock/Makefile
1343 dlls/winspool/Makefile
1344 dlls/wintrust/Makefile
1345 dlls/wow32/Makefile
1346 dlls/wsock32/Makefile
1347 dlls/x11drv/Makefile
1348 documentation/Makefile
1349 files/Makefile
1350 graphics/Makefile
1351 graphics/x11drv/Makefile
1352 if1632/Makefile
1353 include/Makefile
1354 library/Makefile
1355 libtest/Makefile
1356 loader/Makefile
1357 loader/ne/Makefile
1358 memory/Makefile
1359 misc/Makefile
1360 miscemu/Makefile
1361 msdos/Makefile
1362 objects/Makefile
1363 ole/Makefile
1364 programs/Makefile
1365 programs/avitools/Makefile
1366 programs/clock/Makefile
1367 programs/cmdlgtst/Makefile
1368 programs/control/Makefile
1369 programs/notepad/Makefile
1370 programs/osversioncheck/Makefile
1371 programs/progman/Makefile
1372 programs/regapi/Makefile
1373 programs/regedit/Makefile
1374 programs/regsvr32/Makefile
1375 programs/regtest/Makefile
1376 programs/uninstaller/Makefile
1377 programs/view/Makefile
1378 programs/wcmd/Makefile
1379 programs/wineconsole/Makefile
1380 programs/winemine/Makefile
1381 programs/winepath/Makefile
1382 programs/winetest/Makefile
1383 programs/winhelp/Makefile
1384 programs/winver/Makefile
1385 relay32/Makefile
1386 scheduler/Makefile
1387 server/Makefile
1388 tools/Makefile
1389 tools/winapi/Makefile
1390 tools/winebuild/Makefile
1391 tools/winedump/Makefile
1392 tools/wmc/Makefile
1393 tools/wrc/Makefile
1394 tsx11/Makefile
1395 unicode/Makefile
1396 win32/Makefile
1397 windows/Makefile])
1399 AC_OUTPUT
1401 if test "$have_x" = "no"
1402 then
1403   echo
1404   echo "*** Warning: X development files not found. Wine will be built without"
1405   echo "*** X support, which currently does not work, and would probably not be"
1406   echo "*** what you want anyway. You will need to install devel packages of"
1407   echo "*** Xlib/Xfree86 at the very least."
1410 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
1411 then
1412   echo
1413   echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
1414   echo "*** terminal resize support. Consider upgrading ncurses."
1417 if test "$wine_cv_libc_reentrant" = "no" 
1418 then
1419   echo
1420   echo "*** Warning: non-reentrant libc detected. Wine will be built without"
1421   echo "*** threading support. Consider upgrading libc to a more recent"
1422   echo "*** reentrant version of libc."
1425 if test "$have_x" = "yes" -a "$wine_cv_x_reentrant" != "yes"
1426 then
1427   echo
1428   echo "*** Warning: non-reentrant X11 library detected. Multi-threaded"
1429   echo "*** applications won't work properly. You should upgrade your X11 library."
1432 if test "$wine_cv_opengl_version_OK" = "no"
1433 then
1434   echo
1435   echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
1436   echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
1439 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a "x$enable_opengl" = "x"
1440 then
1441   echo
1442   echo "*** Warning: the OpenGL version you have installed relies on libpthread for"
1443   echo "*** thread-safety. To prevent crashes, OpenGL support has been removed."
1444   echo "*** A fix for glibc 2.1.3 that seems to work is included in this version of Wine,"
1445   echo "*** start configure with '--enable-opengl' to force OpenGL support."
1448 if test "$wine_cv_opengl_version_threadsafe" = "yes" -a "x$enable_opengl" = "xyes"
1449 then
1450   echo
1451   echo "*** Warning: you explicitly linked in a thread-safe OpenGL version. If you"
1452   echo "*** experience unusual crashes on DirectDraw games, try first to disable OpenGL"
1453   echo "*** support before reporting bugs."
1456 if test "$wine_cv_warn_cups_h" = "yes"
1457 then
1458   echo
1459   echo "*** Note: You have cups runtime libraries, but no development"
1460   echo "*** libraries. Install the cups-devel package or whichever package"
1461   echo "*** contains cups.h to enable CUPS support in Wine."
1464 if test "$wine_cv_msg_freetype" = "yes"
1465 then
1466   echo
1467   echo "*** Note: Your system appears to have the FreeType 2 runtime libraries"
1468   echo "*** installed, but 'freetype-config' is not in your PATH. Install the"
1469   echo "*** freetype-devel package (or its equivalent on your distribution) to"
1470   echo "*** enable Wine to use TrueType fonts."
1473 echo
1474 echo "Configure finished.  Do 'make depend && make' to compile Wine."
1475 echo
1477 dnl Local Variables:
1478 dnl comment-start: "dnl "
1479 dnl comment-end: ""
1480 dnl comment-start-skip: "\\bdnl\\b\\s *"
1481 dnl compile-command: "autoconf"
1482 dnl End: