3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono, 0.17)
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"
47 AC_MSG_WARN([*** Please add $host to configure.in checks!])
53 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
55 AC_CHECK_TOOL(CC, gcc, gcc)
60 AC_CHECK_PROG(BISON, bison,yes,no)
61 if test "x$BISON" = "xno";
63 AC_MSG_ERROR([You need to install bison])
66 dnl may require a specific autoconf version
67 dnl AC_PROG_CC_FOR_BUILD
68 dnl CC_FOR_BUILD not automatically detected
71 if test "x$cross_compiling" = "xyes"; then
75 AC_SUBST(CC_FOR_BUILD)
77 AC_SUBST(BUILD_EXEEXT)
84 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h)
86 # for mono/metadata/debug-symfile.c
87 AC_CHECK_HEADERS(elf.h)
90 AC_CHECK_HEADERS(wchar.h)
92 # not 64 bit clean in cross-compile
93 AC_CHECK_SIZEOF(void *, 4)
95 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
97 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
98 if test "x$PKG_CONFIG" = "xno"; then
99 AC_MSG_ERROR([You need to install pkg-config])
102 dnl for use on the build system
103 dnl pkg-config is stupid
104 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
105 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
106 AC_SUBST(BUILD_GLIB_CFLAGS)
107 AC_SUBST(BUILD_GLIB_LIBS)
110 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
111 if test x$with_crosspkgdir = "x"; then
112 if test -s $PKG_CONFIG_PATH; then
113 PKG_PATH=$PKG_CONFIG_PATH
116 PKG_PATH=$with_crosspkgdir
117 PKG_CONFIG_PATH=$PKG_PATH
118 export PKG_CONFIG_PATH
122 ## Versions of dependencies
123 GLIB_REQUIRED_VERSION=1.3.11
125 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
127 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
128 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
129 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
130 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
132 AC_SUBST(GLIB_CFLAGS)
134 AC_SUBST(GMODULE_CFLAGS)
135 AC_SUBST(GMODULE_LIBS)
138 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
139 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
141 AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
145 if test "x$found_boehm" != "xyes"; then
146 AC_MSG_ERROR("GC requested but libgc not found!")
148 if test "x$gc_headers" != "xyes"; then
149 AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
152 AC_DEFINE(HAVE_BOEHM_GC)
153 AC_SUBST(HAVE_BOEHM_GC)
154 LIBS="$LIBS -lgc $libdl"
157 AC_MSG_WARN("Compiling mono without GC.")
160 # If libgc was found, use it. Otherwise just warn.
161 if test "x$found_boehm" != "xyes"; then
162 AC_MSG_WARN("Compiling mono without GC.")
164 if test "x$gc_headers" != "xyes"; then
165 AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
167 AC_DEFINE(HAVE_BOEHM_GC)
168 AC_SUBST(HAVE_BOEHM_GC)
169 LIBS="$LIBS -lgc $libdl"
175 if test x$platform_win32 = xno; then
176 dnl ******************************************************************
177 dnl *** Check for large file support ***
178 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
179 dnl ******************************************************************
181 # Check that off_t can represent 2**63 - 1 correctly, working around
182 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
183 # CPPFLAGS and sets $large_offt to yes if the test succeeds
185 AC_DEFUN(LARGE_FILES, [
186 large_CPPFLAGS=$CPPFLAGS
187 CPPFLAGS="$CPPFLAGS $1"
189 #include <sys/types.h>
191 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
194 int big_off_t=((BIG_OFF_T%2147483629==721) &&
195 (BIG_OFF_T%2147483647==1));
204 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
205 large_CPPFLAGS="$large_CPPFLAGS $1"
210 CPPFLAGS=$large_CPPFLAGS
213 AC_MSG_CHECKING(if off_t is 64 bits wide)
215 if test $large_offt = no; then
216 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
217 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
219 if test $large_offt = no; then
220 AC_MSG_WARN([No 64 bit file size support available])
223 dnl *****************************
224 dnl *** Checks for libsocket ***
225 dnl *****************************
226 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
228 dnl *******************************
229 dnl *** Checks for MSG_NOSIGNAL ***
230 dnl *******************************
231 AC_MSG_CHECKING(for MSG_NOSIGNAL)
232 AC_TRY_COMPILE([#include <sys/socket.h>], [
233 int f = MSG_NOSIGNAL;
237 AC_DEFINE(HAVE_MSG_NOSIGNAL)
239 # We'll have to use signals
243 dnl *****************************
244 dnl *** Checks for SOL_IP ***
245 dnl *****************************
246 AC_MSG_CHECKING(for SOL_IP)
247 AC_TRY_COMPILE([#include <netdb.h>], [
252 AC_DEFINE(HAVE_SOL_IP)
254 # We'll have to use getprotobyname
258 dnl *****************************
259 dnl *** Checks for SOL_TCP ***
260 dnl *****************************
261 AC_MSG_CHECKING(for SOL_TCP)
262 AC_TRY_COMPILE([#include <netdb.h>], [
267 AC_DEFINE(HAVE_SOL_TCP)
269 # We'll have to use getprotobyname
273 dnl *****************************
274 dnl *** Checks for IP_PKTINFO ***
275 dnl *****************************
276 AC_MSG_CHECKING(for IP_PKTINFO)
277 AC_TRY_COMPILE([#include <netdb.h>], [
278 int level = IP_PKTINFO;
282 AC_DEFINE(HAVE_IP_PKTINFO)
287 dnl *********************************
288 dnl *** Check for struct ip_mreqn ***
289 dnl *********************************
290 AC_MSG_CHECKING(for struct ip_mreqn)
291 AC_TRY_COMPILE([#include <netinet/in.h>], [
292 struct ip_mreqn mreq;
293 mreq.imr_address.s_addr = 0;
297 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
299 # We'll just have to use struct ip_mreq
303 dnl *****************************
304 dnl *** Checks for libnsl ***
305 dnl *****************************
306 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
308 AC_CHECK_FUNCS(inet_pton inet_aton)
310 dnl ***********************************************
311 dnl *** Checks for size of sockaddr_un.sun_path ***
312 dnl ***********************************************
313 # AC_CHECK_SIZEOF can't cope with struct members :-(
314 AC_MSG_CHECKING(size of sockaddr_un.sun_path)
315 AC_CACHE_VAL(cv_mono_sizeof_sunpath,
317 #include <sys/types.h>
322 struct sockaddr_un sock_un;
323 FILE *f=fopen("conftestval", "w");
325 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
328 ], cv_mono_sizeof_sunpath=`cat conftestval`,
329 cv_mono_sizeof_sunpath=0,
330 cv_mono_sizeof_sunpath=0)])dnl
331 AC_MSG_RESULT($cv_mono_sizeof_sunpath)
332 AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
334 dnl *****************************
335 dnl *** Checks for libxnet ***
336 dnl *****************************
339 AC_MSG_CHECKING(for Solaris XPG4 support)
340 if test -f /usr/lib/libxnet.so; then
341 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
342 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
343 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
350 if test "$GCC" = "yes"; then
351 CFLAGS="$CFLAGS -Wno-char-subscripts"
356 dnl *****************************
357 dnl *** Checks for libpthread ***
358 dnl *****************************
359 AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
360 AC_CHECK_FUNCS(pthread_mutex_timedlock)
361 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
362 AC_TRY_COMPILE([ #include <pthread.h>], [
363 pthread_mutexattr_t attr;
364 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
369 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
370 AC_DEFINE(USE_MONO_MUTEX)
373 dnl ********************************
374 dnl *** Checks for semaphore lib ***
375 dnl ********************************
376 AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
378 dnl ********************************
379 dnl *** Checks for timezone stuff **
380 dnl ********************************
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_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
396 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
397 if test $ac_cv_var_timezone = yes; then
398 AC_DEFINE(HAVE_TIMEZONE)
400 AC_ERROR(unable to find a way to determine timezone)
404 AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
405 AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
408 dnl ****************************
409 dnl *** Look for /dev/random ***
410 dnl ****************************
412 AC_MSG_CHECKING([if usage of random device is requested])
413 AC_ARG_ENABLE(dev-random,
414 [ --disable-dev-random disable the use of the random device],
415 try_dev_random=$enableval, try_dev_random=yes)
416 AC_MSG_RESULT($try_dev_random)
420 NAME_DEV_RANDOM="/dev/srandom"
423 dnl Win32 does not have /dev/random, they have their own method...
425 *-*-mingw*|*-*-cygwin*)
426 ac_cv_have_dev_random = no
429 dnl Everywhere else, it's /dev/random
432 NAME_DEV_RANDOM="/dev/random"
436 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
438 dnl Now check if the device actually exists
440 if test "x$try_dev_random" = "xyes"; then
441 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
442 [if test -r "$NAME_DEV_RANDOM" ; then
443 ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
444 if test "x$ac_cv_have_dev_random" = "xyes"; then
445 AC_DEFINE(HAVE_CRYPT_RNG)
448 AC_MSG_CHECKING(for random device)
449 ac_cv_have_dev_random=no
450 AC_MSG_RESULT(has been disabled)
453 if test "x$platform_win32" = "xyes"; then
454 AC_DEFINE(HAVE_CRYPT_RNG)
457 if test "x$ac_cv_have_dev_random" = "xno" \
458 && test "x$platform_win32" = "xno"; then
461 *** A system-provided entropy source was not found on this system.
462 *** Because of this, the System.Security.Cryptography random number generator
463 *** will throw a NotImplemented exception.
465 *** If you are seeing this message, and you know your system DOES have an
466 *** entropy collection in place, please contact <crichton@gimp.org> and
467 *** provide information about the system and how to access the random device.
469 *** For those systems who lack a random device, EGD support is forthcoming.
473 AC_MSG_CHECKING([if inter-process shared handles are requested])
474 AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
475 AC_MSG_RESULT($try_shared_handles)
476 if test "x$try_shared_handles" != "xyes"; then
477 AC_DEFINE(DISABLE_SHARED_HANDLES)
478 AC_SUBST(DISABLE_SHARED_HANDLES)
482 ACCESS_UNALIGNED="yes"
485 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
486 i*86-*-*) TARGET=X86; arch_target=x86;;
487 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
488 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
489 #m68k-*-linux*) TARGET=M68K;;
490 macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
491 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
492 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
495 if test ${TARGET} = unknown; then
496 CPPFLAGS="$CPPFLAGS -DNO_PORT"
497 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
500 if test ${ACCESS_UNALIGNED} = no; then
501 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
504 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
505 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
506 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
507 AM_CONDITIONAL(X86, test x$TARGET = xX86)
508 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
509 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
510 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
511 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
512 AM_CONDITIONAL(S390, test x$TARGET = xS390)
517 AC_SUBST(arch_target)
526 mono/metadata/Makefile
531 mono/os/win32/Makefile
532 mono/os/unix/Makefile
533 mono/arch/x86/Makefile
534 mono/arch/ppc/Makefile
535 mono/arch/sparc/Makefile
536 mono/arch/s390/Makefile
537 mono/arch/arm/Makefile
538 mono/interpreter/Makefile
540 mono/benchmark/Makefile
541 mono/monoburg/Makefile
542 mono/monograph/Makefile
544 mono/io-layer/Makefile
545 mono/handles/Makefile