Remove sqlsharp as we no longer distribute it.
[mono.git] / configure.in
index a280453fd93247c5ef1477a95b90640fb2a9b3dc..56369722cfac5bd5da71f902b72e9d29e3c41ea6 100644 (file)
@@ -1,47 +1,95 @@
 AC_INIT(README)
 AC_CANONICAL_SYSTEM
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono, 0.17)
+AM_INIT_AUTOMAKE(mono,0.25.99.2)
 AM_MAINTAINER_MODE
 
+dnl
+dnl libgc checks
+dnl
+
+gc_headers=no
+gc=included
+use_included_gc=no
+
+if test -d $srcdir/libgc ; then
+  gc_default=included
+else
+  gc_default=boehm
+fi
+
 #
 # These are the flags that need to be stored in the mono.pc file for 
 # compiling code that will embed Mono
 #
 libmono_cflags=""
+libmono_ldflags=""
 AC_SUBST(libmono_cflags)
+AC_SUBST(libmono_ldflags)
 
 # Thread configuration inspired by sleepycat's db
 AC_MSG_CHECKING([host platform characteristics])
+libgc_threads=no
 case "$host" in
        *-*-mingw*|*-*-cygwin*)
                platform_win32=yes
                AC_DEFINE(PLATFORM_WIN32)
                CC="gcc -mno-cygwin"
                HOST_CC="gcc"
-               CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS"
+# latest libgc already defines GC_WIN32_THREADS
+#              CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
+               CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
                libdl=
+               libgc_threads=win32
+               gc_default=boehm 
                ;;
-       *-*-*bsd*)
+       *-*-*netbsd*)
+               platform_win32=no
+               CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+               libmono_cflags="-D_REENTRANT"
+               LDFLAGS="$LDFLAGS -pthread"
+               libmono_ldflags="-pthread"
+               AC_DEFINE(NEED_LINK_UNLINK)
+               libdl=
+               libgc_threads=pthreads
+               ;;
+       *-*-*freebsd*|*-*-*openbsd*)
                platform_win32=no
                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
                libmono_cflags="-D_THREAD_SAFE"
                LDFLAGS="$LDFLAGS -pthread"
+               libmono_ldflags="-pthread"
                AC_DEFINE(NEED_LINK_UNLINK)
                AC_DEFINE(PTHREAD_POINTER_ID)
                libdl=
+               libgc_threads=pthreads
                ;;
        *-*-linux*)
                platform_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
                libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
+               libmono_ldflags="-lpthread"
                libdl="-ldl"
+               libgc_threads=pthreads
                ;;
        *-*-solaris*)
                platform_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
                AC_DEFINE(NEED_LINK_UNLINK)
                libmono_cflags="-D_REENTRANT"
+               libgc_threads=solaris
+               ;;
+       *-*-darwin*)
+               platform_win32=no
+               CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
+               libmono_cflags="-D_THREAD_SAFE"
+               LDFLAGS="$LDFLAGS -pthread"
+               libmono_ldflags="-pthread"
+               AC_DEFINE(NEED_LINK_UNLINK)
+               AC_DEFINE(PTHREAD_POINTER_ID)
+               libdl=
+               libgc_threads=no
+               gc_default=none 
                ;;
        *)
                AC_MSG_WARN([*** Please add $host to configure.in checks!])
@@ -56,6 +104,12 @@ AC_CHECK_TOOL(CC, gcc, gcc)
 AC_PROG_CC
 AM_PROG_CC_STDC
 AC_PROG_INSTALL
+dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
+: ${CCAS='$(CC)'}
+# Set ASFLAGS if not already set.
+: ${CCASFLAGS='$(CFLAGS)'}
+AC_SUBST(CCAS)
+AC_SUBST(CCASFLAGS)
 
 AC_CHECK_PROG(BISON, bison,yes,no)
 if test "x$BISON" = "xno";
@@ -81,7 +135,7 @@ AC_HEADER_STDC
 AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
-AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h)
+AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
 
 # for mono/metadata/debug-symfile.c
 AC_CHECK_HEADERS(elf.h)
