AC_INIT([ftimings], [0.2]) AC_PREREQ([2.59]) AC_CONFIG_MACRO_DIR([m4]) API_VERSION=1 AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_LANG([C]) AM_PROG_CC_C_O AC_OPENMP AC_ARG_ENABLE([papi], [AS_HELP_STRING([--disable-papi],[Do not use PAPI to also measure flop count])], [want_papi=$enableval],[want_papi="yes"]) if test "$want_papi" = "yes" ; then AC_CHECK_LIB([papi],[PAPI_library_init],[papi_found="yes"],[papi_found="no"]) if test "$papi_found" = "no" ; then AC_MSG_ERROR(["Could not find usable PAPI installation, please adjust CFLAGS, LDFLAGS"]) fi AC_DEFINE([HAVE_LIBPAPI], [1], [Use the PAPI library]) LIBS="-lpapi $LIBS" fi AM_CONDITIONAL([HAVE_LIBPAPI],[test "$want_papi" = "yes"]) AC_ARG_ENABLE([perf], [AS_HELP_STRING([--disable-perf],[Do not use the Linux perf API to measure amount of DRAM memory accesses])], [want_perf=$enableval],[want_perf="yes"]) if test "$want_perf" = "yes" ; then AC_CHECK_HEADERS([linux/perf_event.h],[perf_found="yes"],[perf_found="no"]) if test "$perf_found" = "no" ; then AC_MSG_ERROR(["Could not find linux/perf_event.h, please adjust CPPFLAGS"]) fi AC_DEFINE([HAVE_PERF], [1], [Use Linux perf API]) fi AM_CONDITIONAL([HAVE_PERF],[test "$want_perf" = "yes"]) AC_MSG_CHECKING([for custom library name suffix]) AC_ARG_ENABLE([compiler-suffix], [AS_HELP_STRING([--enable-compiler-suffix=NAME],[Libraries are named libftimings-$API_VERSION-NAME and libftimings_perflib-$API_VERSION-NAME @<:@default=$FC@:>@ ])], [AC_MSG_RESULT([$enableval]); compiler_suffix=$enableval],[AC_MSG_RESULT([default: $FC]); compiler_suffix=$FC]) AC_SUBST([FCNAME],[$compiler_suffix]) AC_MSG_CHECKING([whether we can compile AVX opcodes (important for example programs only)]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ int main(int argc, char **argv) { __asm__ __volatile__( "vmulpd %%ymm1, %%ymm2, %%ymm3;" "vaddpd %%ymm4, %%ymm5, %%ymm6;" : /* No outputs */ : /* No inputs */ : "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6" ); }])], [can_compile_avx=yes], [can_compile_avx=no] ) if test "$can_compile_avx" = "yes" ; then AC_DEFINE([HAVE_AVX], [1], [AVX code can be compiled]) fi AC_MSG_RESULT([$can_compile_avx]) AC_PROG_EGREP AC_LANG([Fortran]) AC_PROG_FC AC_FC_LIBRARY_LDFLAGS AC_FC_FREEFORM AC_OPENMP LT_INIT AC_ENABLE_SHARED AC_ENABLE_STATIC PKG_PROG_PKG_CONFIG DX_PDF_FEATURE(OFF) DX_PS_FEATURE(OFF) DX_MAN_FEATURE(ON) DX_HTML_FEATURE(ON) DX_INIT_DOXYGEN([ftimings], [Doxyfile], [docs]) AC_SUBST([API_VERSION]) AC_SUBST([FTIMINGS_SO_VERSION], [$API_VERSION:0:0]) AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_FCFLAGS]) AC_SUBST([AM_LDFLAGS]) AC_SUBST([DOXYGEN_OUTPUT_DIR], [docs]) AC_CONFIG_FILES([Makefile Doxyfile ftimings-${API_VERSION}-${FCNAME}.pc:ftimings.pc.in ftimings_perflib-${API_VERSION}-${FCNAME}.pc:ftimings_perflib.pc.in ]) AC_OUTPUT echo "Generating config-f90.h..." grep "^#define" config.h > config-f90.h echo "Generating ftimings/ftimings_generated.h..." grep "^ *!c>" $srcdir/ftimings/ftimings.F90 | sed 's/^ *!c>//;' > ftimings/ftimings_generated.h