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