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