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