forked from linbox-team/givaro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
291 lines (234 loc) · 8.6 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Copyright(c)'1994-2011 by The Givaro group
# This file is part of Givaro.
# Givaro is governed by the CeCILL-B license under French law
# and abiding by the rules of distribution of free software.
# see the COPYRIGHT file for more details.
#/
AC_PREREQ([2.68])
AC_INIT([Givaro],[4.0.5],[http://github.com/linbox-team/givaro],[givaro],
[https://casys.gricad-pages.univ-grenoble-alpes.fr/givaro])
AC_CONFIG_MACRO_DIR([macros])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.10 -Wall -Wno-portability foreign])
AX_PREFIX_CONFIG_H(givaro-config.h, __GIVARO)
AM_PROG_AR
AM_ACLOCAL_INCLUDE(macros)
AC_LANG([C++])
echo "-----------------------------------------------"
AC_DEBUG
AC_PROFILE
AC_WARNINGS
AC_INLINE # DON'T TOUCH
echo "-----------------------------------------------"
# CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
# CXXFLAGS=${CXXFLAGS:-$DEFAULT_CXXFLAGS}
######################################################
# Try and pass different flags according to compiler #
######################################################
# disable default -g -O2 CXXFLAGS
: ${CXXFLAGS=""}
#set CXX
AC_PROG_CXX
AC_COMPILER_NAME
# We need a C++11 compiler now - AB 2014-12-12
# clang-3.8 does not support __float128 without explicitly passing it -std=c++11
if test "x${CCNAM}" = "xclang38" ; then
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
else
AX_CXX_COMPILE_STDCXX_11([ext],[mandatory])
fi
REQUIRED_FLAGS="$CXX11FLAGS"
# Add the c++11 flags for the configure compilations as clang needs it to work properly with a glibc++ compiled with gcc
BACKUP_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="${CXXFLAGS} ${REQUIRED_FLAGS}"
TESTS_CFLAGS="-O0"
DEBUG_CFLAGS="-g"
DEFAULT_CFLAGS=""
WARN_CFLAGS="-Wall"
#TODO use -fast for icc, -ipa for eko...
if test "x$DBG" = "xyes" ; then
DEFAULT_CFLAGS="-O0 ${DEFAULT_CFLAGS} " #those are CXXFLAGS
DEBUG_CFLAGS="${DEBUG_CFLAGS} -UNDEBUG -DDEBUG -DGIVARO_DEBUG"
else
DEFAULT_CFLAGS="-O2 ${DEFAULT_CFLAGS} "
DEBUG_CFLAGS="${DEBUG_CFLAGS} -DNDEBUG -UGIVARO_DEBUG -UDEBUG"
fi
if test "x$PROF" = "xyes" ; then
DEFAULT_CFLAGS="${DEFAULT_CFLAGS} -pg"
fi
if test "x$WARN" = "xyes" -o "x$WARN" = "xfull" ; then
case x${CCNAM} in
xicc)
WARN_CFLAGS="${WARN_CFLAGS} -Wcheck"
WARN_CFLAGS="${WARN_CFLAGS} -Wall -Wno-unused-parameter -Wuninitialized -Wconversion -Wcast-qual -pedantic -Wshadow -Wpointer-arith -Wwrite-strings -Wno-long-long"
WARN_CFLAGS="${WARN_CFLAGS} -Wextra -ansi"
;;
xeko)
WARN_CFLAGS="${WARN_CFLAGS} -Wno-unused-parameter"
;;
xgcc|xgcc44)
WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
if test "x${WARN}" = "xfull" ; then
WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long -Wno-variadic-macros -Wno-vla"
fi
if test "x${HAVE_CXX11}" = "x0" ; then
WARN_CFLAGS="${WARN_CFLAGS} -ansi"
fi
;;
xgcc48)
WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
if test "x${WARN}" = "xfull" ; then
WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long -Wno-variadic-macros -Wno-vla"
# WARN_CFLAGS="${WARN_CFLAGS} -fsanitize=address"
fi
if test "x${HAVE_CXX11}" = "x0" ; then
WARN_CFLAGS="${WARN_CFLAGS} -ansi"
fi
;;
xclang)
WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
if test "x${WARN}" = "xfull" ; then
WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long -Wno-vla-extension -Wno-variadic-macros"
WARN_CFLAGS="${WARN_CFLAGS} -D__STRICT_ANSI__"
fi
;;
xclang38)
WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
if test "x${WARN}" = "xfull" ; then
WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long -g -Wno-vla-extension -Wno-variadic-macros"
WARN_CFLAGS="${WARN_CFLAGS} -D__STRICT_ANSI__"
# WARN_CFLAGS="${WARN_CFLAGS} -fsanitize=address"
fi
;;
*)
echo
echo "*******************************************************"
echo "unsupported compiler ($CCNAM). Please file a bug."
echo "*******************************************************"
echo
WARN_CFLAGS="${WARN_CFLAGS}"
esac
fi
DEFAULT_CFLAGS="${DEFAULT_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
TESTS_CFLAGS="${TESTS_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
AC_SUBST([DEFAULT_CFLAGS])
AC_SUBST([DEBUG_CFLAGS])
AC_SUBST([TESTS_CFLAGS])
AC_HEADER_STDC
AC_PROG_LIBTOOL
# newer libtool...
LT_PREREQ([2.4.2])
LT_INIT
echo "-----------------------------------------------"
echo " START GIVARO CONFIG "
echo "-----------------------------------------------"
# Checks which SIMD optimization flags to use and set SIMD_CFLAGS accordingly
INSTR_SET
AC_SUBST(SIMD_FLAGS)
# Veltkamp Split in modular-extended.inl requires to use the SSE floating point multiplier and not the fp87
# This is by default on x86_64 but not on i386.
arch=`echo $target | cut -d"-" -f1`
AS_IF([ test \( "x$arch" = "xi386" -o "x$arch" = "xi686" \) -a "x$HAVE_SSE" = "xyes" ],
[
AS_ECHO("Compiling for an $arch architecture: appending -mfpmath=sse flags")
REQUIRED_FLAGS="${REQUIRED_FLAGS} -mfpmath=sse"
])
echo "-----------------------------------------------"
dnl With GCC's default ABI version, a __m128 or __m256 are the same types and therefore we cannot
dnl have overloads for both types without linking error.
AS_IF([test "x$CCNAM" = "xgcc48"],[REQUIRED_FLAGS="${REQUIRED_FLAGS} -fabi-version=6"],[])
AC_SUBST(REQUIRED_FLAGS)
# Machine characteristics
AC_CHECK_SIZEOF(char, 8)
AC_CHECK_SIZEOF(short, 16)
AC_CHECK_SIZEOF(int, 32)
AC_CHECK_SIZEOF(long, 32)
AC_CHECK_SIZEOF(long long, 64)
AC_CHECK_SIZEOF(__int64_t, 64)
AC_LANG([C++])
AC_CHECK_TYPE([__int128_t], [AC_TRY_COMPILE([#include <type_traits>], [std::make_unsigned<__int128_t>::type y;],[AC_DEFINE(HAVE_INT128, 1, [Define that compiler allows int128_t types])])])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([float.h limits.h stddef.h stdlib.h string.h sys/time.h stdint.h pthread.h])
# check endianness of the architecture
AC_C_BIGENDIAN(
[AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define that architecture uses big endian storage])],
[AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define that architecture uses little endian storage])],
[])
AC_MSG_NOTICE([Creating symbolic link for compilation])
for link in \
src/kernel/system/givaro \
src/kernel/bstruct/givaro \
src/kernel/integer/givaro \
src/kernel/memory/givaro \
src/kernel/rational/givaro \
src/kernel/recint/recint \
src/kernel/field/givaro \
src/kernel/ring/givaro \
src/kernel/gmp++/gmp++ \
src/library/matrix/givaro \
src/library/poly1/givaro \
src/library/tools/givaro \
src/library/vector/givaro \
; do
dir="$(dirname "$link")"
AS_MKDIR_P([$dir])
AS_IF([ test ! -L "$link" ],
[ln -s "../../../$srcdir/$dir" "$link"])
done
AC_DEFINE_UNQUOTED(INT8, $GIVARO_INT8, Canonical 8-bit data type)
AC_DEFINE_UNQUOTED(INT16, $GIVARO_INT16, Canonical 16-bit data type)
AC_DEFINE_UNQUOTED(INT32, $GIVARO_INT32, Canonical 32-bit data type)
AC_DEFINE_UNQUOTED(INT64, $GIVARO_INT64, Canonical 64-bit data type)
echo "-----------------------------------------------"
# Feature checks
echo "-----------------------------------------------"
GIV_CHECK_GMP(40000)
REQUIRED_FLAGS="${REQUIRED_FLAGS} ${GMP_CFLAGS}"
GIV_DOC
CXXFLAGS=${BACKUP_CXXFLAGS}
CXXFLAGS="${CXXFLAGS} ${REQUIRED_FLAGS}"
CXXFLAGS="${CXXFLAGS} ${SIMD_CFLAGS}"
LIBS="${GMP_LIBS}"
echo "CXXFLAGS=${CXXFLAGS}"
AC_SUBST(CXXFLAGS)
echo "-----------------------------------------------"
echo " END GIVARO CONFIG "
echo "-----------------------------------------------"
AC_CONFIG_FILES([
Makefile
givaro-makefile
src/Makefile
src/kernel/Makefile
src/kernel/system/Makefile
src/kernel/memory/Makefile
src/kernel/gmp++/Makefile
src/kernel/integer/Makefile
src/kernel/bstruct/Makefile
src/kernel/rational/Makefile
src/kernel/recint/Makefile
src/kernel/field/Makefile
src/kernel/ring/Makefile
src/library/Makefile
src/library/vector/Makefile
src/library/tools/Makefile
src/library/poly1/Makefile
src/library/matrix/Makefile
macros/Makefile
macros/CodeChunk/Makefile
benchmarks/Makefile
examples/Makefile
examples/FiniteField/Makefile
examples/Integer/Makefile
examples/Rational/Makefile
examples/RecInt/Makefile
examples/Polynomial/Makefile
tests/Makefile
docs/Makefile
givaro.pc
])
AC_CONFIG_FILES([givaro-config],[chmod +x givaro-config])
AC_OUTPUT
echo "-----------------------------------------------"