2478197016ee4a09fd722db03eb864d7c3c34043
[mono.git] / configure.in
1 AC_INIT(README)
2 AC_CANONICAL_SYSTEM
3
4 # Gross hack to enable 'make dist' on automake 1.9+tar 1.14.
5 # The extra brackets are to foil regex-based scans.
6 m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
7
8 AM_CONFIG_HEADER(config.h)
9 AM_INIT_AUTOMAKE(mono,1.1.9)
10 AM_MAINTAINER_MODE
11
12 AC_PROG_LN_S
13
14 # In case of cygwin, override LN_S, irrespective of what it determines.
15 # The build uses cygwin, but the actual runtime doesn't.
16 case $host_os in
17 *cygwin* ) LN_S='cp -p';;
18 esac
19
20
21 dnl
22 dnl libgc checks
23 dnl
24
25 gc_headers=no
26 gc=included
27 use_included_gc=no
28 libgc_configure_args=
29
30 if test -d $srcdir/libgc ; then
31   gc_default=included
32 else
33   gc_default=boehm
34 fi
35
36 #
37 # These are the flags that need to be stored in the mono.pc file for 
38 # compiling code that will embed Mono
39 #
40 libmono_cflags=""
41 libmono_ldflags=""
42 AC_SUBST(libmono_cflags)
43 AC_SUBST(libmono_ldflags)
44
45 dnl if linker handles the version script
46 no_version_script=no
47
48 # Set to yes if Unix sockets cannot be created in an anonymous namespace
49 need_link_unlink=no
50
51 # Thread configuration inspired by sleepycat's db
52 AC_MSG_CHECKING([host platform characteristics])
53 libgc_threads=no
54 case "$host" in
55         *-*-mingw*|*-*-cygwin*)
56                 platform_win32=yes
57                 AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
58                 if test "x$cross_compiling" = "xno"; then
59                         CC="gcc -mno-cygwin -g"
60                         # So libgc configure gets -mno-cygwin
61                         export CC
62                 fi
63                 HOST_CC="gcc"
64                 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS -DFD_SETSIZE=1024"
65                 libdl=
66                 libgc_threads=win32
67                 gc_default=included
68                 with_nptl=default
69                 with_sigaltstack=no
70                 LN_S=cp
71                 # This forces libgc to use the DllMain based thread registration code on win32
72                 libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
73                 ;;
74         *-*-*netbsd*)
75                 platform_win32=no
76                 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
77                 libmono_cflags="-D_REENTRANT"
78                 LDFLAGS="$LDFLAGS -pthread"
79                 libmono_ldflags="-pthread"
80                 need_link_unlink=yes
81                 libdl=
82                 libgc_threads=no
83                 ;;
84 # these flags will work for all versions of -STABLE
85 #
86         *-*-*freebsd4*)
87                 platform_win32=no
88                 if test "x$PTHREAD_CFLAGS" = "x"; then
89                         CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
90                         libmono_cflags="-D_THREAD_SAFE"
91                 else
92                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
93                         libmono_cflags="$PTHREAD_CFLAGS"
94                 fi
95                 if test "x$PTHREAD_LIBS" = "x"; then
96                         LDFLAGS="$LDFLAGS -pthread"
97                         libmono_ldflags="-pthread"
98                 else
99                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
100                         libmono_ldflags="$PTHREAD_LIBS"
101                 fi
102                 need_link_unlink=yes
103                 AC_DEFINE(PTHREAD_POINTER_ID)
104                 libdl=
105                 libgc_threads=pthreads
106 # TLS isn't implemented at all on 4-STABLE
107                 with_nptl=no
108                 with_tls=pthread
109                 ;;
110         *-*-*freebsd5*)
111                 platform_win32=no
112                 if test "x$PTHREAD_CFLAGS" = "x"; then
113                         CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
114                         libmono_cflags=
115                 else
116                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
117                         libmono_cflags="$PTHREAD_CFLAGS"
118                 fi
119                 if test "x$PTHREAD_LIBS" = "x"; then
120                         LDFLAGS="$LDFLAGS -pthread"
121                         libmono_ldflags="-pthread"
122                 else
123                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
124                         libmono_ldflags="$PTHREAD_LIBS"
125                 fi
126                 need_link_unlink=yes
127                 AC_DEFINE(PTHREAD_POINTER_ID)
128                 libdl=
129                 with_sigaltstack=yes
130                 libgc_threads=pthreads
131 # TLS is only partially implemented on 5-STABLE (compiler support
132 # but NOT library support)
133 #
134                 with_tls=pthread
135                 ;;
136         *-*-*freebsd6*)
137                 platform_win32=no
138                 if test "x$PTHREAD_CFLAGS" = "x"; then
139                         CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
140                         libmono_cflags=
141                 else
142                         CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
143                         libmono_cflags="$PTHREAD_CFLAGS"
144                 fi
145                 if test "x$PTHREAD_LIBS" = "x"; then
146                         LDFLAGS="$LDFLAGS -pthread"
147                         libmono_ldflags="-pthread"
148                 else
149                         LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
150                         libmono_ldflags="$PTHREAD_LIBS"
151                 fi
152                 need_link_unlink=yes
153                 AC_DEFINE(PTHREAD_POINTER_ID)
154                 libdl=
155                 libgc_threads=pthreads
156                 with_sigaltstack=yes
157 # TLS is only partially implemented on -CURRENT (compiler support
158 # but NOT library support)
159 #
160                 with_tls=pthread
161                 ;;
162         *-*-*openbsd*)
163                 platform_win32=no
164                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
165                 libmono_cflags="-D_THREAD_SAFE"
166                 LDFLAGS="$LDFLAGS -pthread"
167                 libmono_ldflags="-pthread"
168                 need_link_unlink=yes
169                 AC_DEFINE(PTHREAD_POINTER_ID)
170                 libdl=
171                 libgc_threads=pthreads
172                 ;;
173         *-*-linux*)
174                 platform_win32=no
175                 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP"
176                 libmono_cflags="-D_REENTRANT"
177                 libmono_ldflags="-lpthread"
178                 libdl="-ldl"
179                 libgc_threads=pthreads
180                 ;;
181         *-*-hpux*)
182                 platform_win32=no
183                 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
184                 CFLAGS="$CFLAGS +ESdbgasm"
185                 LDFLAGS="$LDFLAGS -z"
186                 libmono_cflags="-D_REENTRANT"
187                 libmono_ldflags="-lpthread"
188                 libgc_threads=pthreads
189                 need_link_unlink=yes
190                 ;;
191         *-*-solaris*)
192                 platform_win32=no
193                 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP"
194                 need_link_unlink=yes
195                 libmono_cflags="-D_REENTRANT"
196                 libgc_threads=pthreads
197                 ;;
198         *-*-darwin*)
199                 platform_win32=no
200                 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
201                 libmono_cflags="-D_THREAD_SAFE"
202                 LDFLAGS="$LDFLAGS -pthread"
203                 libmono_ldflags="-pthread"
204                 need_link_unlink=yes
205                 AC_DEFINE(PTHREAD_POINTER_ID)
206                 AC_DEFINE(USE_MACH_SEMA)
207                 no_version_script=yes
208                 libdl=
209                 libgc_threads=pthreads
210                 ;;
211         *)
212                 AC_MSG_WARN([*** Please add $host to configure.in checks!])
213                 platform_win32=no
214                 libdl="-ldl"
215                 ;;
216 esac
217 AC_MSG_RESULT(ok)
218
219 if test x$need_link_unlink = xyes; then
220    AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
221 fi
222
223 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
224
225 AC_CHECK_TOOL(CC, gcc, gcc)
226 AC_PROG_CC
227 AM_PROG_CC_STDC
228 AC_PROG_INSTALL
229 AC_PROG_AWK
230 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
231 : ${CCAS='$(CC)'}
232 # Set ASFLAGS if not already set.
233 : ${CCASFLAGS='$(CFLAGS)'}
234 AC_SUBST(CCAS)
235 AC_SUBST(CCASFLAGS)
236
237 AC_CHECK_PROG(BISON, bison,yes,no)
238 if test "x$BISON" = "xno";
239 then
240         AC_MSG_ERROR([You need to install bison])
241 fi
242
243 dnl may require a specific autoconf version
244 dnl AC_PROG_CC_FOR_BUILD
245 dnl CC_FOR_BUILD not automatically detected
246 CC_FOR_BUILD=$CC
247 BUILD_EXEEXT=
248 if test "x$cross_compiling" = "xyes"; then
249         CC_FOR_BUILD=cc
250         BUILD_EXEEXT=""
251 fi
252 AC_SUBST(CC_FOR_BUILD)
253 AC_SUBST(HOST_CC)
254 AC_SUBST(BUILD_EXEEXT)
255
256 # Set STDC_HEADERS
257 AC_HEADER_STDC
258 AC_LIBTOOL_WIN32_DLL
259 AC_DISABLE_FAST_INSTALL
260 AM_PROG_LIBTOOL
261
262 # Test whenever ld supports -version-script
263 AC_PROG_LD
264 AC_PROG_LD_GNU
265 if test "x$lt_cv_prog_gnu_ld" = "xno"; then
266    no_version_script=yes
267 fi
268
269 AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
270
271 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h linux/rtc.h)
272
273 AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
274
275 AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
276
277 # for mono/metadata/debug-symfile.c
278 AC_CHECK_HEADERS(elf.h)
279
280 # for support
281 AC_CHECK_HEADERS(poll.h)
282 AC_CHECK_HEADERS(sys/poll.h)
283 AC_CHECK_HEADERS(sys/wait.h)
284 AC_CHECK_HEADERS(grp.h)
285 AC_CHECK_HEADERS(syslog.h)
286
287 # for mono/dis
288 AC_CHECK_HEADERS(wchar.h)
289 case "$host" in
290         *-*-*freebsd6*)
291                 AC_CHECK_HEADERS(ieeefp.h)
292         ;;
293         *-*-*freebsd*)
294                 /* Only freebsd6 has a working ieeefp.h */
295         ;;
296         *)
297                 AC_CHECK_HEADERS(ieeefp.h)
298         ;;
299 esac
300 AC_MSG_CHECKING(for isinf)
301 AC_TRY_LINK([#include <math.h>], [
302         int f = isinf (1);
303 ], [
304         AC_MSG_RESULT(yes)
305         AC_DEFINE(HAVE_ISINF, 1, [isinf available])
306 ], [
307         # We'll have to use signals
308         AC_MSG_RESULT(no)
309 ])
310
311
312 # not 64 bit clean in cross-compile
313 AC_CHECK_SIZEOF(void *, 4)
314
315 WARN=''
316 if test x"$GCC" = xyes; then
317         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
318                 # The runtime code does not respect ANSI C strict aliasing rules
319                 CFLAGS="$CFLAGS -fno-strict-aliasing"
320
321                 ORIG_CFLAGS=$CFLAGS
322                 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
323                 AC_MSG_CHECKING(for -Wdeclaration-after-statement option to gcc)
324                 AC_TRY_COMPILE([], [
325                                                    void main () { }
326                 ], [
327                    AC_MSG_RESULT(yes)
328                 ], [
329                    AC_MSG_RESULT(no)
330                    CFLAGS=$ORIG_CFLAGS
331                 ])
332 else
333         # The Sun Forte compiler complains about inline functions that access static variables
334         # so disable all inlining.
335         case "$host" in
336         *-*-solaris*)
337                 CFLAGS="$CFLAGS -Dinline="
338                 ;;
339         esac
340 fi
341 CFLAGS="$CFLAGS -g $WARN"
342
343 # Where's the 'mcs' source tree?
344 if test -d $srcdir/mcs; then
345   mcsdir=mcs
346 else
347   mcsdir=../mcs
348 fi
349
350 mcs_topdir='$(top_srcdir)/'$mcsdir
351 mcs_topdir_from_srcdir='$(top_builddir)/'$mcsdir
352
353 ## Maybe should also disable if mcsdir is invalid.  Let's punt the issue for now.
354 AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno])
355
356 AC_SUBST([mcs_topdir])
357 AC_SUBST([mcs_topdir_from_srcdir])
358
359 AC_ARG_WITH([libgdiplus], 
360         [  --with-libgdiplus=installed|sibling|<path>   Override the libgdiplus used for System.Drawing tests (defaults to NO)], 
361         [], [with_libgdiplus=installed])
362
363 case $with_libgdiplus in
364 no|installed) libgdiplus_loc= ;;
365 yes|sibling) libgdiplus_loc=`cd ../libgdiplus && pwd`/src/libgdiplus.la ;;
366 /*) libgdiplus_loc=$with_libgdiplus ;;
367 *) libgdiplus_loc=`pwd`/$with_libgdiplus ;;
368 esac
369 AC_SUBST([libgdiplus_loc])
370
371 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
372 if test "x$PKG_CONFIG" = "xno"; then
373         AC_MSG_ERROR([You need to install pkg-config])
374 fi
375
376 dnl for use on the build system
377 dnl pkg-config is stupid
378 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
379 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
380 AC_SUBST(BUILD_GLIB_CFLAGS)
381 AC_SUBST(BUILD_GLIB_LIBS)
382
383 pkg_config_path=
384 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir],
385         if test x$with_crosspkgdir = "x"; then
386                 if test -s $PKG_CONFIG_PATH; then
387                         pkg_config_path=$PKG_CONFIG_PATH
388                 fi
389         else
390                 pkg_config_path=$with_crosspkgdir
391                 PKG_CONFIG_PATH=$pkg_config_path
392                 export PKG_CONFIG_PATH
393         fi
394 )
395
396 ## Versions of dependencies
397 GLIB_REQUIRED_VERSION=1.3.11
398
399 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
400
401 if test "x$cross_compiling" = "xno"; then
402    GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
403    GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
404    GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
405    GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
406 fi
407
408 AC_SUBST(GLIB_CFLAGS)
409 AC_SUBST(GLIB_LIBS)
410 AC_SUBST(GMODULE_CFLAGS)
411 AC_SUBST(GMODULE_LIBS)
412
413 if test x$platform_win32 = xyes -a x$cross_compiling = xno; then   
414    AC_MSG_CHECKING(for cygwin glib2-dev package)
415    if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
416       AC_MSG_RESULT(found)
417           AC_MSG_ERROR([Mono cannot be built with the cygwin glib2-devel package installed, because that package doesn't work with -mno-cygwin. Please uninstall it then re-run configure.])
418    else
419       AC_MSG_RESULT(not found, ok)
420    fi
421
422    AC_MSG_CHECKING(for broken gwin32.h)
423    glib_include=`$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`
424    if test -f $glib_include/glib/gwin32.h; then
425           if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
426                  AC_MSG_RESULT(failed)
427                  hashmark='#'
428                  AC_MSG_ERROR([Your version of gwin32.h is broken and will cause compilation errors when building mono. Please fix it by deleting the line: '$hashmark   define ftruncate...' from '$glib_include/glib/gwin32.h' then re-run configure.])
429           fi
430    fi
431    AC_MSG_RESULT(ok)
432 fi
433
434 AC_ARG_WITH(gc, [  --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
435
436 # Enable support for fast thread-local storage
437 # Some systems have broken support, so we allow to disable it.
438 AC_ARG_WITH(tls, [  --with-tls=__thread,pthread       select Thread Local Storage implementation],[],[with_tls=__thread])
439
440 # Kept for compatibility
441 AC_ARG_WITH(nptl, [  --with-nptl=yes,no      deprecated, use --with-tls instead],[],[with_nptl=default])
442
443 if test "x$with_nptl" != "xdefault"; then
444    if test "x$with_nptl" = "xyes"; then
445       AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.])
446           with_tls=__thread
447    fi
448    if test "x$with_nptl" = "xno"; then
449       AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.])
450           with_tls=pthread
451    fi
452 fi
453
454 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
455 # This does not work on some platforms (bug #55253)
456 AC_ARG_WITH(sigaltstack, [  --with-sigaltstack=yes,no      enable/disable support for sigaltstack],[],[with_sigaltstack=no])
457
458 AC_ARG_WITH(static_mono, [  --with-static_mono=yes,no      link mono statically to libmono (faster)],[],[with_static_mono=yes])
459
460 if test "x$enable_static" = "xno"; then
461    with_static_mono=no
462 fi
463
464 if test "x$platform_win32" = "xyes"; then
465    # Boehm GC requires the runtime to be in its own dll
466    with_static_mono=no
467 fi
468
469 AM_CONDITIONAL(STATIC_MONO, test x$with_static_mono != xno)
470
471 AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsystems.
472   LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, reflection_emit.],
473 [
474         for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
475                 eval "mono_feature_disable_$feature='yes'"
476                 AC_MSG_NOTICE([Disabled support for feature: $feature])
477         done
478         disabled="Disabled:    $enable_minimal"
479 ],[])
480
481 if test "x$mono_feature_disable_aot" = "xyes"; then
482         AC_DEFINE(DISABLE_AOT, 1, [Disable AOT support])
483 fi
484
485 if test "x$mono_feature_disable_profiler" = "xyes"; then
486         AC_DEFINE(DISABLE_PROFILER, 1, [Disable default profiler support])
487 fi
488
489 if test "x$mono_feature_disable_decimal" = "xyes"; then
490         AC_DEFINE(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
491 fi
492
493 if test "x$mono_feature_disable_pinvoke" = "xyes"; then
494         AC_DEFINE(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
495 fi
496
497 if test "x$mono_feature_disable_debug" = "xyes"; then
498         AC_DEFINE(DISABLE_DEBUG, 1, [Disable runtime debugging support])
499 fi
500
501 if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
502         AC_DEFINE(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
503 fi
504
505 LIBGC_CFLAGS=
506 LIBGC_LIBS=
507 LIBGC_STATIC_LIBS=
508 libgc_dir=
509 case "x$gc" in
510         xboehm|xbohem|xyes)
511                 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
512                 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
513
514                 if test "x$found_boehm" != "xyes"; then
515                         AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
516                 fi
517                 if test "x$gc_headers" != "xyes"; then
518                         AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
519                 fi
520
521                 AC_DEFINE(HAVE_BOEHM_GC)
522                 AC_SUBST(HAVE_BOEHM_GC)
523                 LIBGC_LIBS="-lgc $libdl"
524                 LIBGC_STATIC_LIBS="$LIBGC_LIBS"
525
526                 # AC_CHECK_FUNCS does not work for some reason...
527                 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
528                 if test "x$found_gcj_malloc" = "xyes"; then
529                         AC_DEFINE(HAVE_GC_GCJ_MALLOC)
530                 fi
531                 AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
532                 if test "x$found_gc_enable" = "xyes"; then
533                         AC_DEFINE(HAVE_GC_ENABLE)
534                 fi
535                 ;;
536
537         xincluded)
538                 AC_CONFIG_SUBDIRS(libgc)
539
540                 found_boehm=yes
541                 gc_headers=yes
542                 use_included_gc=yes
543                 libgc_dir=libgc
544
545                 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
546                 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
547                 LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
548
549                 AC_DEFINE(HAVE_BOEHM_GC)
550                 AC_SUBST(HAVE_BOEHM_GC)
551
552                 AC_DEFINE(HAVE_GC_H)
553                 AC_DEFINE(USE_INCLUDED_LIBGC)
554
555                 # The included libgc contains GCJ support
556                 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
557                 AC_DEFINE(HAVE_GC_ENABLE)
558                 ;;
559
560         xnone)
561                 AC_MSG_WARN("Compiling mono without GC.")
562                 ;;
563         *)
564                 AC_MSG_ERROR([Invalid argument to --with-gc.])
565                 ;;
566 esac
567
568 AC_ARG_WITH(large-heap, [  --with-large-heap=yes,no    Enable support for GC heaps larger than 3GB], [large_heap=$withval], [large_heap=no])
569 if test "x$large_heap" = "xyes"; then
570    echo "FOO"
571    CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
572 fi
573
574 # tell libgc/configure about what we want
575 ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads $libgc_configure_args"
576
577 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
578 AC_SUBST(LIBGC_CFLAGS)
579 AC_SUBST(LIBGC_LIBS)
580 AC_SUBST(LIBGC_STATIC_LIBS)
581 AC_SUBST(libgc_dir)
582
583 dnl
584 dnl End of libgc checks
585 dnl
586
587 if test x$platform_win32 = xno; then
588
589         dnl ******************************************************************
590         dnl *** Checks for the IKVM JNI interface library                  ***
591         dnl ******************************************************************
592         AC_ARG_WITH(ikvm-native, [  --with-ikvm-native=yes,no  build the IKVM JNI interface library],[with_ikvm_native=$withval],[with_ikvm_native=yes])
593
594         ikvm_native_dir=
595         if test x$with_ikvm_native = xyes; then
596                 ikvm_native_dir=ikvm-native
597                 jdk_headers_found="IKVM Native"
598         fi
599
600         AC_SUBST(ikvm_native_dir)
601
602         AC_CHECK_FUNCS(getgrgid_r)
603         AC_CHECK_FUNCS(getgrnam_r)
604         AC_CHECK_FUNCS(getpwnam_r)
605         AC_CHECK_FUNCS(getpwuid_r)
606         AC_CHECK_FUNCS(getresuid)
607         AC_CHECK_FUNCS(setresuid)
608         AC_CHECK_FUNCS(kqueue)
609         AC_CHECK_FUNCS(backtrace_symbols)
610
611         dnl ******************************************************************
612         dnl *** Check for large file support                               ***
613         dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
614         dnl ******************************************************************
615         
616         # Check that off_t can represent 2**63 - 1 correctly, working around
617         # potential compiler bugs.  Defines LARGE_FILE_SUPPORT, adds $1 to
618         # CPPFLAGS and sets $large_offt to yes if the test succeeds
619         large_offt=no
620         AC_DEFUN([LARGE_FILES], [
621                 large_CPPFLAGS=$CPPFLAGS
622                 CPPFLAGS="$CPPFLAGS $1"
623                 AC_TRY_RUN([
624                         #include <sys/types.h>
625
626                         #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
627
628                         int main(void) {
629                                 int big_off_t=((BIG_OFF_T%2147483629==721) &&
630                                                (BIG_OFF_T%2147483647==1));
631                                 if(big_off_t) {
632                                         exit(0);
633                                 } else {
634                                         exit(1);
635                                 }
636                         }
637                 ], [
638                         AC_MSG_RESULT(ok)
639                         AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
640                         large_CPPFLAGS="$large_CPPFLAGS $1"
641                         large_offt=yes
642                 ], [
643                         AC_MSG_RESULT(no)
644                 ], "")
645                 CPPFLAGS=$large_CPPFLAGS
646         ])
647
648         AC_MSG_CHECKING(if off_t is 64 bits wide)
649         LARGE_FILES("")
650         if test $large_offt = no; then
651                 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
652                 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
653         fi
654         if test $large_offt = no; then
655                 AC_MSG_WARN([No 64 bit file size support available])
656         fi
657         
658         dnl *****************************
659         dnl *** Checks for libsocket  ***
660         dnl *****************************
661         AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
662
663         dnl *******************************
664         dnl *** Checks for MSG_NOSIGNAL ***
665         dnl *******************************
666         AC_MSG_CHECKING(for MSG_NOSIGNAL)
667         AC_TRY_COMPILE([#include <sys/socket.h>], [
668                 int f = MSG_NOSIGNAL;
669         ], [
670                 # Yes, we have it...
671                 AC_MSG_RESULT(yes)
672                 AC_DEFINE(HAVE_MSG_NOSIGNAL)
673         ], [
674                 # We'll have to use signals
675                 AC_MSG_RESULT(no)
676         ])
677
678         dnl *****************************
679         dnl *** Checks for SOL_IP     ***
680         dnl *****************************
681         AC_MSG_CHECKING(for SOL_IP)
682         AC_TRY_COMPILE([#include <netdb.h>], [
683                 int level = SOL_IP;
684         ], [
685                 # Yes, we have it...
686                 AC_MSG_RESULT(yes)
687                 AC_DEFINE(HAVE_SOL_IP)
688         ], [
689                 # We'll have to use getprotobyname
690                 AC_MSG_RESULT(no)
691         ])
692
693         dnl *****************************
694         dnl *** Checks for SOL_IPV6     ***
695         dnl *****************************
696         AC_MSG_CHECKING(for SOL_IPV6)
697         AC_TRY_COMPILE([#include <netdb.h>], [
698                 int level = SOL_IPV6;
699         ], [
700                 # Yes, we have it...
701                 AC_MSG_RESULT(yes)
702                 AC_DEFINE(HAVE_SOL_IPV6)
703         ], [
704                 # We'll have to use getprotobyname
705                 AC_MSG_RESULT(no)
706         ])
707
708         dnl *****************************
709         dnl *** Checks for SOL_TCP    ***
710         dnl *****************************
711         AC_MSG_CHECKING(for SOL_TCP)
712         AC_TRY_COMPILE([#include <netdb.h>], [
713                 int level = SOL_TCP;
714         ], [
715                 # Yes, we have it...
716                 AC_MSG_RESULT(yes)
717                 AC_DEFINE(HAVE_SOL_TCP)
718         ], [
719                 # We'll have to use getprotobyname
720                 AC_MSG_RESULT(no)
721         ])
722
723         dnl *****************************
724         dnl *** Checks for IP_PKTINFO ***
725         dnl *****************************
726         AC_MSG_CHECKING(for IP_PKTINFO)
727         AC_TRY_COMPILE([#include <netdb.h>], [
728                 int level = IP_PKTINFO;
729         ], [
730                 # Yes, we have it...
731                 AC_MSG_RESULT(yes)
732                 AC_DEFINE(HAVE_IP_PKTINFO)
733         ], [
734                 AC_MSG_RESULT(no)
735         ])
736
737         dnl *****************************
738     dnl *** Checks for IPV6_PKTINFO ***
739     dnl *****************************
740     AC_MSG_CHECKING(for IPV6_PKTINFO)
741     AC_TRY_COMPILE([#include <netdb.h>], [
742         int level = IPV6_PKTINFO;
743     ], [
744         # Yes, we have it...
745         AC_MSG_RESULT(yes)
746         AC_DEFINE(HAVE_IPV6_PKTINFO)
747     ], [
748         AC_MSG_RESULT(no)
749     ])
750  
751         dnl *********************************
752         dnl *** Check for struct ip_mreqn ***
753         dnl *********************************
754         AC_MSG_CHECKING(for struct ip_mreqn)
755         AC_TRY_COMPILE([#include <netinet/in.h>], [
756                 struct ip_mreqn mreq;
757                 mreq.imr_address.s_addr = 0;
758         ], [
759                 # Yes, we have it...
760                 AC_MSG_RESULT(yes)
761                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
762         ], [
763                 # We'll just have to try and use struct ip_mreq
764                 AC_MSG_RESULT(no)
765                 AC_MSG_CHECKING(for struct ip_mreq)
766                 AC_TRY_COMPILE([#include <netinet/in.h>], [
767                         struct ip_mreq mreq;
768                         mreq.imr_interface.s_addr = 0;
769                 ], [
770                         # Yes, we have it...
771                         AC_MSG_RESULT(yes)
772                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
773                 ], [
774                         # No multicast support
775                         AC_MSG_RESULT(no)
776                 ])
777         ])
778         
779         dnl **********************************
780         dnl *** Check for gethostbyname2_r ***
781         dnl **********************************
782         AC_MSG_CHECKING(for gethostbyname2_r)
783                 AC_TRY_LINK([#include <netdb.h>], [
784                 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
785         ], [
786                 # Yes, we have it...
787                 AC_MSG_RESULT(yes)
788                 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
789         ], [
790                 AC_MSG_RESULT(no)
791         ])
792
793         dnl *****************************
794         dnl *** Checks for libnsl     ***
795         dnl *****************************
796         AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
797
798         AC_CHECK_FUNCS(inet_pton inet_aton)
799
800         dnl ***********************************************
801         dnl *** Checks for size of sockaddr_un.sun_path ***
802         dnl ***********************************************
803         # AC_CHECK_SIZEOF can't cope with struct members :-(
804         AC_MSG_CHECKING(size of sockaddr_un.sun_path)
805         AC_CACHE_VAL(cv_mono_sizeof_sunpath,
806                 [AC_TRY_RUN([
807                         #include <sys/types.h>
808                         #include <stdio.h>
809                         #include <sys/un.h>
810
811                         int main(void) {
812                                 struct sockaddr_un sock_un;
813                                 FILE *f=fopen("conftestval", "w");
814                                 if(!f) exit(1);
815                                 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
816                                 exit(0);
817                         }
818                 ], cv_mono_sizeof_sunpath=`cat conftestval`,
819                    cv_mono_sizeof_sunpath=0,
820                    cv_mono_sizeof_sunpath=0)])dnl
821         AC_MSG_RESULT($cv_mono_sizeof_sunpath)
822         AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
823
824         dnl *************************************
825         dnl *** Checks for zero length arrays ***
826         dnl *************************************
827         AC_MSG_CHECKING(whether $CC supports zero length arrays)
828         AC_TRY_COMPILE([
829                 struct s {
830                         int  length;
831                         char data [0];
832                 };
833         ], [], [
834                 AC_MSG_RESULT(yes)
835                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
836         ], [
837                 AC_MSG_RESULT(no)
838                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
839         ])
840
841         dnl *****************************
842         dnl *** Checks for libxnet    ***
843         dnl *****************************
844         case "${host}" in
845                 *solaris* )
846                         AC_MSG_CHECKING(for Solaris XPG4 support)
847                         if test -f /usr/lib/libxnet.so; then
848                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
849                                 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
850                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
851                                 LIBS="$LIBS -lxnet"
852                                 AC_MSG_RESULT(yes)
853                         else
854                                 AC_MSG_RESULT(no)
855                         fi
856
857                         if test "$GCC" = "yes"; then
858                                 CFLAGS="$CFLAGS -Wno-char-subscripts"
859                         fi
860                 ;;
861         esac
862
863         dnl *****************************
864         dnl *** Checks for libpthread ***
865         dnl *****************************
866 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
867 # and libpthread does not exist
868 #
869         case "${host}" in
870                 *-*-*freebsd4*)
871                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
872                 ;;
873                 *-*-*freebsd5*)
874                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
875                 ;;
876                 *-*-*freebsd6*)
877                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
878                 ;;
879                 *)
880                         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
881                 ;;
882         esac
883         AC_CHECK_HEADERS(pthread.h)
884         AC_CHECK_FUNCS(pthread_mutex_timedlock)
885         AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
886         AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
887         AC_TRY_COMPILE([ #include <pthread.h>], [
888                 pthread_mutexattr_t attr;
889                 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
890         ], [
891                 AC_MSG_RESULT(ok)
892         ], [
893                 AC_MSG_RESULT(no)
894                 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
895                 AC_DEFINE(USE_MONO_MUTEX)
896         ])
897         AC_CHECK_FUNCS(pthread_attr_setstacksize)
898
899         dnl ***********************************
900         dnl *** Checks for working __thread ***
901         dnl ***********************************
902         AC_MSG_CHECKING(for working __thread)
903         if test "x$with_tls" != "x__thread"; then
904                 AC_MSG_RESULT(disabled)
905         else
906                 AC_TRY_RUN([
907                         #include <pthread.h>
908                         __thread int i;
909                         static int res1, res2;
910
911                         void thread_main (void *arg)
912                         {
913                                 i = arg;
914                                 sleep (1);
915                                 if (arg == 1)
916                                         res1 = (i == arg);
917                                 else
918                                         res2 = (i == arg);
919                         }
920
921                         int main () {
922                                 pthread_t t1, t2;
923
924                                 i = 5;
925
926                                 pthread_create (&t1, NULL, thread_main, 1);
927                                 pthread_create (&t2, NULL, thread_main, 2);
928
929                                 pthread_join (t1, NULL);
930                                 pthread_join (t2, NULL);
931
932                                 return !(res1 + res2 == 2);
933                         }
934                 ], [
935                                 AC_MSG_RESULT(yes)
936                 ], [
937                                 AC_MSG_RESULT(no)
938                                 with_tls=pthread
939                 ])
940         fi
941
942         dnl **************************************
943         dnl *** Checks for working sigaltstack ***
944         dnl **************************************
945         AC_MSG_CHECKING(for working sigaltstack)
946         if test "x$with_sigaltstack" != "xyes"; then
947                 AC_MSG_RESULT(disabled)
948         else
949                 AC_TRY_RUN([
950                         #include <stdio.h>
951                         #include <stdlib.h>
952                         #include <unistd.h>
953                         #include <signal.h>
954                         #include <pthread.h>
955                         #include <sys/wait.h>
956                         #if defined(__FreeBSD__) || defined(__NetBSD__)
957                         #define SA_STACK SA_ONSTACK
958                         #endif
959                         static void
960                         sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
961                         {
962                                 exit (0);
963                         }
964
965                         static void *
966                         loop (void *ignored)
967                         {
968                                 char *ptr = NULL;
969
970                                 *ptr = 0;
971                                 return NULL;
972                         }
973
974                         static void
975                         child ()
976                         {
977                                 struct sigaction sa;
978                                 struct sigaltstack sas;
979                                 pthread_t id;
980                                 pthread_attr_t attr;
981
982                                 sa.sa_sigaction = sigsegv_signal_handler;
983                                 sigemptyset (&sa.sa_mask);
984                                 sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
985                                 if (sigaction (SIGSEGV, &sa, NULL) == -1) {
986                                         perror ("sigaction");
987                                         return;
988                                 }
989
990                                 sas.ss_sp = malloc (SIGSTKSZ);
991                                 sas.ss_size = SIGSTKSZ;
992                                 sas.ss_flags = 0;
993                                 if (sigaltstack (&sas, NULL) == -1) {
994                                         perror ("sigaltstack");
995                                         return;
996                                 }
997
998                                 pthread_attr_init (&attr);
999                                 if (pthread_create(&id, &attr, loop, &attr) != 0) {
1000                                         printf ("pthread_create\n");
1001                                         return;
1002                                 }
1003
1004                                 sleep (100);
1005                         }
1006
1007                         int
1008                         main ()
1009                         {
1010                                 pid_t son;
1011                                 int status;
1012                                 int i;
1013
1014                                 son = fork ();
1015                                 if (son == -1) {
1016                                         return 1;
1017                                 }
1018
1019                                 if (son == 0) {
1020                                         child ();
1021                                         return 0;
1022                                 }
1023
1024                                 for (i = 0; i < 3; ++i) {
1025                                         sleep (1);
1026                                         waitpid (son, &status, WNOHANG);
1027                                         if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
1028                                                 return 0;
1029                                 }
1030
1031                                 kill (son, SIGKILL);
1032                                 return 1;
1033                         }
1034
1035                 ], [
1036                                 AC_MSG_RESULT(yes)
1037                                 AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
1038                 ], [
1039                                 with_sigaltstack=no
1040                                 AC_MSG_RESULT(no)
1041                 ])
1042         fi
1043
1044         dnl ********************************
1045         dnl *** Checks for semaphore lib ***
1046         dnl ********************************
1047         # 'Real Time' functions on Solaris
1048         # posix4 on Solaris 2.6
1049         # pthread (first!) on Linux
1050         AC_SEARCH_LIBS(sem_init, pthread rt posix4) 
1051
1052         dnl ********************************
1053         dnl *** Checks for timezone stuff **
1054         dnl ********************************
1055         AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
1056                 AC_TRY_COMPILE([
1057                         #include <time.h>
1058                         ], [
1059                         struct tm tm;
1060                         tm.tm_gmtoff = 1;
1061                         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
1062         if test $ac_cv_struct_tm_gmtoff = yes; then
1063                 AC_DEFINE(HAVE_TM_GMTOFF)
1064         else
1065                 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
1066                         AC_TRY_COMPILE([
1067                                 #include <time.h>
1068                         ], [
1069                                 timezone = 1;
1070                         ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
1071                 if test $ac_cv_var_timezone = yes; then
1072                         AC_DEFINE(HAVE_TIMEZONE)
1073                 else
1074                         AC_ERROR(unable to find a way to determine timezone)
1075                 fi
1076         fi
1077
1078         dnl *********************************
1079         dnl *** Checks for math functions ***
1080         dnl *********************************
1081         LIBS="$LIBS -lm";
1082         AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
1083                 AC_TRY_LINK([#include <math.h>], 
1084                 [ finite(0.0); ], 
1085                 AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes),
1086                 AC_MSG_RESULT(no)))
1087         AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
1088                 AC_TRY_LINK([#include <math.h>], 
1089                 [ isfinite(0.0); ], 
1090                 AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
1091                 AC_MSG_RESULT(no)))
1092
1093         dnl ****************************************************************
1094         dnl *** Checks for working poll() (macosx defines it but doesn't ***
1095         dnl *** have it in the library (duh))                            ***
1096         dnl ****************************************************************
1097         AC_CHECK_FUNCS(poll)
1098
1099         dnl *************************
1100         dnl *** Check for signbit ***
1101         dnl *************************
1102         AC_MSG_CHECKING(for signbit)
1103         AC_TRY_LINK([#include <math.h>], [
1104                 int s = signbit(1.0);
1105         ], [
1106                 AC_MSG_RESULT(yes)
1107                 AC_DEFINE(HAVE_SIGNBIT)
1108         ], [
1109                 AC_MSG_RESULT(no)
1110         ]) 
1111
1112         dnl *********************
1113         dnl *** Check for AIO ***
1114         dnl *********************
1115         AC_MSG_CHECKING([for SIGEV_THREAD definition])
1116         dnl Some systems (FreeBSD at least) may have aio_read
1117         dnl but don't support/define SIGEV_THREAD.
1118         AC_TRY_COMPILE([
1119         #include <sys/signal.h>
1120         ],[
1121         int x = SIGEV_THREAD;
1122         ],[
1123                 ac_cv_c_sigev_thread=yes
1124                 AC_MSG_RESULT(yes)
1125         ],[
1126                 AC_MSG_RESULT(no)
1127         ])
1128
1129         if test "$ac_cv_c_sigev_thread" = "yes" ; then
1130                 AC_CHECK_HEADERS(aio.h sys/aio.h)
1131                 AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
1132                 SIGVAL_PTR="undefined"
1133                 if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
1134                         AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
1135                                         #include <sys/signal.h>
1136                                         ])
1137                         AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
1138                                         #include <sys/signal.h>
1139                                         ])
1140                         if test "$SIGVAL_PTR" = "undefined" ; then
1141                                 AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
1142                         fi
1143                 fi
1144                 AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
1145         fi
1146
1147         dnl **********************************
1148         dnl *** epoll                      ***
1149         dnl **********************************
1150         AC_CHECK_HEADERS(sys/epoll.h)
1151         haveepoll=no
1152         AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
1153         if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
1154                 AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
1155         fi
1156
1157         dnl ******************************
1158         dnl *** Checks for SIOCGIFCONF ***
1159         dnl ******************************
1160         AC_CHECK_HEADERS(sys/ioctl.h)
1161         AC_CHECK_HEADERS(net/if.h)
1162         AC_MSG_CHECKING(for ifreq)
1163         AC_TRY_COMPILE([
1164                 #include <sys/ioctl.h>
1165                 #include <net/if.h>
1166                 ], [
1167                 struct ifconf ifc;
1168                 struct ifreq *ifr;
1169                 void *x;
1170                 ifc.ifc_len = 0;
1171                 ifc.ifc_buf = NULL;
1172                 x = (void *) &ifr->ifr_addr;
1173                 ],[
1174                         AC_MSG_RESULT(yes)
1175                         AC_DEFINE(HAVE_SIOCGIFCONF, 1, [Can get interface list])
1176                 ], [
1177                         AC_MSG_RESULT(no)
1178                 ])
1179         dnl **********************************
1180         dnl *** Checks for MonoPosixHelper ***
1181         dnl **********************************
1182         AC_CHECK_HEADERS(checklist.h)
1183         AC_CHECK_HEADERS(fstab.h)
1184         AC_CHECK_HEADERS(attr/xattr.h)
1185         AC_CHECK_HEADERS(sys/extattr.h)
1186         AC_CHECK_HEADERS(sys/sendfile.h)
1187         AC_CHECK_HEADERS(sys/statvfs.h)
1188         AC_CHECK_HEADERS(sys/vfstab.h)
1189         AC_CHECK_HEADERS(sys/xattr.h)
1190         AC_CHECK_FUNCS(getdomainname)
1191         AC_CHECK_FUNCS(setdomainname)
1192         AC_CHECK_FUNCS(fgetgrent)
1193         AC_CHECK_FUNCS(fgetpwent)
1194         AC_CHECK_FUNCS(fgetpwent)
1195         AC_CHECK_FUNCS(getfsstat)
1196         AC_CHECK_FUNCS(mremap)
1197         AC_CHECK_FUNCS(remap_file_pages)
1198         AC_CHECK_FUNCS(posix_fadvise)
1199         AC_CHECK_FUNCS(posix_fallocate)
1200         AC_CHECK_FUNCS(posix_madvise)
1201         AC_CHECK_FUNCS(vsnprintf)
1202         AC_CHECK_FUNCS(sendfile)
1203         AC_CHECK_FUNCS(sethostid)
1204         AC_CHECK_FUNCS(statfs)
1205         AC_CHECK_FUNCS(fstatfs)
1206         AC_CHECK_FUNCS(statvfs)
1207         AC_CHECK_FUNCS(fstatvfs)
1208         AC_CHECK_FUNCS(stime)
1209         AC_CHECK_FUNCS(strerror_r)
1210         AC_CHECK_FUNCS(ttyname_r)
1211         AC_CHECK_SIZEOF(size_t)
1212         AC_CHECK_MEMBERS(
1213                 [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,, 
1214                 [#include <sys/types.h>
1215                  #include <dirent.h>])
1216
1217         dnl Favour xattr through glibc, but use libattr if we have to
1218         AC_CHECK_FUNC(lsetxattr, ,
1219                 AC_CHECK_LIB(attr, lsetxattr, XATTR_LIB="-lattr",)
1220         )
1221         AC_SUBST(XATTR_LIB)
1222
1223         dnl *********************************
1224         dnl *** Check for Console 2.0 I/O ***
1225         dnl *********************************
1226         AC_CHECK_HEADERS([curses.h])
1227         AC_CHECK_HEADERS([term.h], [], [],
1228         [#if HAVE_CURSES_H
1229          #include <curses.h>
1230          #endif
1231         ])
1232         AC_CHECK_HEADERS([termios.h])
1233 else
1234         jdk_headers_found=no
1235         AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
1236         AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
1237         AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
1238
1239         dnl *********************************
1240         dnl *** Check for struct ip_mreqn ***
1241         dnl *********************************
1242         AC_MSG_CHECKING(for struct ip_mreqn)
1243         AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1244                 struct ip_mreqn mreq;
1245                 mreq.imr_address.s_addr = 0;
1246         ], [
1247                 # Yes, we have it...
1248                 AC_MSG_RESULT(yes)
1249                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
1250         ], [
1251                 # We'll just have to try and use struct ip_mreq
1252                 AC_MSG_RESULT(no)
1253                 AC_MSG_CHECKING(for struct ip_mreq)
1254                 AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1255                         struct ip_mreq mreq;
1256                         mreq.imr_interface.s_addr = 0;
1257                 ], [
1258                         # Yes, we have it...
1259                         AC_MSG_RESULT(yes)
1260                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
1261                 ], [
1262                         # No multicast support
1263                         AC_MSG_RESULT(no)
1264                 ])
1265         ])
1266 fi
1267
1268 dnl socklen_t check
1269 AC_MSG_CHECKING(for socklen_t)
1270 AC_TRY_COMPILE([
1271 #include <sys/types.h>
1272 #include <sys/socket.h>
1273 ],[
1274   socklen_t foo;
1275 ],[
1276 ac_cv_c_socklen_t=yes
1277         AC_DEFINE(HAVE_SOCKLEN_T)
1278         AC_MSG_RESULT(yes)
1279 ],[
1280         AC_MSG_RESULT(no)
1281 ])
1282
1283 AC_MSG_CHECKING(for array element initalizer support)
1284 AC_TRY_COMPILE([#include <sys/socket.h>], [
1285         const int array[] = {[1] = 2,};
1286 ], [
1287         # Yes, we have it...
1288         AC_MSG_RESULT(yes)
1289         AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1290 ], [
1291         # We'll have to use signals
1292         AC_MSG_RESULT(no)
1293 ])
1294
1295 AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
1296         # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1297         AC_TRY_LINK([#include <math.h>], 
1298         [ static void *p = &trunc; ],
1299         [
1300                 AC_DEFINE(HAVE_TRUNC) 
1301                 AC_MSG_RESULT(yes)
1302                 ac_cv_trunc=yes
1303         ],
1304         AC_MSG_RESULT(no)))
1305
1306 if test "x$ac_cv_truncl" != "xyes"; then
1307    AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL) LIBS="$LIBS -lsunmath"])
1308 fi
1309
1310 dnl ****************************
1311 dnl *** Look for /dev/random ***
1312 dnl ****************************
1313
1314 AC_MSG_CHECKING([if usage of random device is requested])
1315 AC_ARG_ENABLE(dev-random,
1316 [  --disable-dev-random    disable the use of the random device],
1317 try_dev_random=$enableval, try_dev_random=yes)
1318 AC_MSG_RESULT($try_dev_random)
1319
1320 case "{$target}" in
1321     *-openbsd*)
1322     NAME_DEV_RANDOM="/dev/srandom"
1323     ;;
1324
1325 dnl Win32 does not have /dev/random, they have their own method...
1326
1327     *-*-mingw*|*-*-cygwin*)
1328     ac_cv_have_dev_random=no
1329     ;;
1330
1331 dnl Everywhere else, it's /dev/random
1332
1333     *)
1334     NAME_DEV_RANDOM="/dev/random"
1335     ;;
1336 esac
1337
1338 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
1339
1340 dnl Now check if the device actually exists
1341
1342 if test "x$try_dev_random" = "xyes"; then
1343     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1344     [if test -r "$NAME_DEV_RANDOM" ; then
1345         ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
1346     if test "x$ac_cv_have_dev_random" = "xyes"; then
1347         AC_DEFINE(HAVE_CRYPT_RNG)
1348     fi
1349 else
1350     AC_MSG_CHECKING(for random device)
1351     ac_cv_have_dev_random=no
1352     AC_MSG_RESULT(has been disabled)
1353 fi
1354
1355 if test "x$platform_win32" = "xyes"; then
1356     AC_DEFINE(HAVE_CRYPT_RNG)
1357 fi
1358
1359 if test "x$ac_cv_have_dev_random" = "xno" \
1360     && test "x$platform_win32" = "xno"; then
1361     AC_MSG_WARN([[
1362 ***
1363 *** A system-provided entropy source was not found on this system.
1364 *** Because of this, the System.Security.Cryptography random number generator
1365 *** will throw a NotImplemented exception.
1366 ***
1367 *** If you are seeing this message, and you know your system DOES have an
1368 *** entropy collection in place, please contact <crichton@gimp.org> and
1369 *** provide information about the system and how to access the random device.
1370 ***
1371 *** Otherwise you can install either egd or prngd and set the environment
1372 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1373 ***]])
1374 fi
1375  
1376 AC_MSG_CHECKING([if inter-process shared handles are requested])
1377 AC_ARG_ENABLE(shared-handles, [  --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
1378 AC_MSG_RESULT($try_shared_handles)
1379 if test "x$try_shared_handles" != "xyes"; then
1380         AC_DEFINE(DISABLE_SHARED_HANDLES)
1381         AC_SUBST(DISABLE_SHARED_HANDLES)
1382 fi
1383
1384 AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests       Run the nunit tests of the class library on 'make check'])
1385 AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
1386
1387 TARGET="unknown"
1388 ACCESS_UNALIGNED="yes"
1389
1390 JIT_SUPPORTED=no
1391 INTERP_SUPPORTED=no
1392 LIBC="libc.so.6"
1393 INTL="libc.so.6"
1394 SQLITE="libsqlite.so.0"
1395 SQLITE3="libsqlite3.so.0"
1396 X11="libX11.so"
1397
1398 jit_wanted=false
1399 interp_wanted=false
1400 case "$host" in
1401 #       mips-sgi-irix5.* | mips-sgi-irix6.*)
1402 #               TARGET=MIPS;
1403 #               ACCESS_UNALIGNED="no"
1404 #               ;;
1405         i*86-*-*)
1406                 TARGET=X86;
1407                 arch_target=x86;
1408                 JIT_SUPPORTED=yes
1409                 jit_wanted=true
1410                 ;;
1411         x86_64-*-* | amd64-*-*)
1412                 TARGET=AMD64;
1413                 arch_target=amd64;
1414                 JIT_SUPPORTED=yes
1415                 jit_wanted=true
1416                 ;;
1417         ia64-*-*)
1418                 TARGET=IA64
1419                 arch_target=ia64
1420                 ACCESS_UNALIGNED="no"
1421                 JIT_SUPPORTED=yes
1422                 jit_wanted=true
1423                 LIBC="libc.so.6.1"
1424                 AC_CHECK_LIB(unwind, _U_dyn_register, [], [AC_MSG_ERROR(library libunwind not found)])
1425                 libmono_ldflags="-lunwind"
1426                 ;;
1427         sparc*-*-*)
1428                 if test "x$ac_cv_sizeof_void_p" = "x8"; then
1429                    TARGET=SPARC64
1430                 else
1431                         TARGET=SPARC
1432                 fi
1433                 arch_target=sparc;
1434                 JIT_SUPPORTED=yes
1435                 ACCESS_UNALIGNED="no"
1436                 case $host_os in
1437                   linux*) ;;
1438                   *)
1439                         LIBC="libc.so"
1440                         INTL="libintl.so"
1441                 esac
1442                 jit_wanted=true
1443                 if test x"$GCC" = xyes; then
1444                         CFLAGS="$CFLAGS -Wno-cast-align"
1445                 fi
1446                 ;;
1447        alpha*-*-linux* | alpha*-*-osf*)
1448                 TARGET=ALPHA;
1449                 ACCESS_UNALIGNED="no"
1450                 JIT_SUPPORTED=no
1451                 INTERP_SUPPORTED=yes
1452                 interp_wanted=true
1453                 arch_target=alpha;
1454                 case $host_os in
1455                   linux*)
1456                         LIBC="libc.so.6.1"
1457                         INTL="libc.so.6.1"
1458                 esac
1459                ;;
1460         *-*-mingw*|*-*-cygwin*)
1461                 INTL="intl"
1462                 ;;
1463         hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
1464                 TARGET=HPPA;
1465                 arch_target=hppa; 
1466                 LIBC="libc.sl"
1467                 ACCESS_UNALIGNED="no"
1468                 INTERP_SUPPORTED=yes
1469                 interp_wanted=true
1470                 ;;
1471         hppa*linux*)
1472                 TARGET=HPPA;
1473                 arch_target=hppa; 
1474                 ACCESS_UNALIGNED="no"
1475                 INTERP_SUPPORTED=yes
1476                 interp_wanted=true
1477                 ;;
1478         macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
1479         powerpc-*-sysv* | powerpc-*-darwin*)
1480                 TARGET=POWERPC;
1481                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1482                 arch_target=ppc;
1483                 JIT_SUPPORTED=yes
1484                 jit_wanted=true
1485                 ;;
1486         arm*-linux*)
1487                 TARGET=ARM;
1488                 arch_target=arm;
1489                 ACCESS_UNALIGNED="no"
1490                 JIT_SUPPORTED=yes
1491                 jit_wanted=true
1492                 ;;
1493         s390-*-linux*)
1494                 TARGET=S390;
1495                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1496                 arch_target=s390;
1497                 ACCESS_UNALIGNED="no"
1498                 JIT_SUPPORTED=yes
1499                 ;;
1500         s390x-*-linux*)
1501                 TARGET=S390x;
1502                 AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
1503                 arch_target=s390x;
1504                 ACCESS_UNALIGNED="no"
1505                 JIT_SUPPORTED=yes
1506                 ;;
1507 esac
1508
1509 AC_ARG_WITH(jit, [  --with-jit=yes,no       If you want to build scripts that default to the JIT],[
1510         if test x$withval = xyes; then
1511            jit_wanted=true
1512         else
1513            jit_wanted=false
1514         fi
1515 ])
1516
1517 AC_ARG_WITH(interp, [  --with-interp=yes,no    If you want to build scripts that default to the interpreter],[
1518         if test x$withval = xyes; then
1519            interp_wanted=true
1520         else
1521            interp_wanted=false
1522         fi
1523 ])
1524
1525 USEJIT=false
1526 if test x$JIT_SUPPORTED = xyes; then
1527    if $jit_wanted; then
1528       USEJIT=true
1529       jit_status="Building and using the JIT"
1530    else
1531       if $interp_wanted; then
1532          jit_status="Building the JIT, defaulting to the interpreter"
1533       else
1534          AC_ERROR(No JIT or interpreter support available or selected.)
1535       fi
1536    fi
1537 else
1538    if test x$interp_wanted = xtrue; then
1539       jit_status="interpreter"
1540    else
1541       AC_ERROR(No JIT or interpreter support available or selected.)
1542    fi
1543 fi
1544
1545 AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
1546
1547 libsuffix=".so"
1548
1549 case "$host" in
1550      *-*-darwin*)
1551         libsuffix=".dylib"
1552         LIBC="libc.dylib"
1553         INTL="libintl.dylib"
1554         SQLITE="libsqlite.0.dylib"
1555         SQLITE3="libsqlite3.0.dylib"
1556         X11="libX11.dylib"
1557         ;;
1558      *-*-*netbsd*)
1559         LIBC="libc.so.12"
1560         INTL="libintl.so.0"
1561         ;;
1562     *-*-*freebsd*)
1563         LIBC="libc.so"
1564         INTL="libintl.so"
1565         ;;
1566     *-*-*openbsd*)
1567         LIBC="libc.so"
1568         INTL="libintl.so"
1569         ;;
1570     *-*-*linux*)
1571         AC_PATH_X
1572         AC_MSG_CHECKING(for the soname of libX11.so)
1573         for i in $x_libraries /usr/lib /usr/lib64; do
1574                 for r in 4 5 6; do
1575                         if test -f $i/libX11.so.$r; then
1576                                 X11=libX11.so.$r
1577                                 AC_MSG_RESULT($X11)
1578                         fi
1579                 done
1580         done
1581         
1582         if test "x$X11" = "xlibX11.so"; then
1583                 AC_MSG_WARN([Could not find X development libs. Do you have the -devel package installed? WinForms may not work...]);
1584         fi
1585         ;;
1586 esac
1587
1588
1589 AC_SUBST(libsuffix)
1590
1591 if test "x$TARGET" != "xAMD64"; then
1592    # valgrind headers don't compile under x86-64
1593    AC_CHECK_HEADERS(valgrind/memcheck.h)
1594 fi
1595
1596 if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
1597         if test "x$with_tls" = "x__thread"; then
1598                 #
1599                 # On some linux distributions, TLS works in executables, but linking 
1600                 # against a shared library containing TLS fails with:
1601                 # undefined reference to `__tls_get_addr'
1602                 #
1603                 rm -f conftest.c conftest.so conftest
1604                 echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
1605                 $CC -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
1606                 $CC -o conftest conftest.so > /dev/null 2>&1
1607                 if test ! -f conftest; then
1608                    AC_MSG_WARN([Disabling usage of __thread.]);
1609                    with_tls=pthread
1610                 fi
1611                 rm -f conftest.c conftest.so conftest
1612         fi
1613 fi
1614
1615 if test "x$with_tls" = "x__thread"; then
1616         AC_DEFINE(HAVE_KW_THREAD)
1617    # Pass the information to libgc
1618         CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
1619         export CPPFLAGS
1620         AC_MSG_CHECKING(if the tls_model attribute is supported)
1621         AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
1622                 ], [
1623                         AC_MSG_RESULT(yes)
1624                         AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tld_model available])
1625                 ], [
1626                         AC_MSG_RESULT(no)
1627         ])
1628 fi
1629
1630 if test ${TARGET} = ARM; then
1631         dnl ******************************************
1632         dnl *** Check to see what FPU is available ***
1633         dnl ******************************************
1634         AC_MSG_CHECKING(which FPU to use)
1635
1636         AC_TRY_COMPILE([], [
1637                 __asm__ ("ldfd f0, [r0]");
1638                 ], fpu=FPA, [
1639                         AC_TRY_COMPILE([], [
1640                                 __asm__ ("fldd d0, [r0]");
1641                         ], fpu=VFP, fpu=NONE)
1642                 ])
1643
1644         AC_MSG_RESULT($fpu)
1645         CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
1646         unset fpu
1647 fi
1648
1649 if test ${TARGET} = unknown; then
1650         CPPFLAGS="$CPPFLAGS -DNO_PORT"
1651         AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
1652 fi
1653
1654 if test ${ACCESS_UNALIGNED} = no; then
1655         CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
1656 fi
1657
1658 PREVIEW=yes
1659 AC_ARG_WITH(preview, [ --with-preview=yes,no     If you want to install the 2.0 FX preview],[
1660         if test x$with_preview = xno; then
1661               PREVIEW=no
1662         fi
1663 ])
1664
1665 AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
1666
1667 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
1668 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
1669 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
1670 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
1671 AM_CONDITIONAL(X86, test x$TARGET = xX86)
1672 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
1673 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
1674 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
1675 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
1676 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
1677 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
1678 AM_CONDITIONAL(S390, test x$TARGET = xS390)
1679 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
1680 AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
1681
1682 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
1683 AM_CONDITIONAL(INTERP_SUPPORTED, test x$interp_wanted = xtrue)
1684 AM_CONDITIONAL(INCLUDED_LIBGC, test x$gc = xincluded)
1685
1686 AC_SUBST(LIBC)
1687 AC_SUBST(INTL)
1688 AC_SUBST(SQLITE)
1689 AC_SUBST(SQLITE3)
1690 AC_SUBST(X11)
1691
1692 AC_SUBST(arch_target)
1693 AC_SUBST(CFLAGS)
1694 AC_SUBST(CPPFLAGS)
1695 AC_SUBST(LDFLAGS)
1696
1697 mono_build_root=`pwd`
1698 AC_SUBST(mono_build_root)
1699
1700 if test x$USEJIT = xtrue; then
1701   mono_runtime=mono/mini/mono
1702 else
1703   mono_runtime=mono/interpreter/mint
1704 fi
1705 AC_SUBST(mono_runtime)
1706
1707 mono_cfg_root=$mono_build_root/runtime
1708 if test x$platform_win32 = xyes; then
1709   mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
1710 else
1711   mono_cfg_dir=$mono_cfg_root/etc
1712 fi
1713 AC_SUBST(mono_cfg_dir)
1714
1715 AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
1716 AC_CONFIG_FILES([runtime/monodis-wrapper],[chmod +x runtime/monodis-wrapper])
1717 AC_CONFIG_FILES([runtime/semdel-wrapper],[chmod +x runtime/semdel-wrapper])
1718
1719 AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
1720 [   depth=../../../..
1721     case $srcdir in
1722     [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1723     .) reldir=$depth ;;
1724     *) reldir=$depth/$srcdir ;;
1725     esac
1726     $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
1727     cd runtime/etc/mono/1.0
1728     rm -f machine.config
1729     $LN_S $reldir/data/net_1_1/machine.config machine.config
1730     cd $depth
1731 ],[LN_S='$LN_S'])
1732
1733 AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
1734 [   depth=../../../..
1735     case $srcdir in
1736     [\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
1737     .) reldir=$depth ;;
1738     *) reldir=$depth/$srcdir ;;
1739     esac
1740     $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
1741     cd runtime/etc/mono/2.0
1742     rm -f machine.config
1743     $LN_S $reldir/data/net_2_0/machine.config machine.config
1744     cd $depth
1745 ],[LN_S='$LN_S'])
1746
1747 AC_OUTPUT([
1748 Makefile
1749 mint.pc
1750 mono.pc
1751 dotnet.pc
1752 mono-uninstalled.pc
1753 scripts/mono-nunit.pc
1754 scripts/mono-find-provides
1755 scripts/mono-find-requires
1756 mono/Makefile
1757 mono/utils/Makefile
1758 mono/metadata/Makefile
1759 mono/dis/Makefile
1760 mono/cil/Makefile
1761 mono/arch/Makefile
1762 mono/os/Makefile
1763 mono/os/win32/Makefile
1764 mono/os/unix/Makefile
1765 mono/arch/x86/Makefile
1766 mono/arch/amd64/Makefile
1767 mono/arch/hppa/Makefile
1768 mono/arch/ppc/Makefile
1769 mono/arch/sparc/Makefile
1770 mono/arch/s390/Makefile
1771 mono/arch/s390x/Makefile
1772 mono/arch/arm/Makefile
1773 mono/arch/alpha/Makefile
1774 mono/arch/ia64/Makefile
1775 mono/interpreter/Makefile
1776 mono/tests/Makefile
1777 mono/tests/tests-config
1778 mono/benchmark/Makefile
1779 mono/monoburg/Makefile
1780 mono/monograph/Makefile
1781 mono/io-layer/Makefile
1782 mono/mini/Makefile
1783 mono/handles/Makefile
1784 mono/profiler/Makefile
1785 ikvm-native/Makefile
1786 scripts/Makefile
1787 man/Makefile
1788 web/Makefile
1789 docs/Makefile
1790 data/Makefile
1791 data/net_1_1/Makefile
1792 data/net_2_0/Makefile
1793 samples/Makefile
1794 support/Makefile
1795 data/config
1796 tools/Makefile
1797 tools/locale-builder/Makefile
1798 runtime/Makefile
1799 ])
1800
1801 if test x$platform_win32 = xyes; then
1802    # Get rid of 'cyg' prefixes in library names
1803    sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
1804 fi
1805
1806 (
1807   case $prefix in
1808   NONE) prefix=$ac_default_prefix ;;
1809   esac
1810   case $exec_prefix in
1811   NONE) exec_prefix='${prefix}' ;;
1812   esac
1813
1814   test -w $srcdir/$mcsdir/build || chmod +w $srcdir/$mcsdir/build
1815
1816   #
1817   # If we are cross compiling, we don't build in the mcs/ tree.  Let us not clobber
1818   # any existing config.make.  This allows people to share the same source tree
1819   # with different build directories, one native and one cross
1820   #
1821   if test x$cross_compiling = xno; then
1822     echo "prefix=$prefix" > $srcdir/$mcsdir/build/config.make
1823     echo "exec_prefix=$exec_prefix" >> $srcdir/$mcsdir/build/config.make
1824     echo 'mono_libdir=${exec_prefix}/lib' >> $srcdir/$mcsdir/build/config.make
1825     echo 'MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)' >> $srcdir/$mcsdir/build/config.make
1826     echo 'IL_FLAGS = /debug' >> $srcdir/$mcsdir/build/config.make
1827     echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $srcdir/$mcsdir/build/config.make
1828     echo "ILDISASM = $mono_build_root/runtime/monodis-wrapper" >> $srcdir/$mcsdir/build/config.make
1829     echo "INSTALL = $INSTALL" >> $srcdir/$mcsdir/build/config.make
1830
1831     export VERSION
1832     [myver=$($AWK 'BEGIN {
1833       split (ENVIRON["VERSION"] ".0.0.0", vsplit, ".")
1834       print vsplit [1] "." vsplit [2] "." vsplit [3] "." vsplit [4]
1835     }')]
1836
1837     echo "MONO_VERSION = $myver" >> $srcdir/$mcsdir/build/config.make
1838   fi
1839 )
1840
1841 libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
1842
1843 echo "
1844         mcs source:  $mcs_topdir
1845         GC:          $gc
1846         Globalization:     $enable_glob
1847         TLS:         $with_tls
1848         SIGALTSTACK: $with_sigaltstack
1849         Engine:      $jit_status
1850         2.0 Alpha:   $PREVIEW
1851         JNI support: $jdk_headers_found
1852         libgdiplus:  $libgdiplus_msg
1853         $disabled
1854
1855 "