2004-12-06 Ben Maurer <bmaurer@ximian.com>
[mono-project.git] / configure.in
blob07146ac45381e4c752c176269f135b30ea8332d0
1 AC_INIT(README)
2 AC_CANONICAL_SYSTEM
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,1.1.2.99)
5 AM_MAINTAINER_MODE
7 AC_PROG_LN_S
9 # In case of cygwin, override LN_S, irrespective of what it determines.
10 # The build uses cygwin, but the actual runtime doesn't.
11 case $host_os in
12 *cygwin* ) LN_S='cp -p';;
13 esac
16 dnl
17 dnl libgc checks
18 dnl
20 gc_headers=no
21 gc=included
22 use_included_gc=no
24 if test -d $srcdir/libgc ; then
25   gc_default=included
26 else
27   gc_default=boehm
31 # These are the flags that need to be stored in the mono.pc file for 
32 # compiling code that will embed Mono
34 libmono_cflags=""
35 libmono_ldflags=""
36 AC_SUBST(libmono_cflags)
37 AC_SUBST(libmono_ldflags)
39 dnl if linker handles the version script
40 no_version_script=no
42 # Set to yes if Unix sockets cannot be created in an anonymous namespace
43 need_link_unlink=no
45 # Thread configuration inspired by sleepycat's db
46 AC_MSG_CHECKING([host platform characteristics])
47 libgc_threads=no
48 case "$host" in
49         *-*-mingw*|*-*-cygwin*)
50                 platform_win32=yes
51                 AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
52                 CC="gcc -mno-cygwin -g"
53                 HOST_CC="gcc"
54                 # So libgc configure gets -mno-cygwin
55                 export CC
56 # latest libgc already defines GC_WIN32_THREADS
57 #               CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
58                 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
59                 libdl=
60                 libgc_threads=win32
61                 gc_default=included
62                 with_nptl=default
63                 with_sigaltstack=no
64                 LN_S=cp
65                 ;;
66         *-*-*netbsd*)
67                 platform_win32=no
68                 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
69                 libmono_cflags="-D_REENTRANT"
70                 LDFLAGS="$LDFLAGS -pthread"
71                 libmono_ldflags="-pthread"
72                 need_link_unlink=yes
73                 libdl=
74                 libgc_threads=no
75                 ;;
76 # these flags will work for all versions of -STABLE
78         *-*-*freebsd4*)
79                 platform_win32=no
80                 if test "x$PTHREAD_CFLAGS" = "x"; then
81                         CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
82                         libmono_cflags="-D_THREAD_SAFE"
83                 else
84                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
85                         libmono_cflags="$PTHREAD_CFLAGS"
86                 fi
87                 if test "x$PTHREAD_LIBS" = "x"; then
88                         LDFLAGS="$LDFLAGS -pthread"
89                         libmono_ldflags="-pthread"
90                 else
91                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
92                         libmono_ldflags="$PTHREAD_LIBS"
93                 fi
94                 need_link_unlink=yes
95                 AC_DEFINE(PTHREAD_POINTER_ID)
96                 libdl=
97                 libgc_threads=pthreads
98 # TLS isn't implemented at all on -STABLE
99                 with_nptl=no
100                 with_tls=pthread
101                 ;;
102 # older versions of -CURRENT will break with these flags but testing
103 # indicates these older versions won't run Mono anyway
105         *-*-*freebsd5*)
106                 platform_win32=no
107                 if test "x$PTHREAD_CFLAGS" = "x"; then
108                         CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
109                         libmono_cflags=
110                 else
111                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
112                         libmono_cflags="$PTHREAD_CFLAGS"
113                 fi
114                 if test "x$PTHREAD_LIBS" = "x"; then
115                         LDFLAGS="$LDFLAGS -lpthread"
116                         libmono_ldflags="-lpthread"
117                 else
118                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
119                         libmono_ldflags="$PTHREAD_LIBS"
120                 fi
121                 need_link_unlink=yes
122                 AC_DEFINE(PTHREAD_POINTER_ID)
123                 libdl=
124                 libgc_threads=pthreads
125 # TLS is only partially implemented on -CURRENT (compiler support
126 # but NOT library support)
128                 with_nptl=no
129                 with_tls=pthread
130                 ;;
131         *-*-*openbsd*)
132                 platform_win32=no
133                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
134                 libmono_cflags="-D_THREAD_SAFE"
135                 LDFLAGS="$LDFLAGS -pthread"
136                 libmono_ldflags="-pthread"
137                 need_link_unlink=yes
138                 AC_DEFINE(PTHREAD_POINTER_ID)
139                 libdl=
140                 libgc_threads=pthreads
141                 ;;
142         *-*-linux*)
143                 platform_win32=no
144                 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
145                 libmono_cflags="-D_REENTRANT"
146                 libmono_ldflags="-lpthread"
147                 libdl="-ldl"
148                 libgc_threads=pthreads
149                 ;;
150         *-*-hpux*)
151                 platform_win32=no
152                 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
153                 CFLAGS="$CFLAGS +ESdbgasm"
154                 LDFLAGS="$LDFLAGS -z"
155                 libmono_cflags="-D_REENTRANT"
156                 libmono_ldflags="-lpthread"
157                 libgc_threads=pthreads
158                 need_link_unlink=yes
159                 ;;
160         *-*-solaris*)
161                 platform_win32=no
162                 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
163                 need_link_unlink=yes
164                 libmono_cflags="-D_REENTRANT"
165                 libgc_threads=pthreads
166                 ;;
167         *-*-darwin*)
168                 platform_win32=no
169                 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
170                 libmono_cflags="-D_THREAD_SAFE"
171                 LDFLAGS="$LDFLAGS -pthread"
172                 libmono_ldflags="-pthread"
173                 need_link_unlink=yes
174                 AC_DEFINE(PTHREAD_POINTER_ID)
175                 AC_DEFINE(USE_MACH_SEMA)
176                 no_version_script=yes
177                 libdl=
178                 libgc_threads=pthreads
179                 ;;
180         *)
181                 AC_MSG_WARN([*** Please add $host to configure.in checks!])
182                 platform_win32=no
183                 libdl="-ldl"
184                 ;;
185 esac
186 AC_MSG_RESULT(ok)
188 if test x$need_link_unlink = xyes; then
189    AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
192 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
194 AC_CHECK_TOOL(CC, gcc, gcc)
195 AC_PROG_CC
196 AM_PROG_CC_STDC
197 AC_PROG_INSTALL
198 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
199 : ${CCAS='$(CC)'}
200 # Set ASFLAGS if not already set.
201 : ${CCASFLAGS='$(CFLAGS)'}
202 AC_SUBST(CCAS)
203 AC_SUBST(CCASFLAGS)
205 AC_CHECK_PROG(BISON, bison,yes,no)
206 if test "x$BISON" = "xno";
207 then
208         AC_MSG_ERROR([You need to install bison])
211 dnl may require a specific autoconf version
212 dnl AC_PROG_CC_FOR_BUILD
213 dnl CC_FOR_BUILD not automatically detected
214 CC_FOR_BUILD=$CC
215 BUILD_EXEEXT=
216 if test "x$cross_compiling" = "xyes"; then
217         CC_FOR_BUILD=cc
218         BUILD_EXEEXT=""
220 AC_SUBST(CC_FOR_BUILD)
221 AC_SUBST(HOST_CC)
222 AC_SUBST(BUILD_EXEEXT)
224 # Set STDC_HEADERS
225 AC_HEADER_STDC
226 AC_LIBTOOL_WIN32_DLL
227 AM_PROG_LIBTOOL
229 # Test whenever ld supports -version-script
230 AC_PROG_LD
231 AC_PROG_LD_GNU
232 if test "x$lt_cv_prog_gnu_ld" = "xno"; then
233    no_version_script=yes
236 AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
238 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
240 AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
242 AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
244 # for mono/metadata/debug-symfile.c
245 AC_CHECK_HEADERS(elf.h)
247 # for mono/dis
248 AC_CHECK_HEADERS(wchar.h)
250 # not 64 bit clean in cross-compile
251 AC_CHECK_SIZEOF(void *, 4)
253 WARN=''
254 if test x"$GCC" = xyes; then
255         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
256                 # The runtime code does not respect ANSI C strict aliasing rules
257                 CFLAGS="$CFLAGS -fno-strict-aliasing"
258 else
259         # The Sun Forte compiler complains about inline functions that access static variables
260         # so disable all inlining.
261         case "$host" in
262         *-*-solaris*)
263                 CFLAGS="$CFLAGS -Dinline="
264                 ;;
265         esac
267 CFLAGS="$CFLAGS -g $WARN"
269 # Where's the 'mcs' source tree?
270 if test -d $srcdir/mcs; then
271   mcsdir=mcs
272 else
273   mcsdir=../mcs
276 mcs_topdir='$(top_srcdir)/'$mcsdir
277 mcs_topdir_from_srcdir='$(top_builddir)/'$mcsdir
279 AC_SUBST([mcs_topdir])
280 AC_SUBST([mcs_topdir_from_srcdir])
282 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
283 if test "x$PKG_CONFIG" = "xno"; then
284         AC_MSG_ERROR([You need to install pkg-config])
287 dnl for use on the build system
288 dnl pkg-config is stupid
289 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
290 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
291 AC_SUBST(BUILD_GLIB_CFLAGS)
292 AC_SUBST(BUILD_GLIB_LIBS)
294 PKG_PATH=
295 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir],
296         if test x$with_crosspkgdir = "x"; then
297                 if test -s $PKG_CONFIG_PATH; then
298                         PKG_PATH=$PKG_CONFIG_PATH
299                 fi
300         else
301                 PKG_PATH=$with_crosspkgdir
302                 PKG_CONFIG_PATH=$PKG_PATH
303                 export PKG_CONFIG_PATH
304         fi
307 ## Versions of dependencies
308 GLIB_REQUIRED_VERSION=1.3.11
310 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
312 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
313 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
314 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
315 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
317 AC_SUBST(GLIB_CFLAGS)
318 AC_SUBST(GLIB_LIBS)
319 AC_SUBST(GMODULE_CFLAGS)
320 AC_SUBST(GMODULE_LIBS)
322 if test x$platform_win32 = xyes; then   
323    AC_MSG_CHECKING(for cygwin glib2-dev package)
324    if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
325       AC_MSG_RESULT(found)
326           AC_MSG_ERROR([Mono cannot be built with the cygwin glib2-devel package installed, because that package doesn't work with -mno-cygwin. Please uninstall it then re-run configure.])
327    else
328       AC_MSG_RESULT(not found, ok)
329    fi
331    AC_MSG_CHECKING(for broken gwin32.h)
332    glib_include=`$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`
333    if test -f $glib_include/glib/gwin32.h; then
334           if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
335                  AC_MSG_RESULT(failed)
336                  hashmark='#'
337                  AC_MSG_ERROR([Your version of gwin32.h is broken and will cause compilation errors when building mono. Please fix it by deleting the line: '$hashmark   define ftruncate...' from '$glib_include/glib/gwin32.h' then re-run configure.])
338           fi
339    fi
340    AC_MSG_RESULT(ok)
343 AC_ARG_WITH(gc, [  --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
345 # Enable support for fast thread-local storage
346 # Some systems have broken support, so we allow to disable it.
347 AC_ARG_WITH(tls, [  --with-tls=__thread,pthread       select Thread Local Storage implementation],[],[with_tls=__thread])
349 # Kept for compatibility
350 AC_ARG_WITH(nptl, [  --with-nptl=yes,no      deprecated, use --with-tls instead],[],[with_nptl=default])
352 if test "x$with_nptl" != "xdefault"; then
353    if test "x$with_nptl" = "xyes"; then
354       AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.])
355           with_tls=__thread
356    fi
357    if test "x$with_nptl" = "xno"; then
358       AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.])
359           with_tls=pthread
360    fi
363 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
364 # This does not work on some platforms (bug #55253)
365 AC_ARG_WITH(sigaltstack, [  --with-sigaltstack=yes,no      enable/disable support for sigaltstack],[],[with_sigaltstack=no])
367 AC_ARG_WITH(static_mono, [  --with-static_mono=yes,no      link mono statically to libmono (faster)],[],[with_static_mono=yes])
369 if test "x$enable_static" = "xno"; then
370    with_static_mono=no
373 AM_CONDITIONAL(STATIC_MONO, test x$with_static_mono != xno)
375 AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsystems.
376   LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, reflection_emit.],
378         for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
379                 eval "mono_feature_disable_$feature='yes'"
380                 AC_MSG_NOTICE([Disabled support for feature: $feature])
381         done
382 ],[])
384 if test "x$mono_feature_disable_aot" = "xyes"; then
385         AC_DEFINE(DISABLE_AOT, 1, [Disable AOT support])
388 if test "x$mono_feature_disable_profiler" = "xyes"; then
389         AC_DEFINE(DISABLE_PROFILER, 1, [Disable default profiler support])
392 if test "x$mono_feature_disable_decimal" = "xyes"; then
393         AC_DEFINE(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
396 if test "x$mono_feature_disable_pinvoke" = "xyes"; then
397         AC_DEFINE(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
400 if test "x$mono_feature_disable_debug" = "xyes"; then
401         AC_DEFINE(DISABLE_DEBUG, 1, [Disable runtime debugging support])
404 if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
405         AC_DEFINE(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
408 LIBGC_CFLAGS=
409 LIBGC_LIBS=
410 LIBGC_STATIC_LIBS=
411 libgc_dir=
412 case "x$gc" in
413         xboehm|xbohem|xyes)
414                 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
415                 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
417                 if test "x$found_boehm" != "xyes"; then
418                         AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
419                 fi
420                 if test "x$gc_headers" != "xyes"; then
421                         AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
422                 fi
424                 AC_DEFINE(HAVE_BOEHM_GC)
425                 AC_SUBST(HAVE_BOEHM_GC)
426                 LIBGC_LIBS="-lgc $libdl"
427                 LIBGC_STATIC_LIBS="$LIBGC_LIBS"
429                 # AC_CHECK_FUNCS does not work for some reason...
430                 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
431                 if test "x$found_gcj_malloc" = "xyes"; then
432                         AC_DEFINE(HAVE_GC_GCJ_MALLOC)
433                 fi
434                 AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
435                 if test "x$found_gc_enable" = "xyes"; then
436                         AC_DEFINE(HAVE_GC_ENABLE)
437                 fi
438                 ;;
440         xincluded)
441                 AC_CONFIG_SUBDIRS(libgc)
443                 found_boehm=yes
444                 gc_headers=yes
445                 use_included_gc=yes
446                 libgc_dir=libgc
448                 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
449                 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
450                 LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
452                 AC_DEFINE(HAVE_BOEHM_GC)
453                 AC_SUBST(HAVE_BOEHM_GC)
455                 AC_DEFINE(HAVE_GC_H)
456                 AC_DEFINE(USE_INCLUDED_LIBGC)
458                 # The included libgc contains GCJ support
459                 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
460                 AC_DEFINE(HAVE_GC_ENABLE)
461                 ;;
463         xnone)
464                 AC_MSG_WARN("Compiling mono without GC.")
465                 ;;
466         *)
467                 AC_MSG_ERROR([Invalid argument to --with-gc.])
468                 ;;
469 esac
472 # tell libgc/configure about what we want
473 ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads"
475 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
476 AC_SUBST(LIBGC_CFLAGS)
477 AC_SUBST(LIBGC_LIBS)
478 AC_SUBST(LIBGC_STATIC_LIBS)
479 AC_SUBST(libgc_dir)
482 dnl End of libgc checks
485 if test x$platform_win32 = xno; then
487         dnl ******************************************************************
488         dnl *** Checks for the IKVM JNI interface library                  ***
489         dnl ******************************************************************
490         AC_ARG_WITH(ikvm-jni, [  --with-ikvm-jni=yes,no  build the IKVM JNI interface library],[with_ikvm_jni=$withval],[with_ikvm_jni=yes])
491         AC_ARG_WITH(jdk, [  --with-jdk=DIRECTORY    Use JDK from DIRECTORY],[with_jdk_dir=$withval],[with_jdk_dir=])
493         ikvm_jni_dir=
494         if test x$with_ikvm_jni = xyes; then
495                 AC_MSG_CHECKING([JDK headers])
497                 if test x$with_jdk_dir = x; then
498                         # Try JAVA_HOME variable
499                         if test x$JAVA_HOME != x; then
500                                 with_jdk_dir=$JAVA_HOME
501                         fi
502                 fi
503         
504                 jdk_platform=
505                 if test -d $with_jdk_dir/include; then
506                         jdk_headers_found=yes
508                         if test -d $with_jdk_dir/include/linux; then
509                                 jdk_platform=linux
510                         else
511                         if test -d $with_jdk_dir/include/solaris; then
512                                 jdk_platform=solaris
513                         else
514                         if test -f $with_jdk_dir/include/jni_md.h; then
515                                 # GNU Classpath sources
516                                 jdk_platform=
517                         else
518                                 jdk_headers_found=no
519                         fi
520                         fi
521                         fi
522                 else
523                         jdk_headers_found=no
524                 fi
526                 if test x$jdk_headers_found = xyes; then
527                         AC_MSG_RESULT($with_jdk_dir/include $with_jdk_dir/include/$jdk_platform)
528                 else
529                         AC_MSG_RESULT(not found)
530                 fi
532                 if test x$jdk_headers_found = xyes; then
533                         ikvm_jni_dir=ikvm-jni
534                         IKVM_JNI_CFLAGS="-I$with_jdk_dir/include -I$with_jdk_dir/include/$jdk_platform"
535                 fi
536         fi
538         AC_SUBST(ikvm_jni_dir)
539         AC_SUBST(IKVM_JNI_CFLAGS)
541         AC_CHECK_FUNCS(getgrgid_r)
542         AC_CHECK_FUNCS(getgrnam_r)
543         AC_CHECK_FUNCS(getpwnam_r)
544         AC_CHECK_FUNCS(getpwuid_r)
545         AC_CHECK_FUNCS(getresuid)
546         AC_CHECK_FUNCS(setresuid)
547         AC_CHECK_FUNCS(kqueue)
549         dnl ******************************************************************
550         dnl *** Check for large file support                               ***
551         dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
552         dnl ******************************************************************
553         
554         # Check that off_t can represent 2**63 - 1 correctly, working around
555         # potential compiler bugs.  Defines LARGE_FILE_SUPPORT, adds $1 to
556         # CPPFLAGS and sets $large_offt to yes if the test succeeds
557         large_offt=no
558         AC_DEFUN(LARGE_FILES, [
559                 large_CPPFLAGS=$CPPFLAGS
560                 CPPFLAGS="$CPPFLAGS $1"
561                 AC_TRY_RUN([
562                         #include <sys/types.h>
564                         #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
566                         int main(void) {
567                                 int big_off_t=((BIG_OFF_T%2147483629==721) &&
568                                                (BIG_OFF_T%2147483647==1));
569                                 if(big_off_t) {
570                                         exit(0);
571                                 } else {
572                                         exit(1);
573                                 }
574                         }
575                 ], [
576                         AC_MSG_RESULT(ok)
577                         AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
578                         large_CPPFLAGS="$large_CPPFLAGS $1"
579                         large_offt=yes
580                 ], [
581                         AC_MSG_RESULT(no)
582                 ], "")
583                 CPPFLAGS=$large_CPPFLAGS
584         ])
586         AC_MSG_CHECKING(if off_t is 64 bits wide)
587         LARGE_FILES("")
588         if test $large_offt = no; then
589                 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
590                 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
591         fi
592         if test $large_offt = no; then
593                 AC_MSG_WARN([No 64 bit file size support available])
594         fi
595         
596         dnl *****************************
597         dnl *** Checks for libsocket  ***
598         dnl *****************************
599         AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
601         dnl *******************************
602         dnl *** Checks for MSG_NOSIGNAL ***
603         dnl *******************************
604         AC_MSG_CHECKING(for MSG_NOSIGNAL)
605         AC_TRY_COMPILE([#include <sys/socket.h>], [
606                 int f = MSG_NOSIGNAL;
607         ], [
608                 # Yes, we have it...
609                 AC_MSG_RESULT(yes)
610                 AC_DEFINE(HAVE_MSG_NOSIGNAL)
611         ], [
612                 # We'll have to use signals
613                 AC_MSG_RESULT(no)
614         ])
616         dnl *****************************
617         dnl *** Checks for SOL_IP     ***
618         dnl *****************************
619         AC_MSG_CHECKING(for SOL_IP)
620         AC_TRY_COMPILE([#include <netdb.h>], [
621                 int level = SOL_IP;
622         ], [
623                 # Yes, we have it...
624                 AC_MSG_RESULT(yes)
625                 AC_DEFINE(HAVE_SOL_IP)
626         ], [
627                 # We'll have to use getprotobyname
628                 AC_MSG_RESULT(no)
629         ])
631         dnl *****************************
632         dnl *** Checks for SOL_IPV6     ***
633         dnl *****************************
634         AC_MSG_CHECKING(for SOL_IPV6)
635         AC_TRY_COMPILE([#include <netdb.h>], [
636                 int level = SOL_IPV6;
637         ], [
638                 # Yes, we have it...
639                 AC_MSG_RESULT(yes)
640                 AC_DEFINE(HAVE_SOL_IPV6)
641         ], [
642                 # We'll have to use getprotobyname
643                 AC_MSG_RESULT(no)
644         ])
646         dnl *****************************
647         dnl *** Checks for SOL_TCP    ***
648         dnl *****************************
649         AC_MSG_CHECKING(for SOL_TCP)
650         AC_TRY_COMPILE([#include <netdb.h>], [
651                 int level = SOL_TCP;
652         ], [
653                 # Yes, we have it...
654                 AC_MSG_RESULT(yes)
655                 AC_DEFINE(HAVE_SOL_TCP)
656         ], [
657                 # We'll have to use getprotobyname
658                 AC_MSG_RESULT(no)
659         ])
661         dnl *****************************
662         dnl *** Checks for IP_PKTINFO ***
663         dnl *****************************
664         AC_MSG_CHECKING(for IP_PKTINFO)
665         AC_TRY_COMPILE([#include <netdb.h>], [
666                 int level = IP_PKTINFO;
667         ], [
668                 # Yes, we have it...
669                 AC_MSG_RESULT(yes)
670                 AC_DEFINE(HAVE_IP_PKTINFO)
671         ], [
672                 AC_MSG_RESULT(no)
673         ])
675         dnl *********************************
676         dnl *** Check for struct ip_mreqn ***
677         dnl *********************************
678         AC_MSG_CHECKING(for struct ip_mreqn)
679         AC_TRY_COMPILE([#include <netinet/in.h>], [
680                 struct ip_mreqn mreq;
681                 mreq.imr_address.s_addr = 0;
682         ], [
683                 # Yes, we have it...
684                 AC_MSG_RESULT(yes)
685                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
686         ], [
687                 # We'll just have to try and use struct ip_mreq
688                 AC_MSG_RESULT(no)
689                 AC_MSG_CHECKING(for struct ip_mreq)
690                 AC_TRY_COMPILE([#include <netinet/in.h>], [
691                         struct ip_mreq mreq;
692                         mreq.imr_interface.s_addr = 0;
693                 ], [
694                         # Yes, we have it...
695                         AC_MSG_RESULT(yes)
696                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
697                 ], [
698                         # No multicast support
699                         AC_MSG_RESULT(no)
700                 ])
701         ])
702         
703         dnl **********************************
704         dnl *** Check for gethostbyname2_r ***
705         dnl **********************************
706         AC_MSG_CHECKING(for gethostbyname2_r)
707                 AC_TRY_LINK([#include <netdb.h>], [
708                 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
709         ], [
710                 # Yes, we have it...
711                 AC_MSG_RESULT(yes)
712                 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
713         ], [
714                 AC_MSG_RESULT(no)
715         ])
717         dnl *****************************
718         dnl *** Checks for libnsl     ***
719         dnl *****************************
720         AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
722         AC_CHECK_FUNCS(inet_pton inet_aton)
724         dnl ***********************************************
725         dnl *** Checks for size of sockaddr_un.sun_path ***
726         dnl ***********************************************
727         # AC_CHECK_SIZEOF can't cope with struct members :-(
728         AC_MSG_CHECKING(size of sockaddr_un.sun_path)
729         AC_CACHE_VAL(cv_mono_sizeof_sunpath,
730                 [AC_TRY_RUN([
731                         #include <sys/types.h>
732                         #include <stdio.h>
733                         #include <sys/un.h>
735                         int main(void) {
736                                 struct sockaddr_un sock_un;
737                                 FILE *f=fopen("conftestval", "w");
738                                 if(!f) exit(1);
739                                 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
740                                 exit(0);
741                         }
742                 ], cv_mono_sizeof_sunpath=`cat conftestval`,
743                    cv_mono_sizeof_sunpath=0,
744                    cv_mono_sizeof_sunpath=0)])dnl
745         AC_MSG_RESULT($cv_mono_sizeof_sunpath)
746         AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
748         dnl *************************************
749         dnl *** Checks for zero length arrays ***
750         dnl *************************************
751         AC_MSG_CHECKING(whether $CC supports zero length arrays)
752         AC_TRY_COMPILE([
753                 struct s {
754                         int  length;
755                         char data [0];
756                 };
757         ], [], [
758                 AC_MSG_RESULT(yes)
759                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
760         ], [
761                 AC_MSG_RESULT(no)
762                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
763         ])
765         dnl *****************************
766         dnl *** Checks for libxnet    ***
767         dnl *****************************
768         case "${host}" in
769                 *solaris* )
770                         AC_MSG_CHECKING(for Solaris XPG4 support)
771                         if test -f /usr/lib/libxnet.so; then
772                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
773                                 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
774                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
775                                 LIBS="$LIBS -lxnet"
776                                 AC_MSG_RESULT(yes)
777                         else
778                                 AC_MSG_RESULT(no)
779                         fi
781                         if test "$GCC" = "yes"; then
782                                 CFLAGS="$CFLAGS -Wno-char-subscripts"
783                         fi
784                 ;;
785         esac
787         dnl *****************************
788         dnl *** Checks for libpthread ***
789         dnl *****************************
790 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
791 # and libpthread does not exist
793         case "${host}" in
794                 *-*-*freebsd4*)
795                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
796                 ;;
797                 *)
798                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
799                 ;;
800         esac
801         AC_CHECK_HEADERS(pthread.h)
802         AC_CHECK_FUNCS(pthread_mutex_timedlock)
803         AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
804         AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
805         AC_TRY_COMPILE([ #include <pthread.h>], [
806                 pthread_mutexattr_t attr;
807                 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
808         ], [
809                 AC_MSG_RESULT(ok)
810         ], [
811                 AC_MSG_RESULT(no)
812                 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
813                 AC_DEFINE(USE_MONO_MUTEX)
814         ])
815         AC_CHECK_FUNCS(pthread_attr_setstacksize)
817         dnl ***********************************
818         dnl *** Checks for working __thread ***
819         dnl ***********************************
820         AC_MSG_CHECKING(for working __thread)
821         if test "x$with_tls" != "x__thread"; then
822                 AC_MSG_RESULT(disabled)
823         else
824                 AC_TRY_RUN([
825                         #include <pthread.h>
827                         __thread int i;
828                         static int res1, res2;
830                         void thread_main (void *arg)
831                         {
832                                 i = arg;
833                                 sleep (1);
834                                 if (arg == 1)
835                                         res1 = (i == arg);
836                                 else
837                                         res2 = (i == arg);
838                         }
840                         int main () {
841                                 pthread_t t1, t2;
843                                 i = 5;
845                                 pthread_create (&t1, NULL, thread_main, 1);
846                                 pthread_create (&t2, NULL, thread_main, 2);
848                                 pthread_join (t1, NULL);
849                                 pthread_join (t2, NULL);
851                                 return !(res1 + res2 == 2);
852                         }
853                 ], [
854                                 AC_MSG_RESULT(yes)
855                 ], [
856                                 AC_MSG_RESULT(no)
857                                 with_tls=pthread
858                 ])
859         fi
861         dnl **************************************
862         dnl *** Checks for working sigaltstack ***
863         dnl **************************************
864         AC_MSG_CHECKING(for working sigaltstack)
865         if test "x$with_sigaltstack" != "xyes"; then
866                 AC_MSG_RESULT(disabled)
867         else
868                 AC_TRY_RUN([
869                         #include <stdio.h>
870                         #include <stdlib.h>
871                         #include <unistd.h>
872                         #include <signal.h>
873                         #include <pthread.h>
874                         #include <sys/wait.h>
876                         static void
877                         sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
878                         {
879                                 exit (0);
880                         }
882                         static void *
883                         loop (void *ignored)
884                         {
885                                 char *ptr = NULL;
887                                 *ptr = 0;
888                                 return NULL;
889                         }
891                         static void
892                         child ()
893                         {
894                                 struct sigaction sa;
895                                 struct sigaltstack sas;
896                                 pthread_t id;
897                                 pthread_attr_t attr;
899                                 sa.sa_sigaction = sigsegv_signal_handler;
900                                 sigemptyset (&sa.sa_mask);
901                                 sa.sa_flags = SA_SIGINFO | SA_STACK;
902                                 if (sigaction (SIGSEGV, &sa, NULL) == -1) {
903                                         perror ("lala");
904                                         return;
905                                 }
907                                 sas.ss_sp = malloc (SIGSTKSZ);
908                                 sas.ss_size = SIGSTKSZ;
909                                 sas.ss_flags = SS_ONSTACK;
910                                 if (sigaltstack (&sas, NULL) == -1) {
911                                         perror ("lala");
912                                         return;
913                                 }
915                                 pthread_attr_init (&attr);
916                                 if (pthread_create(&id, &attr, loop, &attr) != 0) {
917                                         printf ("failed\n");
918                                         return;
919                                 }
921                                 sleep (100);
922                         }
924                         int
925                         main ()
926                         {
927                                 pid_t son;
928                                 int status;
929                                 int i;
931                                 son = fork ();
932                                 if (son == -1) {
933                                         return 1;
934                                 }
936                                 if (son == 0) {
937                                         child ();
938                                         return 0;
939                                 }
941                                 for (i = 0; i < 3; ++i) {
942                                         sleep (1);
943                                         waitpid (son, &status, WNOHANG);
944                                         if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
945                                                 return 0;
946                                 }
948                                 kill (son, SIGKILL);
949                                 return 1;
950                         }
952                 ], [
953                                 AC_MSG_RESULT(yes)
954                                 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
955                 ], [
956                                 with_sigaltstack=no
957                                 AC_MSG_RESULT(no)
958                 ])
959         fi
961         dnl ********************************
962         dnl *** Checks for semaphore lib ***
963         dnl ********************************
964         # 'Real Time' functions on Solaris
965         # posix4 on Solaris 2.6
966         # pthread (first!) on Linux
967         AC_SEARCH_LIBS(sem_init, pthread rt posix4) 
969         dnl ********************************
970         dnl *** Checks for timezone stuff **
971         dnl ********************************
972         AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
973                 AC_TRY_COMPILE([
974                         #include <time.h>
975                         ], [
976                         struct tm tm;
977                         tm.tm_gmtoff = 1;
978                         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
979         if test $ac_cv_struct_tm_gmtoff = yes; then
980                 AC_DEFINE(HAVE_TM_GMTOFF)
981         else
982                 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
983                         AC_TRY_COMPILE([
984                                 #include <time.h>
985                         ], [
986                                 timezone = 1;
987                         ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
988                 if test $ac_cv_var_timezone = yes; then
989                         AC_DEFINE(HAVE_TIMEZONE)
990                 else
991                         AC_ERROR(unable to find a way to determine timezone)
992                 fi
993         fi
995         dnl *********************************
996         dnl *** Checks for math functions ***
997         dnl *********************************
998         LIBS="$LIBS -lm";
999         AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
1000                 AC_TRY_LINK([#include <math.h>], 
1001                 [ finite(0.0); ], 
1002                 AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes),
1003                 AC_MSG_RESULT(no)))
1004         AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
1005                 AC_TRY_LINK([#include <math.h>], 
1006                 [ isfinite(0.0); ], 
1007                 AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
1008                 AC_MSG_RESULT(no)))
1010         dnl ****************************************************************
1011         dnl *** Checks for working poll() (macosx defines it but doesn't ***
1012         dnl *** have it in the library (duh))                            ***
1013         dnl ****************************************************************
1014         AC_CHECK_FUNCS(poll)
1016         dnl *************************
1017         dnl *** Check for signbit ***
1018         dnl *************************
1019         AC_MSG_CHECKING(for signbit)
1020         AC_TRY_LINK([#include <math.h>], [
1021                 int s = signbit(1.0);
1022         ], [
1023                 AC_MSG_RESULT(yes)
1024                 AC_DEFINE(HAVE_SIGNBIT)
1025         ], [
1026                 AC_MSG_RESULT(no)
1027         ]) 
1029         dnl *********************
1030         dnl *** Check for AIO ***
1031         dnl *********************
1032         AC_MSG_CHECKING([for SIGEV_THREAD definition])
1033         dnl Some systems (FreeBSD at least) may have aio_read
1034         dnl but don't support/define SIGEV_THREAD.
1035         AC_TRY_COMPILE([
1036         #include <sys/signal.h>
1037         ],[
1038         int x = SIGEV_THREAD;
1039         ],[
1040                 ac_cv_c_sigev_thread=yes
1041                 AC_MSG_RESULT(yes)
1042         ],[
1043                 AC_MSG_RESULT(no)
1044         ])
1046         if test "$ac_cv_c_sigev_thread" = "yes" ; then
1047                 AC_CHECK_HEADERS(aio.h sys/aio.h)
1048                 AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
1049                 SIGVAL_PTR="undefined"
1050                 if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
1051                         AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
1052                                         #include <sys/signal.h>
1053                                         ])
1054                         AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
1055                                         #include <sys/signal.h>
1056                                         ])
1057                         if test "$SIGVAL_PTR" = "undefined" ; then
1058                                 AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
1059                         fi
1060                 fi
1061                 AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
1062         fi
1064         dnl **********************************
1065         dnl *** Checks for MonoPosixHelper ***
1066         dnl **********************************
1067         AC_CHECK_FUNCS(posix_fadvise)
1068         AC_CHECK_FUNCS(posix_madvise)
1069         AC_CHECK_FUNCS(posix_fallocate)
1070         AC_CHECK_FUNCS(fgetgrent)
1071         AC_CHECK_FUNCS(fgetpwent)
1072         AC_CHECK_FUNCS(fgetpwent)
1073         AC_CHECK_HEADERS(sys/sendfile.h)
1074         AC_CHECK_FUNCS(sendfile)
1075         AC_CHECK_FUNCS(sethostid)
1076         AC_CHECK_FUNCS(stime)
1077         AC_CHECK_FUNCS(strerror_r)
1078         AC_CHECK_FUNCS(ttyname_r)
1079         AC_CHECK_SIZEOF(size_t)
1080         AC_CHECK_MEMBERS(
1081                 [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,, 
1082                 [#include <sys/types.h>
1083                  #include <dirent.h>])
1084 else
1085         jdk_headers_found=no
1086         AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
1087         AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
1088         AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
1090         dnl *********************************
1091         dnl *** Check for struct ip_mreqn ***
1092         dnl *********************************
1093         AC_MSG_CHECKING(for struct ip_mreqn)
1094         AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1095                 struct ip_mreqn mreq;
1096                 mreq.imr_address.s_addr = 0;
1097         ], [
1098                 # Yes, we have it...
1099                 AC_MSG_RESULT(yes)
1100                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
1101         ], [
1102                 # We'll just have to try and use struct ip_mreq
1103                 AC_MSG_RESULT(no)
1104                 AC_MSG_CHECKING(for struct ip_mreq)
1105                 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1106                         struct ip_mreq mreq;
1107                         mreq.imr_interface.s_addr = 0;
1108                 ], [
1109                         # Yes, we have it...
1110                         AC_MSG_RESULT(yes)
1111                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
1112                 ], [
1113                         # No multicast support
1114                         AC_MSG_RESULT(no)
1115                 ])
1116         ])
1119 dnl socklen_t check
1120 AC_MSG_CHECKING(for socklen_t)
1121 AC_TRY_COMPILE([
1122 #include <sys/types.h>
1123 #include <sys/socket.h>
1125   socklen_t foo;
1127 ac_cv_c_socklen_t=yes
1128         AC_DEFINE(HAVE_SOCKLEN_T)
1129         AC_MSG_RESULT(yes)
1131         AC_MSG_RESULT(no)
1134 AC_MSG_CHECKING(for array element initalizer support)
1135 AC_TRY_COMPILE([#include <sys/socket.h>], [
1136         const int array[] = {[1] = 2,};
1137 ], [
1138         # Yes, we have it...
1139         AC_MSG_RESULT(yes)
1140         AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1141 ], [
1142         # We'll have to use signals
1143         AC_MSG_RESULT(no)
1146 AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
1147         # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1148         AC_TRY_LINK([#include <math.h>], 
1149         [ static void *p = &trunc; ],
1150         [
1151                 AC_DEFINE(HAVE_TRUNC) 
1152                 AC_MSG_RESULT(yes)
1153                 ac_cv_trunc=yes
1154         ],
1155         AC_MSG_RESULT(no)))
1157 if test "x$ac_cv_truncl" != "xyes"; then
1158    AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL) LIBS="$LIBS -lsunmath"])
1161 dnl ****************************
1162 dnl *** Look for /dev/random ***
1163 dnl ****************************
1165 AC_MSG_CHECKING([if usage of random device is requested])
1166 AC_ARG_ENABLE(dev-random,
1167 [  --disable-dev-random    disable the use of the random device],
1168 try_dev_random=$enableval, try_dev_random=yes)
1169 AC_MSG_RESULT($try_dev_random)
1171 case "{$target}" in
1172     *-openbsd*)
1173     NAME_DEV_RANDOM="/dev/srandom"
1174     ;;
1176 dnl Win32 does not have /dev/random, they have their own method...
1178     *-*-mingw*|*-*-cygwin*)
1179     ac_cv_have_dev_random=no
1180     ;;
1182 dnl Everywhere else, it's /dev/random
1184     *)
1185     NAME_DEV_RANDOM="/dev/random"
1186     ;;
1187 esac
1189 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
1191 dnl Now check if the device actually exists
1193 if test "x$try_dev_random" = "xyes"; then
1194     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1195     [if test -r "$NAME_DEV_RANDOM" ; then
1196         ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1197     if test "x$ac_cv_have_dev_random" = "xyes"; then
1198         AC_DEFINE(HAVE_CRYPT_RNG)
1199     fi
1200 else
1201     AC_MSG_CHECKING(for random device)
1202     ac_cv_have_dev_random=no
1203     AC_MSG_RESULT(has been disabled)
1206 if test "x$platform_win32" = "xyes"; then
1207     AC_DEFINE(HAVE_CRYPT_RNG)
1210 if test "x$ac_cv_have_dev_random" = "xno" \
1211     && test "x$platform_win32" = "xno"; then
1212     AC_MSG_WARN([[
1214 *** A system-provided entropy source was not found on this system.
1215 *** Because of this, the System.Security.Cryptography random number generator
1216 *** will throw a NotImplemented exception.
1218 *** If you are seeing this message, and you know your system DOES have an
1219 *** entropy collection in place, please contact <crichton@gimp.org> and
1220 *** provide information about the system and how to access the random device.
1222 *** Otherwise you can install either egd or prngd and set the environment
1223 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1224 ***]])
1227 AC_MSG_CHECKING([if inter-process shared handles are requested])
1228 AC_ARG_ENABLE(shared-handles, [  --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
1229 AC_MSG_RESULT($try_shared_handles)
1230 if test "x$try_shared_handles" != "xyes"; then
1231         AC_DEFINE(DISABLE_SHARED_HANDLES)
1232         AC_SUBST(DISABLE_SHARED_HANDLES)
1236 # ICU 
1238 ICU_CFLAGS=""
1239 ICU_LIBS=""
1240 enable_icu="no;  default"
1242 probe_icu=false
1243 AC_ARG_WITH(icu, [  --with-icu=yes/no],
1244         if test x$with_icu = xno; then
1245            probe_icu=false;
1246            AC_MSG_RESULT(Will not probe for ICU)
1247         fi
1248         if test x$with_icu = xyes; then
1249            probe_icu=true;
1250         fi
1253 if $probe_icu; then
1254         AC_PATH_PROG(ICU_CONFIG, icu-config, no)
1255         if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
1256                 AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
1257                 enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
1258         else
1259                 enable_icu="yes. Version: `$ICU_CONFIG --version`"
1260                 AC_DEFINE(HAVE_ICU)
1261                 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
1262                 ICU_LIBS=`$ICU_CONFIG --ldflags`
1263         fi
1265 AC_SUBST(ICU_CFLAGS)
1266 AC_SUBST(ICU_LIBS)
1268 AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests       Run the nunit tests of the class library on 'make check'])
1269 AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
1271 TARGET="unknown"
1272 ACCESS_UNALIGNED="yes"
1274 JIT_SUPPORTED=no
1275 LIBC="libc.so.6"
1276 INTL="libc.so.6"
1278 jit_wanted=false
1279 case "$host" in
1280 #       mips-sgi-irix5.* | mips-sgi-irix6.*)
1281 #               TARGET=MIPS;
1282 #               ACCESS_UNALIGNED="no"
1283 #               ;;
1284         i*86-*-*)
1285                 TARGET=X86;
1286                 arch_target=x86;
1287                 JIT_SUPPORTED=yes
1288                 jit_wanted=true
1289                 ;;
1290         x86_64-*-* | amd64-*-*)
1291                 TARGET=AMD64;
1292                 arch_target=amd64;
1293                 JIT_SUPPORTED=yes
1294                 jit_wanted=true
1295                 ;;
1296         sparc*-*-*)
1297                 if test "x$ac_cv_sizeof_void_p" = "x8"; then
1298                    TARGET=SPARC64
1299                 else
1300                         TARGET=SPARC
1301                 fi
1302                 arch_target=sparc;
1303                 JIT_SUPPORTED=yes
1304                 ACCESS_UNALIGNED="no"
1305                 LIBC="libc.so"
1306                 INTL="libintl.so"
1307                 jit_wanted=true
1308                 if test x"$GCC" = xyes; then
1309                         CFLAGS="$CFLAGS -Wno-cast-align"
1310                 fi
1311                 ;;
1312        alpha*-*-linux* | alpha*-*-osf*)
1313                 TARGET=ALPHA;
1314                 ACCESS_UNALIGNED="no"
1315                 JIT_SUPPORTED=no
1316                 arch_target=alpha;
1317                ;;
1318 #       ia64-*-linux* | ia64-*-hpux*)
1319 #               TARGET=IA64;
1320 #               arch_target=ia64;
1321 #               JIT_SUPPORTED=no;
1322 #               ACCESS_UNALIGNED="no";
1323 #               case "$host_os" in
1324 #                       linux*) LIBC="libc.so.6.1";;
1325 #                       hpux*)  LIBC="libc.so.1";;
1326 #               esac
1327 #               ;;
1328 #       m68k-*-linux*)
1329 #               TARGET=M68K
1330 #               ;;
1331         hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
1332                 TARGET=HPPA;
1333                 arch_target=hppa; 
1334                 LIBC="libc.sl"
1335                 ACCESS_UNALIGNED="no"
1336                 ;;
1337         hppa*linux*)
1338                 TARGET=HPPA;
1339                 arch_target=hppa; 
1340                 ACCESS_UNALIGNED="no"
1341                 ;;
1342         macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
1343         powerpc-*-sysv* | powerpc-*-darwin*)
1344                 TARGET=POWERPC;
1345                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1346                 arch_target=ppc;
1347                 JIT_SUPPORTED=yes
1348                 jit_wanted=true
1349                 ;;
1350         arm-*-linux-* | armv4l-*-linux-*)
1351                 TARGET=ARM;
1352                 arch_target=arm;
1353                 ACCESS_UNALIGNED="no"
1354                 ;;
1355         s390-*-linux*)
1356                 TARGET=S390;
1357                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1358                 arch_target=s390;
1359                 ACCESS_UNALIGNED="no"
1360                 JIT_SUPPORTED=yes
1361                 ;;
1362         s390x-*-linux*)
1363                 TARGET=S390x;
1364                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1365                 arch_target=s390x;
1366                 ACCESS_UNALIGNED="no"
1367                 JIT_SUPPORTED=yes
1368                 ;;
1369 esac
1371 AC_ARG_WITH(jit, [  --with-jit=yes,no       If you want to build scripts that default to the JIT],[
1372         if test x$withval = xyes; then
1373            jit_wanted=true
1374         else
1375            jit_wanted=false
1376         fi
1379 USEJIT=false
1380 if test x$JIT_SUPPORTED = xyes; then
1381    if $jit_wanted; then
1382       USEJIT=true
1383       jit_status="Building and using the JIT"
1384    else
1385       jit_status="Building the JIT, defaulting to the interpreter"
1386    fi
1387 else
1388    jit_status="interpreter"
1391 AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
1393 libsuffix=".so"
1395 case "$host" in
1396      powerpc-*-darwin*)
1397         libsuffix=".dylib"
1398         LIBC="libc.dylib"
1399         INTL="libintl.dylib"
1400         ;;
1401      *-*-*netbsd*)
1402         LIBC="libc.so.12"
1403         INTL="libintl.so.0"
1404         ;;
1405     *-*-*freebsd*)
1406         LIBC="libc.so"
1407         INTL="libintl.so"
1408         ;;
1409     *-*-*openbsd*)
1410         LIBC="libc.so"
1411         INTL="libintl.so"
1412         ;;
1413 esac
1414 AC_SUBST(libsuffix)
1416 if test "x$TARGET" != "xAMD64"; then
1417    # valgrind headers don't compile under x86-64
1418    AC_CHECK_HEADERS(valgrind/memcheck.h)
1421 if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
1422         if test "x$with_tls" = "x__thread"; then
1423                 #
1424                 # On some linux distributions, TLS works in executables, but linking 
1425                 # against a shared library containing TLS fails with:
1426                 # undefined reference to `__tls_get_addr'
1427                 #
1428                 rm -f conftest.c conftest.so conftest
1429                 echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
1430                 gcc -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
1431                 gcc -o conftest conftest.so > /dev/null 2>&1
1432                 if test ! -f conftest; then
1433                    AC_MSG_WARN([Disabling usage of __thread.]);
1434                    with_tls=pthread
1435                 fi
1436                 rm -f conftest.c conftest.so conftest
1437         fi
1440 if test "x$with_tls" = "x__thread"; then
1441         AC_DEFINE(HAVE_KW_THREAD)
1442    # Pass the information to libgc
1443         CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
1444         export CPPFLAGS
1447 if test ${TARGET} = ARM; then
1448         dnl ******************************************
1449         dnl *** Check to see what FPU is available ***
1450         dnl ******************************************
1451         AC_MSG_CHECKING(which FPU to use)
1453         AC_TRY_COMPILE([], [
1454                 __asm__ ("ldfd f0, [r0]");
1455                 ], fpu=FPA, [
1456                         AC_TRY_COMPILE([], [
1457                                 __asm__ ("fldd d0, [r0]");
1458                         ], fpu=VFP, fpu=NONE)
1459                 ])
1461         AC_MSG_RESULT($fpu)
1462         CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
1463         unset fpu
1466 if test ${TARGET} = unknown; then
1467         CPPFLAGS="$CPPFLAGS -DNO_PORT"
1468         AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
1471 if test ${ACCESS_UNALIGNED} = no; then
1472         CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
1475 PREVIEW=no
1476 AC_ARG_WITH(preview, [ --with-preview=yes,no     If you want to install the 2.0 FX preview],[
1477         if test x$with_preview = xyes; then
1478               PREVIEW=yes
1479         fi
1482 AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
1484 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1485 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1486 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1487 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
1488 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1489 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
1490 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
1491 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
1492 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
1493 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
1494 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1495 AM_CONDITIONAL(S390, test x$TARGET = xS390)
1496 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
1497 AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
1499 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
1500 AM_CONDITIONAL(INCLUDED_LIBGC, test x$gc = xincluded)
1502 AC_SUBST(LIBC)
1503 AC_SUBST(INTL)
1505 AC_SUBST(arch_target)
1506 AC_SUBST(CFLAGS)
1507 AC_SUBST(CPPFLAGS)
1508 AC_SUBST(LDFLAGS)
1510 mono_build_root=`pwd`
1511 AC_SUBST(mono_build_root)
1513 if test x$USEJIT = xtrue; then
1514   mono_runtime=mono/mini/mono
1515 else
1516   mono_runtime=mono/interpreter/mint
1518 AC_SUBST(mono_runtime)
1520 mono_cfg_root=$mono_build_root/runtime
1521 if test x$platform_win32 = xyes; then
1522   mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
1523 else
1524   mono_cfg_dir=$mono_cfg_root/etc
1526 AC_SUBST(mono_cfg_dir)
1528 AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
1530 AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
1531 [   depth=../../../..
1532     case $srcdir in
1533     [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1534     .) reldir=$depth ;;
1535     *) reldir=$depth/$srcdir ;;
1536     esac
1537     $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
1538     cd runtime/etc/mono/1.0
1539     rm -f machine.config
1540     $LN_S $reldir/data/net_1_1/machine.config machine.config
1541     cd $depth
1542 ],[LN_S='$LN_S'])
1544 AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
1545 [   depth=../../../..
1546     case $srcdir in
1547     [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1548     .) reldir=$depth ;;
1549     *) reldir=$depth/$srcdir ;;
1550     esac
1551     $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
1552     cd runtime/etc/mono/2.0
1553     rm -f machine.config
1554     $LN_S $reldir/data/net_2_0/machine.config machine.config
1555     cd $depth
1556 ],[LN_S='$LN_S'])
1558 AC_OUTPUT([
1559 Makefile
1560 mint.pc
1561 mono.pc
1562 mono/Makefile
1563 mono/utils/Makefile
1564 mono/metadata/Makefile
1565 mono/dis/Makefile
1566 mono/cil/Makefile
1567 mono/arch/Makefile
1568 mono/os/Makefile
1569 mono/os/win32/Makefile
1570 mono/os/unix/Makefile
1571 mono/arch/x86/Makefile
1572 mono/arch/amd64/Makefile
1573 mono/arch/hppa/Makefile
1574 mono/arch/ppc/Makefile
1575 mono/arch/sparc/Makefile
1576 mono/arch/s390/Makefile
1577 mono/arch/s390x/Makefile
1578 mono/arch/arm/Makefile
1579 mono/arch/alpha/Makefile
1580 mono/interpreter/Makefile
1581 mono/tests/Makefile
1582 mono/tests/tests-config
1583 mono/benchmark/Makefile
1584 mono/monoburg/Makefile
1585 mono/monograph/Makefile
1586 mono/io-layer/Makefile
1587 mono/handles/Makefile
1588 mono/mini/Makefile
1589 mono/profiler/Makefile
1590 ikvm-jni/Makefile
1591 scripts/Makefile
1592 man/Makefile
1593 web/Makefile
1594 docs/Makefile
1595 data/Makefile
1596 data/net_1_1/Makefile
1597 data/net_2_0/Makefile
1598 samples/Makefile
1599 support/Makefile
1600 data/config
1601 mono.spec
1602 tools/Makefile
1603 tools/locale-builder/Makefile
1604 runtime/Makefile
1607 echo "
1608         mcs source:  $mcs_topdir
1609         GC:          $gc
1610         ICU:         $enable_icu
1611         TLS:         $with_tls
1612         SIGALTSTACK: $with_sigaltstack
1613         Engine:      $jit_status
1614         2.0 Alpha:   $PREVIEW
1615         JNI support: $jdk_headers_found
1616         Disabled:    $enable_minimal