-
Notifications
You must be signed in to change notification settings - Fork 23
/
configure.ac
163 lines (122 loc) · 3.77 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
AC_INIT([fgsl],[1.6.0],[Reinhold.Bader@lrz.de])
AC_PREREQ([2.69])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CANONICAL_HOST
LIB_CURRENT=1
LIB_REVISION=6
LIB_AGE=0
AC_SUBST(LIB_CURRENT)
AC_SUBST(LIB_REVISION)
AC_SUBST(LIB_AGE)
#m4_pattern_allow([AS_TR_SH])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
m4_ifdef([AM_PROG_AR],[AM_PROG_AR])
LT_PREREQ([2.1.0])
LT_INIT([win32-dll])
AC_PROG_CC
if test -z $CC ; then
AC_MSG_ERROR([no C compiler was found on the system.])
fi
#initialize pkg-config
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([gsl], [gsl >= 2.7])
local_gsl_version=`$PKG_CONFIG --modversion gsl`
AC_SUBST(GSL_VERSION,$local_gsl_version)
AC_DEFINE_UNQUOTED([GSL_VERSION],['$local_gsl_version'],[gsl version])
AC_DEFINE_UNQUOTED([GSL_VERSION2],[$local_gsl_version],[gsl version without quotes])
AC_PROG_FC
if test -z $FC ; then
AC_MSG_ERROR([Fortran 2003 compiler was not found])
fi
#check for ieee_exceptions support
AC_FC_SRCEXT([F90],[
AC_MSG_CHECKING([whether the fortran compiler supports the 2003 feature: ieee_exceptions])
AC_LANG_PUSH(Fortran)
AC_COMPILE_IFELSE([[
PROGRAM main
USE, INTRINSIC :: ieee_exceptions
IMPLICIT NONE
INTEGER :: i = 0
i = i+1
ENDPROGRAM
]], [IEEE_EXCEPTIONS=yes], [IEEE_EXCEPTIONS=no])
AC_LANG_POP(Fortran)
AC_MSG_RESULT([$IEEE_EXCEPTIONS])
])
if test "x$IEEE_EXCEPTIONS" = xyes ; then
AC_DEFINE([IEEE_EXCEPTIONS],[],[Fortran 2003 ieee_exceptions intrinsic module found])
fi
#check for support for BLOCK
AC_FC_SRCEXT([F90],[
AC_MSG_CHECKING([whether the fortran compiler supports the BLOCK construct])
AC_LANG_PUSH(Fortran)
AC_COMPILE_IFELSE([[
PROGRAM main
IMPLICIT NONE
INTEGER :: i = 0
BLOCK
i = i+1
END BLOCK
ENDPROGRAM
]], [BLOCK=yes], [BLOCK=no])
AC_LANG_POP(Fortran)
AC_MSG_RESULT([$BLOCK])
])
if test "x$BLOCK" = xno ; then
AC_MSG_ERROR([Fortran 2008 BLOCK construct is not supported])
fi
#check for target support
AC_FC_SRCEXT([F90],[
AC_MSG_CHECKING([whether the fortran compiler supports the 2008 feature: c_loc for targeted arrays])
AC_LANG_PUSH(Fortran)
AC_COMPILE_IFELSE([[
SUBROUTINE test(c)
USE, INTRINSIC :: iso_c_binding
IMPLICIT NONE
INTEGER(c_size_t), DIMENSION(:), INTENT(inout), TARGET:: c
TYPE(C_PTR) :: ptr
ptr = C_LOC(c)
ENDSUBROUTINE
]], [C_LOC_TARGET=yes], [C_LOC_TARGET=no])
AC_LANG_POP(Fortran)
AC_MSG_RESULT([$C_LOC_TARGET])
])
if test "x$C_LOC_TARGET" = xno; then
AC_MSG_ERROR([Fortran compiler does not support a required feature from the 2008 standard.])
fi
case "$host" in
*mingw*)
FGSL_LDFLAGS="-no-undefined"
AC_SUBST(FGSL_LDFLAGS)
;;
esac
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([size_t])
if test "x$ac_cv_sizeof_size_t" = "x4" ; then
AC_MSG_NOTICE([32 bit architecture detected])
elif test "x$ac_cv_sizeof_size_t" = "x8" ; then
AC_MSG_NOTICE([64 bit architecture detected])
else
AC_MSG_ERROR([Unknown architecture detected])
fi
AC_PROG_SED
gsl_version_major_fortran=`echo $local_gsl_version | $SED -e 's/\([[[:digit:]]]\{1,\}\)\.\([[[:digit:]]]\{1,\}\)/\1/'`
gsl_version_minor_fortran=`echo $local_gsl_version | $SED -e 's/\([[[:digit:]]]\{1,\}\)\.\([[[:digit:]]]\{1,\}\)/\2/'`
AC_DEFINE_UNQUOTED([GSL_VERSION_MAJOR_FORTRAN],[$gsl_version_major_fortran],[gsl version major for fortran code])
AC_DEFINE_UNQUOTED([GSL_VERSION_MINOR_FORTRAN],[$gsl_version_minor_fortran],[gsl version minor for fortran code])
AC_LANG_PUSH(Fortran)
AC_OPENMP
AC_LANG_POP(Fortran)
AC_CONFIG_FILES([Makefile tests/Makefile fgsl.pc fgsl.spec doc/Makefile doc/examples/Makefile])
AC_CONFIG_HEADERS([config.h])
abs_top_builddir=`pwd -P`
AC_SUBST(abs_top_builddir)
abs_top_srcdir=`AS_DIRNAME([$0])`
cd $abs_top_srcdir
abs_top_srcdir=`pwd -P`
cd $abs_top_builddir
AC_SUBST(abs_top_srcdir)
AM_CONDITIONAL([ABS_SRC_BUILD_EQUAL],[test x$abs_top_builddir = x$abs_top_srcdir])
AC_OUTPUT