https://github.com/Singular/Sources
Raw File
Tip revision: be77cf1dd000fb79a2c712ff01d5455661826482 authored by Hans Schoenemann on 19 November 2014, 13:06:05 UTC
chg: changes from spielwiese
Tip revision: be77cf1
configure.in
dnl Process this file with autoconf to produce a configure script
AC_INIT(kernel/matpol.h)
AC_PREFIX_DEFAULT(`pwd`)
pwd=`pwd`

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Version business --  set these here
dnl
# make them to env variables 
# pass them indirectly to subsequent configures
SINGULAR_MAJOR_VERSION=3
SINGULAR_MINOR_VERSION=1
SINGULAR_SUB_VERSION=7
VERSION_SEP="-"
SINGULAR_SHORT_VERSION="${SINGULAR_MAJOR_VERSION}${VERSION_SEP}${SINGULAR_MINOR_VERSION}"
SINGULAR_VERSION="${SINGULAR_SHORT_VERSION}${VERSION_SEP}${SINGULAR_SUB_VERSION}"
SINGULAR_RPM_VERSION="${SINGULAR_MAJOR_VERSION}.${SINGULAR_MINOR_VERSION}.${SINGULAR_SUB_VERSION}"
VERSION_DATE="Aug 2013"
SINGULAR_ROOT_DIR=$pwd

export SINGULAR_MINOR_VERSION
export SINGULAR_MAJOR_VERSION
export SINGULAR_SUB_VERSION
export SINGULAR_VERSION
export SINGULAR_RPM_VERSION
export VERSION_DATE
export SINGULAR_ROOT_DIR

dnl substitue them into the Makefiles
AC_SUBST(SINGULAR_VERSION)
AC_SUBST(VERSION_DATE)
AC_SUBST(SINGULAR_SHORT_VERSION)
AC_SUBST(SINGULAR_RPM_VERSION)
AC_SUBST(SINGULAR_ROOT_DIR)


dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Makefiles to output
dnl
# determine Makefiles to output
OUTPUT_MAKEFILES="Makefile"
if test "$enable_gfanlib" = yes -o "$enable_polymake" = yes; then
   OUTPUT_MAKEFILES="$OUTPUT_MAKEFILES callgfanlib/Makefile"
fi
if test -d "doc"; then
   OUTPUT_MAKEFILES="$OUTPUT_MAKEFILES doc/Makefile doc/version.texi doc/uname.texi"
fi
if test -d "emacs"; then
   OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" emacs/Makefile"
fi
if test -d "IntegerProgramming"; then
   OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" IntegerProgramming/Makefile"
fi
if test -d "Plural"; then
   OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" Plural/Makefile"
fi
if test -d "InstallShield"; then
   OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" InstallShield/Makefile InstallShield/Etc/Makefile InstallShield/Cygwin/Makefile InstallShield/Singular/Makefile InstallShield/Xemacs/Makefile"
fi


dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl determine singuname
dnl
AC_MSG_CHECKING(uname for singular)
AC_CACHE_VAL(ac_cv_singuname,
ac_cv_singuname="unknown"
if test -r "singuname.sh"; then
  if (/bin/sh singuname.sh >/dev/null 2>&1) then
    ac_cv_singuname=`/bin/sh singuname.sh`
  fi
fi
)
AC_MSG_RESULT($ac_cv_singuname)
if test "$ac_cv_singuname" = unknown; then
  AC_MSG_WARN(Unknown architecture: Check singuname.sh)
fi
SINGUNAME=$ac_cv_singuname
AC_SUBST(SINGUNAME)

SING_UNAME=`echo $SINGUNAME | tr '-' '_' `
AC_SUBST(SING_UNAME)


dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl compiler stuff
dnl is needed to check for libs and headers, later on
dnl
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

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl compiler stuff
dnl is needed to check for libs and headers, later on
dnl
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_AIX
AC_PROG_CXX

SING_CC=${CC}; export SING_CC
SING_CXX=${CXX}; export SING_CXX

