[a44b50]: src / configure.in Maximize Restore History

Download this file

configure.in    337 lines (316 with data), 10.5 kB

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
dnl  configure.in    ---<autoconf>--->> configure
dnl
dnl                      _____
dnl  configure                \
dnl  src/h/config.h.in   ----<sh>---->> $(machine)/h/config.h
dnl  src/*/Makefile.in   _____/         $(machine)/*/Makefile
dnl
dnl  $(machine)/Makefile ---<make>--->> ecl
dnl
dnl
AC_INIT(configure.in)
AC_PREREQ(2.1)		# You must have autoconf version 2.1 or later.

###
### Make sure we do not configure within source directory
###
if test -f configure; then
echo "***"
echo "*** This program cannot be built within the source directory ***"
echo "***"
exit 2;
fi

dnl Set the version number. This seems the best place to keep it.
ECL_VERSION=0.9
AC_SUBST(ECL_VERSION)

dnl Guess operating system of host. We do not allow cross-compiling.
AC_CANONICAL_HOST

AC_SUBST(host)
AC_SUBST(bindir)
AC_SUBST(mandir)
AC_SUBST(infodir)
AC_SUBST(builddir)
AC_SUBST(libdir)
AC_SUBST(top_srcdir)
dnl AC_ARG_ENABLE(tk,
dnl 	[--enable-tk            Include Tk.],
dnl 	tk="$enable_tk")
dnl AC_ARG_ENABLE(clx,
dnl 	[--enable-clx           Include CLX.],
dnl 	clx="$enableval")
AC_ARG_WITH(tcp,
	[--with-tcp             Include socket interface.],
	tcp="yes")
AC_ARG_ENABLE(boehm,
	[--disable-boehm        Disable Boehm's garbage collector.],
	boehm="${enableval}",boehm="yes")
AC_ARG_ENABLE(local-boehm,
	[--enable-local-boehm   Use already installed Boehm GC library.],
	[local_boehm="${enableval}" boehm="yes"],local_boehm="no")
AC_ARG_ENABLE(local-gmp,
	[--enable-local-gmp     Use already installed GMP library.],
	local_gmp="${enableval}",local_gmp="no")
AC_ARG_WITH(gmp,
	[--with-gmp=args        Configure supplied GMP library with arguments.],
	[gmp_flags=${withval}; local_gmp="no"],
	gmp_flags="")
dnl AC_ARG_ENABLE(locative,
dnl 	[--enable-locative      Include locative support.],
dnl 	locative="$enable_locative")
AC_ARG_ENABLE(threads,
	[--enable-threads	Include the multiple thread facility.],
	threads="$enable_threads")
dnl AC_ARG_ENABLE(runtime,
dnl 	[--enable-runtime	Build no compiler.],
dnl 	runtime="$enable_runtime")
AC_ARG_ENABLE(shared,
	[--disable-shared       Enable building dynamically loadable extensions.],
	shared="$enable_shared",shared="yes")
AC_ARG_WITH(oldloop,
	[--with-oldloop         Use the old MIT LOOP macro.],
	oldloop="yes")
AC_ARG_WITH(clos-streams,
	[--with-clos-streams    Allow user defined stream objects.],
	closstreams="yes")
AC_ARG_ENABLE(cxx,
	[--enable-cxx           Build ECL using C++ compiler],
	usecxx=${enableval},usecxx="no")

### ----------------------------------------------------------------------
###           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_EXEEXT dnl			Guess whether .exe is needed for executables
AC_SUBST(ECL_CC)dnl		Which compiler should we use for building ECL
AC_SUBST(CFLAGS)dnl		Flags for the compiler
AC_SUBST(LSPCFLAGS)dnl		Additional flags needed to compile translated code
AC_SUBST(CLIBS)dnl		System libraries to be linked in
AC_SUBST(LDFLAGS)dnl		Flags for program linker
AC_SUBST(SHARED_LDFLAGS)dnl	Flags for shared libraries linker
AC_SUBST(architecture)dnl	Type of processor for which this is compiled
AC_SUBST(software_type)dnl	Type of operating system
AC_SUBST(software_version)dnl	Version number of operating system
AC_SUBST(ecl_setjmp)dnl		Function to use for setjmp
AC_SUBST(ecl_longjmp)dnl	Function to use for longjmp
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)dnl		Versions of ECL to be built
AC_SUBST(TKLIBS)dnl		Libraries with the Tcl/Tk components
AC_SUBST(SUBDIR)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(BOEHM_HEADERS)dnl	Header path for Boehm GC

