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 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
46 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
47 libmono_cflags="-D_REENTRANT"
48 LDFLAGS="$LDFLAGS -pthread"
49 libmono_ldflags="-pthread"
50 AC_DEFINE(NEED_LINK_UNLINK)
52 libgc_threads=pthreads
54 *-*-*freebsd*|*-*-*openbsd*)
56 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
57 libmono_cflags="-D_THREAD_SAFE"
58 LDFLAGS="$LDFLAGS -pthread"
59 libmono_ldflags="-pthread"
60 AC_DEFINE(NEED_LINK_UNLINK)
61 AC_DEFINE(PTHREAD_POINTER_ID)
63 libgc_threads=pthreads
67 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
68 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
69 libmono_ldflags="-lpthread"
71 libgc_threads=pthreads
75 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
76 AC_DEFINE(NEED_LINK_UNLINK)
77 libmono_cflags="-D_REENTRANT"
82 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
83 libmono_cflags="-D_THREAD_SAFE"
84 LDFLAGS="$LDFLAGS -pthread"
85 libmono_ldflags="-pthread"
86 AC_DEFINE(NEED_LINK_UNLINK)
87 AC_DEFINE(PTHREAD_POINTER_ID)
93 AC_MSG_WARN([*** Please add $host to configure.in checks!])
99 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
101 AC_CHECK_TOOL(CC, gcc, gcc)
106 AC_CHECK_PROG(BISON, bison,yes,no)
107 if test "x$BISON" = "xno";
109 AC_MSG_ERROR([You need to install bison])
112 dnl may require a specific autoconf version
113 dnl AC_PROG_CC_FOR_BUILD
114 dnl CC_FOR_BUILD not automatically detected
117 if test "x$cross_compiling" = "xyes"; then
121 AC_SUBST(CC_FOR_BUILD)
123 AC_SUBST(BUILD_EXEEXT)
130 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
132 # for mono/metadata/debug-symfile.c
133 AC_CHECK_HEADERS(elf.h)
136 AC_CHECK_HEADERS(wchar.h)
138 # not 64 bit clean in cross-compile
139 AC_CHECK_SIZEOF(void *, 4)
141 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
143 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
144 if test "x$PKG_CONFIG" = "xno"; then
145 AC_MSG_ERROR([You need to install pkg-config])
148 dnl for use on the build system
149 dnl pkg-config is stupid
150 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
151 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
152 AC_SUBST(BUILD_GLIB_CFLAGS)
153 AC_SUBST(BUILD_GLIB_LIBS)
156 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
157 if test x$with_crosspkgdir = "x"; then
158 if test -s $PKG_CONFIG_PATH; then
159 PKG_PATH=$PKG_CONFIG_PATH
162 PKG_PATH=$with_crosspkgdir
163 PKG_CONFIG_PATH=$PKG_PATH
164 export PKG_CONFIG_PATH
168 ## Versions of dependencies
169 GLIB_REQUIRED_VERSION=1.3.11
171 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
173 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
174 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
175 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
176 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
178 AC_SUBST(GLIB_CFLAGS)
180 AC_SUBST(GMODULE_CFLAGS)
181 AC_SUBST(GMODULE_LIBS)
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! Install libgc or run configure with --with-gc=none.")
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)
208 AC_CONFIG_SUBDIRS(libgc)
215 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
216 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
218 AC_DEFINE(HAVE_BOEHM_GC)
219 AC_SUBST(HAVE_BOEHM_GC)
222 AC_DEFINE(USE_INCLUDED_LIBGC)
224 # The included libgc contains GCJ support
225 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
229 AC_MSG_WARN("Compiling mono without GC.")
232 AC_MSG_ERROR([Invalid argument to --with-gc.])
236 we_are_embedded_in_mono=yes
237 export we_are_embedded_in_mono
240 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
241 AC_SUBST(LIBGC_CFLAGS)
246 dnl End of libgc checks
249 if test x$platform_win32 = xno; then
250 dnl ******************************************************************
251 dnl *** Check for large file support ***
252 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
253 dnl ******************************************************************
255 # Check that off_t can represent 2**63 - 1 correctly, working around
256 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
257 # CPPFLAGS and sets $large_offt to yes if the test succeeds
259 AC_DEFUN(LARGE_FILES, [
260 large_CPPFLAGS=$CPPFLAGS
261 CPPFLAGS="$CPPFLAGS $1"
263 #include <sys/types.h>
265 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
268 int big_off_t=((BIG_OFF_T%2147483629==721) &&
269 (BIG_OFF_T%2147483647==1));
278 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
279 large_CPPFLAGS="$large_CPPFLAGS $1"
284 CPPFLAGS=$large_CPPFLAGS
287 AC_MSG_CHECKING(if off_t is 64 bits wide)
289 if test $large_offt = no; then
290 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
291 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
293 if test $large_offt = no; then
294 AC_MSG_WARN([No 64 bit file size support available])
297 dnl *****************************
298 dnl *** Checks for libsocket ***
299 dnl *****************************
300 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
302 dnl *******************************
303 dnl *** Checks for MSG_NOSIGNAL ***
304 dnl *******************************
305 AC_MSG_CHECKING(for MSG_NOSIGNAL)
306 AC_TRY_COMPILE([#include <sys/socket.h>], [
307 int f = MSG_NOSIGNAL;
311 AC_DEFINE(HAVE_MSG_NOSIGNAL)
313 # We'll have to use signals
317 dnl *****************************
318 dnl *** Checks for SOL_IP ***
319 dnl *****************************
320 AC_MSG_CHECKING(for SOL_IP)
321 AC_TRY_COMPILE([#include <netdb.h>], [
326 AC_DEFINE(HAVE_SOL_IP)
328 # We'll have to use getprotobyname
332 dnl *****************************
333 dnl *** Checks for SOL_TCP ***
334 dnl *****************************
335 AC_MSG_CHECKING(for SOL_TCP)
336 AC_TRY_COMPILE([#include <netdb.h>], [
341 AC_DEFINE(HAVE_SOL_TCP)
343 # We'll have to use getprotobyname
347 dnl *****************************
348 dnl *** Checks for IP_PKTINFO ***
349 dnl *****************************
350 AC_MSG_CHECKING(for IP_PKTINFO)
351 AC_TRY_COMPILE([#include <netdb.h>], [
352 int level = IP_PKTINFO;
356 AC_DEFINE(HAVE_IP_PKTINFO)
361 dnl *********************************
362 dnl *** Check for struct ip_mreqn ***
363 dnl *********************************
364 AC_MSG_CHECKING(for struct ip_mreqn)
365 AC_TRY_COMPILE([#include <netinet/in.h>], [
366 struct ip_mreqn mreq;
367 mreq.imr_address.s_addr = 0;
371 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
373 # We'll just have to try and use struct ip_mreq
375 AC_MSG_CHECKING(for struct ip_mreq)
376 AC_TRY_COMPILE([#include <netinet/in.h>], [
378 mreq.imr_interface.s_addr = 0;
382 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
384 # No multicast support
389 dnl *****************************
390 dnl *** Checks for libnsl ***
391 dnl *****************************
392 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
394 AC_CHECK_FUNCS(inet_pton inet_aton)
396 dnl ***********************************************
397 dnl *** Checks for size of sockaddr_un.sun_path ***
398 dnl ***********************************************
399 # AC_CHECK_SIZEOF can't cope with struct members :-(
400 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
401 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
403 #include <sys/types.h>
408 struct sockaddr_un sock_un;
409 FILE *f=fopen("conftestval", "w");
411 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
414 ], cv_mono_sizeof_sunpath=`cat conftestval`,
415 cv_mono_sizeof_sunpath=0,
416 cv_mono_sizeof_sunpath=0)])dnl
417 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
418 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
420 dnl *****************************
421 dnl *** Checks for libxnet ***
422 dnl *****************************
425 AC_MSG_CHECKING(for Solaris XPG4 support)
426 if test -f /usr/lib/libxnet.so; then
427 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
428 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
429 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
436 if test "$GCC" = "yes"; then
437 CFLAGS="$CFLAGS -Wno-char-subscripts"
442 dnl *****************************
443 dnl *** Checks for libpthread ***
444 dnl *****************************
445 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
446 AC_CHECK_FUNCS(pthread_mutex_timedlock)
447 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
448 AC_TRY_COMPILE([ #include <pthread.h>], [
449 pthread_mutexattr_t attr;
450 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
455 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
456 AC_DEFINE(USE_MONO_MUTEX)
459 dnl ********************************
460 dnl *** Checks for semaphore lib ***
461 dnl ********************************
462 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
464 dnl ********************************
465 dnl *** Checks for timezone stuff **
466 dnl ********************************
467 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
473 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
474 if test $ac_cv_struct_tm_gmtoff = yes; then
475 AC_DEFINE(HAVE_TM_GMTOFF)
477 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
482 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
483 if test $ac_cv_var_timezone = yes; then
484 AC_DEFINE(HAVE_TIMEZONE)
486 AC_ERROR(unable to find a way to determine timezone)
490 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
491 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
494 dnl ****************************
495 dnl *** Look for /dev/random ***
496 dnl ****************************
498 AC_MSG_CHECKING([if usage of random device is requested])
499 AC_ARG_ENABLE(dev-random,
500 [ --disable-dev-random disable the use of the random device],
501 try_dev_random=$enableval, try_dev_random=yes)
502 AC_MSG_RESULT($try_dev_random)
506 NAME_DEV_RANDOM="/dev/srandom"
509 dnl Win32 does not have /dev/random, they have their own method...
511 *-*-mingw*|*-*-cygwin*)
512 ac_cv_have_dev_random = no
515 dnl Everywhere else, it's /dev/random
518 NAME_DEV_RANDOM="/dev/random"
522 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
524 dnl Now check if the device actually exists
526 if test "x$try_dev_random" = "xyes"; then
527 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
528 [if test -r "$NAME_DEV_RANDOM" ; then
529 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
530 if test "x$ac_cv_have_dev_random" = "xyes"; then
531 AC_DEFINE(HAVE_CRYPT_RNG)
534 AC_MSG_CHECKING(for random device)
535 ac_cv_have_dev_random=no
536 AC_MSG_RESULT(has been disabled)
539 if test "x$platform_win32" = "xyes"; then
540 AC_DEFINE(HAVE_CRYPT_RNG)
543 if test "x$ac_cv_have_dev_random" = "xno" \
544 && test "x$platform_win32" = "xno"; then
547 *** A system-provided entropy source was not found on this system.
548 *** Because of this, the System.Security.Cryptography random number generator
549 *** will throw a NotImplemented exception.
551 *** If you are seeing this message, and you know your system DOES have an
552 *** entropy collection in place, please contact <crichton@gimp.org> and
553 *** provide information about the system and how to access the random device.
555 *** For those systems who lack a random device, EGD support is forthcoming.
559 AC_MSG_CHECKING([if inter-process shared handles are requested])
560 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
561 AC_MSG_RESULT($try_shared_handles)
562 if test "x$try_shared_handles" != "xyes"; then
563 AC_DEFINE(DISABLE_SHARED_HANDLES)
564 AC_SUBST(DISABLE_SHARED_HANDLES)
568 ACCESS_UNALIGNED="yes"
573 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
574 i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
575 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
576 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
577 #m68k-*-linux*) TARGET=M68K;;
578 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
579 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
580 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
583 if test ${TARGET} = unknown; then
584 CPPFLAGS="$CPPFLAGS -DNO_PORT"
585 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
588 if test ${ACCESS_UNALIGNED} = no; then
589 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
592 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
593 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
594 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
595 AM_CONDITIONAL(X86, test x$TARGET = xX86)
596 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
597 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
598 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
599 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
600 AM_CONDITIONAL(S390, test x$TARGET = xS390)
602 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
607 AC_SUBST(arch_target)
617 mono/metadata/Makefile
622 mono/os/win32/Makefile
623 mono/os/unix/Makefile
624 mono/arch/x86/Makefile
625 mono/arch/ppc/Makefile
626 mono/arch/sparc/Makefile
627 mono/arch/s390/Makefile
628 mono/arch/arm/Makefile
629 mono/arch/alpha/Makefile
630 mono/interpreter/Makefile
632 mono/benchmark/Makefile
633 mono/monoburg/Makefile
634 mono/monograph/Makefile
635 mono/io-layer/Makefile
636 mono/handles/Makefile