dnl $Id: configure.in,v 1.8 1997-09-10 13:50:44 schmidt Exp $ dnl dnl configure.in - process this file with autoconf to generate dnl a configure script. dnl dnl See the INSTALL file for information on how the configure script dnl works. dnl # # - initialisation. # AC_REVISION($Id: configure.in,v 1.8 1997-09-10 13:50:44 schmidt Exp $) AC_INIT(canonicalform.cc) AC_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR(bin) # # Do not change version here!!! # dnl dnl Change version here, do not believe the comment in the dnl preceding lines. dnl factory_version="1.3a" # # - check withs and enables. # AC_ARG_WITH( memman, [ --with-memman(=) specify Factory memory manager. is either 'old' (default), 'new', or 'no'.], , [ if test "x$with_Singular" = xyes; then with_memman=no else with_memman=old fi ]) AC_ARG_WITH( gmp, [ --with-gmp(=(,)) specify where to find gmp library.]) AC_ARG_WITH( Singular, [ --with-Singular build for use with computer algebra system Singular.], , with_Singular=no) AC_ARG_ENABLE( streamio, [ --disable-streamio build Factory without stream IO], , [ if test "x$with_Singular" = xyes; then enable_streamio=no else enable_streamio=yes fi ]) AC_ARG_ENABLE( memdebug, [ --enable-memdebug= switch on memory management debugging. Meaningful with --with-memman=new only. may be either 'no' (default), 'normal', or 'full'.], , enable_memdebug=no) AC_ARG_ENABLE( assertions, [ --enable-assertions build Factory with assertions activated], , enable_assertions=no) AC_ARG_ENABLE( timing, [ --enable-timing build Factory so it will print timing information], , enable_timing=no) AC_ARG_ENABLE( debugoutput, [ --enable-debugoutput build Factory so it will print debugging information], , enable_debugoutput=no) # an ugly tribute to Singular AC_ARG_ENABLE( gmp, [ --enable-gmp together with --with-Singular means: installation in process, be graceful when there is no gmp.h], [ if test "x$with_Singular" = xyes && test "x$enable_gmp" != xno; then with_gmp='$(includedir)' fi ]) # # - check the results of --with-gmp. # case "$with_gmp" in yes|no|"") gmp_in_installation=no ;; '$(includedir)'|'${includedir}') gmp_in_installation=yes ;; *,*) saveIFS="$IFS"; IFS="${IFS}," set dummy $with_gmp IFS="$saveIFS" CPPFLAGS="-I$2 $CPPFLAGS" LDFLAGS="-L$3 $LDFLAGS" gmp_in_installation=no ;; *) CPPFLAGS="-I$with_gmp $CPPFLAGS" LDFLAGS="-L$with_gmp/../lib $LDFLAGS" gmp_in_installation=no ;; esac # # - check for CC and CXX but be careful about CFLAGS. # test "${CFLAGS+set}" = set || cflags_expl_set=no AC_PROG_CC test "${CXXFLAGS+set}" = set || cxxflags_expl_set=no AC_PROG_CXX if test "x$GCC" != xyes && test "x$GXX" != xyes; then AC_MSG_WARN(you better use gcc to compile Factory) else if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CXXFLAGS (instead of the configure default '-g -O')]) fi if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then AC_MSG_WARN([we will use '-O2 -fomit-frame-pointer' as default for CFLAGS (instead of the configure default '-g -O')]) fi fi # # - check for some other programs. # AC_PROG_CPP AC_PROG_CXXCPP AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_MAKE_SET AC_CHECK_PROG(AR, ar, ar, where-is-your-ar) AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison) # get absolute path of srcdir to avoid some funny problems when # feeding our results to other peoples configure via cache if echo "$srcdir" | grep '^/' > /dev/null 2> /dev/null; then abssrcdir="$srcdir" else abssrcdir="`pwd`/$srcdir" fi AC_PATH_PROG(MKINSTALLDIRS, mkinstalldirs, -mkdir, $PATH:$abssrcdir/bin) AC_PATH_PROG(MAKEHEADER, makeheader, , $abssrcdir/bin:$PATH) # # - check for libraries. # if test "x$gmp_in_installation" != xyes; then AC_CHECK_LIB(gmp, mpz_init) fi AC_CHECK_LIB(m, sqrt) # # - check for header files. # AC_LANG_CPLUSPLUS if test "x$gmp_in_installation" != xyes; then AC_CHECK_HEADERS(gmp.h, , [ AC_MSG_ERROR(gmp.h not found. Use option --with-gmp to specify path) ]) fi AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, , [ AC_MSG_ERROR(standard C header files not found) ]) if test "x$enable_streamio" != xno; then AC_CHECK_HEADERS(iostream.h strstream.h fstream.h, , [ AC_MSG_ERROR(C++ header files not found) ]) AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ]) fi if test "x$enable_timing" != xno; then AC_CHECK_HEADERS(sys/param.h sys/times.h, , [ AC_MSG_ERROR(sys/times.h or sys/param.h not found. Try configure --disable-timing) ]) fi # # - check for compiler characteristics. # # use C to check compiler characteristics instead of C++. On # nextstep, checking with C++ may fail. AC_LANG_C # cross-compiling ?! AC_C_CROSS if test "x$cross_compiling" = xyes; then AC_MSG_WARN([you better specify a cache file to get the values for cross-compiling right (call configure --cache-file=target.cache)]) fi AC_C_CONST AC_C_INLINE # arithmetic shift AC_MSG_CHECKING(whether your compiler does arithmetic shifts) AC_CACHE_VAL(ac_cv_shift, [ AC_TRY_RUN( [ int main() { if (-2 >> 1 == -1) exit(0); else exit(1); } ], ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=no) ]) if test "x$ac_cv_shift" = xyes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi # # - paths. # # we have to get datadir explicitely for config.h save_prefix="$prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix" expl_datadir=`eval echo "$datadir"` prefix="$save_prefix" # get absolute path of expl_datadir if echo "$expl_datadir" | grep -v '^/' > /dev/null 2> /dev/null; then expl_datadir="`pwd`/$expl_datadir" fi if test "x$with_Singular" = xyes; then gftabledir='${datadir}/Singular/gftables' expl_gftabledir="$expl_datadir/Singular/gftables" templatedir='${includedir}/templates' else gftabledir='${datadir}/factory/gftables' expl_gftabledir="$expl_datadir/factory/gftables" templatedir='${includedir}/templates' fi # # - the name of the game and the targets to create. # if test "x$with_Singular" = xyes; then libfactory=libsingcf.a factorysrc='$(basefactorysrc) $(singfactorysrc)' factoryincl='$(basefactoryincl) $(singfactoryincl)' memmansrc= memmanincl= alltargets=cf installtargets=installcf uninstalltargets=uninstallcf else libfactory=libcf.a factorysrc='$(basefactorysrc)' factoryincl='$(basefactoryincl)' memmansrc='$(basememmansrc)' memmanincl= alltargets=cf installtargets=installcf uninstalltargets=uninstallcf fi # # - set defines and variables according to our tests. # # CFLAGS if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then CFLAGS="-O2 -fomit-frame-pointer" fi # CXXFLAGS if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then CXXFLAGS="-O2 -fomit-frame-pointer" fi # ARFLAGS test "${ARFLAGS+set}" = set || ARFLAGS=cr # Singular if test "x$with_Singular" = xyes; then AC_DEFINE(SINGULAR) fi # arithmetic shift if test "x$ac_cv_shift" = xyes; then AC_DEFINE(HAS_ARITHMETIC_SHIFT) fi # gmp-stuff. we must not set these flags before the tests # are finished! if test "x$gmp_in_installation" = xyes; then CPPFLAGS="-I\$(includedir) $CPPFLAGS" LDFLAGS="-L\$(libdir) -lgmp $LDFLAGS" fi # memory manager if test "x$with_memman" != xno; then alltargets="$alltargets mem" installtargets="$installtargets installmem" uninstalltargets="$uninstalltargets uninstallmem" AC_DEFINE(USE_MEMUTIL) if test "x$with_memman" != xnew; then memmansrc="$memmansrc \$(oldmemmansrc)" memmanincl='$(oldmemmanincl)' AC_DEFINE(USE_OLD_MEMMAN) else memmansrc="$memmansrc \$(newmemmansrc)" memmanincl='$(newmemmanincl)' if test "x$enable_memdebug" = xfull; then AC_DEFINE(MDEBUG, 1) elif test "x$enable_memdebug" != xno; then AC_DEFINE(MDEBUG, 0) fi fi fi # iostream if test "x$enable_streamio" = xno; then AC_DEFINE(NOSTREAMIO) else factorysrc="$factorysrc \$(useiofactorysrc)" factoryincl="$factoryincl \$(useiofactoryincl)" fi # assertions if test "x$enable_assertions" = xno; then AC_DEFINE(NOASSERT) fi # # - debugoutput and timing magic. # # For those who do not like this: As long as you do not specify # --enable-timing or --enable-debugoutput the following code will # not be executed. # timingtargets=/dev/null debouttargets=/dev/null debtimingtargets=/dev/null enhanceddebtime=no # timing if test "x$enable_timing" != xno; then if test "x$enable_timing" = xyes; then AC_DEFINE(TIMING) else echo "$enable_timing" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.time timingtargets=conftest.time enhanceddebtime=yes fi fi # debugoutput if test "x$enable_debugoutput" != xno; then if test "x$enable_debugoutput" = xyes; then AC_DEFINE(DEBUGOUTPUT) else echo "$enable_debugoutput" | tr ',' '\n' | sed 's/\..*$//' | sort > conftest.debout debouttargets=conftest.debout enhanceddebtime=yes fi fi # create makefile fragments if test "x$enhanceddebtime" = xyes; then # get the intersection of timingtargets and debouttargets sort "$timingtargets" "$debouttargets" | uniq -d > conftest.debtime if test -s conftest.debtime; then debtimingtargets=conftest.debtime fi if test "x$timingtargets" != x/dev/null; then # get difference of timingtargets and debtimingtargets sort "$timingtargets" "$debtimingtargets" | uniq -u | while read line; do echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING $(LIBCXXFLAGS) -o $@' done > conftest.tmp mv conftest.tmp "$timingtargets" fi if test "x$debouttargets" != x/dev/null; then # get difference of debouttargets and debtimingtargets sort "$debouttargets" "$debtimingtargets" | uniq -u | while read line; do echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@' done > conftest.tmp mv conftest.tmp "$debouttargets" fi if test "x$debtimingtargets" != x/dev/null; then while read line; do echo "$line.o: $line.cc config.h;" '$(CXX) -c $< -DTIMING -DDEBUGOUTPUT $(LIBCXXFLAGS) -o $@' done < "$debtimingtargets" > conftest.tmp mv conftest.tmp "$debtimingtargets" fi fi # # - complete and substitute variables, defines. # AC_SUBST(gftabledir) AC_SUBST(templatedir) AC_SUBST(factory_version) AC_SUBST(libfactory) AC_SUBST(ARFLAGS) AC_SUBST(MAKEHEADERFLAGS) AC_SUBST(factorysrc) AC_SUBST(factoryincl) AC_SUBST(memmansrc) AC_SUBST(memmanincl) AC_SUBST(alltargets) AC_SUBST(installtargets) AC_SUBST(uninstalltargets) AC_SUBST_FILE(timingtargets) AC_SUBST_FILE(debouttargets) AC_SUBST_FILE(debtimingtargets) AC_DEFINE_UNQUOTED(FACTORYVERSION, "$factory_version") AC_DEFINE_UNQUOTED(GFTABLEDIR, "$expl_gftabledir") AC_OUTPUT(GNUmakefile)