3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.15)
7 dnl ****************************************
8 dnl *** Check if we're building on win32 ***
9 dnl ****************************************
10 AC_MSG_CHECKING([if building for some Win32 platform])
12 *-*-mingw*|*-*-cygwin*)
14 AC_DEFINE(PLATFORM_WIN32)
24 AC_MSG_RESULT($platform_win32)
25 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
27 AC_CHECK_TOOL(CC, gcc, gcc)
32 AC_CHECK_PROG(BISON, bison,yes,no)
33 if test "x$BISON" = "xno";
35 AC_MSG_ERROR([You need to install bison])
38 dnl may require a specific autoconf version
39 dnl AC_PROG_CC_FOR_BUILD
40 dnl CC_FOR_BUILD not automatically detected
43 if test "x$cross_compiling" = "xyes"; then
47 AC_SUBST(CC_FOR_BUILD)
49 AC_SUBST(BUILD_EXEEXT)
56 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h)
58 # for mono/metadata/debug-symfile.c
59 AC_CHECK_HEADERS(elf.h)
62 AC_CHECK_HEADERS(wchar.h)
64 # not 64 bit clean in cross-compile
65 AC_CHECK_SIZEOF(void *, 4)
67 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
69 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
70 if test "x$PKG_CONFIG" = "xno"; then
71 AC_MSG_ERROR([You need to install pkg-config])
74 dnl for use on the build system
75 dnl pkg-config is stupid
76 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
77 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
78 AC_SUBST(BUILD_GLIB_CFLAGS)
79 AC_SUBST(BUILD_GLIB_LIBS)
82 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
83 if test x$with_crosspkgdir = "x"; then
84 if test -s $PKG_CONFIG_PATH; then
85 PKG_PATH=$PKG_CONFIG_PATH
88 PKG_PATH=$with_crosspkgdir
89 PKG_CONFIG_PATH=$PKG_PATH
90 export PKG_CONFIG_PATH
94 ## Versions of dependencies
95 GLIB_REQUIRED_VERSION=1.3.11
97 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
99 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
100 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
101 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
102 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
104 AC_SUBST(GLIB_CFLAGS)
106 AC_SUBST(GMODULE_CFLAGS)
107 AC_SUBST(GMODULE_LIBS)
109 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
111 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
115 if test "x$found_boehm" != "xyes"; then
116 AC_MSG_ERROR("GC requested but libgc not found!")
119 AC_DEFINE(HAVE_BOEHM_GC)
120 AC_SUBST(HAVE_BOEHM_GC)
121 LIBS="$LIBS -lgc $libdl"
124 AC_MSG_WARN("Compiling mono without GC.")
127 dnl When the JIT works with libgc, use this chunk.
128 dnl # If libgc was found, use it. Otherwise just warn.
129 if test "x$found_boehm" != "xyes"; then
130 AC_MSG_WARN("Compiling mono without GC.")
132 AC_DEFINE(HAVE_BOEHM_GC)
133 AC_SUBST(HAVE_BOEHM_GC)
134 LIBS="$LIBS -lgc $libdl"
137 dnl AC_MSG_WARN("Compiling mono without GC.")
141 if test x$platform_win32 = xno; then
142 dnl ******************************************************************
143 dnl *** Check for large file support ***
144 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
145 dnl ******************************************************************
147 # Check that off_t can represent 2**63 - 1 correctly, working around
148 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
149 # CPPFLAGS and sets $large_offt to yes if the test succeeds
151 AC_DEFUN(LARGE_FILES, [
152 large_CPPFLAGS=$CPPFLAGS
153 CPPFLAGS="$CPPFLAGS $1"
155 #include <sys/types.h>
157 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
160 int big_off_t=((BIG_OFF_T%2147483629==721) &&
161 (BIG_OFF_T%2147483647==1));
170 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
171 large_CPPFLAGS="$large_CPPFLAGS $1"
176 CPPFLAGS=$large_CPPFLAGS
179 AC_MSG_CHECKING(if off_t is 64 bits wide)
181 if test $large_offt = no; then
182 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
183 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
185 if test $large_offt = no; then
186 AC_MSG_WARN([No 64 bit file size support available])
189 dnl *****************************
190 dnl *** Checks for libsocket ***
191 dnl *****************************
192 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
194 dnl *******************************
195 dnl *** Checks for MSG_NOSIGNAL ***
196 dnl *******************************
197 AC_MSG_CHECKING(for MSG_NOSIGNAL)
198 AC_TRY_COMPILE([#include <sys/socket.h>], [
199 int f = MSG_NOSIGNAL;
203 AC_DEFINE(HAVE_MSG_NOSIGNAL)
205 # We'll have to use signals
209 dnl *****************************
210 dnl *** Checks for SOL_IP ***
211 dnl *****************************
212 AC_MSG_CHECKING(for SOL_IP)
213 AC_TRY_COMPILE([#include <netdb.h>], [
218 AC_DEFINE(HAVE_SOL_IP)
220 # We'll have to use getprotobyname
224 dnl *****************************
225 dnl *** Checks for SOL_TCP ***
226 dnl *****************************
227 AC_MSG_CHECKING(for SOL_TCP)
228 AC_TRY_COMPILE([#include <netdb.h>], [
233 AC_DEFINE(HAVE_SOL_TCP)
235 # We'll have to use getprotobyname
239 dnl *****************************
240 dnl *** Checks for IP_PKTINFO ***
241 dnl *****************************
242 AC_MSG_CHECKING(for IP_PKTINFO)
243 AC_TRY_COMPILE([#include <netdb.h>], [
244 int level = IP_PKTINFO;
248 AC_DEFINE(HAVE_IP_PKTINFO)
253 dnl *********************************
254 dnl *** Check for struct ip_mreqn ***
255 dnl *********************************
256 AC_MSG_CHECKING(for struct ip_mreqn)
257 AC_TRY_COMPILE([#include <netinet/in.h>], [
258 struct ip_mreqn mreq;
259 mreq.imr_address.s_addr = 0;
263 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
265 # We'll just have to use struct ip_mreq
269 dnl *****************************
270 dnl *** Checks for libnsl ***
271 dnl *****************************
272 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
274 AC_CHECK_FUNCS(inet_pton inet_aton)
276 dnl ***********************************************
277 dnl *** Checks for size of sockaddr_un.sun_path ***
278 dnl ***********************************************
279 # AC_CHECK_SIZEOF can't cope with struct members :-(
280 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
281 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
287 struct sockaddr_un sock_un;
288 FILE *f=fopen("conftestval", "w");
290 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
293 ], cv_mono_sizeof_sunpath=`cat conftestval`,
294 cv_mono_sizeof_sunpath=0,
295 cv_mono_sizeof_sunpath=0)])dnl
296 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
297 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
299 dnl *****************************
300 dnl *** Checks for libpthread ***
301 dnl *****************************
302 AC_SEARCH_LIBS(pthread_create, pthread c_r, [
303 AM_CONDITIONAL(THREADS_PTHREAD, true)
304 AC_DEFINE(HAVE_PTHREAD)
306 # Need pthread_mutex_timedlock
308 orig_CPPFLAGS=$CPPFLAGS
309 # This is a gcc-specific error, but we already set
310 # gcc-specific options in CFLAGS
311 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
312 AC_MSG_CHECKING(for pthread_mutex_timedlock)
313 AC_TRY_COMPILE([ #include <pthread.h>], [
314 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
315 pthread_mutex_timedlock(&mut, NULL);
319 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
323 # glibc requires -D_GNU_SOURCE before it will declare
325 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
326 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
327 AC_TRY_COMPILE([ #include <pthread.h>], [
328 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
329 pthread_mutex_timedlock(&mut, NULL);
332 pthread_CFLAGS="-D_GNU_SOURCE"
333 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
336 dnl Add other variants here
337 AC_MSG_WARN(Working around pthread_mutex_timedlock)
340 CPPFLAGS=$orig_CPPFLAGS
341 CPPFLAGS="$CPPFLAGS $pthread_CFLAGS"
343 # Need PTHREAD_MUTEX_RECURSIVE
345 orig_CPPFLAGS=$CPPFLAGS
346 # This is a gcc-specific error, but we already set
347 # gcc-specific options in CFLAGS
348 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
349 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
350 AC_TRY_COMPILE([ #include <pthread.h>], [
351 pthread_mutexattr_t attr;
352 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
359 # glibc requires -D_GNU_SOURCE before it will declare
361 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
362 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
363 AC_TRY_COMPILE([ #include <pthread.h>], [
364 pthread_mutexattr_t attr;
365 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
368 pthread_CFLAGS="-D_GNU_SOURCE"
371 dnl Add other variants here
372 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
373 AC_DEFINE(USE_MONO_MUTEX)
376 CPPFLAGS=$orig_CPPFLAGS
377 CPPFLAGS="$CPPFLAGS -D_REENTRANT $pthread_CFLAGS"
379 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
382 dnl ********************************
383 dnl *** Checks for semaphore lib ***
384 dnl ********************************
385 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
387 dnl ********************************
388 dnl *** Checks for timezone stuff **
389 dnl ********************************
390 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
395 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
396 if test $ac_cv_var_timezone = yes; then
397 AC_DEFINE(HAVE_TIMEZONE)
399 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
405 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
406 if test $ac_cv_struct_tm_gmtoff = yes; then
407 AC_DEFINE(HAVE_TM_GMTOFF)
409 AC_ERROR(unable to find a way to determine timezone)
413 AM_CONDITIONAL(THREADS_PTHREAD, false)
414 # This is a kludge, we really ought to test for libws2_32, but
415 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
416 # with @num suffixes)
417 LIBS="$LIBS -lws2_32"
418 CFLAGS="$CFLAGS -mno-cygwin"
421 dnl ****************************
422 dnl *** Look for /dev/random ***
423 dnl ****************************
425 AC_MSG_CHECKING([if usage of random device is requested])
426 AC_ARG_ENABLE(dev-random,
427 [ --disable-dev-random disable the use of the random device],
428 try_dev_random=$enableval, try_dev_random=yes)
429 AC_MSG_RESULT($try_dev_random)
433 NAME_DEV_RANDOM="/dev/srandom"
436 dnl Win32 does not have /dev/random, they have their own method...
438 *-*-mingw*|*-*-cygwin*)
439 ac_cv_have_dev_random = no
442 dnl Everywhere else, it's /dev/random
445 NAME_DEV_RANDOM="/dev/random"
449 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
451 dnl Now check if the device actually exists
453 if test "x$try_dev_random" = "xyes"; then
454 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
455 [if test -r "$NAME_DEV_RANDOM" ; then
456 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
457 if test "x$ac_cv_have_dev_random" = "xyes"; then
458 AC_DEFINE(HAVE_CRYPT_RNG)
461 AC_MSG_CHECKING(for random device)
462 ac_cv_have_dev_random=no
463 AC_MSG_RESULT(has been disabled)
466 if test "x$platform_win32" = "xyes"; then
467 AC_DEFINE(HAVE_CRYPT_RNG)
470 if test "x$ac_cv_have_dev_random" = "xno" \
471 && test "x$platform_win32" = "xno"; then
474 *** A system-provided entropy source was not found on this system.
475 *** Because of this, the System.Security.Cryptography random number generator
476 *** will throw a NotImplemented exception.
478 *** If you are seeing this message, and you know your system DOES have an
479 *** entropy collection in place, please contact <crichton@gimp.org> and
480 *** provide information about the system and how to access the random device.
482 *** For those systems who lack a random device, EGD support is forthcoming.
486 AC_MSG_CHECKING([if inter-process shared handles are requested])
487 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
488 AC_MSG_RESULT($try_shared_handles)
489 if test "x$try_shared_handles" != "xyes"; then
490 AC_DEFINE(DISABLE_SHARED_HANDLES)
491 AC_SUBST(DISABLE_SHARED_HANDLES)
495 ACCESS_UNALIGNED="yes"
498 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
499 i*86-*-*) TARGET=X86; arch_target=x86;;
500 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
501 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
502 #m68k-*-linux*) TARGET=M68K;;
503 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
504 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
507 if test ${TARGET} = unknown; then
508 CPPFLAGS="$CPPFLAGS -DNO_PORT"
509 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
512 if test ${ACCESS_UNALIGNED} = no; then
513 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
516 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
517 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
518 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
519 AM_CONDITIONAL(X86, test x$TARGET = xX86)
520 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
521 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
522 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
523 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
528 AC_SUBST(arch_target)
537 mono/metadata/Makefile
542 mono/os/win32/Makefile
543 mono/os/unix/Makefile
544 mono/arch/x86/Makefile
545 mono/arch/ppc/Makefile
546 mono/arch/sparc/Makefile
547 mono/arch/arm/Makefile
548 mono/interpreter/Makefile
550 mono/benchmark/Makefile
551 mono/monoburg/Makefile
552 mono/monograph/Makefile
554 mono/io-layer/Makefile
555 mono/handles/Makefile