| 1 |
# -*- Autoconf -*- |
| 2 |
# Process this file with autoconf to produce a configure script. |
| 3 |
|
| 4 |
AC_PREREQ([2.71]) |
| 5 |
AC_INIT([ikarus],[0.0.4-rc1-derick],[[email protected]]) |
| 6 |
AC_CANONICAL_TARGET |
| 7 |
AM_INIT_AUTOMAKE([-Wall foreign]) |
| 8 |
AC_CONFIG_SRCDIR([src/ikarus.c]) |
| 9 |
|
| 10 |
|
| 11 |
AM_PROG_AS |
| 12 |
# Checks for programs. |
| 13 |
AC_PROG_CC |
| 14 |
AM_PROG_CC_C_O |
| 15 |
|
| 16 |
|
| 17 |
CFLAGS="$CFLAGS -DNDEBUG -O3 -Wall" |
| 18 |
|
| 19 |
case "$target_os" in |
| 20 |
*linux*) |
| 21 |
LDFLAGS="-rdynamic $LDFLAGS" |
| 22 |
;; |
| 23 |
*bsd*) |
| 24 |
LDFLAGS="-Wl,-E $LDFLAGS" |
| 25 |
;; |
| 26 |
*cygwin*) |
| 27 |
LDFLAGS="-Wl,-E -Wl,--export-all-symbols $LDFLAGS" |
| 28 |
;; |
| 29 |
*darwin*) |
| 30 |
AC_DEFINE(HACK_FFI, 1, |
| 31 |
[Mark code returned by libffi executable because |
| 32 |
libffi does not do that yet. This so far is only |
| 33 |
important on Snow Leopard in 64-bit mode but we |
| 34 |
mark it on all darwins anyways.]) |
| 35 |
;; |
| 36 |
esac |
| 37 |
|
| 38 |
AC_CHECK_SIZEOF(void *) |
| 39 |
if test "$ac_cv_sizeof_void_p" = 4; then |
| 40 |
AC_DEFINE(FLAT_TABLES, 1, |
| 41 |
[use flat segment and dirty vectors (not used yet)]) |
| 42 |
fi |
| 43 |
|
| 44 |
AC_SYS_LARGEFILE |
| 45 |
|
| 46 |
# Checks for libraries. |
| 47 |
AC_SEARCH_LIBS(dlsym, dl,, [AC_MSG_ERROR([Cannot find libdl])]) |
| 48 |
AC_SEARCH_LIBS(cos, m,, [AC_MSG_ERROR([Cannot find libm])]) |
| 49 |
AC_SEARCH_LIBS(nanosleep, rt,, [AC_MSG_ERROR([Cannot find nanosleep])]) |
| 50 |
AC_SEARCH_LIBS(socket, socket,, [AC_MSG_ERROR([Cannot find socket])]) |
| 51 |
|
| 52 |
|
| 53 |
# Checks for header files. |
| 54 |
AC_HEADER_SYS_WAIT |
| 55 |
|
| 56 |
|
| 57 |
AC_CHECK_HEADERS([assert.h dlfcn.h errno.h fcntl.h signal.h \ |
| 58 |
stdint.h stdlib.h string.h strings.h \ |
| 59 |
sys/mman.h sys/resource.h sys/stat.h \ |
| 60 |
sys/time.h sys/types.h sys/wait.h \ |
| 61 |
unistd.h]) |
| 62 |
|
| 63 |
AC_CHECK_LIB(pthread, main) |
| 64 |
|
| 65 |
AC_CHECK_HEADERS([gmp.h],,[AC_MSG_ERROR([ |
| 66 |
ERROR: Cannot find libgmp. |
| 67 |
ERROR: You might want to supply CFLAGS=-I</path/to/include> (containing |
| 68 |
ERROR: the gmp.h header file), and LDFLAGS=-L</path/to/lib> (containing |
| 69 |
ERROR: libgmp.so) if libgmp is installed in a non-standard location. |
| 70 |
ERROR: libgmp can be obtained from <http://gmplib.org>. ])]) |
| 71 |
|
| 72 |
# check that gmp is present |
| 73 |
AC_CHECK_LIB([gmp],[main],[],[AC_MSG_ERROR([ |
| 74 |
ERROR: Cannot find libgmp. |
| 75 |
ERROR: You might want to supply CFLAGS=-I</path/to/include> (containing |
| 76 |
ERROR: the gmp.h header file), and LDFLAGS=-L</path/to/lib> (containing |
| 77 |
ERROR: libgmp.so) if libgmp is installed in a non-standard location. |
| 78 |
ERROR: libgmp can be obtained from <http://gmplib.org>. ])],[]) |
| 79 |
|
| 80 |
|
| 81 |
AC_ARG_ENABLE(libffi, |
| 82 |
AS_HELP_STRING([--enable-libffi], [enable support for libffi (default is check)]), |
| 83 |
[true], [enable_libffi=check]) |
| 84 |
|
| 85 |
# Check for libffi (optional) |
| 86 |
|
| 87 |
libffi_val=0 |
| 88 |
if test "$enable_libffi" != no; then |
| 89 |
AC_CHECK_HEADER([ffi.h], [have_ffi_h=yes], [have_ffi_h=no]) |
| 90 |
AC_CHECK_LIB(ffi,ffi_call, [have_libffi=yes], [have_libffi=no]) |
| 91 |
if test "$have_libffi" = yes && test "$have_ffi_h" = yes; then |
| 92 |
libffi_val=1 |
| 93 |
LIBS="$LIBS -lffi" |
| 94 |
elif test "$enable_libffi" = yes; then |
| 95 |
if test "$have_ffi_h" = no; then |
| 96 |
AC_MSG_ERROR([ffi.h cannot be found. |
| 97 |
Please specify the location of the header file using |
| 98 |
./configure CFLAGS=-I<path/to/ffi.h> <other-options ...> |
| 99 |
]) |
| 100 |
fi |
| 101 |
if test "$have_libffi" = no; then |
| 102 |
AC_MSG_ERROR([libffi cannot be found. |
| 103 |
Please specify the location of the library file using |
| 104 |
./configure LDFLAGS=-L<path/to/libffi.ld|dylib|so|etc.> <other-options ...> |
| 105 |
]) |
| 106 |
fi |
| 107 |
else |
| 108 |
AC_MSG_WARN([libffi not found -- FFI disabled]) |
| 109 |
fi |
| 110 |
fi # "$enable_ffi" != no |
| 111 |
|
| 112 |
AC_DEFINE_UNQUOTED(ENABLE_LIBFFI, [$libffi_val], [adds support for libffi]) |
| 113 |
|
| 114 |
AC_CHECK_MEMBER([struct stat.st_mtimespec], |
| 115 |
AC_DEFINE(HAVE_STAT_ST_MTIMESPEC, 1, |
| 116 |
[stat struct has st_mtimespec field]), |
| 117 |
[], |
| 118 |
[[#include <sys/stat.h>]]) |
| 119 |
|
| 120 |
AC_CHECK_MEMBER([struct stat.st_mtim], |
| 121 |
AC_DEFINE(HAVE_STAT_ST_MTIM, 1, |
| 122 |
[stat struct has st_mtim field]), |
| 123 |
[], |
| 124 |
[[#include <sys/stat.h>]]) |
| 125 |
|
| 126 |
AC_CHECK_MEMBER([struct stat.st_ctimespec], |
| 127 |
AC_DEFINE(HAVE_STAT_ST_CTIMESPEC, 1, |
| 128 |
[stat struct has st_ctimespec field]), |
| 129 |
[], |
| 130 |
[[#include <sys/stat.h>]]) |
| 131 |
|
| 132 |
AC_CHECK_MEMBER([struct stat.st_ctim], |
| 133 |
AC_DEFINE(HAVE_STAT_ST_CTIM, 1, |
| 134 |
[stat struct has st_ctim field]), |
| 135 |
[], |
| 136 |
[[#include <sys/stat.h>]]) |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
# Checks for typedefs, structures, and compiler characteristics. |
| 141 |
AC_C_CONST |
| 142 |
AC_C_INLINE |
| 143 |
AC_C_RESTRICT |
| 144 |
AC_TYPE_SIZE_T |
| 145 |
AC_STRUCT_TM |
| 146 |
|
| 147 |
|
| 148 |
# Checks for library functions. |
| 149 |
AC_FUNC_FORK |
| 150 |
AC_FUNC_MALLOC |
| 151 |
AC_FUNC_MEMCMP |
| 152 |
AC_FUNC_MMAP |
| 153 |
AC_FUNC_STAT |
| 154 |
AC_FUNC_STRFTIME |
| 155 |
AC_FUNC_STRTOD |
| 156 |
AC_CHECK_FUNCS([sigaltstack bzero gettimeofday memmove memset munmap setenv sqrt strerror getaddrinfo]) |
| 157 |
AC_CONFIG_HEADERS([config.h]) |
| 158 |
AC_CONFIG_FILES([Makefile src/Makefile scheme/Makefile doc/Makefile lib/Makefile benchmarks/Makefile]) |
| 159 |
AC_OUTPUT |