dnl ----------------------------------------------------------------------
dnl           checks for UNIX variants that set DEFS
dnl
AC_CHECK_LIB(sun, getpwnam)         # on IRIX adds -lsun

dnl ----------------------------------------------------------------------
dnl           checks for header files
dnl
dnl AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h string.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS(float.h)
AC_CHECK_FUNCS(nanosleep)
AC_CHECK_FUNCS(isnanf)
AC_ISC_POSIX

dnl ----------------------------------------------------------------------
dnl		Establish some default values
dnl
ECL_MAKE_ABSOLUTE_SRCDIR()
ECL_GUESS_HOST_OS()
ECL_PROCESS_MACHINES_H()
ECL_LINEFEED_MODE()

dnl ----------------------------------------------------------------------
dnl		Set options
dnl
if test "x$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
if test "x$exec_prefix" = "xNONE"; then exec_prefix=${prefix}; fi
bindir="${exec_prefix}/bin"
libdir="${exec_prefix}/lib/ecl"
includedir="${exec_prefix}/lib/ecl/h"
mandir="${prefix}/man/man1"
infodir="${prefix}/info"
TARGETS="ecl${EXEEXT}"
LIBRARIES="libecl.a"
LSP_LIBRARIES="liblsp.a libclos.a"
SUBDIR=c
CLIBS="${CLIBS} -lgmp -lm"
if test ${boehm} = "no" ; then
  EXTRA_OBJS="${EXTRA_OBJS} alloc.o gbc.o"
else
  if test ${local_boehm} = "no"; then
    LIBRARIES="${LIBRARIES} libgc.a"
    SUBDIR="${SUBDIR} gc"
    BOEHM_HEADERS="-I\$(top_srcdir)/gc/include"
  else
    BOEHM_HEADERS=""
  fi
  CLIBS="-lgc ${CLIBS}"
  EXTRA_OBJS="${EXTRA_OBJS} alloc_2.o"
  AC_DEFINE(GBC_BOEHM)
fi
if test ${shared} = "yes"; then
  AC_DEFINE(ENABLE_DLOPEN)
fi
if test ${local_gmp} = "no" ; then
  LIBRARIES="${LIBRARIES} libgmp.a"
  SUBDIR="${SUBDIR} gmp"
fi
if test ${runtime} ; then
  AC_DEFINE(RUNTIME)
else
  if test ${shared} = "yes" ; then
    LSP_LIBRARIES="${LSP_LIBRARIES} cmp.so sysfun.lsp"
  else
    LSP_LIBRARIES="${LSP_LIBRARIES} libcmp.a sysfun.lsp"
  fi
fi
if test ${tk} ; then
  TKLIBS="-ltk -ltcl -lXpm @XLIBS@"
  AC_DEFINE(TK)
fi
if test ${clx} ; then
  TARGETS="${TARGETS} eclx${EXEEXT}"
  LSP_LIBRARIES="${LSP_LIBRARIES} libclx.a"
  AC_DEFINE(CLX)
fi
if test "${tcp}" -o "${clx}"; then
  AC_DEFINE(TCP)
  EXTRA_OBJS="${EXTRA_OBJS} tcp.o"
fi
if test "${oldloop}"; then
  AC_DEFINE(ECL_OLD_LOOP)
fi
if test "${closstreams}"; then
  AC_DEFINE(ECL_CLOS_STREAMS)
fi
if test "${locative}" ; then
  EXTRA_OBJS="${EXTRA_OBJS} unify.o"
  AC_DEFINE(LOCATIVE)
fi
AC_MSG_CHECKING(Checking for threads support)
if test "${threads}" ; then
  EXTRA_OBJS="${EXTRA_OBJS} lwp.o"
  AC_DEFINE(THREADS)
  AC_MSG_RESULT(userland threads)
else
  AC_MSG_RESULT(no)
fi
if test ${usecxx} = "no" ; then
  ECL_CC="${CC}"
