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