3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,0.24)
8 # These are the flags that need to be stored in the mono.pc file for
9 # compiling code that will embed Mono
13 AC_SUBST(libmono_cflags)
14 AC_SUBST(libmono_ldflags)
16 # Thread configuration inspired by sleepycat's db
17 AC_MSG_CHECKING([host platform characteristics])
20 *-*-mingw*|*-*-cygwin*)
22 AC_DEFINE(PLATFORM_WIN32)
25 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
31 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
32 libmono_cflags="-D_REENTRANT"
33 LDFLAGS="$LDFLAGS -pthread"
34 libmono_ldflags="-pthread"
35 AC_DEFINE(NEED_LINK_UNLINK)
37 libgc_threads=pthreads
39 *-*-*freebsd*|*-*-*openbsd*)
41 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
42 libmono_cflags="-D_THREAD_SAFE"
43 LDFLAGS="$LDFLAGS -pthread"
44 libmono_ldflags="-pthread"
45 AC_DEFINE(NEED_LINK_UNLINK)
46 AC_DEFINE(PTHREAD_POINTER_ID)
48 libgc_threads=pthreads
52 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
53 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
54 libmono_ldflags="-lpthread"
56 libgc_threads=pthreads
60 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
61 AC_DEFINE(NEED_LINK_UNLINK)
62 libmono_cflags="-D_REENTRANT"
67 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
68 libmono_cflags="-D_THREAD_SAFE"
69 LDFLAGS="$LDFLAGS -pthread"
70 libmono_ldflags="-pthread"
71 AC_DEFINE(NEED_LINK_UNLINK)
72 AC_DEFINE(PTHREAD_POINTER_ID)
77 AC_MSG_WARN([*** Please add $host to configure.in checks!])
83 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
85 AC_CHECK_TOOL(CC, gcc, gcc)
90 AC_CHECK_PROG(BISON, bison,yes,no)
91 if test "x$BISON" = "xno";
93 AC_MSG_ERROR([You need to install bison])
96 dnl may require a specific autoconf version
97 dnl AC_PROG_CC_FOR_BUILD
98 dnl CC_FOR_BUILD not automatically detected
101 if test "x$cross_compiling" = "xyes"; then
105 AC_SUBST(CC_FOR_BUILD)
107 AC_SUBST(BUILD_EXEEXT)
114 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
116 # for mono/metadata/debug-symfile.c
117 AC_CHECK_HEADERS(elf.h)
120 AC_CHECK_HEADERS(wchar.h)
122 # not 64 bit clean in cross-compile
123 AC_CHECK_SIZEOF(void *, 4)
125 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
127 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
128 if test "x$PKG_CONFIG" = "xno"; then
129 AC_MSG_ERROR([You need to install pkg-config])
132 dnl for use on the build system
133 dnl pkg-config is stupid
134 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
135 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
136 AC_SUBST(BUILD_GLIB_CFLAGS)
137 AC_SUBST(BUILD_GLIB_LIBS)
140 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
141 if test x$with_crosspkgdir = "x"; then
142 if test -s $PKG_CONFIG_PATH; then
143 PKG_PATH=$PKG_CONFIG_PATH
146 PKG_PATH=$with_crosspkgdir
147 PKG_CONFIG_PATH=$PKG_PATH
148 export PKG_CONFIG_PATH
152 ## Versions of dependencies
153 GLIB_REQUIRED_VERSION=1.3.11
155 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
157 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
158 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
159 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
160 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
162 AC_SUBST(GLIB_CFLAGS)
164 AC_SUBST(GMODULE_CFLAGS)
165 AC_SUBST(GMODULE_LIBS)
171 AC_CONFIG_SUBDIRS(libgc)
177 if test -d $srcdir/libgc ; then
183 AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
190 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
191 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
193 if test "x$found_boehm" != "xyes"; then
194 AC_MSG_ERROR("GC requested but libgc not found!")
196 if test "x$gc_headers" != "xyes"; then
197 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
200 AC_DEFINE(HAVE_BOEHM_GC)
201 AC_SUBST(HAVE_BOEHM_GC)
202 LIBGC_LIBS="-lgc $libdl"
204 AC_CHECK_FUNCS(GC_gcj_malloc)
213 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
214 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
216 AC_DEFINE(HAVE_BOEHM_GC)
217 AC_SUBST(HAVE_BOEHM_GC)
220 AC_DEFINE(USE_INCLUDED_LIBGC)
222 # The included libgc contains GCJ support
223 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
227 AC_MSG_WARN("Compiling mono without GC.")
230 AC_MSG_ERROR([Invalid argument to --with-gc.])
234 we_are_embedded_in_mono=yes
235 export we_are_embedded_in_mono
238 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
239 AC_SUBST(LIBGC_CFLAGS)
244 dnl End of libgc checks
247 if test x$platform_win32 = xno; then
248 dnl ******************************************************************
249 dnl *** Check for large file support ***
250 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
251 dnl ******************************************************************
253 # Check that off_t can represent 2**63 - 1 correctly, working around
254 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
255 # CPPFLAGS and sets $large_offt to yes if the test succeeds
257 AC_DEFUN(LARGE_FILES, [
258 large_CPPFLAGS=$CPPFLAGS
259 CPPFLAGS="$CPPFLAGS $1"
261 #include <sys/types.h>
263 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
266 int big_off_t=((BIG_OFF_T%2147483629==721) &&
267 (BIG_OFF_T%2147483647==1));
276 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
277 large_CPPFLAGS="$large_CPPFLAGS $1"
282 CPPFLAGS=$large_CPPFLAGS
285 AC_MSG_CHECKING(if off_t is 64 bits wide)
287 if test $large_offt = no; then
288 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
289 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
291 if test $large_offt = no; then
292 AC_MSG_WARN([No 64 bit file size support available])
295 dnl *****************************
296 dnl *** Checks for libsocket ***
297 dnl *****************************
298 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
300 dnl *******************************
301 dnl *** Checks for MSG_NOSIGNAL ***
302 dnl *******************************
303 AC_MSG_CHECKING(for MSG_NOSIGNAL)
304 AC_TRY_COMPILE([#include <sys/socket.h>], [
305 int f = MSG_NOSIGNAL;
309 AC_DEFINE(HAVE_MSG_NOSIGNAL)
311 # We'll have to use signals
315 dnl *****************************
316 dnl *** Checks for SOL_IP ***
317 dnl *****************************
318 AC_MSG_CHECKING(for SOL_IP)
319 AC_TRY_COMPILE([#include <netdb.h>], [
324 AC_DEFINE(HAVE_SOL_IP)
326 # We'll have to use getprotobyname
330 dnl *****************************
331 dnl *** Checks for SOL_TCP ***
332 dnl *****************************
333 AC_MSG_CHECKING(for SOL_TCP)
334 AC_TRY_COMPILE([#include <netdb.h>], [
339 AC_DEFINE(HAVE_SOL_TCP)
341 # We'll have to use getprotobyname
345 dnl *****************************
346 dnl *** Checks for IP_PKTINFO ***
347 dnl *****************************
348 AC_MSG_CHECKING(for IP_PKTINFO)
349 AC_TRY_COMPILE([#include <netdb.h>], [
350 int level = IP_PKTINFO;
354 AC_DEFINE(HAVE_IP_PKTINFO)
359 dnl *********************************
360 dnl *** Check for struct ip_mreqn ***
361 dnl *********************************
362 AC_MSG_CHECKING(for struct ip_mreqn)
363 AC_TRY_COMPILE([#include <netinet/in.h>], [
364 struct ip_mreqn mreq;
365 mreq.imr_address.s_addr = 0;
369 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
371 # We'll just have to try and use struct ip_mreq
373 AC_MSG_CHECKING(for struct ip_mreq)
374 AC_TRY_COMPILE([#include <netinet/in.h>], [
376 mreq.imr_interface.s_addr = 0;
380 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
382 # No multicast support
387 dnl *****************************
388 dnl *** Checks for libnsl ***
389 dnl *****************************
390 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
392 AC_CHECK_FUNCS(inet_pton inet_aton)
394 dnl ***********************************************
395 dnl *** Checks for size of sockaddr_un.sun_path ***
396 dnl ***********************************************
397 # AC_CHECK_SIZEOF can't cope with struct members :-(
398 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
399 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
401 #include <sys/types.h>
406 struct sockaddr_un sock_un;
407 FILE *f=fopen("conftestval", "w");
409 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
412 ], cv_mono_sizeof_sunpath=`cat conftestval`,
413 cv_mono_sizeof_sunpath=0,
414 cv_mono_sizeof_sunpath=0)])dnl
415 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
416 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
418 dnl *****************************
419 dnl *** Checks for libxnet ***
420 dnl *****************************
423 AC_MSG_CHECKING(for Solaris XPG4 support)
424 if test -f /usr/lib/libxnet.so; then
425 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
426 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
427 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
434 if test "$GCC" = "yes"; then
435 CFLAGS="$CFLAGS -Wno-char-subscripts"
440 dnl *****************************
441 dnl *** Checks for libpthread ***
442 dnl *****************************
443 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
444 AC_CHECK_FUNCS(pthread_mutex_timedlock)
445 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
446 AC_TRY_COMPILE([ #include <pthread.h>], [
447 pthread_mutexattr_t attr;
448 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
453 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
454 AC_DEFINE(USE_MONO_MUTEX)
457 dnl ********************************
458 dnl *** Checks for semaphore lib ***
459 dnl ********************************
460 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
462 dnl ********************************
463 dnl *** Checks for timezone stuff **
464 dnl ********************************
465 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
471 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
472 if test $ac_cv_struct_tm_gmtoff = yes; then
473 AC_DEFINE(HAVE_TM_GMTOFF)
475 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
480 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
481 if test $ac_cv_var_timezone = yes; then
482 AC_DEFINE(HAVE_TIMEZONE)
484 AC_ERROR(unable to find a way to determine timezone)
488 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
489 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
492 dnl ****************************
493 dnl *** Look for /dev/random ***
494 dnl ****************************
496 AC_MSG_CHECKING([if usage of random device is requested])
497 AC_ARG_ENABLE(dev-random,
498 [ --disable-dev-random disable the use of the random device],
499 try_dev_random=$enableval, try_dev_random=yes)
500 AC_MSG_RESULT($try_dev_random)
504 NAME_DEV_RANDOM="/dev/srandom"
507 dnl Win32 does not have /dev/random, they have their own method...
509 *-*-mingw*|*-*-cygwin*)
510 ac_cv_have_dev_random = no
513 dnl Everywhere else, it's /dev/random
516 NAME_DEV_RANDOM="/dev/random"
520 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
522 dnl Now check if the device actually exists
524 if test "x$try_dev_random" = "xyes"; then
525 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
526 [if test -r "$NAME_DEV_RANDOM" ; then
527 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
528 if test "x$ac_cv_have_dev_random" = "xyes"; then
529 AC_DEFINE(HAVE_CRYPT_RNG)
532 AC_MSG_CHECKING(for random device)
533 ac_cv_have_dev_random=no
534 AC_MSG_RESULT(has been disabled)
537 if test "x$platform_win32" = "xyes"; then
538 AC_DEFINE(HAVE_CRYPT_RNG)
541 if test "x$ac_cv_have_dev_random" = "xno" \
542 && test "x$platform_win32" = "xno"; then
545 *** A system-provided entropy source was not found on this system.
546 *** Because of this, the System.Security.Cryptography random number generator
547 *** will throw a NotImplemented exception.
549 *** If you are seeing this message, and you know your system DOES have an
550 *** entropy collection in place, please contact <crichton@gimp.org> and
551 *** provide information about the system and how to access the random device.
553 *** For those systems who lack a random device, EGD support is forthcoming.
557 AC_MSG_CHECKING([if inter-process shared handles are requested])
558 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
559 AC_MSG_RESULT($try_shared_handles)
560 if test "x$try_shared_handles" != "xyes"; then
561 AC_DEFINE(DISABLE_SHARED_HANDLES)
562 AC_SUBST(DISABLE_SHARED_HANDLES)
566 ACCESS_UNALIGNED="yes"
571 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
572 i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
573 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
574 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
575 #m68k-*-linux*) TARGET=M68K;;
576 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
577 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
578 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
581 if test ${TARGET} = unknown; then
582 CPPFLAGS="$CPPFLAGS -DNO_PORT"
583 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
586 if test ${ACCESS_UNALIGNED} = no; then
587 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
590 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
591 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
592 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
593 AM_CONDITIONAL(X86, test x$TARGET = xX86)
594 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
595 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
596 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
597 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
598 AM_CONDITIONAL(S390, test x$TARGET = xS390)
600 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
605 AC_SUBST(arch_target)
615 mono/metadata/Makefile
620 mono/os/win32/Makefile
621 mono/os/unix/Makefile
622 mono/arch/x86/Makefile
623 mono/arch/ppc/Makefile
624 mono/arch/sparc/Makefile
625 mono/arch/s390/Makefile
626 mono/arch/arm/Makefile
627 mono/arch/alpha/Makefile
628 mono/interpreter/Makefile
630 mono/benchmark/Makefile
631 mono/monoburg/Makefile
632 mono/monograph/Makefile
633 mono/io-layer/Makefile
634 mono/handles/Makefile