3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,0.25)
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_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
78 AC_DEFINE(NEED_LINK_UNLINK)
79 libmono_cflags="-D_REENTRANT"
84 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
85 libmono_cflags="-D_THREAD_SAFE"
86 LDFLAGS="$LDFLAGS -pthread"
87 libmono_ldflags="-pthread"
88 AC_DEFINE(NEED_LINK_UNLINK)
89 AC_DEFINE(PTHREAD_POINTER_ID)
95 AC_MSG_WARN([*** Please add $host to configure.in checks!])
101 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
103 AC_CHECK_TOOL(CC, gcc, gcc)
107 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
109 # Set ASFLAGS if not already set.
110 : ${CCASFLAGS='$(CFLAGS)'}
114 AC_CHECK_PROG(BISON, bison,yes,no)
115 if test "x$BISON" = "xno";
117 AC_MSG_ERROR([You need to install bison])
120 dnl may require a specific autoconf version
121 dnl AC_PROG_CC_FOR_BUILD
122 dnl CC_FOR_BUILD not automatically detected
125 if test "x$cross_compiling" = "xyes"; then
129 AC_SUBST(CC_FOR_BUILD)
131 AC_SUBST(BUILD_EXEEXT)
138 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
140 # for mono/metadata/debug-symfile.c
141 AC_CHECK_HEADERS(elf.h)
144 AC_CHECK_HEADERS(wchar.h)
146 # not 64 bit clean in cross-compile
147 AC_CHECK_SIZEOF(void *, 4)
149 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
151 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
152 if test "x$PKG_CONFIG" = "xno"; then
153 AC_MSG_ERROR([You need to install pkg-config])
156 dnl for use on the build system
157 dnl pkg-config is stupid
158 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
159 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
160 AC_SUBST(BUILD_GLIB_CFLAGS)
161 AC_SUBST(BUILD_GLIB_LIBS)
164 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
165 if test x$with_crosspkgdir = "x"; then
166 if test -s $PKG_CONFIG_PATH; then
167 PKG_PATH=$PKG_CONFIG_PATH
170 PKG_PATH=$with_crosspkgdir
171 PKG_CONFIG_PATH=$PKG_PATH
172 export PKG_CONFIG_PATH
176 ## Versions of dependencies
177 GLIB_REQUIRED_VERSION=1.3.11
179 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
181 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
182 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
183 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
184 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
186 AC_SUBST(GLIB_CFLAGS)
188 AC_SUBST(GMODULE_CFLAGS)
189 AC_SUBST(GMODULE_LIBS)
191 AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
193 # assembly bundle support, see metadata/make-bundle.pl for more info
194 AC_ARG_WITH(bundle, [ --with-bundle=bundle_template],[
195 BUNDLE_FILE=$with_bundle
196 AC_SUBST(BUNDLE_FILE)
197 AC_DEFINE(WITH_BUNDLE)
199 AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
206 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
207 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
209 if test "x$found_boehm" != "xyes"; then
210 AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
212 if test "x$gc_headers" != "xyes"; then
213 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
216 AC_DEFINE(HAVE_BOEHM_GC)
217 AC_SUBST(HAVE_BOEHM_GC)
218 LIBGC_LIBS="-lgc $libdl"
220 AC_CHECK_FUNCS(GC_gcj_malloc)
224 AC_CONFIG_SUBDIRS(libgc)
231 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
232 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
234 AC_DEFINE(HAVE_BOEHM_GC)
235 AC_SUBST(HAVE_BOEHM_GC)
238 AC_DEFINE(USE_INCLUDED_LIBGC)
240 # The included libgc contains GCJ support
241 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
245 AC_MSG_WARN("Compiling mono without GC.")
248 AC_MSG_ERROR([Invalid argument to --with-gc.])
252 we_are_embedded_in_mono=yes
253 export we_are_embedded_in_mono
256 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
257 AC_SUBST(LIBGC_CFLAGS)
262 dnl End of libgc checks
265 if test x$platform_win32 = xno; then
266 dnl ******************************************************************
267 dnl *** Check for large file support ***
268 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
269 dnl ******************************************************************
271 # Check that off_t can represent 2**63 - 1 correctly, working around
272 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
273 # CPPFLAGS and sets $large_offt to yes if the test succeeds
275 AC_DEFUN(LARGE_FILES, [
276 large_CPPFLAGS=$CPPFLAGS
277 CPPFLAGS="$CPPFLAGS $1"
279 #include <sys/types.h>
281 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
284 int big_off_t=((BIG_OFF_T%2147483629==721) &&
285 (BIG_OFF_T%2147483647==1));
294 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
295 large_CPPFLAGS="$large_CPPFLAGS $1"
300 CPPFLAGS=$large_CPPFLAGS
303 AC_MSG_CHECKING(if off_t is 64 bits wide)
305 if test $large_offt = no; then
306 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
307 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
309 if test $large_offt = no; then
310 AC_MSG_WARN([No 64 bit file size support available])
313 dnl *****************************
314 dnl *** Checks for libsocket ***
315 dnl *****************************
316 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
318 dnl *******************************
319 dnl *** Checks for MSG_NOSIGNAL ***
320 dnl *******************************
321 AC_MSG_CHECKING(for MSG_NOSIGNAL)
322 AC_TRY_COMPILE([#include <sys/socket.h>], [
323 int f = MSG_NOSIGNAL;
327 AC_DEFINE(HAVE_MSG_NOSIGNAL)
329 # We'll have to use signals
333 dnl *****************************
334 dnl *** Checks for SOL_IP ***
335 dnl *****************************
336 AC_MSG_CHECKING(for SOL_IP)
337 AC_TRY_COMPILE([#include <netdb.h>], [
342 AC_DEFINE(HAVE_SOL_IP)
344 # We'll have to use getprotobyname
348 dnl *****************************
349 dnl *** Checks for SOL_TCP ***
350 dnl *****************************
351 AC_MSG_CHECKING(for SOL_TCP)
352 AC_TRY_COMPILE([#include <netdb.h>], [
357 AC_DEFINE(HAVE_SOL_TCP)
359 # We'll have to use getprotobyname
363 dnl *****************************
364 dnl *** Checks for IP_PKTINFO ***
365 dnl *****************************
366 AC_MSG_CHECKING(for IP_PKTINFO)
367 AC_TRY_COMPILE([#include <netdb.h>], [
368 int level = IP_PKTINFO;
372 AC_DEFINE(HAVE_IP_PKTINFO)
377 dnl *********************************
378 dnl *** Check for struct ip_mreqn ***
379 dnl *********************************
380 AC_MSG_CHECKING(for struct ip_mreqn)
381 AC_TRY_COMPILE([#include <netinet/in.h>], [
382 struct ip_mreqn mreq;
383 mreq.imr_address.s_addr = 0;
387 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
389 # We'll just have to try and use struct ip_mreq
391 AC_MSG_CHECKING(for struct ip_mreq)
392 AC_TRY_COMPILE([#include <netinet/in.h>], [
394 mreq.imr_interface.s_addr = 0;
398 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
400 # No multicast support
405 dnl **********************************
406 dnl *** Check for gethostbyname2_r ***
407 dnl **********************************
408 AC_MSG_CHECKING(for gethostbyname2_r)
409 AC_TRY_COMPILE([#include <netdb.h>], [
410 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
414 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
417 dnl *****************************
418 dnl *** Checks for libnsl ***
419 dnl *****************************
420 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
422 AC_CHECK_FUNCS(inet_pton inet_aton)
424 dnl ***********************************************
425 dnl *** Checks for size of sockaddr_un.sun_path ***
426 dnl ***********************************************
427 # AC_CHECK_SIZEOF can't cope with struct members :-(
428 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
429 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
431 #include <sys/types.h>
436 struct sockaddr_un sock_un;
437 FILE *f=fopen("conftestval", "w");
439 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
442 ], cv_mono_sizeof_sunpath=`cat conftestval`,
443 cv_mono_sizeof_sunpath=0,
444 cv_mono_sizeof_sunpath=0)])dnl
445 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
446 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
448 dnl *****************************
449 dnl *** Checks for libxnet ***
450 dnl *****************************
453 AC_MSG_CHECKING(for Solaris XPG4 support)
454 if test -f /usr/lib/libxnet.so; then
455 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
456 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
457 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
464 if test "$GCC" = "yes"; then
465 CFLAGS="$CFLAGS -Wno-char-subscripts"
470 dnl *****************************
471 dnl *** Checks for libpthread ***
472 dnl *****************************
473 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
474 AC_CHECK_FUNCS(pthread_mutex_timedlock)
475 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
476 AC_TRY_COMPILE([ #include <pthread.h>], [
477 pthread_mutexattr_t attr;
478 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
483 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
484 AC_DEFINE(USE_MONO_MUTEX)
487 dnl ********************************
488 dnl *** Checks for semaphore lib ***
489 dnl ********************************
490 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
492 dnl ********************************
493 dnl *** Checks for timezone stuff **
494 dnl ********************************
495 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
501 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
502 if test $ac_cv_struct_tm_gmtoff = yes; then
503 AC_DEFINE(HAVE_TM_GMTOFF)
505 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
510 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
511 if test $ac_cv_var_timezone = yes; then
512 AC_DEFINE(HAVE_TIMEZONE)
514 AC_ERROR(unable to find a way to determine timezone)
518 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
519 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
522 dnl ****************************
523 dnl *** Look for /dev/random ***
524 dnl ****************************
526 AC_MSG_CHECKING([if usage of random device is requested])
527 AC_ARG_ENABLE(dev-random,
528 [ --disable-dev-random disable the use of the random device],
529 try_dev_random=$enableval, try_dev_random=yes)
530 AC_MSG_RESULT($try_dev_random)
534 NAME_DEV_RANDOM="/dev/srandom"
537 dnl Win32 does not have /dev/random, they have their own method...
539 *-*-mingw*|*-*-cygwin*)
540 ac_cv_have_dev_random = no
543 dnl Everywhere else, it's /dev/random
546 NAME_DEV_RANDOM="/dev/random"
550 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
552 dnl Now check if the device actually exists
554 if test "x$try_dev_random" = "xyes"; then
555 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
556 [if test -r "$NAME_DEV_RANDOM" ; then
557 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
558 if test "x$ac_cv_have_dev_random" = "xyes"; then
559 AC_DEFINE(HAVE_CRYPT_RNG)
562 AC_MSG_CHECKING(for random device)
563 ac_cv_have_dev_random=no
564 AC_MSG_RESULT(has been disabled)
567 if test "x$platform_win32" = "xyes"; then
568 AC_DEFINE(HAVE_CRYPT_RNG)
571 if test "x$ac_cv_have_dev_random" = "xno" \
572 && test "x$platform_win32" = "xno"; then
575 *** A system-provided entropy source was not found on this system.
576 *** Because of this, the System.Security.Cryptography random number generator
577 *** will throw a NotImplemented exception.
579 *** If you are seeing this message, and you know your system DOES have an
580 *** entropy collection in place, please contact <crichton@gimp.org> and
581 *** provide information about the system and how to access the random device.
583 *** For those systems who lack a random device, EGD support is forthcoming.
587 AC_MSG_CHECKING([if inter-process shared handles are requested])
588 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
589 AC_MSG_RESULT($try_shared_handles)
590 if test "x$try_shared_handles" != "xyes"; then
591 AC_DEFINE(DISABLE_SHARED_HANDLES)
592 AC_SUBST(DISABLE_SHARED_HANDLES)
596 ACCESS_UNALIGNED="yes"
601 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
602 i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
603 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
604 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
605 #m68k-*-linux*) TARGET=M68K;;
606 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
607 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
608 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
611 if test ${TARGET} = unknown; then
612 CPPFLAGS="$CPPFLAGS -DNO_PORT"
613 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
616 if test ${ACCESS_UNALIGNED} = no; then
617 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
620 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
621 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
622 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
623 AM_CONDITIONAL(X86, test x$TARGET = xX86)
624 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
625 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
626 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
627 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
628 AM_CONDITIONAL(S390, test x$TARGET = xS390)
630 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
635 AC_SUBST(arch_target)
645 mono/metadata/Makefile
650 mono/os/win32/Makefile
651 mono/os/unix/Makefile
652 mono/arch/x86/Makefile
653 mono/arch/ppc/Makefile
654 mono/arch/sparc/Makefile
655 mono/arch/s390/Makefile
656 mono/arch/arm/Makefile
657 mono/arch/alpha/Makefile
658 mono/interpreter/Makefile
660 mono/benchmark/Makefile
661 mono/monoburg/Makefile
662 mono/monograph/Makefile
663 mono/io-layer/Makefile
664 mono/handles/Makefile
666 mono/profiler/Makefile