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'
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 dnl When the JIT works with libgc, use this chunk.
97 dnl # If libgc was found, use it. Otherwise just warn.
98 dnl if test "x$found_boehm" != "xyes"; then
99 dnl AC_MSG_WARN("Compiling mono without GC.")
101 dnl AC_DEFINE(HAVE_BOEHM_GC)
102 dnl AC_SUBST(HAVE_BOEHM_GC)
103 dnl LIBS="$LIBS -lgc"
105 AC_MSG_WARN("Compiling mono without GC.")
109 dnl ****************************************
110 dnl *** Check if we're building on win32 ***
111 dnl ****************************************
112 AC_MSG_CHECKING([if building for some Win32 platform])
114 *-*-mingw*|*-*-cygwin*)
116 AC_DEFINE(PLATFORM_WIN32)
122 AC_MSG_RESULT($platform_win32)
123 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
125 if test x$platform_win32 = xno; then
126 dnl ******************************************************************
127 dnl *** Check for large file support ***
128 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
129 dnl ******************************************************************
131 # Check that off_t can represent 2**63 - 1 correctly, working around
132 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
133 # CFLAGS and sets $large_offt to yes if the test succeeds
135 AC_DEFUN(LARGE_FILES, [
136 large_CPPFLAGS=$CPPFLAGS
137 CPPFLAGS="$CPPFLAGS $1"
139 #include <sys/types.h>
141 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
144 int big_off_t=((BIG_OFF_T%2147483629==721) &&
145 (BIG_OFF_T%2147483647==1));
154 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
160 CPPFLAGS=$large_CPPFLAGS
163 AC_MSG_CHECKING(if off_t is 64 bits wide)
165 if test $large_offt = no; then
166 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
167 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
169 if test $large_offt = no; then
170 AC_MSG_WARN([No 64 bit file size support available])
173 dnl *****************************
174 dnl *** Checks for libsocket ***
175 dnl *****************************
176 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
178 dnl *****************************
179 dnl *** Checks for SOL_IP ***
180 dnl *****************************
181 AC_MSG_CHECKING(for SOL_IP)
182 AC_TRY_COMPILE([#include <netdb.h>], [
187 AC_DEFINE(HAVE_SOL_IP)
189 # We'll have to use getprotobyname
193 dnl *****************************
194 dnl *** Checks for SOL_TCP ***
195 dnl *****************************
196 AC_MSG_CHECKING(for SOL_TCP)
197 AC_TRY_COMPILE([#include <netdb.h>], [
202 AC_DEFINE(HAVE_SOL_TCP)
204 # We'll have to use getprotobyname
208 dnl *****************************
209 dnl *** Checks for IP_PKTINFO ***
210 dnl *****************************
211 AC_MSG_CHECKING(for IP_PKTINFO)
212 AC_TRY_COMPILE([#include <netdb.h>], [
213 int level = IP_PKTINFO;
217 AC_DEFINE(HAVE_IP_PKTINFO)
222 dnl *********************************
223 dnl *** Check for struct ip_mreqn ***
224 dnl *********************************
225 AC_MSG_CHECKING(for struct ip_mreqn)
226 AC_TRY_COMPILE([#include <netinet/in.h>], [
227 struct ip_mreqn mreq;
228 mreq.imr_address.s_addr = 0;
232 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
234 # We'll just have to use struct ip_mreq
238 dnl *****************************
239 dnl *** Checks for libnsl ***
240 dnl *****************************
241 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
243 AC_CHECK_FUNCS(inet_pton inet_aton)
245 dnl *****************************
246 dnl *** Checks for libpthread ***
247 dnl *****************************
248 AC_SEARCH_LIBS(pthread_create, pthread, [
249 AM_CONDITIONAL(THREADS_PTHREAD, true)
250 AC_DEFINE(HAVE_PTHREAD)
252 # Need pthread_mutex_timedlock
254 orig_CPPFLAGS=$CPPFLAGS
255 # This is a gcc-specific error, but we already set
256 # gcc-specific options in CFLAGS
257 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
258 AC_MSG_CHECKING(for pthread_mutex_timedlock)
259 AC_TRY_COMPILE([ #include <pthread.h>], [
260 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
261 pthread_mutex_timedlock(&mut, NULL);
265 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
269 # glibc requires -D_GNU_SOURCE before it will declare
271 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
272 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
273 AC_TRY_COMPILE([ #include <pthread.h>], [
274 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
275 pthread_mutex_timedlock(&mut, NULL);
278 pthread_CFLAGS="-D_GNU_SOURCE"
279 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
282 dnl Add other variants here
283 AC_MSG_WARN(Working around pthread_mutex_timedlock)
286 CPPFLAGS=$orig_CPPFLAGS
287 CFLAGS="$CFLAGS $pthread_CFLAGS"
289 # Need PTHREAD_MUTEX_RECURSIVE
291 orig_CPPFLAGS=$CPPFLAGS
292 # This is a gcc-specific error, but we already set
293 # gcc-specific options in CFLAGS
294 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
295 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
296 AC_TRY_COMPILE([ #include <pthread.h>], [
297 pthread_mutexattr_t attr;
298 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
305 # glibc requires -D_GNU_SOURCE before it will declare
307 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
308 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
309 AC_TRY_COMPILE([ #include <pthread.h>], [
310 pthread_mutexattr_t attr;
311 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
314 pthread_CFLAGS="-D_GNU_SOURCE"
317 dnl Add other variants here
318 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
319 AC_DEFINE(USE_MONO_MUTEX)
322 CPPFLAGS=$orig_CPPFLAGS
323 CFLAGS="$CFLAGS $pthread_CFLAGS"
325 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
328 dnl ********************************
329 dnl *** Checks for semaphore lib ***
330 dnl ********************************
331 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
333 # This is a kludge, we really ought to test for libws2_32, but
334 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
335 # with @num suffixes)
336 LIBS="$LIBS -lws2_32"
337 CFLAGS="$CFLAGS -mno-cygwin"
340 dnl ****************************
341 dnl *** Look for /dev/random ***
342 dnl ****************************
344 AC_MSG_CHECKING([if usage of random device is requested])
345 AC_ARG_ENABLE(dev-random,
346 [ --disable-dev-random disable the use of the random device],
347 try_dev_random=$enableval, try_dev_random=yes)
348 AC_MSG_RESULT($try_dev_random)
352 NAME_DEV_RANDOM="/dev/srandom"
355 dnl Win32 does not have /dev/random, they have their own method...
357 *-*-mingw*|*-*-cygwin*)
358 ac_cv_have_dev_random = no
361 dnl Everywhere else, it's /dev/random
364 NAME_DEV_RANDOM="/dev/random"
368 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
370 dnl Now check if the device actually exists
372 if test "x$try_dev_random" = "xyes"; then
373 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
374 [if test -r "$NAME_DEV_RANDOM" ; then
375 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
376 if test "x$ac_cv_have_dev_random" = "xyes"; then
377 AC_DEFINE(HAVE_CRYPT_RNG)
380 AC_MSG_CHECKING(for random device)
381 ac_cv_have_dev_random=no
382 AC_MSG_RESULT(has been disabled)
385 if test "x$platform_win32" = "xyes"; then
386 AC_DEFINE(HAVE_CRYPT_RNG)
389 if test "x$ac_cv_have_dev_random" = "xno" \
390 && test "x$platform_win32" = "xno"; then
393 *** A system-provided entropy source was not found on this system.
394 *** Because of this, the System.Security.Cryptography random number generator
395 *** will throw a NotImplemented exception.
397 *** If you are seeing this message, and you know your system DOES have an
398 *** entropy collection in place, please contact <crichton@gimp.org> and
399 *** provide information about the system and how to access the random device.
401 *** For those systems who lack a random device, EGD support is forthcoming.
405 if test "x$cross_compiling" = "xno"; then
406 # check for new iconv version
407 AC_MSG_CHECKING(for new iconv)
408 AC_CACHE_VAL(new_iconv,[
409 AC_TRY_RUN([#include <stdio.h>
414 exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
417 new_iconv=yes,new_iconv=)])
418 if test -n "$new_iconv"; then
420 AC_DEFINE(HAVE_NEW_ICONV)
427 ACCESS_UNALIGNED="yes"
430 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
431 i*86-*-*) TARGET=X86; arch_target=x86;;
432 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
433 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
434 #m68k-*-linux*) TARGET=M68K;;
435 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
436 arm-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
439 if test ${TARGET} = unknown; then
440 CFLAGS="$CFLAGS -DNO_PORT"
441 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
444 if test ${ACCESS_UNALIGNED} = no; then
445 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
448 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
449 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
450 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
451 AM_CONDITIONAL(X86, test x$TARGET = xX86)
452 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
453 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
454 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
455 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
457 AC_SUBST(arch_target)
464 mono/metadata/Makefile
468 mono/arch/x86/Makefile
469 mono/arch/ppc/Makefile
470 mono/arch/sparc/Makefile
471 mono/arch/arm/Makefile
472 mono/interpreter/Makefile
474 mono/wrapper/Makefile
475 mono/monoburg/Makefile
476 mono/monograph/Makefile
478 mono/io-layer/Makefile