Fixes crash when running without external shell32.dll.
[wine/multimedia.git] / configure.in
blob040057fd75a20239fd45d493c5086c2706aaefa7
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="-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])
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) \$(X11OBJS)"; 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(ncurses,
47 [  --with-ncurses          compile in the ncurses terminal (EXPERIMENTAL)],
48 [if test "$withval" = "yes"; then LIBS="$LIBS -lncurses"; AC_DEFINE(WINE_NCURSES) fi])
50 AC_ARG_WITH(reentrant-x,
51 [  --without-reentrant-x   compile for use with non-reentrant X libraries])
53 AC_SUBST(MAIN_TARGET)
54 AC_SUBST(LIB_TARGET)
55 AC_SUBST(ALT_LINK)
56 AC_SUBST(OPTIONS)
58 if test "$DEBUG_MSGS" = "no"
59 then
60     AC_DEFINE(NO_DEBUG_MSGS)
61     AC_DEFINE(NO_TRACE_MSGS)
62 else
63     if test "$TRACE_MSGS" = "no"
64     then
65         AC_DEFINE(NO_TRACE_MSGS)
66     fi
69 dnl **** Check for some programs ****
71 AC_PROG_MAKE_SET
72 AC_PROG_CC
73 AC_PROG_CPP
74 AC_PATH_XTRA
75 AC_PROG_YACC
76 AC_PROG_LEX
77 AC_PROG_RANLIB
78 AC_PROG_INSTALL
79 AC_PROG_LN_S
80 AC_CHECK_PROG(C2MAN,c2man,c2man,true)
82 dnl **** Check for some libraries ****
84 dnl Check for -li386 for NetBSD and OpenBSD
85 AC_CHECK_LIB(i386,i386_set_ldt)
86 dnl Check for -lossaudio for NetBSD
87 AC_CHECK_LIB(ossaudio,_oss_ioctl)
88 dnl Check for -lw for Solaris
89 AC_CHECK_LIB(w,iswalnum)
90 dnl Check for -lnsl for Solaris
91 AC_CHECK_FUNCS(gethostbyname)
92 if test "$ac_cv_func_gethostbyname" = "no"
93 then
94     AC_CHECK_LIB(nsl,gethostbyname)
96 dnl Check for -lxpg4 for FreeBSD
97 AC_CHECK_LIB(xpg4,setrunelocale)
98 dnl Check for -ldl
99 AC_CHECK_LIB(dl,dlopen)
100 AC_SUBST(XLIB)
101 if test "$have_x" = "yes"
102 then
103     XLIB="-lXpm -lXext -lX11"
104     dnl Check for -lXpm
105     dnl FIXME: should be done once we can compile without -lXpm
106     dnl AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
107     dnl Check for X Shm extension
108     AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
109     dnl Check for XFree86 DGA extension
110     AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
111     dnl Check for XFree86 VMODE extension
112     AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11)
113 else
114     XLIB=""
115     X_CFLAGS=""
116     X_LIBS=""
119 dnl **** Check for Open Sound System ****
120 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
122 AC_CACHE_CHECK("for Open Sound System",
123         ac_cv_c_opensoundsystem,
124         AC_TRY_COMPILE([
125         #if defined(HAVE_SYS_SOUNDCARD_H)
126                 #include <sys/soundcard.h>
127         #elif defined(HAVE_MACHINE_SOUNDCARD_H)
128                 #include <machine/soundcard.h>
129         #elif defined(HAVE_SOUNDCARD_H)
130                 #include <soundcard.h>
131         #endif
132         ],[
134 /* check for one of the Open Sound System specific SNDCTL_ defines */
135 #if !defined(SNDCTL_DSP_STEREO)
136 #error No open sound system
137 #endif
138 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
140 if test "$ac_cv_c_opensoundsystem" = "yes"
141 then
142     AC_DEFINE(HAVE_OSS)
145 dnl **** Check for union semun ****
147 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
148  AC_TRY_COMPILE([#include <sys/types.h>
149 #include <sys/sem.h>],[union semun foo],
150                 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
151 if test "$ac_cv_c_union_semun" = "yes"
152 then
153     AC_DEFINE(HAVE_UNION_SEMUN)
156 dnl **** If ln -s doesn't work, use cp instead ****
157 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
159 dnl **** Check for gcc strength-reduce bug ****
161 if test "x${GCC}" = "xyes"
162 then
163   CFLAGS="$CFLAGS -Wall"
164   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
165                   AC_TRY_RUN([
166 int main(void) {
167   static int Array[[3]];
168   unsigned int B = 3;
169   int i;
170   for(i=0; i<B; i++) Array[[i]] = i - 3;
171   exit( Array[[1]] != -2 );
173     ac_cv_c_gcc_strength_bug="no",
174     ac_cv_c_gcc_strength_bug="yes",
175     ac_cv_c_gcc_strength_bug="yes") )
176   if test "$ac_cv_c_gcc_strength_bug" = "yes"
177   then
178     CFLAGS="$CFLAGS -fno-strength-reduce"
179   fi
182 dnl **** Check for underscore on external symbols ****
184 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
185                ac_cv_c_extern_prefix,
186 [saved_libs=$LIBS
187 LIBS="conftest_asm.s $LIBS"
188 cat > conftest_asm.s <<EOF
189         .globl _ac_test
190 _ac_test:
191         .long 0
193 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
194             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
195 LIBS=$saved_libs])
196 if test "$ac_cv_c_extern_prefix" = "yes"
197 then
198   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
201 dnl **** Check for .string in assembler ****
203 AC_CACHE_CHECK("whether assembler accepts .string",
204                ac_cv_c_asm_string,
205 [saved_libs=$LIBS
206 LIBS="conftest_asm.s $LIBS"
207 cat > conftest_asm.s <<EOF
208         .string "test"
210 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
211 LIBS=$saved_libs])
212 if test "$ac_cv_c_asm_string" = "yes"
213 then
214   AC_DEFINE(HAVE_ASM_STRING)
217 dnl **** Check for working dll ****
219 DLLFLAGS=""
220 LDSHARED=""
221 if test "$LIB_TARGET" = "libwine.so.1.0"
222 then
223   AC_CACHE_CHECK("whether we can build a Linux dll",
224                  ac_cv_c_dll_linux,
225   [saved_cflags=$CFLAGS
226   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
227   AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
228   CFLAGS=$saved_cflags
229   ])
230   if test "$ac_cv_c_dll_linux" = "yes"
231   then
232     DLLFLAGS="-fPIC"
233     LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so"
234   else
235     AC_CACHE_CHECK("whether we can build a NetBSD dll",
236                    ac_cv_c_dll_netbsd,
237     [saved_cflags=$CFLAGS
238     CFLAGS="$CFLAGS -fPIC -Bshareable -Bforcearchive"
239     AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
240     CFLAGS=$saved_cflags
241     ])
242     if test "$ac_cv_c_dll_netbsd" = "yes"
243     then
244       DLLFLAGS="-fPIC"
245       LDSHARED="ld -Bshareable -Bforcearchive"
246     fi
247   fi
248   if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
249   then
250     LIB_TARGET="libwine.a"
251   fi
253 AC_SUBST(DLLFLAGS)
254 AC_SUBST(LDSHARED)
256 dnl **** Check for reentrant libc ****
258 dnl For cross-compiling we blindly assume that libc is reentrant. This is
259 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
261 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
262   [AC_TRY_RUN([int myerrno = 0;
263 char buf[256];
264 int *__errno_location(){return &myerrno;}
265 main(){connect(0,buf,255); exit(!myerrno);}],
266   wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
267   wine_cv_libc_reentrant=yes ) ] )
268 if test "$wine_cv_libc_reentrant" = "no" 
269 then
270   AC_DEFINE(NO_REENTRANT_LIBC)
273 dnl **** Check for reentrant X libraries ****
275 dnl This may fail to determine whether X libraries are reentrant if
276 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
277 dnl is possible with the --without-reentrant-x option.
279 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
280   [ if test "x$with_reentrant_x" = "xno"
281     then
282         wine_cv_x_reentrant=no
283     else
284         libX11_ckeck=none
285         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
286             if test -r $dir/libX11.so; then
287                 libX11_check="-D $dir/libX11.so"
288                 break 1
289             fi
290             if test -r $dir/libX11.a; then
291                 libX11_check="$dir/libX11.a"
292                 break 1
293             fi
294         done
295         if test "$libX11_check" != "none"; then
296             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
297             then
298                 wine_cv_x_reentrant=yes
299             else
300                 wine_cv_x_reentrant=no
301             fi
302         else
303             wine_cv_x_reentrant=unknown
304         fi
305     fi ] )
306 if test "$wine_cv_x_reentrant" = "no"
307 then
308   AC_DEFINE(NO_REENTRANT_X11)
311 dnl **** Check for functions and header files ****
313 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
314 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 linux/ipx.h)
315 AC_HEADER_STAT()
316 AC_C_CONST()
317 AC_TYPE_SIZE_T()
318 AC_CHECK_SIZEOF(long long,0)
320 dnl **** Check for sendmsg in -lsocket if not found above ****
322 if test $ac_cv_func_sendmsg = no; then
323     AC_CHECK_LIB(socket,sendmsg)
326 dnl **** statfs checks ****
328 if test "$ac_cv_header_sys_vfs_h" = "yes"
329 then
330     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
331                     wine_cv_sys_vfs_has_statfs,
332         AC_TRY_COMPILE([
333         #include <sys/types.h>
334         #ifdef HAVE_SYS_PARAM_H
335         # include <sys/param.h>
336         #endif
337         #include <sys/vfs.h>
338         ],[
339                 struct statfs stfs;
341                 memset(&stfs,0,sizeof(stfs));
342         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
343         )
344     )
345     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
346     then
347       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
348     fi
351 if test "$ac_cv_header_sys_statfs_h" = "yes"
352 then
353     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
354                     wine_cv_sys_statfs_has_statfs,
355         AC_TRY_COMPILE([
356         #include <sys/types.h>
357         #ifdef HAVE_SYS_PARAM_H
358         # include <sys/param.h>
359         #endif
360         #include <sys/statfs.h>
361         ],[
362                 struct statfs stfs;
363         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
364         )
365     )
366     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
367     then
368       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
369     fi
372 if test "$ac_cv_header_sys_mount_h" = "yes"
373 then
374     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
375                     wine_cv_sys_mount_has_statfs,
376         AC_TRY_COMPILE([
377         #include <sys/types.h>
378         #ifdef HAVE_SYS_PARAM_H
379         # include <sys/param.h>
380         #endif
381         #include <sys/mount.h>
382         ],[
383                 struct statfs stfs;
384         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
385         )
386     )
387     if test "$wine_cv_sys_mount_has_statfs" = "yes"
388     then
389       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
390     fi
393 dnl **** FIXME: what about mixed cases, where we need two of them? ***
395 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
396   [ if test "x$statfs_bfree" = "xno"
397     then
398         wine_cv_statfs_bfree=no
399     else
400         AC_TRY_COMPILE([
401         #include <sys/types.h>
402         #ifdef HAVE_SYS_PARAM_H
403         # include <sys/param.h>
404         #endif
405         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
406         # include <sys/mount.h>
407         #else
408         # ifdef STATFS_DEFINED_BY_SYS_VFS
409         #  include <sys/vfs.h>
410         # else
411         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
412         #   include <sys/statfs.h>
413         #  endif
414         # endif
415         #endif
416         ],[
417                 struct statfs stfs;
419                 stfs.f_bfree++;
420         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
421         )
422     fi ] )
423 if test "$wine_cv_statfs_bfree" = "yes"
424 then
425   AC_DEFINE(STATFS_HAS_BFREE)
428 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
429   [ if test "x$statfs_bavail" = "xno"
430     then
431         wine_cv_statfs_bavail=no
432     else
433         AC_TRY_COMPILE([
434         #include <sys/types.h>
435         #ifdef HAVE_SYS_PARAM_H
436         # include <sys/param.h>
437         #endif
438         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
439         # include <sys/mount.h>
440         #else
441         # ifdef STATFS_DEFINED_BY_SYS_VFS
442         #  include <sys/vfs.h>
443         # else
444         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
445         #   include <sys/statfs.h>
446         #  endif
447         # endif
448         #endif
449         ],[
450                 struct statfs stfs;
452                 stfs.f_bavail++;
453         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
454         )
455     fi ] )
456 if test "$wine_cv_statfs_bavail" = "yes"
457 then
458   AC_DEFINE(STATFS_HAS_BAVAIL)
461 dnl *** check for working sigaltstack
462 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
464 AC_CACHE_CHECK("for working sigaltstack",
465         ac_cv_c_working_sigaltstack,
466         AC_TRY_RUN([
467         #include <stdio.h>
468         #include <time.h> /* <sys/time.h> ? bad magic without end */
469         #include <sys/types.h>
470         #include <sys/signal.h>
471         #ifdef HAVE_SYS_PARAM_H
472         # include <sys/param.h>
473         #endif
474         #ifdef HAVE_SYSCALL_H
475         # include <syscall.h>
476         #else
477         # ifdef HAVE_SYS_SYSCALL_H
478         #  include <sys/syscall.h>
479         # endif
480         #endif
481         
482         unsigned char *xaltstack;
484         int
485         main(int argc,char **argv) {
486             struct sigaltstack  ss;
488             xaltstack = malloc(16384);
489             ss.ss_sp    = xaltstack;
490             ss.ss_size  = 16384;
491             ss.ss_flags = 0;
492             if (sigaltstack(&ss, NULL) < 0) {
493                 /* this catches the glibc case */
494                 perror("sigaltstack");
495                 return (1); /* aka exit(1) aka fail */
496             }
497             /* assume it works. */
498             return 0; /* OK */
499         }
500         ],
501         ac_cv_c_working_sigaltstack="yes",
502         ac_cv_c_working_sigaltstack="no",
503         ac_cv_c_working_sigaltstack="no"
506 if test "$ac_cv_c_working_sigaltstack" = "yes"
507 then
508     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
512 dnl *** check for file descriptor passing with msg_accrights
514 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
515  AC_TRY_COMPILE([#include <sys/types.h>
516 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
517                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
518 if test "$ac_cv_c_msg_accrights" = "yes"
519 then
520     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
523 dnl **** Generate output files ****
525 MAKE_RULES=Make.rules
526 AC_SUBST_FILE(MAKE_RULES)
528 AC_OUTPUT([
529 Make.rules
530 Makefile
531 console/Makefile
532 controls/Makefile
533 debugger/Makefile
534 dlls/Makefile
535 dlls/comctl32/Makefile
536 dlls/imagehlp/Makefile
537 dlls/msacm/Makefile
538 dlls/msacm32/Makefile
539 dlls/ntdll/Makefile
540 dlls/psapi/Makefile
541 dlls/rasapi32/Makefile
542 dlls/shell32/Makefile
543 dlls/winaspi/Makefile
544 dlls/wnaspi32/Makefile
545 documentation/Makefile
546 files/Makefile
547 graphics/Makefile
548 graphics/metafiledrv/Makefile
549 graphics/psdrv/Makefile
550 graphics/win16drv/Makefile
551 graphics/x11drv/Makefile
552 if1632/Makefile
553 ipc/Makefile
554 library/Makefile
555 libtest/Makefile
556 loader/Makefile
557 loader/ne/Makefile
558 loader/dos/Makefile
559 memory/Makefile
560 misc/Makefile
561 miscemu/Makefile
562 msdos/Makefile
563 multimedia/Makefile
564 objects/Makefile
565 ole/Makefile
566 programs/Makefile
567 programs/clock/Makefile
568 programs/control/Makefile
569 programs/notepad/Makefile
570 programs/progman/Makefile
571 programs/regtest/Makefile
572 programs/view/Makefile
573 programs/winhelp/Makefile
574 programs/winver/Makefile
575 rc/Makefile
576 relay32/Makefile
577 resources/Makefile
578 scheduler/Makefile
579 server/Makefile
580 tools/Makefile
581 tools/wrc/Makefile
582 tsx11/Makefile
583 win32/Makefile
584 windows/Makefile
585 windows/ttydrv/Makefile
586 windows/x11drv/Makefile ])
588 if test "$wine_cv_libc_reentrant" = "no" 
589 then
590   echo
591   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
592   echo "*** thread support. Consider upgrading libc to a more recent"
593   echo "*** reentrant version of libc."
594   echo
597 echo
598 echo "Configure finished.  Do 'make depend; make' to compile Wine."
599 echo
601 dnl Local Variables:
602 dnl comment-start: "dnl "
603 dnl comment-end: ""
604 dnl comment-start-skip: "\\bdnl\\b\\s *"
605 dnl compile-command: "autoconf"
606 dnl End: