dnl Process this file with autoconf to produce a configure script. AC_INIT(matpol.h) AC_CONFIG_HEADER(mod2.h) dnl dnl set the version here dnl SINGULAR_MAJOR_VERSION=1 SINGULAR_MINOR_VERSION=1 SINGULAR_SUB_VERSION=0 VERSION_DATE="June 1997" AC_SUBST(SINGULAR_MAJOR_VERSION) AC_SUBST(SINGULAR_MINOR_VERSION) AC_SUBST(SINGULAR_SUB_VERSION) AC_DEFINE_UNQUOTED(SINGULAR_MAJOR_VERSION, ${SINGULAR_MAJOR_VERSION}) AC_DEFINE_UNQUOTED(SINGULAR_MINOR_VERSION, ${SINGULAR_MINOR_VERSION}) AC_DEFINE_UNQUOTED(S_VERSION1, "version: ${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}") AC_DEFINE_UNQUOTED(S_VERSION2, "${VERSION_DATE}") dnl dnl paths stuff dnl AC_PREFIX_DEFAULT(`pwd`/..) dnl if test "x$datadir" = 'x${prefix}/share'; then if test "x${prefix}" = xNONE; then singulardatadir=${ac_default_prefix}/share/Singular; else singulardatadir=${prefix}/share/Singular; fi else singulardatadir=${datadir}/Singular; fi if test "x$infodir" = 'x${prefix}/info'; then if test "x${prefix}" = xNONE; then singularinfodir=${ac_default_prefix}/info; else singularinfodir=${prefix}/info; fi else singularinfodir=$infodir; fi AC_DEFINE_UNQUOTED(SINGULAR_DATADIR, "${singulardatadir}") AC_DEFINE_UNQUOTED(SINGULAR_INFODIR, "${singularinfodir}") AC_SUBST(singulardatadir) dnl dnl Checks for programs. dnl dnl compiler stuff dnl we do not want to have "-g -O" for CFLAGS if test "${CXXFLAGS+set}" != set; then ac_cxxflags_set=no CXXFLAGS="-O" fi if test "${CFLAGS+set}" != set; then CFLAGS="-O" ac_cflags_set=no fi AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_SET_MAKE dnl we prefer using gcc for compiling C++ files if test ${GXX} = yes; then CXX=gcc fi dnl and add to -I to CPPFLAGS and and -Lto LDFLAGS, just to be sure if test "$libdir" = '${exec_prefix}/lib'; then if test "x$exec_prefix" = xNONE; then if test "x$prefix" = xNONE; then LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}" else LDFLAGS="-L${prefix}/lib ${LDFLAGS}" fi else LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}" fi else LDFLAGS="-L${libdir} ${LDFLAGS}" fi if test "$includedir" = '${prefix}/include'; then if test "x$prefix" = xNONE; then CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}" else CPPFLAGS="-I${prefix}/include ${CPPFLAGS}" fi else CPPFLAGS="-I${includedir} ${CPPFLAGS}" fi dnl programs to built the grammar/parser dnl check for info if test "$with_info" != no; then AC_CHECK_PROG(INFO, info, info) if test -n "$INFO"; then AC_DEFINE(HAVE_INFO) fi fi dnl dnl CHECK --without arguments dnl AC_ARG_WITH( readline, [ --without-readline do not use readline for fancy display]) AC_ARG_WITH( MP, [ --without-MP do not use MP (disables MP links)]) AC_ARG_WITH( dbm, [ --without-dbm do not use dbm (disables DBM links)]) AC_ARG_WITH( info, [ --without-info do not use info for help (use buildin help, instead)]) AC_ARG_WITH( dld, [ --without-dld do not use dld (disables dynamic linking)]) AC_ARG_WITH( factory, [ --without-factory do not use factory (disables poly factorization)]) AC_ARG_WITH( libfac, [ --without-libfac do not use libfac (disables primary decompositions)]) AC_ARG_WITH(apint, \ [ --with-apint=PACKAGE use PACKAGE for arbitary integer arithmetic where PACKAGE can be gmp, smallgmp, or buildin]) dnl dnl CHECK VARIOUS LIBRARIES dnl for gmp, MP, factory and libfac, we built them in, even if the libs dnl and headers were not found under the condition that the respective dnl --enable argument was given dnl AC_CHECK_LIB(m, atof) AC_CHECK_LIB(bsd, socket) AC_CHECK_LIB(socket, listen) AC_CHECK_LIB(nsl, gethostbyname) dnl Check -lreadline if test "$with_readline" != no; then AC_CHECK_LIB(ncurses,tgetent,,\ AC_CHECK_LIB(curses,tgetent,,\ AC_CHECK_LIB(termcap,tgetent))) AC_CHECK_LIB(readline, rl_abort) if test "$ac_cv_lib_readline_rl_abort" = yes; then AC_CHECK_HEADERS(readline/readline.h readline/history.h sys/file.h,ac_readline_ok=yes,ac_readline_ok=no; break) fi if test "$ac_readline_ok" = yes; then AC_DEFINE(HAVE_READLINE) else AC_MSG_WARN(building without readline: disabling fancy display); AC_DEFINE(HAVE_FEREAD) fi else AC_DEFINE(HAVE_FEREAD) fi dnl Check dbm if test "$with_dbm" != no; then AC_CHECK_LIB( dbm, dbminit, AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS", AC_CHECK_LIB( gdbm, dbminit, AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS", AC_MSG_WARN(building without dbm: disabling DBM links))) fi dnl Check dld if test "$with_dld" = yes; then AC_CHECK_LIB(dld, dld_init,\ AC_MSG_WARN(building without dld: disabling dynamic linking)) fi NEED_LIBS=$LIBS AC_CHECK_LIB(gmp, mpq_init) AC_CHECK_LIB(smallgmp, mpz_init) AC_CHECK_LIB(MP, IMP_PutGmpInt) AC_CHECK_LIB(MPT, MPT_GetTree) AC_CHECK_LIB(singcf, atof) AC_CHECK_LIB(singfac, atof) AC_CHECK_HEADERS(gmp.h smallgmp.h MP.h MPT.h factory.h factor.h) if test "$ac_cv_lib_gmp_mpq_init" = yes && \ test "$ac_cv_header_gmp_h" = yes; then ac_gmp_ok=yes fi if test "$ac_cv_lib_smallgmp_mpz_init" = yes && \ test "$ac_cv_header_smallgmp_h" = yes && \ test "$ac_cv_header_gmp_h" = yes; then ac_smallgmp_ok=yes fi if test "$ac_cv_lib_MP_IMP_PutGmpInt" = yes && \ test "$ac_cv_lib_MPT_MPT_GetTree" && \ test "$ac_cv_header_MP_h" = yes && \ test "$ac_cv_header_MPT_h" = yes; then ac_MP_ok=yes fi if test "$ac_cv_lib_singcf_atof" = yes && \ test "$ac_cv_header_factory_h" = yes; then ac_factory_ok=yes fi if test "$ac_cv_lib_singfac_atof" = yes && \ test "$ac_cv_header_factor_h" = yes; then ac_libfac_ok=yes fi dnl Check gmp if test "$with_apint" != buildin; then if test "$with_apint" = gmp; then if test "$ac_gmp_ok" = yes; then ac_will_have_gmp=yes elif test "$enable_gmp" = yes; then ac_will_have_gmp=yes AC_MSG_WARN(install gmp before making Singular) else AC_MSG_ERROR(Can not use with gmp: lib/header not found) fi elif test "$with_apint" = smallgmp; then if test "$ac_smallgmp_ok" = yes; then ac_will_have_gmp=yes ac_will have_smallgmp=yes elif test "$enable_gmp" = yes; then ac_will_have_gmp=yes ac_will_have_smallgmp=yes AC_MSG_WARN(install smallgmp before making Singular) else AC_MSG_ERROR(Can not use with smallgmp: lib/header not found) fi elif test "$ac_gmp_ok" = yes; then ac_will_have_gmp=yes elif test "$ac_smallgmp_ok" = yes || test "$enable_smallgmp" = yes; then ac_will_have_gmp=yes ac_will_have_smallgmp=yes elif test "$enable_gmp" = yes; then ac_will_have_gmp=yes fi fi AC_MSG_CHECKING(which apint package to use) if test "$ac_will_have_gmp" = yes; then AC_DEFINE(HAVE_GMP) if test "$ac_will_have_smallgmp" = yes; then NEED_LIBS="-lsmallgmp ${NEED_LIBS}" AC_MSG_RESULT(smallgmp) AC_DEFINE(HAVE_SMALLGMP) else NEED_LIBS="-lgmp ${NEED_LIBS}" AC_MSG_RESULT(gmp) fi else AC_MSG_RESULT(buildin) fi dnl Check MP WITH_MP=no if test "$with_MP" != no; then if test "$ac_will_have_gmp" != yes; then AC_MSG_WARN(Need gmp to build with MP) else if test "$ac_MP_ok" = yes; then WITH_MP=yes elif test "$enable_MP" = yes; then WITH_MP=yes AC_MSG_WARN(Install MP before making Singular) else AC_MSG_WARN(Need MP library to build with MP) fi fi fi AC_MSG_CHECKING(whether to use with MP) AC_SUBST(WITH_MP) if test "$WITH_MP" = yes; then AC_DEFINE(HAVE_MPSR) NEED_LIBS="-lMPT -lMP ${NEED_LIBS}" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl Check factory WITH_FACTORY=no if test "$with_factory" != no; then if test "$ac_will_have_gmp" != yes; then AC_MSG_WARN(Need gmp to build with factory) else if test "$ac_factory_ok" = yes; then WITH_FACTORY=yes elif test "$enable_factory" = yes; then WITH_FACTORY=yes AC_MSG_WARN(Install factory before making Singular) else AC_MSG_WARN(Need factory library to build with factory) fi fi fi AC_MSG_CHECKING(whether to use with factory) AC_SUBST(WITH_FACTORY) if test "$WITH_FACTORY" = yes; then AC_DEFINE(HAVE_FACTORY) NEED_LIBS="-lsingcf ${NEED_LIBS}" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl Check libfac WITH_LIBFAC=no if test "$with_libfac" != no; then if test "$WITH_FACTORY" != yes; then AC_MSG_WARN(Need factory to build with libfac) else if test "$ac_libfac_ok" = yes; then WITH_LIBFAC=yes elif test "$enable_libfac" = yes; then WITH_LIBFAC=yes AC_MSG_WARN(Install libfac before making Singular) else AC_MSG_WARN(Need libfac library to build with libfac) fi fi fi AC_MSG_CHECKING(whether to use with libfac) AC_SUBST(WITH_LIBFAC) if test "$WITH_LIBFAC" = yes; then AC_DEFINE(HAVE_LIBFAC_P) NEED_LIBS="-lsingfac ${NEED_LIBS}" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_SUBST(NEED_LIBS) dnl dnl CHECKS FOR HEADER FILES. dnl AC_HEADER_STDC AC_CHECK_HEADERS(limits.h unistd.h,, AC_MSG_ERROR(Can not compile without limits.h unistd.h)) AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h) dnl dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM dnl dnl Checks for library functions. dnl AC_FUNC_ALLOCA AC_PROG_GCC_TRADITIONAL AC_FUNC_MMAP AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(gettimeofday strstr strtod strtol atexit) dnl dnl System specific tests dnl dnl arithmetic shifts AC_MSG_CHECKING(whether your machine has correct 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, 1)) if test "$ac_cv_shift" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_ERROR(need -2 >> 1 == -1) fi dnl sizeof(int) == 4 AC_MSG_CHECKING(whether sizeof int is four bytes) AC_CACHE_VAL(ac_cv_sizeof_int_equals_four, AC_TRY_RUN( [ int main() {if (sizeof(int) == 4) exit(0); else exit(1); } ], ac_cv_sizeof_int_equals_four=yes, ac_cv_sizeof_int_equals_four=no, 1)) if test "$ac_cv_sizeof_int_equals_four" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_ERROR(need int to be four bytes long) fi dnl sizeof(long) == sizeof (void *) AC_MSG_CHECKING(whether sizeof long equals sizeof void*) AC_CACHE_VAL(ac_cv_sizeof_long_equals_voidp, AC_TRY_RUN( [ int main() {if (sizeof(long) == sizeof(void*)) exit(0); else exit(1); }], ac_cv_sizeof_long_equals_voidp=yes, ac_cv_sizeof_long_equals_voidp=no, 1)) if test "$ac_cv_sizeof_long_equals_voidp" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_ERROR(need equal sizes for long and void*) fi dnl sprintf returns number of printed chars AC_MSG_CHECKING(whether vsprintf returns number of printed chars) AC_CACHE_VAL(ac_cv_returns_n_of_chars, AC_TRY_RUN( [#include main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }], ac_cv_returns_n_of_chars=yes, ac_cv_returns_n_of_chars=no, 1)) if test "$ac_cv_returns_n_of_chars" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_DEFINE(BSD_SPRINTF) fi dnl determine ALIGN_8 AC_CHECK_SIZEOF(void*,4) dnl dnl Last, but not least, customize CFLAGS dnl AC_MSG_CHECKING(whether _AIX is defined) AC_CACHE_VAL(ac_cv_is_aix, AC_EGREP_CPP(yes, [#ifdef _AIX yes #endif ], ac_cv_is_aix=yes, ac_cv_is_aix=no, 1)) if test "$ac_cv_is_aix" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi if test ${GXX} = yes; then if test "$ac_cxxflags_set" = no; then CXXFLAGS="-O3 -w -fomit-frame-pointer" fi CXXTEMPLFLAGS="-fno-implicit-templates" if test "$ac_cv_is_aix" = yes; then CXXNOOPTFLAGS="-w" else CXXNOOPTFLAGS=$CXXFLAGS fi else CXXTEMPFLAGS="" CXXNOOPTFLAGS=$CXXFLAGS fi AC_SUBST(CXXTEMPLFLAGS) AC_SUBST(CXXNOOPTFLAGS) if test ${GCC} = yes && test "$ac_cflags_set" = no ; then CFLAGS="-O3 -w -fomit-frame-pointer" fi AC_OUTPUT(Makefile doc/Makefile, \ if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi)