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 ****
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 -lw for Solaris
83 AC_CHECK_LIB(w,iswalnum)
84 dnl Check for -lnsl for Solaris
85 AC_CHECK_FUNCS(gethostbyname)
86 if test "$ac_cv_func_gethostbyname" = "no"
88 AC_CHECK_LIB(nsl,gethostbyname)
90 dnl Check for -lxpg4 for FreeBSD
91 AC_CHECK_LIB(xpg4,setrunelocale)
93 AC_CHECK_LIB(dl,dlopen)
95 if test "$have_x" = "yes"
97 XLIB="-lXpm -lXext -lX11"
99 dnl FIXME: should be done once we can compile without -lXpm
100 dnl AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
101 dnl Check for X Shm extension
102 AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
103 dnl Check for XFree86 DGA extension
104 AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
111 dnl **** Check for Open Sound System ****
112 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
114 AC_CACHE_CHECK("for Open Sound System",
115 ac_cv_c_opensoundsystem,
117 #ifdef HAVE_SYS_SOUNDCARD_H
118 #include <sys/soundcard.h>
120 #ifdef HAVE_MACHINE_SOUNDCARD_H
121 #include <machine/soundcard.h>
125 /* check for one of the Open Sound System specific SNDCTL_ defines */
126 #if !defined(SNDCTL_DSP_STEREO)
127 #error No open sound system
129 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
131 if test "$ac_cv_c_opensoundsystem" = "yes"
136 dnl **** Check for union semun ****
138 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
139 AC_TRY_COMPILE([#include <sys/types.h>
140 #include <sys/sem.h>],[union semun foo],
141 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
142 if test "$ac_cv_c_union_semun" = "yes"
144 AC_DEFINE(HAVE_UNION_SEMUN)
147 dnl **** If ln -s doesn't work, use cp instead ****
148 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
150 dnl **** Check for gcc strength-reduce bug ****
152 if test "x${GCC}" = "xyes"
154 CFLAGS="$CFLAGS -Wall"
155 AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
158 static int Array[[3]];
161 for(i=0; i<B; i++) Array[[i]] = i - 3;
162 exit( Array[[1]] != -2 );
164 ac_cv_c_gcc_strength_bug="no",
165 ac_cv_c_gcc_strength_bug="yes",
166 ac_cv_c_gcc_strength_bug="yes") )
167 if test "$ac_cv_c_gcc_strength_bug" = "yes"
169 CFLAGS="$CFLAGS -fno-strength-reduce"
173 dnl **** Check for underscore on external symbols ****
175 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
176 ac_cv_c_extern_prefix,
178 LIBS="conftest_asm.s $LIBS"
179 cat > conftest_asm.s <<EOF
184 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
185 ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
187 if test "$ac_cv_c_extern_prefix" = "yes"
189 AC_DEFINE(NEED_UNDERSCORE_PREFIX)
192 dnl **** Check for .string in assembler ****
194 AC_CACHE_CHECK("whether assembler accepts .string",
197 LIBS="conftest_asm.s $LIBS"
198 cat > conftest_asm.s <<EOF
201 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
203 if test "$ac_cv_c_asm_string" = "yes"
205 AC_DEFINE(HAVE_ASM_STRING)
208 dnl **** Check for working dll ****
211 if test "$LIB_TARGET" = "libwine.so.1.0"
213 AC_CACHE_CHECK("whether we can build a dll",
215 [saved_cflags=$CFLAGS
216 CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
217 AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
220 if test "$ac_cv_c_dll" = "yes"
224 LIB_TARGET="libwine.a"
229 dnl **** Check for reentrant libc ****
231 dnl For cross-compiling we blindly assume that libc is reentrant. This is
232 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
234 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
235 [AC_TRY_RUN([int myerrno = 0;
237 int *__errno_location(){return &myerrno;}
238 main(){connect(0,buf,255); exit(!myerrno);}],
239 wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
240 wine_cv_libc_reentrant=yes ) ] )
241 if test "$wine_cv_libc_reentrant" = "no"
243 AC_DEFINE(NO_REENTRANT_LIBC)
246 dnl **** Check for reentrant X libraries ****
248 dnl This may fail to determine whether X libraries are reentrant if
249 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
250 dnl is possible with the --without-reentrant-x option.
252 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
253 [ if test "x$with_reentrant_x" = "xno"
255 wine_cv_x_reentrant=no
258 for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
259 if test -r $dir/libX11.so; then
260 libX11_check="-D $dir/libX11.so"
263 if test -r $dir/libX11.a; then
264 libX11_check="$dir/libX11.a"
268 if test "$libX11_check" != "none"; then
269 if nm $libX11_check | grep __errno_location >/dev/null 2>&1
271 wine_cv_x_reentrant=yes
273 wine_cv_x_reentrant=no
276 wine_cv_x_reentrant=unknown
279 if test "$wine_cv_x_reentrant" = "no"
281 AC_DEFINE(NO_REENTRANT_X11)
284 dnl **** Check for functions and header files ****
286 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
287 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)
291 AC_CHECK_SIZEOF(long long,0)
293 dnl **** Check for sendmsg in -lsocket if not found above ****
295 if test $ac_cv_func_sendmsg = no; then
296 AC_CHECK_LIB(socket,sendmsg)
299 dnl **** statfs checks ****
301 if test "$ac_cv_header_sys_vfs_h" = "yes"
303 AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
304 wine_cv_sys_vfs_has_statfs,
306 #include <sys/types.h>
307 #ifdef HAVE_SYS_PARAM_H
308 # include <sys/param.h>
314 memset(&stfs,0,sizeof(stfs));
315 ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
318 if test "$wine_cv_sys_vfs_has_statfs" = "yes"
320 AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
324 if test "$ac_cv_header_sys_statfs_h" = "yes"
326 AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
327 wine_cv_sys_statfs_has_statfs,
329 #include <sys/types.h>
330 #ifdef HAVE_SYS_PARAM_H
331 # include <sys/param.h>
333 #include <sys/statfs.h>
336 ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
339 if test "$wine_cv_sys_statfs_has_statfs" = "yes"
341 AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
345 if test "$ac_cv_header_sys_mount_h" = "yes"
347 AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
348 wine_cv_sys_mount_has_statfs,
350 #include <sys/types.h>
351 #ifdef HAVE_SYS_PARAM_H
352 # include <sys/param.h>
354 #include <sys/mount.h>
357 ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
360 if test "$wine_cv_sys_mount_has_statfs" = "yes"
362 AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
366 dnl **** FIXME: what about mixed cases, where we need two of them? ***
368 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
369 [ if test "x$statfs_bfree" = "xno"
371 wine_cv_statfs_bfree=no
374 #include <sys/types.h>
375 #ifdef HAVE_SYS_PARAM_H
376 # include <sys/param.h>
378 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
379 # include <sys/mount.h>
381 # ifdef STATFS_DEFINED_BY_SYS_VFS
382 # include <sys/vfs.h>
384 # ifdef STATFS_DEFINED_BY_SYS_STATFS
385 # include <sys/statfs.h>
393 ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
396 if test "$wine_cv_statfs_bfree" = "yes"
398 AC_DEFINE(STATFS_HAS_BFREE)
401 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
402 [ if test "x$statfs_bavail" = "xno"
404 wine_cv_statfs_bavail=no
407 #include <sys/types.h>
408 #ifdef HAVE_SYS_PARAM_H
409 # include <sys/param.h>
411 #ifdef STATFS_DEFINED_BY_SYS_MOUNT
412 # include <sys/mount.h>
414 # ifdef STATFS_DEFINED_BY_SYS_VFS
415 # include <sys/vfs.h>
417 # ifdef STATFS_DEFINED_BY_SYS_STATFS
418 # include <sys/statfs.h>
426 ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
429 if test "$wine_cv_statfs_bavail" = "yes"
431 AC_DEFINE(STATFS_HAS_BAVAIL)
434 dnl *** check for working sigaltstack
435 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
437 AC_CACHE_CHECK("for working sigaltstack",
438 ac_cv_c_working_sigaltstack,
441 #include <time.h> /* <sys/time.h> ? bad magic without end */
442 #include <sys/types.h>
443 #include <sys/signal.h>
444 #ifdef HAVE_SYS_PARAM_H
445 # include <sys/param.h>
447 #ifdef HAVE_SYSCALL_H
448 # include <syscall.h>
450 # ifdef HAVE_SYS_SYSCALL_H
451 # include <sys/syscall.h>
455 unsigned char *xaltstack;
458 main(int argc,char **argv) {
459 struct sigaltstack ss;
461 xaltstack = malloc(16384);
462 ss.ss_sp = xaltstack;
465 if (sigaltstack(&ss, NULL) < 0) {
466 /* this catches the glibc case */
467 perror("sigaltstack");
468 return (1); /* aka exit(1) aka fail */
470 /* assume it works. */
474 ac_cv_c_working_sigaltstack="yes",
475 ac_cv_c_working_sigaltstack="no",
476 ac_cv_c_working_sigaltstack="no"
479 if test "$ac_cv_c_working_sigaltstack" = "yes"
481 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
485 dnl *** check for file descriptor passing with msg_accrights
487 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
488 AC_TRY_COMPILE([#include <sys/types.h>
489 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
490 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
491 if test "$ac_cv_c_msg_accrights" = "yes"
493 AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
496 dnl **** Generate output files ****
498 MAKE_RULES=Make.rules
499 AC_SUBST_FILE(MAKE_RULES)
507 dlls/comctl32/Makefile
508 dlls/imagehlp/Makefile
510 dlls/msacm32/Makefile
513 dlls/shell32/Makefile
514 dlls/winaspi/Makefile
515 dlls/wnaspi32/Makefile
516 documentation/Makefile
519 graphics/metafiledrv/Makefile
520 graphics/psdrv/Makefile
521 graphics/win16drv/Makefile
522 graphics/x11drv/Makefile
538 programs/clock/Makefile
539 programs/control/Makefile
540 programs/notepad/Makefile
541 programs/progman/Makefile
542 programs/regtest/Makefile
543 programs/view/Makefile
544 programs/winhelp/Makefile
545 programs/winver/Makefile
556 windows/x11drv/Makefile ])
558 if test "$wine_cv_libc_reentrant" = "no"
561 echo "*** Warning: non-reentrant libc detected. Wine will be build without"
562 echo "*** thread support. Consider upgrading libc to a more recent"
563 echo "*** reentrant version of libc."
568 echo "Configure finished. Do 'make depend; make' to compile Wine."
572 dnl comment-start: "dnl "
574 dnl comment-start-skip: "\\bdnl\\b\\s *"
575 dnl compile-command: "autoconf"