else
  ECL_CC="${CXX}"
fi

dnl ---------------------------------------------------------------------
dnl		This flag is an optimization for GNU
dnl ---------------------------------------------------------------------
if test "${GCC}" = "yes"; then
  CFLAGS="${CFLAGS} -fstrict-aliasing"
fi

dnl ----------------------------------------------------------------------
dnl		Study the call conventions
dnl
ECL_STACK_DIRECTION()
ECL_ARGS_ARRAY()

dnl ---------------------------------------------------------------------
dnl		Check the appropiate type for cl_fixnum/cl_index
dnl
ECL_FIXNUM_TYPE()

dnl		      # DEFS HAVE_UNISTD_H, HAVE_STDLIB_H, HAVE_STDARG_H
dnl		      # and HAVE_STRING_H
dnl AC_DIR_HEADER         # directory reading functions, DEFS VOID_CLOSEDIR
dnl
dnl           checks for typedefs
dnl
dnl AC_TYPE_SIZE_T         # DEFS size_t
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
dnl           checks for functions and declarations
dnl
dnl           checks for compiler characteristics
dnl
AC_C_BIGENDIAN    	   # DEFS WORDS_BIGENDIAN
dnl AC_C_CONST             # DEFS const
dnl AC_C_CHAR_UNSIGNED     # DEFS __CHAR_UNSIGNED__ if char is unsigned

dnl ---------------------------------------------------------------------
dnl	      X11 stuff
dnl
AC_PATH_X
AC_PATH_XTRA
 
XINCLUDES=""
XLIBS=""
 
if test "$x_includes" != "" 
then 
  XINCLUDES=-I$x_includes
fi
 
if test "$x_libraries" != ""
then
   XLIBS="-L$x_libraries"
fi

AC_SUBST(XINCLUDES)
AC_SUBST(XLIBS)

XLIBS="$XLIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"

dnl ---------------------------------------------------------------------
dnl		GNU multiprecision library
dnl
AC_MSG_CHECKING(checking for gmp...)
if test ${local_gmp} = "yes" ; then
  AC_MSG_RESULT(already installed)
else
  AC_MSG_RESULT(configuring local copy)
  test -d gmp && rm -rf gmp
  if mkdir gmp; then
   (destdir=`pwd`; cd gmp;
     $srcdir/gmp/configure --disable-shared --prefix=$bindir \
	--infodir=${destdir}/doc --includedir=${destdir}/h \
        --libdir=${destdir} $gmp_flags)
  fi
fi
dnl ---------------------------------------------------------------------
dnl		Boehm-Weiser garbage collector
dnl
AC_MSG_CHECKING(checking for Boehm-Weiser gc...)
if test ${boehm} = "no"; then
  AC_MSG_RESULT(use small collector instead)
elif test "${local_boehm}" = "no" ; then
  AC_MSG_RESULT(configuring local copy)
  test -d gc && rm -rf gc
  if mkdir gc; then
   (destdir=`pwd`; cd gc;
     $srcdir/gc/configure --disable-threads --disable-shared --prefix=$bindir \
	--includedir=${destdir}/h --libdir=${destdir})
  fi
else
  AC_MSG_RESULT(already installed)
fi
dnl ---------------------------------------------------------------------
dnl		Final pass over configuration files
dnl
dnl Notice that we build ${builddir}/h/configpre.h fron ${srcdir}/h/config.h.in,
dnl and then use all AC_DEF* to build h/config.h from h/configpre.h
dnl
AC_CONFIG_FILES(compile.lsp compile_rest.lsp bare.lsp
 lsp/config.lsp cmp/cmpcfg.lsp lsp/load.lsp clos/load.lsp cmp/load.lsp
 ../Makefile Makefile c/Makefile doc/Makefile
 tk/Makefile clx/defsys.lsp tests/Makefile ansi-tests/Makefile gabriel/Makefile
 lsp/defsys.lsp cmp/defsys.lsp clos/defsys.lsp)
AC_CONFIG_FILES([ecl-config:util/ecl-config],[chmod +x ecl-config])
AC_CONFIG_FILES([h/configpre:h/config.h.in])
AC_CONFIG_HEADER([h/config.h:h/configpre])
AC_OUTPUT