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