diff --git a/Makefile.am b/Makefile.am index 491dce02a6ac70c35a0227fc84102eb10dfd136e..09288605fdb7ff0e34ddac06a4d0e0177bfb725b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Automake stuff -AUTOMAKE_OPTIONS = gnu ACLOCAL_AMFLAGS = -I m4 # Show the way... diff --git a/configure.ac b/configure.ac index 39233f5fe11bd377534cac2c73bcd34db19ec8e7..6e2d8282e471fdbe5aafa297c4ea079122f3f415 100644 --- a/configure.ac +++ b/configure.ac @@ -1,17 +1,17 @@ # This file is part of SWIFT. # Coypright (c) 2012 pedro.gonnet@durham.ac.uk. -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -19,8 +19,8 @@ AC_INIT([SWIFT],[0.1.0]) AC_CONFIG_SRCDIR([src/space.c]) AM_INIT_AUTOMAKE - AC_USE_SYSTEM_EXTENSIONS + LT_INIT # my own macro collection @@ -31,14 +31,30 @@ AM_CONFIG_HEADER(config.h) # find and test the compiler AC_PROG_CC +AM_PROG_CC_C_O + +# Check for MPI. Need to do this before characterising the compiler (C99 mode). +AC_ARG_ENABLE([mpi], + [AS_HELP_STRING([--enable-mpi],[compile with functionality for distributed-memory parallelim using MPI @<:@default=yes@:>@])], + [if test "x$enable_mpi" != "xno" + then + ACX_MPI([ CC="$MPICC" AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.]) ]) + fi], + [ACX_MPI([ CC="$MPICC" AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.]) ])]) +AM_CONDITIONAL([HAVEMPI],[test -n "$MPICC"]) + AC_PROG_CC_C99 AC_C_INLINE -# AX_CC_MAXOPT +AX_CC_MAXOPT AX_FUNC_POSIX_MEMALIGN AX_GCC_ARCHFLAG([no]) -AX_EXT +# Check SSE & AVX support. +AX_EXT +if test "$SIMD_FLAGS" != ""; then + CFLAGS="$CFLAGS $SIMD_FLAGS" +fi # autoconf stuff AC_PROG_INSTALL @@ -55,19 +71,18 @@ ACX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" the pthread library. Make sure you have the library and header files installed or use CPPFLAGS and LDFLAGS if the library is installed in a non-standard location.])) - - -# Check for MPI -AC_ARG_ENABLE([mpi], - [AS_HELP_STRING([--enable-mpi],[compile with functionality for distributed-memory parallelim using MPI @<:@default=yes@:>@])], - [if test "x$enable_mpi" != "xno" - then - ACX_MPI([ CC="$MPICC" AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.]) ]) - fi], - [ACX_MPI([ CC="$MPICC" AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.]) ])]) -AM_CONDITIONAL([HAVEMPI],[test -n "$MPICC"]) - + +# Check for OpenMP +AC_OPENMP +AC_SUBST(OPENMP_CFLAGS) +if test -z "${OPENMP_CFLAGS}"; then + echo $OPENMP_CFLAGS + AC_MSG_ERROR(Compiler does not support OpenMP, 1) +else + CFLAGS="$CFLAGS $OPENMP_CFLAGS" +fi + # Check for metis AC_ARG_WITH([metis], [AS_HELP_STRING([--with-metis=PATH],[prefix where the metis library is installed @<:@default=yes@:>@])], @@ -93,25 +108,14 @@ AC_CHECK_LIB(z,gzopen,[ LDFLAGS="$LDFLAGS -lz" ],[]) -# check for memalign -AX_FUNC_POSIX_MEMALIGN - -# Check for OpenMP -AC_OPENMP -AC_SUBST(OPENMP_CFLAGS) -if test -z "${OPENMP_CFLAGS}"; then - echo $OPENMP_CFLAGS - AC_MSG_ERROR(Compiler does not support OpenMP, 1) -fi # Check for HDF5 AX_LIB_HDF5() # check for setaffinity -AC_USE_SYSTEM_EXTENSIONS AC_CHECK_FUNC( pthread_setaffinity_np , AC_DEFINE([HAVE_SETAFFINITY],[true], [Defined if pthread_setaffinity_np exists.]) ) - + # Check for timing functions needed by cycle.h AC_HEADER_TIME AC_CHECK_HEADERS([sys/time.h c_asm.h intrinsics.h mach/mach_time.h]) diff --git a/examples/Makefile.am b/examples/Makefile.am index 1f39d95ea5c5f799457c33ba9e9ef8f18e8f868e..d097d06d5fa4c3032e14c1cf0122907b03843f1a 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -38,35 +38,35 @@ endif # Sources for test test_SOURCES = test.c test_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep | engine_policy_setaffinity" -test_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) +test_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_fixdt test_fixdt_SOURCES = test.c test_fixdt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep | engine_policy_setaffinity" -test_fixdt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) +test_fixdt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_mindt test_mindt_SOURCES = test.c test_mindt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_keep | engine_policy_setaffinity" -test_mindt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) +test_mindt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_mpi test_mpi_SOURCES = test.c test_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep" -test_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) +test_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_fixdt_mpi test_fixdt_mpi_SOURCES = test.c test_fixdt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep" -test_fixdt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) +test_fixdt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_mindt_mpi test_mindt_mpi_SOURCES = test.c test_mindt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DWITH_MPI -DENGINE_POLICY="engine_policy_keep" -test_mindt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) +test_mindt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) # Sources for test_single test_single_SOURCES = test_single.c test_single_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -test_single_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) +test_single_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 index ca3639715e7243fa4343eb2e7f3de53927cc9d4a..89d3b93b527a717a8901584144f55f4475e503f6 100644 --- a/m4/ax_check_compile_flag.m4 +++ b/m4/ax_check_compile_flag.m4 @@ -58,7 +58,7 @@ #serial 4 AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +[AC_PREREQ(2.63)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS