Support the MEMCPY(base, base) rule and add initial ARGLIST support
[mono.git] / configure.in
blobd8f1da10450689e9c2848a25e2619d63b665184e
1 AC_INIT(README)
2 AC_CANONICAL_SYSTEM
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,1.1.1)
5 AM_MAINTAINER_MODE
7 AC_PROG_LN_S
9 dnl
10 dnl libgc checks
11 dnl
13 gc_headers=no
14 gc=included
15 use_included_gc=no
17 if test -d $srcdir/libgc ; then
18   gc_default=included
19 else
20   gc_default=boehm
24 # These are the flags that need to be stored in the mono.pc file for 
25 # compiling code that will embed Mono
27 libmono_cflags=""
28 libmono_ldflags=""
29 AC_SUBST(libmono_cflags)
30 AC_SUBST(libmono_ldflags)
32 dnl if linker handles the version script
33 no_version_script=no
35 # Set to yes if Unix sockets cannot be created in an anonymous namespace
36 need_link_unlink=no
38 # Thread configuration inspired by sleepycat's db
39 AC_MSG_CHECKING([host platform characteristics])
40 libgc_threads=no
41 case "$host" in
42         *-*-mingw*|*-*-cygwin*)
43                 platform_win32=yes
44                 AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
45                 CC="gcc -mno-cygwin"
46                 HOST_CC="gcc"
47                 # So libgc configure gets -mno-cygwin
48                 export CC
49 # latest libgc already defines GC_WIN32_THREADS
50 #               CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
51                 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
52                 libdl=
53                 libgc_threads=win32
54                 gc_default=boehm 
55                 with_nptl=no
56                 with_sigaltstack=no
57                 LN_S=cp
59                 ;;
60         *-*-*netbsd*)
61                 platform_win32=no
62                 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
63                 libmono_cflags="-D_REENTRANT"
64                 LDFLAGS="$LDFLAGS -pthread"
65                 libmono_ldflags="-pthread"
66                 need_link_unlink=yes
67                 libdl=
68                 libgc_threads=no
69                 ;;
70 # these flags will work for all versions of -STABLE
72         *-*-*freebsd4*)
73                 platform_win32=no
74                 if test "x$PTHREAD_CFLAGS" = "x"; then
75                         CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
76                         libmono_cflags="-D_THREAD_SAFE"
77                 else
78                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
79                         libmono_cflags="$PTHREAD_CFLAGS"
80                 fi
81                 if test "x$PTHREAD_LIBS" = "x"; then
82                         LDFLAGS="$LDFLAGS -pthread"
83                         libmono_ldflags="-pthread"
84                 else
85                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
86                         libmono_ldflags="$PTHREAD_LIBS"
87                 fi
88                 need_link_unlink=yes
89                 AC_DEFINE(PTHREAD_POINTER_ID)
90                 libdl=
91                 libgc_threads=pthreads
92 # TLS isn't implemented at all on -STABLE
93                 with_nptl=no
94                 with_tls=pthread
95                 ;;
96 # older versions of -CURRENT will break with these flags but testing
97 # indicates these older versions won't run Mono anyway
99         *-*-*freebsd5*)
100                 platform_win32=no
101                 if test "x$PTHREAD_CFLAGS" = "x"; then
102                         CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
103                         libmono_cflags=
104                 else
105                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
106                         libmono_cflags="$PTHREAD_CFLAGS"
107                 fi
108                 if test "x$PTHREAD_LIBS" = "x"; then
109                         LDFLAGS="$LDFLAGS -lpthread"
110                         libmono_ldflags="-lpthread"
111                 else
112                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
113                         libmono_ldflags="$PTHREAD_LIBS"
114                 fi
115                 need_link_unlink=yes
116                 AC_DEFINE(PTHREAD_POINTER_ID)
117                 libdl=
118                 libgc_threads=pthreads
119 # TLS is only partially implemented on -CURRENT (compiler support
120 # but NOT library support)
122                 with_nptl=no
123                 with_tls=pthread
124                 ;;
125         *-*-*openbsd*)
126                 platform_win32=no
127                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
128                 libmono_cflags="-D_THREAD_SAFE"
129                 LDFLAGS="$LDFLAGS -pthread"
130                 libmono_ldflags="-pthread"
131                 need_link_unlink=yes
132                 AC_DEFINE(PTHREAD_POINTER_ID)
133                 libdl=
134                 libgc_threads=pthreads
135                 ;;
136         *-*-linux*)
137                 platform_win32=no
138                 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
139                 libmono_cflags="-D_REENTRANT"
140                 libmono_ldflags="-lpthread"
141                 libdl="-ldl"
142                 libgc_threads=pthreads
143                 ;;
144         *-*-hpux*)
145                 platform_win32=no
146                 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
147                 CFLAGS="$CFLAGS +ESdbgasm"
148                 LDFLAGS="$LDFLAGS -z"
149                 libmono_cflags="-D_REENTRANT"
150                 libmono_ldflags="-lpthread"
151                 libgc_threads=pthreads
152                 need_link_unlink=yes
153                 ;;
154         *-*-solaris*)
155                 platform_win32=no
156                 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
157                 need_link_unlink=yes
158                 libmono_cflags="-D_REENTRANT"
159                 libgc_threads=pthreads
160                 ;;
161         *-*-darwin*)
162                 platform_win32=no
163                 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
164                 libmono_cflags="-D_THREAD_SAFE"
165                 LDFLAGS="$LDFLAGS -pthread"
166                 libmono_ldflags="-pthread"
167                 need_link_unlink=yes
168                 AC_DEFINE(PTHREAD_POINTER_ID)
169                 AC_DEFINE(USE_MACH_SEMA)
170                 no_version_script=yes
171                 libdl=
172                 libgc_threads=pthreads
173                 ;;
174         *)
175                 AC_MSG_WARN([*** Please add $host to configure.in checks!])
176                 platform_win32=no
177                 libdl="-ldl"
178                 ;;
179 esac
180 AC_MSG_RESULT(ok)
182 if test x$need_link_unlink = xyes; then
183    AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
186 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
188 AC_CHECK_TOOL(CC, gcc, gcc)
189 AC_PROG_CC
190 AM_PROG_CC_STDC
191 AC_PROG_INSTALL
192 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
193 : ${CCAS='$(CC)'}
194 # Set ASFLAGS if not already set.
195 : ${CCASFLAGS='$(CFLAGS)'}
196 AC_SUBST(CCAS)
197 AC_SUBST(CCASFLAGS)
199 AC_CHECK_PROG(BISON, bison,yes,no)
200 if test "x$BISON" = "xno";
201 then
202         AC_MSG_ERROR([You need to install bison])
205 dnl may require a specific autoconf version
206 dnl AC_PROG_CC_FOR_BUILD
207 dnl CC_FOR_BUILD not automatically detected
208 CC_FOR_BUILD=$CC
209 BUILD_EXEEXT=
210 if test "x$cross_compiling" = "xyes"; then
211         CC_FOR_BUILD=cc
212         BUILD_EXEEXT=""
214 AC_SUBST(CC_FOR_BUILD)
215 AC_SUBST(HOST_CC)
216 AC_SUBST(BUILD_EXEEXT)
218 # Set STDC_HEADERS
219 AC_HEADER_STDC
220 AC_LIBTOOL_WIN32_DLL
221 AM_PROG_LIBTOOL
223 # Test whenever ld supports -version-script
224 AC_PROG_LD
225 AC_PROG_LD_GNU
226 if test "x$lt_cv_prog_gnu_ld" = "xno"; then
227    no_version_script=yes
230 AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
232 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
234 # for mono/metadata/debug-symfile.c
235 AC_CHECK_HEADERS(elf.h)
237 # for mono/dis
238 AC_CHECK_HEADERS(wchar.h)
240 # not 64 bit clean in cross-compile
241 AC_CHECK_SIZEOF(void *, 4)
243 WARN=''
244 if test x"$GCC" = xyes; then
245         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
246                 # The runtime code does not respect ANSI C strict aliasing rules
247                 CFLAGS="$CFLAGS -fno-strict-aliasing"
248 else
249         # The Sun Forte compiler complains about inline functions that access static variables
250         # so disable all inlining.
251         case "$host" in
252         *-*-solaris*)
253                 CFLAGS="$CFLAGS -Dinline="
254                 ;;
255         esac
257 CFLAGS="$CFLAGS -g $WARN"
259 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
260 if test "x$PKG_CONFIG" = "xno"; then
261         AC_MSG_ERROR([You need to install pkg-config])
264 dnl for use on the build system
265 dnl pkg-config is stupid
266 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
267 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
268 AC_SUBST(BUILD_GLIB_CFLAGS)
269 AC_SUBST(BUILD_GLIB_LIBS)
271 PKG_PATH=
272 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir],
273         if test x$with_crosspkgdir = "x"; then
274                 if test -s $PKG_CONFIG_PATH; then
275                         PKG_PATH=$PKG_CONFIG_PATH
276                 fi
277         else
278                 PKG_PATH=$with_crosspkgdir
279                 PKG_CONFIG_PATH=$PKG_PATH
280                 export PKG_CONFIG_PATH
281         fi
284 ## Versions of dependencies
285 GLIB_REQUIRED_VERSION=1.3.11
287 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
289 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
290 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
291 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
292 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
294 AC_SUBST(GLIB_CFLAGS)
295 AC_SUBST(GLIB_LIBS)
296 AC_SUBST(GMODULE_CFLAGS)
297 AC_SUBST(GMODULE_LIBS)
299 AC_ARG_WITH(gc, [  --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
301 # Enable support for fast thread-local storage
302 # Some systems have broken support, so we allow to disable it.
303 AC_ARG_WITH(tls, [  --with-tls=__thread,pthread       select Thread Local Storage implementation],[],[with_tls=__thread])
305 # Kept for compatibility
306 AC_ARG_WITH(nptl, [  --with-nptl=yes,no      deprecated, use --with-tls instead],[],[with_nptl=default])
308 if test "x$with_nptl" != "xdefault"; then
309    if test "x$with_nptl" = "xyes"; then
310       AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.])
311           with_tls=__thread
312    fi
313    if test "x$with_nptl" = "xno"; then
314       AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.])
315           with_tls=pthread
316    fi
319 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
320 # This does not work on some platforms (bug #55253)
321 AC_ARG_WITH(sigaltstack, [  --with-sigaltstack=yes,no      enable/disable support for sigaltstack],[],[with_sigaltstack=no])
323 # assembly bundle support, see metadata/make-bundle.pl for more info
324 AC_ARG_WITH(bundle, [  --with-bundle=bundle_template],[
325         BUNDLE_FILE=$with_bundle
326         AC_SUBST(BUNDLE_FILE)
327         AC_DEFINE(WITH_BUNDLE)
328 ],[with_bundle=no])
329 AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
331 LIBGC_CFLAGS=
332 LIBGC_LIBS=
333 libgc_dir=
334 case "x$gc" in
335         xboehm|xbohem|xyes)
336                 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
337                 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
339                 if test "x$found_boehm" != "xyes"; then
340                         AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
341                 fi
342                 if test "x$gc_headers" != "xyes"; then
343                         AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
344                 fi
346                 AC_DEFINE(HAVE_BOEHM_GC)
347                 AC_SUBST(HAVE_BOEHM_GC)
348                 LIBGC_LIBS="-lgc $libdl"
350                 # AC_CHECK_FUNCS does not work for some reason...
351                 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
352                 if test "x$found_gcj_malloc" = "xyes"; then
353                         AC_DEFINE(HAVE_GC_GCJ_MALLOC)
354                 fi
355                 AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
356                 if test "x$found_gc_enable" = "xyes"; then
357                         AC_DEFINE(HAVE_GC_ENABLE)
358                 fi
359                 ;;
361         xincluded)
362                 AC_CONFIG_SUBDIRS(libgc)
364                 found_boehm=yes
365                 gc_headers=yes
366                 use_included_gc=yes
367                 libgc_dir=libgc
369                 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
370                 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
372                 AC_DEFINE(HAVE_BOEHM_GC)
373                 AC_SUBST(HAVE_BOEHM_GC)
375                 AC_DEFINE(HAVE_GC_H)
376                 AC_DEFINE(USE_INCLUDED_LIBGC)
378                 # The included libgc contains GCJ support
379                 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
380                 AC_DEFINE(HAVE_GC_ENABLE)
381                 ;;
383         xnone)
384                 AC_MSG_WARN("Compiling mono without GC.")
385                 ;;
386         *)
387                 AC_MSG_ERROR([Invalid argument to --with-gc.])
388                 ;;
389 esac
392 # tell libgc/configure about what we want
393 ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads"
395 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
396 AC_SUBST(LIBGC_CFLAGS)
397 AC_SUBST(LIBGC_LIBS)
398 AC_SUBST(libgc_dir)
401 dnl End of libgc checks
404 if test x$platform_win32 = xno; then
406         dnl ******************************************************************
407         dnl *** Checks for the IKVM JNI interface library                  ***
408         dnl ******************************************************************
409         AC_ARG_WITH(ikvm-jni, [  --with-ikvm-jni=yes,no  build the IKVM JNI interface library],[with_ikvm_jni=$withval],[with_ikvm_jni=yes])
410         AC_ARG_WITH(jdk, [  --with-jdk=DIRECTORY    Use JDK from DIRECTORY],[with_jdk_dir=$withval],[with_jdk_dir=])
412         ikvm_jni_dir=
413         if test x$with_ikvm_jni = xyes; then
414                 AC_MSG_CHECKING([JDK headers])
416                 if test x$with_jdk_dir = x; then
417                         # Try JAVA_HOME variable
418                         if test x$JAVA_HOME != x; then
419                                 with_jdk_dir=$JAVA_HOME
420                         fi
421                 fi
422         
423                 jdk_platform=
424                 if test -d $with_jdk_dir/include; then
425                         jdk_headers_found=yes
427                         if test -d $with_jdk_dir/include/linux; then
428                                 jdk_platform=linux
429                         else
430                         if test -d $with_jdk_dir/include/solaris; then
431                                 jdk_platform=solaris
432                         else
433                         if test -f $with_jdk_dir/include/jni_md.h; then
434                                 # GNU Classpath sources
435                                 jdk_platform=
436                         else
437                                 jdk_headers_found=no
438                         fi
439                         fi
440                         fi
441                 else
442                         jdk_headers_found=no
443                 fi
445                 if test x$jdk_headers_found = xyes; then
446                         AC_MSG_RESULT($with_jdk_dir/include $with_jdk_dir/include/$jdk_platform)
447                 else
448                         AC_MSG_RESULT(not found)
449                 fi
451                 if test x$jdk_headers_found = xyes; then
452                         ikvm_jni_dir=ikvm-jni
453                         IKVM_JNI_CFLAGS="-I$with_jdk_dir/include -I$with_jdk_dir/include/$jdk_platform"
454                 fi
455         fi
457         AC_SUBST(ikvm_jni_dir)
458         AC_SUBST(IKVM_JNI_CFLAGS)
460         AC_CHECK_FUNCS(getgrgid_r)
461         AC_CHECK_FUNCS(getgrnam_r)
462         AC_CHECK_FUNCS(getpwnam_r)
463         AC_CHECK_FUNCS(getpwuid_r)
464         AC_CHECK_FUNCS(getresuid)
465         AC_CHECK_FUNCS(setresuid)
467         dnl ******************************************************************
468         dnl *** Check for large file support                               ***
469         dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
470         dnl ******************************************************************
471         
472         # Check that off_t can represent 2**63 - 1 correctly, working around
473         # potential compiler bugs.  Defines LARGE_FILE_SUPPORT, adds $1 to
474         # CPPFLAGS and sets $large_offt to yes if the test succeeds
475         large_offt=no
476         AC_DEFUN(LARGE_FILES, [
477                 large_CPPFLAGS=$CPPFLAGS
478                 CPPFLAGS="$CPPFLAGS $1"
479                 AC_TRY_RUN([
480                         #include <sys/types.h>
482                         #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
484                         int main(void) {
485                                 int big_off_t=((BIG_OFF_T%2147483629==721) &&
486                                                (BIG_OFF_T%2147483647==1));
487                                 if(big_off_t) {
488                                         exit(0);
489                                 } else {
490                                         exit(1);
491                                 }
492                         }
493                 ], [
494                         AC_MSG_RESULT(ok)
495                         AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
496                         large_CPPFLAGS="$large_CPPFLAGS $1"
497                         large_offt=yes
498                 ], [
499                         AC_MSG_RESULT(no)
500                 ], "")
501                 CPPFLAGS=$large_CPPFLAGS
502         ])
504         AC_MSG_CHECKING(if off_t is 64 bits wide)
505         LARGE_FILES("")
506         if test $large_offt = no; then
507                 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
508                 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
509         fi
510         if test $large_offt = no; then
511                 AC_MSG_WARN([No 64 bit file size support available])
512         fi
513         
514         dnl *****************************
515         dnl *** Checks for libsocket  ***
516         dnl *****************************
517         AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
519         dnl *******************************
520         dnl *** Checks for MSG_NOSIGNAL ***
521         dnl *******************************
522         AC_MSG_CHECKING(for MSG_NOSIGNAL)
523         AC_TRY_COMPILE([#include <sys/socket.h>], [
524                 int f = MSG_NOSIGNAL;
525         ], [
526                 # Yes, we have it...
527                 AC_MSG_RESULT(yes)
528                 AC_DEFINE(HAVE_MSG_NOSIGNAL)
529         ], [
530                 # We'll have to use signals
531                 AC_MSG_RESULT(no)
532         ])
534         dnl *****************************
535         dnl *** Checks for SOL_IP     ***
536         dnl *****************************
537         AC_MSG_CHECKING(for SOL_IP)
538         AC_TRY_COMPILE([#include <netdb.h>], [
539                 int level = SOL_IP;
540         ], [
541                 # Yes, we have it...
542                 AC_MSG_RESULT(yes)
543                 AC_DEFINE(HAVE_SOL_IP)
544         ], [
545                 # We'll have to use getprotobyname
546                 AC_MSG_RESULT(no)
547         ])
549         dnl *****************************
550         dnl *** Checks for SOL_IPV6     ***
551         dnl *****************************
552         AC_MSG_CHECKING(for SOL_IPV6)
553         AC_TRY_COMPILE([#include <netdb.h>], [
554                 int level = SOL_IPV6;
555         ], [
556                 # Yes, we have it...
557                 AC_MSG_RESULT(yes)
558                 AC_DEFINE(HAVE_SOL_IPV6)
559         ], [
560                 # We'll have to use getprotobyname
561                 AC_MSG_RESULT(no)
562         ])
564         dnl *****************************
565         dnl *** Checks for SOL_TCP    ***
566         dnl *****************************
567         AC_MSG_CHECKING(for SOL_TCP)
568         AC_TRY_COMPILE([#include <netdb.h>], [
569                 int level = SOL_TCP;
570         ], [
571                 # Yes, we have it...
572                 AC_MSG_RESULT(yes)
573                 AC_DEFINE(HAVE_SOL_TCP)
574         ], [
575                 # We'll have to use getprotobyname
576                 AC_MSG_RESULT(no)
577         ])
579         dnl *****************************
580         dnl *** Checks for IP_PKTINFO ***
581         dnl *****************************
582         AC_MSG_CHECKING(for IP_PKTINFO)
583         AC_TRY_COMPILE([#include <netdb.h>], [
584                 int level = IP_PKTINFO;
585         ], [
586                 # Yes, we have it...
587                 AC_MSG_RESULT(yes)
588                 AC_DEFINE(HAVE_IP_PKTINFO)
589         ], [
590                 AC_MSG_RESULT(no)
591         ])
593         dnl *********************************
594         dnl *** Check for struct ip_mreqn ***
595         dnl *********************************
596         AC_MSG_CHECKING(for struct ip_mreqn)
597         AC_TRY_COMPILE([#include <netinet/in.h>], [
598                 struct ip_mreqn mreq;
599                 mreq.imr_address.s_addr = 0;
600         ], [
601                 # Yes, we have it...
602                 AC_MSG_RESULT(yes)
603                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
604         ], [
605                 # We'll just have to try and use struct ip_mreq
606                 AC_MSG_RESULT(no)
607                 AC_MSG_CHECKING(for struct ip_mreq)
608                 AC_TRY_COMPILE([#include <netinet/in.h>], [
609                         struct ip_mreq mreq;
610                         mreq.imr_interface.s_addr = 0;
611                 ], [
612                         # Yes, we have it...
613                         AC_MSG_RESULT(yes)
614                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
615                 ], [
616                         # No multicast support
617                         AC_MSG_RESULT(no)
618                 ])
619         ])
620         
621         dnl **********************************
622         dnl *** Check for gethostbyname2_r ***
623         dnl **********************************
624         AC_MSG_CHECKING(for gethostbyname2_r)
625                 AC_TRY_LINK([#include <netdb.h>], [
626                 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
627         ], [
628                 # Yes, we have it...
629                 AC_MSG_RESULT(yes)
630                 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
631         ], [
632                 AC_MSG_RESULT(no)
633         ])
635         dnl *****************************
636         dnl *** Checks for libnsl     ***
637         dnl *****************************
638         AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
640         AC_CHECK_FUNCS(inet_pton inet_aton)
642         dnl ***********************************************
643         dnl *** Checks for size of sockaddr_un.sun_path ***
644         dnl ***********************************************
645         # AC_CHECK_SIZEOF can't cope with struct members :-(
646         AC_MSG_CHECKING(size of sockaddr_un.sun_path)
647         AC_CACHE_VAL(cv_mono_sizeof_sunpath,
648                 [AC_TRY_RUN([
649                         #include <sys/types.h>
650                         #include <stdio.h>
651                         #include <sys/un.h>
653                         int main(void) {
654                                 struct sockaddr_un sock_un;
655                                 FILE *f=fopen("conftestval", "w");
656                                 if(!f) exit(1);
657                                 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
658                                 exit(0);
659                         }
660                 ], cv_mono_sizeof_sunpath=`cat conftestval`,
661                    cv_mono_sizeof_sunpath=0,
662                    cv_mono_sizeof_sunpath=0)])dnl
663         AC_MSG_RESULT($cv_mono_sizeof_sunpath)
664         AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
666         dnl *************************************
667         dnl *** Checks for zero length arrays ***
668         dnl *************************************
669         AC_MSG_CHECKING(whether $CC supports zero length arrays)
670         AC_TRY_COMPILE([
671                 struct s {
672                         int  length;
673                         char data [0];
674                 };
675         ], [], [
676                 AC_MSG_RESULT(yes)
677                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
678         ], [
679                 AC_MSG_RESULT(no)
680                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
681         ])
683         dnl *****************************
684         dnl *** Checks for libxnet    ***
685         dnl *****************************
686         case "${host}" in
687                 *solaris* )
688                         AC_MSG_CHECKING(for Solaris XPG4 support)
689                         if test -f /usr/lib/libxnet.so; then
690                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
691                                 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
692                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
693                                 LIBS="$LIBS -lxnet"
694                                 AC_MSG_RESULT(yes)
695                         else
696                                 AC_MSG_RESULT(no)
697                         fi
699                         if test "$GCC" = "yes"; then
700                                 CFLAGS="$CFLAGS -Wno-char-subscripts"
701                         fi
702                 ;;
703         esac
705         dnl *****************************
706         dnl *** Checks for libpthread ***
707         dnl *****************************
708 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
709 # and libpthread does not exist
711         case "${host}" in
712                 *-*-*freebsd4*)
713                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
714                 ;;
715                 *)
716                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
717                 ;;
718         esac
719         AC_CHECK_HEADERS(pthread.h)
720         AC_CHECK_FUNCS(pthread_mutex_timedlock)
721         AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
722         AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
723         AC_TRY_COMPILE([ #include <pthread.h>], [
724                 pthread_mutexattr_t attr;
725                 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
726         ], [
727                 AC_MSG_RESULT(ok)
728         ], [
729                 AC_MSG_RESULT(no)
730                 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
731                 AC_DEFINE(USE_MONO_MUTEX)
732         ])
733         AC_CHECK_FUNCS(pthread_attr_setstacksize)
735         dnl ***********************************
736         dnl *** Checks for working __thread ***
737         dnl ***********************************
738         AC_MSG_CHECKING(for working __thread)
739         if test "x$with_tls" != "x__thread"; then
740                 AC_MSG_RESULT(disabled)
741         else
742                 AC_TRY_RUN([
743                         #include <pthread.h>
745                         __thread int i;
746                         static int res1, res2;
748                         void thread_main (void *arg)
749                         {
750                                 i = arg;
751                                 sleep (1);
752                                 if (arg == 1)
753                                         res1 = (i == arg);
754                                 else
755                                         res2 = (i == arg);
756                         }
758                         int main () {
759                                 pthread_t t1, t2;
761                                 i = 5;
763                                 pthread_create (&t1, NULL, thread_main, 1);
764                                 pthread_create (&t2, NULL, thread_main, 2);
766                                 pthread_join (t1, NULL);
767                                 pthread_join (t2, NULL);
769                                 return !(res1 + res2 == 2);
770                         }
771                 ], [
772                                 AC_MSG_RESULT(yes)
773                                 AC_DEFINE(HAVE_KW_THREAD)
774                 ], [
775                                 AC_MSG_RESULT(no)
776                 ])
777         fi
779         dnl **************************************
780         dnl *** Checks for working sigaltstack ***
781         dnl **************************************
782         AC_MSG_CHECKING(for working sigaltstack)
783         if test "x$with_sigaltstack" != "xyes"; then
784                 AC_MSG_RESULT(disabled)
785         else
786                 AC_TRY_RUN([
787                         #include <stdio.h>
788                         #include <stdlib.h>
789                         #include <unistd.h>
790                         #include <signal.h>
791                         #include <pthread.h>
792                         #include <sys/wait.h>
794                         static void
795                         sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
796                         {
797                                 exit (0);
798                         }
800                         static void *
801                         loop (void *ignored)
802                         {
803                                 char *ptr = NULL;
805                                 *ptr = 0;
806                                 return NULL;
807                         }
809                         static void
810                         child ()
811                         {
812                                 struct sigaction sa;
813                                 struct sigaltstack sas;
814                                 pthread_t id;
815                                 pthread_attr_t attr;
817                                 sa.sa_sigaction = sigsegv_signal_handler;
818                                 sigemptyset (&sa.sa_mask);
819                                 sa.sa_flags = SA_SIGINFO | SA_STACK;
820                                 if (sigaction (SIGSEGV, &sa, NULL) == -1) {
821                                         perror ("lala");
822                                         return;
823                                 }
825                                 sas.ss_sp = malloc (SIGSTKSZ);
826                                 sas.ss_size = SIGSTKSZ;
827                                 sas.ss_flags = SS_ONSTACK;
828                                 if (sigaltstack (&sas, NULL) == -1) {
829                                         perror ("lala");
830                                         return;
831                                 }
833                                 pthread_attr_init (&attr);
834                                 if (pthread_create(&id, &attr, loop, &attr) != 0) {
835                                         printf ("failed\n");
836                                         return;
837                                 }
839                                 sleep (100);
840                         }
842                         int
843                         main ()
844                         {
845                                 pid_t son;
846                                 int status;
847                                 int i;
849                                 son = fork ();
850                                 if (son == -1) {
851                                         return 1;
852                                 }
854                                 if (son == 0) {
855                                         child ();
856                                         return 0;
857                                 }
859                                 for (i = 0; i < 3; ++i) {
860                                         sleep (1);
861                                         waitpid (son, &status, WNOHANG);
862                                         if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
863                                                 return 0;
864                                 }
866                                 kill (son, SIGKILL);
867                                 return 1;
868                         }
870                 ], [
871                                 AC_MSG_RESULT(yes)
872                                 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
873                 ], [
874                                 with_sigaltstack=no
875                                 AC_MSG_RESULT(no)
876                 ])
877         fi
879         dnl ********************************
880         dnl *** Checks for semaphore lib ***
881         dnl ********************************
882         # 'Real Time' functions on Solaris
883         # posix4 on Solaris 2.6
884         # pthread (first!) on Linux
885         AC_SEARCH_LIBS(sem_init, pthread rt posix4) 
887         dnl ********************************
888         dnl *** Checks for timezone stuff **
889         dnl ********************************
890         AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
891                 AC_TRY_COMPILE([
892                         #include <time.h>
893                         ], [
894                         struct tm tm;
895                         tm.tm_gmtoff = 1;
896                         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
897         if test $ac_cv_struct_tm_gmtoff = yes; then
898                 AC_DEFINE(HAVE_TM_GMTOFF)
899         else
900                 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
901                         AC_TRY_COMPILE([
902                                 #include <time.h>
903                         ], [
904                                 timezone = 1;
905                         ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
906                 if test $ac_cv_var_timezone = yes; then
907                         AC_DEFINE(HAVE_TIMEZONE)
908                 else
909                         AC_ERROR(unable to find a way to determine timezone)
910                 fi
911         fi
913         dnl *********************************
914         dnl *** Checks for math functions ***
915         dnl *********************************
916         LIBS="$LIBS -lm";
917         AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
918                 AC_TRY_LINK([#include <math.h>], 
919                 [ finite(0.0); ], 
920                 AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes),
921                 AC_MSG_RESULT(no)))
922         AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
923                 AC_TRY_LINK([#include <math.h>], 
924                 [ isfinite(0.0); ], 
925                 AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
926                 AC_MSG_RESULT(no)))
928         dnl ****************************************************************
929         dnl *** Checks for working poll() (macosx defines it but doesn't ***
930         dnl *** have it in the library (duh))                            ***
931         dnl ****************************************************************
932         AC_CHECK_FUNCS(poll)
934         dnl *************************
935         dnl *** Check for signbit ***
936         dnl *************************
937         AC_MSG_CHECKING(for signbit)
938         AC_TRY_LINK([#include <math.h>], [
939                 int s = signbit(1.0);
940         ], [
941                 AC_MSG_RESULT(yes)
942                 AC_DEFINE(HAVE_SIGNBIT)
943         ], [
944                 AC_MSG_RESULT(no)
945         ]) 
947         dnl *********************
948         dnl *** Check for AIO ***
949         dnl *********************
950         AC_MSG_CHECKING([for SIGEV_THREAD definition])
951         dnl Some systems (FreeBSD at least) may have aio_read
952         dnl but don't support/define SIGEV_THREAD.
953         AC_TRY_COMPILE([
954         #include <sys/signal.h>
955         ],[
956         int x = SIGEV_THREAD;
957         ],[
958                 ac_cv_c_sigev_thread=yes
959                 AC_MSG_RESULT(yes)
960         ],[
961                 AC_MSG_RESULT(no)
962         ])
964         if test "$ac_cv_c_sigev_thread" = "yes" ; then
965                 AC_CHECK_HEADERS(aio.h sys/aio.h)
966                 AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
967                 SIGVAL_PTR="undefined"
968                 if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
969                         AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
970                                         #include <sys/signal.h>
971                                         ])
972                         AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
973                                         #include <sys/signal.h>
974                                         ])
975                         if test "$SIGVAL_PTR" = "undefined" ; then
976                                 AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
977                         fi
978                 fi
979                 AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
980         fi
981 else
982         jdk_headers_found=no
983         AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
984         AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
986         dnl *********************************
987         dnl *** Check for struct ip_mreqn ***
988         dnl *********************************
989         AC_MSG_CHECKING(for struct ip_mreqn)
990         AC_TRY_COMPILE([#include <ws2tcpip.h>], [
991                 struct ip_mreqn mreq;
992                 mreq.imr_address.s_addr = 0;
993         ], [
994                 # Yes, we have it...
995                 AC_MSG_RESULT(yes)
996                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
997         ], [
998                 # We'll just have to try and use struct ip_mreq
999                 AC_MSG_RESULT(no)
1000                 AC_MSG_CHECKING(for struct ip_mreq)
1001                 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1002                         struct ip_mreq mreq;
1003                         mreq.imr_interface.s_addr = 0;
1004                 ], [
1005                         # Yes, we have it...
1006                         AC_MSG_RESULT(yes)
1007                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
1008                 ], [
1009                         # No multicast support
1010                         AC_MSG_RESULT(no)
1011                 ])
1012         ])
1015 dnl socklen_t check
1016 AC_MSG_CHECKING(for socklen_t)
1017 AC_TRY_COMPILE([
1018 #include <sys/types.h>
1019 #include <sys/socket.h>
1021   socklen_t foo;
1023 ac_cv_c_socklen_t=yes
1024         AC_DEFINE(HAVE_SOCKLEN_T)
1025         AC_MSG_RESULT(yes)
1027         AC_MSG_RESULT(no)
1030 AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
1031         # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1032         AC_TRY_LINK([#include <math.h>], 
1033         [ static void *p = &trunc; ],
1034         [
1035                 AC_DEFINE(HAVE_TRUNC) 
1036                 AC_MSG_RESULT(yes)
1037                 ac_cv_trunc=yes
1038         ],
1039         AC_MSG_RESULT(no)))
1041 if test "x$ac_cv_truncl" != "xyes"; then
1042    AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL) LIBS="$LIBS -lsunmath"])
1045 dnl ****************************
1046 dnl *** Look for /dev/random ***
1047 dnl ****************************
1049 AC_MSG_CHECKING([if usage of random device is requested])
1050 AC_ARG_ENABLE(dev-random,
1051 [  --disable-dev-random    disable the use of the random device],
1052 try_dev_random=$enableval, try_dev_random=yes)
1053 AC_MSG_RESULT($try_dev_random)
1055 case "{$target}" in
1056     *-openbsd*)
1057     NAME_DEV_RANDOM="/dev/srandom"
1058     ;;
1060 dnl Win32 does not have /dev/random, they have their own method...
1062     *-*-mingw*|*-*-cygwin*)
1063     ac_cv_have_dev_random=no
1064     ;;
1066 dnl Everywhere else, it's /dev/random
1068     *)
1069     NAME_DEV_RANDOM="/dev/random"
1070     ;;
1071 esac
1073 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
1075 dnl Now check if the device actually exists
1077 if test "x$try_dev_random" = "xyes"; then
1078     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1079     [if test -r "$NAME_DEV_RANDOM" ; then
1080         ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1081     if test "x$ac_cv_have_dev_random" = "xyes"; then
1082         AC_DEFINE(HAVE_CRYPT_RNG)
1083     fi
1084 else
1085     AC_MSG_CHECKING(for random device)
1086     ac_cv_have_dev_random=no
1087     AC_MSG_RESULT(has been disabled)
1090 if test "x$platform_win32" = "xyes"; then
1091     AC_DEFINE(HAVE_CRYPT_RNG)
1094 if test "x$ac_cv_have_dev_random" = "xno" \
1095     && test "x$platform_win32" = "xno"; then
1096     AC_MSG_WARN([[
1098 *** A system-provided entropy source was not found on this system.
1099 *** Because of this, the System.Security.Cryptography random number generator
1100 *** will throw a NotImplemented exception.
1102 *** If you are seeing this message, and you know your system DOES have an
1103 *** entropy collection in place, please contact <crichton@gimp.org> and
1104 *** provide information about the system and how to access the random device.
1106 *** Otherwise you can install either egd or prngd and set the environment
1107 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1108 ***]])
1111 AC_MSG_CHECKING([if inter-process shared handles are requested])
1112 AC_ARG_ENABLE(shared-handles, [  --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
1113 AC_MSG_RESULT($try_shared_handles)
1114 if test "x$try_shared_handles" != "xyes"; then
1115         AC_DEFINE(DISABLE_SHARED_HANDLES)
1116         AC_SUBST(DISABLE_SHARED_HANDLES)
1120 # ICU 
1122 ICU_CFLAGS=""
1123 ICU_LIBS=""
1124 enable_icu=no
1126 probe_icu=true
1127 AC_ARG_WITH(icu, [  --with-icu=yes/no],
1128         if test x$with_icu = xno; then
1129            probe_icu=false;
1130            AC_MSG_RESULT(Will not probe for ICU)
1131         fi
1134 if $probe_icu; then
1135         AC_PATH_PROG(ICU_CONFIG, icu-config, no)
1136         if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
1137                 AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
1138                 enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
1139         else
1140                 enable_icu="yes. Version: `$ICU_CONFIG --version`"
1141                 AC_DEFINE(HAVE_ICU)
1142                 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
1143                 ICU_LIBS=`$ICU_CONFIG --ldflags`
1144         fi
1146 AC_SUBST(ICU_CFLAGS)
1147 AC_SUBST(ICU_LIBS)
1149 TARGET="unknown"
1150 ACCESS_UNALIGNED="yes"
1152 JIT_SUPPORTED=no
1153 LIBC="libc.so.6"
1154 INTL="libc.so.6"
1156 jit_wanted=false
1157 case "$host" in
1158 #       mips-sgi-irix5.* | mips-sgi-irix6.*)
1159 #               TARGET=MIPS;
1160 #               ACCESS_UNALIGNED="no"
1161 #               ;;
1162         i*86-*-*)
1163                 TARGET=X86;
1164                 arch_target=x86;
1165                 JIT_SUPPORTED=yes
1166                 jit_wanted=true
1167                 ;;
1168         x86_64-*-* | amd64-*-*)
1169                 TARGET=AMD64;
1170                 arch_target=amd64;
1171                 JIT_SUPPORTED=yes
1172                 jit_wanted=true
1173                 ;;
1174         sparc*-*-*)
1175                 if test "x$ac_cv_sizeof_void_p" = "x8"; then
1176                    TARGET=SPARC64
1177                 else
1178                         TARGET=SPARC
1179                 fi
1180                 arch_target=sparc;
1181                 JIT_SUPPORTED=yes
1182                 ACCESS_UNALIGNED="no"
1183                 LIBC="libc.so"
1184                 INTL="libintl.so"
1185                 jit_wanted=true
1186                 ;;
1187        alpha*-*-linux* | alpha*-*-osf*)
1188                 TARGET=ALPHA;
1189                 ACCESS_UNALIGNED="no"
1190                 JIT_SUPPORTED=no
1191                 arch_target=alpha;
1192                ;;
1193 #       ia64-*-linux* | ia64-*-hpux*)
1194 #               TARGET=IA64;
1195 #               arch_target=ia64;
1196 #               JIT_SUPPORTED=no;
1197 #               ACCESS_UNALIGNED="no";
1198 #               case "$host_os" in
1199 #                       linux*) LIBC="libc.so.6.1";;
1200 #                       hpux*)  LIBC="libc.so.1";;
1201 #               esac
1202 #               ;;
1203 #       m68k-*-linux*)
1204 #               TARGET=M68K
1205 #               ;;
1206         hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
1207                 TARGET=HPPA;
1208                 arch_target=hppa; 
1209                 LIBC="libc.sl"
1210                 ACCESS_UNALIGNED="no"
1211                 ;;
1212         hppa*linux*)
1213                 TARGET=HPPA;
1214                 arch_target=hppa; 
1215                 ACCESS_UNALIGNED="no"
1216                 ;;
1217         macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
1218         powerpc-*-sysv* | powerpc-*-darwin*)
1219                 TARGET=POWERPC;
1220                 arch_target=ppc;
1221                 JIT_SUPPORTED=yes
1222                 jit_wanted=true
1223                 ;;
1224         arm-*-linux-* | armv4l-*-linux-*)
1225                 TARGET=ARM;
1226                 arch_target=arm;
1227                 ACCESS_UNALIGNED="no"
1228                 ;;
1229         s390-*-linux*)
1230                 TARGET=S390;
1231                 arch_target=s390;
1232                 ACCESS_UNALIGNED="no"
1233                 JIT_SUPPORTED=yes
1234                 ;;
1235         s390x-*-linux*)
1236                 TARGET=S390x;
1237                 arch_target=s390x;
1238                 ACCESS_UNALIGNED="no"
1239                 JIT_SUPPORTED=yes
1240                 ;;
1241 esac
1243 AC_ARG_WITH(jit, [  --with-jit=yes,no       If you want to build scripts that default to the JIT],[
1244         jit_wanted=true
1247 USEJIT=false
1248 if test x$JIT_SUPPORTED = xyes; then
1249    if $jit_wanted; then
1250       USEJIT=true
1251       jit_status="Building and using the JIT"
1252    else
1253       jit_status="Building the JIT, defaulting to the interpreter"
1254    fi
1255 else
1256    jit_status="interpreter"
1259 AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
1261 libsuffix=".so"
1263 case "$host" in
1264      powerpc-*-darwin*)
1265         libsuffix=".dylib"
1266         LIBC="libc.dylib"
1267         INTL="libintl.dylib"
1268         ;;
1269      *-*-*netbsd*)
1270         LIBC="libc.so.12"
1271         INTL="libintl.so.0"
1272         ;;
1273 esac
1274 AC_SUBST(libsuffix)
1276 if test "x$TARGET" != "xAMD64"; then
1277    # valgrind headers don't compile under x86-64
1278    echo "A: $TARGET"
1279    AC_CHECK_HEADERS(valgrind/memcheck.h)
1282 if test ${TARGET} = ARM; then
1283         dnl ******************************************
1284         dnl *** Check to see what FPU is available ***
1285         dnl ******************************************
1286         AC_MSG_CHECKING(which FPU to use)
1288         AC_TRY_COMPILE([], [
1289                 __asm__ ("ldfd f0, [r0]");
1290                 ], fpu=FPA, [
1291                         AC_TRY_COMPILE([], [
1292                                 __asm__ ("fldd d0, [r0]");
1293                         ], fpu=VFP, fpu=NONE)
1294                 ])
1296         AC_MSG_RESULT($fpu)
1297         CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
1298         unset fpu
1301 if test ${TARGET} = unknown; then
1302         CPPFLAGS="$CPPFLAGS -DNO_PORT"
1303         AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
1306 if test ${ACCESS_UNALIGNED} = no; then
1307         CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
1310 PREVIEW=no
1311 AC_ARG_WITH(preview, [ --with-preview=yes,no     If you want to install the 2.0 FX preview],[
1312         if test x$with_preview = xyes; then
1313               PREVIEW=yes
1314         fi
1317 AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
1319 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1320 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1321 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1322 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
1323 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1324 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
1325 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
1326 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
1327 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
1328 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
1329 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1330 AM_CONDITIONAL(S390, test x$TARGET = xS390)
1331 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
1332 AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
1334 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
1336 AC_SUBST(LIBC)
1337 AC_SUBST(INTL)
1339 AC_SUBST(arch_target)
1340 AC_SUBST(CFLAGS)
1341 AC_SUBST(CPPFLAGS)
1342 AC_SUBST(LDFLAGS)
1344 AC_OUTPUT([
1345 Makefile
1346 mint.pc
1347 mono.pc
1348 mono/Makefile
1349 mono/utils/Makefile
1350 mono/metadata/Makefile
1351 mono/dis/Makefile
1352 mono/cil/Makefile
1353 mono/arch/Makefile
1354 mono/os/Makefile
1355 mono/os/win32/Makefile
1356 mono/os/unix/Makefile
1357 mono/arch/x86/Makefile
1358 mono/arch/amd64/Makefile
1359 mono/arch/hppa/Makefile
1360 mono/arch/ppc/Makefile
1361 mono/arch/sparc/Makefile
1362 mono/arch/s390/Makefile
1363 mono/arch/s390x/Makefile
1364 mono/arch/arm/Makefile
1365 mono/arch/alpha/Makefile
1366 mono/interpreter/Makefile
1367 mono/tests/Makefile
1368 mono/tests/tests-config
1369 mono/benchmark/Makefile
1370 mono/monoburg/Makefile
1371 mono/monograph/Makefile
1372 mono/io-layer/Makefile
1373 mono/handles/Makefile
1374 mono/mini/Makefile
1375 mono/profiler/Makefile
1376 ikvm-jni/Makefile
1377 runtime/Makefile
1378 runtime/net_1_1/Makefile
1379 runtime/net_2_0/Makefile
1380 scripts/Makefile
1381 man/Makefile
1382 web/Makefile
1383 docs/Makefile
1384 data/Makefile
1385 data/net_1_1/Makefile
1386 data/net_2_0/Makefile
1387 samples/Makefile
1388 support/Makefile
1389 data/config
1390 mono.spec
1391 tools/Makefile
1392 tools/locale-builder/Makefile
1395 echo "
1397         GC:          $gc
1398         ICU:         $enable_icu
1399         TLS:         $with_tls
1400         SIGALTSTACK: $with_sigaltstack
1401         Engine:      $jit_status
1402         2.0 Alpha:   $PREVIEW
1403         JNI support: $jdk_headers_found