ecl/src/configure.in

601 lines
20 KiB
Text

dnl
dnl This is an autoconf script.
dnl To rebuild the `configure' script from this, execute the command
dnl autoconf
dnl in the directory containing this script.
dnl
dnl AUTOCONF configuration for ECL
dnl Giuseppe Attardi 25.1.1994
dnl
AC_INIT([ecl],[0.9i],[])
AC_REVISION([$Revision$])
AC_CONFIG_SRCDIR([bare.lsp.in])
AC_CONFIG_AUX_DIR([${srcdir}/gmp])
AC_PREREQ(2.59)
dnl -----------------------------------------------------------------------
dnl Make sure we do not configure within source directory
if test -f configure; then
AC_MSG_ERROR([This program cannot be built within the source directory])
fi
dnl -----------------------------------------------------------------------
dnl Configure switches
AC_ARG_WITH(cross_config,
AS_HELP_STRING( [--with-cross-config=f],
[supply configuration for a cross compiler]),
[], [with_cross_config="`pwd`/cross_config"])
AC_ARG_ENABLE(shared,
AS_HELP_STRING( [--enable-shared],
[enable loading compiled files (default=YES)]),
[], [enable_shared=yes])
AC_ARG_ENABLE(threads,
AS_HELP_STRING( [--enable-threads],
[support for native threads (yes|no|auto, default=NO).]),
[], [enable_threads=no])
AC_ARG_ENABLE(boehm,
AS_HELP_STRING( [--enable-boehm],
[use the Boehm-Weiser garbage collector]
[(no|included|system|auto, default=included)] ),
[], [enable_boehm=included] )
AC_ARG_ENABLE(local-boehm,
AS_HELP_STRING( [--enable-local-boehm], [Deprecated! See --enable-boehm] ),
[AC_MSG_WARN(
[--enable-local-boehm is deprecated, use --enable-boehm=system instead!])
test ${withval} = "no" || enable_boehm="system"])
AC_ARG_ENABLE(slow-config,
AS_HELP_STRING( [--enable-slow-config],
[use GMP to guess compiler/linker flags]
[(no|yes, default=NO)]),
[], [enable_slow_config=no] )
AC_ARG_WITH(system-boehm,
AS_HELP_STRING( [--with-system-boehm], [Deprecated! See --enable-boehm] ),
[AC_MSG_WARN(
[--with-system-boehm is deprecated, use --enable-boehm=system instead!])
test ${withval} = "no" || enable_boehm="system"])
AC_ARG_WITH(gmp,
AS_HELP_STRING( [--with-gmp=args],
[supply arguments for configuring GMP library])
[], [with_gmp=""])
AC_ARG_WITH(system-gmp,
AS_HELP_STRING( [--with-system-gmp],
[use already installed GMP library (default=auto)]),
[], [with_system_gmp="auto"])
AC_ARG_WITH(gmp-prefix,
AS_HELP_STRING( [--with-gmp-prefix=path],
[prefix for system GMP includes and libraries] ),
[GMP_CFLAGS="-I$withval/include"; GMP_LDFLAGS="-L$withval/lib"], [])
AC_ARG_WITH(gmp-incdir,
AS_HELP_STRING( [--with-gmp-incdir=path],
[path to system GMP includes (overrides prefix)] ),
[GMP_CFLAGS="-I$withval"], [])
AC_ARG_WITH(gmp-libdir,
AS_HELP_STRING( [--with-gmp-libdir=path],
[path to system GMP libraries (overrides prefix)] ),
[GMP_LDFLAGS="-L$withval"], [])
AC_ARG_ENABLE(local-gmp,
AS_HELP_STRING( [--enable-local-gmp],
[Deprecated! See --with-system-gmp]),
[AC_MSG_WARN(
[--with-local-gmp is deprecated, use --with-system-gmp instead!])
with_system_gmp="${enableval}"])
AC_ARG_WITH(__thread,
AS_HELP_STRING( [--with-__thread],
[Enable __thread thread-local variables]
[(supported by NPTL-aware glibc and maybe Windows)] ),
[], [])
AC_ARG_ENABLE(debug,
AS_HELP_STRING( [--enable-debug],
[enable various debugging features]
[(default=NO)]),
[DEBUG_CFLAGS="-g -O0"; CFLAGS="$CFLAGS -g -O0"],[])
AC_ARG_ENABLE(opcode8,
AS_HELP_STRING( [--enable-opcode8],
[interpreter uses 8-bit codes]
[(default=NO, only works on Intel)]),
[opcode8=${enableval}], [opcode8=no])
AC_ARG_WITH(cxx,
AS_HELP_STRING( [--with-cxx],
[build ECL using C++ compiler (default=NO)]),
[], [with_cxx=no])
AC_ARG_WITH(tcp,
AS_HELP_STRING( [--with-tcp],
[include socket interface (default=YES)]),
[], [with_tcp=yes])
AC_ARG_WITH(clx,
AS_HELP_STRING( [--with-clx],
[include CLX library (default=NO)]),
[], [with_clx=no])
AC_ARG_WITH(clos-streams,
AS_HELP_STRING( [--with-clos-streams],
[user defined stream objects (default=YES)]),
[], [with_clos_streams=yes])
AC_ARG_WITH(cmuformat,
AS_HELP_STRING( [--with-cmuformat],
[use CMUCL's FORMAT routine (default=YES)]),
[], [with_cmuformat=${with_clos_streams}])
AC_ARG_WITH(asdf,
AS_HELP_STRING( [--with-asdf],
[include ASDF building facility]
[(default=YES if shared library support is on)]),
[], [with_asdf=${enable_shared}])
AC_ARG_WITH(defsystem,
AS_HELP_STRING( [--with-defsystem],
[include DEFSYSTEM building facility]
[(default=YES if shared library support is on)]),
[], [with_defsystem=${enable_shared}])
AC_ARG_WITH(cmp,
AS_HELP_STRING( [--with-cmp],
[build in the compiler (default=YES)] ),
[], [with_cmp=yes])
AC_ARG_WITH(rt,
AS_HELP_STRING( [--with-rt],
[include MIT-RT testing environment]
[(default=YES)]),
[], [with_rt=${enable_shared}])
AC_ARG_ENABLE(unicode,
AS_HELP_STRING( [--enable-unicode],
[enable support for unicode (default=NO)]),
[], [enable_unicode=no])
AC_ARG_ENABLE(longdouble,
AS_HELP_STRING( [--enable-longdouble],
[include support for long double]
[(default=NO)]),
[enable_longdouble=${enableval}], [enable_longdouble=no])
AC_ARG_ENABLE(c99complex,
AS_HELP_STRING( [--enable-c99-complex],
[include support for C complex type]
[(default=NO)]),
[enable_c99complex=${enableval}], [enable_c99complex=no])
AC_ARG_ENABLE(hpack,
AS_HELP_STRING( [--enable-hierarchical-packages],
[hierarchical package names]
[(default=YES)]),
[enable_hpack=${enableval}], [enable_hpack=yes])
dnl -----------------------------------------------------------------------
dnl Installation directories
libdir="${libdir}/ecl"
includedir="${libdir}"
test -z "${docdir}" && docdir="${datadir}/doc/ecl"
AC_SUBST([docdir])
dnl -----------------------------------------------------------------------
dnl Initialize variables.
boehm_configure_flags=""
AC_EXEEXT dnl Guess whether .exe is needed for executables
AC_SUBST(buildir) dnl For top-level Makefile.in
AC_SUBST(ECL_CFLAGS) dnl Similar, but specific to ECL (see src/util/ecl-config)
AC_SUBST(DEBUG_CFLAGS) dnl Additional flags when debugging
AC_SUBST(GMP_CFLAGS) dnl CFLAGS needed for compiling with system GMP library
AC_SUBST(GMP_LDFLAGS) dnl LDFLAGS needed for compiling with system GMP library
AC_SUBST(FASL_LIBS) dnl Libraries to link into all ecl code but not
dnl into helper programs.
AC_SUBST(CORE_LIBS, []) dnl Locally compiled libs to link into
dnl ecl/ecl_min/libecl.so and nowhere else.
AC_SUBST(SHARED_LDFLAGS) dnl Flags for shared libraries linker
AC_SUBST(BUNDLE_LDFLAGS) dnl Flags for FASL files linker
AC_SUBST(SHORT_SITE_NAME) dnl Short name for the machine we built this on
AC_SUBST(LONG_SITE_NAME) dnl Long name for the machine we built this on
AC_SUBST(EXTRA_OBJS) dnl Extra *.o files to be compiled into libecl.a
AC_SUBST(TARGETS, ['bin/ecl$(EXE)'])dnl Versions of ECL to be built
AC_SUBST(SUBDIRS, [c]) dnl Subdirectories that make should process
AC_SUBST(LIBRARIES, []) dnl GMP, Boehm's GC, etc
AC_SUBST(LSP_LIBRARIES) dnl Libraries produced by lisp translator
AC_SUBST(LSP_FEATURES, ['*features*']) dnl Symbols to add to *FEATURES* for conditional compilation
dnl -----------------------------------------------------------------------
dnl Guess operating system of host. We do not allow cross-compiling.
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl =====================================================================
dnl Checks for programs
AC_PROG_CC # sets variable CC
AC_PROG_CXX # sets variable CXX
AC_PROG_CPP # sets variable CPP
AC_PROG_RANLIB # sets variable RANLIB
AC_PROG_INSTALL # sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
AC_PROG_LN_S # sets variable LN_S
AC_PROG_MAKE_SET # set $(MAKE) if needed
dnl -----------------------------------------------------------------------
dnl GMP-based search of C/C++ compiler and linker flags
if test "${enable_slow_config}" = "yes"; then
ECL_GMP_BASED_CONFIG
fi
dnl -----------------------------------------------------------------------
dnl Checks which do not come with autoconf (must be after AC_PROG_CC)
ECL_MAKE_ABSOLUTE_SRCDIR
ECL_CROSS_CONFIG
ECL_GUESS_HOST_OS
ECL___THREAD
AC_SUBST(INFOEXT)
AC_SUBST(INSTALL_INFO)
AC_PATH_PROG([INSTALL_INFO], [install-info], [/bin/true], [$PATH:/sbin:/usr/sbin:/usr/etc])
if test -z `which gzip`; then
INFOEXT=info.gz
else
INFOEXT=info
fi
dnl =====================================================================
dnl Checks for libraries
LIBS="${LIBS} -lm"
AC_CHECK_LIB(sun, getpwnam) # on IRIX adds -lsun
AC_ISC_POSIX
dnl ----------------------------------------------------------------------
dnl Native thread support
if test "${enable_threads}" = "auto"; then
AC_MSG_CHECKING([for threads support])
if test -z "${THREAD_OBJ}"; then
AC_MSG_RESULT([no])
enable_threads="no"
else
AC_MSG_RESULT([yes])
enable_threads="yes"
fi
fi
if test "${enable_threads}" = "yes" ; then
if test -z "${THREAD_OBJ}"; then
AC_MSG_ERROR([Threads aren't supported on this system.])
else
boehm_configure_flags="${boehm_configure_flags} ${THREAD_GC_FLAGS}"
EXTRA_OBJS="${EXTRA_OBJS} ${THREAD_OBJ}.${OBJEXT}"
LIBS="${THREAD_LIBS} ${LIBS}"
CFLAGS="${CFLAGS} ${THREAD_CFLAGS}"
AC_DEFINE( [ECL_THREADS], [1], [Userland threads?])
if test "${ac_cv_ecl___thread}" = "yes" ; then
AC_DEFINE( [WITH___THREAD], [1], [__thread thread-local variables?] )
fi
fi
else
boehm_configure_flags="${boehm_configure_flags} --disable-threads"
fi
dnl ----------------------------------------------------------------------
dnl Boehm-Weiser garbage collector
if test ${enable_boehm} = "no" ; then
EXTRA_OBJS="${EXTRA_OBJS} alloc.${OBJEXT} gbc.${OBJEXT}"
else
if test ${enable_boehm} = "auto"; then
AC_CHECK_LIB( [gc], [GC_malloc],
[enable_boehm="system"], [enable_boehm="included"])
fi
if test ${enable_boehm} = "system"; then
AC_CHECK_LIB( [gc], [GC_malloc],
[FASL_LIBS="${FASL_LIBS} -lgc"],
[AC_MSG_ERROR([System Boehm GC library requested but not found.])])
AC_MSG_CHECKING( [if we need to copy GC private headers] )
AC_DEFINE(GBC_BOEHM, [1], [Use Boehm's garbage collector])
else
enable_boehm="included"
SUBDIRS="${SUBDIRS} gc"
CORE_LIBS="-leclgc ${CORE_LIBS}"
if test "${enable_shared}" = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclgc.${LIBEXT}"
fi
AC_DEFINE(GBC_BOEHM, [0], [Use Boehm's garbage collector])
fi
EXTRA_OBJS="${EXTRA_OBJS} alloc_2.${OBJEXT}"
fi
dnl ----------------------------------------------------------------------
dnl GNU multiprecision library
if test "x${with_gmp}" != "xno"; then
CFLAGS="$CFLAGS $GMP_CFLAGS"
LDFLAGS="$LDFLAGS $GMP_LDFLAGS"
if test ${with_system_gmp} = "auto"; then
AC_CHECK_LIB( [gmp], [__gmpz_init],
[with_system_gmp=yes], [with_system_gmp=no] )
fi
if test "${with_system_gmp}" = "yes"; then
AC_CHECK_LIB( [gmp], [__gmpz_init],
[FASL_LIBS="${FASL_LIBS} -lgmp"],
[AC_MSG_ERROR([System gmp library requested but not found.])])
else
SUBDIRS="${SUBDIRS} gmp"
CORE_LIBS="-leclgmp ${CORE_LIBS}"
if test ${enable_shared} = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclgmp.${LIBEXT}"
fi
fi
fi
dnl =====================================================================
dnl Checks for header files
dnl !!! autoscan
AC_PATH_X
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS( [fcntl.h inttypes.h limits.h netdb.h netinet/in.h] \
[stddef.h stdlib.h string.h sys/param.h] \
[sys/socket.h sys/time.h unistd.h fenv.h] )
dnl !!! end autoscan
AC_CHECK_HEADERS( [sys/resource.h sys/utsname.h float.h pwd.h dlfcn.h link.h] \
[mach-o/dyld.h ulimit.h dirent.h sys/ioctl.h sys/select.h])
dnl =====================================================================
dnl Checks for typedefs, structures, and compiler characteristics.
dnl !!! autoscan
AC_C_CONST dnl !!! DNLed
AC_C_INLINE
AC_TYPE_SIZE_T dnl !!! DNLed
AC_STRUCT_TM
AC_C_VOLATILE
AC_CHECK_TYPES([ptrdiff_t])
AC_C_LONG_LONG
dnl !!! end autoscan
dnl !!! dnled in original
dnl AC_TYPE_PID_T # DEFS pid_t
dnl AC_TYPE_UID_T # DEFS uid_t, gid_t
dnl AC_TYPE_OFF_T # DEFS off_t
dnl AC_C_CHAR_UNSIGNED # DEFS __CHAR_UNSIGNED__ if char is unsigned
dnl !!! end dnled
AC_C_BIGENDIAN([], [],
[AC_DEFINE(WORDS_BIGENDIAN, [/* EDIT! - Undefine if small endian */])])
dnl ----------------------------------------------------------------------
dnl This flag is an optimization for GNU
if test "${GCC}" = "yes"; then
CFLAGS="${CFLAGS} -fstrict-aliasing"
fi
ECL_LINEFEED_MODE
ECL_FIND_SETJMP
ECL_FILE_STRUCTURE
ECL_FFI
ECL_FPE_MODEL
if test "$enable_longdouble" != "no" ; then
AC_CHECK_TYPES([long double])
fi
if test "$enable_c99complex" != "no" ; then
AC_CHECK_TYPES([double complex, float complex],[],[],[#include <complex.h>])
fi
dnl -----------------------------------------------------------------------
dnl Study the call conventions
ECL_STACK_DIRECTION
dnl ----------------------------------------------------------------------
dnl Check the appropiate type for cl_fixnum/cl_index
ECL_FIXNUM_TYPE
dnl =====================================================================
dnl Checks for library functions
dnl !!! autoscan
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRTOD
AC_CHECK_FUNCS( [floor getcwd gethostbyaddr gethostbyname getpagesize] \
[memmove memset mkdir putenv socket sqrt] \
[strcasecmp strchr strerror strtol] )
dnl !!! end autoscan
AC_CHECK_FUNCS( [nanosleep alarm times isnanf select setenv putenv] \
[lstat mkstemp sigprocmask isatty feenableexcept tzset] \
[gettimeofday getrusage] )
AC_CHECK_FUNCS( [expf logf sqrtf cosf sinf tanf sinhf coshf tanhf] \
[floorf ceilf fabsf frexpf ldexpf])
dnl =====================================================================
dnl Checks for system services
dnl =====================================================================
dnl Final pass over configuration files
dnl
dnl Notice that we build ${builddir}/ecl/configpre.h from
dnl ${srcdir}/ecl/config.h.in, and then use all AC_DEF* to build
dnl ecl/config.h from ecl/configpre.h
dnl ----------------------------------------------------------------------
dnl Do we use C or C++ compiler to compile ecl?
if test ${with_cxx} = "no" ; then
AC_SUBST([ECL_CC], [${CC}])
else
AC_SUBST([ECL_CC], [${CXX}])
boehm_configure_flags="${boehm_configure_flags} --enable-cplusplus"
fi
dnl ----------------------------------------------------------------------
dnl Do we need to have 8-bit opcodes?
if test ! ${opcode8} = "no" ; then
AC_DEFINE( ECL_SMALL_BYTECODES, [1],
[Bytecodes and arguments are 8 and 16 bits large, respectively])
fi
dnl ----------------------------------------------------------------------
dnl Lisp library and libecl features
if test ${enable_shared} = "yes"; then
AC_DEFINE(ENABLE_DLOPEN, [1], [Allow loading dynamically linked code])
LSP_LIBRARIES="${SHAREDPREFIX}ecl.${SHAREDEXT}"
ECL_ADD_FEATURE([wants-dlopen])
else
LSP_LIBRARIES="${LIBPREFIX}ecl.${LIBEXT}"
LDRPATH='~*'
fi
if test "${with_cmuformat}" = "yes"; then
with_clos_streams="yes"
AC_DEFINE(ECL_CMU_FORMAT, [1], [Use CMU Common-Lisp's FORMAT routine])
fi
if test "${with_clos_streams}" = "yes"; then
AC_DEFINE( ECL_CLOS_STREAMS, [1],
[Allow STREAM operations to work on arbitrary objects])
fi
if test "${with_cmp}" = "yes"; then
ECL_ADD_LISP_MODULE([cmp])
fi
AC_SUBST(CLX_INFO)
if test ${with_clx} = "yes"; then
tcp="yes"
ECL_ADD_LISP_MODULE([clx])
CLX_INFO="clx.${INFOEXT}"
else
CLX_INFO=""
fi
if test "${with_tcp}" = "yes"; then
AC_DEFINE(TCP, [1], [Network streams])
EXTRA_OBJS="${EXTRA_OBJS} tcp.${OBJEXT}"
ECL_ADD_LISP_MODULE([sockets])
LIBS="${LIBS} ${TCPLIBS}"
fi
if test "${with_asdf}" = "yes"; then
ECL_ADD_LISP_MODULE([asdf])
fi
if test "${with_defsystem}" = "yes"; then
ECL_ADD_LISP_MODULE([defsystem])
fi
if test "${with_rt}" = "yes"; then
ECL_ADD_LISP_MODULE([rt])
fi
if test "${enable_unicode}" = "yes"; then
AC_DEFINE(ECL_UNICODE, [1], [Support for Unicode])
fi
if test "${enable_hpack}" = "yes"; then
AC_DEFINE(ECL_RELATIVE_PACKAGE_NAMES, [1], [Hierarchical package names])
fi
dnl ----------------------------------------------------------------------
dnl Configure included Boehm GC if needed
AC_SUBST(ECL_BOEHM_GC_HEADER)
case "${enable_boehm}" in
included)
AC_MSG_NOTICE([Configuring included Boehm GC library:])
test -d gc && rm -rf gc
if mkdir gc; then
(destdir=`${PWDCMD}`; cd gc; \
CC="${CC} ${PICFLAG}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
$srcdir/gc/configure --disable-shared --prefix=${destdir} \
--includedir=${destdir}/ecl/gc/ --libdir=${destdir} --build=${build_alias} \
--host=${host_alias} ${boehm_configure_flags})
ECL_BOEHM_GC_HEADER='ecl/gc/gc.h'
else
AC_MSG_ERROR([Unable to create 'gc' directory])
fi
;;
system)
AC_CHECK_HEADER([gc.h],[ECL_BOEHM_GC_HEADER='gc.h'],[],[])
if test -z "$ECL_BOEHM_GC_HEADER"; then
AC_CHECK_HEADER([gc/gc.h],[ECL_BOEHM_GC_HEADER='gc/gc.h'],[],[])
fi
if test -z "$ECL_BOEHM_GC_HEADER"; then
AC_MSG_ERROR([Boehm-Weiser garbage collector's headers not found])
fi
;;
no)
ECL_BOEHM_GC_HEADER='none';;
*)
AC_MSG_ERROR([Not a valid argument for --enable-boehm $enable_boehm]);;
esac
dnl ----------------------------------------------------------------------
dnl Configure local GMP if needed
AC_SUBST(ECL_GMP_HEADER)
if test "${with_gmp}" = "no" ; then
AC_MSG_NOTICE(Not using GMP library at all. Are you sure?)
EXTRA_OBJS="${EXTRA_OBJS} big_ll.o"
ECL_GMP_HEADER='nofile'
else
AC_DEFINE( [WITH_GMP], [1], [Use GMP for bignums] )
EXTRA_OBJS="${EXTRA_OBJS} big.o"
ECL_GMP_HEADER='gmp.h'
if test "${with_system_gmp}" = "no" ; then
AC_MSG_NOTICE(Configuring included GMP library:)
test -d gmp && rm -rf gmp
if test -z "$gmp_build"; then
gmp_build="${build_alias}"
fi
if mkdir gmp; then
ECL_GMP_HEADER='ecl/gmp.h'
dnl Notice we need -DPIC to force the assembler to generate PIC code
(destdir=`${PWDCMD}`; cd gmp; CC="${CC} ${PICFLAG}" \
$srcdir/gmp/configure --disable-shared --prefix=${destdir} \
--infodir=${destdir}/doc --includedir=${destdir}/ecl --with-pic \
--libdir=${destdir} --build=${gmp_build} --host=${host_alias} $with_gmp)
fi
fi
fi
AC_CONFIG_FILES([
bare.lsp lsp/load.lsp clos/load.lsp cmp/load.lsp
../Makefile Makefile c/Makefile doc/Makefile doc/ecl.man doc/ecl-config.man
ecl/configpre.h:h/config.h.in bin/ecl-config.pre:util/ecl-config
lsp/config.pre:lsp/config.lsp.in compile.pre:compile.lsp.in
cmp/cmpdefs.pre:cmp/cmpdefs.lsp
])
AC_CONFIG_HEADERS([ecl/config.h:ecl/configpre.h]) # FIXME
AC_OUTPUT