Initial revision
[wine/multimedia.git] / configure.in
blob0e0a190837b72c9c807b5583ef18db1b70a41235
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 -lxpg4 for FreeBSD
83 AC_CHECK_LIB(xpg4,setrunelocale)
84 dnl Check for XFree86 DGA extension
85 AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
87 dnl **** Check for Open Sound System ****
88 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
90 AC_CACHE_CHECK("for Open Sound System",
91         ac_cv_c_opensoundsystem,
92         AC_TRY_COMPILE([
93         #ifdef HAVE_SYS_SOUNDCARD_H
94                 #include <sys/soundcard.h>
95         #endif
96         #ifdef HAVE_MACHINE_SOUNDCARD_H
97                 #include <machine/soundcard.h>
98         #endif
99         ],[
101 /* check for one of the Open Sound System specific SNDCTL_ defines */
102 #if !defined(SNDCTL_DSP_STEREO)
103 #error No open sound system
104 #endif
105 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
107 if test "$ac_cv_c_opensoundsystem" = "yes"
108 then
109     AC_DEFINE(HAVE_OSS)
112 dnl **** Check for union semun ****
114 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
115  AC_TRY_COMPILE([#include <sys/types.h>
116 #include <sys/sem.h>],[union semun foo],
117                 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
118 if test "$ac_cv_c_union_semun" = "yes"
119 then
120     AC_DEFINE(HAVE_UNION_SEMUN)
123 dnl **** If ln -s doesn't work, use cp instead ****
124 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
126 dnl **** Check for gcc strength-reduce bug ****
128 if test "x${GCC}" = "xyes"
129 then
130   CFLAGS="$CFLAGS -Wall"
131   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
132                   AC_TRY_RUN([
133 int main(void) {
134   static int Array[[3]];
135   unsigned int B = 3;
136   int i;
137   for(i=0; i<B; i++) Array[[i]] = i - 3;
138   exit( Array[[1]] != -2 );
140     ac_cv_c_gcc_strength_bug="no",
141     ac_cv_c_gcc_strength_bug="yes",
142     ac_cv_c_gcc_strength_bug="yes") )
143   if test "$ac_cv_c_gcc_strength_bug" = "yes"
144   then
145     CFLAGS="$CFLAGS -fno-strength-reduce"
146   fi
149 dnl **** Check for underscore on external symbols ****
151 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
152                ac_cv_c_extern_prefix,
153 [saved_libs=$LIBS
154 LIBS="conftest_asm.s $LIBS"
155 cat > conftest_asm.s <<EOF
156         .globl _ac_test
157 _ac_test:
158         .long 0
160 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
161             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
162 LIBS=$saved_libs])
163 if test "$ac_cv_c_extern_prefix" = "yes"
164 then
165   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
168 dnl **** Check for .string in assembler ****
170 AC_CACHE_CHECK("whether assembler accepts .string",
171                ac_cv_c_asm_string,
172 [saved_libs=$LIBS
173 LIBS="conftest_asm.s $LIBS"
174 cat > conftest_asm.s <<EOF
175         .string "test"
177 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
178 LIBS=$saved_libs])
179 if test "$ac_cv_c_asm_string" = "yes"
180 then
181   AC_DEFINE(HAVE_ASM_STRING)
184 dnl **** Check for working dll ****
186 DLLFLAGS=""
187 if test "$LIB_TARGET" = "libwine.so.1.0"
188 then
189   AC_CACHE_CHECK("whether we can build a dll",
190                  ac_cv_c_dll,
191   [saved_cflags=$CFLAGS
192   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
193   AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
194   CFLAGS=$saved_cflags
195   ])
196   if test "$ac_cv_c_dll" = "yes"
197   then
198     DLLFLAGS="-fPIC"
199   else
200     LIB_TARGET="libwine.a"
201   fi
203 AC_SUBST(DLLFLAGS)
205 dnl **** Check for reentrant libc ****
207 dnl For cross-compiling we blindly assume that libc is reentrant. This is
208 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
210 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
211   [AC_TRY_RUN([int myerrno = 0;
212 char buf[256];
213 int *__errno_location(){return &myerrno;}
214 main(){connect(0,buf,255); exit(!myerrno);}],
215   wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
216   wine_cv_libc_reentrant=yes ) ] )
217 if test "$wine_cv_libc_reentrant" = "no" 
218 then
219   AC_DEFINE(NO_REENTRANT_LIBC)
222 dnl **** Check for reentrant X libraries ****
224 dnl This may fail to determine whether X libraries are reentrant if
225 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
226 dnl is possible with the --without-reentrant-x option.
228 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
229   [ if test "x$with_reentrant_x" = "xno"
230     then
231         wine_cv_x_reentrant=no
232     else
233         libX11_ckeck=none
234         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
235             if test -r $dir/libX11.so; then
236                 libX11_check="-D $dir/libX11.so"
237                 break 1
238             fi
239             if test -r $dir/libX11.a; then
240                 libX11_check="$dir/libX11.a"
241                 break 1
242             fi
243         done
244         if test "$libX11_check" != "none"; then
245             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
246             then
247                 wine_cv_x_reentrant=yes
248             else
249                 wine_cv_x_reentrant=no
250             fi
251         else
252             wine_cv_x_reentrant=unknown
253         fi
254     fi ] )
255 if test "$wine_cv_x_reentrant" = "no"
256 then
257   AC_DEFINE(NO_REENTRANT_X11)
260 dnl **** Check for functions and header files ****
262 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
263 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)
264 AC_HEADER_STAT()
265 AC_C_CONST()
266 AC_TYPE_SIZE_T()
267 AC_CHECK_SIZEOF(long long,0)
269 dnl **** Check for sendmsg in -lsocket if not found above ****
271 if test $ac_cv_func_sendmsg = no; then
272     AC_CHECK_LIB(socket,sendmsg)
275 dnl **** statfs checks ****
277 if test "$ac_cv_header_sys_vfs_h" = "yes"
278 then
279     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
280                     wine_cv_sys_vfs_has_statfs,
281         AC_TRY_COMPILE([
282         #include <sys/types.h>
283         #ifdef HAVE_SYS_PARAM_H
284         # include <sys/param.h>
285         #endif
286         #include <sys/vfs.h>
287         ],[
288                 struct statfs stfs;
290                 memset(&stfs,0,sizeof(stfs));
291         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
292         )
293     )
294     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
295     then
296       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
297     fi
300 if test "$ac_cv_header_sys_statfs_h" = "yes"
301 then
302     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
303                     wine_cv_sys_statfs_has_statfs,
304         AC_TRY_COMPILE([
305         #include <sys/types.h>
306         #ifdef HAVE_SYS_PARAM_H
307         # include <sys/param.h>
308         #endif
309         #include <sys/statfs.h>
310         ],[
311                 struct statfs stfs;
312         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
313         )
314     )
315     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
316     then
317       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
318     fi
321 if test "$ac_cv_header_sys_mount_h" = "yes"
322 then
323     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
324                     wine_cv_sys_mount_has_statfs,
325         AC_TRY_COMPILE([
326         #include <sys/types.h>
327         #ifdef HAVE_SYS_PARAM_H
328         # include <sys/param.h>
329         #endif
330         #include <sys/mount.h>
331         ],[
332                 struct statfs stfs;
333         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
334         )
335     )
336     if test "$wine_cv_sys_mount_has_statfs" = "yes"
337     then
338       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
339     fi
342 dnl **** FIXME: what about mixed cases, where we need two of them? ***
344 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
345   [ if test "x$statfs_bfree" = "xno"
346     then
347         wine_cv_statfs_bfree=no
348     else
349         AC_TRY_COMPILE([
350         #include <sys/types.h>
351         #ifdef HAVE_SYS_PARAM_H
352         # include <sys/param.h>
353         #endif
354         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
355         # include <sys/mount.h>
356         #else
357         # ifdef STATFS_DEFINED_BY_SYS_VFS
358         #  include <sys/vfs.h>
359         # else
360         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
361         #   include <sys/statfs.h>
362         #  endif
363         # endif
364         #endif
365         ],[
366                 struct statfs stfs;
368                 stfs.f_bfree++;
369         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
370         )
371     fi ] )
372 if test "$wine_cv_statfs_bfree" = "yes"
373 then
374   AC_DEFINE(STATFS_HAS_BFREE)
377 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
378   [ if test "x$statfs_bavail" = "xno"
379     then
380         wine_cv_statfs_bavail=no
381     else
382         AC_TRY_COMPILE([
383         #include <sys/types.h>
384         #ifdef HAVE_SYS_PARAM_H
385         # include <sys/param.h>
386         #endif
387         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
388         # include <sys/mount.h>
389         #else
390         # ifdef STATFS_DEFINED_BY_SYS_VFS
391         #  include <sys/vfs.h>
392         # else
393         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
394         #   include <sys/statfs.h>
395         #  endif
396         # endif
397         #endif
398         ],[
399                 struct statfs stfs;
401                 stfs.f_bavail++;
402         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
403         )
404     fi ] )
405 if test "$wine_cv_statfs_bavail" = "yes"
406 then
407   AC_DEFINE(STATFS_HAS_BAVAIL)
410 dnl *** check for working sigaltstack
411 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
413 AC_CACHE_CHECK("for working sigaltstack",
414         ac_cv_c_working_sigaltstack,
415         AC_TRY_RUN([
416         #include <stdio.h>
417         #include <time.h> /* <sys/time.h> ? bad magic without end */
418         #include <sys/types.h>
419         #include <sys/signal.h>
420         #ifdef HAVE_SYS_PARAM_H
421         # include <sys/param.h>
422         #endif
423         #ifdef HAVE_SYSCALL_H
424         # include <syscall.h>
425         #else
426         # ifdef HAVE_SYS_SYSCALL_H
427         #  include <sys/syscall.h>
428         # endif
429         #endif
430         
431         unsigned char *xaltstack;
433         int
434         main(int argc,char **argv) {
435             struct sigaltstack  ss;
437             xaltstack = malloc(16384);
438             ss.ss_sp    = xaltstack;
439             ss.ss_size  = 16384;
440             ss.ss_flags = 0;
441             if (sigaltstack(&ss, NULL) < 0) {
442                 /* this catches the glibc case */
443                 perror("sigaltstack");
444                 return (1); /* aka exit(1) aka fail */
445             }
446             /* assume it works. */
447             return 0; /* OK */
448         }
449         ],
450         ac_cv_c_working_sigaltstack="yes",
451         ac_cv_c_working_sigaltstack="no",
452         ac_cv_c_working_sigaltstack="no"
455 if test "$ac_cv_c_working_sigaltstack" = "yes"
456 then
457     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
461 dnl *** check for file descriptor passing with msg_accrights
463 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
464  AC_TRY_COMPILE([#include <sys/types.h>
465 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
466                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
467 if test "$ac_cv_c_msg_accrights" = "yes"
468 then
469     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
472 dnl **** Generate output files ****
474 MAKE_RULES=Make.rules
475 AC_SUBST_FILE(MAKE_RULES)
477 AC_OUTPUT([
478 Make.rules
479 Makefile
480 controls/Makefile
481 debugger/Makefile
482 dlls/Makefile
483 dlls/comctl32/Makefile
484 dlls/psapi/Makefile
485 dlls/shell32/Makefile
486 dlls/winaspi/Makefile
487 dlls/wnaspi32/Makefile
488 documentation/Makefile
489 files/Makefile
490 graphics/Makefile
491 graphics/metafiledrv/Makefile
492 graphics/psdrv/Makefile
493 graphics/win16drv/Makefile
494 graphics/x11drv/Makefile
495 if1632/Makefile
496 ipc/Makefile
497 library/Makefile
498 libtest/Makefile
499 loader/Makefile
500 loader/ne/Makefile
501 loader/dos/Makefile
502 memory/Makefile
503 misc/Makefile
504 miscemu/Makefile
505 msdos/Makefile
506 multimedia/Makefile
507 objects/Makefile
508 ole/Makefile
509 programs/Makefile
510 programs/clock/Makefile
511 programs/control/Makefile
512 programs/notepad/Makefile
513 programs/progman/Makefile
514 programs/regtest/Makefile
515 programs/view/Makefile
516 programs/winhelp/Makefile
517 programs/winver/Makefile
518 rc/Makefile
519 relay32/Makefile
520 resources/Makefile
521 scheduler/Makefile
522 server/Makefile
523 tools/Makefile
524 tools/wrc/Makefile
525 tsx11/Makefile
526 win32/Makefile
527 windows/Makefile ])
529 if test "$wine_cv_libc_reentrant" = "no" 
530 then
531   echo
532   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
533   echo "*** thread support. Consider upgrading libc to a more recent"
534   echo "*** reentrant version of libc."
535   echo
538 echo
539 echo "Configure finished.  Do 'make depend; make' to compile Wine."
540 echo
542 dnl Local Variables:
543 dnl comment-start: "dnl "
544 dnl comment-end: ""
545 dnl comment-start-skip: "\\bdnl\\b\\s *"
546 dnl compile-command: "autoconf"
547 dnl End: