3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.23)
8 # These are the flags that need to be stored in the mono.pc file for
9 # compiling code that will embed Mono
13 AC_SUBST(libmono_cflags)
14 AC_SUBST(libmono_ldflags)
16 # Thread configuration inspired by sleepycat's db
17 AC_MSG_CHECKING([host platform characteristics])
19 *-*-mingw*|*-*-cygwin*)
21 AC_DEFINE(PLATFORM_WIN32)
24 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
29 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
30 libmono_cflags="-D_THREAD_SAFE"
31 LDFLAGS="$LDFLAGS -pthread"
32 libmono_ldflags="-pthread"
33 AC_DEFINE(NEED_LINK_UNLINK)
34 AC_DEFINE(PTHREAD_POINTER_ID)
39 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
40 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
41 libmono_ldflags="-lpthread"
46 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
47 AC_DEFINE(NEED_LINK_UNLINK)
48 libmono_cflags="-D_REENTRANT"
52 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
53 libmono_cflags="-D_THREAD_SAFE"
54 LDFLAGS="$LDFLAGS -pthread"
55 libmono_ldflags="-pthread"
56 AC_DEFINE(NEED_LINK_UNLINK)
57 AC_DEFINE(PTHREAD_POINTER_ID)
61 AC_MSG_WARN([*** Please add $host to configure.in checks!])
67 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
69 AC_CHECK_TOOL(CC, gcc, gcc)
74 AC_CHECK_PROG(BISON, bison,yes,no)
75 if test "x$BISON" = "xno";
77 AC_MSG_ERROR([You need to install bison])
80 dnl may require a specific autoconf version
81 dnl AC_PROG_CC_FOR_BUILD
82 dnl CC_FOR_BUILD not automatically detected
85 if test "x$cross_compiling" = "xyes"; then
89 AC_SUBST(CC_FOR_BUILD)
91 AC_SUBST(BUILD_EXEEXT)
98 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
100 # for mono/metadata/debug-symfile.c
101 AC_CHECK_HEADERS(elf.h)
104 AC_CHECK_HEADERS(wchar.h)
106 # not 64 bit clean in cross-compile
107 AC_CHECK_SIZEOF(void *, 4)
109 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
111 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
112 if test "x$PKG_CONFIG" = "xno"; then
113 AC_MSG_ERROR([You need to install pkg-config])
116 dnl for use on the build system
117 dnl pkg-config is stupid
118 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
119 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
120 AC_SUBST(BUILD_GLIB_CFLAGS)
121 AC_SUBST(BUILD_GLIB_LIBS)
124 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
125 if test x$with_crosspkgdir = "x"; then
126 if test -s $PKG_CONFIG_PATH; then
127 PKG_PATH=$PKG_CONFIG_PATH
130 PKG_PATH=$with_crosspkgdir
131 PKG_CONFIG_PATH=$PKG_PATH
132 export PKG_CONFIG_PATH
136 ## Versions of dependencies
137 GLIB_REQUIRED_VERSION=1.3.11
139 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
141 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
142 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
143 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
144 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
145 MINI_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0 gthread-2.0`
146 MINI_LIBS=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0 gthread-2.0`
148 AC_SUBST(GLIB_CFLAGS)
150 AC_SUBST(GMODULE_CFLAGS)
151 AC_SUBST(GMODULE_LIBS)
152 AC_SUBST(MINI_CFLAGS)
156 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
157 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
159 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
163 if test "x$found_boehm" != "xyes"; then
164 AC_MSG_ERROR("GC requested but libgc not found!")
166 if test "x$gc_headers" != "xyes"; then
167 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
170 AC_DEFINE(HAVE_BOEHM_GC)
171 AC_SUBST(HAVE_BOEHM_GC)
172 LIBS="$LIBS -lgc $libdl"
175 AC_MSG_WARN("Compiling mono without GC.")
178 # If libgc was found, use it. Otherwise just warn.
179 if test "x$found_boehm" != "xyes"; then
180 AC_MSG_WARN("Compiling mono without GC.")
182 if test "x$gc_headers" != "xyes"; then
183 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
185 AC_DEFINE(HAVE_BOEHM_GC)
186 AC_SUBST(HAVE_BOEHM_GC)
187 LIBS="$LIBS -lgc $libdl"
193 if test "x$gc" = xboehm; then
194 AC_CHECK_FUNCS(GC_gcj_malloc)
197 if test x$platform_win32 = xno; then
198 dnl ******************************************************************
199 dnl *** Check for large file support ***
200 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
201 dnl ******************************************************************
203 # Check that off_t can represent 2**63 - 1 correctly, working around
204 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
205 # CPPFLAGS and sets $large_offt to yes if the test succeeds
207 AC_DEFUN(LARGE_FILES, [
208 large_CPPFLAGS=$CPPFLAGS
209 CPPFLAGS="$CPPFLAGS $1"
211 #include <sys/types.h>
213 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
216 int big_off_t=((BIG_OFF_T%2147483629==721) &&
217 (BIG_OFF_T%2147483647==1));
226 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
227 large_CPPFLAGS="$large_CPPFLAGS $1"
232 CPPFLAGS=$large_CPPFLAGS
235 AC_MSG_CHECKING(if off_t is 64 bits wide)
237 if test $large_offt = no; then
238 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
239 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
241 if test $large_offt = no; then
242 AC_MSG_WARN([No 64 bit file size support available])
245 dnl *****************************
246 dnl *** Checks for libsocket ***
247 dnl *****************************
248 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
250 dnl *******************************
251 dnl *** Checks for MSG_NOSIGNAL ***
252 dnl *******************************
253 AC_MSG_CHECKING(for MSG_NOSIGNAL)
254 AC_TRY_COMPILE([#include <sys/socket.h>], [
255 int f = MSG_NOSIGNAL;
259 AC_DEFINE(HAVE_MSG_NOSIGNAL)
261 # We'll have to use signals
265 dnl *****************************
266 dnl *** Checks for SOL_IP ***
267 dnl *****************************
268 AC_MSG_CHECKING(for SOL_IP)
269 AC_TRY_COMPILE([#include <netdb.h>], [
274 AC_DEFINE(HAVE_SOL_IP)
276 # We'll have to use getprotobyname
280 dnl *****************************
281 dnl *** Checks for SOL_TCP ***
282 dnl *****************************
283 AC_MSG_CHECKING(for SOL_TCP)
284 AC_TRY_COMPILE([#include <netdb.h>], [
289 AC_DEFINE(HAVE_SOL_TCP)
291 # We'll have to use getprotobyname
295 dnl *****************************
296 dnl *** Checks for IP_PKTINFO ***
297 dnl *****************************
298 AC_MSG_CHECKING(for IP_PKTINFO)
299 AC_TRY_COMPILE([#include <netdb.h>], [
300 int level = IP_PKTINFO;
304 AC_DEFINE(HAVE_IP_PKTINFO)
309 dnl *********************************
310 dnl *** Check for struct ip_mreqn ***
311 dnl *********************************
312 AC_MSG_CHECKING(for struct ip_mreqn)
313 AC_TRY_COMPILE([#include <netinet/in.h>], [
314 struct ip_mreqn mreq;
315 mreq.imr_address.s_addr = 0;
319 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
321 # We'll just have to use struct ip_mreq
325 dnl *****************************
326 dnl *** Checks for libnsl ***
327 dnl *****************************
328 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
330 AC_CHECK_FUNCS(inet_pton inet_aton)
332 dnl ***********************************************
333 dnl *** Checks for size of sockaddr_un.sun_path ***
334 dnl ***********************************************
335 # AC_CHECK_SIZEOF can't cope with struct members :-(
336 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
337 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
339 #include <sys/types.h>
344 struct sockaddr_un sock_un;
345 FILE *f=fopen("conftestval", "w");
347 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
350 ], cv_mono_sizeof_sunpath=`cat conftestval`,
351 cv_mono_sizeof_sunpath=0,
352 cv_mono_sizeof_sunpath=0)])dnl
353 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
354 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
356 dnl *****************************
357 dnl *** Checks for libxnet ***
358 dnl *****************************
361 AC_MSG_CHECKING(for Solaris XPG4 support)
362 if test -f /usr/lib/libxnet.so; then
363 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
364 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
365 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
372 if test "$GCC" = "yes"; then
373 CFLAGS="$CFLAGS -Wno-char-subscripts"
378 dnl *****************************
379 dnl *** Checks for libpthread ***
380 dnl *****************************
381 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
382 AC_CHECK_FUNCS(pthread_mutex_timedlock)
383 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
384 AC_TRY_COMPILE([ #include <pthread.h>], [
385 pthread_mutexattr_t attr;
386 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
391 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
392 AC_DEFINE(USE_MONO_MUTEX)
395 dnl ********************************
396 dnl *** Checks for semaphore lib ***
397 dnl ********************************
398 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
400 dnl ********************************
401 dnl *** Checks for timezone stuff **
402 dnl ********************************
403 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
409 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
410 if test $ac_cv_struct_tm_gmtoff = yes; then
411 AC_DEFINE(HAVE_TM_GMTOFF)
413 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
418 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
419 if test $ac_cv_var_timezone = yes; then
420 AC_DEFINE(HAVE_TIMEZONE)
422 AC_ERROR(unable to find a way to determine timezone)
426 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
427 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
430 dnl ****************************
431 dnl *** Look for /dev/random ***
432 dnl ****************************
434 AC_MSG_CHECKING([if usage of random device is requested])
435 AC_ARG_ENABLE(dev-random,
436 [ --disable-dev-random disable the use of the random device],
437 try_dev_random=$enableval, try_dev_random=yes)
438 AC_MSG_RESULT($try_dev_random)
442 NAME_DEV_RANDOM="/dev/srandom"
445 dnl Win32 does not have /dev/random, they have their own method...
447 *-*-mingw*|*-*-cygwin*)
448 ac_cv_have_dev_random = no
451 dnl Everywhere else, it's /dev/random
454 NAME_DEV_RANDOM="/dev/random"
458 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
460 dnl Now check if the device actually exists
462 if test "x$try_dev_random" = "xyes"; then
463 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
464 [if test -r "$NAME_DEV_RANDOM" ; then
465 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
466 if test "x$ac_cv_have_dev_random" = "xyes"; then
467 AC_DEFINE(HAVE_CRYPT_RNG)
470 AC_MSG_CHECKING(for random device)
471 ac_cv_have_dev_random=no
472 AC_MSG_RESULT(has been disabled)
475 if test "x$platform_win32" = "xyes"; then
476 AC_DEFINE(HAVE_CRYPT_RNG)
479 if test "x$ac_cv_have_dev_random" = "xno" \
480 && test "x$platform_win32" = "xno"; then
483 *** A system-provided entropy source was not found on this system.
484 *** Because of this, the System.Security.Cryptography random number generator
485 *** will throw a NotImplemented exception.
487 *** If you are seeing this message, and you know your system DOES have an
488 *** entropy collection in place, please contact <crichton@gimp.org> and
489 *** provide information about the system and how to access the random device.
491 *** For those systems who lack a random device, EGD support is forthcoming.
495 AC_MSG_CHECKING([if inter-process shared handles are requested])
496 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
497 AC_MSG_RESULT($try_shared_handles)
498 if test "x$try_shared_handles" != "xyes"; then
499 AC_DEFINE(DISABLE_SHARED_HANDLES)
500 AC_SUBST(DISABLE_SHARED_HANDLES)
504 ACCESS_UNALIGNED="yes"
507 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
508 i*86-*-*) TARGET=X86; arch_target=x86;;
509 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
510 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
511 #m68k-*-linux*) TARGET=M68K;;
512 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc;;
513 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
514 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
517 if test ${TARGET} = unknown; then
518 CPPFLAGS="$CPPFLAGS -DNO_PORT"
519 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
522 if test ${ACCESS_UNALIGNED} = no; then
523 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
526 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
527 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
528 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
529 AM_CONDITIONAL(X86, test x$TARGET = xX86)
530 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
531 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
532 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
533 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
534 AM_CONDITIONAL(S390, test x$TARGET = xS390)
539 AC_SUBST(arch_target)
549 mono/metadata/Makefile
554 mono/os/win32/Makefile
555 mono/os/unix/Makefile
556 mono/arch/x86/Makefile
557 mono/arch/ppc/Makefile
558 mono/arch/sparc/Makefile
559 mono/arch/s390/Makefile
560 mono/arch/arm/Makefile
561 mono/arch/alpha/Makefile
562 mono/interpreter/Makefile
564 mono/benchmark/Makefile
565 mono/monoburg/Makefile
566 mono/monograph/Makefile
568 mono/io-layer/Makefile
569 mono/handles/Makefile