3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,1.1.2.99)
17 if test -d $srcdir/libgc ; then
24 # These are the flags that need to be stored in the mono.pc file for
25 # compiling code that will embed Mono
29 AC_SUBST(libmono_cflags)
30 AC_SUBST(libmono_ldflags)
32 dnl if linker handles the version script
35 # Set to yes if Unix sockets cannot be created in an anonymous namespace
38 # Thread configuration inspired by sleepycat's db
39 AC_MSG_CHECKING([host platform characteristics])
42 *-*-mingw*|*-*-cygwin*)
44 AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
45 CC="gcc -mno-cygwin -g"
47 # So libgc configure gets -mno-cygwin
49 # latest libgc already defines GC_WIN32_THREADS
50 # CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
51 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
61 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
62 libmono_cflags="-D_REENTRANT"
63 LDFLAGS="$LDFLAGS -pthread"
64 libmono_ldflags="-pthread"
69 # these flags will work for all versions of -STABLE
73 if test "x$PTHREAD_CFLAGS" = "x"; then
74 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
75 libmono_cflags="-D_THREAD_SAFE"
77 CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
78 libmono_cflags="$PTHREAD_CFLAGS"
80 if test "x$PTHREAD_LIBS" = "x"; then
81 LDFLAGS="$LDFLAGS -pthread"
82 libmono_ldflags="-pthread"
84 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
85 libmono_ldflags="$PTHREAD_LIBS"
88 AC_DEFINE(PTHREAD_POINTER_ID)
90 libgc_threads=pthreads
91 # TLS isn't implemented at all on -STABLE
95 # older versions of -CURRENT will break with these flags but testing
96 # indicates these older versions won't run Mono anyway
100 if test "x$PTHREAD_CFLAGS" = "x"; then
101 CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
104 CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
105 libmono_cflags="$PTHREAD_CFLAGS"
107 if test "x$PTHREAD_LIBS" = "x"; then
108 LDFLAGS="$LDFLAGS -lpthread"
109 libmono_ldflags="-lpthread"
111 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
112 libmono_ldflags="$PTHREAD_LIBS"
115 AC_DEFINE(PTHREAD_POINTER_ID)
117 libgc_threads=pthreads
118 # TLS is only partially implemented on -CURRENT (compiler support
119 # but NOT library support)
126 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
127 libmono_cflags="-D_THREAD_SAFE"
128 LDFLAGS="$LDFLAGS -pthread"
129 libmono_ldflags="-pthread"
131 AC_DEFINE(PTHREAD_POINTER_ID)
133 libgc_threads=pthreads
137 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
138 libmono_cflags="-D_REENTRANT"
139 libmono_ldflags="-lpthread"
141 libgc_threads=pthreads
145 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
146 CFLAGS="$CFLAGS +ESdbgasm"
147 LDFLAGS="$LDFLAGS -z"
148 libmono_cflags="-D_REENTRANT"
149 libmono_ldflags="-lpthread"
150 libgc_threads=pthreads
155 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
157 libmono_cflags="-D_REENTRANT"
158 libgc_threads=pthreads
162 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
163 libmono_cflags="-D_THREAD_SAFE"
164 LDFLAGS="$LDFLAGS -pthread"
165 libmono_ldflags="-pthread"
167 AC_DEFINE(PTHREAD_POINTER_ID)
168 AC_DEFINE(USE_MACH_SEMA)
169 no_version_script=yes
171 libgc_threads=pthreads
174 AC_MSG_WARN([*** Please add $host to configure.in checks!])
181 if test x$need_link_unlink = xyes; then
182 AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
185 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
187 AC_CHECK_TOOL(CC, gcc, gcc)
191 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
193 # Set ASFLAGS if not already set.
194 : ${CCASFLAGS='$(CFLAGS)'}
198 AC_CHECK_PROG(BISON, bison,yes,no)
199 if test "x$BISON" = "xno";
201 AC_MSG_ERROR([You need to install bison])
204 dnl may require a specific autoconf version
205 dnl AC_PROG_CC_FOR_BUILD
206 dnl CC_FOR_BUILD not automatically detected
209 if test "x$cross_compiling" = "xyes"; then
213 AC_SUBST(CC_FOR_BUILD)
215 AC_SUBST(BUILD_EXEEXT)
222 # Test whenever ld supports -version-script
225 if test "x$lt_cv_prog_gnu_ld" = "xno"; then
226 no_version_script=yes
229 AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
231 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
233 AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
235 AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
237 # for mono/metadata/debug-symfile.c
238 AC_CHECK_HEADERS(elf.h)
241 AC_CHECK_HEADERS(wchar.h)
243 # not 64 bit clean in cross-compile
244 AC_CHECK_SIZEOF(void *, 4)
247 if test x"$GCC" = xyes; then
248 WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
249 # The runtime code does not respect ANSI C strict aliasing rules
250 CFLAGS="$CFLAGS -fno-strict-aliasing"
252 # The Sun Forte compiler complains about inline functions that access static variables
253 # so disable all inlining.
256 CFLAGS="$CFLAGS -Dinline="
260 CFLAGS="$CFLAGS -g $WARN"
262 # Where's the 'mcs' source tree?
263 if test -d $srcdir/mcs; then
269 mcs_topdir='$(top_srcdir)/'$mcsdir
270 mcs_topdir_from_srcdir='$(top_builddir)/'$mcsdir
272 AC_SUBST([mcs_topdir])
273 AC_SUBST([mcs_topdir_from_srcdir])
275 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
276 if test "x$PKG_CONFIG" = "xno"; then
277 AC_MSG_ERROR([You need to install pkg-config])
280 dnl for use on the build system
281 dnl pkg-config is stupid
282 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
283 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
284 AC_SUBST(BUILD_GLIB_CFLAGS)
285 AC_SUBST(BUILD_GLIB_LIBS)
288 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
289 if test x$with_crosspkgdir = "x"; then
290 if test -s $PKG_CONFIG_PATH; then
291 PKG_PATH=$PKG_CONFIG_PATH
294 PKG_PATH=$with_crosspkgdir
295 PKG_CONFIG_PATH=$PKG_PATH
296 export PKG_CONFIG_PATH
300 ## Versions of dependencies
301 GLIB_REQUIRED_VERSION=1.3.11
303 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
305 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
306 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
307 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
308 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
310 AC_SUBST(GLIB_CFLAGS)
312 AC_SUBST(GMODULE_CFLAGS)
313 AC_SUBST(GMODULE_LIBS)
315 if test x$platform_win32 = xyes; then
316 AC_MSG_CHECKING(for cygwin glib2-dev package)
317 if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
319 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.])
321 AC_MSG_RESULT(not found, ok)
324 AC_MSG_CHECKING(for broken gwin32.h)
325 glib_include=`$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`
326 if test -f $glib_include/glib/gwin32.h; then
327 if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
328 AC_MSG_RESULT(failed)
330 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.])
336 AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
338 # Enable support for fast thread-local storage
339 # Some systems have broken support, so we allow to disable it.
340 AC_ARG_WITH(tls, [ --with-tls=__thread,pthread select Thread Local Storage implementation],[],[with_tls=__thread])
342 # Kept for compatibility
343 AC_ARG_WITH(nptl, [ --with-nptl=yes,no deprecated, use --with-tls instead],[],[with_nptl=default])
345 if test "x$with_nptl" != "xdefault"; then
346 if test "x$with_nptl" = "xyes"; then
347 AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.])
350 if test "x$with_nptl" = "xno"; then
351 AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.])
356 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
357 # This does not work on some platforms (bug #55253)
358 AC_ARG_WITH(sigaltstack, [ --with-sigaltstack=yes,no enable/disable support for sigaltstack],[],[with_sigaltstack=no])
360 # assembly bundle support, see metadata/make-bundle.pl for more info
361 AC_ARG_WITH(bundle, [ --with-bundle=bundle_template],[
362 BUNDLE_FILE=$with_bundle
363 AC_SUBST(BUNDLE_FILE)
364 AC_DEFINE(WITH_BUNDLE)
366 AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
374 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
375 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
377 if test "x$found_boehm" != "xyes"; then
378 AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
380 if test "x$gc_headers" != "xyes"; then
381 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
384 AC_DEFINE(HAVE_BOEHM_GC)
385 AC_SUBST(HAVE_BOEHM_GC)
386 LIBGC_LIBS="-lgc $libdl"
387 LIBGC_STATIC_LIBS="$LIBGC_LIBS"
389 # AC_CHECK_FUNCS does not work for some reason...
390 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
391 if test "x$found_gcj_malloc" = "xyes"; then
392 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
394 AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
395 if test "x$found_gc_enable" = "xyes"; then
396 AC_DEFINE(HAVE_GC_ENABLE)
401 AC_CONFIG_SUBDIRS(libgc)
408 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
409 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
410 LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
412 AC_DEFINE(HAVE_BOEHM_GC)
413 AC_SUBST(HAVE_BOEHM_GC)
416 AC_DEFINE(USE_INCLUDED_LIBGC)
418 # The included libgc contains GCJ support
419 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
420 AC_DEFINE(HAVE_GC_ENABLE)
424 AC_MSG_WARN("Compiling mono without GC.")
427 AC_MSG_ERROR([Invalid argument to --with-gc.])
432 # tell libgc/configure about what we want
433 ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads"
435 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
436 AC_SUBST(LIBGC_CFLAGS)
438 AC_SUBST(LIBGC_STATIC_LIBS)
442 dnl End of libgc checks
445 if test x$platform_win32 = xno; then
447 dnl ******************************************************************
448 dnl *** Checks for the IKVM JNI interface library ***
449 dnl ******************************************************************
450 AC_ARG_WITH(ikvm-jni, [ --with-ikvm-jni=yes,no build the IKVM JNI interface library],[with_ikvm_jni=$withval],[with_ikvm_jni=yes])
451 AC_ARG_WITH(jdk, [ --with-jdk=DIRECTORY Use JDK from DIRECTORY],[with_jdk_dir=$withval],[with_jdk_dir=])
454 if test x$with_ikvm_jni = xyes; then
455 AC_MSG_CHECKING([JDK headers])
457 if test x$with_jdk_dir = x; then
458 # Try JAVA_HOME variable
459 if test x$JAVA_HOME != x; then
460 with_jdk_dir=$JAVA_HOME
465 if test -d $with_jdk_dir/include; then
466 jdk_headers_found=yes
468 if test -d $with_jdk_dir/include/linux; then
471 if test -d $with_jdk_dir/include/solaris; then
474 if test -f $with_jdk_dir/include/jni_md.h; then
475 # GNU Classpath sources
486 if test x$jdk_headers_found = xyes; then
487 AC_MSG_RESULT($with_jdk_dir/include $with_jdk_dir/include/$jdk_platform)
489 AC_MSG_RESULT(not found)
492 if test x$jdk_headers_found = xyes; then
493 ikvm_jni_dir=ikvm-jni
494 IKVM_JNI_CFLAGS="-I$with_jdk_dir/include -I$with_jdk_dir/include/$jdk_platform"
498 AC_SUBST(ikvm_jni_dir)
499 AC_SUBST(IKVM_JNI_CFLAGS)
501 AC_CHECK_FUNCS(getgrgid_r)
502 AC_CHECK_FUNCS(getgrnam_r)
503 AC_CHECK_FUNCS(getpwnam_r)
504 AC_CHECK_FUNCS(getpwuid_r)
505 AC_CHECK_FUNCS(getresuid)
506 AC_CHECK_FUNCS(setresuid)
507 AC_CHECK_FUNCS(kqueue)
509 dnl ******************************************************************
510 dnl *** Check for large file support ***
511 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
512 dnl ******************************************************************
514 # Check that off_t can represent 2**63 - 1 correctly, working around
515 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
516 # CPPFLAGS and sets $large_offt to yes if the test succeeds
518 AC_DEFUN(LARGE_FILES, [
519 large_CPPFLAGS=$CPPFLAGS
520 CPPFLAGS="$CPPFLAGS $1"
522 #include <sys/types.h>
524 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
527 int big_off_t=((BIG_OFF_T%2147483629==721) &&
528 (BIG_OFF_T%2147483647==1));
537 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
538 large_CPPFLAGS="$large_CPPFLAGS $1"
543 CPPFLAGS=$large_CPPFLAGS
546 AC_MSG_CHECKING(if off_t is 64 bits wide)
548 if test $large_offt = no; then
549 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
550 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
552 if test $large_offt = no; then
553 AC_MSG_WARN([No 64 bit file size support available])
556 dnl *****************************
557 dnl *** Checks for libsocket ***
558 dnl *****************************
559 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
561 dnl *******************************
562 dnl *** Checks for MSG_NOSIGNAL ***
563 dnl *******************************
564 AC_MSG_CHECKING(for MSG_NOSIGNAL)
565 AC_TRY_COMPILE([#include <sys/socket.h>], [
566 int f = MSG_NOSIGNAL;
570 AC_DEFINE(HAVE_MSG_NOSIGNAL)
572 # We'll have to use signals
576 dnl *****************************
577 dnl *** Checks for SOL_IP ***
578 dnl *****************************
579 AC_MSG_CHECKING(for SOL_IP)
580 AC_TRY_COMPILE([#include <netdb.h>], [
585 AC_DEFINE(HAVE_SOL_IP)
587 # We'll have to use getprotobyname
591 dnl *****************************
592 dnl *** Checks for SOL_IPV6 ***
593 dnl *****************************
594 AC_MSG_CHECKING(for SOL_IPV6)
595 AC_TRY_COMPILE([#include <netdb.h>], [
596 int level = SOL_IPV6;
600 AC_DEFINE(HAVE_SOL_IPV6)
602 # We'll have to use getprotobyname
606 dnl *****************************
607 dnl *** Checks for SOL_TCP ***
608 dnl *****************************
609 AC_MSG_CHECKING(for SOL_TCP)
610 AC_TRY_COMPILE([#include <netdb.h>], [
615 AC_DEFINE(HAVE_SOL_TCP)
617 # We'll have to use getprotobyname
621 dnl *****************************
622 dnl *** Checks for IP_PKTINFO ***
623 dnl *****************************
624 AC_MSG_CHECKING(for IP_PKTINFO)
625 AC_TRY_COMPILE([#include <netdb.h>], [
626 int level = IP_PKTINFO;
630 AC_DEFINE(HAVE_IP_PKTINFO)
635 dnl *********************************
636 dnl *** Check for struct ip_mreqn ***
637 dnl *********************************
638 AC_MSG_CHECKING(for struct ip_mreqn)
639 AC_TRY_COMPILE([#include <netinet/in.h>], [
640 struct ip_mreqn mreq;
641 mreq.imr_address.s_addr = 0;
645 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
647 # We'll just have to try and use struct ip_mreq
649 AC_MSG_CHECKING(for struct ip_mreq)
650 AC_TRY_COMPILE([#include <netinet/in.h>], [
652 mreq.imr_interface.s_addr = 0;
656 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
658 # No multicast support
663 dnl **********************************
664 dnl *** Check for gethostbyname2_r ***
665 dnl **********************************
666 AC_MSG_CHECKING(for gethostbyname2_r)
667 AC_TRY_LINK([#include <netdb.h>], [
668 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
672 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
677 dnl *****************************
678 dnl *** Checks for libnsl ***
679 dnl *****************************
680 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
682 AC_CHECK_FUNCS(inet_pton inet_aton)
684 dnl ***********************************************
685 dnl *** Checks for size of sockaddr_un.sun_path ***
686 dnl ***********************************************
687 # AC_CHECK_SIZEOF can't cope with struct members :-(
688 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
689 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
691 #include <sys/types.h>
696 struct sockaddr_un sock_un;
697 FILE *f=fopen("conftestval", "w");
699 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
702 ], cv_mono_sizeof_sunpath=`cat conftestval`,
703 cv_mono_sizeof_sunpath=0,
704 cv_mono_sizeof_sunpath=0)])dnl
705 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
706 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
708 dnl *************************************
709 dnl *** Checks for zero length arrays ***
710 dnl *************************************
711 AC_MSG_CHECKING(whether $CC supports zero length arrays)
719 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
722 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
725 dnl *****************************
726 dnl *** Checks for libxnet ***
727 dnl *****************************
730 AC_MSG_CHECKING(for Solaris XPG4 support)
731 if test -f /usr/lib/libxnet.so; then
732 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
733 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
734 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
741 if test "$GCC" = "yes"; then
742 CFLAGS="$CFLAGS -Wno-char-subscripts"
747 dnl *****************************
748 dnl *** Checks for libpthread ***
749 dnl *****************************
750 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
751 # and libpthread does not exist
755 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
758 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
761 AC_CHECK_HEADERS(pthread.h)
762 AC_CHECK_FUNCS(pthread_mutex_timedlock)
763 AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
764 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
765 AC_TRY_COMPILE([ #include <pthread.h>], [
766 pthread_mutexattr_t attr;
767 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
772 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
773 AC_DEFINE(USE_MONO_MUTEX)
775 AC_CHECK_FUNCS(pthread_attr_setstacksize)
777 dnl ***********************************
778 dnl *** Checks for working __thread ***
779 dnl ***********************************
780 AC_MSG_CHECKING(for working __thread)
781 if test "x$with_tls" != "x__thread"; then
782 AC_MSG_RESULT(disabled)
788 static int res1, res2;
790 void thread_main (void *arg)
805 pthread_create (&t1, NULL, thread_main, 1);
806 pthread_create (&t2, NULL, thread_main, 2);
808 pthread_join (t1, NULL);
809 pthread_join (t2, NULL);
811 return !(res1 + res2 == 2);
821 dnl **************************************
822 dnl *** Checks for working sigaltstack ***
823 dnl **************************************
824 AC_MSG_CHECKING(for working sigaltstack)
825 if test "x$with_sigaltstack" != "xyes"; then
826 AC_MSG_RESULT(disabled)
834 #include <sys/wait.h>
837 sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
855 struct sigaltstack sas;
859 sa.sa_sigaction = sigsegv_signal_handler;
860 sigemptyset (&sa.sa_mask);
861 sa.sa_flags = SA_SIGINFO | SA_STACK;
862 if (sigaction (SIGSEGV, &sa, NULL) == -1) {
867 sas.ss_sp = malloc (SIGSTKSZ);
868 sas.ss_size = SIGSTKSZ;
869 sas.ss_flags = SS_ONSTACK;
870 if (sigaltstack (&sas, NULL) == -1) {
875 pthread_attr_init (&attr);
876 if (pthread_create(&id, &attr, loop, &attr) != 0) {
901 for (i = 0; i < 3; ++i) {
903 waitpid (son, &status, WNOHANG);
904 if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
914 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
921 dnl ********************************
922 dnl *** Checks for semaphore lib ***
923 dnl ********************************
924 # 'Real Time' functions on Solaris
925 # posix4 on Solaris 2.6
926 # pthread (first!) on Linux
927 AC_SEARCH_LIBS(sem_init, pthread rt posix4)
929 dnl ********************************
930 dnl *** Checks for timezone stuff **
931 dnl ********************************
932 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
938 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
939 if test $ac_cv_struct_tm_gmtoff = yes; then
940 AC_DEFINE(HAVE_TM_GMTOFF)
942 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
947 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
948 if test $ac_cv_var_timezone = yes; then
949 AC_DEFINE(HAVE_TIMEZONE)
951 AC_ERROR(unable to find a way to determine timezone)
955 dnl *********************************
956 dnl *** Checks for math functions ***
957 dnl *********************************
959 AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
960 AC_TRY_LINK([#include <math.h>],
962 AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes),
964 AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
965 AC_TRY_LINK([#include <math.h>],
967 AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
970 dnl ****************************************************************
971 dnl *** Checks for working poll() (macosx defines it but doesn't ***
972 dnl *** have it in the library (duh)) ***
973 dnl ****************************************************************
976 dnl *************************
977 dnl *** Check for signbit ***
978 dnl *************************
979 AC_MSG_CHECKING(for signbit)
980 AC_TRY_LINK([#include <math.h>], [
981 int s = signbit(1.0);
984 AC_DEFINE(HAVE_SIGNBIT)
989 dnl *********************
990 dnl *** Check for AIO ***
991 dnl *********************
992 AC_MSG_CHECKING([for SIGEV_THREAD definition])
993 dnl Some systems (FreeBSD at least) may have aio_read
994 dnl but don't support/define SIGEV_THREAD.
996 #include <sys/signal.h>
998 int x = SIGEV_THREAD;
1000 ac_cv_c_sigev_thread=yes
1006 if test "$ac_cv_c_sigev_thread" = "yes" ; then
1007 AC_CHECK_HEADERS(aio.h sys/aio.h)
1008 AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
1009 SIGVAL_PTR="undefined"
1010 if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
1011 AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
1012 #include <sys/signal.h>
1014 AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
1015 #include <sys/signal.h>
1017 if test "$SIGVAL_PTR" = "undefined" ; then
1018 AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
1021 AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
1024 dnl **********************************
1025 dnl *** Checks for MonoPosixHelper ***
1026 dnl **********************************
1027 AC_CHECK_FUNCS(posix_fadvise)
1028 AC_CHECK_FUNCS(posix_fallocate)
1029 AC_CHECK_FUNCS(fgetgrent)
1030 AC_CHECK_FUNCS(fgetpwent)
1031 AC_CHECK_FUNCS(fgetpwent)
1032 AC_CHECK_HEADERS(sys/sendfile.h)
1033 AC_CHECK_FUNCS(sendfile)
1034 AC_CHECK_FUNCS(stime)
1035 AC_CHECK_FUNCS(ttyname_r)
1036 AC_CHECK_SIZEOF(size_t)
1038 jdk_headers_found=no
1039 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
1040 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
1041 AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
1043 dnl *********************************
1044 dnl *** Check for struct ip_mreqn ***
1045 dnl *********************************
1046 AC_MSG_CHECKING(for struct ip_mreqn)
1047 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1048 struct ip_mreqn mreq;
1049 mreq.imr_address.s_addr = 0;
1051 # Yes, we have it...
1053 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
1055 # We'll just have to try and use struct ip_mreq
1057 AC_MSG_CHECKING(for struct ip_mreq)
1058 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1059 struct ip_mreq mreq;
1060 mreq.imr_interface.s_addr = 0;
1062 # Yes, we have it...
1064 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
1066 # No multicast support
1073 AC_MSG_CHECKING(for socklen_t)
1075 #include <sys/types.h>
1076 #include <sys/socket.h>
1080 ac_cv_c_socklen_t=yes
1081 AC_DEFINE(HAVE_SOCKLEN_T)
1087 AC_MSG_CHECKING(for array element initalizer support)
1088 AC_TRY_COMPILE([#include <sys/socket.h>], [
1089 const int array[] = {[1] = 2,};
1091 # Yes, we have it...
1093 AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1095 # We'll have to use signals
1099 AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
1100 # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1101 AC_TRY_LINK([#include <math.h>],
1102 [ static void *p = &trunc; ],
1104 AC_DEFINE(HAVE_TRUNC)
1110 if test "x$ac_cv_truncl" != "xyes"; then
1111 AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL) LIBS="$LIBS -lsunmath"])
1114 dnl ****************************
1115 dnl *** Look for /dev/random ***
1116 dnl ****************************
1118 AC_MSG_CHECKING([if usage of random device is requested])
1119 AC_ARG_ENABLE(dev-random,
1120 [ --disable-dev-random disable the use of the random device],
1121 try_dev_random=$enableval, try_dev_random=yes)
1122 AC_MSG_RESULT($try_dev_random)
1126 NAME_DEV_RANDOM="/dev/srandom"
1129 dnl Win32 does not have /dev/random, they have their own method...
1131 *-*-mingw*|*-*-cygwin*)
1132 ac_cv_have_dev_random=no
1135 dnl Everywhere else, it's /dev/random
1138 NAME_DEV_RANDOM="/dev/random"
1142 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
1144 dnl Now check if the device actually exists
1146 if test "x$try_dev_random" = "xyes"; then
1147 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1148 [if test -r "$NAME_DEV_RANDOM" ; then
1149 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1150 if test "x$ac_cv_have_dev_random" = "xyes"; then
1151 AC_DEFINE(HAVE_CRYPT_RNG)
1154 AC_MSG_CHECKING(for random device)
1155 ac_cv_have_dev_random=no
1156 AC_MSG_RESULT(has been disabled)
1159 if test "x$platform_win32" = "xyes"; then
1160 AC_DEFINE(HAVE_CRYPT_RNG)
1163 if test "x$ac_cv_have_dev_random" = "xno" \
1164 && test "x$platform_win32" = "xno"; then
1167 *** A system-provided entropy source was not found on this system.
1168 *** Because of this, the System.Security.Cryptography random number generator
1169 *** will throw a NotImplemented exception.
1171 *** If you are seeing this message, and you know your system DOES have an
1172 *** entropy collection in place, please contact <crichton@gimp.org> and
1173 *** provide information about the system and how to access the random device.
1175 *** Otherwise you can install either egd or prngd and set the environment
1176 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1180 AC_MSG_CHECKING([if inter-process shared handles are requested])
1181 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
1182 AC_MSG_RESULT($try_shared_handles)
1183 if test "x$try_shared_handles" != "xyes"; then
1184 AC_DEFINE(DISABLE_SHARED_HANDLES)
1185 AC_SUBST(DISABLE_SHARED_HANDLES)
1196 AC_ARG_WITH(icu, [ --with-icu=yes/no],
1197 if test x$with_icu = xno; then
1199 AC_MSG_RESULT(Will not probe for ICU)
1204 AC_PATH_PROG(ICU_CONFIG, icu-config, no)
1205 if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
1206 AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
1207 enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
1209 enable_icu="yes. Version: `$ICU_CONFIG --version`"
1211 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
1212 ICU_LIBS=`$ICU_CONFIG --ldflags`
1215 AC_SUBST(ICU_CFLAGS)
1219 ACCESS_UNALIGNED="yes"
1227 # mips-sgi-irix5.* | mips-sgi-irix6.*)
1229 # ACCESS_UNALIGNED="no"
1237 x86_64-*-* | amd64-*-*)
1244 if test "x$ac_cv_sizeof_void_p" = "x8"; then
1251 ACCESS_UNALIGNED="no"
1256 alpha*-*-linux* | alpha*-*-osf*)
1258 ACCESS_UNALIGNED="no"
1262 # ia64-*-linux* | ia64-*-hpux*)
1266 # ACCESS_UNALIGNED="no";
1267 # case "$host_os" in
1268 # linux*) LIBC="libc.so.6.1";;
1269 # hpux*) LIBC="libc.so.1";;
1275 hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
1279 ACCESS_UNALIGNED="no"
1284 ACCESS_UNALIGNED="no"
1286 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
1287 powerpc-*-sysv* | powerpc-*-darwin*)
1293 arm-*-linux-* | armv4l-*-linux-*)
1296 ACCESS_UNALIGNED="no"
1301 ACCESS_UNALIGNED="no"
1307 ACCESS_UNALIGNED="no"
1312 AC_ARG_WITH(jit, [ --with-jit=yes,no If you want to build scripts that default to the JIT],[
1313 if test x$withval = xyes; then
1321 if test x$JIT_SUPPORTED = xyes; then
1322 if $jit_wanted; then
1324 jit_status="Building and using the JIT"
1326 jit_status="Building the JIT, defaulting to the interpreter"
1329 jit_status="interpreter"
1332 AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
1340 INTL="libintl.dylib"
1357 if test "x$TARGET" != "xAMD64"; then
1358 # valgrind headers don't compile under x86-64
1359 AC_CHECK_HEADERS(valgrind/memcheck.h)
1362 if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
1363 if test "x$with_tls" = "x__thread"; then
1365 # On some linux distributions, TLS works in executables, but linking
1366 # against a shared library containing TLS fails with:
1367 # undefined reference to `__tls_get_addr'
1369 rm -f conftest.c conftest.so conftest
1370 echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
1371 gcc -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
1372 gcc -o conftest conftest.so > /dev/null 2>&1
1373 if test ! -f conftest; then
1374 AC_MSG_WARN([Disabling usage of __thread.]);
1377 rm -f conftest.c conftest.so conftest
1381 if test "x$with_tls" = "x__thread"; then
1382 AC_DEFINE(HAVE_KW_THREAD)
1383 # Pass the information to libgc
1384 CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
1388 if test ${TARGET} = ARM; then
1389 dnl ******************************************
1390 dnl *** Check to see what FPU is available ***
1391 dnl ******************************************
1392 AC_MSG_CHECKING(which FPU to use)
1394 AC_TRY_COMPILE([], [
1395 __asm__ ("ldfd f0, [r0]");
1397 AC_TRY_COMPILE([], [
1398 __asm__ ("fldd d0, [r0]");
1399 ], fpu=VFP, fpu=NONE)
1403 CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
1407 if test ${TARGET} = unknown; then
1408 CPPFLAGS="$CPPFLAGS -DNO_PORT"
1409 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
1412 if test ${ACCESS_UNALIGNED} = no; then
1413 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
1417 AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to install the 2.0 FX preview],[
1418 if test x$with_preview = xyes; then
1423 AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
1425 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1426 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1427 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1428 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
1429 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1430 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
1431 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
1432 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
1433 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
1434 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
1435 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1436 AM_CONDITIONAL(S390, test x$TARGET = xS390)
1437 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
1438 AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
1440 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
1441 AM_CONDITIONAL(INCLUDED_LIBGC, test x$gc = xincluded)
1446 AC_SUBST(arch_target)
1457 mono/metadata/Makefile
1462 mono/os/win32/Makefile
1463 mono/os/unix/Makefile
1464 mono/arch/x86/Makefile
1465 mono/arch/amd64/Makefile
1466 mono/arch/hppa/Makefile
1467 mono/arch/ppc/Makefile
1468 mono/arch/sparc/Makefile
1469 mono/arch/s390/Makefile
1470 mono/arch/s390x/Makefile
1471 mono/arch/arm/Makefile
1472 mono/arch/alpha/Makefile
1473 mono/interpreter/Makefile
1475 mono/tests/tests-config
1476 mono/benchmark/Makefile
1477 mono/monoburg/Makefile
1478 mono/monograph/Makefile
1479 mono/io-layer/Makefile
1480 mono/handles/Makefile
1482 mono/profiler/Makefile
1485 runtime/net_1_1/Makefile
1486 runtime/net_2_0/Makefile
1492 data/net_1_1/Makefile
1493 data/net_2_0/Makefile
1499 tools/locale-builder/Makefile
1503 mcs source: $mcs_topdir
1507 SIGALTSTACK: $with_sigaltstack
1510 JNI support: $jdk_headers_found