lib/keyword.c (kw_parseempty): Use correct variable scanning `kwval' list.
[sod] / configure.ac
1 dnl -*-autoconf-*-
2 dnl
3 dnl Configuration script for SOD
4 dnl
5 dnl (c) 2015 Straylight/Edgeware
6 dnl
7
8 dnl----- Licensing notice ---------------------------------------------------
9 dnl
10 dnl This file is part of the Sensible Object Design, an object system for C.
11 dnl
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.
16 dnl
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.
21 dnl
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.
25
26 dnl--------------------------------------------------------------------------
27 dnl Initialization.
28
29 mdw_AUTO_VERSION
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])
34 mdw_SILENT_RULES
35
36 AC_PROG_CC
37 AM_PROG_LIBTOOL
38 AX_CFLAGS_WARN_ALL
39 mdw_LIBTOOL_VERSION_INFO
40
41 dnl--------------------------------------------------------------------------
42 dnl Convert the version number for ASDF.
43
44 ## This is surprisingly awful. The convention for official version numbers
45 ## is that they look like [MAJOR.MINOR.PATCH~]MAJOR.MINOR.PATCH[.BPB]
46 ## [-N-gHEX[+]]. ASDF insists on simple numeric things separated by dots.
47 ## If there's no interim-version thing on the front or Git thing on the end,
48 ## then the main version number will do fine. If there is, then we insert
49 ## /two/ `0's in, followed by N and the HEX converted to decimal. Why two?
50 ## Because if there's no brown-paper-bag number, we want to make sure that
51 ## the first BPB release is higher than any of the preceding Git revisions.
52 ver=AC_PACKAGE_VERSION
53 case $ver in
54 *-*-g*)
55 case $ver in
56 *~*) pre=${ver%%~*}. tail=${ver#*~} ;;
57 *) pre= tail=$ver ;;
58 esac
59 base=${tail%%-*} tail=${tail#*-}
60 n=${tail%%-*} tail=${tail#*-g}
61 case $tail in *+) grubby=.0.1 tail=${tail%+} ;; *) grubby= ;; esac
62 rev=$(( 0x$tail ))
63 ASDF_VERSION=$pre$base.0.0.$n.$rev$grubby
64 ;;
65 *)
66 ASDF_VERSION=$ver
67 ;;
68 esac
69 AC_SUBST([ASDF_VERSION])
70
71 dnl--------------------------------------------------------------------------
72 dnl Common Lisp things.
73
74 WORKING_LISPS="sbcl,clisp,ecl"; AC_SUBST([WORKING_LISPS])
75
76 AC_CHECK_PROGS([RUNLISP], [runlisp], [not-found])
77 case "$RUNLISP" in
78 not-found) AC_MSG_ERROR([\`runlisp' not found]) ;;
79 esac
80
81 AC_MSG_CHECKING([FASL file extension])
82 fasl=$($RUNLISP -L$WORKING_LISPS -e \
83 '(format t "~A~%"
84 (pathname-type (compile-file-pathname "foo.lisp")))')
85 AC_SUBST([fasl])
86 AC_MSG_RESULT([.$fasl])
87
88 AC_ARG_WITH([lisp-source-dir],
89 [AS_HELP_STRING([--with-lisp-source-dir=DIR],
90 [where to install Common Lisp source files])],
91 [], [with_lisp_source_dir='${datadir}/common-lisp/source'])
92 AC_ARG_WITH([lisp-system-dir],
93 [AS_HELP_STRING([--with-lisp-system-dir=DIR],
94 [where to install ASDF system links])],
95 [], [with_lisp_system_dir='${datadir}/common-lisp/systems'])
96 AC_SUBST([lispsrcdir], [$with_lisp_source_dir])
97 AC_SUBST([lispsysdir], [$with_lisp_system_dir])
98
99 dnl--------------------------------------------------------------------------
100 dnl TeX things.
101
102 AC_DEFUN([SOD_CHECK_LATEX_FILE],
103 [sod_thing="$1"; case $sod_thing in
104 *.sty) sod_thing=${sod_thing%.sty} sod_what=package ;;
105 *.cls) sod_thing=${sod_thing%.cls} sod_what="document class" ;;
106 *.tfm) sod_thing=${sod_thing%.tfm} sod_what="font metrics" ;;
107 *) sod_what="file" ;;
108 esac
109 AS_VAR_PUSHDEF([SOD_Pkg], [sod_cv_latex_$1])
110 AC_CACHE_CHECK([for LaTeX `$sod_thing' $sod_what],
111 [SOD_Pkg],
112 [if $KPSEWHICH >/dev/null 2>&1 --progname=pdflatex $1
113 then SOD_Pkg=yes
114 else SOD_Pkg=no; fi])
115 case $SOD_Pkg in
116 yes) m4_default([$2], [:]) ;;
117 no) m4_default([$3], [AC_MSG_ERROR([Can't find `$1'])]) ;;
118 esac
119 AS_VAR_POPDEF([SOD_Pkg])])
120
121 dnl See if we want to build the documentation.
122 AC_ARG_ENABLE([manual], [AS_HELP_STRING([--enable-manual])],
123 [if test "$enableval" = "no"
124 then sod_want_latex=no sod_have_latex=no
125 else sod_want_latex=must sod_have_latex=maybe; fi],
126 [sod_want_latex=maybe sod_have_latex=maybe])
127
128 dnl Make sure the TeX programs we need are available.
129 case $sod_have_latex in maybe)
130 AC_CHECK_PROGS([TEX], [tex], [none])
131 AC_CHECK_PROGS([PDFLATEX], [pdflatex], [none])
132 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [none])
133 AC_CHECK_PROGS([BIBTEX], [bibtex], [none])
134 AC_CHECK_PROGS([MAKEINDEX], [makeindex], [none])
135 case ,$TEX,$PDFLATEX,$KPSEWHICH,$BIBTEX,$MAKEINDX, in
136 *,none,*)
137 AC_MSG_WARN([Necessary TeX programs not found: can't build manual!])
138 sod_have_latex=no
139 ;;
140 esac
141 ;; esac
142
143 sod_have_custom_bib=no
144 case $sod_have_latex in maybe)
145 SOD_CHECK_LATEX_FILE([strayman.cls], [], [sod_have_latex=no])
146 SOD_CHECK_LATEX_FILE([fontenc.sty], [], [sod_have_latex=no])
147 SOD_CHECK_LATEX_FILE([inputenc.sty], [], [sod_have_latex=no])
148 SOD_CHECK_LATEX_FILE([longtable.sty], [], [sod_have_latex=no])
149 SOD_CHECK_LATEX_FILE([makeidx.sty], [], [sod_have_latex=no])
150 SOD_CHECK_LATEX_FILE([amssymb.sty], [], [sod_have_latex=no])
151 SOD_CHECK_LATEX_FILE([tikz.sty], [], [sod_have_latex=no])
152 SOD_CHECK_LATEX_FILE([at.sty], [], [sod_have_latex=no])
153 SOD_CHECK_LATEX_FILE([footnote.sty], [], [sod_have_latex=no])
154 SOD_CHECK_LATEX_FILE([mdwfonts.sty], [], [sod_have_latex=no])
155 SOD_CHECK_LATEX_FILE([mdwref.sty], [], [sod_have_latex=no])
156 SOD_CHECK_LATEX_FILE([mdwtab.sty], [], [sod_have_latex=no])
157 SOD_CHECK_LATEX_FILE([mdwthm.sty], [], [sod_have_latex=no])
158 SOD_CHECK_LATEX_FILE([sverb.sty], [], [sod_have_latex=no])
159 SOD_CHECK_LATEX_FILE([syntax.sty], [], [sod_have_latex=no])
160
161 SOD_CHECK_LATEX_FILE([cmr12.tfm], [], [sod_have_latex=no])
162 SOD_CHECK_LATEX_FILE([cmbx10.tfm], [], [sod_have_latex=no])
163 SOD_CHECK_LATEX_FILE([cmcsc10.tfm], [], [sod_have_latex=no])
164 SOD_CHECK_LATEX_FILE([cmex10.tfm], [], [sod_have_latex=no])
165 SOD_CHECK_LATEX_FILE([cmmi12.tfm], [], [sod_have_latex=no])
166 SOD_CHECK_LATEX_FILE([cmsy10.tfm], [], [sod_have_latex=no])
167 SOD_CHECK_LATEX_FILE([cmti10.tfm], [], [sod_have_latex=no])
168 SOD_CHECK_LATEX_FILE([msam10.tfm], [], [sod_have_latex=no])
169 SOD_CHECK_LATEX_FILE([msbm10.tfm], [], [sod_have_latex=no])
170 SOD_CHECK_LATEX_FILE([ecrm1000.tfm], [], [sod_have_latex=no])
171 SOD_CHECK_LATEX_FILE([logo10.tfm], [], [sod_have_latex=no])
172 SOD_CHECK_LATEX_FILE([pplr8r.tfm], [], [sod_have_latex=no])
173 SOD_CHECK_LATEX_FILE([pplri8r.tfm], [], [sod_have_latex=no])
174 SOD_CHECK_LATEX_FILE([pplb8r.tfm], [], [sod_have_latex=no])
175 SOD_CHECK_LATEX_FILE([phvr8r.tfm], [], [sod_have_latex=no])
176 SOD_CHECK_LATEX_FILE([phvb8r.tfm], [], [sod_have_latex=no])
177 SOD_CHECK_LATEX_FILE([pcrr8rn.tfm], [], [sod_have_latex=no])
178
179 SOD_CHECK_LATEX_FILE([merlin.mbs], [sod_have_custom_bib=yes], [:])
180
181 case $sod_have_latex in
182 no)
183 AC_MSG_WARN([Necessary LaTeX packages not found: can't build manual!])
184 ;;
185 esac
186 ;; esac
187
188 case $sod_want_latex,$sod_have_latex in
189 must,no)
190 AC_MSG_ERROR([Couldn't find necessary LaTeX support to build manual!])
191 ;;
192 *,maybe)
193 sod_have_latex=yes
194 ;;
195 esac
196 AM_CONDITIONAL([HAVE_LATEX], [test "$sod_have_latex" = "yes"])
197 AM_CONDITIONAL([HAVE_CUSTOM_BIB], [test "$sod_have_custom_bib" = "yes"])
198
199 dnl--------------------------------------------------------------------------
200 dnl Output.
201
202 AC_CONFIG_FILES(
203 [Makefile]
204 [common/Makefile]
205 [src/Makefile]
206 [lib/Makefile]
207 [doc/Makefile]
208 [test/Makefile])
209 AC_OUTPUT
210
211 dnl----- That's all, folks --------------------------------------------------