4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(mono, 0.12)
8 dnl ****************************************
9 dnl *** Check if we're building on win32 ***
10 dnl ****************************************
11 AC_MSG_CHECKING([if building for some Win32 platform])
13 *-*-mingw*|*-*-cygwin*)
15 AC_DEFINE(PLATFORM_WIN32)
22 AC_MSG_RESULT($platform_win32)
23 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
25 AC_CHECK_TOOL(CC, gcc, gcc)
30 dnl may require a specific autoconf version
31 dnl AC_PROG_CC_FOR_BUILD
32 dnl CC_FOR_BUILD not automatically detected
35 if test "x$cross_compiling" = "xyes"; then
39 AC_SUBST(CC_FOR_BUILD)
41 AC_SUBST(BUILD_EXEEXT)
48 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h)
50 AC_CHECK_HEADERS(iconv.h)
51 AC_CHECK_HEADERS(giconv.h)
53 # for mono/metadata/debug-symfile.c
54 AC_CHECK_HEADERS(elf.h)
56 # not 64 bit clean in cross-compile
57 AC_CHECK_SIZEOF(void *, 4)
59 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
61 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
62 if test "x$PKG_CONFIG" = "xno"; then
63 AC_MSG_ERROR([You need to install pkg-config])
66 dnl for use on the build system
67 dnl pkg-config is stupid
68 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
69 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
70 AC_SUBST(BUILD_GLIB_CFLAGS)
71 AC_SUBST(BUILD_GLIB_LIBS)
74 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
75 if test x$with_crosspkgdir = "x"; then
76 if test -s $PKG_CONFIG_PATH; then
77 PKG_PATH=$PKG_CONFIG_PATH
80 PKG_PATH=$with_crosspkgdir
81 PKG_CONFIG_PATH=$PKG_PATH
82 export PKG_CONFIG_PATH
86 ## Versions of dependencies
87 GLIB_REQUIRED_VERSION=1.3.11
89 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
91 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
92 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
93 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
94 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
98 AC_SUBST(GMODULE_CFLAGS)
99 AC_SUBST(GMODULE_LIBS)
101 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes")
103 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
107 if test "x$found_boehm" != "xyes"; then
108 AC_MSG_ERROR("GC requested but libgc not found!")
111 AC_DEFINE(HAVE_BOEHM_GC)
112 AC_SUBST(HAVE_BOEHM_GC)
116 AC_MSG_WARN("Compiling mono without GC.")
119 dnl When the JIT works with libgc, use this chunk.
120 dnl # If libgc was found, use it. Otherwise just warn.
121 if test "x$found_boehm" != "xyes"; then
122 AC_MSG_WARN("Compiling mono without GC.")
124 AC_DEFINE(HAVE_BOEHM_GC)
125 AC_SUBST(HAVE_BOEHM_GC)
129 dnl AC_MSG_WARN("Compiling mono without GC.")
133 if test x$platform_win32 = xno; then
134 dnl ******************************************************************
135 dnl *** Check for large file support ***
136 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
137 dnl ******************************************************************
139 # Check that off_t can represent 2**63 - 1 correctly, working around
140 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
141 # CPPFLAGS and sets $large_offt to yes if the test succeeds
143 AC_DEFUN(LARGE_FILES, [
144 large_CPPFLAGS=$CPPFLAGS
145 CPPFLAGS="$CPPFLAGS $1"
147 #include <sys/types.h>
149 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
152 int big_off_t=((BIG_OFF_T%2147483629==721) &&
153 (BIG_OFF_T%2147483647==1));
162 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
163 large_CPPFLAGS="$large_CPPFLAGS $1"
168 CPPFLAGS=$large_CPPFLAGS
171 AC_MSG_CHECKING(if off_t is 64 bits wide)
173 if test $large_offt = no; then
174 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
175 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
177 if test $large_offt = no; then
178 AC_MSG_WARN([No 64 bit file size support available])
181 dnl *****************************
182 dnl *** Checks for libsocket ***
183 dnl *****************************
184 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
186 dnl *******************************
187 dnl *** Checks for MSG_NOSIGNAL ***
188 dnl *******************************
189 AC_MSG_CHECKING(for MSG_NOSIGNAL)
190 AC_TRY_COMPILE([#include <sys/socket.h>], [
191 int f = MSG_NOSIGNAL;
195 AC_DEFINE(HAVE_MSG_NOSIGNAL)
197 # We'll have to use signals
201 dnl *****************************
202 dnl *** Checks for SOL_IP ***
203 dnl *****************************
204 AC_MSG_CHECKING(for SOL_IP)
205 AC_TRY_COMPILE([#include <netdb.h>], [
210 AC_DEFINE(HAVE_SOL_IP)
212 # We'll have to use getprotobyname
216 dnl *****************************
217 dnl *** Checks for SOL_TCP ***
218 dnl *****************************
219 AC_MSG_CHECKING(for SOL_TCP)
220 AC_TRY_COMPILE([#include <netdb.h>], [
225 AC_DEFINE(HAVE_SOL_TCP)
227 # We'll have to use getprotobyname
231 dnl *****************************
232 dnl *** Checks for IP_PKTINFO ***
233 dnl *****************************
234 AC_MSG_CHECKING(for IP_PKTINFO)
235 AC_TRY_COMPILE([#include <netdb.h>], [
236 int level = IP_PKTINFO;
240 AC_DEFINE(HAVE_IP_PKTINFO)
245 dnl *********************************
246 dnl *** Check for struct ip_mreqn ***
247 dnl *********************************
248 AC_MSG_CHECKING(for struct ip_mreqn)
249 AC_TRY_COMPILE([#include <netinet/in.h>], [
250 struct ip_mreqn mreq;
251 mreq.imr_address.s_addr = 0;
255 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
257 # We'll just have to use struct ip_mreq
261 dnl *****************************
262 dnl *** Checks for libnsl ***
263 dnl *****************************
264 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
266 AC_CHECK_FUNCS(inet_pton inet_aton)
268 dnl ***********************************************
269 dnl *** Checks for size of sockaddr_un.sun_path ***
270 dnl ***********************************************
271 # AC_CHECK_SIZEOF can't cope with struct members :-(
272 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
273 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
279 struct sockaddr_un sock_un;
280 FILE *f=fopen("conftestval", "w");
282 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
285 ], cv_mono_sizeof_sunpath=`cat conftestval`,
286 cv_mono_sizeof_sunpath=0,
287 cv_mono_sizeof_sunpath=0)])dnl
288 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
289 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
291 dnl *****************************
292 dnl *** Checks for libpthread ***
293 dnl *****************************
294 AC_SEARCH_LIBS(pthread_create, pthread c_r, [
295 AM_CONDITIONAL(THREADS_PTHREAD, true)
296 AC_DEFINE(HAVE_PTHREAD)
298 # Need pthread_mutex_timedlock
300 orig_CPPFLAGS=$CPPFLAGS
301 # This is a gcc-specific error, but we already set
302 # gcc-specific options in CFLAGS
303 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
304 AC_MSG_CHECKING(for pthread_mutex_timedlock)
305 AC_TRY_COMPILE([ #include <pthread.h>], [
306 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
307 pthread_mutex_timedlock(&mut, NULL);
311 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
315 # glibc requires -D_GNU_SOURCE before it will declare
317 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
318 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
319 AC_TRY_COMPILE([ #include <pthread.h>], [
320 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
321 pthread_mutex_timedlock(&mut, NULL);
324 pthread_CFLAGS="-D_GNU_SOURCE"
325 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
328 dnl Add other variants here
329 AC_MSG_WARN(Working around pthread_mutex_timedlock)
332 CPPFLAGS=$orig_CPPFLAGS
333 CPPFLAGS="$CPPFLAGS $pthread_CFLAGS"
335 # Need PTHREAD_MUTEX_RECURSIVE
337 orig_CPPFLAGS=$CPPFLAGS
338 # This is a gcc-specific error, but we already set
339 # gcc-specific options in CFLAGS
340 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
341 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
342 AC_TRY_COMPILE([ #include <pthread.h>], [
343 pthread_mutexattr_t attr;
344 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
351 # glibc requires -D_GNU_SOURCE before it will declare
353 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
354 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
355 AC_TRY_COMPILE([ #include <pthread.h>], [
356 pthread_mutexattr_t attr;
357 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
360 pthread_CFLAGS="-D_GNU_SOURCE"
363 dnl Add other variants here
364 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
365 AC_DEFINE(USE_MONO_MUTEX)
368 CPPFLAGS=$orig_CPPFLAGS
369 CPPFLAGS="$CPPFLAGS $pthread_CFLAGS"
371 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
374 dnl ********************************
375 dnl *** Checks for semaphore lib ***
376 dnl ********************************
377 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
379 dnl ********************************
380 dnl *** Checks for timezone stuff **
381 dnl ********************************
382 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
387 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
388 if test $ac_cv_var_timezone = yes; then
389 AC_DEFINE(HAVE_TIMEZONE)
391 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
397 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
398 if test $ac_cv_struct_tm_gmtoff = yes; then
399 AC_DEFINE(HAVE_TM_GMTOFF)
401 AC_ERROR(unable to find a way to determine timezone)
405 AM_CONDITIONAL(THREADS_PTHREAD, false)
406 # This is a kludge, we really ought to test for libws2_32, but
407 # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
408 # with @num suffixes)
409 LIBS="$LIBS -lws2_32"
410 CFLAGS="$CFLAGS -mno-cygwin"
413 dnl ****************************
414 dnl *** Look for /dev/random ***
415 dnl ****************************
417 AC_MSG_CHECKING([if usage of random device is requested])
418 AC_ARG_ENABLE(dev-random,
419 [ --disable-dev-random disable the use of the random device],
420 try_dev_random=$enableval, try_dev_random=yes)
421 AC_MSG_RESULT($try_dev_random)
425 NAME_DEV_RANDOM="/dev/srandom"
428 dnl Win32 does not have /dev/random, they have their own method...
430 *-*-mingw*|*-*-cygwin*)
431 ac_cv_have_dev_random = no
434 dnl Everywhere else, it's /dev/random
437 NAME_DEV_RANDOM="/dev/random"
441 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
443 dnl Now check if the device actually exists
445 if test "x$try_dev_random" = "xyes"; then
446 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
447 [if test -r "$NAME_DEV_RANDOM" ; then
448 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
449 if test "x$ac_cv_have_dev_random" = "xyes"; then
450 AC_DEFINE(HAVE_CRYPT_RNG)
453 AC_MSG_CHECKING(for random device)
454 ac_cv_have_dev_random=no
455 AC_MSG_RESULT(has been disabled)
458 if test "x$platform_win32" = "xyes"; then
459 AC_DEFINE(HAVE_CRYPT_RNG)
462 if test "x$ac_cv_have_dev_random" = "xno" \
463 && test "x$platform_win32" = "xno"; then
466 *** A system-provided entropy source was not found on this system.
467 *** Because of this, the System.Security.Cryptography random number generator
468 *** will throw a NotImplemented exception.
470 *** If you are seeing this message, and you know your system DOES have an
471 *** entropy collection in place, please contact <crichton@gimp.org> and
472 *** provide information about the system and how to access the random device.
474 *** For those systems who lack a random device, EGD support is forthcoming.
478 if test "x$cross_compiling" = "xno"; then
479 # check for new iconv version
480 AC_MSG_CHECKING(for new iconv)
481 AC_CACHE_VAL(new_iconv,[
482 AC_TRY_RUN([#include <stdio.h>
487 exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
490 new_iconv=yes,new_iconv=)])
491 if test -n "$new_iconv"; then
493 AC_DEFINE(HAVE_NEW_ICONV)
499 AC_MSG_CHECKING([if inter-process shared handles are requested])
500 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
501 AC_MSG_RESULT($try_shared_handles)
502 if test "x$try_shared_handles" != "xyes"; then
503 AC_DEFINE(DISABLE_SHARED_HANDLES)
504 AC_SUBST(DISABLE_SHARED_HANDLES)
508 ACCESS_UNALIGNED="yes"
511 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
512 i*86-*-*) TARGET=X86; arch_target=x86;;
513 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
514 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
515 #m68k-*-linux*) TARGET=M68K;;
516 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
517 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
520 if test ${TARGET} = unknown; then
521 CPPFLAGS="$CPPFLAGS -DNO_PORT"
522 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
525 if test ${ACCESS_UNALIGNED} = no; then
526 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
529 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
530 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
531 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
532 AM_CONDITIONAL(X86, test x$TARGET = xX86)
533 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
534 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
535 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
536 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
538 AC_SUBST(arch_target)
547 mono/metadata/Makefile
552 mono/os/win32/Makefile
553 mono/os/unix/Makefile
554 mono/arch/x86/Makefile
555 mono/arch/ppc/Makefile
556 mono/arch/sparc/Makefile
557 mono/arch/arm/Makefile
558 mono/interpreter/Makefile
560 mono/benchmark/Makefile
561 mono/monoburg/Makefile
562 mono/monograph/Makefile
564 mono/io-layer/Makefile
565 mono/handles/Makefile