Release 980822
[wine/hacks.git] / configure.in
blobcf1d4147543fe116579a0876cd0f87a7e75e9c63
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.
10 LIBS="$LIBS -lm"
11 test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
13 dnl **** Command-line arguments ****
15 dnl Default values
16 MAIN_TARGET=emu
17 LIB_TARGET=libwine.a
18 TRACE_MSGS=yes  # the TRACE() macro
19 DEBUG_MSGS=yes  # the TRACE(), WARN(), and FIXME() macros.
21 AC_ARG_ENABLE(emulator,
22 [  --disable-emulator      build only the Wine library, not the emulator],
23 [if test "$enableval" = "no"; then MAIN_TARGET="lib"; fi])
25 AC_ARG_ENABLE(dll,
26 [  --enable-dll            build the Wine library as a DLL],
27 [if test "$enableval" = "no"; then : ; else LIB_TARGET="libwine.so.1.0"; fi])
29 AC_ARG_ENABLE(lib,
30 [  --disable-lib           build the Wine without building libwine.a],
31 [if test "$enableval" = "no"; then LIB_TARGET="\$(LIBOBJS)"; fi])
33 dnl AC_ARG_WITH(ipc,
34 dnl [  --enable-ipc            use inter-process communication for DDE],
35 dnl [if test "$enableval" = "no"; then : ; else OPTIONS="-DCONFIG_IPC"; fi])
37 AC_ARG_ENABLE(debug,
38 [  --disable-debug         compile out all debugging messages],
39 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
41 AC_ARG_ENABLE(trace,
42 [  --disable-trace         compile out TRACE messages],
43 [if test "$enableval" = "no"; then TRACE_MSGS="no"; fi])
45 AC_ARG_WITH(reentrant-x,
46 [  --without-reentrant-x   Compile for use with non-reentrant X libraries])
48 AC_SUBST(MAIN_TARGET)
49 AC_SUBST(LIB_TARGET)
50 AC_SUBST(OPTIONS)
52 if test "$DEBUG_MSGS" = "no"
53 then
54     AC_DEFINE(NO_DEBUG_MSGS)
55     AC_DEFINE(NO_TRACE_MSGS)
56 else
57     if test "$TRACE_MSGS" = "no"
58     then
59         AC_DEFINE(NO_TRACE_MSGS)
60     fi
63 dnl **** Check for some programs ****
65 AC_PROG_MAKE_SET
66 AC_PROG_CC
67 AC_PROG_CPP
68 AC_PATH_XTRA
69 AC_PROG_YACC
70 AC_PROG_LEX
71 AC_PROG_RANLIB
72 AC_PROG_INSTALL
73 AC_PROG_LN_S
74 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
76 dnl **** Check for some libraries ****
78 dnl Check for -li386 for NetBSD and OpenBSD
79 AC_CHECK_LIB(i386,i386_set_ldt)
80 dnl Check for -lw for Solaris
81 AC_CHECK_LIB(w,iswalnum)
82 dnl Check for XFree86 DGA extension
83 AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
85 dnl **** Check for Open Sound System ****
86 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
88 AC_CACHE_CHECK("for Open Sound System",
89         ac_cv_c_opensoundsystem,
90         AC_TRY_COMPILE([
91         #ifdef HAVE_SYS_SOUNDCARD_H
92                 #include <sys/soundcard.h>
93         #endif
94         #ifdef HAVE_MACHINE_SOUNDCARD_H
95                 #include <machine/soundcard.h>
96         #endif
97         ],[
99 /* check for one of the Open Sound System specific SNDCTL_ defines */
100 #if !defined(SNDCTL_DSP_STEREO)
101 #error No open sound system
102 #endif
103 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
105 if test "$ac_cv_c_opensoundsystem" = "yes"
106 then
107     AC_DEFINE(HAVE_OSS)
110 dnl **** Check for union semun ****
112 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
113  AC_TRY_COMPILE([#include <sys/types.h>
114 #include <sys/sem.h>],[union semun foo],
115                 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
116 if test "$ac_cv_c_union_semun" = "yes"
117 then
118     AC_DEFINE(HAVE_UNION_SEMUN)
121 dnl **** If ln -s doesn't work, use cp instead ****
122 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
124 dnl **** Check for gcc strength-reduce bug ****
126 if test "x${GCC}" = "xyes"
127 then
128   CFLAGS="$CFLAGS -Wall"
129   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
130                   AC_TRY_RUN([
131 int main(void) {
132   static int Array[[3]];
133   unsigned int B = 3;
134   int i;
135   for(i=0; i<B; i++) Array[[i]] = i - 3;
136   exit( Array[[1]] != -2 );
138     ac_cv_c_gcc_strength_bug="no",
139     ac_cv_c_gcc_strength_bug="yes",
140     ac_cv_c_gcc_strength_bug="yes") )
141   if test "$ac_cv_c_gcc_strength_bug" = "yes"
142   then
143     CFLAGS="$CFLAGS -fno-strength-reduce"
144   fi
147 dnl **** Check for underscore on external symbols ****
149 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
150                ac_cv_c_extern_prefix,
151 [saved_libs=$LIBS
152 LIBS="conftest_asm.s $LIBS"
153 cat > conftest_asm.s <<EOF
154         .globl _ac_test
155 _ac_test:
156         .long 0
158 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
159             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
160 LIBS=$saved_libs])
161 if test "$ac_cv_c_extern_prefix" = "yes"
162 then
163   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
166 dnl **** Check for .string in assembler ****
168 AC_CACHE_CHECK("whether assembler accepts .string",
169                ac_cv_c_asm_string,
170 [saved_libs=$LIBS
171 LIBS="conftest_asm.s $LIBS"
172 cat > conftest_asm.s <<EOF
173         .string "test"
175 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
176 LIBS=$saved_libs])
177 if test "$ac_cv_c_asm_string" = "yes"
178 then
179   AC_DEFINE(HAVE_ASM_STRING)
182 dnl **** Check for working dll ****
184 DLLFLAGS=""
185 if test "$LIB_TARGET" = "libwine.so.1.0"
186 then
187   AC_CACHE_CHECK("whether we can build a dll",
188                  ac_cv_c_dll,
189   [saved_cflags=$CFLAGS
190   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
191   AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
192   CFLAGS=$saved_cflags
193   ])
194   if test "$ac_cv_c_dll" = "yes"
195   then
196     DLLFLAGS="-fPIC"
197   else
198     LIB_TARGET="libwine.a"
199   fi
201 AC_SUBST(DLLFLAGS)
203 dnl **** Check for reentrant X libraries ****
205 dnl This may fail to determine whether X libraries are reentrant if
206 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
207 dnl is possible with the --without-reentrant-x option.
209 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
210   [ if test "x$with_reentrant_x" = "xno"
211     then
212         wine_cv_x_reentrant=no
213     else
214         libX11_ckeck=none
215         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
216             if test -r $dir/libX11.so; then
217                 libX11_check="-D $dir/libX11.so"
218                 break 1
219             fi
220             if test -r $dir/libX11.a; then
221                 libX11_check="$dir/libX11.a"
222                 break 1
223             fi
224         done
225         if test "$libX11_check" != "none"; then
226             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
227             then
228                 wine_cv_x_reentrant=yes
229             else
230                 wine_cv_x_reentrant=no
231             fi
232         else
233             wine_cv_x_reentrant=unknown
234         fi
235     fi ] )
236 if test "$wine_cv_x_reentrant" = "no"
237 then
238   AC_DEFINE(NO_REENTRANT_X11)
241 dnl **** Check for functions and header files ****
243 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
244 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)
245 AC_HEADER_STAT()
246 AC_C_CONST()
247 AC_TYPE_SIZE_T()
248 AC_CHECK_SIZEOF(long long,0)
250 dnl **** Check for sendmsg in -lsocket if not found above ****
252 if test $ac_cv_func_sendmsg = no; then
253     AC_CHECK_LIB(socket,sendmsg)
256 dnl **** statfs checks ****
258 if test "$ac_cv_header_sys_vfs_h" = "yes"
259 then
260     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
261                     wine_cv_sys_vfs_has_statfs,
262         AC_TRY_COMPILE([
263         #include <sys/types.h>
264         #ifdef HAVE_SYS_PARAM_H
265         # include <sys/param.h>
266         #endif
267         #include <sys/vfs.h>
268         ],[
269                 struct statfs stfs;
271                 memset(&stfs,0,sizeof(stfs));
272         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
273         )
274     )
275     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
276     then
277       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
278     fi
281 if test "$ac_cv_header_sys_statfs_h" = "yes"
282 then
283     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
284                     wine_cv_sys_statfs_has_statfs,
285         AC_TRY_COMPILE([
286         #include <sys/types.h>
287         #ifdef HAVE_SYS_PARAM_H
288         # include <sys/param.h>
289         #endif
290         #include <sys/statfs.h>
291         ],[
292                 struct statfs stfs;
293         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
294         )
295     )
296     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
297     then
298       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
299     fi
302 if test "$ac_cv_header_sys_mount_h" = "yes"
303 then
304     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
305                     wine_cv_sys_mount_has_statfs,
306         AC_TRY_COMPILE([
307         #include <sys/types.h>
308         #ifdef HAVE_SYS_PARAM_H
309         # include <sys/param.h>
310         #endif
311         #include <sys/mount.h>
312         ],[
313                 struct statfs stfs;
314         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
315         )
316     )
317     if test "$wine_cv_sys_mount_has_statfs" = "yes"
318     then
319       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
320     fi
323 dnl **** FIXME: what about mixed cases, where we need two of them? ***
325 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
326   [ if test "x$statfs_bfree" = "xno"
327     then
328         wine_cv_statfs_bfree=no
329     else
330         AC_TRY_COMPILE([
331         #include <sys/types.h>
332         #ifdef HAVE_SYS_PARAM_H
333         # include <sys/param.h>
334         #endif
335         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
336         # include <sys/mount.h>
337         #else
338         # ifdef STATFS_DEFINED_BY_SYS_VFS
339         #  include <sys/vfs.h>
340         # else
341         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
342         #   include <sys/statfs.h>
343         #  endif
344         # endif
345         #endif
346         ],[
347                 struct statfs stfs;
349                 stfs.f_bfree++;
350         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
351         )
352     fi ] )
353 if test "$wine_cv_statfs_bfree" = "yes"
354 then
355   AC_DEFINE(STATFS_HAS_BFREE)
358 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
359   [ if test "x$statfs_bavail" = "xno"
360     then
361         wine_cv_statfs_bavail=no
362     else
363         AC_TRY_COMPILE([
364         #include <sys/types.h>
365         #ifdef HAVE_SYS_PARAM_H
366         # include <sys/param.h>
367         #endif
368         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
369         # include <sys/mount.h>
370         #else
371         # ifdef STATFS_DEFINED_BY_SYS_VFS
372         #  include <sys/vfs.h>
373         # else
374         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
375         #   include <sys/statfs.h>
376         #  endif
377         # endif
378         #endif
379         ],[
380                 struct statfs stfs;
382                 stfs.f_bavail++;
383         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
384         )
385     fi ] )
386 if test "$wine_cv_statfs_bavail" = "yes"
387 then
388   AC_DEFINE(STATFS_HAS_BAVAIL)
391 dnl *** check for working sigaltstack
392 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
394 AC_CACHE_CHECK("for working sigaltstack",
395         ac_cv_c_working_sigaltstack,
396         AC_TRY_RUN([
397         #include <stdio.h>
398         #include <time.h> /* <sys/time.h> ? bad magic without end */
399         #include <sys/types.h>
400         #include <sys/signal.h>
401         #ifdef HAVE_SYS_PARAM_H
402         # include <sys/param.h>
403         #endif
404         #ifdef HAVE_SYSCALL_H
405         # include <syscall.h>
406         #else
407         # ifdef HAVE_SYS_SYSCALL_H
408         #  include <sys/syscall.h>
409         # endif
410         #endif
411         
412         unsigned char *xaltstack;
414         int
415         main(int argc,char **argv) {
416             struct sigaltstack  ss;
418             xaltstack = malloc(16384);
419             ss.ss_sp    = xaltstack;
420             ss.ss_size  = 16384;
421             ss.ss_flags = 0;
422             if (sigaltstack(&ss, NULL) < 0) {
423                 /* this catches the glibc case */
424                 perror("sigaltstack");
425                 return (1); /* aka exit(1) aka fail */
426             }
427             /* assume it works. */
428             return 0; /* OK */
429         }
430         ],
431         ac_cv_c_working_sigaltstack="yes",
432         ac_cv_c_working_sigaltstack="no",
433         ac_cv_c_working_sigaltstack="no"
436 if test "$ac_cv_c_working_sigaltstack" = "yes"
437 then
438     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
442 dnl *** check for file descriptor passing with msg_accrights
444 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
445  AC_TRY_COMPILE([#include <sys/types.h>
446 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
447                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
448 if test "$ac_cv_c_msg_accrights" = "yes"
449 then
450     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
453 dnl **** Generate output files ****
455 MAKE_RULES=Make.rules
456 AC_SUBST_FILE(MAKE_RULES)
458 AC_OUTPUT([
459 Make.rules
460 Makefile
461 controls/Makefile
462 debugger/Makefile
463 dlls/Makefile
464 dlls/shell32/Makefile
465 documentation/Makefile
466 files/Makefile
467 graphics/Makefile
468 graphics/metafiledrv/Makefile
469 graphics/psdrv/Makefile
470 graphics/win16drv/Makefile
471 graphics/x11drv/Makefile
472 if1632/Makefile
473 ipc/Makefile
474 library/Makefile
475 libtest/Makefile
476 loader/Makefile
477 loader/ne/Makefile
478 loader/dos/Makefile
479 memory/Makefile
480 misc/Makefile
481 miscemu/Makefile
482 msdos/Makefile
483 multimedia/Makefile
484 objects/Makefile
485 ole/Makefile
486 programs/Makefile
487 programs/clock/Makefile
488 programs/notepad/Makefile
489 programs/progman/Makefile
490 programs/regtest/Makefile
491 programs/view/Makefile
492 programs/winhelp/Makefile
493 programs/winver/Makefile
494 rc/Makefile
495 relay32/Makefile
496 resources/Makefile
497 scheduler/Makefile
498 server/Makefile
499 tools/Makefile
500 tools/wrc/Makefile
501 tsx11/Makefile
502 win32/Makefile
503 windows/Makefile ])
505 echo
506 echo "Configure finished.  Do 'make depend; make' to compile Wine."
507 echo
509 dnl Local Variables:
510 dnl comment-start: "dnl "
511 dnl comment-end: ""
512 dnl comment-start-skip: "\\bdnl\\b\\s *"
513 dnl compile-command: "autoconf"
514 dnl End: