lib/keyword.c (kw_parseempty): Use correct variable scanning `kwval' list.
[sod] / configure.ac
index e5a9e88..1a45f9e 100644 (file)
 dnl -*-autoconf-*-
 dnl
-dnl Configuring the Common Files Distribution
+dnl Configuration script for SOD
 dnl
-dnl (c) 1997 Mark Wooding
+dnl (c) 2015 Straylight/Edgeware
 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 This file is part of the Sensible Object Design, an object system for C.
+dnl
+dnl SOD 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
+dnl SOD 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
 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 along with SOD; if not, write to the Free Software Foundation,
 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 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([sod], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([lib/sod.h])
 AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE([foreign])
+mdw_SILENT_RULES
+
+AC_PROG_CC
+AM_PROG_LIBTOOL
+AX_CFLAGS_WARN_ALL
+mdw_LIBTOOL_VERSION_INFO
 
 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 Convert the version number for ASDF.
+
+## This is surprisingly awful.  The convention for official version numbers
+## is that they look like [MAJOR.MINOR.PATCH~]MAJOR.MINOR.PATCH[.BPB]
+## [-N-gHEX[+]].  ASDF insists on simple numeric things separated by dots.
+## If there's no interim-version thing on the front or Git thing on the end,
+## then the main version number will do fine.  If there is, then we insert
+## /two/ `0's in, followed by N and the HEX converted to decimal.  Why two?
+## Because if there's no brown-paper-bag number, we want to make sure that
+## the first BPB release is higher than any of the preceding Git revisions.
+ver=AC_PACKAGE_VERSION
+case $ver in
+  *-*-g*)
+    case $ver in
+      *~*) pre=${ver%%~*}. tail=${ver#*~} ;;
+      *) pre= tail=$ver ;;
+    esac
+    base=${tail%%-*} tail=${tail#*-}
+    n=${tail%%-*} tail=${tail#*-g}
+    case $tail in *+) grubby=.0.1 tail=${tail%+} ;; *) grubby= ;; esac
+    rev=$(( 0x$tail ))
+    ASDF_VERSION=$pre$base.0.0.$n.$rev$grubby
+    ;;
+  *)
+    ASDF_VERSION=$ver
+    ;;
+esac
+AC_SUBST([ASDF_VERSION])
+
+dnl--------------------------------------------------------------------------
+dnl Common Lisp things.
+
+WORKING_LISPS="sbcl,clisp,ecl"; AC_SUBST([WORKING_LISPS])
+
+AC_CHECK_PROGS([RUNLISP], [runlisp], [not-found])
+case "$RUNLISP" in
+  not-found) AC_MSG_ERROR([\`runlisp' not found]) ;;
+esac
+
+AC_MSG_CHECKING([FASL file extension])
+fasl=$($RUNLISP -L$WORKING_LISPS -e \
+       '(format t "~A~%"
+                (pathname-type (compile-file-pathname "foo.lisp")))')
+AC_SUBST([fasl])
+AC_MSG_RESULT([.$fasl])
+
+AC_ARG_WITH([lisp-source-dir],
+       [AS_HELP_STRING([--with-lisp-source-dir=DIR],
+                       [where to install Common Lisp source files])],
+       [], [with_lisp_source_dir='${datadir}/common-lisp/source'])
+AC_ARG_WITH([lisp-system-dir],
+       [AS_HELP_STRING([--with-lisp-system-dir=DIR],
+                       [where to install ASDF system links])],
+       [], [with_lisp_system_dir='${datadir}/common-lisp/systems'])
+AC_SUBST([lispsrcdir], [$with_lisp_source_dir])
+AC_SUBST([lispsysdir], [$with_lisp_system_dir])
+
+dnl--------------------------------------------------------------------------
+dnl TeX things.
+
+AC_DEFUN([SOD_CHECK_LATEX_FILE],
+  [sod_thing="$1"; case $sod_thing in
+     *.sty) sod_thing=${sod_thing%.sty} sod_what=package ;;
+     *.cls) sod_thing=${sod_thing%.cls} sod_what="document class" ;;
+     *.tfm) sod_thing=${sod_thing%.tfm} sod_what="font metrics" ;;
+     *) sod_what="file" ;;
+   esac
+   AS_VAR_PUSHDEF([SOD_Pkg], [sod_cv_latex_$1])
+   AC_CACHE_CHECK([for LaTeX `$sod_thing' $sod_what],
+     [SOD_Pkg],
+     [if $KPSEWHICH >/dev/null 2>&1 --progname=pdflatex $1
+      then SOD_Pkg=yes
+      else SOD_Pkg=no; fi])
+   case $SOD_Pkg in
+     yes) m4_default([$2], [:]) ;;
+     no) m4_default([$3], [AC_MSG_ERROR([Can't find `$1'])]) ;;
+   esac
+   AS_VAR_POPDEF([SOD_Pkg])])
+
+dnl See if we want to build the documentation.
+AC_ARG_ENABLE([manual], [AS_HELP_STRING([--enable-manual])],
+       [if test "$enableval" = "no"
+        then sod_want_latex=no sod_have_latex=no
+        else sod_want_latex=must sod_have_latex=maybe; fi],
+       [sod_want_latex=maybe sod_have_latex=maybe])
+
+dnl Make sure the TeX programs we need are available.
+case $sod_have_latex in maybe)
+AC_CHECK_PROGS([TEX], [tex], [none])
+AC_CHECK_PROGS([PDFLATEX], [pdflatex], [none])
+AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [none])
+AC_CHECK_PROGS([BIBTEX], [bibtex], [none])
+AC_CHECK_PROGS([MAKEINDEX], [makeindex], [none])
+case ,$TEX,$PDFLATEX,$KPSEWHICH,$BIBTEX,$MAKEINDX, in
+  *,none,*)
+    AC_MSG_WARN([Necessary TeX programs not found: can't build manual!])
+    sod_have_latex=no
+    ;;
+esac
+;; esac
+
+sod_have_custom_bib=no
+case $sod_have_latex in maybe)
+SOD_CHECK_LATEX_FILE([strayman.cls], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([fontenc.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([inputenc.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([longtable.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([makeidx.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([amssymb.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([tikz.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([at.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([footnote.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([mdwfonts.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([mdwref.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([mdwtab.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([mdwthm.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([sverb.sty], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([syntax.sty], [], [sod_have_latex=no])
+
+SOD_CHECK_LATEX_FILE([cmr12.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmbx10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmcsc10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmex10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmmi12.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmsy10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([cmti10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([msam10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([msbm10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([ecrm1000.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([logo10.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([pplr8r.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([pplri8r.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([pplb8r.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([phvr8r.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([phvb8r.tfm], [], [sod_have_latex=no])
+SOD_CHECK_LATEX_FILE([pcrr8rn.tfm], [], [sod_have_latex=no])
+
+SOD_CHECK_LATEX_FILE([merlin.mbs], [sod_have_custom_bib=yes], [:])
+
+case $sod_have_latex in
+  no)
+    AC_MSG_WARN([Necessary LaTeX packages not found: can't build manual!])
+    ;;
+esac
+;; esac
+
+case $sod_want_latex,$sod_have_latex in
+  must,no)
+    AC_MSG_ERROR([Couldn't find necessary LaTeX support to build manual!])
+    ;;
+  *,maybe)
+    sod_have_latex=yes
+    ;;
+esac
+AM_CONDITIONAL([HAVE_LATEX], [test "$sod_have_latex" = "yes"])
+AM_CONDITIONAL([HAVE_CUSTOM_BIB], [test "$sod_have_custom_bib" = "yes"])
 
 dnl--------------------------------------------------------------------------
 dnl Output.
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES(
+  [Makefile]
+  [common/Makefile]
+  [src/Makefile]
+  [lib/Makefile]
+  [doc/Makefile]
+  [test/Makefile])
 AC_OUTPUT
 
 dnl----- That's all, folks --------------------------------------------------