# check whether the compiler accepts -pipe
AC_MSG_CHECKING(whether compiler accepts -pipe)
temp_cflags=${CFLAGS}
CFLAGS="${CFLAGS} -pipe"
AC_CACHE_VAL(ac_cv_cxx_have_pipe,
AC_TRY_COMPILE(,,ac_cv_cxx_have_pipe=yes,ac_cv_cxx_have_pipe=no)
)
AC_MSG_RESULT(${ac_cv_cxx_have_pipe})
CFLAGS=${temp_cflags}
if test "${ac_cv_cxx_have_pipe}" != yes; then
  PIPE=
else
  PIPE="-pipe"
fi
AC_SUBST(PIPE)

AC_CHECK_PROGS(PERL, perl5 perl)
AC_CHECK_PROGS(UUDECODE, uudecode "uudeview -i",${pwd}/warn_not_found.sh uudecode)
AC_CHECK_PROGS(GUNZIP, gunzip,  ${pwd}/warn_not_found.sh gunzip)
# don't use GZIP this breaks configure
AC_CHECK_PROGS(MYGZIP, gzip, ${pwd}/warn_not_found.sh gzip)
AC_CHECK_PROG(LATEX2HTML, latex2html, latex2html)
AC_PROG_LN_S

if test -r "${pwd}/mkinstalldirs"; then
  MKINSTALLDIRS=${pwd}/mkinstalldirs
  AC_SUBST(MKINSTALLDIRS)
else
  AC_MSG_ERROR(mkinstalldirs not foind in ${pwd})
fi

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Set exec_prefix, bindir, libdir, includedir to some sensible values
dnl
# expand prefix and pass it to subsequent configures
if test "x$prefix" = xNONE; then
  prefix=${ac_default_prefix}
  ac_configure_args="$ac_configure_args --prefix=${prefix}"
fi

# expand exec_prefix
if test "x$exec_prefix" = xNONE; then
 exec_prefix=${prefix}/${ac_cv_singuname}
 ac_configure_args="$ac_configure_args --exec_prefix=${exec_prefix}"
fi

# expand bindir
if test "x$bindir" = 'x${exec_prefix}/bin'; then
  bindir="${exec_prefix}"
  ac_configure_args="$ac_configure_args --bindir=${bindir}"
fi

# expand libdir
if test "x$libdir" = 'x${exec_prefix}/lib'; then
  libdir="${exec_prefix}/lib"
  ac_configure_args="$ac_configure_args --libdir=${libdir}"
fi

# expand includedir
if test "x$includedir" = 'x${prefix}/include'; then
  includedir="${exec_prefix}/include"
  ac_configure_args="$ac_configure_args --includedir=${includedir}"
fi

# construct name of installed Singular executable
SINGULAR=${bindir}/Singular-${SINGULAR_MAJOR_VERSION}${VERSION_SEP}${SINGULAR_MINOR_VERSION}${VERSION_SEP}${SINGULAR_SUB_VERSION}
export SINGULAR
AC_SUBST(SINGULAR)

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check for various libraries and headers
dnl
dnl After this part, the variables 'ac_<package>_ok' is 'yes'
dnl if '<package>' is already existent on the system, otherwise
dnl undefined.
dnl

# add -I to CPPFLAGS and -L to LDFLAGS, just to be sure
LDFLAGS="-L${libdir} ${LDFLAGS}"
CPPFLAGS="-I${includedir} ${CPPFLAGS}"

# check for AIX
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

AC_CHECK_LIB(m, atof)
AC_CHECK_LIB(bsd, socket)
AC_CHECK_LIB(socket, listen)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(gmp, main)
AC_CHECK_LIB(MP, IMP_PutGmpInt)
AC_CHECK_LIB(MPT, MPT_GetTree)
AC_CHECK_LIB(singcf, atof)
AC_CHECK_LIB(singfac, atof)
AC_CHECK_LIB(omalloc, omTestAddr)
AC_CHECK_LIB(omalloc_ndebug, main)

AC_CHECK_HEADERS(gmp.h MP.h  MPT.h factory.h factor.h omalloc.h)

if test "$ac_cv_lib_gmp_main" = yes && \
 test "$ac_cv_header_gmp_h" = yes; then
  ac_gmp_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

