3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,1.1.2.99)
9 # In case of cygwin, override LN_S, irrespective of what it determines.
10 # The build uses cygwin, but the actual runtime doesn't.
12 *cygwin* ) LN_S='cp -p';;
24 if test -d $srcdir/libgc ; then
31 # These are the flags that need to be stored in the mono.pc file for
32 # compiling code that will embed Mono
36 AC_SUBST(libmono_cflags)
37 AC_SUBST(libmono_ldflags)
39 dnl if linker handles the version script
42 # Set to yes if Unix sockets cannot be created in an anonymous namespace
45 # Thread configuration inspired by sleepycat's db
46 AC_MSG_CHECKING([host platform characteristics])
49 *-*-mingw*|*-*-cygwin*)
51 AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
52 CC="gcc -mno-cygwin -g"
54 # So libgc configure gets -mno-cygwin
56 # latest libgc already defines GC_WIN32_THREADS
57 # CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
58 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
68 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
69 libmono_cflags="-D_REENTRANT"
70 LDFLAGS="$LDFLAGS -pthread"
71 libmono_ldflags="-pthread"
76 # these flags will work for all versions of -STABLE
80 if test "x$PTHREAD_CFLAGS" = "x"; then
81 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
82 libmono_cflags="-D_THREAD_SAFE"
84 CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
85 libmono_cflags="$PTHREAD_CFLAGS"
87 if test "x$PTHREAD_LIBS" = "x"; then
88 LDFLAGS="$LDFLAGS -pthread"
89 libmono_ldflags="-pthread"
91 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
92 libmono_ldflags="$PTHREAD_LIBS"
95 AC_DEFINE(PTHREAD_POINTER_ID)
97 libgc_threads=pthreads
98 # TLS isn't implemented at all on -STABLE
102 # older versions of -CURRENT will break with these flags but testing
103 # indicates these older versions won't run Mono anyway
107 if test "x$PTHREAD_CFLAGS" = "x"; then
108 CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
111 CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
112 libmono_cflags="$PTHREAD_CFLAGS"
114 if test "x$PTHREAD_LIBS" = "x"; then
115 LDFLAGS="$LDFLAGS -lpthread"
116 libmono_ldflags="-lpthread"
118 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
119 libmono_ldflags="$PTHREAD_LIBS"
122 AC_DEFINE(PTHREAD_POINTER_ID)
124 libgc_threads=pthreads
125 # TLS is only partially implemented on -CURRENT (compiler support
126 # but NOT library support)
133 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
134 libmono_cflags="-D_THREAD_SAFE"
135 LDFLAGS="$LDFLAGS -pthread"
136 libmono_ldflags="-pthread"
138 AC_DEFINE(PTHREAD_POINTER_ID)
140 libgc_threads=pthreads
144 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
145 libmono_cflags="-D_REENTRANT"
146 libmono_ldflags="-lpthread"
148 libgc_threads=pthreads
152 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
153 CFLAGS="$CFLAGS +ESdbgasm"
154 LDFLAGS="$LDFLAGS -z"
155 libmono_cflags="-D_REENTRANT"
156 libmono_ldflags="-lpthread"
157 libgc_threads=pthreads
162 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
164 libmono_cflags="-D_REENTRANT"
165 libgc_threads=pthreads
169 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
170 libmono_cflags="-D_THREAD_SAFE"
171 LDFLAGS="$LDFLAGS -pthread"
172 libmono_ldflags="-pthread"
174 AC_DEFINE(PTHREAD_POINTER_ID)
175 AC_DEFINE(USE_MACH_SEMA)
176 no_version_script=yes
178 libgc_threads=pthreads
181 AC_MSG_WARN([*** Please add $host to configure.in checks!])
188 if test x$need_link_unlink = xyes; then
189 AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
192 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
194 AC_CHECK_TOOL(CC, gcc, gcc)
198 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
200 # Set ASFLAGS if not already set.
201 : ${CCASFLAGS='$(CFLAGS)'}
205 AC_CHECK_PROG(BISON, bison,yes,no)
206 if test "x$BISON" = "xno";
208 AC_MSG_ERROR([You need to install bison])
211 dnl may require a specific autoconf version
212 dnl AC_PROG_CC_FOR_BUILD
213 dnl CC_FOR_BUILD not automatically detected
216 if test "x$cross_compiling" = "xyes"; then
220 AC_SUBST(CC_FOR_BUILD)
222 AC_SUBST(BUILD_EXEEXT)
229 # Test whenever ld supports -version-script
232 if test "x$lt_cv_prog_gnu_ld" = "xno"; then
233 no_version_script=yes
236 AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
238 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
240 AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
242 AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
244 # for mono/metadata/debug-symfile.c
245 AC_CHECK_HEADERS(elf.h)
248 AC_CHECK_HEADERS(wchar.h)
250 # not 64 bit clean in cross-compile
251 AC_CHECK_SIZEOF(void *, 4)
254 if test x"$GCC" = xyes; then
255 WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
256 # The runtime code does not respect ANSI C strict aliasing rules
257 CFLAGS="$CFLAGS -fno-strict-aliasing"
259 # The Sun Forte compiler complains about inline functions that access static variables
260 # so disable all inlining.
263 CFLAGS="$CFLAGS -Dinline="
267 CFLAGS="$CFLAGS -g $WARN"
269 # Where's the 'mcs' source tree?
270 if test -d $srcdir/mcs; then
276 mcs_topdir='$(top_srcdir)/'$mcsdir
277 mcs_topdir_from_srcdir='$(top_builddir)/'$mcsdir
279 AC_SUBST([mcs_topdir])
280 AC_SUBST([mcs_topdir_from_srcdir])
282 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
283 if test "x$PKG_CONFIG" = "xno"; then
284 AC_MSG_ERROR([You need to install pkg-config])
287 dnl for use on the build system
288 dnl pkg-config is stupid
289 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
290 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
291 AC_SUBST(BUILD_GLIB_CFLAGS)
292 AC_SUBST(BUILD_GLIB_LIBS)
295 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
296 if test x$with_crosspkgdir = "x"; then
297 if test -s $PKG_CONFIG_PATH; then
298 PKG_PATH=$PKG_CONFIG_PATH
301 PKG_PATH=$with_crosspkgdir
302 PKG_CONFIG_PATH=$PKG_PATH
303 export PKG_CONFIG_PATH
307 ## Versions of dependencies
308 GLIB_REQUIRED_VERSION=1.3.11
310 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
312 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
313 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
314 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
315 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
317 AC_SUBST(GLIB_CFLAGS)
319 AC_SUBST(GMODULE_CFLAGS)
320 AC_SUBST(GMODULE_LIBS)
322 if test x$platform_win32 = xyes; then
323 AC_MSG_CHECKING(for cygwin glib2-dev package)
324 if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
326 AC_MSG_ERROR([Mono cannot be built with the cygwin glib2-devel package installed, because that package doesn't work with -mno-cygwin. Please uninstall it then re-run configure.])
328 AC_MSG_RESULT(not found, ok)
331 AC_MSG_CHECKING(for broken gwin32.h)
332 glib_include=`$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`
333 if test -f $glib_include/glib/gwin32.h; then
334 if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
335 AC_MSG_RESULT(failed)
337 AC_MSG_ERROR([Your version of gwin32.h is broken and will cause compilation errors when building mono. Please fix it by deleting the line: '$hashmark define ftruncate...' from '$glib_include/glib/gwin32.h' then re-run configure.])
343 AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
345 # Enable support for fast thread-local storage
346 # Some systems have broken support, so we allow to disable it.
347 AC_ARG_WITH(tls, [ --with-tls=__thread,pthread select Thread Local Storage implementation],[],[with_tls=__thread])
349 # Kept for compatibility
350 AC_ARG_WITH(nptl, [ --with-nptl=yes,no deprecated, use --with-tls instead],[],[with_nptl=default])
352 if test "x$with_nptl" != "xdefault"; then
353 if test "x$with_nptl" = "xyes"; then
354 AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.])
357 if test "x$with_nptl" = "xno"; then
358 AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.])
363 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
364 # This does not work on some platforms (bug #55253)
365 AC_ARG_WITH(sigaltstack, [ --with-sigaltstack=yes,no enable/disable support for sigaltstack],[],[with_sigaltstack=no])
367 AC_ARG_WITH(static_mono, [ --with-static_mono=yes,no link mono statically to libmono (faster)],[],[with_static_mono=yes])
369 if test "x$enable_static" = "xno"; then
373 AM_CONDITIONAL(STATIC_MONO, test x$with_static_mono != xno)
381 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
382 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
384 if test "x$found_boehm" != "xyes"; then
385 AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
387 if test "x$gc_headers" != "xyes"; then
388 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
391 AC_DEFINE(HAVE_BOEHM_GC)
392 AC_SUBST(HAVE_BOEHM_GC)
393 LIBGC_LIBS="-lgc $libdl"
394 LIBGC_STATIC_LIBS="$LIBGC_LIBS"
396 # AC_CHECK_FUNCS does not work for some reason...
397 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
398 if test "x$found_gcj_malloc" = "xyes"; then
399 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
401 AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
402 if test "x$found_gc_enable" = "xyes"; then
403 AC_DEFINE(HAVE_GC_ENABLE)
408 AC_CONFIG_SUBDIRS(libgc)
415 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
416 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
417 LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
419 AC_DEFINE(HAVE_BOEHM_GC)
420 AC_SUBST(HAVE_BOEHM_GC)
423 AC_DEFINE(USE_INCLUDED_LIBGC)
425 # The included libgc contains GCJ support
426 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
427 AC_DEFINE(HAVE_GC_ENABLE)
431 AC_MSG_WARN("Compiling mono without GC.")
434 AC_MSG_ERROR([Invalid argument to --with-gc.])
439 # tell libgc/configure about what we want
440 ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads"
442 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
443 AC_SUBST(LIBGC_CFLAGS)
445 AC_SUBST(LIBGC_STATIC_LIBS)
449 dnl End of libgc checks
452 if test x$platform_win32 = xno; then
454 dnl ******************************************************************
455 dnl *** Checks for the IKVM JNI interface library ***
456 dnl ******************************************************************
457 AC_ARG_WITH(ikvm-jni, [ --with-ikvm-jni=yes,no build the IKVM JNI interface library],[with_ikvm_jni=$withval],[with_ikvm_jni=yes])
458 AC_ARG_WITH(jdk, [ --with-jdk=DIRECTORY Use JDK from DIRECTORY],[with_jdk_dir=$withval],[with_jdk_dir=])
461 if test x$with_ikvm_jni = xyes; then
462 AC_MSG_CHECKING([JDK headers])
464 if test x$with_jdk_dir = x; then
465 # Try JAVA_HOME variable
466 if test x$JAVA_HOME != x; then
467 with_jdk_dir=$JAVA_HOME
472 if test -d $with_jdk_dir/include; then
473 jdk_headers_found=yes
475 if test -d $with_jdk_dir/include/linux; then
478 if test -d $with_jdk_dir/include/solaris; then
481 if test -f $with_jdk_dir/include/jni_md.h; then
482 # GNU Classpath sources
493 if test x$jdk_headers_found = xyes; then
494 AC_MSG_RESULT($with_jdk_dir/include $with_jdk_dir/include/$jdk_platform)
496 AC_MSG_RESULT(not found)
499 if test x$jdk_headers_found = xyes; then
500 ikvm_jni_dir=ikvm-jni
501 IKVM_JNI_CFLAGS="-I$with_jdk_dir/include -I$with_jdk_dir/include/$jdk_platform"
505 AC_SUBST(ikvm_jni_dir)
506 AC_SUBST(IKVM_JNI_CFLAGS)
508 AC_CHECK_FUNCS(getgrgid_r)
509 AC_CHECK_FUNCS(getgrnam_r)
510 AC_CHECK_FUNCS(getpwnam_r)
511 AC_CHECK_FUNCS(getpwuid_r)
512 AC_CHECK_FUNCS(getresuid)
513 AC_CHECK_FUNCS(setresuid)
514 AC_CHECK_FUNCS(kqueue)
516 dnl ******************************************************************
517 dnl *** Check for large file support ***
518 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
519 dnl ******************************************************************
521 # Check that off_t can represent 2**63 - 1 correctly, working around
522 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
523 # CPPFLAGS and sets $large_offt to yes if the test succeeds
525 AC_DEFUN(LARGE_FILES, [
526 large_CPPFLAGS=$CPPFLAGS
527 CPPFLAGS="$CPPFLAGS $1"
529 #include <sys/types.h>
531 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
534 int big_off_t=((BIG_OFF_T%2147483629==721) &&
535 (BIG_OFF_T%2147483647==1));
544 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
545 large_CPPFLAGS="$large_CPPFLAGS $1"
550 CPPFLAGS=$large_CPPFLAGS
553 AC_MSG_CHECKING(if off_t is 64 bits wide)
555 if test $large_offt = no; then
556 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
557 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
559 if test $large_offt = no; then
560 AC_MSG_WARN([No 64 bit file size support available])
563 dnl *****************************
564 dnl *** Checks for libsocket ***
565 dnl *****************************
566 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
568 dnl *******************************
569 dnl *** Checks for MSG_NOSIGNAL ***
570 dnl *******************************
571 AC_MSG_CHECKING(for MSG_NOSIGNAL)
572 AC_TRY_COMPILE([#include <sys/socket.h>], [
573 int f = MSG_NOSIGNAL;
577 AC_DEFINE(HAVE_MSG_NOSIGNAL)
579 # We'll have to use signals
583 dnl *****************************
584 dnl *** Checks for SOL_IP ***
585 dnl *****************************
586 AC_MSG_CHECKING(for SOL_IP)
587 AC_TRY_COMPILE([#include <netdb.h>], [
592 AC_DEFINE(HAVE_SOL_IP)
594 # We'll have to use getprotobyname
598 dnl *****************************
599 dnl *** Checks for SOL_IPV6 ***
600 dnl *****************************
601 AC_MSG_CHECKING(for SOL_IPV6)
602 AC_TRY_COMPILE([#include <netdb.h>], [
603 int level = SOL_IPV6;
607 AC_DEFINE(HAVE_SOL_IPV6)
609 # We'll have to use getprotobyname
613 dnl *****************************
614 dnl *** Checks for SOL_TCP ***
615 dnl *****************************
616 AC_MSG_CHECKING(for SOL_TCP)
617 AC_TRY_COMPILE([#include <netdb.h>], [
622 AC_DEFINE(HAVE_SOL_TCP)
624 # We'll have to use getprotobyname
628 dnl *****************************
629 dnl *** Checks for IP_PKTINFO ***
630 dnl *****************************
631 AC_MSG_CHECKING(for IP_PKTINFO)
632 AC_TRY_COMPILE([#include <netdb.h>], [
633 int level = IP_PKTINFO;
637 AC_DEFINE(HAVE_IP_PKTINFO)
642 dnl *********************************
643 dnl *** Check for struct ip_mreqn ***
644 dnl *********************************
645 AC_MSG_CHECKING(for struct ip_mreqn)
646 AC_TRY_COMPILE([#include <netinet/in.h>], [
647 struct ip_mreqn mreq;
648 mreq.imr_address.s_addr = 0;
652 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
654 # We'll just have to try and use struct ip_mreq
656 AC_MSG_CHECKING(for struct ip_mreq)
657 AC_TRY_COMPILE([#include <netinet/in.h>], [
659 mreq.imr_interface.s_addr = 0;
663 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
665 # No multicast support
670 dnl **********************************
671 dnl *** Check for gethostbyname2_r ***
672 dnl **********************************
673 AC_MSG_CHECKING(for gethostbyname2_r)
674 AC_TRY_LINK([#include <netdb.h>], [
675 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
679 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
684 dnl *****************************
685 dnl *** Checks for libnsl ***
686 dnl *****************************
687 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
689 AC_CHECK_FUNCS(inet_pton inet_aton)
691 dnl ***********************************************
692 dnl *** Checks for size of sockaddr_un.sun_path ***
693 dnl ***********************************************
694 # AC_CHECK_SIZEOF can't cope with struct members :-(
695 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
696 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
698 #include <sys/types.h>
703 struct sockaddr_un sock_un;
704 FILE *f=fopen("conftestval", "w");
706 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
709 ], cv_mono_sizeof_sunpath=`cat conftestval`,
710 cv_mono_sizeof_sunpath=0,
711 cv_mono_sizeof_sunpath=0)])dnl
712 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
713 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
715 dnl *************************************
716 dnl *** Checks for zero length arrays ***
717 dnl *************************************
718 AC_MSG_CHECKING(whether $CC supports zero length arrays)
726 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
729 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
732 dnl *****************************
733 dnl *** Checks for libxnet ***
734 dnl *****************************
737 AC_MSG_CHECKING(for Solaris XPG4 support)
738 if test -f /usr/lib/libxnet.so; then
739 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
740 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
741 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
748 if test "$GCC" = "yes"; then
749 CFLAGS="$CFLAGS -Wno-char-subscripts"
754 dnl *****************************
755 dnl *** Checks for libpthread ***
756 dnl *****************************
757 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
758 # and libpthread does not exist
762 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
765 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
768 AC_CHECK_HEADERS(pthread.h)
769 AC_CHECK_FUNCS(pthread_mutex_timedlock)
770 AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
771 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
772 AC_TRY_COMPILE([ #include <pthread.h>], [
773 pthread_mutexattr_t attr;
774 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
779 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
780 AC_DEFINE(USE_MONO_MUTEX)
782 AC_CHECK_FUNCS(pthread_attr_setstacksize)
784 dnl ***********************************
785 dnl *** Checks for working __thread ***
786 dnl ***********************************
787 AC_MSG_CHECKING(for working __thread)
788 if test "x$with_tls" != "x__thread"; then
789 AC_MSG_RESULT(disabled)
795 static int res1, res2;
797 void thread_main (void *arg)
812 pthread_create (&t1, NULL, thread_main, 1);
813 pthread_create (&t2, NULL, thread_main, 2);
815 pthread_join (t1, NULL);
816 pthread_join (t2, NULL);
818 return !(res1 + res2 == 2);
828 dnl **************************************
829 dnl *** Checks for working sigaltstack ***
830 dnl **************************************
831 AC_MSG_CHECKING(for working sigaltstack)
832 if test "x$with_sigaltstack" != "xyes"; then
833 AC_MSG_RESULT(disabled)
841 #include <sys/wait.h>
844 sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
862 struct sigaltstack sas;
866 sa.sa_sigaction = sigsegv_signal_handler;
867 sigemptyset (&sa.sa_mask);
868 sa.sa_flags = SA_SIGINFO | SA_STACK;
869 if (sigaction (SIGSEGV, &sa, NULL) == -1) {
874 sas.ss_sp = malloc (SIGSTKSZ);
875 sas.ss_size = SIGSTKSZ;
876 sas.ss_flags = SS_ONSTACK;
877 if (sigaltstack (&sas, NULL) == -1) {
882 pthread_attr_init (&attr);
883 if (pthread_create(&id, &attr, loop, &attr) != 0) {
908 for (i = 0; i < 3; ++i) {
910 waitpid (son, &status, WNOHANG);
911 if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
921 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
928 dnl ********************************
929 dnl *** Checks for semaphore lib ***
930 dnl ********************************
931 # 'Real Time' functions on Solaris
932 # posix4 on Solaris 2.6
933 # pthread (first!) on Linux
934 AC_SEARCH_LIBS(sem_init, pthread rt posix4)
936 dnl ********************************
937 dnl *** Checks for timezone stuff **
938 dnl ********************************
939 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
945 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
946 if test $ac_cv_struct_tm_gmtoff = yes; then
947 AC_DEFINE(HAVE_TM_GMTOFF)
949 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
954 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
955 if test $ac_cv_var_timezone = yes; then
956 AC_DEFINE(HAVE_TIMEZONE)
958 AC_ERROR(unable to find a way to determine timezone)
962 dnl *********************************
963 dnl *** Checks for math functions ***
964 dnl *********************************
966 AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
967 AC_TRY_LINK([#include <math.h>],
969 AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes),
971 AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
972 AC_TRY_LINK([#include <math.h>],
974 AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
977 dnl ****************************************************************
978 dnl *** Checks for working poll() (macosx defines it but doesn't ***
979 dnl *** have it in the library (duh)) ***
980 dnl ****************************************************************
983 dnl *************************
984 dnl *** Check for signbit ***
985 dnl *************************
986 AC_MSG_CHECKING(for signbit)
987 AC_TRY_LINK([#include <math.h>], [
988 int s = signbit(1.0);
991 AC_DEFINE(HAVE_SIGNBIT)
996 dnl *********************
997 dnl *** Check for AIO ***
998 dnl *********************
999 AC_MSG_CHECKING([for SIGEV_THREAD definition])
1000 dnl Some systems (FreeBSD at least) may have aio_read
1001 dnl but don't support/define SIGEV_THREAD.
1003 #include <sys/signal.h>
1005 int x = SIGEV_THREAD;
1007 ac_cv_c_sigev_thread=yes
1013 if test "$ac_cv_c_sigev_thread" = "yes" ; then
1014 AC_CHECK_HEADERS(aio.h sys/aio.h)
1015 AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
1016 SIGVAL_PTR="undefined"
1017 if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
1018 AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
1019 #include <sys/signal.h>
1021 AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
1022 #include <sys/signal.h>
1024 if test "$SIGVAL_PTR" = "undefined" ; then
1025 AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
1028 AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
1031 dnl **********************************
1032 dnl *** Checks for MonoPosixHelper ***
1033 dnl **********************************
1034 AC_CHECK_FUNCS(posix_fadvise)
1035 AC_CHECK_FUNCS(posix_madvise)
1036 AC_CHECK_FUNCS(posix_fallocate)
1037 AC_CHECK_FUNCS(fgetgrent)
1038 AC_CHECK_FUNCS(fgetpwent)
1039 AC_CHECK_FUNCS(fgetpwent)
1040 AC_CHECK_HEADERS(sys/sendfile.h)
1041 AC_CHECK_FUNCS(sendfile)
1042 AC_CHECK_FUNCS(sethostid)
1043 AC_CHECK_FUNCS(stime)
1044 AC_CHECK_FUNCS(strerror_r)
1045 AC_CHECK_FUNCS(ttyname_r)
1046 AC_CHECK_SIZEOF(size_t)
1048 [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
1049 [#include <sys/types.h>
1050 #include <dirent.h>])
1052 jdk_headers_found=no
1053 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
1054 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
1055 AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
1057 dnl *********************************
1058 dnl *** Check for struct ip_mreqn ***
1059 dnl *********************************
1060 AC_MSG_CHECKING(for struct ip_mreqn)
1061 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1062 struct ip_mreqn mreq;
1063 mreq.imr_address.s_addr = 0;
1065 # Yes, we have it...
1067 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
1069 # We'll just have to try and use struct ip_mreq
1071 AC_MSG_CHECKING(for struct ip_mreq)
1072 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1073 struct ip_mreq mreq;
1074 mreq.imr_interface.s_addr = 0;
1076 # Yes, we have it...
1078 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
1080 # No multicast support
1087 AC_MSG_CHECKING(for socklen_t)
1089 #include <sys/types.h>
1090 #include <sys/socket.h>
1094 ac_cv_c_socklen_t=yes
1095 AC_DEFINE(HAVE_SOCKLEN_T)
1101 AC_MSG_CHECKING(for array element initalizer support)
1102 AC_TRY_COMPILE([#include <sys/socket.h>], [
1103 const int array[] = {[1] = 2,};
1105 # Yes, we have it...
1107 AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1109 # We'll have to use signals
1113 AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
1114 # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1115 AC_TRY_LINK([#include <math.h>],
1116 [ static void *p = &trunc; ],
1118 AC_DEFINE(HAVE_TRUNC)
1124 if test "x$ac_cv_truncl" != "xyes"; then
1125 AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL) LIBS="$LIBS -lsunmath"])
1128 dnl ****************************
1129 dnl *** Look for /dev/random ***
1130 dnl ****************************
1132 AC_MSG_CHECKING([if usage of random device is requested])
1133 AC_ARG_ENABLE(dev-random,
1134 [ --disable-dev-random disable the use of the random device],
1135 try_dev_random=$enableval, try_dev_random=yes)
1136 AC_MSG_RESULT($try_dev_random)
1140 NAME_DEV_RANDOM="/dev/srandom"
1143 dnl Win32 does not have /dev/random, they have their own method...
1145 *-*-mingw*|*-*-cygwin*)
1146 ac_cv_have_dev_random=no
1149 dnl Everywhere else, it's /dev/random
1152 NAME_DEV_RANDOM="/dev/random"
1156 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
1158 dnl Now check if the device actually exists
1160 if test "x$try_dev_random" = "xyes"; then
1161 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1162 [if test -r "$NAME_DEV_RANDOM" ; then
1163 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1164 if test "x$ac_cv_have_dev_random" = "xyes"; then
1165 AC_DEFINE(HAVE_CRYPT_RNG)
1168 AC_MSG_CHECKING(for random device)
1169 ac_cv_have_dev_random=no
1170 AC_MSG_RESULT(has been disabled)
1173 if test "x$platform_win32" = "xyes"; then
1174 AC_DEFINE(HAVE_CRYPT_RNG)
1177 if test "x$ac_cv_have_dev_random" = "xno" \
1178 && test "x$platform_win32" = "xno"; then
1181 *** A system-provided entropy source was not found on this system.
1182 *** Because of this, the System.Security.Cryptography random number generator
1183 *** will throw a NotImplemented exception.
1185 *** If you are seeing this message, and you know your system DOES have an
1186 *** entropy collection in place, please contact <crichton@gimp.org> and
1187 *** provide information about the system and how to access the random device.
1189 *** Otherwise you can install either egd or prngd and set the environment
1190 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1194 AC_MSG_CHECKING([if inter-process shared handles are requested])
1195 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
1196 AC_MSG_RESULT($try_shared_handles)
1197 if test "x$try_shared_handles" != "xyes"; then
1198 AC_DEFINE(DISABLE_SHARED_HANDLES)
1199 AC_SUBST(DISABLE_SHARED_HANDLES)
1207 enable_icu="no; default"
1210 AC_ARG_WITH(icu, [ --with-icu=yes/no],
1211 if test x$with_icu = xno; then
1213 AC_MSG_RESULT(Will not probe for ICU)
1215 if test x$with_icu = xyes; then
1221 AC_PATH_PROG(ICU_CONFIG, icu-config, no)
1222 if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
1223 AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
1224 enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
1226 enable_icu="yes. Version: `$ICU_CONFIG --version`"
1228 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
1229 ICU_LIBS=`$ICU_CONFIG --ldflags`
1232 AC_SUBST(ICU_CFLAGS)
1235 AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests Run the nunit tests of the class library on 'make check'])
1236 AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
1239 ACCESS_UNALIGNED="yes"
1247 # mips-sgi-irix5.* | mips-sgi-irix6.*)
1249 # ACCESS_UNALIGNED="no"
1257 x86_64-*-* | amd64-*-*)
1264 if test "x$ac_cv_sizeof_void_p" = "x8"; then
1271 ACCESS_UNALIGNED="no"
1276 alpha*-*-linux* | alpha*-*-osf*)
1278 ACCESS_UNALIGNED="no"
1282 # ia64-*-linux* | ia64-*-hpux*)
1286 # ACCESS_UNALIGNED="no";
1287 # case "$host_os" in
1288 # linux*) LIBC="libc.so.6.1";;
1289 # hpux*) LIBC="libc.so.1";;
1295 hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
1299 ACCESS_UNALIGNED="no"
1304 ACCESS_UNALIGNED="no"
1306 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
1307 powerpc-*-sysv* | powerpc-*-darwin*)
1309 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1314 arm-*-linux-* | armv4l-*-linux-*)
1317 ACCESS_UNALIGNED="no"
1321 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1323 ACCESS_UNALIGNED="no"
1328 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1330 ACCESS_UNALIGNED="no"
1335 AC_ARG_WITH(jit, [ --with-jit=yes,no If you want to build scripts that default to the JIT],[
1336 if test x$withval = xyes; then
1344 if test x$JIT_SUPPORTED = xyes; then
1345 if $jit_wanted; then
1347 jit_status="Building and using the JIT"
1349 jit_status="Building the JIT, defaulting to the interpreter"
1352 jit_status="interpreter"
1355 AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
1363 INTL="libintl.dylib"
1380 if test "x$TARGET" != "xAMD64"; then
1381 # valgrind headers don't compile under x86-64
1382 AC_CHECK_HEADERS(valgrind/memcheck.h)
1385 if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
1386 if test "x$with_tls" = "x__thread"; then
1388 # On some linux distributions, TLS works in executables, but linking
1389 # against a shared library containing TLS fails with:
1390 # undefined reference to `__tls_get_addr'
1392 rm -f conftest.c conftest.so conftest
1393 echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
1394 gcc -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
1395 gcc -o conftest conftest.so > /dev/null 2>&1
1396 if test ! -f conftest; then
1397 AC_MSG_WARN([Disabling usage of __thread.]);
1400 rm -f conftest.c conftest.so conftest
1404 if test "x$with_tls" = "x__thread"; then
1405 AC_DEFINE(HAVE_KW_THREAD)
1406 # Pass the information to libgc
1407 CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
1411 if test ${TARGET} = ARM; then
1412 dnl ******************************************
1413 dnl *** Check to see what FPU is available ***
1414 dnl ******************************************
1415 AC_MSG_CHECKING(which FPU to use)
1417 AC_TRY_COMPILE([], [
1418 __asm__ ("ldfd f0, [r0]");
1420 AC_TRY_COMPILE([], [
1421 __asm__ ("fldd d0, [r0]");
1422 ], fpu=VFP, fpu=NONE)
1426 CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
1430 if test ${TARGET} = unknown; then
1431 CPPFLAGS="$CPPFLAGS -DNO_PORT"
1432 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
1435 if test ${ACCESS_UNALIGNED} = no; then
1436 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
1440 AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to install the 2.0 FX preview],[
1441 if test x$with_preview = xyes; then
1446 AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
1448 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1449 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1450 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1451 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
1452 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1453 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
1454 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
1455 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
1456 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
1457 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
1458 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1459 AM_CONDITIONAL(S390, test x$TARGET = xS390)
1460 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
1461 AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
1463 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
1464 AM_CONDITIONAL(INCLUDED_LIBGC, test x$gc = xincluded)
1469 AC_SUBST(arch_target)
1474 mono_build_root=`pwd`
1475 AC_SUBST(mono_build_root)
1477 if test x$USEJIT = xtrue; then
1478 mono_runtime=mono/mini/mono
1480 mono_runtime=mono/interpreter/mint
1482 AC_SUBST(mono_runtime)
1484 mono_cfg_root=$mono_build_root/runtime
1485 if test x$platform_win32 = xyes; then
1486 mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
1488 mono_cfg_dir=$mono_cfg_root/etc
1490 AC_SUBST(mono_cfg_dir)
1492 AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
1494 AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
1497 [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1499 *) reldir=$depth/$srcdir ;;
1501 $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
1502 cd runtime/etc/mono/1.0
1503 rm -f machine.config
1504 $LN_S $reldir/data/net_1_1/machine.config machine.config
1508 AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
1511 [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1513 *) reldir=$depth/$srcdir ;;
1515 $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
1516 cd runtime/etc/mono/2.0
1517 rm -f machine.config
1518 $LN_S $reldir/data/net_2_0/machine.config machine.config
1528 mono/metadata/Makefile
1533 mono/os/win32/Makefile
1534 mono/os/unix/Makefile
1535 mono/arch/x86/Makefile
1536 mono/arch/amd64/Makefile
1537 mono/arch/hppa/Makefile
1538 mono/arch/ppc/Makefile
1539 mono/arch/sparc/Makefile
1540 mono/arch/s390/Makefile
1541 mono/arch/s390x/Makefile
1542 mono/arch/arm/Makefile
1543 mono/arch/alpha/Makefile
1544 mono/interpreter/Makefile
1546 mono/tests/tests-config
1547 mono/benchmark/Makefile
1548 mono/monoburg/Makefile
1549 mono/monograph/Makefile
1550 mono/io-layer/Makefile
1551 mono/handles/Makefile
1553 mono/profiler/Makefile
1560 data/net_1_1/Makefile
1561 data/net_2_0/Makefile
1567 tools/locale-builder/Makefile
1572 mcs source: $mcs_topdir
1576 SIGALTSTACK: $with_sigaltstack
1579 JNI support: $jdk_headers_found