1 dnl Process this file with autoconf to produce a configure script.
2 dnl Author: Michael Patra <micky@marie.physik.tu-berlin.de>
3 dnl <patra@itp1.physik.tu-berlin.de>
4 AC_REVISION([configure.in 1.00])
5 AC_INIT(controls/edit.c)
6 AC_CONFIG_HEADER(include/config.h)
7 AC_CONFIG_AUX_DIR(tools)
9 # We want these before the checks, so the checks can modify their values.
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
13 dnl **** Command-line arguments ****
18 ALT_LINK="-L\$(TOPOBJDIR) -lwine"
19 TRACE_MSGS=yes # the TRACE() macro
20 DEBUG_MSGS=yes # the TRACE(), WARN(), and FIXME() macros.
22 AC_ARG_ENABLE(emulator,
23 [ --disable-emulator build only the Wine library, not the emulator],
24 [if test "$enableval" = "no"; then MAIN_TARGET="lib"; fi])
27 [ --enable-dll build the Wine library as a DLL],
28 [if test "$enableval" = "no"; then : ; else LIB_TARGET="libwine.so.1.0"; fi])
31 [ --disable-lib build the Wine without building libwine.a],
32 [if test "$enableval" = "no"; then ALT_LINK="\$(LIBOBJS) \$(X11OBJS)"; LIB_TARGET=""; fi])
35 dnl [ --enable-ipc use inter-process communication for DDE],
36 dnl [if test "$enableval" = "no"; then : ; else OPTIONS="-DCONFIG_IPC"; fi])
39 [ --disable-debug compile out all debugging messages],
40 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
43 [ --disable-trace compile out TRACE messages],
44 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
46 AC_ARG_WITH(reentrant-x,
47 [ --without-reentrant-x compile for use with non-reentrant X libraries])
54 if test "$DEBUG_MSGS" = "no"
56 AC_DEFINE(NO_DEBUG_MSGS)
57 AC_DEFINE(NO_TRACE_MSGS)
59 if test "$TRACE_MSGS" = "no"
61 AC_DEFINE(NO_TRACE_MSGS)
65 dnl **** Check for some programs ****
76 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
78 dnl **** Check for some libraries ****
80 dnl Check for -li386 for NetBSD and OpenBSD
81 AC_CHECK_LIB(i386,i386_set_ldt)
82 dnl Check for -lossaudio for NetBSD
83 AC_CHECK_LIB(ossaudio,_oss_ioctl)
84 dnl Check for -lw for Solaris
85 AC_CHECK_LIB(w,iswalnum)
86 dnl Check for -lnsl for Solaris
87 AC_CHECK_FUNCS(gethostbyname)
88 if test "$ac_cv_func_gethostbyname" = "no"
90 AC_CHECK_LIB(nsl,gethostbyname)
92 dnl Check for -lxpg4 for FreeBSD
93 AC_CHECK_LIB(xpg4,setrunelocale)
95 AC_CHECK_LIB(dl,dlopen)
97 if test "$have_x" = "yes"
99 XLIB="-lXpm -lXext -lX11"
101 dnl FIXME: should be done once we can compile without -lXpm
102 dnl AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
103 dnl Check for X Shm extension
104 AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
105 dnl Check for XFree86 DGA extension
106 AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
107 dnl Check for XFree86 VMODE extension
108 AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11)
109 dnl Check for the presence of Mesa
110 AC_CHECK_LIB(MesaGL,OSMesaCreateContext,AC_DEFINE(HAVE_MESAGL) X_PRE_LIBS="$X_PRE_LIBS -lMesaGL",,$X_LIBS -lXext -lX11 -lm)
117 dnl **** Check which curses lib to use ***
118 AC_CHECK_LIB(ncurses,waddch)
119 if test "$ac_cv_lib_ncurses_waddch" = "yes"
121 AC_CHECK_LIB(ncurses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
123 AC_CHECK_LIB(curses,waddch)
124 AC_CHECK_LIB(curses,resizeterm,AC_DEFINE(HAVE_RESIZETERM))
127 dnl **** Check for IPX (currently Linux only) ****
128 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
130 [#include <sys/socket.h>
131 #include <netipx/ipx.h>],
132 [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
133 [AC_DEFINE(HAVE_IPX_GNU)
134 ac_cv_c_ipx_gnu="yes"],
135 [ac_cv_c_ipx_gnu="no"])
138 if test "$ac_cv_c_ipx_gnu" = "no"
140 AC_CACHE_CHECK("for linux style IPX support", ac_cv_c_ipx_linux,
142 [#include <sys/socket.h>
143 #include <asm/types.h>
144 #include <linux/ipx.h>],
145 [((struct sockaddr_ipx *)0)->sipx_family == AF_IPX],
146 [AC_DEFINE(HAVE_IPX_LINUX)
147 ac_cv_c_ipx_linux="yes"],
148 [ac_cv_c_ipx_linux="no"])
152 dnl **** Check for Open Sound System ****
153 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
155 AC_CACHE_CHECK("for Open Sound System",
156 ac_cv_c_opensoundsystem,
158 #if defined(HAVE_SYS_SOUNDCARD_H)
159 #include <sys/soundcard.h>
160 #elif defined(HAVE_MACHINE_SOUNDCARD_H)
161 #include <machine/soundcard.h>
162 #elif defined(HAVE_SOUNDCARD_H)
163 #include <soundcard.h>
167 /* check for one of the Open Sound System specific SNDCTL_ defines */
168 #if !defined(SNDCTL_DSP_STEREO)
169 #error No open sound system
171 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
173 if test "$ac_cv_c_opensoundsystem" = "yes"
178 dnl **** Check for union semun ****
180 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
181 AC_TRY_COMPILE([#include <sys/types.h>
182 #include <sys/sem.h>],[union semun foo],
183 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
184 if test "$ac_cv_c_union_semun" = "yes"
186 AC_DEFINE(HAVE_UNION_SEMUN)
189 dnl **** If ln -s doesn't work, use cp instead ****
190 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
192 dnl **** Check for gcc strength-reduce bug ****
194 if test "x${GCC}" = "xyes"
196 CFLAGS="$CFLAGS -Wall"
197 AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
200 static int Array[[3]];
203 for(i=0; i<B; i++) Array[[i]] = i - 3;
204 exit( Array[[1]] != -2 );
206 ac_cv_c_gcc_strength_bug="no",
207 ac_cv_c_gcc_strength_bug="yes",
208 ac_cv_c_gcc_strength_bug="yes") )
209 if test "$ac_cv_c_gcc_strength_bug" = "yes"
211 CFLAGS="$CFLAGS -fno-strength-reduce"
215 dnl **** Check for underscore on external symbols ****
217 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
218 ac_cv_c_extern_prefix,
220 LIBS="conftest_asm.s $LIBS"
221 cat > conftest_asm.s <<EOF
226 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
227 ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
229 if test "$ac_cv_c_extern_prefix" = "yes"
231 AC_DEFINE(NEED_UNDERSCORE_PREFIX)
234 dnl **** Check for .string in assembler ****
236 AC_CACHE_CHECK("whether assembler accepts .string",
239 LIBS="conftest_asm.s $LIBS"
240 cat > conftest_asm.s <<EOF
243 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
245 if test "$ac_cv_c_asm_string" = "yes"
247 AC_DEFINE(HAVE_ASM_STRING)
250 dnl **** Check for working dll ****
254 if test "$LIB_TARGET" = "libwine.so.1.0"
256 AC_CACHE_CHECK("whether we can build a Linux dll",
258 [saved_cflags=$CFLAGS
259 CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
260 AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
263 if test "$ac_cv_c_dll_linux" = "yes"
266 LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so"
268 AC_CACHE_CHECK("whether we can build a NetBSD dll",
270 [saved_cflags=$CFLAGS
271 CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
272 AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
275 if test "$ac_cv_c_dll_netbsd" = "yes"
278 LDSHARED="ld -Bshareable -Bforcearchive"
281 if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
283 LIB_TARGET="libwine.a"
289 dnl **** Check for reentrant libc ****
291 dnl For cross-compiling we blindly assume that libc is reentrant. This is
292 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
294 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
295 [AC_TRY_RUN([int myerrno = 0;
297 int *__errno_location(){return &myerrno;}
298 main(){connect(0,buf,255); exit(!myerrno);}],
299 wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
300 wine_cv_libc_reentrant=yes ) ] )
301 if test "$wine_cv_libc_reentrant" = "no"
303 AC_DEFINE(NO_REENTRANT_LIBC)
306 dnl **** Check for reentrant X libraries ****
308 dnl This may fail to determine whether X libraries are reentrant if
309 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
310 dnl is possible with the --without-reentrant-x option.
312 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
313 [ if test "x$with_reentrant_x" = "xno"
315 wine_cv_x_reentrant=no
318 for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
319 if test -r $dir/libX11.so; then
320 libX11_check="-D $dir/libX11.so"
323 if test -r $dir/libX11.a; then
324 libX11_check="$dir/libX11.a"
328 if test "$libX11_check" != "none"; then
329 if nm $libX11_check | grep __errno_location >/dev/null 2>&1
331 wine_cv_x_reentrant=yes
333 wine_cv_x_reentrant=no
336 wine_cv_x_reentrant=unknown
339 if test "$wine_cv_x_reentrant" = "no"
341 AC_DEFINE(NO_REENTRANT_X11)
344 dnl **** Check for functions and header files ****
346 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
347 AC_CHECK_HEADERS(wctype.h sys/syscall.h syscall.h sys/param.h sys/vfs.h sys/mount.h sys/statfs.h float.h linux/cdrom.h linux/ucdrom.h sys/cdio.h sys/filio.h sys/modem.h strings.h sys/strtio.h dlfcn.h unistd.h sys/sockio.h net/if.h netinet/in.h sys/file.h libio.h curses.h ncurses.h elf.h)
351 AC_CHECK_SIZEOF(long long,0)
353 dnl **** Check for sendmsg in -lsocket if not found above ****
355 if test $ac_cv_func_sendmsg = no; then
356 AC_CHECK_LIB(socket,sendmsg)
359 dnl **** statfs checks ****
361 if test "$ac_cv_header_sys_vfs_h" = "yes"
363 AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
364 wine_cv_sys_vfs_has_statfs,
366 #include <sys/types.h>
367 #ifdef HAVE_SYS_PARAM_H
368 # include <sys/param.h>
374 memset(&stfs,0,sizeof(stfs));
375 ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
378 if test "$wine_cv_sys_vfs_has_statfs" = "yes"
380 AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
384 if test "$ac_cv_header_sys_statfs_h" = "yes"
386 AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
387 wine_cv_sys_statfs_has_statfs,
389 #include <sys/types.h>
390 #ifdef HAVE_SYS_PARAM_H
391 # include <sys/param.h>
393 #include <sys/statfs.h>
396 ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
399 if test "$wine_cv_sys_statfs_has_statfs" = "yes"
401 AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
405 if test "$ac_cv_header_sys_mount_h" = "yes"
407 AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
408 wine_cv_sys_mount_has_statfs,
410 #include <sys/types.h>
411 #ifdef HAVE_SYS_PARAM_H
412 # include <sys/param.h>
414 #include <sys/mount.h>
417 ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
420 if test "$wine_cv_sys_mount_has_statfs" = "yes"
422 AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
426 dnl **** FIXME: what about mixed cases, where we need two of them? ***
428 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
429 [ if test "x$statfs_bfree" = "xno"
431 wine_cv_statfs_bfree=no
434 #include <sys/types.h>
435 #ifdef HAVE_SYS_PARAM_H
436 # include <sys/param.h>
438 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
439 # include <sys/mount.h>
441 # ifdef STATFS_DEFINED_BY_SYS_VFS
442 # include <sys/vfs.h>
444 # ifdef STATFS_DEFINED_BY_SYS_STATFS
445 # include <sys/statfs.h>
453 ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
456 if test "$wine_cv_statfs_bfree" = "yes"
458 AC_DEFINE(STATFS_HAS_BFREE)
461 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
462 [ if test "x$statfs_bavail" = "xno"
464 wine_cv_statfs_bavail=no
467 #include <sys/types.h>
468 #ifdef HAVE_SYS_PARAM_H
469 # include <sys/param.h>
471 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
472 # include <sys/mount.h>
474 # ifdef STATFS_DEFINED_BY_SYS_VFS
475 # include <sys/vfs.h>
477 # ifdef STATFS_DEFINED_BY_SYS_STATFS
478 # include <sys/statfs.h>
486 ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
489 if test "$wine_cv_statfs_bavail" = "yes"
491 AC_DEFINE(STATFS_HAS_BAVAIL)
494 dnl *** check for working sigaltstack
495 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
497 AC_CACHE_CHECK("for working sigaltstack",
498 ac_cv_c_working_sigaltstack,
501 #include <time.h> /* <sys/time.h> ? bad magic without end */
502 #include <sys/types.h>
503 #include <sys/signal.h>
504 #ifdef HAVE_SYS_PARAM_H
505 # include <sys/param.h>
507 #ifdef HAVE_SYSCALL_H
508 # include <syscall.h>
510 # ifdef HAVE_SYS_SYSCALL_H
511 # include <sys/syscall.h>
515 unsigned char *xaltstack;
518 main(int argc,char **argv) {
519 struct sigaltstack ss;
521 xaltstack = malloc(16384);
522 ss.ss_sp = xaltstack;
525 if (sigaltstack(&ss, NULL) < 0) {
526 /* this catches the glibc case */
527 perror("sigaltstack");
528 return (1); /* aka exit(1) aka fail */
530 /* assume it works. */
534 ac_cv_c_working_sigaltstack="yes",
535 ac_cv_c_working_sigaltstack="no",
536 ac_cv_c_working_sigaltstack="no"
539 if test "$ac_cv_c_working_sigaltstack" = "yes"
541 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
545 dnl *** check for file descriptor passing with msg_accrights
547 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
548 AC_TRY_COMPILE([#include <sys/types.h>
549 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
550 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
551 if test "$ac_cv_c_msg_accrights" = "yes"
553 AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
556 dnl **** Generate output files ****
558 MAKE_RULES=Make.rules
559 AC_SUBST_FILE(MAKE_RULES)
568 dlls/advapi32/Makefile
569 dlls/comctl32/Makefile
570 dlls/imagehlp/Makefile
572 dlls/msacm32/Makefile
575 dlls/rasapi32/Makefile
576 dlls/shell32/Makefile
577 dlls/winaspi/Makefile
578 dlls/wnaspi32/Makefile
579 documentation/Makefile
582 graphics/metafiledrv/Makefile
583 graphics/psdrv/Makefile
584 graphics/win16drv/Makefile
585 graphics/x11drv/Makefile
601 programs/clock/Makefile
602 programs/control/Makefile
603 programs/avitools/Makefile
604 programs/notepad/Makefile
605 programs/progman/Makefile
606 programs/regtest/Makefile
607 programs/view/Makefile
608 programs/winhelp/Makefile
609 programs/winver/Makefile
620 windows/ttydrv/Makefile
621 windows/x11drv/Makefile ])
623 if test "$have_x" = "no"
626 echo "*** Warning: X development files not found. Wine will be built without"
627 echo "*** X support, which currently does not work, and would probably not be"
628 echo "*** what you want anyway. You will need to install devel packages of"
629 echo "*** Xlib/Xfree86 and Xpm at the very least."
632 if test "$ac_cv_lib_ncurses_resizeterm" = "no" -a "$ac_cv_lib_ncurses_waddch" = "yes"
635 echo "*** Warning: resizeterm not found in ncurses. Wine will be built without"
636 echo "*** terminal resize support. Consider upgrading ncurses."
639 if test "$wine_cv_libc_reentrant" = "no"
642 echo "*** Warning: non-reentrant libc detected. Wine will be build without"
643 echo "*** thread support. Consider upgrading libc to a more recent"
644 echo "*** reentrant version of libc."
648 echo "Configure finished. Do 'make depend; make' to compile Wine."
652 dnl comment-start: "dnl "
654 dnl comment-start-skip: "\\bdnl\\b\\s *"
655 dnl compile-command: "autoconf"