3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.17)
7 # Thread configuration inspired by sleepycat's db
8 AC_MSG_CHECKING([host platform characteristics])
10 *-*-mingw*|*-*-cygwin*)
12 AC_DEFINE(PLATFORM_WIN32)
15 CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS"
20 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
21 LDFLAGS="$LDFLAGS -pthread"
22 AC_DEFINE(NEED_LINK_UNLINK)
23 AC_DEFINE(PTHREAD_POINTER_ID)
28 AC_DEFINE(MONO_USE_EXC_TABLES)
29 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -fexceptions"
34 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
35 AC_DEFINE(NEED_LINK_UNLINK)
38 AC_MSG_WARN([*** Please add $host to configure.in checks!])
44 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
46 AC_CHECK_TOOL(CC, gcc, gcc)
51 AC_CHECK_PROG(BISON, bison,yes,no)
52 if test "x$BISON" = "xno";
54 AC_MSG_ERROR([You need to install bison])
57 dnl may require a specific autoconf version
58 dnl AC_PROG_CC_FOR_BUILD
59 dnl CC_FOR_BUILD not automatically detected
62 if test "x$cross_compiling" = "xyes"; then
66 AC_SUBST(CC_FOR_BUILD)
68 AC_SUBST(BUILD_EXEEXT)
75 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h)
77 # for mono/metadata/debug-symfile.c
78 AC_CHECK_HEADERS(elf.h)
81 AC_CHECK_HEADERS(wchar.h)
83 # not 64 bit clean in cross-compile
84 AC_CHECK_SIZEOF(void *, 4)
86 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
88 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
89 if test "x$PKG_CONFIG" = "xno"; then
90 AC_MSG_ERROR([You need to install pkg-config])
93 dnl for use on the build system
94 dnl pkg-config is stupid
95 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
96 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
97 AC_SUBST(BUILD_GLIB_CFLAGS)
98 AC_SUBST(BUILD_GLIB_LIBS)
101 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
102 if test x$with_crosspkgdir = "x"; then
103 if test -s $PKG_CONFIG_PATH; then
104 PKG_PATH=$PKG_CONFIG_PATH
107 PKG_PATH=$with_crosspkgdir
108 PKG_CONFIG_PATH=$PKG_PATH
109 export PKG_CONFIG_PATH
113 ## Versions of dependencies
114 GLIB_REQUIRED_VERSION=1.3.11
116 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
118 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
119 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
120 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
121 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
123 AC_SUBST(GLIB_CFLAGS)
125 AC_SUBST(GMODULE_CFLAGS)
126 AC_SUBST(GMODULE_LIBS)
129 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
130 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
132 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
136 if test "x$found_boehm" != "xyes"; then
137 AC_MSG_ERROR("GC requested but libgc not found!")
139 if test "x$gc_headers" != "xyes"; then
140 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
143 AC_DEFINE(HAVE_BOEHM_GC)
144 AC_SUBST(HAVE_BOEHM_GC)
145 LIBS="$LIBS -lgc $libdl"
148 AC_MSG_WARN("Compiling mono without GC.")
151 # If libgc was found, use it. Otherwise just warn.
152 if test "x$found_boehm" != "xyes"; then
153 AC_MSG_WARN("Compiling mono without GC.")
155 if test "x$gc_headers" != "xyes"; then
156 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
158 AC_DEFINE(HAVE_BOEHM_GC)
159 AC_SUBST(HAVE_BOEHM_GC)
160 LIBS="$LIBS -lgc $libdl"
166 if test x$platform_win32 = xno; then
167 dnl ******************************************************************
168 dnl *** Check for large file support ***
169 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
170 dnl ******************************************************************
172 # Check that off_t can represent 2**63 - 1 correctly, working around
173 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
174 # CPPFLAGS and sets $large_offt to yes if the test succeeds
176 AC_DEFUN(LARGE_FILES, [
177 large_CPPFLAGS=$CPPFLAGS
178 CPPFLAGS="$CPPFLAGS $1"
180 #include <sys/types.h>
182 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
185 int big_off_t=((BIG_OFF_T%2147483629==721) &&
186 (BIG_OFF_T%2147483647==1));
195 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
196 large_CPPFLAGS="$large_CPPFLAGS $1"
201 CPPFLAGS=$large_CPPFLAGS
204 AC_MSG_CHECKING(if off_t is 64 bits wide)
206 if test $large_offt = no; then
207 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
208 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
210 if test $large_offt = no; then
211 AC_MSG_WARN([No 64 bit file size support available])
214 dnl *****************************
215 dnl *** Checks for libsocket ***
216 dnl *****************************
217 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
219 dnl *******************************
220 dnl *** Checks for MSG_NOSIGNAL ***
221 dnl *******************************
222 AC_MSG_CHECKING(for MSG_NOSIGNAL)
223 AC_TRY_COMPILE([#include <sys/socket.h>], [
224 int f = MSG_NOSIGNAL;
228 AC_DEFINE(HAVE_MSG_NOSIGNAL)
230 # We'll have to use signals
234 dnl *****************************
235 dnl *** Checks for SOL_IP ***
236 dnl *****************************
237 AC_MSG_CHECKING(for SOL_IP)
238 AC_TRY_COMPILE([#include <netdb.h>], [
243 AC_DEFINE(HAVE_SOL_IP)
245 # We'll have to use getprotobyname
249 dnl *****************************
250 dnl *** Checks for SOL_TCP ***
251 dnl *****************************
252 AC_MSG_CHECKING(for SOL_TCP)
253 AC_TRY_COMPILE([#include <netdb.h>], [
258 AC_DEFINE(HAVE_SOL_TCP)
260 # We'll have to use getprotobyname
264 dnl *****************************
265 dnl *** Checks for IP_PKTINFO ***
266 dnl *****************************
267 AC_MSG_CHECKING(for IP_PKTINFO)
268 AC_TRY_COMPILE([#include <netdb.h>], [
269 int level = IP_PKTINFO;
273 AC_DEFINE(HAVE_IP_PKTINFO)
278 dnl *********************************
279 dnl *** Check for struct ip_mreqn ***
280 dnl *********************************
281 AC_MSG_CHECKING(for struct ip_mreqn)
282 AC_TRY_COMPILE([#include <netinet/in.h>], [
283 struct ip_mreqn mreq;
284 mreq.imr_address.s_addr = 0;
288 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
290 # We'll just have to use struct ip_mreq
294 dnl *****************************
295 dnl *** Checks for libnsl ***
296 dnl *****************************
297 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
299 AC_CHECK_FUNCS(inet_pton inet_aton)
301 dnl ***********************************************
302 dnl *** Checks for size of sockaddr_un.sun_path ***
303 dnl ***********************************************
304 # AC_CHECK_SIZEOF can't cope with struct members :-(
305 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
306 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
308 #include <sys/types.h>
313 struct sockaddr_un sock_un;
314 FILE *f=fopen("conftestval", "w");
316 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
319 ], cv_mono_sizeof_sunpath=`cat conftestval`,
320 cv_mono_sizeof_sunpath=0,
321 cv_mono_sizeof_sunpath=0)])dnl
322 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
323 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
325 dnl *****************************
326 dnl *** Checks for libxnet ***
327 dnl *****************************
330 AC_MSG_CHECKING(for Solaris XPG4 support)
331 if test -f /usr/lib/libxnet.so; then
332 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
333 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
334 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
341 if test "$GCC" = "yes"; then
342 CFLAGS="$CFLAGS -Wno-char-subscripts"
347 dnl *****************************
348 dnl *** Checks for libpthread ***
349 dnl *****************************
350 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
351 AC_CHECK_FUNCS(pthread_mutex_timedlock)
352 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
353 AC_TRY_COMPILE([ #include <pthread.h>], [
354 pthread_mutexattr_t attr;
355 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
360 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
361 AC_DEFINE(USE_MONO_MUTEX)
364 dnl ********************************
365 dnl *** Checks for semaphore lib ***
366 dnl ********************************
367 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
369 dnl ********************************
370 dnl *** Checks for timezone stuff **
371 dnl ********************************
372 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
377 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
378 if test $ac_cv_var_timezone = yes; then
379 AC_DEFINE(HAVE_TIMEZONE)
381 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
387 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
388 if test $ac_cv_struct_tm_gmtoff = yes; then
389 AC_DEFINE(HAVE_TM_GMTOFF)
391 AC_ERROR(unable to find a way to determine timezone)
395 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
396 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
399 dnl ****************************
400 dnl *** Look for /dev/random ***
401 dnl ****************************
403 AC_MSG_CHECKING([if usage of random device is requested])
404 AC_ARG_ENABLE(dev-random,
405 [ --disable-dev-random disable the use of the random device],
406 try_dev_random=$enableval, try_dev_random=yes)
407 AC_MSG_RESULT($try_dev_random)
411 NAME_DEV_RANDOM="/dev/srandom"
414 dnl Win32 does not have /dev/random, they have their own method...
416 *-*-mingw*|*-*-cygwin*)
417 ac_cv_have_dev_random = no
420 dnl Everywhere else, it's /dev/random
423 NAME_DEV_RANDOM="/dev/random"
427 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
429 dnl Now check if the device actually exists
431 if test "x$try_dev_random" = "xyes"; then
432 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
433 [if test -r "$NAME_DEV_RANDOM" ; then
434 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
435 if test "x$ac_cv_have_dev_random" = "xyes"; then
436 AC_DEFINE(HAVE_CRYPT_RNG)
439 AC_MSG_CHECKING(for random device)
440 ac_cv_have_dev_random=no
441 AC_MSG_RESULT(has been disabled)
444 if test "x$platform_win32" = "xyes"; then
445 AC_DEFINE(HAVE_CRYPT_RNG)
448 if test "x$ac_cv_have_dev_random" = "xno" \
449 && test "x$platform_win32" = "xno"; then
452 *** A system-provided entropy source was not found on this system.
453 *** Because of this, the System.Security.Cryptography random number generator
454 *** will throw a NotImplemented exception.
456 *** If you are seeing this message, and you know your system DOES have an
457 *** entropy collection in place, please contact <crichton@gimp.org> and
458 *** provide information about the system and how to access the random device.
460 *** For those systems who lack a random device, EGD support is forthcoming.
464 AC_MSG_CHECKING([if inter-process shared handles are requested])
465 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
466 AC_MSG_RESULT($try_shared_handles)
467 if test "x$try_shared_handles" != "xyes"; then
468 AC_DEFINE(DISABLE_SHARED_HANDLES)
469 AC_SUBST(DISABLE_SHARED_HANDLES)
473 ACCESS_UNALIGNED="yes"
476 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
477 i*86-*-*) TARGET=X86; arch_target=x86;;
478 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
479 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
480 #m68k-*-linux*) TARGET=M68K;;
481 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
482 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
483 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
486 if test ${TARGET} = unknown; then
487 CPPFLAGS="$CPPFLAGS -DNO_PORT"
488 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
491 if test ${ACCESS_UNALIGNED} = no; then
492 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
495 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
496 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
497 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
498 AM_CONDITIONAL(X86, test x$TARGET = xX86)
499 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
500 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
501 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
502 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
503 AM_CONDITIONAL(S390, test x$TARGET = xS390)
508 AC_SUBST(arch_target)
517 mono/metadata/Makefile
522 mono/os/win32/Makefile
523 mono/os/unix/Makefile
524 mono/arch/x86/Makefile
525 mono/arch/ppc/Makefile
526 mono/arch/sparc/Makefile
527 mono/arch/s390/Makefile
528 mono/arch/arm/Makefile
529 mono/interpreter/Makefile
531 mono/benchmark/Makefile
532 mono/monoburg/Makefile
533 mono/monograph/Makefile
535 mono/io-layer/Makefile
536 mono/handles/Makefile