3 dnl Configuration script for SOD
5 dnl (c) 2015 Straylight/Edgeware
8 dnl----- Licensing notice ---------------------------------------------------
10 dnl This file is part of the Sensible Object Design, an object system for C.
12 dnl SOD is free software; you can redistribute it and/or modify
13 dnl it under the terms of the GNU General Public License as published by
14 dnl the Free Software Foundation; either version 2 of the License, or
15 dnl (at your option) any later version.
17 dnl SOD is distributed in the hope that it will be useful,
18 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 dnl GNU General Public License for more details.
22 dnl You should have received a copy of the GNU General Public License
23 dnl along with SOD; if not, write to the Free Software Foundation,
24 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 dnl--------------------------------------------------------------------------
30 AC_INIT([sod], AUTO_VERSION, [mdw@distorted.org.uk])
31 AC_CONFIG_SRCDIR([lib/sod.h])
32 AC_CONFIG_AUX_DIR([config])
33 AM_INIT_AUTOMAKE([foreign])
39 mdw_LIBTOOL_VERSION_INFO
41 dnl--------------------------------------------------------------------------
42 dnl Convert the version number for ASDF.
44 ## This is surprisingly awful. The convention for official version numbers
45 ## is that they look like MAJOR.MINOR.PATCH[.BPB][-N-gHEX[+]]. ASDF
46 ## insists on simple numeric things separated by dots. If there's no Git
47 ## thing on the end, then the main version number will do fine. If there
48 ## is, then we insert /two/ `0's in, followed by N and the HEX converted to
49 ## decimal. Why two? Because if there's no brown-paper-bag number, we
50 ## want to make sure that the first BPB release is higher than any of the
51 ## preceding Git revisions.
52 ver=AC_PACKAGE_VERSION
55 base=${ver%%-*} tail=${ver#*-}
56 n=${tail%%-*} tail=${tail#*-g}
57 case $tail in *+) grubby=.1 tail=${tail%+} ;; *) grubby= ;; esac
59 ASDF_VERSION=$base.0.0.$n.$rev$grubby
65 AC_SUBST([ASDF_VERSION])
67 dnl--------------------------------------------------------------------------
68 dnl Common Lisp things.
70 AC_ARG_WITH([lisp-system],
71 [AS_HELP_STRING([--with-lisp-system=SYSTEMS],
72 [preference order of cl-launch Lisp systems])],
73 [], [with_lisp_system="sbcl clisp"])
75 AC_CHECK_PROGS([CL_LAUNCH], [cl-launch], [not-found])
77 not-found) AC_MSG_ERROR([\`cl-launch' not found]) ;;
80 AC_MSG_CHECKING([for best choice of Lisp system])
81 if ! LISPSYS=$($CL_LAUNCH -l "$with_lisp_system" \
82 -ip '(string-downcase (lisp-implementation-type))'); then
83 AC_MSG_ERROR([cl-launch didn't like any Lisp system])
86 AC_MSG_RESULT([$LISPSYS])
88 AC_MSG_CHECKING([FASL file extension])
89 fasl=$($CL_LAUNCH -l $LISPSYS -ip \
90 '(pathname-type (compile-file-pathname "foo.lisp"))')
92 AC_MSG_RESULT([.$fasl])
94 AC_ARG_WITH([lisp-source-dir],
95 [AS_HELP_STRING([--with-lisp-source-dir=DIR],
96 [where to install Common Lisp source files])],
97 [], [with_lisp_source_dir='${datadir}/common-lisp/source'])
98 AC_ARG_WITH([lisp-system-dir],
99 [AS_HELP_STRING([--with-lisp-system-dir=DIR],
100 [where to install ASDF system links])],
101 [], [with_lisp_system_dir='${datadir}/common-lisp/systems'])
102 AC_SUBST([lispsrcdir], [$with_lisp_source_dir])
103 AC_SUBST([lispsysdir], [$with_lisp_system_dir])
105 dnl--------------------------------------------------------------------------
108 AC_DEFUN([SOD_CHECK_LATEX_FILE],
109 [sod_thing="$1"; case $sod_thing in
110 *.sty) sod_thing=${sod_thing%.sty} sod_what=package ;;
111 *.cls) sod_thing=${sod_thing%.cls} sod_what="document class" ;;
112 *.tfm) sod_thing=${sod_thing%.tfm} sod_what="font metrics" ;;
113 *) sod_what="file" ;;
115 AS_VAR_PUSHDEF([SOD_Pkg], [sod_cv_latex_$1])
116 AC_CACHE_CHECK([for LaTeX `$sod_thing' $sod_what],
118 [if $KPSEWHICH >/dev/null 2>&1 --progname=pdflatex $1
120 else SOD_Pkg=no; fi])
122 yes) m4_default([$2], [:]) ;;
123 no) m4_default([$3], [AC_MSG_ERROR([Can't find `$1'])]) ;;
125 AS_VAR_POPDEF([SOD_Pkg])])
127 dnl See if we want to build the documentation.
128 AC_ARG_ENABLE([manual], [AS_HELP_STRING([--enable-manual])],
129 [if test "$enableval" = "no"
130 then sod_want_latex=no sod_have_latex=no
131 else sod_want_latex=must sod_have_latex=maybe; fi],
132 [sod_want_latex=maybe sod_have_latex=maybe])
134 dnl Make sure the TeX programs we need are available.
135 case $sod_have_latex in maybe)
136 AC_CHECK_PROGS([TEX], [tex], [none])
137 AC_CHECK_PROGS([PDFLATEX], [pdflatex], [none])
138 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [none])
139 AC_CHECK_PROGS([BIBTEX], [bibtex], [none])
140 AC_CHECK_PROGS([MAKEINDEX], [makeindex], [none])
141 case ,$TEX,$PDFLATEX,$KPSEWHICH,$BIBTEX,$MAKEINDX, in
143 AC_MSG_WARN([Necessary TeX programs not found: can't build manual!])
149 sod_have_custom_bib=no
150 case $sod_have_latex in maybe)
151 SOD_CHECK_LATEX_FILE([strayman.cls], [], [sod_have_latex=no])
152 SOD_CHECK_LATEX_FILE([fontenc.sty], [], [sod_have_latex=no])
153 SOD_CHECK_LATEX_FILE([inputenc.sty], [], [sod_have_latex=no])
154 SOD_CHECK_LATEX_FILE([longtable.sty], [], [sod_have_latex=no])
155 SOD_CHECK_LATEX_FILE([makeidx.sty], [], [sod_have_latex=no])
156 SOD_CHECK_LATEX_FILE([amssymb.sty], [], [sod_have_latex=no])
157 SOD_CHECK_LATEX_FILE([tikz.sty], [], [sod_have_latex=no])
158 SOD_CHECK_LATEX_FILE([at.sty], [], [sod_have_latex=no])
159 SOD_CHECK_LATEX_FILE([footnote.sty], [], [sod_have_latex=no])
160 SOD_CHECK_LATEX_FILE([mdwfonts.sty], [], [sod_have_latex=no])
161 SOD_CHECK_LATEX_FILE([mdwref.sty], [], [sod_have_latex=no])
162 SOD_CHECK_LATEX_FILE([mdwtab.sty], [], [sod_have_latex=no])
163 SOD_CHECK_LATEX_FILE([mdwthm.sty], [], [sod_have_latex=no])
164 SOD_CHECK_LATEX_FILE([sverb.sty], [], [sod_have_latex=no])
165 SOD_CHECK_LATEX_FILE([syntax.sty], [], [sod_have_latex=no])
167 SOD_CHECK_LATEX_FILE([cmr12.tfm], [], [sod_have_latex=no])
168 SOD_CHECK_LATEX_FILE([cmbx10.tfm], [], [sod_have_latex=no])
169 SOD_CHECK_LATEX_FILE([cmcsc10.tfm], [], [sod_have_latex=no])
170 SOD_CHECK_LATEX_FILE([cmex10.tfm], [], [sod_have_latex=no])
171 SOD_CHECK_LATEX_FILE([cmmi12.tfm], [], [sod_have_latex=no])
172 SOD_CHECK_LATEX_FILE([cmsy10.tfm], [], [sod_have_latex=no])
173 SOD_CHECK_LATEX_FILE([cmti10.tfm], [], [sod_have_latex=no])
174 SOD_CHECK_LATEX_FILE([msam10.tfm], [], [sod_have_latex=no])
175 SOD_CHECK_LATEX_FILE([msbm10.tfm], [], [sod_have_latex=no])
176 SOD_CHECK_LATEX_FILE([ecrm1000.tfm], [], [sod_have_latex=no])
177 SOD_CHECK_LATEX_FILE([logo10.tfm], [], [sod_have_latex=no])
178 SOD_CHECK_LATEX_FILE([pplr8r.tfm], [], [sod_have_latex=no])
179 SOD_CHECK_LATEX_FILE([pplri8r.tfm], [], [sod_have_latex=no])
180 SOD_CHECK_LATEX_FILE([pplb8r.tfm], [], [sod_have_latex=no])
181 SOD_CHECK_LATEX_FILE([phvr8r.tfm], [], [sod_have_latex=no])
182 SOD_CHECK_LATEX_FILE([phvb8r.tfm], [], [sod_have_latex=no])
183 SOD_CHECK_LATEX_FILE([pcrr8rn.tfm], [], [sod_have_latex=no])
185 SOD_CHECK_LATEX_FILE([merlin.mbs], [sod_have_custom_bib=yes], [:])
187 case $sod_have_latex in
189 AC_MSG_WARN([Necessary LaTeX packages not found: can't build manual!])
194 case $sod_want_latex,$sod_have_latex in
196 AC_MSG_ERROR([Couldn't find necessary LaTeX support to build manual!])
202 AM_CONDITIONAL([HAVE_LATEX], [test "$sod_have_latex" = "yes"])
203 AM_CONDITIONAL([HAVE_CUSTOM_BIB], [test "$sod_have_custom_bib" = "yes"])
205 dnl--------------------------------------------------------------------------
216 dnl----- That's all, folks --------------------------------------------------