1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

latan-config utility and HDF5 is now mandatory

This commit is contained in:
Antonin Portelli 2018-08-26 02:55:53 +03:00
parent b4ad61406f
commit 8b9494029c
5 changed files with 35 additions and 27 deletions

View File

@ -1,3 +1,5 @@
SUBDIRS = lib utils physics examples SUBDIRS = lib utils physics examples
bin_SCRIPTS=latan-config
ACLOCAL_AMFLAGS = -I .buildutils/m4 ACLOCAL_AMFLAGS = -I .buildutils/m4

View File

@ -53,9 +53,6 @@ AC_ARG_WITH([latcore],
[use this option for a non-standard install prefix of the LatCore library])], [use this option for a non-standard install prefix of the LatCore library])],
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_latcore/include"] [AM_CXXFLAGS="$AM_CXXFLAGS -I$with_latcore/include"]
[AM_LDFLAGS="$AM_LDFLAGS -L$with_latcore/lib"]) [AM_LDFLAGS="$AM_LDFLAGS -L$with_latcore/lib"])
CFLAGS="$AM_CFLAGS $CFLAGS"
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
# Get compilers informations # Get compilers informations
AX_COMPILER_VENDOR AX_COMPILER_VENDOR
@ -78,6 +75,10 @@ AC_DEFINE_UNQUOTED([GXX_VERSION],["$GXX_VERSION"],
[version of g++ that will compile the code]) [version of g++ that will compile the code])
# Checks for libraries. # Checks for libraries.
CXXFLAGS_CPY=$CXXFLAGS
LDFLAGS_CPY=$LDFLAGS
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
AC_CHECK_LIB([m],[cos],[],[AC_MSG_ERROR([libm library not found])]) AC_CHECK_LIB([m],[cos],[],[AC_MSG_ERROR([libm library not found])])
AC_CHECK_LIB([gslcblas],[cblas_dgemm],[], AC_CHECK_LIB([gslcblas],[cblas_dgemm],[],
[AC_MSG_ERROR([GSL CBLAS library not found])]) [AC_MSG_ERROR([GSL CBLAS library not found])])
@ -90,12 +91,8 @@ AC_CHECK_LIB([nlopt_cxx],[nlopt_create],
[LIBS="$LIBS -lnlopt_cxx"],[]) [LIBS="$LIBS -lnlopt_cxx"],[])
AM_CONDITIONAL([HAVE_NLOPT], [test x$have_nlopt = xtrue]) AM_CONDITIONAL([HAVE_NLOPT], [test x$have_nlopt = xtrue])
AC_CHECK_LIB([hdf5_cpp],[H5Fopen], AC_CHECK_LIB([hdf5_cpp],[H5Fopen],
[AC_DEFINE([HAVE_HDF5], [LIBS="$LIBS -lhdf5_cpp -lhdf5"],
[1], [AC_MSG_ERROR([HDF5 library not found])], [-lhdf5])
[Define to 1 if you have the `HDF5' library (-lhdf5_cpp).])]
[have_hdf5=true]
[LIBS="$LIBS -lhdf5_cpp -lhdf5"],[],[-lhdf5])
AM_CONDITIONAL([HAVE_HDF5], [test x$have_hdf5 = xtrue])
SAVED_LDFLAGS=$LDFLAGS SAVED_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -lMinuit2" LDFLAGS="$LDFLAGS -lMinuit2"
AC_MSG_CHECKING([for ROOT::Minuit2::BasicMinimumError in -lMinuit2]); AC_MSG_CHECKING([for ROOT::Minuit2::BasicMinimumError in -lMinuit2]);
@ -123,24 +120,44 @@ AC_LINK_IFELSE(
[AC_MSG_RESULT([no])] [AC_MSG_RESULT([no])]
[AC_MSG_ERROR([LatCore library not found])]) [AC_MSG_ERROR([LatCore library not found])])
LDFLAGS=$SAVED_LDFLAGS LDFLAGS=$SAVED_LDFLAGS
CXXFLAGS=$CXXFLAGS_CPY
LDFLAGS=$LDFLAGS_CPY
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
cwd=`pwd -P`; cd ${srcdir}; abs_srcdir=`pwd -P`; cd ${cwd}
LATAN_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
LATAN_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
LATAN_LIBS=$LIBS
LATAN_SHORT_SHA=`git rev-parse --short HEAD`
LATAN_SHA=`git rev-parse HEAD`
LATAN_BRANCH=`git rev-parse --abbrev-ref HEAD`
AM_CXXFLAGS="-I${abs_srcdir}/lib $AM_CXXFLAGS"
AM_CFLAGS="-I${abs_srcdir}/lib $AM_CFLAGS"
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
AC_SUBST([LIBS]) AC_SUBST([LIBS])
AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS]) AC_SUBST([AM_LDFLAGS])
AC_SUBST([LATAN_CXXFLAGS])
AC_SUBST([LATAN_LDFLAGS])
AC_SUBST([LATAN_LIBS])
AC_SUBST([LATAN_SHA])
AC_SUBST([LATAN_BRANCH])
AC_CONFIG_FILES([Makefile lib/Makefile utils/Makefile physics/Makefile AC_CONFIG_FILES([latan-config], [chmod +x latan-config])
examples/Makefile]) AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([utils/Makefile])
AC_CONFIG_FILES([physics/Makefile])
AC_CONFIG_FILES([examples/Makefile])
AC_OUTPUT AC_OUTPUT
echo "*********************************************" echo "*********************************************"
echo "* ${PACKAGE_NAME} v${VERSION}" build options echo "* ${PACKAGE_NAME} v${VERSION}" build options
echo "*********************************************" echo "*********************************************"
echo "* C++ compiler : $CXX" echo "* C++ compiler : $CXX"
echo "* HDF5 support : `test x$HAVE_HDF5_TRUE = 'x' && echo yes \
|| echo no`"
echo "* Minuit minimizers: `test x$HAVE_MINUIT_TRUE = 'x' && echo yes \ echo "* Minuit minimizers: `test x$HAVE_MINUIT_TRUE = 'x' && echo yes \
|| echo no`" || echo no`"
echo "* NLopt minimizers : `test x$HAVE_NLOPT_TRUE = 'x' && echo yes \ echo "* NLopt minimizers : `test x$HAVE_NLOPT_TRUE = 'x' && echo yes \

View File

@ -20,9 +20,7 @@
#include <LatAnalyze/Io.hpp> #include <LatAnalyze/Io.hpp>
#include <LatAnalyze/includes.hpp> #include <LatAnalyze/includes.hpp>
#include <LatAnalyze/AsciiFile.hpp> #include <LatAnalyze/AsciiFile.hpp>
#ifdef HAVE_HDF5
#include <LatAnalyze/Hdf5File.hpp> #include <LatAnalyze/Hdf5File.hpp>
#endif
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;
@ -42,12 +40,10 @@ unique_ptr<File> Io::open(const std::string &fileName, const unsigned int mode)
{ {
return unique_ptr<File>(new AsciiFile(fileName, mode)); return unique_ptr<File>(new AsciiFile(fileName, mode));
} }
#ifdef HAVE_HDF5
else if (ext == "h5") else if (ext == "h5")
{ {
return unique_ptr<File>(new Hdf5File(fileName, mode)); return unique_ptr<File>(new Hdf5File(fileName, mode));
} }
#endif
else else
{ {
LATAN_ERROR(Io, "unknown file extension '" + ext + "'"); LATAN_ERROR(Io, "unknown file extension '" + ext + "'");

View File

@ -35,6 +35,7 @@ libLatAnalyze_la_SOURCES = \
GslHybridRootFinder.cpp\ GslHybridRootFinder.cpp\
GslMinimizer.cpp \ GslMinimizer.cpp \
GslQagsIntegrator.cpp \ GslQagsIntegrator.cpp \
Hdf5File.cpp \
Histogram.cpp \ Histogram.cpp \
includes.hpp \ includes.hpp \
Io.cpp \ Io.cpp \
@ -69,6 +70,7 @@ libLatAnalyze_la_HEADERS = \
GslHybridRootFinder.hpp\ GslHybridRootFinder.hpp\
GslMinimizer.hpp \ GslMinimizer.hpp \
GslQagsIntegrator.hpp \ GslQagsIntegrator.hpp \
Hdf5File.hpp \
Histogram.hpp \ Histogram.hpp \
Integrator.hpp \ Integrator.hpp \
Io.hpp \ Io.hpp \
@ -87,10 +89,6 @@ libLatAnalyze_la_HEADERS = \
StatArray.hpp \ StatArray.hpp \
XYSampleData.hpp \ XYSampleData.hpp \
XYStatData.hpp XYStatData.hpp
if HAVE_HDF5
libLatAnalyze_la_SOURCES += Hdf5File.cpp
libLatAnalyze_la_HEADERS += Hdf5File.hpp
endif
if HAVE_MINUIT if HAVE_MINUIT
libLatAnalyze_la_SOURCES += MinuitMinimizer.cpp libLatAnalyze_la_SOURCES += MinuitMinimizer.cpp
libLatAnalyze_la_HEADERS += MinuitMinimizer.hpp libLatAnalyze_la_HEADERS += MinuitMinimizer.hpp

View File

@ -25,12 +25,7 @@
#ifndef DEF_NSAMPLE #ifndef DEF_NSAMPLE
#define DEF_NSAMPLE "100" #define DEF_NSAMPLE "100"
#endif #endif
#ifdef HAVE_HDF5
#define DEF_FMT "h5" #define DEF_FMT "h5"
#else
#define DEF_FMT "sample"
#endif
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;