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)
61 # not 64 bit clean in cross-compile
62 AC_CHECK_SIZEOF(void *, 4)
64 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
66 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
67 if test "x$PKG_CONFIG" = "xno"; then
68 AC_MSG_ERROR([You need to install pkg-config])
71 dnl for use on the build system
72 dnl pkg-config is stupid
73 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
74 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
75 AC_SUBST(BUILD_GLIB_CFLAGS)
76 AC_SUBST(BUILD_GLIB_LIBS)
79 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
80 if test x$with_crosspkgdir = "x"; then
81 if test -s $PKG_CONFIG_PATH; then
82 PKG_PATH=$PKG_CONFIG_PATH
85 PKG_PATH=$with_crosspkgdir
86 PKG_CONFIG_PATH=$PKG_PATH
87 export PKG_CONFIG_PATH
91 ## Versions of dependencies
92 GLIB_REQUIRED_VERSION=1.3.11
94 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
96 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
97 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
98 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
99 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
101 AC_SUBST(GLIB_CFLAGS)
103 AC_SUBST(GMODULE_CFLAGS)
104 AC_SUBST(GMODULE_LIBS)
106 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
108 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
112 if test "x$found_boehm" != "xyes"; then
113 AC_MSG_ERROR("GC requested but libgc not found!")
116 AC_DEFINE(HAVE_BOEHM_GC)
117 AC_SUBST(HAVE_BOEHM_GC)
118 LIBS="$LIBS -lgc $libdl"
121 AC_MSG_WARN("Compiling mono without GC.")
124 dnl When the JIT works with libgc, use this chunk.
125 dnl # If libgc was found, use it. Otherwise just warn.
126 if test "x$found_boehm" != "xyes"; then
127 AC_MSG_WARN("Compiling mono without GC.")
129 AC_DEFINE(HAVE_BOEHM_GC)
130 AC_SUBST(HAVE_BOEHM_GC)
131 LIBS="$LIBS -lgc $libdl"
134 dnl AC_MSG_WARN("Compiling mono without GC.")
138 if test x$platform_win32 = xno; then
139 dnl ******************************************************************
140 dnl *** Check for large file support ***
141 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
142 dnl ******************************************************************
144 # Check that off_t can represent 2**63 - 1 correctly, working around
145 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
146 # CPPFLAGS and sets $large_offt to yes if the test succeeds
148 AC_DEFUN(LARGE_FILES, [
149 large_CPPFLAGS=$CPPFLAGS
150 CPPFLAGS="$CPPFLAGS $1"
152 #include <sys/types.h>
154 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
157 int big_off_t=((BIG_OFF_T%2147483629==721) &&
158 (BIG_OFF_T%2147483647==1));
167 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
168 large_CPPFLAGS="$large_CPPFLAGS $1"
173 CPPFLAGS=$large_CPPFLAGS
176 AC_MSG_CHECKING(if off_t is 64 bits wide)
178 if test $large_offt = no; then
179 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
180 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
182 if test $large_offt = no; then
183 AC_MSG_WARN([No 64 bit file size support available])
186 dnl *****************************
187 dnl *** Checks for libsocket ***
188 dnl *****************************
189 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
191 dnl *******************************
192 dnl *** Checks for MSG_NOSIGNAL ***
193 dnl *******************************
194 AC_MSG_CHECKING(for MSG_NOSIGNAL)
195 AC_TRY_COMPILE([#include <sys/socket.h>], [
196 int f = MSG_NOSIGNAL;
200 AC_DEFINE(HAVE_MSG_NOSIGNAL)
202 # We'll have to use signals
206 dnl *****************************
207 dnl *** Checks for SOL_IP ***
208 dnl *****************************
209 AC_MSG_CHECKING(for SOL_IP)
210 AC_TRY_COMPILE([#include <netdb.h>], [
215 AC_DEFINE(HAVE_SOL_IP)
217 # We'll have to use getprotobyname
221 dnl *****************************
222 dnl *** Checks for SOL_TCP ***
223 dnl *****************************
224 AC_MSG_CHECKING(for SOL_TCP)
225 AC_TRY_COMPILE([#include <netdb.h>], [
230 AC_DEFINE(HAVE_SOL_TCP)
232 # We'll have to use getprotobyname
236 dnl *****************************
237 dnl *** Checks for IP_PKTINFO ***
238 dnl *****************************
239 AC_MSG_CHECKING(for IP_PKTINFO)
240 AC_TRY_COMPILE([#include <netdb.h>], [
241 int level = IP_PKTINFO;
245 AC_DEFINE(HAVE_IP_PKTINFO)
250 dnl *********************************
251 dnl *** Check for struct ip_mreqn ***
252 dnl *********************************
253 AC_MSG_CHECKING(for struct ip_mreqn)
254 AC_TRY_COMPILE([#include <netinet/in.h>], [
255 struct ip_mreqn mreq;
256 mreq.imr_address.s_addr = 0;
260 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
262 # We'll just have to use struct ip_mreq
266 dnl *****************************
267 dnl *** Checks for libnsl ***
268 dnl *****************************
269 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
271 AC_CHECK_FUNCS(inet_pton inet_aton)
273 dnl ***********************************************
274 dnl *** Checks for size of sockaddr_un.sun_path ***
275 dnl ***********************************************
276 # AC_CHECK_SIZEOF can't cope with struct members :-(
277 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
278 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
284 struct sockaddr_un sock_un;
285 FILE *f=fopen("conftestval", "w");
287 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
290 ], cv_mono_sizeof_sunpath=`cat conftestval`,
291 cv_mono_sizeof_sunpath=0,
292 cv_mono_sizeof_sunpath=0)])dnl
293 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
294 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
296 dnl *****************************
297 dnl *** Checks for libpthread ***
298 dnl *****************************
299 AC_SEARCH_LIBS(pthread_create, pthread c_r, [
300 AM_CONDITIONAL(THREADS_PTHREAD, true)
301 AC_DEFINE(HAVE_PTHREAD)
303 # Need pthread_mutex_timedlock
305 orig_CPPFLAGS=$CPPFLAGS
306 # This is a gcc-specific error, but we already set
307 # gcc-specific options in CFLAGS
308 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
309 AC_MSG_CHECKING(for pthread_mutex_timedlock)
310 AC_TRY_COMPILE([ #include <pthread.h>], [
311 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
312 pthread_mutex_timedlock(&mut, NULL);
316 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
320 # glibc requires -D_GNU_SOURCE before it will declare
322 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
323 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
324 AC_TRY_COMPILE([ #include <pthread.h>], [
325 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
326 pthread_mutex_timedlock(&mut, NULL);
329 pthread_CFLAGS="-D_GNU_SOURCE"
330 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
333 dnl Add other variants here
334 AC_MSG_WARN(Working around pthread_mutex_timedlock)
337 CPPFLAGS=$orig_CPPFLAGS
338 CPPFLAGS="$CPPFLAGS $pthread_CFLAGS"
340 # Need PTHREAD_MUTEX_RECURSIVE
342 orig_CPPFLAGS=$CPPFLAGS
343 # This is a gcc-specific error, but we already set
344 # gcc-specific options in CFLAGS
345 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
346 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
347 AC_TRY_COMPILE([ #include <pthread.h>], [
348 pthread_mutexattr_t attr;
349 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
356 # glibc requires -D_GNU_SOURCE before it will declare
358 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
359 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
360 AC_TRY_COMPILE([ #include <pthread.h>], [
361 pthread_mutexattr_t attr;
362 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
365 pthread_CFLAGS="-D_GNU_SOURCE"
368 dnl Add other variants here
369 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
370 AC_DEFINE(USE_MONO_MUTEX)
373 CPPFLAGS=$orig_CPPFLAGS
374 CPPFLAGS="$CPPFLAGS -D_REENTRANT $pthread_CFLAGS"
376 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
379 dnl ********************************
380 dnl *** Checks for semaphore lib ***
381 dnl ********************************
382 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
384 dnl ********************************
385 dnl *** Checks for timezone stuff **
386 dnl ********************************
387 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
392 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
393 if test $ac_cv_var_timezone = yes; then
394 AC_DEFINE(HAVE_TIMEZONE)
396 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
402 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
403 if test $ac_cv_struct_tm_gmtoff = yes; then
404 AC_DEFINE(HAVE_TM_GMTOFF)
406 AC_ERROR(unable to find a way to determine timezone)
410 AM_CONDITIONAL(THREADS_PTHREAD, false)
411 # This is a kludge, we really ought to test for libws2_32, but
412 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
413 # with @num suffixes)
414 LIBS="$LIBS -lws2_32"
415 CFLAGS="$CFLAGS -mno-cygwin"
418 dnl ****************************
419 dnl *** Look for /dev/random ***
420 dnl ****************************
422 AC_MSG_CHECKING([if usage of random device is requested])
423 AC_ARG_ENABLE(dev-random,
424 [ --disable-dev-random disable the use of the random device],
425 try_dev_random=$enableval, try_dev_random=yes)
426 AC_MSG_RESULT($try_dev_random)
430 NAME_DEV_RANDOM="/dev/srandom"
433 dnl Win32 does not have /dev/random, they have their own method...
435 *-*-mingw*|*-*-cygwin*)
436 ac_cv_have_dev_random = no
439 dnl Everywhere else, it's /dev/random
442 NAME_DEV_RANDOM="/dev/random"
446 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
448 dnl Now check if the device actually exists
450 if test "x$try_dev_random" = "xyes"; then
451 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
452 [if test -r "$NAME_DEV_RANDOM" ; then
453 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
454 if test "x$ac_cv_have_dev_random" = "xyes"; then
455 AC_DEFINE(HAVE_CRYPT_RNG)
458 AC_MSG_CHECKING(for random device)
459 ac_cv_have_dev_random=no
460 AC_MSG_RESULT(has been disabled)
463 if test "x$platform_win32" = "xyes"; then
464 AC_DEFINE(HAVE_CRYPT_RNG)
467 if test "x$ac_cv_have_dev_random" = "xno" \
468 && test "x$platform_win32" = "xno"; then
471 *** A system-provided entropy source was not found on this system.
472 *** Because of this, the System.Security.Cryptography random number generator
473 *** will throw a NotImplemented exception.
475 *** If you are seeing this message, and you know your system DOES have an
476 *** entropy collection in place, please contact <crichton@gimp.org> and
477 *** provide information about the system and how to access the random device.
479 *** For those systems who lack a random device, EGD support is forthcoming.
483 AC_MSG_CHECKING([if inter-process shared handles are requested])
484 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
485 AC_MSG_RESULT($try_shared_handles)
486 if test "x$try_shared_handles" != "xyes"; then
487 AC_DEFINE(DISABLE_SHARED_HANDLES)
488 AC_SUBST(DISABLE_SHARED_HANDLES)
492 ACCESS_UNALIGNED="yes"
495 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
496 i*86-*-*) TARGET=X86; arch_target=x86;;
497 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
498 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
499 #m68k-*-linux*) TARGET=M68K;;
500 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
501 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
504 if test ${TARGET} = unknown; then
505 CPPFLAGS="$CPPFLAGS -DNO_PORT"
506 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
509 if test ${ACCESS_UNALIGNED} = no; then
510 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
513 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
514 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
515 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
516 AM_CONDITIONAL(X86, test x$TARGET = xX86)
517 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
518 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
519 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
520 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
525 AC_SUBST(arch_target)
534 mono/metadata/Makefile
539 mono/os/win32/Makefile
540 mono/os/unix/Makefile
541 mono/arch/x86/Makefile
542 mono/arch/ppc/Makefile
543 mono/arch/sparc/Makefile
544 mono/arch/arm/Makefile
545 mono/interpreter/Makefile
547 mono/benchmark/Makefile
548 mono/monoburg/Makefile
549 mono/monograph/Makefile
551 mono/io-layer/Makefile
552 mono/handles/Makefile