Skip to content
Snippets Groups Projects
Commit 3ca0d151 authored by Peter W. Draper's avatar Peter W. Draper Committed by Matthieu Schaller
Browse files

Make build system compatible with autotools 2.71.

parent d2197536
No related branches found
No related tags found
12 merge requests!1715Update planetary strength after planetary plus's master rebase,!1693More threapool plotting tweaks,!1668before Mag.Egy in all the flavors,!1663Initial sync to work again,!1662Initial sync from previous months,!1642When searching for more particles in a ghost task we walk up the cell tree,...,!1633When searching for more particles in a ghost task we walk up the cell tree,...,!1631Solving issues with different Hydro Schemes,!1620Mhd canvas,!1619Mhd canvas,!1617Update to from main branch to Canvas to MHD_FS,!1588Make build system compatible with autotools 2.71.
......@@ -31,10 +31,13 @@ AC_CONFIG_MACRO_DIR([m4])
: ${CFLAGS=""}
# Generate header file.
AM_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS([config.h])
# Find and test the compiler.
AX_CHECK_ENABLE_DEBUG
# Enable POSIX and platform extension preprocessor macros.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AM_PROG_CC_C_O
AC_OPENMP
......@@ -143,9 +146,11 @@ AC_ARG_ENABLE([mpi],
[enable_mpi="$enableval"],
[enable_mpi="yes"]
)
# Use extra flags set by AC_PROG_CC as part of $CC. Currently undocumented as ac_cv_prog_cc_stdc,
# so could change.
good_mpi="yes"
if test "$enable_mpi" = "yes"; then
AX_MPI([CC="$MPICC" AC_DEFINE(HAVE_MPI, 1, [Define if you have the MPI library.]) ])
AX_MPI([CC="$MPICC $ac_cv_prog_cc_stdc" AC_DEFINE(HAVE_MPI, 1, [Define if you have the MPI library.]) ])
MPI_LIBRARY="Unknown MPI"
# Various MPI implementations require additional libraries when also using
......@@ -210,10 +215,13 @@ AC_ARG_VAR(MPIRUN, Path to the mpirun command if non-standard)
# Add libtool support (now that CC is defined). Disable shared libraries by default.
LT_INIT([disable-shared])
# Need C99 and inline support.
AC_PROG_CC_C99
# Need C99 and inline support. Only for autoconfs to version 2.69.
m4_version_prereq([2.71], [], [AC_PROG_CC_C99])
# Need inline support.
AC_C_INLINE
# If debugging try to show inlined functions.
if test "x$enable_debug" = "xyes"; then
# Show inlined functions.
......@@ -682,7 +690,8 @@ AC_ARG_ENABLE([mpi-mesh-gravity],
# Autoconf stuff.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_HEADER_STDC
AC_PROG_EGREP
# Check for the libraries we will need.
AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!))
......@@ -1560,8 +1569,33 @@ AC_CHECK_HEADERS([altivec.h], [], [],
])
# 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])
AC_CHECK_HEADERS_ONCE([sys/time.h])
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
AC_CHECK_HEADERS([sys/time.h], [], [],
[#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
])
AC_CHECK_HEADERS([c_asm.h], [], [],
[#ifdef HAVE_C_ASM_H
# include <c_asm.h>
#endif
])
AC_CHECK_HEADERS([intrinsics.h], [], [],
[#ifdef HAVE_INTRINSICS_H
# include <intrinsics.h>
#endif
])
AC_CHECK_HEADERS([mach/mach_time.h], [], [],
[#ifdef HAVE_MACH_MACH_TIME_H
# include <mach/mach_time.h>
#endif
])
AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t
is defined in <sys/time.h>])],,
[#if HAVE_SYS_TIME_H
......@@ -1579,12 +1613,12 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(
AC_MSG_RESULT($rtc_ok)
# Special timers for the ARM v7 platforms (taken from FFTW-3 to match their cycle.h)
AC_ARG_ENABLE(armv7a-cntvct, [AC_HELP_STRING([--enable-armv7a-cntvct],[enable the cycle counter on Armv7a via the CNTVCT register])], have_armv7acntvct=$enableval)
AC_ARG_ENABLE(armv7a-cntvct, [AS_HELP_STRING([--enable-armv7a-cntvct],[enable the cycle counter on Armv7a via the CNTVCT register])], have_armv7acntvct=$enableval)
if test "$have_armv7acntvct"x = "yes"x; then
AC_DEFINE(HAVE_ARMV7A_CNTVCT,1,[Define if you have enabled the CNTVCT cycle counter on ARMv7a])
fi
AC_ARG_ENABLE(armv7a-pmccntr, [AC_HELP_STRING([--enable-armv7a-pmccntr],[enable the cycle counter on Armv7a via the PMCCNTR register])], have_armv7apmccntr=$enableval)
AC_ARG_ENABLE(armv7a-pmccntr, [AS_HELP_STRING([--enable-armv7a-pmccntr],[enable the cycle counter on Armv7a via the PMCCNTR register])], have_armv7apmccntr=$enableval)
if test "$have_armv7apmccntr"x = "yes"x; then
AC_DEFINE(HAVE_ARMV7A_PMCCNTR,1,[Define if you have enabled the PMCCNTR cycle counter on ARMv7a])
fi
......
......@@ -302,7 +302,7 @@ HDF5 support is being disabled.
AC_MSG_WARN([Unable to compile HDF5 test program])
fi
dnl Look for HDF5's high level library
AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], [])
AC_CHECK_LIB([hdf5_hl],[main],[HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"],[],[])
CC=$ax_lib_hdf5_save_CC
CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS
......
......@@ -67,7 +67,7 @@
AU_ALIAS([ACX_MPI], [AX_MPI])
AC_DEFUN([AX_MPI], [
AC_PREREQ(2.50) dnl for AC_LANG_CASE
AC_PREREQ([2.69]) dnl for AC_LANG_CASE
AC_LANG_CASE([C], [
AC_REQUIRE([AC_PROG_CC])
......@@ -135,16 +135,16 @@ if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
fi
dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the
dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the
dnl latter uses $CPP, not $CC (which may be mpicc).
AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[C++], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[Fortran 77], [if test x != x"$MPILIBS"; then
......
......@@ -16,7 +16,7 @@
#
# Uses pkg-config to try to find package PKGNAME. If successful defines
# preprocessor macro HAVE_$VARNAME and sets USE_$VARNAME = "yes", otherwise
# sets USE_$VARNAME = "no".
# sets USE_$VARNAME = "no".
#
# Also sets ${VARNAME}_LIBS and ${VARNAME}_CFLAGS on success.
#
......@@ -30,7 +30,7 @@
AC_DEFUN([GV_FIND_LIBRARY],[
# Allow user to enable/disable library
AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1@<:@=PATH@:>@],[use the $1 library]),
AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1@<:@=PATH@:>@],[use the $1 library]),
[USE_$2=$withval ; GV_SPEC="yes" ],[USE_$2="check" ; GV_SPEC="no" ])
# Figure out if we have been given a path
......@@ -59,10 +59,12 @@ if test $USE_$2 != "no" ; then
export PKG_CONFIG_PATH=$GV_$2_PATH/pkgconfig/:$GV_$2_PATH/lib/pkgconfig/:$PKG_CONFIG_PATH
fi
# Try to set it up with pkg-config
GV_PKG="yes"
PKG_CHECK_MODULES([$2], [$3], [],
[echo Unable to find $1 with pkg-config, will try to link to it anyway... ; GV_PKG="no"])
# Try to set it up with pkg-config. First check we have the macro...
GV_PKG="no"
m4_ifdef([PKG_CHECK_MODULES],
[PKG_CHECK_MODULES([$2], [$3], [GV_PKG="yes"],
[AC_MSG_WARN([Unable to find $1 with pkg-config, will try to link to it anyway...])])],
[AC_MSG_WARN([No PKG_CHECK_MODULES macro, trying without pkg-config support])])
# Restore original PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$TMP_PKG_CONFIG_PATH
......@@ -84,12 +86,12 @@ if test $USE_$2 != "no" ; then
# Try to link to the library
TMP_LIBS=$LIBS
LIBS="${$2_LIBS} ${LIBS}"
AC_CHECK_LIB([$4], [$5], [GV_FOUND="yes"],
[echo ; echo WARNING: Unable to link to $1 library. See config.log for details ; echo])
AC_CHECK_LIB([$4], [$5], [GV_FOUND="yes"],
[AC_MSG_WARN([Unable to link to $1 library. See config.log for details])])
LIBS=$TMP_LIBS
if test $GV_FOUND = "no" ; then
# If we can't link the library and it was explicitly asked for, abort
# If we can't link the library and it was explicitly asked for, abort
if test $GV_SPEC = "yes" ; then
AC_MSG_ERROR([Unable to link to requested library: $1])
fi
......@@ -116,4 +118,3 @@ if test $GV_FOUND = "yes" ; then
fi
])
......@@ -81,16 +81,8 @@ intrinsic.])], [rtc_ok=no])
/***************************************************************************/
#include <stdint.h>
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#define INLINE_ELAPSED(INL) \
static INL double elapsed(ticks t1, ticks t0) { \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment