source: git/configure.in @ d9f8c1c

RELEASE/1.0
Last change on this file since d9f8c1c was d9f8c1c, checked in by Olly Betts <olly@…>, 13 years ago

Backport change from 1.2.0:
configure.in: Only ask for core wx lib to avoid linking to a load of
others we don't use.

git-svn-id: file:///home/survex-svn/survex/branches/1.0@3728 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

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