configure.ac 3.05 KB
Newer Older
1
AC_INIT([ftimings], [0.2])
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
2
3
4
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])

5
6
API_VERSION=1

Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
7
8
9
10
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([foreign -Wall -Werror])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
11
12

AC_LANG([C])
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
13
AM_PROG_CC_C_O
14
AC_OPENMP
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
15

16
AC_ARG_ENABLE([papi],
17
18
19
	[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
20
  AC_CHECK_LIB([papi],[PAPI_library_init],[papi_found="yes"],[papi_found="no"])
21
22
  if test "$papi_found" = "no" ; then
    AC_MSG_ERROR(["Could not find usable PAPI installation, please adjust CFLAGS, LDFLAGS"])
23
24
25
26
  fi
  AC_DEFINE([HAVE_LIBPAPI], [1], [Use the PAPI library])
  LIBS="-lpapi $LIBS"
fi
27
28
29
30
31
32
33
34
35
36
37
38
39
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"])
40

41
42
43
44
45
46
47
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])

48
AC_MSG_CHECKING([whether we can compile AVX opcodes (important for example programs only)])
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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])

67
AC_LANG([Fortran])
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
68
69
70
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
AC_FC_FREEFORM
71
72
AC_OPENMP

Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
73
74

LT_INIT
75
76
AC_ENABLE_SHARED
AC_ENABLE_STATIC
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
77
78
79

PKG_PROG_PKG_CONFIG

80
81
82
83
84
85
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_MAN_FEATURE(ON)
DX_HTML_FEATURE(ON)
DX_INIT_DOXYGEN([ftimings], [Doxyfile], [docs])

86
87
AC_SUBST([API_VERSION])
AC_SUBST([FTIMINGS_SO_VERSION], [$API_VERSION:0:0])
88
AC_SUBST([AM_CFLAGS])
89
AC_SUBST([AM_FCFLAGS])
90
AC_SUBST([AM_LDFLAGS])
91
AC_SUBST([DOXYGEN_OUTPUT_DIR], [docs])
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
92
93

AC_CONFIG_FILES([Makefile
94
		 Doxyfile
95
96
		 ftimings-${API_VERSION}-${FCNAME}.pc:ftimings.pc.in
		 ftimings_perflib-${API_VERSION}-${FCNAME}.pc:ftimings_perflib.pc.in
Lorenz Hüdepohl's avatar
Lorenz Hüdepohl committed
97
98
		 ])
AC_OUTPUT
99

100
echo "Generating config-f90.h..."
101
grep "^#define" config.h > config-f90.h
102
103
echo "Generating ftimings/ftimings_generated.h..."
grep "^ *!c>" $srcdir/ftimings/ftimings.F90 | sed 's/^ *!c>//;' > ftimings/ftimings_generated.h