source: git/configure.in @ a39e539

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

Backport change from 1.2.0:
configure.in: No need for AC_PROG_MAKE_SET when using automake.

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

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