3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,0.26)
15 if test -d $srcdir/libgc ; then
22 # These are the flags that need to be stored in the mono.pc file for
23 # compiling code that will embed Mono
27 AC_SUBST(libmono_cflags)
28 AC_SUBST(libmono_ldflags)
30 # Thread configuration inspired by sleepycat's db
31 AC_MSG_CHECKING([host platform characteristics])
34 *-*-mingw*|*-*-cygwin*)
36 AC_DEFINE(PLATFORM_WIN32)
39 # latest libgc already defines GC_WIN32_THREADS
40 # CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
41 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
48 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
49 libmono_cflags="-D_REENTRANT"
50 LDFLAGS="$LDFLAGS -pthread"
51 libmono_ldflags="-pthread"
52 AC_DEFINE(NEED_LINK_UNLINK)
54 libgc_threads=pthreads
56 *-*-*freebsd*|*-*-*openbsd*)
58 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
59 libmono_cflags="-D_THREAD_SAFE"
60 LDFLAGS="$LDFLAGS -pthread"
61 libmono_ldflags="-pthread"
62 AC_DEFINE(NEED_LINK_UNLINK)
63 AC_DEFINE(PTHREAD_POINTER_ID)
65 libgc_threads=pthreads
69 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
70 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
71 libmono_ldflags="-lpthread"
73 libgc_threads=pthreads
77 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
78 libmono_cflags="-D_REENTRANT"
79 libmono_ldflags="-lpthread"
80 libgc_threads=pthreads
81 AC_DEFINE(NEED_LINK_UNLINK)
85 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
86 AC_DEFINE(NEED_LINK_UNLINK)
87 libmono_cflags="-D_REENTRANT"
88 libgc_threads=pthreads
92 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
93 libmono_cflags="-D_THREAD_SAFE"
94 LDFLAGS="$LDFLAGS -pthread"
95 libmono_ldflags="-pthread"
96 AC_DEFINE(NEED_LINK_UNLINK)
97 AC_DEFINE(PTHREAD_POINTER_ID)
103 AC_MSG_WARN([*** Please add $host to configure.in checks!])
109 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
111 AC_CHECK_TOOL(CC, gcc, gcc)
115 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
117 # Set ASFLAGS if not already set.
118 : ${CCASFLAGS='$(CFLAGS)'}
122 AC_CHECK_PROG(BISON, bison,yes,no)
123 if test "x$BISON" = "xno";
125 AC_MSG_ERROR([You need to install bison])
128 dnl may require a specific autoconf version
129 dnl AC_PROG_CC_FOR_BUILD
130 dnl CC_FOR_BUILD not automatically detected
133 if test "x$cross_compiling" = "xyes"; then
137 AC_SUBST(CC_FOR_BUILD)
139 AC_SUBST(BUILD_EXEEXT)
146 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
148 # for mono/metadata/debug-symfile.c
149 AC_CHECK_HEADERS(elf.h)
152 AC_CHECK_HEADERS(wchar.h)
154 # not 64 bit clean in cross-compile
155 AC_CHECK_SIZEOF(void *, 4)
158 if test x"$GCC" = xyes; then
159 WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
163 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
164 if test "x$PKG_CONFIG" = "xno"; then
165 AC_MSG_ERROR([You need to install pkg-config])
168 dnl for use on the build system
169 dnl pkg-config is stupid
170 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
171 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
172 AC_SUBST(BUILD_GLIB_CFLAGS)
173 AC_SUBST(BUILD_GLIB_LIBS)
176 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
177 if test x$with_crosspkgdir = "x"; then
178 if test -s $PKG_CONFIG_PATH; then
179 PKG_PATH=$PKG_CONFIG_PATH
182 PKG_PATH=$with_crosspkgdir
183 PKG_CONFIG_PATH=$PKG_PATH
184 export PKG_CONFIG_PATH
188 ## Versions of dependencies
189 GLIB_REQUIRED_VERSION=1.3.11
191 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
193 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
194 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
195 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
196 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
198 AC_SUBST(GLIB_CFLAGS)
200 AC_SUBST(GMODULE_CFLAGS)
201 AC_SUBST(GMODULE_LIBS)
203 AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
205 # assembly bundle support, see metadata/make-bundle.pl for more info
206 AC_ARG_WITH(bundle, [ --with-bundle=bundle_template],[
207 BUNDLE_FILE=$with_bundle
208 AC_SUBST(BUNDLE_FILE)
209 AC_DEFINE(WITH_BUNDLE)
211 AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
218 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
219 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
221 if test "x$found_boehm" != "xyes"; then
222 AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
224 if test "x$gc_headers" != "xyes"; then
225 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
228 AC_DEFINE(HAVE_BOEHM_GC)
229 AC_SUBST(HAVE_BOEHM_GC)
230 LIBGC_LIBS="-lgc $libdl"
232 # AC_CHECK_FUNCS does not work for some reason...
233 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
234 if test "x$found_gcj_malloc" = "xyes"; then
235 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
240 AC_CONFIG_SUBDIRS(libgc)
247 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
248 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
250 AC_DEFINE(HAVE_BOEHM_GC)
251 AC_SUBST(HAVE_BOEHM_GC)
254 AC_DEFINE(USE_INCLUDED_LIBGC)
256 # The included libgc contains GCJ support
257 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
261 AC_MSG_WARN("Compiling mono without GC.")
264 AC_MSG_ERROR([Invalid argument to --with-gc.])
268 we_are_embedded_in_mono=yes
269 export we_are_embedded_in_mono
272 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
273 AC_SUBST(LIBGC_CFLAGS)
278 dnl End of libgc checks
281 if test x$platform_win32 = xno; then
282 dnl ******************************************************************
283 dnl *** Check for large file support ***
284 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
285 dnl ******************************************************************
287 # Check that off_t can represent 2**63 - 1 correctly, working around
288 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
289 # CPPFLAGS and sets $large_offt to yes if the test succeeds
291 AC_DEFUN(LARGE_FILES, [
292 large_CPPFLAGS=$CPPFLAGS
293 CPPFLAGS="$CPPFLAGS $1"
295 #include <sys/types.h>
297 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
300 int big_off_t=((BIG_OFF_T%2147483629==721) &&
301 (BIG_OFF_T%2147483647==1));
310 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
311 large_CPPFLAGS="$large_CPPFLAGS $1"
316 CPPFLAGS=$large_CPPFLAGS
319 AC_MSG_CHECKING(if off_t is 64 bits wide)
321 if test $large_offt = no; then
322 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
323 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
325 if test $large_offt = no; then
326 AC_MSG_WARN([No 64 bit file size support available])
329 dnl *****************************
330 dnl *** Checks for libsocket ***
331 dnl *****************************
332 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
334 dnl *******************************
335 dnl *** Checks for MSG_NOSIGNAL ***
336 dnl *******************************
337 AC_MSG_CHECKING(for MSG_NOSIGNAL)
338 AC_TRY_COMPILE([#include <sys/socket.h>], [
339 int f = MSG_NOSIGNAL;
343 AC_DEFINE(HAVE_MSG_NOSIGNAL)
345 # We'll have to use signals
349 dnl *****************************
350 dnl *** Checks for SOL_IP ***
351 dnl *****************************
352 AC_MSG_CHECKING(for SOL_IP)
353 AC_TRY_COMPILE([#include <netdb.h>], [
358 AC_DEFINE(HAVE_SOL_IP)
360 # We'll have to use getprotobyname
364 dnl *****************************
365 dnl *** Checks for SOL_IPV6 ***
366 dnl *****************************
367 AC_MSG_CHECKING(for SOL_IPV6)
368 AC_TRY_COMPILE([#include <netdb.h>], [
369 int level = SOL_IPV6;
373 AC_DEFINE(HAVE_SOL_IPV6)
375 # We'll have to use getprotobyname
379 dnl *****************************
380 dnl *** Checks for SOL_TCP ***
381 dnl *****************************
382 AC_MSG_CHECKING(for SOL_TCP)
383 AC_TRY_COMPILE([#include <netdb.h>], [
388 AC_DEFINE(HAVE_SOL_TCP)
390 # We'll have to use getprotobyname
394 dnl *****************************
395 dnl *** Checks for IP_PKTINFO ***
396 dnl *****************************
397 AC_MSG_CHECKING(for IP_PKTINFO)
398 AC_TRY_COMPILE([#include <netdb.h>], [
399 int level = IP_PKTINFO;
403 AC_DEFINE(HAVE_IP_PKTINFO)
408 dnl *********************************
409 dnl *** Check for struct ip_mreqn ***
410 dnl *********************************
411 AC_MSG_CHECKING(for struct ip_mreqn)
412 AC_TRY_COMPILE([#include <netinet/in.h>], [
413 struct ip_mreqn mreq;
414 mreq.imr_address.s_addr = 0;
418 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
420 # We'll just have to try and use struct ip_mreq
422 AC_MSG_CHECKING(for struct ip_mreq)
423 AC_TRY_COMPILE([#include <netinet/in.h>], [
425 mreq.imr_interface.s_addr = 0;
429 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
431 # No multicast support
436 dnl **********************************
437 dnl *** Check for gethostbyname2_r ***
438 dnl **********************************
439 AC_MSG_CHECKING(for gethostbyname2_r)
440 AC_TRY_LINK([#include <netdb.h>], [
441 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
445 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
448 dnl *****************************
449 dnl *** Checks for libnsl ***
450 dnl *****************************
451 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
453 AC_CHECK_FUNCS(inet_pton inet_aton)
455 dnl ***********************************************
456 dnl *** Checks for size of sockaddr_un.sun_path ***
457 dnl ***********************************************
458 # AC_CHECK_SIZEOF can't cope with struct members :-(
459 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
460 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
462 #include <sys/types.h>
467 struct sockaddr_un sock_un;
468 FILE *f=fopen("conftestval", "w");
470 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
473 ], cv_mono_sizeof_sunpath=`cat conftestval`,
474 cv_mono_sizeof_sunpath=0,
475 cv_mono_sizeof_sunpath=0)])dnl
476 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
477 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
479 dnl *************************************
480 dnl *** Checks for zero length arrays ***
481 dnl *************************************
482 AC_MSG_CHECKING(whether $CC supports zero length arrays)
490 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
493 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
496 dnl *****************************
497 dnl *** Checks for libxnet ***
498 dnl *****************************
501 AC_MSG_CHECKING(for Solaris XPG4 support)
502 if test -f /usr/lib/libxnet.so; then
503 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
504 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
505 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
512 if test "$GCC" = "yes"; then
513 CFLAGS="$CFLAGS -Wno-char-subscripts"
518 dnl *****************************
519 dnl *** Checks for libpthread ***
520 dnl *****************************
521 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
522 AC_CHECK_FUNCS(pthread_mutex_timedlock)
523 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
524 AC_TRY_COMPILE([ #include <pthread.h>], [
525 pthread_mutexattr_t attr;
526 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
531 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
532 AC_DEFINE(USE_MONO_MUTEX)
535 dnl ********************************
536 dnl *** Checks for semaphore lib ***
537 dnl ********************************
538 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
540 dnl ********************************
541 dnl *** Checks for timezone stuff **
542 dnl ********************************
543 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
549 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
550 if test $ac_cv_struct_tm_gmtoff = yes; then
551 AC_DEFINE(HAVE_TM_GMTOFF)
553 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
558 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
559 if test $ac_cv_var_timezone = yes; then
560 AC_DEFINE(HAVE_TIMEZONE)
562 AC_ERROR(unable to find a way to determine timezone)
566 dnl ****************************************************************
567 dnl *** Checks for working poll() (macosx defines it but doesn't ***
568 dnl *** have it in the library (duh)) ***
569 dnl ****************************************************************
572 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
573 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
576 dnl ****************************
577 dnl *** Look for /dev/random ***
578 dnl ****************************
580 AC_MSG_CHECKING([if usage of random device is requested])
581 AC_ARG_ENABLE(dev-random,
582 [ --disable-dev-random disable the use of the random device],
583 try_dev_random=$enableval, try_dev_random=yes)
584 AC_MSG_RESULT($try_dev_random)
588 NAME_DEV_RANDOM="/dev/srandom"
591 dnl Win32 does not have /dev/random, they have their own method...
593 *-*-mingw*|*-*-cygwin*)
594 ac_cv_have_dev_random = no
597 dnl Everywhere else, it's /dev/random
600 NAME_DEV_RANDOM="/dev/random"
604 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
606 dnl Now check if the device actually exists
608 if test "x$try_dev_random" = "xyes"; then
609 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
610 [if test -r "$NAME_DEV_RANDOM" ; then
611 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
612 if test "x$ac_cv_have_dev_random" = "xyes"; then
613 AC_DEFINE(HAVE_CRYPT_RNG)
616 AC_MSG_CHECKING(for random device)
617 ac_cv_have_dev_random=no
618 AC_MSG_RESULT(has been disabled)
621 if test "x$platform_win32" = "xyes"; then
622 AC_DEFINE(HAVE_CRYPT_RNG)
625 if test "x$ac_cv_have_dev_random" = "xno" \
626 && test "x$platform_win32" = "xno"; then
629 *** A system-provided entropy source was not found on this system.
630 *** Because of this, the System.Security.Cryptography random number generator
631 *** will throw a NotImplemented exception.
633 *** If you are seeing this message, and you know your system DOES have an
634 *** entropy collection in place, please contact <crichton@gimp.org> and
635 *** provide information about the system and how to access the random device.
637 *** For those systems who lack a random device, EGD support is forthcoming.
641 AC_MSG_CHECKING([if inter-process shared handles are requested])
642 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
643 AC_MSG_RESULT($try_shared_handles)
644 if test "x$try_shared_handles" != "xyes"; then
645 AC_DEFINE(DISABLE_SHARED_HANDLES)
646 AC_SUBST(DISABLE_SHARED_HANDLES)
650 ACCESS_UNALIGNED="yes"
656 # mips-sgi-irix5.* | mips-sgi-irix6.*)
658 # ACCESS_UNALIGNED="no"
668 ACCESS_UNALIGNED="no"
670 # alpha*-*-linux* | alpha*-*-osf*)
672 # ACCESS_UNALIGNED="no"
674 # ia64-*-linux* | ia64-*-hpux*)
678 # ACCESS_UNALIGNED="no";
680 # linux*) LIBC="libc.so.6.1";;
681 # hpux*) LIBC="libc.so.1";;
687 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
688 powerpc-*-sysv* | powerpc-*-darwin*)
693 arm-*-linux-* | armv4l-*-linux-*)
696 ACCESS_UNALIGNED="no"
701 ACCESS_UNALIGNED="no"
705 if test ${TARGET} = ARM; then
706 dnl ******************************************
707 dnl *** Check to see what FPU is available ***
708 dnl ******************************************
709 AC_MSG_CHECKING(which FPU to use)
712 __asm__ ("ldfd f0, [r0]");
715 __asm__ ("fldd d0, [r0]");
716 ], fpu=VFP, fpu=NONE)
720 CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
724 if test ${TARGET} = unknown; then
725 CPPFLAGS="$CPPFLAGS -DNO_PORT"
726 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
729 if test ${ACCESS_UNALIGNED} = no; then
730 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
733 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
734 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
735 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
736 AM_CONDITIONAL(X86, test x$TARGET = xX86)
737 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
738 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
739 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
740 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
741 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
742 AM_CONDITIONAL(S390, test x$TARGET = xS390)
744 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
748 AC_SUBST(arch_target)
758 mono/metadata/Makefile
763 mono/os/win32/Makefile
764 mono/os/unix/Makefile
765 mono/arch/x86/Makefile
766 mono/arch/ppc/Makefile
767 mono/arch/sparc/Makefile
768 mono/arch/s390/Makefile
769 mono/arch/arm/Makefile
770 mono/arch/alpha/Makefile
771 mono/interpreter/Makefile
773 mono/tests/tests-config
774 mono/benchmark/Makefile
775 mono/monoburg/Makefile
776 mono/monograph/Makefile
777 mono/io-layer/Makefile
778 mono/handles/Makefile
780 mono/profiler/Makefile