if test "$ac_cv_lib_omalloc_omTestAddr" = yes && \
   test "$ac_cv_lib_omalloc_ndebug_main" = yes && \
   test "$ac_cv_header_omalloc_c" = yes && \
   test "$ac_cv_header_omalloc_h" = yes; then
  ac_cv_omalloc_ok=yes
fi
  
dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check command line arguments
dnl

DOC2TEX_EXAMPLE_EXCLUSIONS=""
AC_SUBST(DOC2TEX_EXAMPLE_EXCLUSIONS)

AC_ARG_WITH(tmpdir, \
 [ --with-tmpdir=DIR       use DIR as temporary directory])
AC_ARG_ENABLE(omalloc, \
 [ --enable-PACKAGE        configure and/or build PACKAGE
  --disable-PACKAGE       do not configure and/or build PACKAGE
   where PACKAGE can be:
     omalloc               omalloc memory managment])
AC_ARG_ENABLE(gfanlib, \
 [    gfanlib              gfanlib])
AC_ARG_ENABLE(polymake, \
 [    polymake             polymake])
AC_ARG_ENABLE(MP, \
 [    MP                   Multi Protocol library])
AC_ARG_ENABLE(factory, \
 [    factory              polynomial factorization library])
AC_ARG_ENABLE(libfac, \
 [    libfac               char set and modp poly factorization library])
AC_ARG_ENABLE(sgroup, \
 [    sgroup               numerical semigroup computations])
AC_ARG_ENABLE(Singular, \
 [    Singular             CAS for Polynomial Computations])
AC_ARG_ENABLE(IntegerProgramming, \
 [    IntegerProgramming   IntegerProgramming])
AC_ARG_ENABLE(countedref, \
 [    countedref           Enable autoloading of reference counted types])
AC_ARG_ENABLE(Plural, \
 [    Plural               Plural])
AC_ARG_ENABLE(Texinfo, \
 [    Texinfo              Texinfo for info, texi2dvi, makeinfo])
AC_ARG_ENABLE(Texi2html, \
 [    Texi2html            Texinfo to HTML converter])
AC_ARG_ENABLE(doc, \
 [    doc                  Singular documentation])
AC_ARG_ENABLE(emacs, \
 [    emacs                emacs completion files])
AC_ARG_WITH(MP,\
 [ --with-PACKAGE          use PACKAGE, provide dependent functionality
  --without-PACKAGE       do not use PACKAGE, disable dependent functionality
   where PACKAGE can be:
     MP                   Multi Protocol library])
AC_ARG_WITH(factory, \
 [    factory              polynomial factorization library])
AC_ARG_WITH(libfac, \
 [    libfac               char set and modp poly factorization library])
AC_ARG_WITH(gmp, \
 [ --with-apint=PACKAGE    use PACKAGE for arbitary integer arithmetic
                          where PACKAGE can be gmp
All additional --enable and --with options are passed to subsequent calls 
to configure of the packages to be built. See also configure --help in 
these packages (resp. subdirs). ])

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check what to use as tmp dir
dnl
AC_MSG_CHECKING(which tmp dir to use)
if test "${with_tmpdir+set}" = set && test -d ${with_tmpdir}; then
  if (echo "${with_tmpdir}" | egrep "\." >/dev/null 2>&1)
  then
    TMP_DIR="${pwd}/tmp"
  else
    TMP_DIR=${with_tmpdir}
  fi
else
  TMP_DIR="${pwd}/tmp"
fi
AC_MSG_RESULT($TMP_DIR)
AC_SUBST(TMP_DIR)

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check whether or not to configure and build various packages
dnl
AC_MSG_CHECKING(whether to configure and build omalloc)
if test "${enable_omalloc+set}" != set; then
   if test "$ac_cv_omalloc_ok" = yes; then 
     enable_omalloc=no
   fi
   enable_omalloc_not_set=yes
fi
if test "$enable_omalloc" = no; then
  if test "$ac_cv_omalloc_ok" != yes; then
    AC_MSG_ERROR(can not build without omalloc)
  fi
  AC_MSG_RESULT(no)
