dnl Process this file with autoconf to produce a configure script dnl CFLAGS=-DDEFAULTLANG=fr to build with French as the default language. dnl Need autoconf 2.13 or later for 3 argument version of AC_DEFINE dnl Need autoconf 2.50 or later for AC_ARG_VAR AC_PREREQ(2.50) AC_INIT(src/cavern.c) AM_INIT_AUTOMAKE(survex, 1.0.40) RELEASE=1 AC_SUBST(RELEASE) AM_CONFIG_HEADER(config.h) dnl don't reformat the next line, miniam.pl pulls out the value COPYRIGHT_MSG="Copyright (C) 1990-2008,2010 Olly Betts" AVEN_COPYRIGHT_MSG="Copyright (C) 1999-2003 Mark R. Shinwell" AC_DEFINE_UNQUOTED(COPYRIGHT_MSG, ["$COPYRIGHT_MSG"], [Copyright Message]) AC_DEFINE_UNQUOTED(AVEN_COPYRIGHT_MSG, ["$AVEN_COPYRIGHT_MSG"], [Copyright Message for Aven]) AC_SUBST(COPYRIGHT_MSG) AC_SUBST(AVEN_COPYRIGHT_MSG) dnl set PRETTYPACKAGE to PACKAGE with the first character capitalised PRETTYPACKAGE=`echo "$PACKAGE"|cut -b1|tr a-z A-Z``echo "$PACKAGE"|cut -b2-` AC_DEFINE_UNQUOTED(PRETTYPACKAGE, "$PRETTYPACKAGE", [Name of package (capitalised)]) AC_SUBST(PRETTYPACKAGE) dnl set COMMAVERSION to VERSION with the dots replaced by commas - dnl e.g. "0,99" or "1,0,22" COMMAVERSION=`echo "$VERSION"|tr '.' ','` AC_DEFINE_UNQUOTED(COMMAVERSION, $COMMAVERSION, [Version number of package (comma-separated)]) AC_SUBST(COMMAVERSION) PKGDOCDIR='${prefix}/share/doc/${PACKAGE}' AC_ARG_ENABLE(docdir, [ --enable-docdir=DIR Set directory for installing documentation to DIR], [case $enableval in yes|no) AC_MSG_ERROR([configure: Syntax: configure --enable-docdir=DIR]) ;; esac PKGDOCDIR="$enableval" ] ) PKGDOCDIR_EXPANDED=`( test NONE = "$prefix" && prefix="$ac_default_prefix" test NONE = "$exec_prefix" && exec_prefix="$prefix" eval echo "$PKGDOCDIR" )` AC_SUBST(PKGDOCDIR) AC_SUBST(PKGDOCDIR_EXPANDED) DEFAULTLANG=en AC_ARG_ENABLE(defaultlang, [ --enable-defaultlang=LANG Set the default language for messages to LANG], [case $enableval in yes|no) # until we support Norwegian... AC_MSG_ERROR([configure: Syntax: configure --enable-defaultlang=LANGUAGE]) ;; esac DEFAULTLANG="$enableval" AC_DEFINE_UNQUOTED(DEFAULTLANG, [$enableval], [Default language for messages]) ] ) AC_SUBST(DEFAULTLANG) AC_ARG_ENABLE(testprogs, [ --enable-testprogs Enable building of various test harness programs], [case $enableval in yes) TESTPROGS="dump3d printxbm" ;; no) TESTPROGS= ;; *) AC_MSG_ERROR(bad value $enableval for --enable-testprogs) ;; esac ] AC_SUBST(TESTPROGS) ) AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AVEN='aven$(EXEEXT)' AC_ARG_ENABLE(aven, [ --disable-aven Don't try to build Aven cave viewer], [case $enableval in yes) ;; no) AVEN= ;; *) AC_MSG_ERROR(bad value $enableval for --enable-aven) ;; esac]) if test -n "$AVEN" ; then AC_PROG_CXX AC_PROG_CXXCPP else dnl We don't want to fail to build Survex just because there's no C++ dnl compiler installed, so we need to invoke AC_PROG_CXX conditionally. dnl This bodge is required in order to do that... am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi AM_PROG_CC_C_O AC_LANG_C AC_EXEEXT AC_OBJEXT case $host_os in *mingw*|*cygwin*|windows*) mswindows=yes ;; *) mswindows=no ;; esac case $host in powerpc-*-darwin*) macosx=yes ;; # wxWidgets uses this to detect MacOS X *) macosx=no ;; esac AC_C_BIGENDIAN AC_ARG_VAR(STRIP, [Command for discarding symbols from object files]) AC_PATH_TOOL(STRIP, strip, [echo "not stripping "]) AC_CHECK_LIB(m, sqrt) AC_PATH_XTRA WINPROGS= if test yes = "$mswindows"; then WINPROGS='printwin$(EXEEXT) editwrap$(EXEEXT)' AC_MSG_RESULT(building printwin and editwrap) fi AC_SUBST(WINPROGS) AC_ARG_VAR(WXCONFIG, [Old name for WX_CONFIG, accepted for compatibility]) AC_ARG_VAR(WX_CONFIG, [wxWidgets configuration script to use to build Aven]) : ${WX_CONFIG="$WXCONFIG"} if test yes = "$no_x"; then AC_MSG_RESULT([not building xcaverot (X libraries not found or disabled)]) if test -z "$WX_CONFIG" && test no = "$mswindows"; then AC_MSG_RESULT([not building aven (X libraries not found or disabled)]) AVEN= fi else AC_CHECK_LIB(Xext, XdbeQueryExtension, X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS", , $X_LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS) CAVEROT=xcaverot ${CAVEROT} AC_MSG_RESULT(building xcaverot) fi AM_CONDITIONAL(WIN32, [test yes = "$mswindows"]) AM_CONDITIONAL(MACOSX, [test yes = "$macosx"]) if test -n "$AVEN"; then if test -n "$WX_CONFIG" ; then dnl WX_CONFIG specified - sanity check the value dnl don't check for --ldflags - older wx-config didn't do that if (exec >&5 2>&5;$WX_CONFIG --libs --cflags --cxxflags;exit $?) then : else AC_MSG_ERROR(['$WX_CONFIG --libs --cflags --cxxflags' doesn't work, bailing out]) fi else # prefer wx2.6 or wx2.8 - a few things work better with it than with wx2.4. if test yes = "$macosx" ; then AC_PATH_PROGS(WX_CONFIG, [wxmac-2.8-config wxmac-2.6-config wxmac-2.4-config wxmac-config]) wxdef=__WXMAC__ elif test yes = "$mswindows" ; then AC_PATH_PROGS(WX_CONFIG, [wxmsw-2.8-config wxmsw-2.6-config wxmsw-2.4-config wxmsw-config]) wxdef=__WXMSW__ else AC_PATH_PROGS(WX_CONFIG, [wxgtk-2.8-config wxgtk-2.6-config wxgtk-2.4-config wxgtk-config]) wxdef=__WXGTK__ fi if test -z "$WX_CONFIG" ; then dnl see if wx-config exists and is for the correct version AC_PATH_PROGS(WX_CONFIG, [wx-config]) if test -n "$WX_CONFIG" ; then if (exec >&5 2>&5;$WX_CONFIG --cflags|grep -e -D"$wxdef";exit $?) then : else WX_CONFIG= fi fi fi if test -z "$WX_CONFIG" ; then AC_MSG_RESULT([not building aven (wxWidgets not found)]) AVEN= fi fi if test -n "$AVEN"; then WX_LIBS=`$WX_CONFIG --libs` AC_SUBST(WX_LIBS) dnl older wx-config didn't support this - error goes to stderr, with dnl nothing to stdout, so just ignore stderr WX_LDFLAGS=`$WX_CONFIG --ldflags 2> /dev/null` AC_SUBST(WX_LDFLAGS) WX_CFLAGS=`$WX_CONFIG --cflags` AC_SUBST(WX_CFLAGS) WX_CXXFLAGS=`$WX_CONFIG --cxxflags` AC_SUBST(WX_CXXFLAGS) AC_MSG_RESULT(building aven) fi fi AM_CONDITIONAL(AVEN, [test -n "$AVEN"]) AC_LANG_C AC_SUBST(CAVEROT) AC_SUBST(AVEN) dnl only build extra man pages on Unix - the ".exe" messes us up otherwise dnl FIXME: probably no point building man pages except on Unix if test -z "$ac_exeext" ; then dnl can't use \> as freebsd sed doesn't support it EXTRA_MANS=`echo "$CAVEROT $AVEN"|sed 's/\$(EXEEXT)//g;s/\([[^ ]]\) /\1.1 /g;s/\(.\)$/\1.1/'` else EXTRA_MANS= fi AC_SUBST(EXTRA_MANS) dnl caverot libraries... AC_SUBST(CRLIB) dnl caverot platform specific sources... AC_SUBST(CROBJX) dnl Checks for header files. AC_HEADER_STDC dnl don't use AC_CHECK_FUNCS for setjmp - mingw #define-s it to _setjmp AC_CHECK_HEADERS(limits.h string.h setjmp.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_STRUCT_TM AC_TYPE_SIGNAL dnl check if CLOCKS_PER_SEC is defined by time.h (as ANSI says it should be) dnl if it isn't, assume it is 1000000, as it is on SunOS 4 AC_TRY_COMPILE([#include ],[ #ifndef CLOCKS_PER_SEC choke me #endif ], , AC_DEFINE(CLOCKS_PER_SEC, 1000000, [For old systems which don't define it themselves])) dnl Look for a signed 32 bit integer type AC_MSG_CHECKING(for 32 bit integer type) AC_TRY_COMPILE(,[switch (0) { case (sizeof(int)==4): case 0: break; }], INT32_T=int, AC_TRY_COMPILE(,[switch (0) { case (sizeof(long)==4): case 0: break; }], INT32_T=long, AC_MSG_ERROR(not found) ) ) AC_MSG_RESULT($INT32_T) AC_DEFINE_UNQUOTED(INT32_T,$INT32_T,[signed 32 bit integer type]) dnl Look for a signed 16 bit integer type AC_MSG_CHECKING(for 16 bit integer type) AC_TRY_COMPILE(,[switch (0) { case (sizeof(short)==2): case 0: break; }], INT16_T=short, AC_TRY_COMPILE(,[switch (0) { case (sizeof(int)==2): case 0: break; }], INT16_T=int, AC_MSG_ERROR(not found) ) ) AC_MSG_RESULT($INT16_T) AC_DEFINE_UNQUOTED(INT16_T,$INT16_T,[signed 16 bit integer type]) dnl Checks for library functions. AC_FUNC_STRFTIME if test yes != "$ac_cv_func_strftime"; then AC_LIBOBJ(strftime) fi AC_FUNC_VPRINTF dnl check for strcasecmp here as well as below - this one is to get dnl HAVE_STRCASECMP defined if appropriate (for img.c) AC_CHECK_FUNCS(popen signal getpwuid round strcasecmp hypot) dnl difftime seems to be an ANSI invention AC_CHECK_FUNCS(difftime) dnl Much faster than using getc()/putc(), at least on Linux. AC_CHECK_FUNCS([getc_unlocked putc_unlocked]) dnl try to find a case-insensitive compare strcasecmp=no dnl The order of these tests is important. AC_CHECK_FUNC(strcasecmp, [strcasecmp=strcasecmp]) if test no = "$strcasecmp"; then AC_CHECK_FUNC(stricmp, [strcasecmp=stricmp]) fi if test no = "$strcasecmp"; then AC_CHECK_FUNC(strcmpi, [strcasecmp=strcmpi]) fi AC_MSG_CHECKING([how to compare strings ignoring case]) case $strcasecmp in no) AC_LIBOBJ(strcasecmp) AC_MSG_RESULT([using own implementation of strcasecmp]) ;; strcasecmp) AC_MSG_RESULT([strcasecmp]) ;; *) AC_DEFINE_UNQUOTED(strcasecmp, "$strcasecmp", [strcasecmp define for systems which call it something else]) AC_MSG_RESULT([$strcasecmp]) ;; esac AC_MSG_CHECKING(for sgmltools v2 or v3) case `(exec 2>&5 ; sgmltools --version)` in *" version 2"*) sgmltools=sgmltools AC_MSG_RESULT(yes) ;; *" version 3"*) sgmltools=sgmltools AC_MSG_RESULT(yes) ;; *) sgmltools="$MISSING sgmltools" AC_MSG_RESULT(no) ;; esac AC_SUBST(sgmltools) dnl extra warning flags for building with GCC if test yes = "$GCC"; then if test yes = "$cross_compiling"; then AM_CFLAGS="$AM_CFLAGS -Werror -Wall -Wunused -Wpointer-arith\ -Wwrite-strings -Wcast-align" AM_CXXFLAGS="$AM_CXXFLAGS -Werror -Wall -Wunused -Wpointer-arith\ -Wwrite-strings -Wcast-align" else AM_CFLAGS="$AM_CFLAGS -Wall -W -Wunused -Wshadow -Wpointer-arith\ -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wnested-externs\ -Wcast-align" dnl -W causes problems with wxWidgets AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wunused -Wshadow -Wpointer-arith\ -Wwrite-strings -Wcast-align" fi dnl too many complaints from headers, etc: -Wconversion fi AC_SUBST(AM_CFLAGS) AC_SUBST(AM_CXXFLAGS) AC_ARG_ENABLE(profiling, [ --enable-profiling Build binaries to generate profiling information], [case $enableval in yes) AM_CXXFLAGS="$AM_CXXFLAGS -pg" AM_CFLAGS="$AM_CFLAGS -pg" AC_MSG_RESULT(building binaries to generate profiling information);; no) ;; *) AC_MSG_ERROR(bad value $enableval for --enable-profiling) ;; esac]) DOCS_OTHER="manual.rtf manual.txt manual.ps" AC_SUBST(DOCS_OTHER) HTMLFILES="AUTHORS.htm HACKING.htm NEWS.htm OLDNEWS.htm TODO.htm index.htm 3dformat.htm" AC_SUBST(HTMLFILES) EXTRA_TEXT="AUTHORS COPYING NEWS TODO ChangeLog" AC_SUBST(EXTRA_TEXT) AC_SUBST_FILE(DESC) DESC=desc.txt AC_SUBST_FILE(AVENDESC) AVENDESC=desc-aven.txt AC_SUBST_FILE(SVXEDITDESC) SVXEDITDESC=desc-svxedit.txt dnl Don't define DATADIR if building for MS Windows - it won't be used, and dnl can conflict with the DATADIR typedef in objidl.h if test no = "$mswindows"; then AC_DEFINE_DIR(DATADIR, datadir, [Location of platform independent support files]) fi AH_BOTTOM( [/* Use getc_unlocked() and putc_unlocked() where available, since they are * faster, and we don't multithread file accesses. */ #ifdef HAVE_GETC_UNLOCKED # define GETC(F) getc_unlocked(F) #else # define GETC(F) getc(F) #endif #ifdef HAVE_PUTC_UNLOCKED # define PUTC(C, F) putc_unlocked(C, F) #else # define PUTC(C, F) putc(C, F) #endif ]) AC_OUTPUT(Makefile src/Makefile doc/Makefile lib/Makefile lib/icons/Makefile tests/Makefile debian/Makefile survex.iss doc/index.htm doc/survex.7 src/borlandc/config.h src/riscos/config.h src/msvc/config.h doc/version.ent debian/copyright survex.spec src/svxedit lib/survex.keys lib/Info.plist)