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])
19 *-*-mingw*|*-*-cygwin*)
21 AC_DEFINE(PLATFORM_WIN32)
24 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
29 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
30 libmono_cflags="-D_REENTRANT"
31 LDFLAGS="$LDFLAGS -pthread"
32 libmono_ldflags="-pthread"
33 AC_DEFINE(NEED_LINK_UNLINK)
36 *-*-*freebsd*|*-*-*openbsd*)
38 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
39 libmono_cflags="-D_THREAD_SAFE"
40 LDFLAGS="$LDFLAGS -pthread"
41 libmono_ldflags="-pthread"
42 AC_DEFINE(NEED_LINK_UNLINK)
43 AC_DEFINE(PTHREAD_POINTER_ID)
48 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
49 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
50 libmono_ldflags="-lpthread"
55 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
56 AC_DEFINE(NEED_LINK_UNLINK)
57 libmono_cflags="-D_REENTRANT"
61 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
62 libmono_cflags="-D_THREAD_SAFE"
63 LDFLAGS="$LDFLAGS -pthread"
64 libmono_ldflags="-pthread"
65 AC_DEFINE(NEED_LINK_UNLINK)
66 AC_DEFINE(PTHREAD_POINTER_ID)
70 AC_MSG_WARN([*** Please add $host to configure.in checks!])
76 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
78 AC_CHECK_TOOL(CC, gcc, gcc)
83 AC_CHECK_PROG(BISON, bison,yes,no)
84 if test "x$BISON" = "xno";
86 AC_MSG_ERROR([You need to install bison])
89 dnl may require a specific autoconf version
90 dnl AC_PROG_CC_FOR_BUILD
91 dnl CC_FOR_BUILD not automatically detected
94 if test "x$cross_compiling" = "xyes"; then
98 AC_SUBST(CC_FOR_BUILD)
100 AC_SUBST(BUILD_EXEEXT)
107 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
109 # for mono/metadata/debug-symfile.c
110 AC_CHECK_HEADERS(elf.h)
113 AC_CHECK_HEADERS(wchar.h)
115 # not 64 bit clean in cross-compile
116 AC_CHECK_SIZEOF(void *, 4)
118 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
120 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
121 if test "x$PKG_CONFIG" = "xno"; then
122 AC_MSG_ERROR([You need to install pkg-config])
125 dnl for use on the build system
126 dnl pkg-config is stupid
127 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
128 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
129 AC_SUBST(BUILD_GLIB_CFLAGS)
130 AC_SUBST(BUILD_GLIB_LIBS)
133 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
134 if test x$with_crosspkgdir = "x"; then
135 if test -s $PKG_CONFIG_PATH; then
136 PKG_PATH=$PKG_CONFIG_PATH
139 PKG_PATH=$with_crosspkgdir
140 PKG_CONFIG_PATH=$PKG_PATH
141 export PKG_CONFIG_PATH
145 ## Versions of dependencies
146 GLIB_REQUIRED_VERSION=1.3.11
148 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
150 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
151 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
152 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
153 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
155 AC_SUBST(GLIB_CFLAGS)
157 AC_SUBST(GMODULE_CFLAGS)
158 AC_SUBST(GMODULE_LIBS)
161 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
162 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
164 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
168 if test "x$found_boehm" != "xyes"; then
169 AC_MSG_ERROR("GC requested but libgc not found!")
171 if test "x$gc_headers" != "xyes"; then
172 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
175 AC_DEFINE(HAVE_BOEHM_GC)
176 AC_SUBST(HAVE_BOEHM_GC)
177 LIBS="$LIBS -lgc $libdl"
180 AC_MSG_WARN("Compiling mono without GC.")
183 # If libgc was found, use it. Otherwise just warn.
184 if test "x$found_boehm" != "xyes"; then
185 AC_MSG_WARN("Compiling mono without GC.")
187 if test "x$gc_headers" != "xyes"; then
188 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
190 AC_DEFINE(HAVE_BOEHM_GC)
191 AC_SUBST(HAVE_BOEHM_GC)
192 LIBS="$LIBS -lgc $libdl"
198 if test "x$gc" = xboehm; then
199 AC_CHECK_FUNCS(GC_gcj_malloc)
202 if test x$platform_win32 = xno; then
203 dnl ******************************************************************
204 dnl *** Check for large file support ***
205 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
206 dnl ******************************************************************
208 # Check that off_t can represent 2**63 - 1 correctly, working around
209 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
210 # CPPFLAGS and sets $large_offt to yes if the test succeeds
212 AC_DEFUN(LARGE_FILES, [
213 large_CPPFLAGS=$CPPFLAGS
214 CPPFLAGS="$CPPFLAGS $1"
216 #include <sys/types.h>
218 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
221 int big_off_t=((BIG_OFF_T%2147483629==721) &&
222 (BIG_OFF_T%2147483647==1));
231 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
232 large_CPPFLAGS="$large_CPPFLAGS $1"
237 CPPFLAGS=$large_CPPFLAGS
240 AC_MSG_CHECKING(if off_t is 64 bits wide)
242 if test $large_offt = no; then
243 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
244 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
246 if test $large_offt = no; then
247 AC_MSG_WARN([No 64 bit file size support available])
250 dnl *****************************
251 dnl *** Checks for libsocket ***
252 dnl *****************************
253 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
255 dnl *******************************
256 dnl *** Checks for MSG_NOSIGNAL ***
257 dnl *******************************
258 AC_MSG_CHECKING(for MSG_NOSIGNAL)
259 AC_TRY_COMPILE([#include <sys/socket.h>], [
260 int f = MSG_NOSIGNAL;
264 AC_DEFINE(HAVE_MSG_NOSIGNAL)
266 # We'll have to use signals
270 dnl *****************************
271 dnl *** Checks for SOL_IP ***
272 dnl *****************************
273 AC_MSG_CHECKING(for SOL_IP)
274 AC_TRY_COMPILE([#include <netdb.h>], [
279 AC_DEFINE(HAVE_SOL_IP)
281 # We'll have to use getprotobyname
285 dnl *****************************
286 dnl *** Checks for SOL_TCP ***
287 dnl *****************************
288 AC_MSG_CHECKING(for SOL_TCP)
289 AC_TRY_COMPILE([#include <netdb.h>], [
294 AC_DEFINE(HAVE_SOL_TCP)
296 # We'll have to use getprotobyname
300 dnl *****************************
301 dnl *** Checks for IP_PKTINFO ***
302 dnl *****************************
303 AC_MSG_CHECKING(for IP_PKTINFO)
304 AC_TRY_COMPILE([#include <netdb.h>], [
305 int level = IP_PKTINFO;
309 AC_DEFINE(HAVE_IP_PKTINFO)
314 dnl *********************************
315 dnl *** Check for struct ip_mreqn ***
316 dnl *********************************
317 AC_MSG_CHECKING(for struct ip_mreqn)
318 AC_TRY_COMPILE([#include <netinet/in.h>], [
319 struct ip_mreqn mreq;
320 mreq.imr_address.s_addr = 0;
324 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
326 # We'll just have to use struct ip_mreq
330 dnl *****************************
331 dnl *** Checks for libnsl ***
332 dnl *****************************
333 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
335 AC_CHECK_FUNCS(inet_pton inet_aton)
337 dnl ***********************************************
338 dnl *** Checks for size of sockaddr_un.sun_path ***
339 dnl ***********************************************
340 # AC_CHECK_SIZEOF can't cope with struct members :-(
341 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
342 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
344 #include <sys/types.h>
349 struct sockaddr_un sock_un;
350 FILE *f=fopen("conftestval", "w");
352 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
355 ], cv_mono_sizeof_sunpath=`cat conftestval`,
356 cv_mono_sizeof_sunpath=0,
357 cv_mono_sizeof_sunpath=0)])dnl
358 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
359 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
361 dnl *****************************
362 dnl *** Checks for libxnet ***
363 dnl *****************************
366 AC_MSG_CHECKING(for Solaris XPG4 support)
367 if test -f /usr/lib/libxnet.so; then
368 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
369 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
370 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
377 if test "$GCC" = "yes"; then
378 CFLAGS="$CFLAGS -Wno-char-subscripts"
383 dnl *****************************
384 dnl *** Checks for libpthread ***
385 dnl *****************************
386 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
387 AC_CHECK_FUNCS(pthread_mutex_timedlock)
388 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
389 AC_TRY_COMPILE([ #include <pthread.h>], [
390 pthread_mutexattr_t attr;
391 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
396 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
397 AC_DEFINE(USE_MONO_MUTEX)
400 dnl ********************************
401 dnl *** Checks for semaphore lib ***
402 dnl ********************************
403 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
405 dnl ********************************
406 dnl *** Checks for timezone stuff **
407 dnl ********************************
408 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
414 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
415 if test $ac_cv_struct_tm_gmtoff = yes; then
416 AC_DEFINE(HAVE_TM_GMTOFF)
418 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
423 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
424 if test $ac_cv_var_timezone = yes; then
425 AC_DEFINE(HAVE_TIMEZONE)
427 AC_ERROR(unable to find a way to determine timezone)
431 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
432 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
435 dnl ****************************
436 dnl *** Look for /dev/random ***
437 dnl ****************************
439 AC_MSG_CHECKING([if usage of random device is requested])
440 AC_ARG_ENABLE(dev-random,
441 [ --disable-dev-random disable the use of the random device],
442 try_dev_random=$enableval, try_dev_random=yes)
443 AC_MSG_RESULT($try_dev_random)
447 NAME_DEV_RANDOM="/dev/srandom"
450 dnl Win32 does not have /dev/random, they have their own method...
452 *-*-mingw*|*-*-cygwin*)
453 ac_cv_have_dev_random = no
456 dnl Everywhere else, it's /dev/random
459 NAME_DEV_RANDOM="/dev/random"
463 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
465 dnl Now check if the device actually exists
467 if test "x$try_dev_random" = "xyes"; then
468 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
469 [if test -r "$NAME_DEV_RANDOM" ; then
470 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
471 if test "x$ac_cv_have_dev_random" = "xyes"; then
472 AC_DEFINE(HAVE_CRYPT_RNG)
475 AC_MSG_CHECKING(for random device)
476 ac_cv_have_dev_random=no
477 AC_MSG_RESULT(has been disabled)
480 if test "x$platform_win32" = "xyes"; then
481 AC_DEFINE(HAVE_CRYPT_RNG)
484 if test "x$ac_cv_have_dev_random" = "xno" \
485 && test "x$platform_win32" = "xno"; then
488 *** A system-provided entropy source was not found on this system.
489 *** Because of this, the System.Security.Cryptography random number generator
490 *** will throw a NotImplemented exception.
492 *** If you are seeing this message, and you know your system DOES have an
493 *** entropy collection in place, please contact <crichton@gimp.org> and
494 *** provide information about the system and how to access the random device.
496 *** For those systems who lack a random device, EGD support is forthcoming.
500 AC_MSG_CHECKING([if inter-process shared handles are requested])
501 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
502 AC_MSG_RESULT($try_shared_handles)
503 if test "x$try_shared_handles" != "xyes"; then
504 AC_DEFINE(DISABLE_SHARED_HANDLES)
505 AC_SUBST(DISABLE_SHARED_HANDLES)
509 ACCESS_UNALIGNED="yes"
514 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
515 i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
516 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
517 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
518 #m68k-*-linux*) TARGET=M68K;;
519 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
520 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
521 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
524 if test ${TARGET} = unknown; then
525 CPPFLAGS="$CPPFLAGS -DNO_PORT"
526 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
529 if test ${ACCESS_UNALIGNED} = no; then
530 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
533 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
534 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
535 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
536 AM_CONDITIONAL(X86, test x$TARGET = xX86)
537 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
538 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
539 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
540 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
541 AM_CONDITIONAL(S390, test x$TARGET = xS390)
543 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
548 AC_SUBST(arch_target)
558 mono/metadata/Makefile
563 mono/os/win32/Makefile
564 mono/os/unix/Makefile
565 mono/arch/x86/Makefile
566 mono/arch/ppc/Makefile
567 mono/arch/sparc/Makefile
568 mono/arch/s390/Makefile
569 mono/arch/arm/Makefile
570 mono/arch/alpha/Makefile
571 mono/interpreter/Makefile
573 mono/benchmark/Makefile
574 mono/monoburg/Makefile
575 mono/monograph/Makefile
577 mono/io-layer/Makefile
578 mono/handles/Makefile