@@ -134,16 +188,26 @@ AC_SUBST(GLIB_LIBS)
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
-gc_headers=no
-AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
-AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
-gc=auto
-AC_ARG_WITH(gc, [  --with-gc=boehm,none],[gc=$with_gc])
+AC_ARG_WITH(gc, [  --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
 
+# assembly bundle support, see metadata/make-bundle.pl for more info
+AC_ARG_WITH(bundle, [  --with-bundle=bundle_template],[
+       BUNDLE_FILE=$with_bundle
+       AC_SUBST(BUNDLE_FILE)
+       AC_DEFINE(WITH_BUNDLE)
+],[with_bundle=no])
+AM_CONDITIONAL(WITH_BUNDLE, test x$with_bundle != xno)
+
+LIBGC_CFLAGS=
+LIBGC_LIBS=
+libgc_dir=
 case "x$gc" in
        xboehm|xbohem|xyes)
+               AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
+               AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
+
                if test "x$found_boehm" != "xyes"; then
-                       AC_MSG_ERROR("GC requested but libgc not found!")
+                       AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
                fi
                if test "x$gc_headers" != "xyes"; then
                        AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
@@ -151,27 +215,57 @@ case "x$gc" in
 
                AC_DEFINE(HAVE_BOEHM_GC)
                AC_SUBST(HAVE_BOEHM_GC)
-               LIBS="$LIBS -lgc $libdl"
+               LIBGC_LIBS="-lgc $libdl"
+
+               # AC_CHECK_FUNCS does not work for some reason...
+               AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
+               if test "x$found_gcj_malloc" = "xyes"; then
+                       AC_DEFINE(HAVE_GC_GCJ_MALLOC)
+               fi
                ;;
+
+       xincluded)
+               AC_CONFIG_SUBDIRS(libgc)
+
+               found_boehm=yes
+               gc_headers=yes
+               use_included_gc=yes
+               libgc_dir=libgc
+
+               LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
+               LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
+
+               AC_DEFINE(HAVE_BOEHM_GC)
+               AC_SUBST(HAVE_BOEHM_GC)
+
+               AC_DEFINE(HAVE_GC_H)
+               AC_DEFINE(USE_INCLUDED_LIBGC)
+
+               # The included libgc contains GCJ support
+               AC_DEFINE(HAVE_GC_GCJ_MALLOC)
+               ;;
+
        xnone)
                AC_MSG_WARN("Compiling mono without GC.")
                ;;
        *)
-               # If libgc was found, use it.  Otherwise just warn.
-               if test "x$found_boehm" != "xyes"; then
-                       AC_MSG_WARN("Compiling mono without GC.")
-               else
-                       if test "x$gc_headers" != "xyes"; then
-                               AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
-                       fi
-                       AC_DEFINE(HAVE_BOEHM_GC)
-                       AC_SUBST(HAVE_BOEHM_GC)
-                       LIBS="$LIBS -lgc $libdl"
-                       gc="boehm"
-               fi
+               AC_MSG_ERROR([Invalid argument to --with-gc.])
                ;;
 esac
 
+we_are_embedded_in_mono=yes
+export we_are_embedded_in_mono
+export libgc_threads
+
+AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
+AC_SUBST(LIBGC_CFLAGS)
+AC_SUBST(LIBGC_LIBS)
+AC_SUBST(libgc_dir)
+
+dnl
+dnl End of libgc checks
+dnl
+
 if test x$platform_win32 = xno; then
        dnl ******************************************************************
        dnl *** Check for large file support                               ***
@@ -296,8 +390,32 @@ if test x$platform_win32 = xno; then
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_STRUCT_IP_MREQN)
        ], [
-               # We'll just have to use struct ip_mreq
+               # We'll just have to try and use struct ip_mreq
                AC_MSG_RESULT(no)
+               AC_MSG_CHECKING(for struct ip_mreq)
+               AC_TRY_COMPILE([#include <netinet/in.h>], [
+                       struct ip_mreq mreq;
+                       mreq.imr_interface.s_addr = 0;
+               ], [
+                       # Yes, we have it...
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE(HAVE_STRUCT_IP_MREQ)
+               ], [
+                       # No multicast support
+                       AC_MSG_RESULT(no)
+               ])
+       ])
+       
+       dnl **********************************
+       dnl *** Check for gethostbyname2_r ***
+       dnl **********************************
+       AC_MSG_CHECKING(for gethostbyname2_r)
+               AC_TRY_COMPILE([#include <netdb.h>], [
+               gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
+       ], [
+               # Yes, we have it...
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GETHOSTBYNAME2_R)
        ])
 
        dnl *****************************
@@ -481,13 +599,15 @@ fi
 TARGET="unknown"
 ACCESS_UNALIGNED="yes"
 
+JIT_SUPPORTED=no
+
 case "$host" in
 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
-i*86-*-*) TARGET=X86; arch_target=x86;;
+i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
 sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
 #m68k-*-linux*) TARGET=M68K;;
-macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
+macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
 arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
 s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
 esac
@@ -511,12 +631,15 @@ AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
 AM_CONDITIONAL(S390, test x$TARGET = xS390)
 
+AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
+
 LIBC="libc.so.6"
 AC_SUBST(LIBC)
 
 AC_SUBST(arch_target)
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
 
 AC_OUTPUT([
 Makefile
@@ -535,14 +658,16 @@ mono/arch/ppc/Makefile
 mono/arch/sparc/Makefile
 mono/arch/s390/Makefile
 mono/arch/arm/Makefile
+mono/arch/alpha/Makefile
 mono/interpreter/Makefile
 mono/tests/Makefile
 mono/benchmark/Makefile
 mono/monoburg/Makefile
 mono/monograph/Makefile
-mono/jit/Makefile
 mono/io-layer/Makefile
 mono/handles/Makefile
+mono/mini/Makefile
+mono/profiler/Makefile
 runtime/Makefile
 scripts/Makefile
 man/Makefile