else
  if test -d omalloc; then
    AC_MSG_RESULT(yes)
    if test "$enable_omalloc_not_set" = yes; then
      ac_configure_args="$ac_configure_args --enable-omalloc --with-external-config_h='$pwd/Singular/omSingularConfig.h' --with-track-custom"
    fi
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS omalloc"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS omalloc"
    if test "${with_malloc+set}" != set; then
case "$ac_cv_singuname" in 
# under windows, it is best to use the provided malloc
	ix86-Win*)
	with_malloc=system
	ac_configure_args="$ac_configure_args --with-malloc=system"
        ;;
	PowerMacintosh-darwin*)
	with_malloc=system
	ac_configure_args="$ac_configure_args --with-malloc=system"
        ;;
esac
fi
  else
    AC_MSG_ERROR(need omalloc subdir)
  fi
fi

# Check whether we have gmp
if test "$ac_gmp_ok" != yes; then
  AC_MSG_ERROR(can not find gmp)
fi

#AC_MSG_CHECKING(whether to configure and build MP lib)
# requires: sizeof(long)==4
AC_CHECK_SIZEOF(long,4)
if test "$ac_cv_sizeof_long" != 4; then
  with_MP=no
fi

AC_MSG_CHECKING(whether to configure and build MP lib)

if test "$enable_MP" != yes && test "$enable_MP" != no; then
  if test "$with_MP" != no && test "$ac_MP_ok" != yes && test -d MP && \
     (test "$ac_gmp_ok" = yes); then
    AC_MSG_RESULT(yes)
    enable_MP=yes
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS MP"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS MP"
    ac_configure_args="$ac_configure_args --enable-MP"
  else
    AC_MSG_RESULT(no)
    enable_MP=no
  fi
elif test "$enable_MP" = yes; then
  if test ! -d MP; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build MP without MP directory)
  fi
  if test "$ac_gmp_ok" = yes; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS MP"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS MP"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build MP without gmp)
  fi
else
  AC_MSG_RESULT(no)
fi

# need MP code to be compiled with -fPIC, should not hurt anybody else
if test "$enable_MP" = yes && test "${with_extra_cflags+set}" != set; then
ac_configure_args="$ac_configure_args --with-extra_cflags=-fPIC"
fi

AC_MSG_CHECKING(whether to configure and build NTL lib)
if test "$enable_NTL" != yes && test "$enable_NTL" != no; then
  if test "$with_NTL" != no && test "$ac_NTL_ok" != yes && \
     test -d ntl; then
    enable_NTL=yes
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS ntl"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS ntl"
    ac_configure_args="$ac_configure_args --enable-NTL"
    AC_LANG_CPLUSPLUS
    AC_CHECK_HEADERS(iostream.h iostream)
    AC_LANG_RESTORE
  else
    enable_NTL=no
    AC_MSG_RESULT(no)
  fi
elif test "$enable_NTL" = yes; then
  if test -d ntl; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS ntl"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS ntl"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build NTL without ntl directory)
  fi
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to configure and build factory lib)
if test "$enable_factory" != yes && test "$enable_factory" != no; then
  if test "$with_factory" != no && test "$ac_factory_ok" != yes && \
     test -d factory; then
    enable_factory=yes
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS factory"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS factory"
    ac_configure_args="$ac_configure_args --enable-factory"
  else
    enable_factory=no
    AC_MSG_RESULT(no)
  fi
elif test "$enable_factory" = yes; then
  if test -d factory; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS factory"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS factory"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build factory without factory directory)
  fi
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to configure and build libfac lib)
if test "$enable_libfac" != yes && test "$enable_libfac" != no; then
  if test "$with_libfac" != no && test "$ac_libfac_ok" != yes && \
     test -d libfac && \
     (test "$ac_factory_ok" = yes || test "$enable_factory" = yes); then
    enable_libfac=yes
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS libfac"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS libfac"
    ac_configure_args="$ac_configure_args --enable-libfac"
  else
    enable_libfac=no
    AC_MSG_RESULT(no)
  fi
