-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
237 lines (201 loc) · 6.3 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
AC_PREREQ([2.63])
AC_INIT([uterus], [0.2.10], [https://github.com/hroptatyr/uterus])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([src/])
dnl -------------------------------------------------------------------------
dnl Local copyright notices.
dnl -------------------------------------------------------------------------
AC_COPYRIGHT(
[#### Configuration script for uterus (and sushi and friends)
#### Copyright (C) 2010-2015 Sebastian Freundt
### Don't edit this script!
### This script was automatically generated by the `autoconf' program
### from the file `./configure.ac'.
### To rebuild it, execute the command
### autoreconf -i
])
AM_INIT_AUTOMAKE([foreign dist-xz color-tests parallel-tests subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
## the build chain
AC_PROG_CC([icc gcc tcc cc])
SXE_CHECK_CC
AC_C_BIGENDIAN
SXE_CHECK_CFLAGS
## we need -msse2 to get the floating point right
SXE_CHECK_COMPILER_FLAG([-msse2], [
CFLAGS="${CFLAGS} -msse2"
])
## yuck helper
AX_YUCK_SCMVER([version.mk])
AX_CHECK_YUCK([with_included_yuck="yes"])
AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
## clitoris helper
AX_CHECK_CLITORIS
## check for byteorder utils
AC_CHECK_HEADERS([endian.h sys/endian.h machine/endian.h byteorder.h])
AC_CHECK_HEADERS([byteswap.h])
## check for mkostemp
SXE_FUNC_MKOSTEMP
## and ssize_t
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_TYPES([ssize_t], [], [], [[
#if defined HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
]])
## check for tzfile.h
AX_ZONEINFO([right])
## check for struct tm goodness
save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="-D_BSD_SOURCE"
AC_STRUCT_TIMEZONE
AC_CHECK_HEADERS([time.h])
AC_CHECK_MEMBERS([struct tm.tm_gmtoff], [], [], [[
#ifdef HAVE_TIME_H
# include <time.h>
#endif
]])
CPPFLAGS="${save_CPPFLAGS}"
## check for routines to set file times
AC_DEFUN([SXE_CHECK_STRUCT_STAT], [
AC_CHECK_MEMBERS([struct stat.$1], [], [], [dnl
#define _XOPEN_SOURCE 600
#define _BSD_SOURCE
#define _POSIX_C_SOURCE 201001L
AC_INCLUDES_DEFAULT
])
])dnl SXE_CHECK_STRUCT_STAT
## find the best function to set timestamps
AC_CHECK_FUNCS([utimens utimensat utimes utime])
## find slots of struct stat where high-res timestamps are stored
SXE_CHECK_STRUCT_STAT([st_atim.tv_nsec])
SXE_CHECK_STRUCT_STAT([st_atimespec.tv_nsec])
SXE_CHECK_STRUCT_STAT([st_atimensec])
SXE_CHECK_STRUCT_STAT([st_uatime])
SXE_CHECK_STRUCT_STAT([st_atim.st__tim.tv_nsec])
## check for working c1x features
SXE_CHECK_ANON_STRUCTS_DECL
SXE_CHECK_ANON_STRUCTS_INIT
SXE_CHECK_SLOPPY_STRUCTS_INIT
if test "${sxe_cv_have_anon_structs_decl}" != "yes"; then
AC_MSG_ERROR([C compiler unusable
uterus make extensive use of c11 anonymous structs/unions but your
compiler does not fully support them.
Change either the CFLAGS or the compiler.
Good day.
])
elif test "${sxe_cv_have_anon_structs_init}" != "yes"; then
AC_MSG_WARN([C compiler needs archaeological treatment
uterus' codebase is modern and makes use of modern compiler features
but your compiler does not fully support them.
The build won't fail but you will use legacy constructs and hacks
which have not seen any form of testing.
Fingers crossed it works innit?
])
fi
## check for libcurl (critical for gandapi)
PKG_CHECK_MODULES([curl], [libcurl >= 7.0.0], [have_curl="yes"], [have_curl="no"])
if test "${have_curl}" = "yes"; then
save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${curl_CFLAGS} ${CPPFLAGS}"
AC_CHECK_HEADERS([curl/curl.h])
CPPFLAGS="${save_CPPFLAGS}"
if test "${ac_cv_header_curl_curl_h}" != "yes"; then
have_curl="no"
fi
fi
AM_CONDITIONAL([HAVE_CURL], [test "${have_curl}" = "yes"])
## ute can do with lzma
PKG_CHECK_MODULES([lzma], [liblzma], [have_lzma="yes"], [have_lzma="no"])
AM_CONDITIONAL([HAVE_LZMA], [test "${have_lzma}" = "yes"])
if test "${have_lzma}" = "yes"; then
## check for the header
SXE_DUMP_LIBS
CPPFLAGS="${CPPFLAGS} ${lzma_CFLAGS}"
LDFLAGS="${LDFLAGS} ${lzma_LIBS}"
AC_CHECK_HEADERS([lzma.h])
if test "${ac_cv_header_lzma_h}" != "yes"; then
have_lzma="no"
fi
SXE_RESTORE_LIBS
fi
## ibhist needs expat
PKG_CHECK_MODULES([expat], [expat], [have_expat="yes"], [have_expat="no"])
AM_CONDITIONAL([HAVE_EXPAT], [test "${have_expat}" = "yes"])
## hdf5 demuxer needs hdf5
AX_LIB_HDF5([serial])
AM_CONDITIONAL([HAVE_HDF5], [test "${with_hdf5}" = "yes"])
## ute anal can do with libpng
PKG_CHECK_MODULES([libpng], [libpng], [have_libpng="yes"], [have_libpng="no"])
AM_CONDITIONAL([HAVE_LIBPNG], [test "${have_libpng}" = "yes"])
if test "${have_libpng}" = "yes"; then
## check for the header
SXE_DUMP_LIBS
CPPFLAGS="${CPPFLAGS} ${libpng_CFLAGS}"
AC_CHECK_HEADERS([png.h])
if test "${ac_cv_header_png_h}" != "yes"; then
have_libpng="no"
fi
SXE_RESTORE_LIBS
fi
## lift big endianness to Makefile level
AM_CONDITIONAL([WORDS_BIGENDIAN], [test "${ac_cv_c_bigendian}" = "yes"])
## check for file(1)
AC_CHECK_TOOL([FILE], [file])
AM_CONDITIONAL([HAVE_FILE], [test -n "${FILE}"])
## check for matlab
AC_ARG_WITH([matlab], [
AS_HELP_STRING([--with-matlab], [Build matlab contribs, default: no.])],
[with_matlab="${withval}"], [with_matlab="no"])
## the actual checks
if test "${with_matlab}" = "yes"; then
SXE_CHECK_MATLAB
have_matlab="yes"
fi
AM_CONDITIONAL([BUILD_MATCLI], [test "${have_matlab}" = "yes"])
## check for R
AC_ARG_WITH([R], [
AS_HELP_STRING([--with-R], [Build R contribs, default: no.])],
[dnl
if test "${withval}" = "yes"; then
PKG_CHECK_MODULES([R], [libR >= 2.0.0], [
with_R="yes"
], [
with_R="no"
])
else
with_R="${withval}"
fi
], [with_R="no"])
AM_CONDITIONAL([BUILD_RCLI], [test "${with_R}" = "yes"])
## libtool goddess^Wgoodness
## has to be down here as we're turning -Werror'ing off
SXE_CHECK_LIBTOOL
LT_CONFIG_LTDL_DIR([libltdl])
LTDL_INIT([recursive])
SXE_CHECK_LIBLTDL
## offload some of the final targets here
headerdir="${includedir}/uterus"
utedir="${libexecdir}/uterus"
AC_SUBST([headerdir])
AC_SUBST([utedir])
## output
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([build-aux/Makefile])
AC_CONFIG_FILES([libltdl/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([aux/Makefile])
AC_CONFIG_FILES([aux/matlab/Makefile])
AC_CONFIG_FILES([aux/R/Makefile])
AC_CONFIG_FILES([info/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_OUTPUT
cat <<EOF
Build summary
=============
Build client: ute
Build library: libuterus
EOF
dnl configure.ac ends here