4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(mono, 0.9)
8 AC_CONFIG_SUBDIRS(libgc)
9 AC_CHECK_TOOL(CC, gcc, gcc)
14 dnl may require a specific autoconf version
15 dnl AC_PROG_CC_FOR_BUILD
16 dnl CC_FOR_BUILD not automatically detected
19 if test "x$cross_compiling" = "xyes"; then
23 AC_SUBST(CC_FOR_BUILD)
25 AC_SUBST(BUILD_EXEEXT)
32 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h)
34 # not 64 bit clean in cross-compile
35 AC_CHECK_SIZEOF(void *, 4)
37 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations'
39 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
40 if test "x$PKG_CONFIG" = "xno"; then
41 AC_MSG_ERROR([You need to install pkg-config])
44 dnl for use on the build system
45 dnl pkg-config is stupid
46 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
47 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
48 AC_SUBST(BUILD_GLIB_CFLAGS)
49 AC_SUBST(BUILD_GLIB_LIBS)
52 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
53 if test x$with_crosspkgdir = "x"; then
54 if test -s $PKG_CONFIG_PATH; then
55 PKG_PATH=$PKG_CONFIG_PATH
58 PKG_PATH=$with_crosspkgdir
59 PKG_CONFIG_PATH=$PKG_PATH
60 export PKG_CONFIG_PATH
64 ## Versions of dependencies
65 GLIB_REQUIRED_VERSION=1.3.11
67 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
69 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
70 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
71 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
72 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
76 AC_SUBST(GMODULE_CFLAGS)
77 AC_SUBST(GMODULE_LIBS)
79 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes")
81 AC_ARG_WITH(gc, [ --with-gc=boehm,none],
82 if test x$with_gc = "xyes"; then
85 if test x$with_gc = "xboehm"; then
86 if test x$found_boehm != "xyes"; then
87 AC_MSG_ERROR(Boehm gc requested but libgc could not be found.)
90 AC_MSG_WARN("Compiling mono without GC.")
92 if test x$found_boehm != "xyes"; then
93 AC_MSG_WARN("Compiling mono without GC.")
98 if test x$with_gc = "xboehm"; then
99 AC_DEFINE(HAVE_BOEHM_GC)
100 AC_SUBST(HAVE_BOEHM_GC)
102 AC_MSG_RESULT("Compiling mono with Boehm GC.")
105 dnl ****************************************
106 dnl *** Check if we're building on win32 ***
107 dnl ****************************************
108 AC_MSG_CHECKING([if building for some Win32 platform])
110 *-*-mingw*|*-*-cygwin*)
112 AC_DEFINE(PLATFORM_WIN32)
118 AC_MSG_RESULT($platform_win32)
119 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
121 if test x$platform_win32 = xno; then
122 dnl ******************************************************************
123 dnl *** Check for large file support ***
124 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
125 dnl ******************************************************************
127 # Check that off_t can represent 2**63 - 1 correctly, working around
128 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
129 # CFLAGS and sets $large_offt to yes if the test succeeds
131 AC_DEFUN(LARGE_FILES, [
132 large_CPPFLAGS=$CPPFLAGS
133 CPPFLAGS="$CPPFLAGS $1"
135 #include <sys/types.h>
137 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
140 int big_off_t=((BIG_OFF_T%2147483629==721) &&
141 (BIG_OFF_T%2147483647==1));
150 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
156 CPPFLAGS=$large_CPPFLAGS
159 AC_MSG_CHECKING(if off_t is 64 bits wide)
161 if test $large_offt = no; then
162 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
163 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
165 if test $large_offt = no; then
166 AC_MSG_WARN([No 64 bit file size support available])
169 dnl *****************************
170 dnl *** Checks for libsocket ***
171 dnl *****************************
172 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
174 dnl *****************************
175 dnl *** Checks for SOL_IP ***
176 dnl *****************************
177 AC_MSG_CHECKING(for SOL_IP)
178 AC_TRY_COMPILE([#include <netdb.h>], [
183 AC_DEFINE(HAVE_SOL_IP)
185 # We'll have to use getprotobyname
189 dnl *****************************
190 dnl *** Checks for SOL_TCP ***
191 dnl *****************************
192 AC_MSG_CHECKING(for SOL_TCP)
193 AC_TRY_COMPILE([#include <netdb.h>], [
198 AC_DEFINE(HAVE_SOL_TCP)
200 # We'll have to use getprotobyname
204 dnl *****************************
205 dnl *** Checks for IP_PKTINFO ***
206 dnl *****************************
207 AC_MSG_CHECKING(for IP_PKTINFO)
208 AC_TRY_COMPILE([#include <netdb.h>], [
209 int level = IP_PKTINFO;
213 AC_DEFINE(HAVE_IP_PKTINFO)
218 dnl *********************************
219 dnl *** Check for struct ip_mreqn ***
220 dnl *********************************
221 AC_MSG_CHECKING(for struct ip_mreqn)
222 AC_TRY_COMPILE([#include <netinet/in.h>], [
223 struct ip_mreqn mreq;
224 mreq.imr_address.s_addr = 0;
228 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
230 # We'll just have to use struct ip_mreq
234 dnl *****************************
235 dnl *** Checks for libnsl ***
236 dnl *****************************
237 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
239 AC_CHECK_FUNCS(inet_pton inet_aton)
241 dnl *****************************
242 dnl *** Checks for libpthread ***
243 dnl *****************************
244 AC_SEARCH_LIBS(pthread_create, pthread, [
245 AM_CONDITIONAL(THREADS_PTHREAD, true)
246 AC_DEFINE(HAVE_PTHREAD)
248 # Need pthread_mutex_timedlock
250 orig_CPPFLAGS=$CPPFLAGS
251 # This is a gcc-specific error, but we already set
252 # gcc-specific options in CFLAGS
253 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
254 AC_MSG_CHECKING(for pthread_mutex_timedlock)
255 AC_TRY_COMPILE([ #include <pthread.h>], [
256 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
257 pthread_mutex_timedlock(&mut, NULL);
261 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
265 # glibc requires -D_GNU_SOURCE before it will declare
267 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
268 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
269 AC_TRY_COMPILE([ #include <pthread.h>], [
270 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
271 pthread_mutex_timedlock(&mut, NULL);
274 pthread_CFLAGS="-D_GNU_SOURCE"
275 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
278 dnl Add other variants here
279 AC_MSG_WARN(Working around pthread_mutex_timedlock)
282 CPPFLAGS=$orig_CPPFLAGS
283 CFLAGS="$CFLAGS $pthread_CFLAGS"
285 # Need PTHREAD_MUTEX_RECURSIVE
287 orig_CPPFLAGS=$CPPFLAGS
288 # This is a gcc-specific error, but we already set
289 # gcc-specific options in CFLAGS
290 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
291 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
292 AC_TRY_COMPILE([ #include <pthread.h>], [
293 pthread_mutexattr_t attr;
294 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
301 # glibc requires -D_GNU_SOURCE before it will declare
303 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
304 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
305 AC_TRY_COMPILE([ #include <pthread.h>], [
306 pthread_mutexattr_t attr;
307 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
310 pthread_CFLAGS="-D_GNU_SOURCE"
313 dnl Add other variants here
314 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
315 AC_DEFINE(USE_MONO_MUTEX)
318 CPPFLAGS=$orig_CPPFLAGS
319 CFLAGS="$CFLAGS $pthread_CFLAGS"
321 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
324 dnl ********************************
325 dnl *** Checks for semaphore lib ***
326 dnl ********************************
327 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
329 # This is a kludge, we really ought to test for libws2_32, but
330 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
331 # with @num suffixes)
332 LIBS="$LIBS -lws2_32"
333 CFLAGS="$CFLAGS -mno-cygwin"
336 dnl ****************************
337 dnl *** Look for /dev/random ***
338 dnl ****************************
340 AC_MSG_CHECKING([if usage of random device is requested])
341 AC_ARG_ENABLE(dev-random,
342 [ --disable-dev-random disable the use of the random device],
343 try_dev_random=$enableval, try_dev_random=yes)
344 AC_MSG_RESULT($try_dev_random)
348 NAME_DEV_RANDOM="/dev/srandom"
351 dnl Win32 does not have /dev/random, they have their own method...
353 *-*-mingw*|*-*-cygwin*)
354 ac_cv_have_dev_random = no
357 dnl Everywhere else, it's /dev/random
360 NAME_DEV_RANDOM="/dev/random"
364 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
366 dnl Now check if the device actually exists
368 if test "x$try_dev_random" = "xyes"; then
369 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
370 [if test -r "$NAME_DEV_RANDOM" ; then
371 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
372 if test "x$ac_cv_have_dev_random" = "xyes"; then
373 AC_DEFINE(HAVE_CRYPT_RNG)
376 AC_MSG_CHECKING(for random device)
377 ac_cv_have_dev_random=no
378 AC_MSG_RESULT(has been disabled)
381 if test "x$platform_win32" = "xyes"; then
382 AC_DEFINE(HAVE_CRYPT_RNG)
385 if test "x$ac_cv_have_dev_random" = "xno" \
386 && test "x$platform_win32" = "xno"; then
389 *** A system-provided entropy source was not found on this system.
390 *** Because of this, the System.Security.Cryptography random number generator
391 *** will throw a NotImplemented exception.
393 *** If you are seeing this message, and you know your system DOES have an
394 *** entropy collection in place, please contact <crichton@gimp.org> and
395 *** provide information about the system and how to access the random device.
397 *** For those systems who lack a random device, EGD support is forthcoming.
401 if test "x$cross_compiling" = "xno"; then
402 # check for new iconv version
403 AC_MSG_CHECKING(for new iconv)
404 AC_CACHE_VAL(new_iconv,[
405 AC_TRY_RUN([#include <stdio.h>
410 exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
413 new_iconv=yes,new_iconv=)])
414 if test -n "$new_iconv"; then
416 AC_DEFINE(HAVE_NEW_ICONV)
423 ACCESS_UNALIGNED="yes"
426 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
427 i*86-*-*) TARGET=X86; arch_target=x86;;
428 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
429 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
430 #m68k-*-linux*) TARGET=M68K;;
431 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
432 arm-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
435 if test ${TARGET} = unknown; then
436 CFLAGS="$CFLAGS -DNO_PORT"
437 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
440 if test ${ACCESS_UNALIGNED} = no; then
441 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
444 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
445 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
446 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
447 AM_CONDITIONAL(X86, test x$TARGET = xX86)
448 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
449 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
450 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
451 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
453 AC_SUBST(arch_target)
459 mono/metadata/Makefile
463 mono/arch/x86/Makefile
464 mono/arch/ppc/Makefile
465 mono/arch/sparc/Makefile
466 mono/arch/arm/Makefile
467 mono/interpreter/Makefile
469 mono/wrapper/Makefile
470 mono/monoburg/Makefile
471 mono/monograph/Makefile
473 mono/io-layer/Makefile