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.50 or later for AC_ARG_VAR. 2.59 has been around for dnl long enough, that we might as well just require that. AC_PREREQ(2.59) AC_INIT(src/aven.cc) AM_INIT_AUTOMAKE(survex, 1.1.13) RELEASE=1 AC_SUBST(RELEASE) AM_CONFIG_HEADER(config.h) COPYRIGHT_MSG="Copyright (C) 1990-2010 Olly Betts" AVEN_COPYRIGHT_MSG="Copyright (C) 1999-2003,2005,2006 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) COPYRIGHT_MSG_UTF8=`echo "$COPYRIGHT_MSG"|sed 's/(C)/©/'` AVEN_COPYRIGHT_MSG_UTF8=`echo "$AVEN_COPYRIGHT_MSG"|sed 's/(C)/©/'` AC_DEFINE_UNQUOTED(COPYRIGHT_MSG_UTF8, ["$COPYRIGHT_MSG_UTF8"], [Copyright Message in UTF-8]) AC_DEFINE_UNQUOTED(AVEN_COPYRIGHT_MSG_UTF8, ["$AVEN_COPYRIGHT_MSG_UTF8"], [Copyright Message for Aven in UTF-8]) 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}/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 ;; 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 AC_PROG_CXX AC_PROG_CXXCPP AM_PROG_CC_C_O AC_LANG_C AC_PROG_MAKE_SET 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='editwrap$(EXEEXT)' AC_MSG_RESULT(building 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"} AM_CONDITIONAL(WIN32, [test yes = "$mswindows"]) AM_CONDITIONAL(MACOSX, [test yes = "$macosx"]) 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 if test yes = "$macosx" ; then dnl FIXME: Not sure if this is useful for newer wx... AC_PATH_PROGS(WX_CONFIG, [wxmac-2.8-config wxmac-2.6-config wxmac-2.7-config wxmac-config]) wxdef=__WXMAC__ elif test yes = "$mswindows" ; then dnl FIXME: Not sure if this is useful for newer wx... AC_PATH_PROGS(WX_CONFIG, [wxmsw-2.8-config wxmac-2.6-config wxmac-2.7-config wxmac-config]) wxdef=__WXMSW__ else 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_ERROR([wxWidgets not found. Run ./configure WX_CONFIG=/path/to/wx-config]) fi fi dnl Unless the user has explicitly specified a --unicode setting, prefer dnl --unicode=yes if we can get it. case $WX_CONFIG in *--unicode=*) ;; *) if (exec >&5 2>&5;$WX_CONFIG --unicode=yes --version;exit $?) ; then WX_CONFIG="$WX_CONFIG --unicode=yes" elif (exec >&5 2>&5;$WX_CONFIG --unicode=no --version;exit $?) ; then WX_CONFIG="$WX_CONFIG --unicode=no" fi ;; esac dnl Call wx-config twice to avoid getting a newline in WX_LIBS. WX_LIBS=`$WX_CONFIG --libs`" "`$WX_CONFIG --gl-libs` dnl Needed for nvidia drivers on linux (for some setups anyway). AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, [WX_LIBS="$WX_LIBS -lXxf86vm"], [], [$WX_LIBS]) AC_SUBST(WX_LIBS) dnl Older wx-config didn't support --ldflags (2.6.3 doesn't) - error goes to dnl stderr, with 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) dnl Check for ffmpeg MOVIE_LIBS= AC_CHECK_LIB(avcodec, avcodec_init, [AC_CHECK_LIB(avformat, av_register_all, [AC_CHECK_HEADERS([avformat.h], [MOVIE_LIBS="-lavformat -lavcodec"])], [], [-lavcodec $WX_LIBS])]) AC_SUBST(MOVIE_LIBS) AC_LANG_C 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 sys/select.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 lstat) dnl difftime seems to be an ANSI invention AC_CHECK_FUNCS(difftime) 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) if test : != "$SGMLTOOLS" ; then : ${SGMLTOOLS=sgmltools} case `(exec 2>&5 ; $SGMLTOOLS --version)` in *" version 3"*) AC_MSG_RESULT([$SGMLTOOLS]) ;; *" version 2"*) AC_MSG_RESULT([$SGMLTOOLS]) ;; *) SGMLTOOLS="$MISSING sgmltools" AC_MSG_RESULT(not found) ;; esac else AC_MSG_RESULT([$SGMLTOOLS]) fi AC_SUBST(SGMLTOOLS) AC_ARG_VAR(SGMLTOOLS, [sgmltools command]) AC_MSG_CHECKING(for docbook-to-man) if test : != "$DOCBOOK_TO_MAN" ; then : ${DOCBOOK_TO_MAN=docbook-to-man} $DOCBOOK_TO_MAN 2> /dev/null if test $? = 1 ; then AC_MSG_RESULT([$DOCBOOK_TO_MAN]) else DOCBOOK_TO_MAN="$MISSING docbook-to-man" AC_MSG_RESULT([not found]) fi else AC_MSG_RESULT([$DOCBOOK_TO_MAN]) fi AC_SUBST(DOCBOOK_TO_MAN) AC_ARG_VAR(DOCBOOK_TO_MAN, [docbook-to-man command]) dnl extra warning flags for building with GCC if test yes = "$GCC"; then if test yes = "$cross_compiling"; then dnl AM_CFLAGS="$AM_CFLAGS -Werror -Wall -Wunused -Wpointer-arith\ dnl -Wwrite-strings -Wcast-align" dnl -Wsign-compare causes a warning with the mingw FD_SET macro, so we have dnl to disable it for mingw builds. AM_CFLAGS="$AM_CFLAGS -Wall -Wunused -Wpointer-arith\ -Wwrite-strings -Wcast-align" AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wunused -Wpointer-arith\ -Wwrite-strings -Wcast-align -Wno-sign-compare" 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 AC_CONFIG_FILES([make_release], [chmod +x make_release]) AC_CONFIG_FILES([ Makefile src/Makefile doc/Makefile lib/Makefile lib/icons/Makefile tests/Makefile vim/Makefile survex.iss doc/index.htm doc/survex.1 doc/version.ent survex.spec src/svxedit lib/survex.keys ]) AC_OUTPUT dnl FIXME update msvc makefile for 1.1 branch dnl src/msvc/config.h