forked from Novartis/hdf5r
-
Notifications
You must be signed in to change notification settings - Fork 23
/
configure.ac
151 lines (120 loc) · 3.47 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
AC_INIT([hdf5r], 0.1.0, [[email protected]])
dnl Grab that macro that checks for HDF5 availability
m4_include([inst/m4/ax_lib_hdf5.m4])
m4_include([inst/m4/ax_compare_version.m4])
m4_include([inst/m4/hh_hdf5rlib.m4])
AX_LIB_HDF5()
if test "$with_hdf5" = "yes"; then
AC_MSG_RESULT([Found hdf5 with version: $HDF5_VERSION])
AX_COMPARE_VERSION([$HDF5_VERSION], [ge], [1.8.13], [hdf5_version_sufficient="yes"], AC_MSG_ERROR([The version of hdf5 installed on your system is not sufficient. Please ensure that at least version 1.8.13 is installed]))
else
AC_MSG_ERROR([hdf5 does not seem to be installed on your platform.
Please install the hdf5 library.
The required HDF5 library files can be installed as follows:
- Debian-based (e.g. Debian >= 8.0, Ubuntu >= 15.04): 'sudo apt-get install libhdf5-dev'
- Old Debian-based (e.g Debian < 8.0, Ubuntu < 15.04): Install from source (see INSTALL)
- OS X using Homebrew: 'brew install hdf5'
- RPM-based (e.g Fedora): 'sudo yum install hdf5-devel'])
fi
if test "$hdf5_version_sufficient" = "yes"; then
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.8.13],
[HDF5_VERSION_USE="1_8_14"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.8.14],
[HDF5_VERSION_USE="1_8_14"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.8.16],
[HDF5_VERSION_USE="1_8_16"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.10.0],
[HDF5_VERSION_USE="1_10_0"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.10.2],
[HDF5_VERSION_USE="1_10_2"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.10.3],
[HDF5_VERSION_USE="1_10_3"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.10.4],
[HDF5_VERSION_USE="1_10_3"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.12.0],
[HDF5_VERSION_USE="1_12_0"])
AX_COMPARE_VERSION(
[$HDF5_VERSION],
[ge],
[1.12.0],
[HDF5_API_VERS_USE="-DH5_USE_110_API"],
[HDF5_API_VERS_USE=""])
fi
AC_SUBST(HDF5_VERSION_USE)
AC_SUBST(HDF5_API_VERS_USE)
AC_SUBST(DEFINE_H5FREE_MEMORY)
dnl Now find the compiler and compiler flags to use
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
if test -z "${LIBS}"; then
dnl prefer ggrep if installed
AC_CHECK_PROG(GREP,ggrep,`which ggrep`, `which grep`)
dnl check if $GREP supports option -o
AC_MSG_CHECKING([whether ${GREP} accepts -o])
if `echo '' | ${GREP} -o '' >/dev/null 2>&1`
then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([${GREP} does not support option -o])
fi
[
LIBS=`${H5CC} -show | ${GREP} -o "\-L[^[:space:]]\+" | tr "\n" " "`
]
dnl Fix for newer Debian versions
HDF5R_LIBS="${LIBS} -L. -lhdf5_hl -lhdf5 -lz -lm"
fi
if test -z "${CPPFLAGS}"; then
dnl prefer ggrep if installed
AC_CHECK_PROG(GREP,ggrep,`which ggrep`, `which grep`)
dnl check if $GREP supports option -o
AC_MSG_CHECKING([whether ${GREP} accepts -o])
if `echo '' | ${GREP} -o '' >/dev/null 2>&1`
then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([${GREP} does not support option -o])
fi
echo 'int main() { return; }' > myconftest.c
[
HDF5R_CPPFLAGS=`${H5CC} -show -c myconftest.c | ${GREP} -o "\-I[^[:space:]]\+" | tr "\n" " "`
]
rm -f myconftest.c
fi
dnl dummy substitute HDF5R_CFLAGS
HDF5R_CFLAGS=""
AC_SUBST(HDF5R_CFLAGS)
dnl substitute CPPFLAGS and LIBS
AC_SUBST(HDF5R_CPPFLAGS)
AC_SUBST(HDF5R_LIBS)
dnl and do subsitution in the src/Makevars.in
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT