1 | dnl Process this file with autoconf to produce a configure script |
---|
2 | |
---|
3 | dnl CFLAGS=-DDEFAULTLANG=fr to build with French as the default language. |
---|
4 | |
---|
5 | dnl Need autoconf 2.13 or later for 3 argument version of AC_DEFINE |
---|
6 | dnl Need autoconf 2.50 or later for AC_ARG_VAR |
---|
7 | AC_PREREQ(2.50) |
---|
8 | AC_INIT(src/cavern.c) |
---|
9 | |
---|
10 | dnl next line is for make_release |
---|
11 | CHANGELOG_FROM_TAG=v1_0_38 |
---|
12 | AM_INIT_AUTOMAKE(survex, 1.0.39) |
---|
13 | RELEASE=1 |
---|
14 | |
---|
15 | AC_SUBST(RELEASE) |
---|
16 | AM_CONFIG_HEADER(config.h) |
---|
17 | |
---|
18 | dnl don't reformat the next line, miniam.pl pulls out the value |
---|
19 | COPYRIGHT_MSG="Copyright (C) 1990-2006 Olly Betts" |
---|
20 | |
---|
21 | AVEN_COPYRIGHT_MSG="Copyright (C) 1999-2002 Mark R. Shinwell" |
---|
22 | |
---|
23 | AC_DEFINE_UNQUOTED(COPYRIGHT_MSG, ["$COPYRIGHT_MSG"], [Copyright Message]) |
---|
24 | AC_DEFINE_UNQUOTED(AVEN_COPYRIGHT_MSG, ["$AVEN_COPYRIGHT_MSG"], |
---|
25 | [Copyright Message for Aven]) |
---|
26 | |
---|
27 | AC_SUBST(COPYRIGHT_MSG) |
---|
28 | AC_SUBST(AVEN_COPYRIGHT_MSG) |
---|
29 | |
---|
30 | dnl set PRETTYPACKAGE to PACKAGE with the first character capitalised |
---|
31 | PRETTYPACKAGE=`echo "$PACKAGE"|cut -b1|tr a-z A-Z``echo "$PACKAGE"|cut -b2-` |
---|
32 | AC_DEFINE_UNQUOTED(PRETTYPACKAGE, "$PRETTYPACKAGE", |
---|
33 | [Name of package (capitalised)]) |
---|
34 | AC_SUBST(PRETTYPACKAGE) |
---|
35 | |
---|
36 | dnl set COMMAVERSION to VERSION with the dots replaced by commas - |
---|
37 | dnl e.g. "0,99" or "1,0,22" |
---|
38 | COMMAVERSION=`echo "$VERSION"|tr '.' ','` |
---|
39 | AC_DEFINE_UNQUOTED(COMMAVERSION, $COMMAVERSION, |
---|
40 | [Version number of package (comma-separated)]) |
---|
41 | AC_SUBST(COMMAVERSION) |
---|
42 | |
---|
43 | PKGDOCDIR='${prefix}/doc/${PACKAGE}' |
---|
44 | AC_ARG_ENABLE(docdir, |
---|
45 | [ --enable-docdir=DIR Set directory for installing documentation to DIR], |
---|
46 | [case $enableval in |
---|
47 | yes|no) |
---|
48 | AC_MSG_ERROR([configure: Syntax: configure --enable-docdir=DIR]) ;; |
---|
49 | esac |
---|
50 | PKGDOCDIR="$enableval" |
---|
51 | ] |
---|
52 | ) |
---|
53 | PKGDOCDIR_EXPANDED=`( |
---|
54 | test NONE = "$prefix" && prefix="$ac_default_prefix" |
---|
55 | test NONE = "$exec_prefix" && exec_prefix="$prefix" |
---|
56 | eval echo "$PKGDOCDIR" |
---|
57 | )` |
---|
58 | AC_SUBST(PKGDOCDIR) |
---|
59 | AC_SUBST(PKGDOCDIR_EXPANDED) |
---|
60 | |
---|
61 | DEFAULTLANG=en |
---|
62 | AC_ARG_ENABLE(defaultlang, |
---|
63 | [ --enable-defaultlang=LANG Set the default language for messages to LANG], |
---|
64 | [case $enableval in |
---|
65 | yes|no) # until we support Norwegian... |
---|
66 | AC_MSG_ERROR([configure: Syntax: configure --enable-defaultlang=LANGUAGE]) ;; |
---|
67 | esac |
---|
68 | DEFAULTLANG="$enableval" |
---|
69 | AC_DEFINE_UNQUOTED(DEFAULTLANG, [$enableval], [Default language for messages]) |
---|
70 | ] |
---|
71 | ) |
---|
72 | AC_SUBST(DEFAULTLANG) |
---|
73 | |
---|
74 | AC_ARG_ENABLE(testprogs, |
---|
75 | [ --enable-testprogs Enable building of various test harness programs], |
---|
76 | [case $enableval in |
---|
77 | yes) TESTPROGS="dump3d printxbm" ;; |
---|
78 | no) TESTPROGS= ;; |
---|
79 | *) AC_MSG_ERROR(bad value $enableval for --enable-testprogs) ;; |
---|
80 | esac |
---|
81 | ] |
---|
82 | AC_SUBST(TESTPROGS) |
---|
83 | ) |
---|
84 | |
---|
85 | AC_CANONICAL_HOST |
---|
86 | |
---|
87 | dnl Checks for programs. |
---|
88 | AC_PROG_CC |
---|
89 | AC_PROG_CPP |
---|
90 | |
---|
91 | AVEN='aven$(EXEEXT)' |
---|
92 | AC_ARG_ENABLE(aven, |
---|
93 | [ --disable-aven Don't try to build Aven cave viewer], |
---|
94 | [case $enableval in |
---|
95 | yes) ;; |
---|
96 | no) AVEN= ;; |
---|
97 | *) AC_MSG_ERROR(bad value $enableval for --enable-aven) ;; |
---|
98 | esac]) |
---|
99 | |
---|
100 | if test -n "$AVEN" ; then |
---|
101 | AC_PROG_CXX |
---|
102 | AC_PROG_CXXCPP |
---|
103 | else |
---|
104 | dnl We don't want to fail to build Survex just because there's no C++ |
---|
105 | dnl compiler installed, so we need to invoke AC_PROG_CXX conditionally. |
---|
106 | dnl This bodge is required in order to do that... |
---|
107 | am__fastdepCXX_TRUE='#' |
---|
108 | am__fastdepCXX_FALSE= |
---|
109 | fi |
---|
110 | |
---|
111 | AC_LANG_C |
---|
112 | |
---|
113 | AC_PROG_MAKE_SET |
---|
114 | |
---|
115 | AC_EXEEXT |
---|
116 | AC_OBJEXT |
---|
117 | |
---|
118 | case $host_os in |
---|
119 | *mingw*|*cygwin*|windows*) mswindows=yes ;; |
---|
120 | *) mswindows=no ;; |
---|
121 | esac |
---|
122 | |
---|
123 | case $host in |
---|
124 | powerpc-*-darwin*) macosx=yes ;; # wxWindows uses this to detect MacOS X |
---|
125 | *) macosx=no ;; |
---|
126 | esac |
---|
127 | |
---|
128 | AC_C_BIGENDIAN |
---|
129 | |
---|
130 | AC_ARG_VAR(STRIP, [Command for discarding symbols from object files]) |
---|
131 | AC_PATH_TOOL(STRIP, strip, [echo "not stripping "]) |
---|
132 | |
---|
133 | AC_CHECK_LIB(m, sqrt) |
---|
134 | |
---|
135 | AC_PATH_XTRA |
---|
136 | |
---|
137 | WINPROGS= |
---|
138 | if test yes = "$mswindows"; then |
---|
139 | WINPROGS='printwin$(EXEEXT) editwrap$(EXEEXT)' |
---|
140 | AC_MSG_RESULT(building printwin and editwrap) |
---|
141 | fi |
---|
142 | AC_SUBST(WINPROGS) |
---|
143 | |
---|
144 | AC_ARG_VAR(WXCONFIG, [Old name for WX_CONFIG, accepted for compatibility]) |
---|
145 | AC_ARG_VAR(WX_CONFIG, [wxWidgets configuration script to use to build Aven]) |
---|
146 | : ${WX_CONFIG="$WXCONFIG"} |
---|
147 | |
---|
148 | if test yes = "$no_x"; then |
---|
149 | AC_MSG_RESULT([not building xcaverot (X libraries not found or disabled)]) |
---|
150 | if test -z "$WX_CONFIG" && test no = "$mswindows"; then |
---|
151 | AC_MSG_RESULT([not building aven (X libraries not found or disabled)]) |
---|
152 | AVEN= |
---|
153 | fi |
---|
154 | else |
---|
155 | AC_CHECK_LIB(Xext, XdbeQueryExtension, X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS", , |
---|
156 | $X_LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS) |
---|
157 | CAVEROT=xcaverot ${CAVEROT} |
---|
158 | AC_MSG_RESULT(building xcaverot) |
---|
159 | fi |
---|
160 | |
---|
161 | AM_CONDITIONAL(WIN32, [test yes = "$mswindows"]) |
---|
162 | AM_CONDITIONAL(MACOSX, [test yes = "$macosx"]) |
---|
163 | |
---|
164 | if test -n "$AVEN"; then |
---|
165 | if test -n "$WX_CONFIG" ; then |
---|
166 | dnl WX_CONFIG specified - sanity check the value |
---|
167 | dnl don't check for --ldflags - older wx-config didn't do that |
---|
168 | if (exec >&5 2>&5;$WX_CONFIG --libs --cflags --cxxflags;exit $?) then |
---|
169 | : |
---|
170 | else |
---|
171 | AC_MSG_ERROR(['$WX_CONFIG --libs --cflags --cxxflags' doesn't work, bailing out]) |
---|
172 | fi |
---|
173 | else |
---|
174 | # prefer wx2.6 or wx2.8 - a few things work better with it than with wx2.4. |
---|
175 | if test yes = "$macosx" ; then |
---|
176 | AC_PATH_PROGS(WX_CONFIG, [wxmac-2.8-config wxmac-2.6-config wxmac-2.4-config wxmac-config]) |
---|
177 | wxdef=__WXMAC__ |
---|
178 | elif test yes = "$mswindows" ; then |
---|
179 | AC_PATH_PROGS(WX_CONFIG, [wxmsw-2.8-config wxmsw-2.6-config wxmsw-2.4-config wxmsw-config]) |
---|
180 | wxdef=__WXMSW__ |
---|
181 | else |
---|
182 | AC_PATH_PROGS(WX_CONFIG, [wxgtk-2.8-config wxgtk-2.6-config wxgtk-2.4-config wxgtk-config]) |
---|
183 | wxdef=__WXGTK__ |
---|
184 | fi |
---|
185 | if test -z "$WX_CONFIG" ; then |
---|
186 | dnl see if wx-config exists and is for the correct version |
---|
187 | AC_PATH_PROGS(WX_CONFIG, [wx-config]) |
---|
188 | if test -n "$WX_CONFIG" ; then |
---|
189 | if (exec >&5 2>&5;$WX_CONFIG --cflags|grep -e -D"$wxdef";exit $?) then |
---|
190 | : |
---|
191 | else |
---|
192 | WX_CONFIG= |
---|
193 | fi |
---|
194 | fi |
---|
195 | fi |
---|
196 | if test -z "$WX_CONFIG" ; then |
---|
197 | AC_MSG_RESULT([not building aven (wxWindows not found)]) |
---|
198 | AVEN= |
---|
199 | fi |
---|
200 | fi |
---|
201 | |
---|
202 | if test -n "$AVEN"; then |
---|
203 | WX_LIBS=`$WX_CONFIG --libs` |
---|
204 | AC_SUBST(WX_LIBS) |
---|
205 | dnl older wx-config didn't support this - error goes to stderr, with |
---|
206 | dnl nothing to stdout, so just ignore stderr |
---|
207 | WX_LDFLAGS=`$WX_CONFIG --ldflags 2> /dev/null` |
---|
208 | AC_SUBST(WX_LDFLAGS) |
---|
209 | WX_CFLAGS=`$WX_CONFIG --cflags` |
---|
210 | AC_SUBST(WX_CFLAGS) |
---|
211 | WX_CXXFLAGS=`$WX_CONFIG --cxxflags` |
---|
212 | AC_SUBST(WX_CXXFLAGS) |
---|
213 | AC_MSG_RESULT(building aven) |
---|
214 | fi |
---|
215 | fi |
---|
216 | |
---|
217 | AM_CONDITIONAL(AVEN, [test -n "$AVEN"]) |
---|
218 | |
---|
219 | AC_LANG_C |
---|
220 | |
---|
221 | AC_SUBST(CAVEROT) |
---|
222 | AC_SUBST(AVEN) |
---|
223 | |
---|
224 | dnl only build extra man pages on Unix - the ".exe" messes us up otherwise |
---|
225 | dnl FIXME: probably no point building man pages except on Unix |
---|
226 | if test -z "$ac_exeext" ; then |
---|
227 | dnl can't use \> as freebsd sed doesn't support it |
---|
228 | EXTRA_MANS=`echo "$CAVEROT $AVEN"|sed 's/\$(EXEEXT)//g;s/\([[^ ]]\) /\1.1 /g;s/\(.\)$/\1.1/'` |
---|
229 | else |
---|
230 | EXTRA_MANS= |
---|
231 | fi |
---|
232 | AC_SUBST(EXTRA_MANS) |
---|
233 | |
---|
234 | dnl caverot libraries... |
---|
235 | AC_SUBST(CRLIB) |
---|
236 | dnl caverot platform specific sources... |
---|
237 | AC_SUBST(CROBJX) |
---|
238 | |
---|
239 | dnl Checks for header files. |
---|
240 | AC_HEADER_STDC |
---|
241 | dnl don't use AC_CHECK_FUNCS for setjmp - mingw #define-s it to _setjmp |
---|
242 | AC_CHECK_HEADERS(limits.h string.h setjmp.h) |
---|
243 | |
---|
244 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
245 | AC_C_CONST |
---|
246 | AC_TYPE_SIZE_T |
---|
247 | AC_STRUCT_TM |
---|
248 | AC_TYPE_SIGNAL |
---|
249 | |
---|
250 | dnl check if CLOCKS_PER_SEC is defined by time.h (as ANSI says it should be) |
---|
251 | dnl if it isn't, assume it is 1000000, as it is on SunOS 4 |
---|
252 | AC_TRY_COMPILE([#include <time.h>],[ |
---|
253 | #ifndef CLOCKS_PER_SEC |
---|
254 | choke me |
---|
255 | #endif |
---|
256 | ], , AC_DEFINE(CLOCKS_PER_SEC, 1000000, [For old systems which don't define it themselves])) |
---|
257 | |
---|
258 | dnl Look for a signed 32 bit integer type |
---|
259 | AC_MSG_CHECKING(for 32 bit integer type) |
---|
260 | AC_TRY_COMPILE(,[switch (0) { case (sizeof(int)==4): case 0: break; }], |
---|
261 | INT32_T=int, |
---|
262 | AC_TRY_COMPILE(,[switch (0) { case (sizeof(long)==4): case 0: break; }], |
---|
263 | INT32_T=long, |
---|
264 | AC_MSG_ERROR(not found) |
---|
265 | ) |
---|
266 | ) |
---|
267 | AC_MSG_RESULT($INT32_T) |
---|
268 | AC_DEFINE_UNQUOTED(INT32_T,$INT32_T,[signed 32 bit integer type]) |
---|
269 | |
---|
270 | dnl Look for a signed 16 bit integer type |
---|
271 | AC_MSG_CHECKING(for 16 bit integer type) |
---|
272 | AC_TRY_COMPILE(,[switch (0) { case (sizeof(short)==2): case 0: break; }], |
---|
273 | INT16_T=short, |
---|
274 | AC_TRY_COMPILE(,[switch (0) { case (sizeof(int)==2): case 0: break; }], |
---|
275 | INT16_T=int, |
---|
276 | AC_MSG_ERROR(not found) |
---|
277 | ) |
---|
278 | ) |
---|
279 | AC_MSG_RESULT($INT16_T) |
---|
280 | AC_DEFINE_UNQUOTED(INT16_T,$INT16_T,[signed 16 bit integer type]) |
---|
281 | |
---|
282 | dnl Checks for library functions. |
---|
283 | AC_FUNC_STRFTIME |
---|
284 | if test yes != "$ac_cv_func_strftime"; then |
---|
285 | AC_LIBOBJ(strftime) |
---|
286 | fi |
---|
287 | AC_FUNC_VPRINTF |
---|
288 | dnl check for strcasecmp here as well as below - this one is to get |
---|
289 | dnl HAVE_STRCASECMP defined if appropriate (for img.c) |
---|
290 | AC_CHECK_FUNCS(popen signal getpwuid round strcasecmp hypot) |
---|
291 | |
---|
292 | dnl difftime seems to be an ANSI invention |
---|
293 | AC_CHECK_FUNCS(difftime) |
---|
294 | |
---|
295 | dnl try to find a case-insensitive compare |
---|
296 | |
---|
297 | strcasecmp=no |
---|
298 | dnl The order of these tests is important. |
---|
299 | AC_CHECK_FUNC(strcasecmp, [strcasecmp=strcasecmp]) |
---|
300 | if test no = "$strcasecmp"; then |
---|
301 | AC_CHECK_FUNC(stricmp, [strcasecmp=stricmp]) |
---|
302 | fi |
---|
303 | if test no = "$strcasecmp"; then |
---|
304 | AC_CHECK_FUNC(strcmpi, [strcasecmp=strcmpi]) |
---|
305 | fi |
---|
306 | |
---|
307 | AC_MSG_CHECKING([how to compare strings ignoring case]) |
---|
308 | case $strcasecmp in |
---|
309 | no) |
---|
310 | AC_LIBOBJ(strcasecmp) |
---|
311 | AC_MSG_RESULT([using own implementation of strcasecmp]) ;; |
---|
312 | strcasecmp) |
---|
313 | AC_MSG_RESULT([strcasecmp]) ;; |
---|
314 | *) |
---|
315 | AC_DEFINE_UNQUOTED(strcasecmp, "$strcasecmp", |
---|
316 | [strcasecmp define for systems which call it something else]) |
---|
317 | AC_MSG_RESULT([$strcasecmp]) ;; |
---|
318 | esac |
---|
319 | |
---|
320 | AC_MSG_CHECKING(for sgmltools v2 or v3) |
---|
321 | case `(exec 2>&5 ; sgmltools --version)` in |
---|
322 | *" version 2"*) |
---|
323 | sgmltools=sgmltools |
---|
324 | AC_MSG_RESULT(yes) ;; |
---|
325 | *" version 3"*) |
---|
326 | sgmltools=sgmltools |
---|
327 | AC_MSG_RESULT(yes) ;; |
---|
328 | *) |
---|
329 | sgmltools="$MISSING sgmltools" |
---|
330 | AC_MSG_RESULT(no) ;; |
---|
331 | esac |
---|
332 | AC_SUBST(sgmltools) |
---|
333 | |
---|
334 | dnl extra warning flags for building with GCC |
---|
335 | if test yes = "$GCC"; then |
---|
336 | if test yes = "$cross_compiling"; then |
---|
337 | AM_CFLAGS="$AM_CFLAGS -Werror -Wall -Wunused -Wpointer-arith\ |
---|
338 | -Wwrite-strings -Wcast-align" |
---|
339 | AM_CXXFLAGS="$AM_CXXFLAGS -Werror -Wall -Wunused -Wpointer-arith\ |
---|
340 | -Wwrite-strings -Wcast-align" |
---|
341 | else |
---|
342 | AM_CFLAGS="$AM_CFLAGS -Wall -W -Wunused -Wshadow -Wpointer-arith\ |
---|
343 | -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wnested-externs\ |
---|
344 | -Wcast-align" |
---|
345 | dnl -W causes problems with wxWindows |
---|
346 | AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wunused -Wshadow -Wpointer-arith\ |
---|
347 | -Wwrite-strings -Wcast-align" |
---|
348 | fi |
---|
349 | dnl too many complaints from headers, etc: -Wconversion |
---|
350 | fi |
---|
351 | AC_SUBST(AM_CFLAGS) |
---|
352 | AC_SUBST(AM_CXXFLAGS) |
---|
353 | |
---|
354 | AC_ARG_ENABLE(profiling, |
---|
355 | [ --enable-profiling Build binaries to generate profiling information], |
---|
356 | [case $enableval in |
---|
357 | yes) AM_CXXFLAGS="$AM_CXXFLAGS -pg" |
---|
358 | AM_CFLAGS="$AM_CFLAGS -pg" |
---|
359 | AC_MSG_RESULT(building binaries to generate profiling information);; |
---|
360 | no) ;; |
---|
361 | *) AC_MSG_ERROR(bad value $enableval for --enable-profiling) ;; |
---|
362 | esac]) |
---|
363 | |
---|
364 | DOCS_OTHER="manual.rtf manual.txt manual.ps" |
---|
365 | AC_SUBST(DOCS_OTHER) |
---|
366 | |
---|
367 | HTMLFILES="AUTHORS.htm ChngeLog.htm GPL.htm HACKING.htm NEWS.htm OLDNEWS.htm TODO.htm index.htm 3dformat.htm" |
---|
368 | AC_SUBST(HTMLFILES) |
---|
369 | |
---|
370 | EXTRA_TEXT="AUTHORS COPYING NEWS TODO ChangeLog" |
---|
371 | AC_SUBST(EXTRA_TEXT) |
---|
372 | |
---|
373 | AC_SUBST_FILE(DESC) |
---|
374 | DESC=desc.txt |
---|
375 | AC_SUBST_FILE(AVENDESC) |
---|
376 | AVENDESC=desc-aven.txt |
---|
377 | AC_SUBST_FILE(SVXEDITDESC) |
---|
378 | SVXEDITDESC=desc-svxedit.txt |
---|
379 | |
---|
380 | dnl Don't define DATADIR if building for MS Windows - it won't be used, and |
---|
381 | dnl can conflict with the DATADIR typedef in objidl.h |
---|
382 | if test no = "$mswindows"; then |
---|
383 | AC_DEFINE_DIR(DATADIR, datadir, [Location of platform independent support files]) |
---|
384 | fi |
---|
385 | |
---|
386 | AC_OUTPUT(Makefile src/Makefile doc/Makefile lib/Makefile lib/icons/Makefile |
---|
387 | tests/Makefile debian/Makefile survex.iss doc/index.htm doc/survex.1 |
---|
388 | src/borlandc/config.h src/riscos/config.h src/msvc/config.h |
---|
389 | doc/version.ent debian/copyright survex.spec src/svxedit lib/survex.keys) |
---|