elif  test "$enable_libfac" = yes; then
  if test ! -d libfac; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build libfac without libfac directory)
  fi
  if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS libfac"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS libfac"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(Can not build libfac without factory)
  fi
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to configure and build gfan lib)
if test "$enable_gfanlib" = yes -o "$enable_polymake" = yes; then
  if test -d gfanlib; then
    if test -d callgfanlib; then
      AC_MSG_RESULT(yes)
      CONFIG_SUBDIRS="$CONFIG_SUBDIRS gfanlib callgfanlib"
      BUILD1_SUBDIRS="$BUILD1_SUBDIRS gfanlib callgfanlib"
    else
      AC_MSG_RESULT(no)
      AC_MSG_ERROR(missing gfanlib interface)
    fi
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(missing gfanlib)
  fi
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to configure and build polymake interface)
if test "$enable_polymake" = yes; then
  if test -d callpolymake; then
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS callpolymake"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS callpolymake"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(missing callpolymake folder)
  fi
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to configure and build sgroup lib)
dnl 
dnl only sgroup if explicietely requested
dnl if test "$enable_sgroup" != yes && test "$enable_sgroup" != no; then
dnl  if test "$with_sgroup" != no && test "$ac_sgroup_ok" != yes && \
dnl     test -d sgroup && \
dnl     (test "$ac_MP_ok" = yes || test "$enable_MP" = yes); then
dnl    enable_sgroup=yes
dnl    AC_MSG_RESULT(yes)
dnl    CONFIG_SUBDIRS="$CONFIG_SUBDIRS sgroup"
dnl    ac_configure_args="$ac_configure_args --enable-sgroup"
dnl  else
dnl    enable_sgroup=no
dnl    AC_MSG_RESULT(no)
dnl  fi
dnl elif  test "$enable_sgroup" = yes; then
if test "$enable_sgroup" = yes; then
  if test ! -d sgroup; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build sgroup without sgroup directory)
  fi
  if test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS sgroup"
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS sgroup"
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(Can not build sgroup without MP)
  fi
else
  AC_MSG_RESULT(no)
fi

BUILD_SUBDIRS="$CONFIG_SUBDIRS"

AC_MSG_CHECKING(whether to configure and build Singular)
if test "$enable_Singular" != yes && test "$enable_Singular" != no; then
  if test "$with_Singular" != no && test -d Singular; then
    enable_Singular=yes
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS Singular"
    BUILD_SUBDIRS="$BUILD_SUBDIRS kernel Singular"	
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS kernel Singular"	
    ac_configure_args="$ac_configure_args --enable-Singular"
  else
    enable_Singular=no
    AC_MSG_RESULT(no)
  fi
elif test "$enable_Singular" = yes; then
  if test -d Singular; then
    AC_MSG_RESULT(yes)
    CONFIG_SUBDIRS="$CONFIG_SUBDIRS Singular"
    BUILD_SUBDIRS="$BUILD_SUBDIRS kernel Singular"	
    BUILD1_SUBDIRS="$BUILD1_SUBDIRS kernel Singular"	
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(can not build Singular without Singular directory)
  fi
else
  AC_MSG_RESULT(no)
fi


# test if IntegerProgramming should be built:

AC_MSG_CHECKING(whether to build IntegerProgramming)
if test "$enable_IntegerProgramming" != no && test -d "IntegerProgramming"; then
   BUILD_SUBDIRS="$BUILD_SUBDIRS IntegerProgramming"
   BUILD1_SUBDIRS="$BUILD1_SUBDIRS IntegerProgramming"
   AC_MSG_RESULT(yes)
   if test "$enable_IntegerProgramming" != yes; then
     ac_configure_args="$ac_configure_args --enable-IntegerProgramming"
   fi
else
   AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to build Plural)
if test "$enable_Plural" != no || test "$with_Plural" != no; then
   AC_MSG_RESULT(yes)
   if test "$enable_Plural" != yes; then
     ac_configure_args="$ac_configure_args --enable-Plural"
   fi
else
   AC_MSG_RESULT(no)
fi


