Improved the handling of font encodings.
[wine/multimedia.git] / configure.in
blob7d1120c4f0e116ac3fccfac11b2ef2f74ac9c8b3
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 if test "$LIB_TARGET" = "libwine.so.1.0"
218 then
219   AC_CACHE_CHECK("whether we can build a dll",
220                  ac_cv_c_dll,
221   [saved_cflags=$CFLAGS
222   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
223   AC_TRY_LINK(,[return 1],ac_cv_c_dll="yes",ac_cv_c_dll="no")
224   CFLAGS=$saved_cflags
225   ])
226   if test "$ac_cv_c_dll" = "yes"
227   then
228     DLLFLAGS="-fPIC"
229   else
230     LIB_TARGET="libwine.a"
231   fi
233 AC_SUBST(DLLFLAGS)
235 dnl **** Check for reentrant libc ****
237 dnl For cross-compiling we blindly assume that libc is reentrant. This is
238 dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
240 AC_CACHE_CHECK("for reentrant libc", wine_cv_libc_reentrant,
241   [AC_TRY_RUN([int myerrno = 0;
242 char buf[256];
243 int *__errno_location(){return &myerrno;}
244 main(){connect(0,buf,255); exit(!myerrno);}],
245   wine_cv_libc_reentrant=yes, wine_cv_libc_reentrant=no,
246   wine_cv_libc_reentrant=yes ) ] )
247 if test "$wine_cv_libc_reentrant" = "no" 
248 then
249   AC_DEFINE(NO_REENTRANT_LIBC)
252 dnl **** Check for reentrant X libraries ****
254 dnl This may fail to determine whether X libraries are reentrant if
255 dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
256 dnl is possible with the --without-reentrant-x option.
258 AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
259   [ if test "x$with_reentrant_x" = "xno"
260     then
261         wine_cv_x_reentrant=no
262     else
263         libX11_ckeck=none
264         for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
265             if test -r $dir/libX11.so; then
266                 libX11_check="-D $dir/libX11.so"
267                 break 1
268             fi
269             if test -r $dir/libX11.a; then
270                 libX11_check="$dir/libX11.a"
271                 break 1
272             fi
273         done
274         if test "$libX11_check" != "none"; then
275             if nm $libX11_check | grep __errno_location >/dev/null 2>&1
276             then
277                 wine_cv_x_reentrant=yes
278             else
279                 wine_cv_x_reentrant=no
280             fi
281         else
282             wine_cv_x_reentrant=unknown
283         fi
284     fi ] )
285 if test "$wine_cv_x_reentrant" = "no"
286 then
287   AC_DEFINE(NO_REENTRANT_X11)
290 dnl **** Check for functions and header files ****
292 AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
293 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)
294 AC_HEADER_STAT()
295 AC_C_CONST()
296 AC_TYPE_SIZE_T()
297 AC_CHECK_SIZEOF(long long,0)
299 dnl **** Check for sendmsg in -lsocket if not found above ****
301 if test $ac_cv_func_sendmsg = no; then
302     AC_CHECK_LIB(socket,sendmsg)
305 dnl **** statfs checks ****
307 if test "$ac_cv_header_sys_vfs_h" = "yes"
308 then
309     AC_CACHE_CHECK( "whether sys/vfs.h defines statfs",
310                     wine_cv_sys_vfs_has_statfs,
311         AC_TRY_COMPILE([
312         #include <sys/types.h>
313         #ifdef HAVE_SYS_PARAM_H
314         # include <sys/param.h>
315         #endif
316         #include <sys/vfs.h>
317         ],[
318                 struct statfs stfs;
320                 memset(&stfs,0,sizeof(stfs));
321         ],wine_cv_sys_vfs_has_statfs=yes,wine_cv_sys_vfs_has_statfs=no
322         )
323     )
324     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
325     then
326       AC_DEFINE(STATFS_DEFINED_BY_SYS_VFS)
327     fi
330 if test "$ac_cv_header_sys_statfs_h" = "yes"
331 then
332     AC_CACHE_CHECK( "whether sys/statfs.h defines statfs",
333                     wine_cv_sys_statfs_has_statfs,
334         AC_TRY_COMPILE([
335         #include <sys/types.h>
336         #ifdef HAVE_SYS_PARAM_H
337         # include <sys/param.h>
338         #endif
339         #include <sys/statfs.h>
340         ],[
341                 struct statfs stfs;
342         ],wine_cv_sys_statfs_has_statfs=yes,wine_cv_sys_statfs_has_statfs=no
343         )
344     )
345     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
346     then
347       AC_DEFINE(STATFS_DEFINED_BY_SYS_STATFS)
348     fi
351 if test "$ac_cv_header_sys_mount_h" = "yes"
352 then
353     AC_CACHE_CHECK( "whether sys/mount.h defines statfs",
354                     wine_cv_sys_mount_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/mount.h>
361         ],[
362                 struct statfs stfs;
363         ],wine_cv_sys_mount_has_statfs=yes,wine_cv_sys_mount_has_statfs=no
364         )
365     )
366     if test "$wine_cv_sys_mount_has_statfs" = "yes"
367     then
368       AC_DEFINE(STATFS_DEFINED_BY_SYS_MOUNT)
369     fi
372 dnl **** FIXME: what about mixed cases, where we need two of them? ***
374 AC_CACHE_CHECK( "for statfs.f_bfree", wine_cv_statfs_bfree,
375   [ if test "x$statfs_bfree" = "xno"
376     then
377         wine_cv_statfs_bfree=no
378     else
379         AC_TRY_COMPILE([
380         #include <sys/types.h>
381         #ifdef HAVE_SYS_PARAM_H
382         # include <sys/param.h>
383         #endif
384         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
385         # include <sys/mount.h>
386         #else
387         # ifdef STATFS_DEFINED_BY_SYS_VFS
388         #  include <sys/vfs.h>
389         # else
390         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
391         #   include <sys/statfs.h>
392         #  endif
393         # endif
394         #endif
395         ],[
396                 struct statfs stfs;
398                 stfs.f_bfree++;
399         ],wine_cv_statfs_bfree=yes,wine_cv_statfs_bfree=no
400         )
401     fi ] )
402 if test "$wine_cv_statfs_bfree" = "yes"
403 then
404   AC_DEFINE(STATFS_HAS_BFREE)
407 AC_CACHE_CHECK( "for statfs.f_bavail", wine_cv_statfs_bavail,
408   [ if test "x$statfs_bavail" = "xno"
409     then
410         wine_cv_statfs_bavail=no
411     else
412         AC_TRY_COMPILE([
413         #include <sys/types.h>
414         #ifdef HAVE_SYS_PARAM_H
415         # include <sys/param.h>
416         #endif
417         #ifdef STATFS_DEFINED_BY_SYS_MOUNT
418         # include <sys/mount.h>
419         #else
420         # ifdef STATFS_DEFINED_BY_SYS_VFS
421         #  include <sys/vfs.h>
422         # else
423         #  ifdef STATFS_DEFINED_BY_SYS_STATFS
424         #   include <sys/statfs.h>
425         #  endif
426         # endif
427         #endif
428         ],[
429                 struct statfs stfs;
431                 stfs.f_bavail++;
432         ],wine_cv_statfs_bavail=yes,wine_cv_statfs_bavail=no
433         )
434     fi ] )
435 if test "$wine_cv_statfs_bavail" = "yes"
436 then
437   AC_DEFINE(STATFS_HAS_BAVAIL)
440 dnl *** check for working sigaltstack
441 dnl glibc 2.0x defines it, but it always fails... so it is useless for us.
443 AC_CACHE_CHECK("for working sigaltstack",
444         ac_cv_c_working_sigaltstack,
445         AC_TRY_RUN([
446         #include <stdio.h>
447         #include <time.h> /* <sys/time.h> ? bad magic without end */
448         #include <sys/types.h>
449         #include <sys/signal.h>
450         #ifdef HAVE_SYS_PARAM_H
451         # include <sys/param.h>
452         #endif
453         #ifdef HAVE_SYSCALL_H
454         # include <syscall.h>
455         #else
456         # ifdef HAVE_SYS_SYSCALL_H
457         #  include <sys/syscall.h>
458         # endif
459         #endif
460         
461         unsigned char *xaltstack;
463         int
464         main(int argc,char **argv) {
465             struct sigaltstack  ss;
467             xaltstack = malloc(16384);
468             ss.ss_sp    = xaltstack;
469             ss.ss_size  = 16384;
470             ss.ss_flags = 0;
471             if (sigaltstack(&ss, NULL) < 0) {
472                 /* this catches the glibc case */
473                 perror("sigaltstack");
474                 return (1); /* aka exit(1) aka fail */
475             }
476             /* assume it works. */
477             return 0; /* OK */
478         }
479         ],
480         ac_cv_c_working_sigaltstack="yes",
481         ac_cv_c_working_sigaltstack="no",
482         ac_cv_c_working_sigaltstack="no"
485 if test "$ac_cv_c_working_sigaltstack" = "yes"
486 then
487     AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
491 dnl *** check for file descriptor passing with msg_accrights
493 AC_CACHE_CHECK("for msg_accrights in struct msghdr", ac_cv_c_msg_accrights,
494  AC_TRY_COMPILE([#include <sys/types.h>
495 #include <sys/socket.h>],[struct msghdr hdr; hdr.msg_accrights=0],
496                 ac_cv_c_msg_accrights="yes", ac_cv_c_msg_accrights="no"))
497 if test "$ac_cv_c_msg_accrights" = "yes"
498 then
499     AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
502 dnl **** Generate output files ****
504 MAKE_RULES=Make.rules
505 AC_SUBST_FILE(MAKE_RULES)
507 AC_OUTPUT([
508 Make.rules
509 Makefile
510 console/Makefile
511 controls/Makefile
512 debugger/Makefile
513 dlls/Makefile
514 dlls/comctl32/Makefile
515 dlls/imagehlp/Makefile
516 dlls/msacm/Makefile
517 dlls/msacm32/Makefile
518 dlls/ntdll/Makefile
519 dlls/psapi/Makefile
520 dlls/shell32/Makefile
521 dlls/winaspi/Makefile
522 dlls/wnaspi32/Makefile
523 documentation/Makefile
524 files/Makefile
525 graphics/Makefile
526 graphics/metafiledrv/Makefile
527 graphics/psdrv/Makefile
528 graphics/win16drv/Makefile
529 graphics/x11drv/Makefile
530 if1632/Makefile
531 ipc/Makefile
532 library/Makefile
533 libtest/Makefile
534 loader/Makefile
535 loader/ne/Makefile
536 loader/dos/Makefile
537 memory/Makefile
538 misc/Makefile
539 miscemu/Makefile
540 msdos/Makefile
541 multimedia/Makefile
542 objects/Makefile
543 ole/Makefile
544 programs/Makefile
545 programs/clock/Makefile
546 programs/control/Makefile
547 programs/notepad/Makefile
548 programs/progman/Makefile
549 programs/regtest/Makefile
550 programs/view/Makefile
551 programs/winhelp/Makefile
552 programs/winver/Makefile
553 rc/Makefile
554 relay32/Makefile
555 resources/Makefile
556 scheduler/Makefile
557 server/Makefile
558 tools/Makefile
559 tools/wrc/Makefile
560 tsx11/Makefile
561 win32/Makefile
562 windows/Makefile
563 windows/ttydrv/Makefile
564 windows/x11drv/Makefile ])
566 if test "$wine_cv_libc_reentrant" = "no" 
567 then
568   echo
569   echo "*** Warning: non-reentrant libc detected. Wine will be build without"
570   echo "*** thread support. Consider upgrading libc to a more recent"
571   echo "*** reentrant version of libc."
572   echo
575 echo
576 echo "Configure finished.  Do 'make depend; make' to compile Wine."
577 echo
579 dnl Local Variables:
580 dnl comment-start: "dnl "
581 dnl comment-end: ""
582 dnl comment-start-skip: "\\bdnl\\b\\s *"
583 dnl compile-command: "autoconf"
584 dnl End: