+ dnl ***********************************************
+ dnl *** Checks for size of sockaddr_un.sun_path ***
+ dnl ***********************************************
+ # AC_CHECK_SIZEOF can't cope with struct members :-(
+ AC_MSG_CHECKING(size of sockaddr_un.sun_path)
+ AC_CACHE_VAL(cv_mono_sizeof_sunpath,
+ [AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <sys/un.h>
+
+ int main(void) {
+ struct sockaddr_un sock_un;
+ FILE *f=fopen("conftestval", "w");
+ if(!f) exit(1);
+ fprintf(f, "%d\n", sizeof(sock_un.sun_path));
+ exit(0);
+ }
+ ], cv_mono_sizeof_sunpath=`cat conftestval`,
+ cv_mono_sizeof_sunpath=0,
+ cv_mono_sizeof_sunpath=0)])dnl
+ AC_MSG_RESULT($cv_mono_sizeof_sunpath)
+ AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $cv_mono_sizeof_sunpath)
+
+ dnl *****************************
+ dnl *** Checks for libpthread ***
+ dnl *****************************
+ AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
+ AC_CHECK_FUNCS(pthread_mutex_timedlock)
+ AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
+ AC_TRY_COMPILE([ #include <pthread.h>], [
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ ], [
+ AC_MSG_RESULT(ok)
+ ], [
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
+ AC_DEFINE(USE_MONO_MUTEX)
+ ])
+
+ dnl ********************************
+ dnl *** Checks for semaphore lib ***
+ dnl ********************************
+ AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
+
+ dnl ********************************
+ dnl *** Checks for timezone stuff **
+ dnl ********************************
+ AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ timezone = 1;
+ ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
+ if test $ac_cv_var_timezone = yes; then
+ AC_DEFINE(HAVE_TIMEZONE)
+ else
+ AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ struct tm tm;
+ tm.tm_gmtoff = 1;
+ ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
+ if test $ac_cv_struct_tm_gmtoff = yes; then
+ AC_DEFINE(HAVE_TM_GMTOFF)
+ else
+ AC_ERROR(unable to find a way to determine timezone)
+ fi
+ fi
+else
+ AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
+fi
+
+dnl ****************************
+dnl *** Look for /dev/random ***
+dnl ****************************
+
+AC_MSG_CHECKING([if usage of random device is requested])
+AC_ARG_ENABLE(dev-random,
+[ --disable-dev-random disable the use of the random device],
+try_dev_random=$enableval, try_dev_random=yes)
+AC_MSG_RESULT($try_dev_random)
+
+case "{$target}" in
+ *-openbsd*)
+ NAME_DEV_RANDOM="/dev/srandom"
+ ;;
+
+dnl Win32 does not have /dev/random, they have their own method...
+
+ *-*-mingw*|*-*-cygwin*)
+ ac_cv_have_dev_random = no
+ ;;
+
+dnl Everywhere else, it's /dev/random
+
+ *)
+ NAME_DEV_RANDOM="/dev/random"
+ ;;
+esac
+
+AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
+
+dnl Now check if the device actually exists
+
+if test "x$try_dev_random" = "xyes"; then
+ AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
+ [if test -r "$NAME_DEV_RANDOM" ; then
+ ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
+ if test "x$ac_cv_have_dev_random" = "xyes"; then
+ AC_DEFINE(HAVE_CRYPT_RNG)
+ fi
+else
+ AC_MSG_CHECKING(for random device)
+ ac_cv_have_dev_random=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
+if test "x$platform_win32" = "xyes"; then
+ AC_DEFINE(HAVE_CRYPT_RNG)
+fi
+
+if test "x$ac_cv_have_dev_random" = "xno" \
+ && test "x$platform_win32" = "xno"; then
+ AC_MSG_WARN([[
+***
+*** A system-provided entropy source was not found on this system.
+*** Because of this, the System.Security.Cryptography random number generator
+*** will throw a NotImplemented exception.
+***
+*** If you are seeing this message, and you know your system DOES have an
+*** entropy collection in place, please contact <crichton@gimp.org> and
+*** provide information about the system and how to access the random device.
+***
+*** For those systems who lack a random device, EGD support is forthcoming.
+***]])
+fi
+
+AC_MSG_CHECKING([if inter-process shared handles are requested])
+AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
+AC_MSG_RESULT($try_shared_handles)
+if test "x$try_shared_handles" != "xyes"; then
+ AC_DEFINE(DISABLE_SHARED_HANDLES)
+ AC_SUBST(DISABLE_SHARED_HANDLES)
+fi
+
+TARGET="unknown"
+ACCESS_UNALIGNED="yes"
+
+case "$host" in
+#mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
+i*86-*-*) TARGET=X86; arch_target=x86;;
+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;;
+arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
+esac
+
+if test ${TARGET} = unknown; then
+ CPPFLAGS="$CPPFLAGS -DNO_PORT"
+ AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
+fi
+
+if test ${ACCESS_UNALIGNED} = no; then
+ CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
+fi
+
+AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
+AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
+AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
+AM_CONDITIONAL(X86, test x$TARGET = xX86)
+AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
+AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
+AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
+AM_CONDITIONAL(ARM, test x$TARGET = xARM)
+
+LIBC="libc.so.6"
+AC_SUBST(LIBC)
+
+AC_SUBST(arch_target)