Commit c4f2a63d authored by Eric Jullo's avatar Eric Jullo
Browse files

Update configuration script to better support static build

parent a14ffd50
This diff is collapsed.
# configure.ac file for Lenstool
# Eric Jullo (Jan 2014)
AC_INIT(Lenstool, 7.0, [Jean-Paul Kneib <jean-paul.kneib@epfl.ch>, Eric Jullo <eric.jullo@lam.fr>])
AC_INIT(Lenstool, 7.1, [Jean-Paul Kneib <jean-paul.kneib@epfl.ch>, Eric Jullo <eric.jullo@lam.fr>])
AC_CONFIG_SRCDIR([src/e_pot.c],[liblt/rdf_fits.c])
AC_CONFIG_AUX_DIR(autoconf)
AM_INIT_AUTOMAKE([no-define])
......@@ -9,10 +9,10 @@ AC_PROG_CC([icc gcc cc cl])
AC_PROG_RANLIB
# Check debug option
AC_ARG_WITH([debug], [AS_HELP_STRING([--with-debug],
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
[Compile in debug mode])],[],[])
if test "x$with_debug" = xyes ; then
if test "${enable_debug+set}" = set ; then
CFLAGS=$(echo "$CFLAGS -g" | sed -e "s/-O./-O0/")
AC_MSG_NOTICE([Enable debug mode])
fi
......@@ -21,12 +21,12 @@ fi
AC_OPENMP
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
# Check static compilation
AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static], [compilation with static dependency on libraries])], [])
# Checks for m library
AC_CHECK_LIB([m],[sin])
# Check static compilation
AC_ARG_ENABLE([shared], [AS_HELP_STRING([--disable-shared], [compilation without dependency on dynamic libraries])], [ if test $enableval = no; then BUILD_STATIC=yes; fi ])
# Check CFITSIO library
AC_ARG_WITH([cfitsio-prefix], [AS_HELP_STRING([--with-cfitsio-prefix=DIR],
[installation prefix for cfitsio])],
......@@ -48,21 +48,26 @@ AC_ARG_WITH([cfitsio-lib-path], [AS_HELP_STRING([--with-cfitsio-lib-path],
if test "x$with_cfitsio_lib_path" = x ; then
with_cfitsio_lib_path="/usr/lib"
fi
CFITSIO_LIB="-L$with_cfitsio_lib_path"
LIBS="$CFITSIO_LIB -lm"
AC_CHECK_LIB([cfitsio], [ffdkopn], [],
AC_MSG_ERROR([Function ffdkopn in cfitsio library not found]))
if test "x$BUILD_STATIC" = xyes ; then
if test "${enable_static+set}" = set; then
CFITSIO_STATIC="${with_cfitsio_lib_path}/libcfitsio.a"
CFITSIO_LIB=
LIBS=$CFITSIO_STATIC
if test -z "$(nm $LIBS | grep ffdkopn)"; then
AC_MSG_ERROR([Function ffdkopn in $LIBS library not found])
fi
else
CFITSIO_STATIC="-lcfitsio"
CFITSIO_LIB="-L$with_cfitsio_lib_path"
LIBS="$CFITSIO_LIB $CFITSIO_STATIC -lm"
AC_CHECK_LIB([cfitsio], [ffdkopn], [],
AC_MSG_ERROR([Function ffdkopn in cfitsio library not found]))
fi
AC_SUBST(CFITSIO_HDR)
AC_SUBST(CFITSIO_LIB)
AC_SUBST(CFITSIO_STATIC)
LIBS=
# Check WCSLIB library
AC_ARG_WITH([wcslib-prefix], [AS_HELP_STRING([--with-wcslib-prefix=DIR],
......@@ -85,29 +90,32 @@ AC_ARG_WITH([wcslib-lib-path], [AS_HELP_STRING([--with-wcslib-lib-path],
if test "x$with_wcslib_lib_path" = x ; then
with_wcslib_lib_path="/usr/lib"
fi
WCS_LIB="-L$with_wcslib_lib_path"
LIBS="$WCS_LIB -lm"
AC_CHECK_LIB([wcs], [pix2wcs], [],
AC_MSG_ERROR([Function pix2wcs in wcs library not found]))
if test "x$BUILD_STATIC" = xyes ; then
if test "${enable_static+set}" = set ; then
WCS_STATIC="${with_wcslib_lib_path}/libwcs.a"
WCS_LIB=
LIBS=$WCS_STATIC
if test -z "$(nm $LIBS | grep pix2wcs)"; then
AC_MSG_ERROR([Function pix2wcs in $LIBS library not found])
fi
else
WCS_STATIC="-lwcs"
WCS_LIB="-L$with_wcslib_lib_path"
LIBS="$WCS_LIB -lm"
AC_CHECK_LIB([wcs], [pix2wcs], [],
AC_MSG_ERROR([Function pix2wcs in wcs library not found]))
fi
AC_SUBST(WCS_HDR)
AC_SUBST(WCS_LIB)
AC_SUBST(WCS_STATIC)
LIBS=
# Check PGPLOT library
AC_ARG_WITH([pgplot], [AS_HELP_STRING([--with-pgplot],
AC_ARG_ENABLE([pgplot], [AS_HELP_STRING([--enable-pgplot],
[Enable PGPLOT tools])], [])
if test "x$with_pgplot" = x; then
AC_MSG_WARN([PGPLOT disabled])
else
if test "${enable_pgplot+set}" = set; then
AC_PROG_F77
AC_PATH_XTRA
......@@ -135,10 +143,12 @@ else
PGPLOT_LIB="-L$with_pgplot_lib_path"
AC_MSG_NOTICE([PGPLOT enabled])
else
AC_MSG_WARN([PGPLOT disabled])
fi
AM_CONDITIONAL([PGPLOT], [test x$with_pgplot = xyes])
AM_CONDITIONAL([PGPLOT], [test "${enable_pgplot+set}" = set])
if test "x$BUILD_STATIC" = xyes -a x$with_pgplot = xyes ; then
if test "${enable_static+set}" = set -a "${enable_pgplot+set}" = set ; then
if test "x$F77" = xgfortran; then
GFORTRANBEGIN_PATH=$(gfortran -print-file-name=libgfortranbegin.a)
GFORTRAN_PATH=$(gfortran -print-file-name=libgfortran.a)
......@@ -176,18 +186,27 @@ AC_ARG_WITH([gsl-lib-path], [AS_HELP_STRING([--with-gsl-lib-path],
if test "x$with_gsl_lib_path" = x ; then
with_gsl_lib_path="/usr/lib"
fi
GSL_LIB="-L$with_gsl_lib_path"
LIBS="$GSL_LIB"
AC_CHECK_LIB([gslcblas],[cblas_dgemm], [],
AC_MSG_ERROR([Function cblas_dgemm in gslcblas library not found]))
AC_CHECK_LIB([gsl],[gsl_blas_dgemm], [],
AC_MSG_ERROR([Function gsl_blas_dgemm in gsl library not found]))
if test "x$BUILD_STATIC" = xyes ; then
if test "${enable_static+set}" = set ; then
GSL_STATIC="${with_gsl_lib_path}/libgsl.a ${with_gsl_lib_path}/libgslcblas.a"
GSL_LIB=
LIBS=${with_gsl_lib_path}/libgslcblas.a
if test -z "$(nm $LIBS | grep cblas_dgemm)"; then
AC_MSG_ERROR([Function cblas_dgemm in $LIBS library not found])
fi
LIBS=${with_gsl_lib_path}/libgsl.a
if test -z "$(nm $LIBS | grep gsl_blas_dgemm)"; then
AC_MSG_ERROR([Function gsl_blas_dgemm in $LIBS library not found])
fi
else
GSL_STATIC="-lgsl -lgslcblas"
GSL_LIB="-L$with_gsl_lib_path"
LIBS="$GSL_LIB $GSL_STATIC"
AC_CHECK_LIB([gslcblas],[cblas_dgemm], [],
AC_MSG_ERROR([Function cblas_dgemm in gslcblas library not found]))
AC_CHECK_LIB([gsl],[gsl_blas_dgemm], [],
AC_MSG_ERROR([Function gsl_blas_dgemm in gsl library not found]))
fi
AC_SUBST(GSL_HDR)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment