Call the new console driver for some routines. This is not completely
[wine.git] / configure.in
blobcbe608fdc663a109c7bb0f0e9adbfcb9de997f67
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],
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 else
110     XLIB=""
111     X_CFLAGS=""
112     X_LIBS=""
115 dnl **** Check for Open Sound System ****
116 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
118 AC_CACHE_CHECK("for Open Sound System",
119         ac_cv_c_opensoundsystem,
120         AC_TRY_COMPILE([
121         #ifdef HAVE_SYS_SOUNDCARD_H
122                 #include <sys/soundcard.h>
123         #endif
124         #ifdef HAVE_MACHINE_SOUNDCARD_H
125                 #include <machine/soundcard.h>
126         #endif
127         ],[
129 /* check for one of the Open Sound System specific SNDCTL_ defines */
130 #if !defined(SNDCTL_DSP_STEREO)
131 #error No open sound system
132 #endif
133 ],ac_cv_c_opensoundsystem="yes",ac_cv_c_opensoundsystem="no"))
135 if test "$ac_cv_c_opensoundsystem" = "yes"
136 then
137     AC_DEFINE(HAVE_OSS)
140 dnl **** Check for union semun ****
142 AC_CACHE_CHECK("for union semun", ac_cv_c_union_semun,
143  AC_TRY_COMPILE([#include <sys/types.h>
144 #include <sys/sem.h>],[union semun foo],
145                 ac_cv_c_union_semun="yes", ac_cv_c_union_semun="no"))
146 if test "$ac_cv_c_union_semun" = "yes"
147 then
148     AC_DEFINE(HAVE_UNION_SEMUN)
151 dnl **** If ln -s doesn't work, use cp instead ****
152 if test "$ac_cv_prog_LN_S" = "ln -s"; then : ; else LN_S=cp ; fi
154 dnl **** Check for gcc strength-reduce bug ****
156 if test "x${GCC}" = "xyes"
157 then
158   CFLAGS="$CFLAGS -Wall"
159   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
160                   AC_TRY_RUN([
161 int main(void) {
162   static int Array[[3]];
163   unsigned int B = 3;
164   int i;
165   for(i=0; i<B; i++) Array[[i]] = i - 3;
166   exit( Array[[1]] != -2 );
168     ac_cv_c_gcc_strength_bug="no",
169     ac_cv_c_gcc_strength_bug="yes",
170     ac_cv_c_gcc_strength_bug="yes") )
171   if test "$ac_cv_c_gcc_strength_bug" = "yes"
172   then
173     CFLAGS="$CFLAGS -fno-strength-reduce"
174   fi
177 dnl **** Check for underscore on external symbols ****
179 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
180                ac_cv_c_extern_prefix,
181 [saved_libs=$LIBS
182 LIBS="conftest_asm.s $LIBS"
183 cat > conftest_asm.s <<EOF
184         .globl _ac_test
185 _ac_test:
186         .long 0
188 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
189             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
190 LIBS=$saved_libs])
191 if test "$ac_cv_c_extern_prefix" = "yes"
192 then
193   AC_DEFINE(NEED_UNDERSCORE_PREFIX)
196 dnl **** Check for .string in assembler ****
198 AC_CACHE_CHECK("whether assembler accepts .string",
199                ac_cv_c_asm_string,
200 [saved_libs=$LIBS
201 LIBS="conftest_asm.s $LIBS"
202 cat > conftest_asm.s <<EOF
203         .string "test"
205 AC_TRY_LINK(,,ac_cv_c_asm_string="yes",ac_cv_c_asm_string="no")
206 LIBS=$saved_libs])
207 if test "$ac_cv_c_asm_string" = "yes"
208 then
209   AC_DEFINE(HAVE_ASM_STRING)
212 dnl **** Check for working dll ****
214 DLLFLAGS=""
215 if test "$LIB_TARGET" = "libwine.so.1.0"
216 then
217   AC_CACHE_CHECK("whether we can build a dll",
218                  ac_cv_c_dll,
219   [saved_cflags=$CFLAGS
220   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
221   AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
222   CFLAGS=$saved_cflags
223   ])
224   if test "$ac_cv_c_dll" = "yes"
225   then
226     DLLFLAGS="-fPIC"
227   else
228     LIB_TARGET="libwine.a"
229   fi
231 AC_SUBST(DLLFLAGS)
233 dnl **** Check for reentrant libc ****
235 dnl For cross-compiling we blindly assume that libc is reentrant. This is
236 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
238 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
239   [AC_TRY_RUN([int myerrno = 0;
240 char buf[256];
241 int *__errno_location(){return &myerrno;}
242 main(){connect(0,buf,255); exit(!myerrno);}],
243   wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
244   wine_cv_libc_reentrant=yes ) ] )
245 if test "$wine_cv_libc_reentrant" = "no" 
246 then
247   AC_DEFINE(NO_REENTRANT_LIBC)
250 dnl **** Check for reentrant X libraries ****
252 dnl This may fail to determine whether X libraries are reentrant if
253 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
254 dnl is possible with the --without-reentrant-x option.
256 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
257   [ if test "x$with_reentrant_x" = "xno"
258     then
259         wine_cv_x_reentrant=no
260     else
261         libX11_ckeck=none
262         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
263             if test -r $dir/libX11.so; then
264                 libX11_check="-D $dir/libX11.so"
265                 break 1
266             fi
267             if test -r $dir/libX11.a; then
268                 libX11_check="$dir/libX11.a"
269                 break 1
270             fi
271         done
272         if test "$libX11_check" != "none"; then
273             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
274             then
275                 wine_cv_x_reentrant=yes
276             else
277                 wine_cv_x_reentrant=no
278             fi
279         else
280             wine_cv_x_reentrant=unknown
281         fi
282     fi ] )
283 if test "$wine_cv_x_reentrant" = "no"
284 then
285   AC_DEFINE(NO_REENTRANT_X11)
288 dnl **** Check for functions and header files ****
290 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
291 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)
292 AC_HEADER_STAT()
293 AC_C_CONST()
294 AC_TYPE_SIZE_T()
295 AC_CHECK_SIZEOF(long long,0)
297 dnl **** Check for sendmsg in -lsocket if not found above ****
299 if test $ac_cv_func_sendmsg = no; then
300     AC_CHECK_LIB(socket,sendmsg)
303 dnl **** statfs checks ****
305 if test "$ac_cv_header_sys_vfs_h" = "yes"
306 then
307     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
308                     wine_cv_sys_vfs_has_statfs,
309         AC_TRY_COMPILE([
310         #include <sys/types.h>
311         #ifdef HAVE_SYS_PARAM_H
312         # include <sys/param.h>
313         #endif
314         #include <sys/vfs.h>
315         ],[
316                 struct statfs stfs;
318                 memset(&stfs,0,sizeof(stfs));
319         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
320         )
321     )
322     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
323     then
324       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
325     fi
328 if test "$ac_cv_header_sys_statfs_h" = "yes"
329 then
330     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
331                     wine_cv_sys_statfs_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/statfs.h>
338         ],[
339                 struct statfs stfs;
340         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
341         )
342     )
343     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
344     then
345       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
346     fi
349 if test "$ac_cv_header_sys_mount_h" = "yes"
350 then
351     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
352                     wine_cv_sys_mount_has_statfs,
353         AC_TRY_COMPILE([
354         #include <sys/types.h>
355         #ifdef HAVE_SYS_PARAM_H
356         # include <sys/param.h>
357         #endif
358         #include <sys/mount.h>
359         ],[
360                 struct statfs stfs;
361         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
362         )
363     )
364     if test "$wine_cv_sys_mount_has_statfs" = "yes"
365     then
366       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
367     fi
370 dnl **** FIXME: what about mixed cases, where we need two of them? ***
372 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
373   [ if test "x$statfs_bfree" = "xno"
374     then
375         wine_cv_statfs_bfree=no
376     else
377         AC_TRY_COMPILE([
378         #include <sys/types.h>
379         #ifdef HAVE_SYS_PARAM_H
380         # include <sys/param.h>
381         #endif
382         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
383         # include <sys/mount.h>
384         #else
385         # ifdef STATFS_DEFINED_BY_SYS_VFS
386         #  include <sys/vfs.h>
387         # else
388         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
389         #   include <sys/statfs.h>
390         #  endif
391         # endif
392         #endif
393         ],[
394                 struct statfs stfs;
396                 stfs.f_bfree++;
397         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
398         )
399     fi ] )
400 if test "$wine_cv_statfs_bfree" = "yes"
401 then
402   AC_DEFINE(STATFS_HAS_BFREE)
405 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
406   [ if test "x$statfs_bavail" = "xno"
407     then
408         wine_cv_statfs_bavail=no
409     else
410         AC_TRY_COMPILE([
411         #include <sys/types.h>
412         #ifdef HAVE_SYS_PARAM_H
413         # include <sys/param.h>
414         #endif
415         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
416         # include <sys/mount.h>
417         #else
418         # ifdef STATFS_DEFINED_BY_SYS_VFS
419         #  include <sys/vfs.h>
420         # else
421         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
422         #   include <sys/statfs.h>
423         #  endif
424         # endif
425         #endif
426         ],[
427                 struct statfs stfs;
429                 stfs.f_bavail++;
430         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
431         )
432     fi ] )
433 if test "$wine_cv_statfs_bavail" = "yes"
434 then
435   AC_DEFINE(STATFS_HAS_BAVAIL)
438 dnl *** check for working sigaltstack
439 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
441 AC_CACHE_CHECK("for working sigaltstack",
442         ac_cv_c_working_sigaltstack,
443         AC_TRY_RUN([
444         #include <stdio.h>
445         #include <time.h> /* <sys/time.h> ? bad magic without end */
446         #include <sys/types.h>
447         #include <sys/signal.h>
448         #ifdef HAVE_SYS_PARAM_H
449         # include <sys/param.h>
450         #endif
451         #ifdef HAVE_SYSCALL_H
452         # include <syscall.h>
453         #else
454         # ifdef HAVE_SYS_SYSCALL_H
455         #  include <sys/syscall.h>
456         # endif
457         #endif
458         
459         unsigned char *xaltstack;
461         int
462         main(int argc,char **argv) {
463             struct sigaltstack  ss;
465             xaltstack = malloc(16384);
466             ss.ss_sp    = xaltstack;
467             ss.ss_size  = 16384;
468             ss.ss_flags = 0;
469             if (sigaltstack(&ss, NULL) < 0) {
470                 /* this catches the glibc case */
471                 perror("sigaltstack");
472                 return (1); /* aka exit(1) aka fail */
473             }
474             /* assume it works. */
475             return 0; /* OK */
476         }
477         ],
478         ac_cv_c_working_sigaltstack="yes",
479         ac_cv_c_working_sigaltstack="no",
480         ac_cv_c_working_sigaltstack="no"
483 if test "$ac_cv_c_working_sigaltstack" = "yes"
484 then
485     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
489 dnl *** check for file descriptor passing with msg_accrights
491 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
492  AC_TRY_COMPILE([#include <sys/types.h>
493 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
494                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
495 if test "$ac_cv_c_msg_accrights" = "yes"
496 then
497     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
500 dnl **** Generate output files ****
502 MAKE_RULES=Make.rules
503 AC_SUBST_FILE(MAKE_RULES)
505 AC_OUTPUT([
506 Make.rules
507 Makefile
508 console/Makefile
509 controls/Makefile
510 debugger/Makefile
511 dlls/Makefile
512 dlls/comctl32/Makefile
513 dlls/imagehlp/Makefile
514 dlls/msacm/Makefile
515 dlls/msacm32/Makefile
516 dlls/ntdll/Makefile
517 dlls/psapi/Makefile
518 dlls/shell32/Makefile
519 dlls/winaspi/Makefile
520 dlls/wnaspi32/Makefile
521 documentation/Makefile
522 files/Makefile
523 graphics/Makefile
524 graphics/metafiledrv/Makefile
525 graphics/psdrv/Makefile
526 graphics/win16drv/Makefile
527 graphics/x11drv/Makefile
528 if1632/Makefile
529 ipc/Makefile
530 library/Makefile
531 libtest/Makefile
532 loader/Makefile
533 loader/ne/Makefile
534 loader/dos/Makefile
535 memory/Makefile
536 misc/Makefile
537 miscemu/Makefile
538 msdos/Makefile
539 multimedia/Makefile
540 objects/Makefile
541 ole/Makefile
542 programs/Makefile
543 programs/clock/Makefile
544 programs/control/Makefile
545 programs/notepad/Makefile
546 programs/progman/Makefile
547 programs/regtest/Makefile
548 programs/view/Makefile
549 programs/winhelp/Makefile
550 programs/winver/Makefile
551 rc/Makefile
552 relay32/Makefile
553 resources/Makefile
554 scheduler/Makefile
555 server/Makefile
556 tools/Makefile
557 tools/wrc/Makefile
558 tsx11/Makefile
559 win32/Makefile
560 windows/Makefile
561 windows/x11drv/Makefile ])
563 if test "$wine_cv_libc_reentrant" = "no" 
564 then
565   echo
566   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
567   echo "*** thread support. Consider upgrading libc to a more recent"
568   echo "*** reentrant version of libc."
569   echo
572 echo
573 echo "Configure finished.  Do 'make depend; make' to compile Wine."
574 echo
576 dnl Local Variables:
577 dnl comment-start: "dnl "
578 dnl comment-end: ""
579 dnl comment-start-skip: "\\bdnl\\b\\s *"
580 dnl compile-command: "autoconf"
581 dnl End: