Small changes (uses HIWORD/LOWORD).
[wine/multimedia.git] / configure.in
blob0d354b32a3a937c65010215e2ff4a0e18dc5072e
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 ALT_LINK=" "
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])
26 AC_ARG_ENABLE(dll,
27 [  --enable-dll            build the Wine library as a DLL],
28 [if test "$enableval" = "no"; then : ; else LIB_TARGET="libwine.so.1.0"; fi])
30 AC_ARG_ENABLE(lib,
31 [  --disable-lib           build the Wine without building libwine.a],
32 [if test "$enableval" = "no"; then ALT_LINK="\$(LIBOBJS)"; LIB_TARGET=""; fi])
34 dnl AC_ARG_WITH(ipc,
35 dnl [  --enable-ipc            use inter-process communication for DDE],
36 dnl [if test "$enableval" = "no"; then : ; else OPTIONS="-DCONFIG_IPC"; fi])
38 AC_ARG_ENABLE(debug,
39 [  --disable-debug         compile out all debugging messages],
40 [if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
42 AC_ARG_ENABLE(trace,
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])
49 AC_SUBST(MAIN_TARGET)
50 AC_SUBST(LIB_TARGET)
51 AC_SUBST(ALT_LINK)
52 AC_SUBST(OPTIONS)
54 if test "$DEBUG_MSGS" = "no"
55 then
56     AC_DEFINE(NO_DEBUG_MSGS)
57     AC_DEFINE(NO_TRACE_MSGS)
58 else
59     if test "$TRACE_MSGS" = "no"
60     then
61         AC_DEFINE(NO_TRACE_MSGS)
62     fi
65 dnl **** Check for some programs ****
67 AC_PROG_MAKE_SET
68 AC_PROG_CC
69 AC_PROG_CPP
70 AC_PATH_XTRA
71 AC_PROG_YACC
72 AC_PROG_LEX
73 AC_PROG_RANLIB
74 AC_PROG_INSTALL
75 AC_PROG_LN_S
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 -lxpg4 for FreeBSD
85 AC_CHECK_LIB(xpg4,setrunelocale)
86 dnl Check for -ldl
87 AC_CHECK_LIB(dl,dlopen)
88 dnl Check for XFree86 DGA extension
89 AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
91 dnl **** Check for Open Sound System ****
92 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
94 AC_CACHE_CHECK("for Open Sound System",
95         ac_cv_c_opensoundsystem,
96         AC_TRY_COMPILE([
97         #ifdef HAVE_SYS_SOUNDCARD_H
98                 #include <sys/soundcard.h>
99         #endif
100         #ifdef HAVE_MACHINE_SOUNDCARD_H
101                 #include <machine/soundcard.h>
102         #endif
103         ],[
105 /* check for one of the Open Sound System specific SNDCTL_ defines */
106 #if !defined(SNDCTL_DSP_STEREO)
107 #error No open sound system
108 #endif
109 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
111 if test "$ac_cv_c_opensoundsystem" = "yes"
112 then
113     AC_DEFINE(HAVE_OSS)
116 dnl **** Check for union semun ****
118 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
119  AC_TRY_COMPILE([#include <sys/types.h>
120 #include <sys/sem.h>],[union semun foo],
121                 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
122 if test "$ac_cv_c_union_semun" = "yes"
123 then
124     AC_DEFINE(HAVE_UNION_SEMUN)
127 dnl **** If ln -s doesn't work, use cp instead ****
128 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
130 dnl **** Check for gcc strength-reduce bug ****
132 if test "x${GCC}" = "xyes"
133 then
134   CFLAGS="$CFLAGS -Wall"
135   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
136                   AC_TRY_RUN([
137 int main(void) {
138   static int Array[[3]];
139   unsigned int B = 3;
140   int i;
141   for(i=0; i<B; i++) Array[[i]] = i - 3;
142   exit( Array[[1]] != -2 );
144     ac_cv_c_gcc_strength_bug="no",
145     ac_cv_c_gcc_strength_bug="yes",
146     ac_cv_c_gcc_strength_bug="yes") )
147   if test "$ac_cv_c_gcc_strength_bug" = "yes"
148   then
149     CFLAGS="$CFLAGS -fno-strength-reduce"
150   fi
153 dnl **** Check for underscore on external symbols ****
155 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
156                ac_cv_c_extern_prefix,
157 [saved_libs=$LIBS
158 LIBS="conftest_asm.s $LIBS"
159 cat > conftest_asm.s <<EOF
160         .globl _ac_test
161 _ac_test:
162         .long 0
164 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
165             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
166 LIBS=$saved_libs])
167 if test "$ac_cv_c_extern_prefix" = "yes"
168 then
169   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
172 dnl **** Check for .string in assembler ****
174 AC_CACHE_CHECK("whether assembler accepts .string",
175                ac_cv_c_asm_string,
176 [saved_libs=$LIBS
177 LIBS="conftest_asm.s $LIBS"
178 cat > conftest_asm.s <<EOF
179         .string "test"
181 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
182 LIBS=$saved_libs])
183 if test "$ac_cv_c_asm_string" = "yes"
184 then
185   AC_DEFINE(HAVE_ASM_STRING)
188 dnl **** Check for working dll ****
190 DLLFLAGS=""
191 if test "$LIB_TARGET" = "libwine.so.1.0"
192 then
193   AC_CACHE_CHECK("whether we can build a dll",
194                  ac_cv_c_dll,
195   [saved_cflags=$CFLAGS
196   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
197   AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
198   CFLAGS=$saved_cflags
199   ])
200   if test "$ac_cv_c_dll" = "yes"
201   then
202     DLLFLAGS="-fPIC"
203   else
204     LIB_TARGET="libwine.a"
205   fi
207 AC_SUBST(DLLFLAGS)
209 dnl **** Check for reentrant libc ****
211 dnl For cross-compiling we blindly assume that libc is reentrant. This is
212 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
214 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
215   [AC_TRY_RUN([int myerrno = 0;
216 char buf[256];
217 int *__errno_location(){return &myerrno;}
218 main(){connect(0,buf,255); exit(!myerrno);}],
219   wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
220   wine_cv_libc_reentrant=yes ) ] )
221 if test "$wine_cv_libc_reentrant" = "no" 
222 then
223   AC_DEFINE(NO_REENTRANT_LIBC)
226 dnl **** Check for reentrant X libraries ****
228 dnl This may fail to determine whether X libraries are reentrant if
229 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
230 dnl is possible with the --without-reentrant-x option.
232 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
233   [ if test "x$with_reentrant_x" = "xno"
234     then
235         wine_cv_x_reentrant=no
236     else
237         libX11_ckeck=none
238         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
239             if test -r $dir/libX11.so; then
240                 libX11_check="-D $dir/libX11.so"
241                 break 1
242             fi
243             if test -r $dir/libX11.a; then
244                 libX11_check="$dir/libX11.a"
245                 break 1
246             fi
247         done
248         if test "$libX11_check" != "none"; then
249             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
250             then
251                 wine_cv_x_reentrant=yes
252             else
253                 wine_cv_x_reentrant=no
254             fi
255         else
256             wine_cv_x_reentrant=unknown
257         fi
258     fi ] )
259 if test "$wine_cv_x_reentrant" = "no"
260 then
261   AC_DEFINE(NO_REENTRANT_X11)
264 dnl **** Check for functions and header files ****
266 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
267 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)
268 AC_HEADER_STAT()
269 AC_C_CONST()
270 AC_TYPE_SIZE_T()
271 AC_CHECK_SIZEOF(long long,0)
273 dnl **** Check for sendmsg in -lsocket if not found above ****
275 if test $ac_cv_func_sendmsg = no; then
276     AC_CHECK_LIB(socket,sendmsg)
279 dnl **** statfs checks ****
281 if test "$ac_cv_header_sys_vfs_h" = "yes"
282 then
283     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
284                     wine_cv_sys_vfs_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/vfs.h>
291         ],[
292                 struct statfs stfs;
294                 memset(&stfs,0,sizeof(stfs));
295         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
296         )
297     )
298     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
299     then
300       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
301     fi
304 if test "$ac_cv_header_sys_statfs_h" = "yes"
305 then
306     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
307                     wine_cv_sys_statfs_has_statfs,
308         AC_TRY_COMPILE([
309         #include <sys/types.h>
310         #ifdef HAVE_SYS_PARAM_H
311         # include <sys/param.h>
312         #endif
313         #include <sys/statfs.h>
314         ],[
315                 struct statfs stfs;
316         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
317         )
318     )
319     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
320     then
321       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
322     fi
325 if test "$ac_cv_header_sys_mount_h" = "yes"
326 then
327     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
328                     wine_cv_sys_mount_has_statfs,
329         AC_TRY_COMPILE([
330         #include <sys/types.h>
331         #ifdef HAVE_SYS_PARAM_H
332         # include <sys/param.h>
333         #endif
334         #include <sys/mount.h>
335         ],[
336                 struct statfs stfs;
337         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
338         )
339     )
340     if test "$wine_cv_sys_mount_has_statfs" = "yes"
341     then
342       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
343     fi
346 dnl **** FIXME: what about mixed cases, where we need two of them? ***
348 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
349   [ if test "x$statfs_bfree" = "xno"
350     then
351         wine_cv_statfs_bfree=no
352     else
353         AC_TRY_COMPILE([
354         #include <sys/types.h>
355         #ifdef HAVE_SYS_PARAM_H
356         # include <sys/param.h>
357         #endif
358         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
359         # include <sys/mount.h>
360         #else
361         # ifdef STATFS_DEFINED_BY_SYS_VFS
362         #  include <sys/vfs.h>
363         # else
364         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
365         #   include <sys/statfs.h>
366         #  endif
367         # endif
368         #endif
369         ],[
370                 struct statfs stfs;
372                 stfs.f_bfree++;
373         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
374         )
375     fi ] )
376 if test "$wine_cv_statfs_bfree" = "yes"
377 then
378   AC_DEFINE(STATFS_HAS_BFREE)
381 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
382   [ if test "x$statfs_bavail" = "xno"
383     then
384         wine_cv_statfs_bavail=no
385     else
386         AC_TRY_COMPILE([
387         #include <sys/types.h>
388         #ifdef HAVE_SYS_PARAM_H
389         # include <sys/param.h>
390         #endif
391         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
392         # include <sys/mount.h>
393         #else
394         # ifdef STATFS_DEFINED_BY_SYS_VFS
395         #  include <sys/vfs.h>
396         # else
397         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
398         #   include <sys/statfs.h>
399         #  endif
400         # endif
401         #endif
402         ],[
403                 struct statfs stfs;
405                 stfs.f_bavail++;
406         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
407         )
408     fi ] )
409 if test "$wine_cv_statfs_bavail" = "yes"
410 then
411   AC_DEFINE(STATFS_HAS_BAVAIL)
414 dnl *** check for working sigaltstack
415 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
417 AC_CACHE_CHECK("for working sigaltstack",
418         ac_cv_c_working_sigaltstack,
419         AC_TRY_RUN([
420         #include <stdio.h>
421         #include <time.h> /* <sys/time.h> ? bad magic without end */
422         #include <sys/types.h>
423         #include <sys/signal.h>
424         #ifdef HAVE_SYS_PARAM_H
425         # include <sys/param.h>
426         #endif
427         #ifdef HAVE_SYSCALL_H
428         # include <syscall.h>
429         #else
430         # ifdef HAVE_SYS_SYSCALL_H
431         #  include <sys/syscall.h>
432         # endif
433         #endif
434         
435         unsigned char *xaltstack;
437         int
438         main(int argc,char **argv) {
439             struct sigaltstack  ss;
441             xaltstack = malloc(16384);
442             ss.ss_sp    = xaltstack;
443             ss.ss_size  = 16384;
444             ss.ss_flags = 0;
445             if (sigaltstack(&ss, NULL) < 0) {
446                 /* this catches the glibc case */
447                 perror("sigaltstack");
448                 return (1); /* aka exit(1) aka fail */
449             }
450             /* assume it works. */
451             return 0; /* OK */
452         }
453         ],
454         ac_cv_c_working_sigaltstack="yes",
455         ac_cv_c_working_sigaltstack="no",
456         ac_cv_c_working_sigaltstack="no"
459 if test "$ac_cv_c_working_sigaltstack" = "yes"
460 then
461     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
465 dnl *** check for file descriptor passing with msg_accrights
467 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
468  AC_TRY_COMPILE([#include <sys/types.h>
469 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
470                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
471 if test "$ac_cv_c_msg_accrights" = "yes"
472 then
473     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
476 dnl **** Generate output files ****
478 MAKE_RULES=Make.rules
479 AC_SUBST_FILE(MAKE_RULES)
481 AC_OUTPUT([
482 Make.rules
483 Makefile
484 controls/Makefile
485 debugger/Makefile
486 dlls/Makefile
487 dlls/comctl32/Makefile
488 dlls/psapi/Makefile
489 dlls/shell32/Makefile
490 dlls/winaspi/Makefile
491 dlls/wnaspi32/Makefile
492 documentation/Makefile
493 files/Makefile
494 graphics/Makefile
495 graphics/metafiledrv/Makefile
496 graphics/psdrv/Makefile
497 graphics/win16drv/Makefile
498 graphics/x11drv/Makefile
499 if1632/Makefile
500 ipc/Makefile
501 library/Makefile
502 libtest/Makefile
503 loader/Makefile
504 loader/ne/Makefile
505 loader/dos/Makefile
506 memory/Makefile
507 misc/Makefile
508 miscemu/Makefile
509 msdos/Makefile
510 multimedia/Makefile
511 objects/Makefile
512 ole/Makefile
513 programs/Makefile
514 programs/clock/Makefile
515 programs/control/Makefile
516 programs/notepad/Makefile
517 programs/progman/Makefile
518 programs/regtest/Makefile
519 programs/view/Makefile
520 programs/winhelp/Makefile
521 programs/winver/Makefile
522 rc/Makefile
523 relay32/Makefile
524 resources/Makefile
525 scheduler/Makefile
526 server/Makefile
527 tools/Makefile
528 tools/wrc/Makefile
529 tsx11/Makefile
530 win32/Makefile
531 windows/Makefile ])
533 if test "$wine_cv_libc_reentrant" = "no" 
534 then
535   echo
536   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
537   echo "*** thread support. Consider upgrading libc to a more recent"
538   echo "*** reentrant version of libc."
539   echo
542 echo
543 echo "Configure finished.  Do 'make depend; make' to compile Wine."
544 echo
546 dnl Local Variables:
547 dnl comment-start: "dnl "
548 dnl comment-end: ""
549 dnl comment-start-skip: "\\bdnl\\b\\s *"
550 dnl compile-command: "autoconf"
551 dnl End: