AC_INIT(adat,2.19,edwards@jlab.org)
AC_CONFIG_AUX_DIR(config)
AC_LANG_CPLUSPLUS
AC_PROG_CXX(g++ cxx CC)
AC_PROG_CC(gcc cc)
AC_PROG_RANLIB
dnl Initialise automake
AM_INIT_AUTOMAKE
dnl
dnl
dnl --with-xxxx and --enable-xxxx switches
dnl
dnl
dnl libxml2
dnl
AC_ARG_WITH(libxml2,
AC_HELP_STRING(
[--with-libxml2=DIR],
[Build on top of libxml2 where libxml2 is installed in DIR]
),
[LIBXML2_HOME="$with_libxml2"]
)
AC_ARG_WITH(itpp,
AC_HELP_STRING(
[--with-itpp=DIR],
[Use ITPP in DIR]),
[ITPP_HOME="$with_itpp"],
[ITPP_HOME="no"]
)
if test "X${ITPP_HOME}X" != "XnoX"; then
AC_MSG_NOTICE("Using ITPP in ${ITPP_HOME}")
AC_PATH_PROG(ITPP_CONFIG, [itpp-config], [], [${ITPP_HOME}/bin:$PATH] )
if test "X${ITPP_CONFIG}X" = "XX"; then
AC_MSG_ERROR([Program itpp-config not found])
fi
AC_MSG_NOTICE([Found ITPP configuration program ${LIBXML2XX_CONFIG}])
AC_SUBST(ITPP_CXXFLAGS, "`${ITPP_CONFIG} --cflags`")
AC_MSG_NOTICE([ITPP compile flags: ${ITPP_CXXFLAGS}])
AC_SUBST(ITPP_LIBS, "`${ITPP_CONFIG} --libs`")
AC_MSG_NOTICE([ITPP libraries flags: ${ITPP_LIBS}])
fi
echo ${LIBXML2_HOME}
if test "X${LIBXML2_HOME}X" = "XX" ; then
AC_PATH_PROG(LIBXML2_CONFIG, [xml2-config], [])
else
AC_PATH_PROG(LIBXML2_CONFIG, [xml2-config], [], [${LIBXML2_HOME}/bin:${PATH}])
fi
if test "X${LIBXML2_CONFIG}X" = "XX" ; then
AC_MSG_ERROR([libxml2 configuration program xml2-config not found.])
fi
AC_MSG_NOTICE([Found libxml2 configuration program ${LIBXML2XX_CONFIG}])
AC_SUBST(LIBXML2_CXXFLAGS, "`${LIBXML2_CONFIG} --cflags`")
AC_MSG_NOTICE([libxml2 compile flags: ${LIBXML2_CXXFLAGS}])
AC_SUBST(LIBXML2_LIBS, "`${LIBXML2_CONFIG} --libs`")
AC_MSG_NOTICE([libxml2 libraries flags: ${LIBXML2_LIBS}])
dnl This function is defined in acinclude.m4
dnl it tries to try to compile the program
AC_MSG_CHECKING([if we can compile/link a simple libxml2 program])
PAC_LIBXML2_LINK_CXX_FUNC(
${LIBXML2_CXXFLAGS},
${LIBXML2_LIBS},
,
,
[libxml2_link_ok=yes],
[libxml2_link_ok=no]
)
if test "X${libxml2_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a program with libxml2.
Use --with-libxml2=
to select a working version.])
fi
dnl database wrapper
AC_ARG_ENABLE(db-lite,
AC_HELP_STRING([--enable-db-lite],
[Build routines using Berkeley DB]),
[ffdb_enabled="yes"]
)
dnl may need location of berkeley db
AC_ARG_WITH([db],
[AC_HELP_STRING([--with-db],
[use Berkeley DB location])],
[DBLOCATION=$withval],
[DBLOCATION="N/A"]
)
dnl ************************************************************************
dnl **** Use ffdb-lite ****
dnl ************************************************************************
case "$ffdb_enabled" in
yes)
AC_MSG_NOTICE([Configuring to use Berkeley DB routines])
AC_CONFIG_SUBDIRS(other_libs/ffdb-lite)
AC_SUBST(FFDB_LITE_DIR, [ffdb-lite])
AC_DEFINE([BUILD_FFDB_LITE],[],[Build ffdb-lite])
AC_SUBST(FFDB_LITE_ENABLED,[yes])
if test "$DBLOCATION" = N/A
then
AC_SUBST(FFDB_LIBS,"-lffdblite -ldb -ldb_cxx")
AC_SUBST(FFDB_INC,[])
AC_SUBST(FFDB_CXXFLAGS,"-DHAVE_CXX_STDHEADERS")
else
AC_SUBST(FFDB_LIBS,"-lffdblite $DBLOCATION/lib/libdb.a $DBLOCATION/lib/libdb_cxx.a")
AC_SUBST(FFDB_INC,"-I$DBLOCATION/include")
AC_SUBST(FFDB_CXXFLAGS,"-DHAVE_CXX_STDHEADERS")
fi
;;
*)
AC_SUBST(FFDB_LITE_DIR)
AC_MSG_NOTICE([Not building ffdb-lite])
AC_SUBST(FFDB_LITE_ENABLED,[no])
;;
esac
AM_CONDITIONAL(BUILD_FFDB_LITE,
[test "x${ffdb_enabled}x" = "xyesx" ])
dnl
dnl
dnl Now have all the options... Do some configuration
dnl
dnl
##################################
# Check for programs to build docs
##################################
AC_CHECK_PROG(LATEX, latex, latex, true)
AC_CHECK_PROG(DVIPS, dvips, dvips, true)
AC_CHECK_PROG(DVIPDF, dvipdf, dvipdf, true)
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, true)
#######################
# Produce output
#######################
#
# Configure subdir packages
#
AC_CONFIG_SUBDIRS(other_libs/c-lime)
AC_CONFIG_SUBDIRS(other_libs/xpath_reader)
AC_CONFIG_SUBDIRS(other_libs/minuit)
AC_CONFIG_SUBDIRS(other_libs/filedb)
#
# Set up the doxygen file
# Substitute the right directories
#
# AC_CONFIG_FILES(docs/adatdoc)
#
# Generate makefiles
#
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(adat-config)
AC_CONFIG_FILES(lib/Makefile)
AC_CONFIG_FILES(other_libs/Makefile)
# AC_CONFIG_FILES(docs/Makefile)
AC_CONFIG_FILES(main/Makefile)
# AC_CONFIG_FILES(main/ensbc/Makefile)
AC_CONFIG_FILES(main/strippers/Makefile)
AC_CONFIG_FILES(main/spectrum/Makefile)
AC_CONFIG_FILES(main/mres/Makefile)
AC_CONFIG_FILES(main/fpi/Makefile)
AC_CONFIG_FILES(main/fitters/Makefile)
AC_CONFIG_FILES(main/utils/Makefile)
AC_CONFIG_FILES(main/reconfit/Makefile)
AC_CONFIG_FILES(main/reconfit2/Makefile)
# AC_CONFIG_FILES(main/baryon_analysis/Makefile)
# AC_CONFIG_FILES(main/baryons/Makefile)
AC_CONFIG_FILES(main/ttt/Makefile)
AC_CONFIG_FILES(main/qqbar/Makefile)
AC_CONFIG_FILES(main/mres_calc_exercise/Makefile)
AC_CONFIG_FILES(main/ensem/Makefile)
AC_CONFIG_FILES(main/formfac/Makefile)
AC_CONFIG_FILES(main/stoch/Makefile)
AC_CONFIG_FILES(main/sfpcac/Makefile)
AC_CONFIG_FILES(main/colorvec/Makefile)
#
# Finish
#
AC_OUTPUT