Commit bad55a26 authored by Karl Wette's avatar Karl Wette

lalsuite_build.m4: fix BOINC configuration to work with top-level build

- LALSUITE_CHECK_BOINC() checks for BOINC libraries/headers, and sets C++
  compiler for any LAL library checks
- LALSUITE_END_CHECK_BOINC() restores C compiler, checks LAL was compiled
  with BOINC support, and hacks Automake to force C++ linking of programs
- Remove special BOINC flag variables, easier to use CFLAGS, LDFLAGS, etc
- Refs #5380
Original: c59129c8a3e685d4cf670ad16b78d30a5b498749
parent 5f65c03c
# -*- mode: autoconf; -*-
# lalsuite_build.m4 - top level build macros
#
# serial 137
# serial 138
# restrict which LALSUITE_... patterns can appearing in output (./configure);
# useful for debugging problems with unexpanded LALSUITE_... Autoconf macros
......@@ -967,12 +967,59 @@ AC_DEFUN([LALSUITE_ENABLE_BOINC],[
])
AC_DEFUN([LALSUITE_CHECK_BOINC],[
# $0: check for BOINC support
# $0: check for BOINC, and modify compiler for lal library checks
AS_IF([test "${boinc}" = "true"],[
LALSUITE_CHECK_LIBRARY_FOR_SUPPORT([LAL],[BOINC],[:],[
AC_MSG_ERROR([BOINC was enabled but LAL was not compiler with BOINC support])
# do compilation checks with c++
AC_LANG_PUSH([C++])
# check for BOINC libraries
AC_SUBST([BOINC_CFLAGS],[""])
AC_SUBST([BOINC_LIBS],["-lboinc_api -lboinc"])
LALSUITE_ADD_FLAGS([C],[${BOINC_CFLAGS}],[${BOINC_LIBS}])
AC_CHECK_LIB([boinc],[boinc_fopen],[:],[AC_MSG_ERROR([could not find the boinc library])])
AC_CHECK_LIB([boinc_api],[boinc_finish],[:],[AC_MSG_ERROR([could not find the boinc_api library])])
# check for BOINC headers
AC_CHECK_HEADERS([boinc/boinc_api.h],[:],[AC_MSG_ERROR([could not find the boinc_api.h header])])
])
# end $0
])
AC_DEFUN([LALSUITE_END_CHECK_BOINC],[
# $0: finish BOINC checks, and restore compiler after lal library checks
m4_pushdef([lowercase],m4_translit(AC_PACKAGE_NAME, [A-Z], [a-z]))
AC_REQUIRE([LALSUITE_CHECK_BOINC])
AS_IF([test "${boinc}" = "true"],[
m4_if(lowercase,[lal],[
# if LAL, define macro to indicate BOINC support
AC_DEFINE([LAL_BOINC_ENABLED],[1],[Define if using BOINC library])
],[
# if not LAL, check LAL was compiled with BOINC support
LALSUITE_CHECK_LIBRARY_FOR_SUPPORT([LAL],[BOINC],[:],[
AC_MSG_ERROR([BOINC enabled but LAL not compiled with BOINC support])
])
])
# go back to c
AC_LANG_POP([C++])
# force automake to use c++ compiler for linking
AC_MSG_WARN([using C++ compiler for linking (forced by BOINC)])
AC_SUBST([CCLD],['$(CXX)'])
AC_SUBST([am__v_CCLD_0],['@echo " CXXLD(B)" $][@;'])
],[
AC_SUBST([CCLD],['$(CC)'])
AC_SUBST([am__v_CCLD_0],['@echo " CCLD " $][@;'])
])
m4_popdef([lowercase])
# end $0
])
......
......@@ -251,34 +251,6 @@ if test "${intelfft}" = "false" ; then
AC_CHECK_HEADERS([fftw3.h],,[AC_MSG_ERROR([could not find the fftw3.h header])])
fi
# check for boinc
if test "x${boinc}" = xtrue; then
# do compilation checks with c++
AC_LANG_PUSH([C++])
# set boinc flags
AC_ARG_VAR([BOINC_PREFIX],[BOINC installation directory (optional)])
AC_ARG_VAR([BOINC_EXTRA_CFLAGS],[extra BOINC compiler flags (optional)])
AC_ARG_VAR([BOINC_EXTRA_LIBS],[extra BOINC libraries (optional)])
AC_SUBST(BOINC_CFLAGS,"${BOINC_EXTRA_CFLAGS}")
AC_SUBST(BOINC_LIBS,"-lboinc_api -lboinc ${BOINC_EXTRA_LIBS}")
if test "x${BOINC_PREFIX}" != x; then
BOINC_CFLAGS="-I${BOINC_PREFIX}/include ${BOINC_CFLAGS}"
BOINC_LIBS="-L${BOINC_PREFIX}/lib ${BOINC_LIBS}"
fi
LALSUITE_ADD_FLAGS([C],[${BOINC_CFLAGS}],[${BOINC_LIBS}])
# check for boinc libraries
AC_CHECK_LIB([boinc],[boinc_fopen],[:],[AC_MSG_ERROR([could not find the boinc library])])
AC_CHECK_LIB([boinc_api],[boinc_finish],[:],[AC_MSG_ERROR([could not find the boinc_api library])])
# check for boinc headers
AC_CHECK_HEADERS([boinc/boinc_api.h],[:],[AC_MSG_ERROR([could not find the boinc_api.h header])])
# go back to c
AC_LANG_POP([C++])
fi
# define what is being enabled
if test "${cuda}" = "true"; then
AC_DEFINE([LAL_CUDA_ENABLED],[1],[Define if using cuda library])
......@@ -289,11 +261,6 @@ if test "${fftw3}" = "true"; then
AC_DEFINE([LAL_FFTW3_MEMALIGN_ENABLED],[1],[Define if using fftw3 library])
fi
fi
if test "${boinc}" = "true"; then
AC_DEFINE([LAL_BOINC_ENABLED],[1],[Define if using boinc library])
AC_SUBST(BOINC_CFLAGS)
AC_SUBST(BOINC_LIBS)
fi
# check for hdf5 support
HDF5_ENABLE_VAL="DISABLED"
......@@ -340,6 +307,10 @@ m4_popdef([includes])
AM_CONDITIONAL([INTELFFT],[test x$intelfft = xtrue])
AM_CONDITIONAL([QTHREAD],[test x$qthread = xtrue])
# check for boinc --- must happen after all compiler checks are done
LALSUITE_CHECK_BOINC
LALSUITE_END_CHECK_BOINC
# configure SWIG wrapping modules
LALSUITE_USE_SWIG
......
......@@ -370,10 +370,8 @@ fi
AM_CONDITIONAL([HAVE_BAMBI],[${hbf}])
AM_CONDITIONAL([HAVE_BAMBI_MPI],[${bambimpi}])
# use c++ mode for boinc build
if test "${boinc}" = "true" ; then
AC_LANG_PUSH([C++])
fi
# check for boinc, and modify compiler for lal library checks
LALSUITE_CHECK_BOINC
# check for lal libararies and headers
LALSUITE_CHECK_LIB([LAL],[${MIN_LAL_VERSION}],[XLALPerror],[lal/XLALError.h])
......@@ -388,13 +386,8 @@ LALSUITE_CHECK_OPT_LIB([LALPulsar],[${MIN_LALPULSAR_VERSION}],[XLALComputeFstat]
LALSUITE_CHECK_OPT_LIB([LALInference],[${MIN_LALINFERENCE_VERSION}],[LALInferenceAddVariable],[lal/LALInference.h])
LALSUITE_CHECK_OPT_LIB([LALStochastic],[${MIN_LALSTOCHASTIC_VERSION}],[LALStochasticOptimalFilter],[lal/StochasticCrossCorrelation.h])
# check that lal was built with BOINC support, if required
LALSUITE_CHECK_BOINC
# back to c mode
if test "${boinc}" = "true" ; then
AC_LANG_POP([C++])
fi
# finish boinc checks, and restore compiler after lal library checks
LALSUITE_END_CHECK_BOINC
# configure Doxygen documentation
LALSUITE_USE_DOXYGEN
......
......@@ -157,27 +157,20 @@ fi
# check for cfitsio
LALSUITE_USE_CFITSIO
# for boinc enabled build do checks for lal in c++ mode
if test "${boinc}" = "true" ; then
AC_LANG_PUSH([C++])
fi
# check for boinc, and modify compiler for lal library checks
LALSUITE_CHECK_BOINC
# check for lal libraries and headers
LALSUITE_CHECK_LIB([LAL],[${MIN_LAL_VERSION}],[XLALPerror],[lal/XLALError.h])
# check that lal was built with BOINC support, if required
LALSUITE_CHECK_BOINC
# check for lalsupport, needed for test suite
LALSUITE_CHECK_LIB([LALSupport],[${MIN_LAL_VERSION}],[XLALCacheImport],[lal/LALCache.h])
# check for lalxml
LALSUITE_CHECK_OPT_LIB([LALXML],[${MIN_LALXML_VERSION}],[XLALXMLFilePrintElements],[lal/LALXML.h])
# back to c mode
if test "${boinc}" = "true" ; then
AC_LANG_POP([C++])
fi
# finish boinc checks, and restore compiler after lal library checks
LALSUITE_END_CHECK_BOINC
# configure SWIG wrapping modules
LALSUITE_USE_SWIG
......
Markdown is supported
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