3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.18)
8 # These are the flags that need to be stored in the mono.pc file for
9 # compiling code that will embed Mono
12 AC_SUBST(libmono_cflags)
14 # Thread configuration inspired by sleepycat's db
15 AC_MSG_CHECKING([host platform characteristics])
17 *-*-mingw*|*-*-cygwin*)
19 AC_DEFINE(PLATFORM_WIN32)
22 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS"
27 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
28 libmono_cflags="-D_THREAD_SAFE"
29 LDFLAGS="$LDFLAGS -pthread"
30 AC_DEFINE(NEED_LINK_UNLINK)
31 AC_DEFINE(PTHREAD_POINTER_ID)
36 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
37 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
42 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
43 AC_DEFINE(NEED_LINK_UNLINK)
44 libmono_cflags="-D_REENTRANT"
48 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
49 libmono_cflags="-D_THREAD_SAFE"
50 LDFLAGS="$LDFLAGS -pthread"
51 AC_DEFINE(NEED_LINK_UNLINK)
52 AC_DEFINE(PTHREAD_POINTER_ID)
56 AC_MSG_WARN([*** Please add $host to configure.in checks!])
62 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
64 AC_CHECK_TOOL(CC, gcc, gcc)
69 AC_CHECK_PROG(BISON, bison,yes,no)
70 if test "x$BISON" = "xno";
72 AC_MSG_ERROR([You need to install bison])
75 dnl may require a specific autoconf version
76 dnl AC_PROG_CC_FOR_BUILD
77 dnl CC_FOR_BUILD not automatically detected
80 if test "x$cross_compiling" = "xyes"; then
84 AC_SUBST(CC_FOR_BUILD)
86 AC_SUBST(BUILD_EXEEXT)
93 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h)
95 # for mono/metadata/debug-symfile.c
96 AC_CHECK_HEADERS(elf.h)
99 AC_CHECK_HEADERS(wchar.h)
101 # not 64 bit clean in cross-compile
102 AC_CHECK_SIZEOF(void *, 4)
104 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
106 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
107 if test "x$PKG_CONFIG" = "xno"; then
108 AC_MSG_ERROR([You need to install pkg-config])
111 dnl for use on the build system
112 dnl pkg-config is stupid
113 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
114 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
115 AC_SUBST(BUILD_GLIB_CFLAGS)
116 AC_SUBST(BUILD_GLIB_LIBS)
119 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
120 if test x$with_crosspkgdir = "x"; then
121 if test -s $PKG_CONFIG_PATH; then
122 PKG_PATH=$PKG_CONFIG_PATH
125 PKG_PATH=$with_crosspkgdir
126 PKG_CONFIG_PATH=$PKG_PATH
127 export PKG_CONFIG_PATH
131 ## Versions of dependencies
132 GLIB_REQUIRED_VERSION=1.3.11
134 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
136 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
137 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
138 GTHREAD_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
139 GTHREAD_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
140 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
141 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
143 AC_SUBST(GLIB_CFLAGS)
145 AC_SUBST(GTHREAD_CFLAGS)
146 AC_SUBST(GTHREAD_LIBS)
147 AC_SUBST(GMODULE_CFLAGS)
148 AC_SUBST(GMODULE_LIBS)
151 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
152 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
154 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
158 if test "x$found_boehm" != "xyes"; then
159 AC_MSG_ERROR("GC requested but libgc not found!")
161 if test "x$gc_headers" != "xyes"; then
162 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
165 AC_DEFINE(HAVE_BOEHM_GC)
166 AC_SUBST(HAVE_BOEHM_GC)
167 LIBS="$LIBS -lgc $libdl"
170 AC_MSG_WARN("Compiling mono without GC.")
173 # If libgc was found, use it. Otherwise just warn.
174 if test "x$found_boehm" != "xyes"; then
175 AC_MSG_WARN("Compiling mono without GC.")
177 if test "x$gc_headers" != "xyes"; then
178 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
180 AC_DEFINE(HAVE_BOEHM_GC)
181 AC_SUBST(HAVE_BOEHM_GC)
182 LIBS="$LIBS -lgc $libdl"
188 if test x$platform_win32 = xno; then
189 dnl ******************************************************************
190 dnl *** Check for large file support ***
191 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
192 dnl ******************************************************************
194 # Check that off_t can represent 2**63 - 1 correctly, working around
195 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
196 # CPPFLAGS and sets $large_offt to yes if the test succeeds
198 AC_DEFUN(LARGE_FILES, [
199 large_CPPFLAGS=$CPPFLAGS
200 CPPFLAGS="$CPPFLAGS $1"
202 #include <sys/types.h>
204 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
207 int big_off_t=((BIG_OFF_T%2147483629==721) &&
208 (BIG_OFF_T%2147483647==1));
217 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
218 large_CPPFLAGS="$large_CPPFLAGS $1"
223 CPPFLAGS=$large_CPPFLAGS
226 AC_MSG_CHECKING(if off_t is 64 bits wide)
228 if test $large_offt = no; then
229 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
230 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
232 if test $large_offt = no; then
233 AC_MSG_WARN([No 64 bit file size support available])
236 dnl *****************************
237 dnl *** Checks for libsocket ***
238 dnl *****************************
239 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
241 dnl *******************************
242 dnl *** Checks for MSG_NOSIGNAL ***
243 dnl *******************************
244 AC_MSG_CHECKING(for MSG_NOSIGNAL)
245 AC_TRY_COMPILE([#include <sys/socket.h>], [
246 int f = MSG_NOSIGNAL;
250 AC_DEFINE(HAVE_MSG_NOSIGNAL)
252 # We'll have to use signals
256 dnl *****************************
257 dnl *** Checks for SOL_IP ***
258 dnl *****************************
259 AC_MSG_CHECKING(for SOL_IP)
260 AC_TRY_COMPILE([#include <netdb.h>], [
265 AC_DEFINE(HAVE_SOL_IP)
267 # We'll have to use getprotobyname
271 dnl *****************************
272 dnl *** Checks for SOL_TCP ***
273 dnl *****************************
274 AC_MSG_CHECKING(for SOL_TCP)
275 AC_TRY_COMPILE([#include <netdb.h>], [
280 AC_DEFINE(HAVE_SOL_TCP)
282 # We'll have to use getprotobyname
286 dnl *****************************
287 dnl *** Checks for IP_PKTINFO ***
288 dnl *****************************
289 AC_MSG_CHECKING(for IP_PKTINFO)
290 AC_TRY_COMPILE([#include <netdb.h>], [
291 int level = IP_PKTINFO;
295 AC_DEFINE(HAVE_IP_PKTINFO)
300 dnl *********************************
301 dnl *** Check for struct ip_mreqn ***
302 dnl *********************************
303 AC_MSG_CHECKING(for struct ip_mreqn)
304 AC_TRY_COMPILE([#include <netinet/in.h>], [
305 struct ip_mreqn mreq;
306 mreq.imr_address.s_addr = 0;
310 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
312 # We'll just have to use struct ip_mreq
316 dnl *****************************
317 dnl *** Checks for libnsl ***
318 dnl *****************************
319 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
321 AC_CHECK_FUNCS(inet_pton inet_aton)
323 dnl ***********************************************
324 dnl *** Checks for size of sockaddr_un.sun_path ***
325 dnl ***********************************************
326 # AC_CHECK_SIZEOF can't cope with struct members :-(
327 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
328 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
330 #include <sys/types.h>
335 struct sockaddr_un sock_un;
336 FILE *f=fopen("conftestval", "w");
338 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
341 ], cv_mono_sizeof_sunpath=`cat conftestval`,
342 cv_mono_sizeof_sunpath=0,
343 cv_mono_sizeof_sunpath=0)])dnl
344 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
345 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
347 dnl *****************************
348 dnl *** Checks for libxnet ***
349 dnl *****************************
352 AC_MSG_CHECKING(for Solaris XPG4 support)
353 if test -f /usr/lib/libxnet.so; then
354 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
355 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
356 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
363 if test "$GCC" = "yes"; then
364 CFLAGS="$CFLAGS -Wno-char-subscripts"
369 dnl *****************************
370 dnl *** Checks for libpthread ***
371 dnl *****************************
372 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
373 AC_CHECK_FUNCS(pthread_mutex_timedlock)
374 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
375 AC_TRY_COMPILE([ #include <pthread.h>], [
376 pthread_mutexattr_t attr;
377 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
382 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
383 AC_DEFINE(USE_MONO_MUTEX)
386 dnl ********************************
387 dnl *** Checks for semaphore lib ***
388 dnl ********************************
389 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
391 dnl ********************************
392 dnl *** Checks for timezone stuff **
393 dnl ********************************
394 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
400 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
401 if test $ac_cv_struct_tm_gmtoff = yes; then
402 AC_DEFINE(HAVE_TM_GMTOFF)
404 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
409 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
410 if test $ac_cv_var_timezone = yes; then
411 AC_DEFINE(HAVE_TIMEZONE)
413 AC_ERROR(unable to find a way to determine timezone)
417 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
418 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
421 dnl ****************************
422 dnl *** Look for /dev/random ***
423 dnl ****************************
425 AC_MSG_CHECKING([if usage of random device is requested])
426 AC_ARG_ENABLE(dev-random,
427 [ --disable-dev-random disable the use of the random device],
428 try_dev_random=$enableval, try_dev_random=yes)
429 AC_MSG_RESULT($try_dev_random)
433 NAME_DEV_RANDOM="/dev/srandom"
436 dnl Win32 does not have /dev/random, they have their own method...
438 *-*-mingw*|*-*-cygwin*)
439 ac_cv_have_dev_random = no
442 dnl Everywhere else, it's /dev/random
445 NAME_DEV_RANDOM="/dev/random"
449 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
451 dnl Now check if the device actually exists
453 if test "x$try_dev_random" = "xyes"; then
454 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
455 [if test -r "$NAME_DEV_RANDOM" ; then
456 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
457 if test "x$ac_cv_have_dev_random" = "xyes"; then
458 AC_DEFINE(HAVE_CRYPT_RNG)
461 AC_MSG_CHECKING(for random device)
462 ac_cv_have_dev_random=no
463 AC_MSG_RESULT(has been disabled)
466 if test "x$platform_win32" = "xyes"; then
467 AC_DEFINE(HAVE_CRYPT_RNG)
470 if test "x$ac_cv_have_dev_random" = "xno" \
471 && test "x$platform_win32" = "xno"; then
474 *** A system-provided entropy source was not found on this system.
475 *** Because of this, the System.Security.Cryptography random number generator
476 *** will throw a NotImplemented exception.
478 *** If you are seeing this message, and you know your system DOES have an
479 *** entropy collection in place, please contact <crichton@gimp.org> and
480 *** provide information about the system and how to access the random device.
482 *** For those systems who lack a random device, EGD support is forthcoming.
486 AC_MSG_CHECKING([if inter-process shared handles are requested])
487 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
488 AC_MSG_RESULT($try_shared_handles)
489 if test "x$try_shared_handles" != "xyes"; then
490 AC_DEFINE(DISABLE_SHARED_HANDLES)
491 AC_SUBST(DISABLE_SHARED_HANDLES)
495 ACCESS_UNALIGNED="yes"
498 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
499 i*86-*-*) TARGET=X86; arch_target=x86;;
500 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
501 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
502 #m68k-*-linux*) TARGET=M68K;;
503 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc;;
504 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
505 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
508 if test ${TARGET} = unknown; then
509 CPPFLAGS="$CPPFLAGS -DNO_PORT"
510 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
513 if test ${ACCESS_UNALIGNED} = no; then
514 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
517 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
518 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
519 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
520 AM_CONDITIONAL(X86, test x$TARGET = xX86)
521 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
522 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
523 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
524 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
525 AM_CONDITIONAL(S390, test x$TARGET = xS390)
530 AC_SUBST(arch_target)
539 mono/metadata/Makefile
544 mono/os/win32/Makefile
545 mono/os/unix/Makefile
546 mono/arch/x86/Makefile
547 mono/arch/ppc/Makefile
548 mono/arch/sparc/Makefile
549 mono/arch/s390/Makefile
550 mono/arch/arm/Makefile
551 mono/interpreter/Makefile
553 mono/benchmark/Makefile
554 mono/monoburg/Makefile
555 mono/monograph/Makefile
557 mono/io-layer/Makefile
558 mono/handles/Makefile