source: git/configure.in @ ab920c2

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

configure.in: Backport change to add support for WX_CONFIG as a
preferred new replacement for WXCONFIG. Add wx2.8 and remove
wx2.5 (development version) from the list of wx versions to
check.

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

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