4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(mono, 0.10)
8 AC_CHECK_TOOL(CC, gcc, gcc)
13 dnl may require a specific autoconf version
14 dnl AC_PROG_CC_FOR_BUILD
15 dnl CC_FOR_BUILD not automatically detected
18 if test "x$cross_compiling" = "xyes"; then
22 AC_SUBST(CC_FOR_BUILD)
24 AC_SUBST(BUILD_EXEEXT)
31 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h)
33 # for mono/metadata/debug-symfile.c
34 AC_CHECK_HEADERS(elf.h)
36 # not 64 bit clean in cross-compile
37 AC_CHECK_SIZEOF(void *, 4)
39 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings'
41 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
42 if test "x$PKG_CONFIG" = "xno"; then
43 AC_MSG_ERROR([You need to install pkg-config])
46 dnl for use on the build system
47 dnl pkg-config is stupid
48 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
49 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
50 AC_SUBST(BUILD_GLIB_CFLAGS)
51 AC_SUBST(BUILD_GLIB_LIBS)
54 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
55 if test x$with_crosspkgdir = "x"; then
56 if test -s $PKG_CONFIG_PATH; then
57 PKG_PATH=$PKG_CONFIG_PATH
60 PKG_PATH=$with_crosspkgdir
61 PKG_CONFIG_PATH=$PKG_PATH
62 export PKG_CONFIG_PATH
66 ## Versions of dependencies
67 GLIB_REQUIRED_VERSION=1.3.11
69 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
71 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
72 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
73 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
74 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
78 AC_SUBST(GMODULE_CFLAGS)
79 AC_SUBST(GMODULE_LIBS)
81 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes")
83 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
87 if test "x$found_boehm" != "xyes"; then
88 AC_MSG_ERROR("GC requested but libgc not found!")
91 AC_DEFINE(HAVE_BOEHM_GC)
92 AC_SUBST(HAVE_BOEHM_GC)
96 AC_MSG_WARN("Compiling mono without GC.")
99 dnl When the JIT works with libgc, use this chunk.
100 dnl # If libgc was found, use it. Otherwise just warn.
101 if test "x$found_boehm" != "xyes"; then
102 AC_MSG_WARN("Compiling mono without GC.")
104 AC_DEFINE(HAVE_BOEHM_GC)
105 AC_SUBST(HAVE_BOEHM_GC)
109 dnl AC_MSG_WARN("Compiling mono without GC.")
113 dnl ****************************************
114 dnl *** Check if we're building on win32 ***
115 dnl ****************************************
116 AC_MSG_CHECKING([if building for some Win32 platform])
118 *-*-mingw*|*-*-cygwin*)
120 AC_DEFINE(PLATFORM_WIN32)
126 AC_MSG_RESULT($platform_win32)
127 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
129 if test x$platform_win32 = xno; then
130 dnl ******************************************************************
131 dnl *** Check for large file support ***
132 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
133 dnl ******************************************************************
135 # Check that off_t can represent 2**63 - 1 correctly, working around
136 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
137 # CFLAGS and sets $large_offt to yes if the test succeeds
139 AC_DEFUN(LARGE_FILES, [
140 large_CPPFLAGS=$CPPFLAGS
141 CPPFLAGS="$CPPFLAGS $1"
143 #include <sys/types.h>
145 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
148 int big_off_t=((BIG_OFF_T%2147483629==721) &&
149 (BIG_OFF_T%2147483647==1));
158 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
164 CPPFLAGS=$large_CPPFLAGS
167 AC_MSG_CHECKING(if off_t is 64 bits wide)
169 if test $large_offt = no; then
170 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
171 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
173 if test $large_offt = no; then
174 AC_MSG_WARN([No 64 bit file size support available])
177 dnl *****************************
178 dnl *** Checks for libsocket ***
179 dnl *****************************
180 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
182 dnl *****************************
183 dnl *** Checks for SOL_IP ***
184 dnl *****************************
185 AC_MSG_CHECKING(for SOL_IP)
186 AC_TRY_COMPILE([#include <netdb.h>], [
191 AC_DEFINE(HAVE_SOL_IP)
193 # We'll have to use getprotobyname
197 dnl *****************************
198 dnl *** Checks for SOL_TCP ***
199 dnl *****************************
200 AC_MSG_CHECKING(for SOL_TCP)
201 AC_TRY_COMPILE([#include <netdb.h>], [
206 AC_DEFINE(HAVE_SOL_TCP)
208 # We'll have to use getprotobyname
212 dnl *****************************
213 dnl *** Checks for IP_PKTINFO ***
214 dnl *****************************
215 AC_MSG_CHECKING(for IP_PKTINFO)
216 AC_TRY_COMPILE([#include <netdb.h>], [
217 int level = IP_PKTINFO;
221 AC_DEFINE(HAVE_IP_PKTINFO)
226 dnl *********************************
227 dnl *** Check for struct ip_mreqn ***
228 dnl *********************************
229 AC_MSG_CHECKING(for struct ip_mreqn)
230 AC_TRY_COMPILE([#include <netinet/in.h>], [
231 struct ip_mreqn mreq;
232 mreq.imr_address.s_addr = 0;
236 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
238 # We'll just have to use struct ip_mreq
242 dnl *****************************
243 dnl *** Checks for libnsl ***
244 dnl *****************************
245 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
247 AC_CHECK_FUNCS(inet_pton inet_aton)
249 dnl *****************************
250 dnl *** Checks for libpthread ***
251 dnl *****************************
252 AC_SEARCH_LIBS(pthread_create, pthread, [
253 AM_CONDITIONAL(THREADS_PTHREAD, true)
254 AC_DEFINE(HAVE_PTHREAD)
256 # Need pthread_mutex_timedlock
258 orig_CPPFLAGS=$CPPFLAGS
259 # This is a gcc-specific error, but we already set
260 # gcc-specific options in CFLAGS
261 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
262 AC_MSG_CHECKING(for pthread_mutex_timedlock)
263 AC_TRY_COMPILE([ #include <pthread.h>], [
264 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
265 pthread_mutex_timedlock(&mut, NULL);
269 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
273 # glibc requires -D_GNU_SOURCE before it will declare
275 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
276 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
277 AC_TRY_COMPILE([ #include <pthread.h>], [
278 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
279 pthread_mutex_timedlock(&mut, NULL);
282 pthread_CFLAGS="-D_GNU_SOURCE"
283 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
286 dnl Add other variants here
287 AC_MSG_WARN(Working around pthread_mutex_timedlock)
290 CPPFLAGS=$orig_CPPFLAGS
291 CFLAGS="$CFLAGS $pthread_CFLAGS"
293 # Need PTHREAD_MUTEX_RECURSIVE
295 orig_CPPFLAGS=$CPPFLAGS
296 # This is a gcc-specific error, but we already set
297 # gcc-specific options in CFLAGS
298 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
299 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
300 AC_TRY_COMPILE([ #include <pthread.h>], [
301 pthread_mutexattr_t attr;
302 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
309 # glibc requires -D_GNU_SOURCE before it will declare
311 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
312 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
313 AC_TRY_COMPILE([ #include <pthread.h>], [
314 pthread_mutexattr_t attr;
315 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
318 pthread_CFLAGS="-D_GNU_SOURCE"
321 dnl Add other variants here
322 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
323 AC_DEFINE(USE_MONO_MUTEX)
326 CPPFLAGS=$orig_CPPFLAGS
327 CFLAGS="$CFLAGS $pthread_CFLAGS"
329 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
332 dnl ********************************
333 dnl *** Checks for semaphore lib ***
334 dnl ********************************
335 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
337 # This is a kludge, we really ought to test for libws2_32, but
338 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
339 # with @num suffixes)
340 LIBS="$LIBS -lws2_32"
341 CFLAGS="$CFLAGS -mno-cygwin"
344 dnl ****************************
345 dnl *** Look for /dev/random ***
346 dnl ****************************
348 AC_MSG_CHECKING([if usage of random device is requested])
349 AC_ARG_ENABLE(dev-random,
350 [ --disable-dev-random disable the use of the random device],
351 try_dev_random=$enableval, try_dev_random=yes)
352 AC_MSG_RESULT($try_dev_random)
356 NAME_DEV_RANDOM="/dev/srandom"
359 dnl Win32 does not have /dev/random, they have their own method...
361 *-*-mingw*|*-*-cygwin*)
362 ac_cv_have_dev_random = no
365 dnl Everywhere else, it's /dev/random
368 NAME_DEV_RANDOM="/dev/random"
372 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
374 dnl Now check if the device actually exists
376 if test "x$try_dev_random" = "xyes"; then
377 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
378 [if test -r "$NAME_DEV_RANDOM" ; then
379 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
380 if test "x$ac_cv_have_dev_random" = "xyes"; then
381 AC_DEFINE(HAVE_CRYPT_RNG)
384 AC_MSG_CHECKING(for random device)
385 ac_cv_have_dev_random=no
386 AC_MSG_RESULT(has been disabled)
389 if test "x$platform_win32" = "xyes"; then
390 AC_DEFINE(HAVE_CRYPT_RNG)
393 if test "x$ac_cv_have_dev_random" = "xno" \
394 && test "x$platform_win32" = "xno"; then
397 *** A system-provided entropy source was not found on this system.
398 *** Because of this, the System.Security.Cryptography random number generator
399 *** will throw a NotImplemented exception.
401 *** If you are seeing this message, and you know your system DOES have an
402 *** entropy collection in place, please contact <crichton@gimp.org> and
403 *** provide information about the system and how to access the random device.
405 *** For those systems who lack a random device, EGD support is forthcoming.
409 if test "x$cross_compiling" = "xno"; then
410 # check for new iconv version
411 AC_MSG_CHECKING(for new iconv)
412 AC_CACHE_VAL(new_iconv,[
413 AC_TRY_RUN([#include <stdio.h>
418 exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
421 new_iconv=yes,new_iconv=)])
422 if test -n "$new_iconv"; then
424 AC_DEFINE(HAVE_NEW_ICONV)
431 ACCESS_UNALIGNED="yes"
434 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
435 i*86-*-*) TARGET=X86; arch_target=x86;;
436 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
437 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
438 #m68k-*-linux*) TARGET=M68K;;
439 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
440 arm-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
443 if test ${TARGET} = unknown; then
444 CFLAGS="$CFLAGS -DNO_PORT"
445 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
448 if test ${ACCESS_UNALIGNED} = no; then
449 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
452 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
453 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
454 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
455 AM_CONDITIONAL(X86, test x$TARGET = xX86)
456 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
457 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
458 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
459 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
461 AC_SUBST(arch_target)
468 mono/metadata/Makefile
472 mono/arch/x86/Makefile
473 mono/arch/ppc/Makefile
474 mono/arch/sparc/Makefile
475 mono/arch/arm/Makefile
476 mono/interpreter/Makefile
478 mono/monoburg/Makefile
479 mono/monograph/Makefile
481 mono/io-layer/Makefile