diff --git a/configure.ac b/configure.ac index 58f25b1eedbab44f9e3f0ecbf157f6c394674f78..5ad10e87265ad5f00031ca4c87303808adb8c622 100644 --- a/configure.ac +++ b/configure.ac @@ -444,6 +444,10 @@ if test "x$with_gsl" != "xno"; then AC_MSG_ERROR(something is wrong with the GSL library!), $GSL_LIBS) have_gsl="yes" fi + if test "$have_gsl" = "no"; then + GSL_LIBS="" + GSL_INCS="" + fi fi AC_SUBST([GSL_LIBS]) AC_SUBST([GSL_INCS]) @@ -543,6 +547,45 @@ AC_SUBST([GRACKLE_LIBS]) AC_SUBST([GRACKLE_INCS]) AM_CONDITIONAL([HAVEGRACKLE],[test -n "$GRACKLE_LIBS"]) +# Check for FFTW. We test for this in the standard directories by default, +# and only disable if using --with-fftw=no or --without-fftw. When a value +# is given GSL must be found. +have_fftw="no" +AC_ARG_WITH([fftw], + [AS_HELP_STRING([--with-fftw=PATH], + [root directory where fftw is installed @<:@yes/no@:>@] + )], + [with_fftw="$withval"], + [with_fftw="test"] +) +if test "x$with_fftw" != "xno"; then + if test "x$with_fftw" != "xyes" -a "x$with_fftw" != "xtest" -a "x$with_fftw" != "x"; then + FFTW_LIBS="-L$with_fftw/lib -lfftw3" + FFTW_INCS="-I$with_fftw/include" + else + FFTW_LIBS="-lfftw3" + FFTW_INCS="" + fi + # FFTW is not specified, so just check if we have it. + if test "x$with_fftw" = "xtest"; then + AC_CHECK_LIB([fftw3],[fftw_malloc],[have_fftw="yes"],[have_fftw="no"],$FFTW_LIBS) + if test "x$have_fftw" != "xno"; then + AC_DEFINE([HAVE_FFTW],1,[The FFTW library appears to be present.]) + fi + else + AC_CHECK_LIB([fftw3],[fftw_malloc], + AC_DEFINE([HAVE_FFTW],1,[The FFTW library appears to be present.]), + AC_MSG_ERROR(something is wrong with the FFTW library!), $FFTW_LIBS) + have_fftw="yes" + fi + if test "$have_fftw" = "no"; then + FFTW_LIBS="" + FFTW_INCS="" + fi +fi +AC_SUBST([FFTW_LIBS]) +AC_SUBST([FFTW_INCS]) +AM_CONDITIONAL([HAVEFFTW],[test -n "$FFTW_LIBS"]) # Check for tcmalloc a fast malloc that is part of the gperftools. have_tcmalloc="no" @@ -704,16 +747,6 @@ if test "$ac_cv_func_pthread_setaffinity_np" = "yes"; then fi fi -# Check for FFTW -have_fftw3="no" -AC_CHECK_HEADER([fftw3.h]) -if test "$ac_cv_header_fftw3_h" = "yes"; then - AC_CHECK_LIB([fftw3],[fftw_malloc], [AC_DEFINE([HAVE_FFTW], - [1],[Defined if FFTW 3.x exists.])] ) - FFTW_LIBS="-lfftw3" - have_fftw3="yes" -fi -AC_SUBST([FFTW_LIBS]) # Check for Intel and PowerPC intrinsics header optionally used by vector.h. AC_CHECK_HEADERS([immintrin.h]) @@ -1114,7 +1147,7 @@ AC_MSG_RESULT([ HDF5 enabled : $with_hdf5 - parallel : $have_parallel_hdf5 Metis enabled : $have_metis - FFTW3 enabled : $have_fftw3 + FFTW3 enabled : $have_fftw GSL enabled : $have_gsl libNUMA enabled : $have_numa GRACKLE enabled : $have_grackle diff --git a/examples/Makefile.am b/examples/Makefile.am index a589b184350b9fddc7028d60709f18c2003a2bea..95057c9bee7d3b4cc001d6c19ca39cab5d8544c4 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -18,8 +18,8 @@ # Common flags MYFLAGS = -# Add the source directory and debug to CFLAGS -AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) +# Add the source directory and the non-standard paths to the included library headers to CFLAGS +AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) AM_LDFLAGS = $(HDF5_LDFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index e21cb6539d2b7ae360ea07c92c426e99342bc2ec..d8b633fe1e97e67fc4ef0cc29bab8f6fd25fd907 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Add the debug flag to the whole thing -AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS) +# Add the non-standard paths to the included library headers +AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) # Assign a "safe" version number AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0 diff --git a/tests/Makefile.am b/tests/Makefile.am index 8a757e0b87ffae4d6daa1a6f2b67cf9548b868d0..643d89aaf05e31b6ea1c304c4fac6c28f7e89d03 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,8 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Add the source directory and debug to CFLAGS -AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) +# Add the source directory and the non-standard paths to the included library headers to CFLAGS +AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS) AM_LDFLAGS = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS)