2003-10-09 Dick Porter <dick@ximian.com>
[mono.git] / configure.in
1 AC_INIT(README)
2 AC_CANONICAL_SYSTEM
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(mono,0.28)
5 AM_MAINTAINER_MODE
6
7 dnl
8 dnl libgc checks
9 dnl
10
11 gc_headers=no
12 gc=included
13 use_included_gc=no
14
15 if test -d $srcdir/libgc ; then
16   gc_default=included
17 else
18   gc_default=boehm
19 fi
20
21 #
22 # These are the flags that need to be stored in the mono.pc file for 
23 # compiling code that will embed Mono
24 #
25 libmono_cflags=""
26 libmono_ldflags=""
27 AC_SUBST(libmono_cflags)
28 AC_SUBST(libmono_ldflags)
29
30 # Thread configuration inspired by sleepycat's db
31 AC_MSG_CHECKING([host platform characteristics])
32 libgc_threads=no
33 case "$host" in
34         *-*-mingw*|*-*-cygwin*)
35                 platform_win32=yes
36                 AC_DEFINE(PLATFORM_WIN32)
37                 CC="gcc -mno-cygwin"
38                 HOST_CC="gcc"
39 # latest libgc already defines GC_WIN32_THREADS
40 #               CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
41                 CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
42                 libdl=
43                 libgc_threads=win32
44                 gc_default=boehm 
45                 ;;
46         *-*-*netbsd*)
47                 platform_win32=no
48                 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
49                 libmono_cflags="-D_REENTRANT"
50                 LDFLAGS="$LDFLAGS -pthread"
51                 libmono_ldflags="-pthread"
52                 AC_DEFINE(NEED_LINK_UNLINK)
53                 libdl=
54                 libgc_threads=pthreads
55                 ;;
56         *-*-*freebsd*|*-*-*openbsd*)
57                 platform_win32=no
58                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
59                 libmono_cflags="-D_THREAD_SAFE"
60                 LDFLAGS="$LDFLAGS -pthread"
61                 libmono_ldflags="-pthread"
62                 AC_DEFINE(NEED_LINK_UNLINK)
63                 AC_DEFINE(PTHREAD_POINTER_ID)
64                 libdl=
65                 libgc_threads=pthreads
66                 ;;
67         *-*-linux*)
68                 platform_win32=no
69                 CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
70                 libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
71                 libmono_ldflags="-lpthread"
72                 libdl="-ldl"
73                 libgc_threads=pthreads
74                 ;;
75         *-*-hpux*)
76                 platform_win32=no
77                 CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
78                 libmono_cflags="-D_REENTRANT"
79                 libmono_ldflags="-lpthread"
80                 libgc_threads=pthreads
81                 AC_DEFINE(NEED_LINK_UNLINK)
82                 ;;
83         *-*-solaris*)
84                 platform_win32=no
85                 CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
86                 AC_DEFINE(NEED_LINK_UNLINK)
87                 libmono_cflags="-D_REENTRANT"
88                 libgc_threads=pthreads
89                 ;;
90         *-*-darwin*)
91                 platform_win32=no
92                 CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
93                 libmono_cflags="-D_THREAD_SAFE"
94                 LDFLAGS="$LDFLAGS -pthread"
95                 libmono_ldflags="-pthread"
96                 AC_DEFINE(NEED_LINK_UNLINK)
97                 AC_DEFINE(PTHREAD_POINTER_ID)
98                 libdl=
99                 libgc_threads=no
100                 gc_default=none 
101                 ;;
102         *)
103                 AC_MSG_WARN([*** Please add $host to configure.in checks!])
104                 platform_win32=no
105                 libdl="-ldl"
106                 ;;
107 esac
108 AC_MSG_RESULT(ok)
109 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
110
111 AC_CHECK_TOOL(CC, gcc, gcc)
112 AC_PROG_CC
113 AM_PROG_CC_STDC
114 AC_PROG_INSTALL
115 dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
116 : ${CCAS='$(CC)'}
117 # Set ASFLAGS if not already set.
118 : ${CCASFLAGS='$(CFLAGS)'}
119 AC_SUBST(CCAS)
120 AC_SUBST(CCASFLAGS)
121
122 AC_CHECK_PROG(BISON, bison,yes,no)
123 if test "x$BISON" = "xno";
124 then
125         AC_MSG_ERROR([You need to install bison])
126 fi
127
128 dnl may require a specific autoconf version
129 dnl AC_PROG_CC_FOR_BUILD
130 dnl CC_FOR_BUILD not automatically detected
131 CC_FOR_BUILD=$CC
132 BUILD_EXEEXT=
133 if test "x$cross_compiling" = "xyes"; then
134         CC_FOR_BUILD=cc
135         BUILD_EXEEXT=""
136 fi
137 AC_SUBST(CC_FOR_BUILD)
138 AC_SUBST(HOST_CC)
139 AC_SUBST(BUILD_EXEEXT)
140
141 # Set STDC_HEADERS
142 AC_HEADER_STDC
143 AC_LIBTOOL_WIN32_DLL
144 AM_PROG_LIBTOOL
145
146 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
147
148 # for mono/mini/tramp-x86.c
149 AC_CHECK_HEADERS(valgrind/memcheck.h)
150
151 # for mono/metadata/debug-symfile.c
152 AC_CHECK_HEADERS(elf.h)
153
154 # for mono/dis
155 AC_CHECK_HEADERS(wchar.h)
156
157 # not 64 bit clean in cross-compile
158 AC_CHECK_SIZEOF(void *, 4)
159
160 WARN=''
161 if test x"$GCC" = xyes; then
162         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
163 fi
164 CFLAGS="-g $WARN"
165
166 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
167 if test "x$PKG_CONFIG" = "xno"; then
168         AC_MSG_ERROR([You need to install pkg-config])
169 fi
170
171 dnl for use on the build system
172 dnl pkg-config is stupid
173 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
174 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
175 AC_SUBST(BUILD_GLIB_CFLAGS)
176 AC_SUBST(BUILD_GLIB_LIBS)
177
178 PKG_PATH=
179 AC_ARG_WITH(crosspkgdir, [  --with-crosspkgdir=/path/to/pkg-config/dir],
180         if test x$with_crosspkgdir = "x"; then
181                 if test -s $PKG_CONFIG_PATH; then
182                         PKG_PATH=$PKG_CONFIG_PATH
183                 fi
184         else
185                 PKG_PATH=$with_crosspkgdir
186                 PKG_CONFIG_PATH=$PKG_PATH
187                 export PKG_CONFIG_PATH
188         fi
189 )
190
191 ## Versions of dependencies
192 GLIB_REQUIRED_VERSION=1.3.11
193
194 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
195
196 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
197 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
198 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
199 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
200
201 AC_SUBST(GLIB_CFLAGS)
202 AC_SUBST(GLIB_LIBS)
203 AC_SUBST(GMODULE_CFLAGS)
204 AC_SUBST(GMODULE_LIBS)
205
206 AC_ARG_WITH(gc, [  --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
207
208 # assembly bundle support, see metadata/make-bundle.pl for more info
209 AC_ARG_WITH(bundle, [  --with-bundle=bundle_template],[
210         BUNDLE_FILE=$with_bundle
211         AC_SUBST(BUNDLE_FILE)
212         AC_DEFINE(WITH_BUNDLE)
213 ],[with_bundle=no])
214 AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
215
216 LIBGC_CFLAGS=
217 LIBGC_LIBS=
218 libgc_dir=
219 case "x$gc" in
220         xboehm|xbohem|xyes)
221                 AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
222                 AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
223
224                 if test "x$found_boehm" != "xyes"; then
225                         AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
226                 fi
227                 if test "x$gc_headers" != "xyes"; then
228                         AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
229                 fi
230
231                 AC_DEFINE(HAVE_BOEHM_GC)
232                 AC_SUBST(HAVE_BOEHM_GC)
233                 LIBGC_LIBS="-lgc $libdl"
234
235                 # AC_CHECK_FUNCS does not work for some reason...
236                 AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
237                 if test "x$found_gcj_malloc" = "xyes"; then
238                         AC_DEFINE(HAVE_GC_GCJ_MALLOC)
239                 fi
240                 ;;
241
242         xincluded)
243                 AC_CONFIG_SUBDIRS(libgc)
244
245                 found_boehm=yes
246                 gc_headers=yes
247                 use_included_gc=yes
248                 libgc_dir=libgc
249
250                 LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
251                 LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
252
253                 AC_DEFINE(HAVE_BOEHM_GC)
254                 AC_SUBST(HAVE_BOEHM_GC)
255
256                 AC_DEFINE(HAVE_GC_H)
257                 AC_DEFINE(USE_INCLUDED_LIBGC)
258
259                 # The included libgc contains GCJ support
260                 AC_DEFINE(HAVE_GC_GCJ_MALLOC)
261                 ;;
262
263         xnone)
264                 AC_MSG_WARN("Compiling mono without GC.")
265                 ;;
266         *)
267                 AC_MSG_ERROR([Invalid argument to --with-gc.])
268                 ;;
269 esac
270
271 we_are_embedded_in_mono=yes
272 export we_are_embedded_in_mono
273 export libgc_threads
274
275 AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
276 AC_SUBST(LIBGC_CFLAGS)
277 AC_SUBST(LIBGC_LIBS)
278 AC_SUBST(libgc_dir)
279
280 dnl
281 dnl End of libgc checks
282 dnl
283
284 if test x$platform_win32 = xno; then
285         dnl ******************************************************************
286         dnl *** Check for large file support                               ***
287         dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
288         dnl ******************************************************************
289         
290         # Check that off_t can represent 2**63 - 1 correctly, working around
291         # potential compiler bugs.  Defines LARGE_FILE_SUPPORT, adds $1 to
292         # CPPFLAGS and sets $large_offt to yes if the test succeeds
293         large_offt=no
294         AC_DEFUN(LARGE_FILES, [
295                 large_CPPFLAGS=$CPPFLAGS
296                 CPPFLAGS="$CPPFLAGS $1"
297                 AC_TRY_RUN([
298                         #include <sys/types.h>
299
300                         #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
301
302                         int main(void) {
303                                 int big_off_t=((BIG_OFF_T%2147483629==721) &&
304                                                (BIG_OFF_T%2147483647==1));
305                                 if(big_off_t) {
306                                         exit(0);
307                                 } else {
308                                         exit(1);
309                                 }
310                         }
311                 ], [
312                         AC_MSG_RESULT(ok)
313                         AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
314                         large_CPPFLAGS="$large_CPPFLAGS $1"
315                         large_offt=yes
316                 ], [
317                         AC_MSG_RESULT(no)
318                 ], "")
319                 CPPFLAGS=$large_CPPFLAGS
320         ])
321
322         AC_MSG_CHECKING(if off_t is 64 bits wide)
323         LARGE_FILES("")
324         if test $large_offt = no; then
325                 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
326                 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
327         fi
328         if test $large_offt = no; then
329                 AC_MSG_WARN([No 64 bit file size support available])
330         fi
331         
332         dnl *****************************
333         dnl *** Checks for libsocket  ***
334         dnl *****************************
335         AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
336
337         dnl *******************************
338         dnl *** Checks for MSG_NOSIGNAL ***
339         dnl *******************************
340         AC_MSG_CHECKING(for MSG_NOSIGNAL)
341         AC_TRY_COMPILE([#include <sys/socket.h>], [
342                 int f = MSG_NOSIGNAL;
343         ], [
344                 # Yes, we have it...
345                 AC_MSG_RESULT(yes)
346                 AC_DEFINE(HAVE_MSG_NOSIGNAL)
347         ], [
348                 # We'll have to use signals
349                 AC_MSG_RESULT(no)
350         ])
351
352         dnl *****************************
353         dnl *** Checks for SOL_IP     ***
354         dnl *****************************
355         AC_MSG_CHECKING(for SOL_IP)
356         AC_TRY_COMPILE([#include <netdb.h>], [
357                 int level = SOL_IP;
358         ], [
359                 # Yes, we have it...
360                 AC_MSG_RESULT(yes)
361                 AC_DEFINE(HAVE_SOL_IP)
362         ], [
363                 # We'll have to use getprotobyname
364                 AC_MSG_RESULT(no)
365         ])
366
367         dnl *****************************
368         dnl *** Checks for SOL_IPV6     ***
369         dnl *****************************
370         AC_MSG_CHECKING(for SOL_IPV6)
371         AC_TRY_COMPILE([#include <netdb.h>], [
372                 int level = SOL_IPV6;
373         ], [
374                 # Yes, we have it...
375                 AC_MSG_RESULT(yes)
376                 AC_DEFINE(HAVE_SOL_IPV6)
377         ], [
378                 # We'll have to use getprotobyname
379                 AC_MSG_RESULT(no)
380         ])
381
382         dnl *****************************
383         dnl *** Checks for SOL_TCP    ***
384         dnl *****************************
385         AC_MSG_CHECKING(for SOL_TCP)
386         AC_TRY_COMPILE([#include <netdb.h>], [
387                 int level = SOL_TCP;
388         ], [
389                 # Yes, we have it...
390                 AC_MSG_RESULT(yes)
391                 AC_DEFINE(HAVE_SOL_TCP)
392         ], [
393                 # We'll have to use getprotobyname
394                 AC_MSG_RESULT(no)
395         ])
396
397         dnl *****************************
398         dnl *** Checks for IP_PKTINFO ***
399         dnl *****************************
400         AC_MSG_CHECKING(for IP_PKTINFO)
401         AC_TRY_COMPILE([#include <netdb.h>], [
402                 int level = IP_PKTINFO;
403         ], [
404                 # Yes, we have it...
405                 AC_MSG_RESULT(yes)
406                 AC_DEFINE(HAVE_IP_PKTINFO)
407         ], [
408                 AC_MSG_RESULT(no)
409         ])
410
411         dnl *********************************
412         dnl *** Check for struct ip_mreqn ***
413         dnl *********************************
414         AC_MSG_CHECKING(for struct ip_mreqn)
415         AC_TRY_COMPILE([#include <netinet/in.h>], [
416                 struct ip_mreqn mreq;
417                 mreq.imr_address.s_addr = 0;
418         ], [
419                 # Yes, we have it...
420                 AC_MSG_RESULT(yes)
421                 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
422         ], [
423                 # We'll just have to try and use struct ip_mreq
424                 AC_MSG_RESULT(no)
425                 AC_MSG_CHECKING(for struct ip_mreq)
426                 AC_TRY_COMPILE([#include <netinet/in.h>], [
427                         struct ip_mreq mreq;
428                         mreq.imr_interface.s_addr = 0;
429                 ], [
430                         # Yes, we have it...
431                         AC_MSG_RESULT(yes)
432                         AC_DEFINE(HAVE_STRUCT_IP_MREQ)
433                 ], [
434                         # No multicast support
435                         AC_MSG_RESULT(no)
436                 ])
437         ])
438         
439         dnl **********************************
440         dnl *** Check for gethostbyname2_r ***
441         dnl **********************************
442         AC_MSG_CHECKING(for gethostbyname2_r)
443                 AC_TRY_LINK([#include <netdb.h>], [
444                 gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
445         ], [
446                 # Yes, we have it...
447                 AC_MSG_RESULT(yes)
448                 AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
449         ])
450
451         dnl *****************************
452         dnl *** Checks for libnsl     ***
453         dnl *****************************
454         AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
455
456         AC_CHECK_FUNCS(inet_pton inet_aton)
457
458         dnl ***********************************************
459         dnl *** Checks for size of sockaddr_un.sun_path ***
460         dnl ***********************************************
461         # AC_CHECK_SIZEOF can't cope with struct members :-(
462         AC_MSG_CHECKING(size of sockaddr_un.sun_path)
463         AC_CACHE_VAL(cv_mono_sizeof_sunpath,
464                 [AC_TRY_RUN([
465                         #include <sys/types.h>
466                         #include <stdio.h>
467                         #include <sys/un.h>
468
469                         int main(void) {
470                                 struct sockaddr_un sock_un;
471                                 FILE *f=fopen("conftestval", "w");
472                                 if(!f) exit(1);
473                                 fprintf(f, "%d\n", sizeof(sock_un.sun_path));
474                                 exit(0);
475                         }
476                 ], cv_mono_sizeof_sunpath=`cat conftestval`,
477                    cv_mono_sizeof_sunpath=0,
478                    cv_mono_sizeof_sunpath=0)])dnl
479         AC_MSG_RESULT($cv_mono_sizeof_sunpath)
480         AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
481
482         dnl *************************************
483         dnl *** Checks for zero length arrays ***
484         dnl *************************************
485         AC_MSG_CHECKING(whether $CC supports zero length arrays)
486         AC_TRY_COMPILE([
487                 struct s {
488                         int  length;
489                         char data [0];
490                 };
491         ], [], [
492                 AC_MSG_RESULT(yes)
493                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0)
494         ], [
495                 AC_MSG_RESULT(no)
496                 AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1)
497         ])
498
499         dnl *****************************
500         dnl *** Checks for libxnet    ***
501         dnl *****************************
502         case "${host}" in
503                 *solaris* )
504                         AC_MSG_CHECKING(for Solaris XPG4 support)
505                         if test -f /usr/lib/libxnet.so; then
506                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
507                                 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
508                                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
509                                 LIBS="$LIBS -lxnet"
510                                 AC_MSG_RESULT(yes)
511                         else
512                                 AC_MSG_RESULT(no)
513                         fi
514
515                         if test "$GCC" = "yes"; then
516                                 CFLAGS="$CFLAGS -Wno-char-subscripts"
517                         fi
518                 ;;
519         esac
520
521         dnl *****************************
522         dnl *** Checks for libpthread ***
523         dnl *****************************
524         AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
525         AC_CHECK_FUNCS(pthread_mutex_timedlock)
526         AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
527         AC_TRY_COMPILE([ #include <pthread.h>], [
528                 pthread_mutexattr_t attr;
529                 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
530         ], [
531                 AC_MSG_RESULT(ok)
532         ], [
533                 AC_MSG_RESULT(no)
534                 AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
535                 AC_DEFINE(USE_MONO_MUTEX)
536         ])
537
538         dnl ********************************
539         dnl *** Checks for semaphore lib ***
540         dnl ********************************
541         AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
542
543         dnl ********************************
544         dnl *** Checks for timezone stuff **
545         dnl ********************************
546         AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
547                 AC_TRY_COMPILE([
548                         #include <time.h>
549                         ], [
550                         struct tm tm;
551                         tm.tm_gmtoff = 1;
552                         ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
553         if test $ac_cv_struct_tm_gmtoff = yes; then
554                 AC_DEFINE(HAVE_TM_GMTOFF)
555         else
556                 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
557                         AC_TRY_COMPILE([
558                                 #include <time.h>
559                         ], [
560                                 timezone = 1;
561                         ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
562                 if test $ac_cv_var_timezone = yes; then
563                         AC_DEFINE(HAVE_TIMEZONE)
564                 else
565                         AC_ERROR(unable to find a way to determine timezone)
566                 fi
567         fi
568
569         dnl ****************************************************************
570         dnl *** Checks for working poll() (macosx defines it but doesn't ***
571         dnl *** have it in the library (duh))                            ***
572         dnl ****************************************************************
573         AC_CHECK_FUNCS(poll)
574 else
575         AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
576         AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
577 fi
578
579 dnl ****************************
580 dnl *** Look for /dev/random ***
581 dnl ****************************
582
583 AC_MSG_CHECKING([if usage of random device is requested])
584 AC_ARG_ENABLE(dev-random,
585 [  --disable-dev-random    disable the use of the random device],
586 try_dev_random=$enableval, try_dev_random=yes)
587 AC_MSG_RESULT($try_dev_random)
588
589 case "{$target}" in
590     *-openbsd*)
591     NAME_DEV_RANDOM="/dev/srandom"
592     ;;
593
594 dnl Win32 does not have /dev/random, they have their own method...
595
596     *-*-mingw*|*-*-cygwin*)
597     ac_cv_have_dev_random = no
598     ;;
599
600 dnl Everywhere else, it's /dev/random
601
602     *)
603     NAME_DEV_RANDOM="/dev/random"
604     ;;
605 esac
606
607 AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
608
609 dnl Now check if the device actually exists
610
611 if test "x$try_dev_random" = "xyes"; then
612     AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
613     [if test -r "$NAME_DEV_RANDOM" ; then
614         ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
615     if test "x$ac_cv_have_dev_random" = "xyes"; then
616         AC_DEFINE(HAVE_CRYPT_RNG)
617     fi
618 else
619     AC_MSG_CHECKING(for random device)
620     ac_cv_have_dev_random=no
621     AC_MSG_RESULT(has been disabled)
622 fi
623
624 if test "x$platform_win32" = "xyes"; then
625     AC_DEFINE(HAVE_CRYPT_RNG)
626 fi
627
628 if test "x$ac_cv_have_dev_random" = "xno" \
629     && test "x$platform_win32" = "xno"; then
630     AC_MSG_WARN([[
631 ***
632 *** A system-provided entropy source was not found on this system.
633 *** Because of this, the System.Security.Cryptography random number generator
634 *** will throw a NotImplemented exception.
635 ***
636 *** If you are seeing this message, and you know your system DOES have an
637 *** entropy collection in place, please contact <crichton@gimp.org> and
638 *** provide information about the system and how to access the random device.
639 ***
640 *** For those systems who lack a random device, EGD support is forthcoming.
641 ***]])
642 fi
643  
644 AC_MSG_CHECKING([if inter-process shared handles are requested])
645 AC_ARG_ENABLE(shared-handles, [  --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
646 AC_MSG_RESULT($try_shared_handles)
647 if test "x$try_shared_handles" != "xyes"; then
648         AC_DEFINE(DISABLE_SHARED_HANDLES)
649         AC_SUBST(DISABLE_SHARED_HANDLES)
650 fi
651
652 ICU_CFLAGS=""
653 ICU_LIBS=""
654 AC_PATH_PROG(ICU_CONFIG, icu-config, no)
655 if test "x$ICU_CONFIG" = "xno"; then
656         AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
657 else
658         AC_DEFINE(HAVE_ICU)
659         ICU_CFLAGS=`$ICU_CONFIG --cppflags`
660         ICU_LIBS=`$ICU_CONFIG --ldflags`
661 fi
662 AC_SUBST(ICU_CFLAGS)
663 AC_SUBST(ICU_LIBS)
664
665 TARGET="unknown"
666 ACCESS_UNALIGNED="yes"
667
668 JIT_SUPPORTED=no
669 LIBC="libc.so.6"
670
671 case "$host" in
672 #       mips-sgi-irix5.* | mips-sgi-irix6.*)
673 #               TARGET=MIPS;
674 #               ACCESS_UNALIGNED="no"
675 #               ;;
676         i*86-*-*)
677                 TARGET=X86;
678                 arch_target=x86;
679                 JIT_SUPPORTED=yes
680                 ;;
681         sparc*-*-*)
682                 TARGET=SPARC;
683                 arch_target=sparc;
684                 ACCESS_UNALIGNED="no"
685                 ;;
686 #       alpha*-*-linux* | alpha*-*-osf*)
687 #               TARGET=ALPHA;
688 #               ACCESS_UNALIGNED="no"
689 #              ;;
690 #       ia64-*-linux* | ia64-*-hpux*)
691 #               TARGET=IA64;
692 #               arch_target=ia64;
693 #               JIT_SUPPORTED=no;
694 #               ACCESS_UNALIGNED="no";
695 #               case "$host_os" in
696 #                       linux*) LIBC="libc.so.6.1";;
697 #                       hpux*)  LIBC="libc.so.1";;
698 #               esac
699 #               ;;
700 #       m68k-*-linux*)
701 #               TARGET=M68K
702 #               ;;
703         macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
704         powerpc-*-sysv* | powerpc-*-darwin*)
705                 TARGET=POWERPC;
706                 arch_target=ppc;
707                 JIT_SUPPORTED=yes
708                 ;;
709         arm-*-linux-* | armv4l-*-linux-*)
710                 TARGET=ARM;
711                 arch_target=arm;
712                 ACCESS_UNALIGNED="no"
713                 ;;
714         s390-*-linux*)
715                 TARGET=S390;
716                 arch_target=s390;
717                 ACCESS_UNALIGNED="no"
718                 ;;
719 esac
720
721 if test ${TARGET} = ARM; then
722         dnl ******************************************
723         dnl *** Check to see what FPU is available ***
724         dnl ******************************************
725         AC_MSG_CHECKING(which FPU to use)
726
727         AC_TRY_COMPILE([], [
728                 __asm__ ("ldfd f0, [r0]");
729                 ], fpu=FPA, [
730                         AC_TRY_COMPILE([], [
731                                 __asm__ ("fldd d0, [r0]");
732                         ], fpu=VFP, fpu=NONE)
733                 ])
734
735         AC_MSG_RESULT($fpu)
736         CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu"
737         unset fpu
738 fi
739
740 if test ${TARGET} = unknown; then
741         CPPFLAGS="$CPPFLAGS -DNO_PORT"
742         AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
743 fi
744
745 if test ${ACCESS_UNALIGNED} = no; then
746         CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
747 fi
748
749 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
750 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
751 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
752 AM_CONDITIONAL(X86, test x$TARGET = xX86)
753 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
754 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
755 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
756 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
757 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
758 AM_CONDITIONAL(S390, test x$TARGET = xS390)
759
760 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
761
762 AC_SUBST(LIBC)
763
764 AC_SUBST(arch_target)
765 AC_SUBST(CFLAGS)
766 AC_SUBST(CPPFLAGS)
767 AC_SUBST(LDFLAGS)
768
769 AC_OUTPUT([
770 Makefile
771 mono.pc
772 mono/Makefile
773 mono/utils/Makefile
774 mono/metadata/Makefile
775 mono/dis/Makefile
776 mono/cil/Makefile
777 mono/arch/Makefile
778 mono/os/Makefile
779 mono/os/win32/Makefile
780 mono/os/unix/Makefile
781 mono/arch/x86/Makefile
782 mono/arch/ppc/Makefile
783 mono/arch/sparc/Makefile
784 mono/arch/s390/Makefile
785 mono/arch/arm/Makefile
786 mono/arch/alpha/Makefile
787 mono/interpreter/Makefile
788 mono/tests/Makefile
789 mono/tests/tests-config
790 mono/benchmark/Makefile
791 mono/monoburg/Makefile
792 mono/monograph/Makefile
793 mono/io-layer/Makefile
794 mono/handles/Makefile
795 mono/mini/Makefile
796 mono/profiler/Makefile
797 runtime/Makefile
798 scripts/Makefile
799 man/Makefile
800 doc/Makefile
801 docs/Makefile
802 data/Makefile
803 samples/Makefile
804 data/config
805 mono.spec
806 ])
807
808 echo "
809
810         GC:     $gc
811
812 "