dnl -*-autoconf-*-
dnl
-dnl Configuring the Common Files Distribution
+dnl Configuration script for `runlisp'
dnl
-dnl (c) 1997 Mark Wooding
+dnl (c) 2020 Mark Wooding
dnl
dnl----- Licensing notice ---------------------------------------------------
dnl
-dnl This file is part of the Common Files Distribution (`common')
-dnl
-dnl `Common' is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl `Common' is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
+dnl This file is part of Runlisp, a tool for invoking Common Lisp scripts.
+dnl
+dnl Runlisp is free software: you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl Runlisp is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
dnl You should have received a copy of the GNU General Public License
-dnl along with `common'; if not, write to the Free Software Foundation,
-dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+dnl along with Runlisp. If not, see <https://www.gnu.org/licenses/>.
dnl--------------------------------------------------------------------------
dnl Initialization.
mdw_AUTO_VERSION
-AC_INIT([Common Files Distribution], AUTO_VERSION,
- [mdw@distorted.org.uk], [cfd])
-AC_CONFIG_SRCDIR([mdw-setup])
+AC_INIT([runlisp], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([runlisp.c])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([foreign])
+mdw_SILENT_RULES
+
+AC_PROG_CC
+AX_CFLAGS_WARN_ALL
+mdw_DECL_ENVIRON
+AC_CHECK_FUNC([strsignal])
+case $ac_cv_func_strsignal in no) AC_DECL_SYS_SIGLIST ;; esac
+
+AC_PROG_RANLIB
+
+AC_CHECK_PROGS([AUTOM4TE], [autom4te])
+
+dnl--------------------------------------------------------------------------
+dnl Checking for Lisp implementations.
+
+AC_ARG_WITH([imagedir],
+ [AS_HELP_STRING([--with-imagedir=DIR],
+ [store and look for custom Lisp images in DIR])],
+ [imagedir=$withval], [imagedir=$localstatedir/$PACKAGE_NAME])
+AC_SUBST(imagedir)
+
+mdw_DEFINE_PATHS([
+ mdw_DEFINE_PATH([IMAGEDIR], [$imagedir])
+ mdw_DEFINE_PATH([ETCDIR], [$sysconfdir/$PACKAGE_NAME])
+ mdw_DEFINE_PATH([DATADIR], [$datadir/$PACKAGE_NAME])])
+
+AC_ARG_ENABLE([imagedump],
+ [AS_HELP_STRING([--enable-imagedump[=SYSTEMS]],
+ [make dumps of Lisp SYSTEMS with ASDF etc. preloaded;
+ SYSTEMS is `yes', `no', or a comma-separated list of
+ system names])],
+ [], [enable_imagedump=yes])
+
+AC_DEFUN([mdw_CHECK_LISP],
+[AC_CHECK_PROGS([$1], [$2])
+AC_ARG_VAR([$1], [Path to the $1 Lisp system.])
+case $[]$1:,$enable_imagedump, in
+ :*) dump=nil ;;
+ *:,yes, | *:*,$2,*) dump=t ;;
+ *) dump=nil ;;
+esac
+AM_CONDITIONAL([DUMP_$1], [test $dump = t])])
+
+mdw_CHECK_LISP([SBCL], [sbcl])
+mdw_CHECK_LISP([CCL], [ccl])
+mdw_CHECK_LISP([CLISP], [clisp])
+mdw_CHECK_LISP([ECL], [ecl])
+mdw_CHECK_LISP([CMUCL], [cmucl])
+mdw_CHECK_LISP([ABCL], [abcl])
+
+dnl ECL is changing its command-line option syntax, because that will make
+dnl things much better or something. So we need to figure out which version
+dnl of the syntax to use.
+mdw_ecl_opts=hunoz
+if test "x$ECL" != x; then
+ AC_MSG_CHECKING([ECL command-line option flavour])
+ ver=$($ECL --version)
+ case $ver in
+ [ECL\ [0-9].*] | [ECL\ 1[0-5].*]) mdw_ecl_opts=trad ;;
+ [ECL\ 1[6-9].*] | [ECL\ [2-9][0-9].*]) mdw_ecl_opts=gnu ;;
+ *) AC_MSG_ERROR([unsupported ECL version \`$ver']) ;;
+ esac
+ AC_MSG_RESULT([$mdw_ecl_opts])
+ case $mdw_ecl_opts in
+ gnu) AC_DEFINE([ECL_OPTIONS_GNU], [1],
+ [Define 1 if ECL uses GNU-style `--FOO' options]) ;;
+ esac
+ case $mdw_ecl_opts in
+ gnu) ECLOPT=-- ;;
+ trad) ECLOPT=- ;;
+ *) AC_MSG_ERROR([internal error: unexpected value for `$mdw_ecl_opts']) ;;
+ esac
+fi
+AC_SUBST([ECLOPT])
dnl--------------------------------------------------------------------------
-dnl Finding installation directories.
-
-AC_ARG_WITH(
- [aclocaldir],
- AS_HELP_STRING([--with-aclocaldir=DIR],
- [store autoconf snippets in DIR]),
- [aclocaldir=$withval],
- [AC_CACHE_CHECK([where to stash Autoconf macros], [mdw_cv_aclocaldir], [
- mdw_cv_aclocaldir=$(aclocal --print-ac-dir)
- if test $? -ne 0; then AC_MSG_ERROR([aclocal not installed]); fi
- ])
- aclocaldir=$mdw_cv_aclocaldir])
-AC_SUBST([aclocaldir])
+dnl Benchmarking support.
+
+dnl This has lots of random dependencies, and isn't really very useful. Turn
+dnl it off unless the user is very keen.
+AC_ARG_ENABLE([benchmark],
+ [AS_HELP_STRING([--enable-benchmark],
+ [turn on script-startup benchmark machinery])],
+ [mdw_bench=$enableval], [mdw_bench=no])
+AM_CONDITIONAL([BENCHMARK], [test "$mdw_bench" = yes])
dnl--------------------------------------------------------------------------
-dnl Output.
+dnl Produce output.
+
+AC_CONFIG_HEADER([config/config.h])
+AC_CONFIG_TESTDIR([t])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile]
+ [bench/Makefile doc/Makefile]
+ [t/Makefile t/atlocal])
AC_OUTPUT
dnl----- That's all, folks --------------------------------------------------