AC_MSG_CHECKING(whether to configure and build Texinfo)
if test "$enable_Texinfo" != no && test -d Texinfo; then
  AC_MSG_RESULT(yes)
  enable_texinfo=yes
  CONFIG_SUBDIRS="$CONFIG_SUBDIRS Texinfo"
  BUILD_SUBDIRS="$BUILD_SUBDIRS Texinfo"	
  TEXI2PDF=${bindir}/texi2pdf
  MAKEINFO="${bindir}/makeinfo"
  TEXINDEX=${bindir}/texindex
  AC_SUBST(TEXI2PDF)
  AC_SUBST(MAKEINFO)
  AC_SUBST(TEXINDEX)
  if test "$enable_Texinfo" != yes; then
    ac_configure_args="$ac_configure_args --enable-Texinfo"
  fi
else
  AC_MSG_RESULT(no)
  AC_MSG_WARN(Building of doc might fail. Need Texinfo)
  enable_texinfo=no
  AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ${pwd}/warn_not_found.sh makeinfo)
  AC_CHECK_PROG(TEXINDEX, texindex, texindex, ${pwd}/warn_not_found.sh texindex)
  AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, ${pwd}/warn_not_found.sh texi2pdf)
fi  

AC_MSG_CHECKING(whether to configure and build Texi2html)
if test "$enable_Texi2html" != no && test -d Texi2html; then
 AC_MSG_RESULT(yes)
 CONFIG_SUBDIRS="$CONFIG_SUBDIRS Texi2html"
 BUILD_SUBDIRS="$BUILD_SUBDIRS Texi2html"
 if test "$enable_Texi2html" != yes; then
   ac_configure_args="$ac_configure_args --enable-Texi2html"
 fi
 TEXI2HTML=${bindir}/texi2html
 AC_SUBST(TEXI2HTML)
else
 AC_MSG_RESULT(no)
 AC_CHECK_PROG(TEXI2HTML, texi2html, texi2html)
fi

if test "${UUDECODE+set}" != set; then
AC_MSG_WARN(uudecode not found. HTML doc generation will fail)
fi
if test "${TEXI2HTML+set}" != set; then
AC_MSG_WARN(texi2html not found. HTML doc generation will fail)
fi
if test "$ac_cv_prog_LATEX2HTML" = latex2html; then
  TEXI2HTML_OPTS="-l2h"
fi
AC_SUBST(TEXI2HTML_OPTS)


AC_MSG_CHECKING(whether to build doc)
if test "$enable_doc" != no && test -d doc; then
 AC_MSG_RESULT(yes)
 BUILD_SUBDIRS="$BUILD_SUBDIRS doc"
 if test "$enable_doc" != yes; then
   enable_doc=yes
   ac_configure_args="$ac_configure_args --enable-doc"
 fi
else
 enable_doc=no
 AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to build emacs)
if test "$enable_doc" = yes && test "$enable_emacs" != no && test -d emacs; then
 AC_MSG_RESULT(yes)
 BUILD_SUBDIRS="$BUILD_SUBDIRS emacs"
 if test "$enable_emacs" != yes; then
   ac_configure_args="$ac_configure_args --enable-emacs"
 fi
else
 AC_MSG_RESULT(no)
fi

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check whether or not to use various packages
dnl
AC_MSG_CHECKING(which apint package to use)
if test "$with_apint" = gmp; then
  if test "$ac_gmp_ok" = yes; then
    AC_MSG_RESULT(gmp)
  else
    AC_MSG_RESULT(none)
    AC_MSG_ERROR(can not use with gmp without finding it)
  fi
elif test "$ac_gmp_ok" = yes; then
    AC_MSG_RESULT(gmp)
    ac_configure_args="$ac_configure_args --with-apint=gmp"
else
  AC_MSG_ERROR(gmp required)
fi

AC_MSG_CHECKING(whether to use with MP)
if test "$with_MP" = yes; then
  if test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(none)
    AC_MSG_ERROR(can not use with MP without finding or building it)
  fi
elif test "$with_MP" = no; then
  AC_MSG_RESULT(no)
elif test "$ac_MP_ok" = yes || test "$enable_MP" = yes; then
  AC_MSG_RESULT(yes)
  ac_configure_args="$ac_configure_args --with-MP"
else
  AC_MSG_RESULT(no)
  ac_configure_args="$ac_configure_args --without-MP"
  DOC2TEX_EXAMPLE_EXCLUSIONS="$DOC2TEX_EXAMPLE_EXCLUSIONS -exclude MP"
fi

