3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.19.1)
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 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
139 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
141 AC_SUBST(GLIB_CFLAGS)
143 AC_SUBST(GMODULE_CFLAGS)
144 AC_SUBST(GMODULE_LIBS)
147 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
148 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
150 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
154 if test "x$found_boehm" != "xyes"; then
155 AC_MSG_ERROR("GC requested but libgc not found!")
157 if test "x$gc_headers" != "xyes"; then
158 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
161 AC_DEFINE(HAVE_BOEHM_GC)
162 AC_SUBST(HAVE_BOEHM_GC)
163 LIBS="$LIBS -lgc $libdl"
166 AC_MSG_WARN("Compiling mono without GC.")
169 # If libgc was found, use it. Otherwise just warn.
170 if test "x$found_boehm" != "xyes"; then
171 AC_MSG_WARN("Compiling mono without GC.")
173 if test "x$gc_headers" != "xyes"; then
174 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
176 AC_DEFINE(HAVE_BOEHM_GC)
177 AC_SUBST(HAVE_BOEHM_GC)
178 LIBS="$LIBS -lgc $libdl"
184 if test x$platform_win32 = xno; then
185 dnl ******************************************************************
186 dnl *** Check for large file support ***
187 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
188 dnl ******************************************************************
190 # Check that off_t can represent 2**63 - 1 correctly, working around
191 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
192 # CPPFLAGS and sets $large_offt to yes if the test succeeds
194 AC_DEFUN(LARGE_FILES, [
195 large_CPPFLAGS=$CPPFLAGS
196 CPPFLAGS="$CPPFLAGS $1"
198 #include <sys/types.h>
200 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
203 int big_off_t=((BIG_OFF_T%2147483629==721) &&
204 (BIG_OFF_T%2147483647==1));
213 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
214 large_CPPFLAGS="$large_CPPFLAGS $1"
219 CPPFLAGS=$large_CPPFLAGS
222 AC_MSG_CHECKING(if off_t is 64 bits wide)
224 if test $large_offt = no; then
225 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
226 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
228 if test $large_offt = no; then
229 AC_MSG_WARN([No 64 bit file size support available])
232 dnl *****************************
233 dnl *** Checks for libsocket ***
234 dnl *****************************
235 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
237 dnl *******************************
238 dnl *** Checks for MSG_NOSIGNAL ***
239 dnl *******************************
240 AC_MSG_CHECKING(for MSG_NOSIGNAL)
241 AC_TRY_COMPILE([#include <sys/socket.h>], [
242 int f = MSG_NOSIGNAL;
246 AC_DEFINE(HAVE_MSG_NOSIGNAL)
248 # We'll have to use signals
252 dnl *****************************
253 dnl *** Checks for SOL_IP ***
254 dnl *****************************
255 AC_MSG_CHECKING(for SOL_IP)
256 AC_TRY_COMPILE([#include <netdb.h>], [
261 AC_DEFINE(HAVE_SOL_IP)
263 # We'll have to use getprotobyname
267 dnl *****************************
268 dnl *** Checks for SOL_TCP ***
269 dnl *****************************
270 AC_MSG_CHECKING(for SOL_TCP)
271 AC_TRY_COMPILE([#include <netdb.h>], [
276 AC_DEFINE(HAVE_SOL_TCP)
278 # We'll have to use getprotobyname
282 dnl *****************************
283 dnl *** Checks for IP_PKTINFO ***
284 dnl *****************************
285 AC_MSG_CHECKING(for IP_PKTINFO)
286 AC_TRY_COMPILE([#include <netdb.h>], [
287 int level = IP_PKTINFO;
291 AC_DEFINE(HAVE_IP_PKTINFO)
296 dnl *********************************
297 dnl *** Check for struct ip_mreqn ***
298 dnl *********************************
299 AC_MSG_CHECKING(for struct ip_mreqn)
300 AC_TRY_COMPILE([#include <netinet/in.h>], [
301 struct ip_mreqn mreq;
302 mreq.imr_address.s_addr = 0;
306 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
308 # We'll just have to use struct ip_mreq
312 dnl *****************************
313 dnl *** Checks for libnsl ***
314 dnl *****************************
315 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
317 AC_CHECK_FUNCS(inet_pton inet_aton)
319 dnl ***********************************************
320 dnl *** Checks for size of sockaddr_un.sun_path ***
321 dnl ***********************************************
322 # AC_CHECK_SIZEOF can't cope with struct members :-(
323 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
324 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
326 #include <sys/types.h>
331 struct sockaddr_un sock_un;
332 FILE *f=fopen("conftestval", "w");
334 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
337 ], cv_mono_sizeof_sunpath=`cat conftestval`,
338 cv_mono_sizeof_sunpath=0,
339 cv_mono_sizeof_sunpath=0)])dnl
340 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
341 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
343 dnl *****************************
344 dnl *** Checks for libxnet ***
345 dnl *****************************
348 AC_MSG_CHECKING(for Solaris XPG4 support)
349 if test -f /usr/lib/libxnet.so; then
350 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
351 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
352 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
359 if test "$GCC" = "yes"; then
360 CFLAGS="$CFLAGS -Wno-char-subscripts"
365 dnl *****************************
366 dnl *** Checks for libpthread ***
367 dnl *****************************
368 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
369 AC_CHECK_FUNCS(pthread_mutex_timedlock)
370 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
371 AC_TRY_COMPILE([ #include <pthread.h>], [
372 pthread_mutexattr_t attr;
373 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
378 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
379 AC_DEFINE(USE_MONO_MUTEX)
382 dnl ********************************
383 dnl *** Checks for semaphore lib ***
384 dnl ********************************
385 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
387 dnl ********************************
388 dnl *** Checks for timezone stuff **
389 dnl ********************************
390 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
396 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
397 if test $ac_cv_struct_tm_gmtoff = yes; then
398 AC_DEFINE(HAVE_TM_GMTOFF)
400 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
405 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
406 if test $ac_cv_var_timezone = yes; then
407 AC_DEFINE(HAVE_TIMEZONE)
409 AC_ERROR(unable to find a way to determine timezone)
413 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
414 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
417 dnl ****************************
418 dnl *** Look for /dev/random ***
419 dnl ****************************
421 AC_MSG_CHECKING([if usage of random device is requested])
422 AC_ARG_ENABLE(dev-random,
423 [ --disable-dev-random disable the use of the random device],
424 try_dev_random=$enableval, try_dev_random=yes)
425 AC_MSG_RESULT($try_dev_random)
429 NAME_DEV_RANDOM="/dev/srandom"
432 dnl Win32 does not have /dev/random, they have their own method...
434 *-*-mingw*|*-*-cygwin*)
435 ac_cv_have_dev_random = no
438 dnl Everywhere else, it's /dev/random
441 NAME_DEV_RANDOM="/dev/random"
445 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
447 dnl Now check if the device actually exists
449 if test "x$try_dev_random" = "xyes"; then
450 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
451 [if test -r "$NAME_DEV_RANDOM" ; then
452 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
453 if test "x$ac_cv_have_dev_random" = "xyes"; then
454 AC_DEFINE(HAVE_CRYPT_RNG)
457 AC_MSG_CHECKING(for random device)
458 ac_cv_have_dev_random=no
459 AC_MSG_RESULT(has been disabled)
462 if test "x$platform_win32" = "xyes"; then
463 AC_DEFINE(HAVE_CRYPT_RNG)
466 if test "x$ac_cv_have_dev_random" = "xno" \
467 && test "x$platform_win32" = "xno"; then
470 *** A system-provided entropy source was not found on this system.
471 *** Because of this, the System.Security.Cryptography random number generator
472 *** will throw a NotImplemented exception.
474 *** If you are seeing this message, and you know your system DOES have an
475 *** entropy collection in place, please contact <crichton@gimp.org> and
476 *** provide information about the system and how to access the random device.
478 *** For those systems who lack a random device, EGD support is forthcoming.
482 AC_MSG_CHECKING([if inter-process shared handles are requested])
483 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
484 AC_MSG_RESULT($try_shared_handles)
485 if test "x$try_shared_handles" != "xyes"; then
486 AC_DEFINE(DISABLE_SHARED_HANDLES)
487 AC_SUBST(DISABLE_SHARED_HANDLES)
491 ACCESS_UNALIGNED="yes"
494 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
495 i*86-*-*) TARGET=X86; arch_target=x86;;
496 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
497 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
498 #m68k-*-linux*) TARGET=M68K;;
499 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc;;
500 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
501 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
504 if test ${TARGET} = unknown; then
505 CPPFLAGS="$CPPFLAGS -DNO_PORT"
506 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
509 if test ${ACCESS_UNALIGNED} = no; then
510 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
513 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
514 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
515 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
516 AM_CONDITIONAL(X86, test x$TARGET = xX86)
517 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
518 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
519 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
520 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
521 AM_CONDITIONAL(S390, test x$TARGET = xS390)
526 AC_SUBST(arch_target)
535 mono/metadata/Makefile
540 mono/os/win32/Makefile
541 mono/os/unix/Makefile
542 mono/arch/x86/Makefile
543 mono/arch/ppc/Makefile
544 mono/arch/sparc/Makefile
545 mono/arch/s390/Makefile
546 mono/arch/arm/Makefile
547 mono/interpreter/Makefile
549 mono/benchmark/Makefile
550 mono/monoburg/Makefile
551 mono/monograph/Makefile
553 mono/io-layer/Makefile
554 mono/handles/Makefile