AC_MSG_CHECKING(whether to use with factory)
if test "$with_factory" = yes; then
  if test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(none)
    AC_MSG_ERROR(can not use with factory without finding or building it)
  fi
elif test "$with_factory" = no; then
  AC_MSG_RESULT(no)
elif test "$ac_factory_ok" = yes || test "$enable_factory" = yes; then
  AC_MSG_RESULT(yes)
  ac_configure_args="$ac_configure_args --with-factory"
else
  AC_MSG_RESULT(no)
  ac_configure_args="$ac_configure_args --without-factory"
fi
  
AC_MSG_CHECKING(whether to use with libfac)
if test "$with_libfac" = yes; then
  if test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(none)
    AC_MSG_ERROR(can not use with libfac without finding or building it)
  fi
elif test "$with_libfac" = no; then
  AC_MSG_RESULT(no)
elif test "$ac_libfac_ok" = yes || test "$enable_libfac" = yes; then
  AC_MSG_RESULT(yes)
  ac_configure_args="$ac_configure_args --with-libfac"
else
  AC_MSG_RESULT(no)
  ac_configure_args="$ac_configure_args --without-libfac"
fi



AC_MSG_CHECKING(whether to use with Singular)
if test "$with_Singular" != no && test "$with_Singular" != yes; then
  if test "$enable_Singular" = yes; then
    with_Singular=yes
  else
    with_Singular=no
  fi
  ac_configure_args="$ac_configure_args --with-Singular=$with_Singular"
fi

if test "$with_Singular" != no; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi


dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Check for known subdirs
dnl
SUBDIRS=""
if test -d omalloc; then
  SUBDIRS="$SUBDIRS omalloc"
fi
if test -d MP; then
  SUBDIRS="$SUBDIRS MP"
fi
if test -d ntl; then
  SUBDIRS="$SUBDIRS ntl"
fi
if test -d factory; then
  SUBDIRS="$SUBDIRS factory"
fi
if test -d libfac; then
  SUBDIRS="$SUBDIRS libfac"
fi
if test -d sgroup; then
  SUBDIRS="$SUBDIRS sgroup"
fi
if test -d kernel; then
  SUBDIRS="$SUBDIRS kernel"
fi
if test -d IntegerProgramming; then
  SUBDIRS="$SUBDIRS IntegerProgramming"
fi
if test -d Singular; then
  SUBDIRS="$SUBDIRS Singular"
fi
if test -d Texinfo; then
  SUBDIRS="$SUBDIRS Texinfo"
fi
if test -d Texi2html; then
  SUBDIRS="$SUBDIRS Texi2html"
fi
if test -d doc; then
  SUBDIRS="$SUBDIRS doc"
fi
if test -d emacs; then
  SUBDIRS="$SUBDIRS emacs"
fi
dnl if test -d rpm; then
dnl  SUBDIRS="$SUBDIRS rpm"
dnl fi
if test -d dyn_modules; then
  SUBDIRS="$SUBDIRS dyn_modules"
fi
if test -d "dyn_modules"; then
dnl    OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" dyn_modules/Makefile"
   CONFIG_SUBDIRS=$CONFIG_SUBDIRS" dyn_modules"
   BUILD_SUBDIRS=$BUILD_SUBDIRS" dyn_modules"
fi
  
AC_MSG_CHECKING(whether to use libsvd)
if test "$with_svd" = yes; then
  AC_MSG_RESULT(yes)
dnl    OUTPUT_MAKEFILES=$OUTPUT_MAKEFILES" dyn_modules/Makefile"
   CONFIG_SUBDIRS=$CONFIG_SUBDIRS" svd"
   BUILD_SUBDIRS=$BUILD_SUBDIRS" svd"
else
  AC_MSG_RESULT(no)
fi

dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
dnl Enough -- wrap it up
dnl
AC_PROG_MAKE_SET
AC_SUBST(SUBDIRS)
AC_SUBST(BUILD_SUBDIRS)
AC_SUBST(BUILD1_SUBDIRS)
AC_SUBST(CONFIG_SUBDIRS)
AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS) 

AC_OUTPUT(${OUTPUT_MAKEFILES})
back to top