-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.ac
243 lines (214 loc) · 6.69 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
# The version is the concatenation of 'v' and the year, month, date: vyyyymmdd
# To access this as a string or integer triple, see libsrc/eclib/version.h
AC_INIT([eclib], [20241112], [[email protected]])
AM_INIT_AUTOMAKE([-Wall])
AC_MSG_NOTICE([Configuring eclib...])
AC_CONFIG_SRCDIR([libsrc])
#AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_PROG_AR
# Initialise libtools:
LT_INIT
# The version of the libtool library is of the form current:revision:age
#
# See
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
#
# When doing a release, they should be updated like this (in sequence):
#
# 1. If any code has changed, whether or not interfaces have changed:
# increment revision. (c,r,a) -> (c,r+1,a)
#
# 2. If interfaces were added, removed or changed: now increment
# current and set revision to zero. (c,r,a) -> (c,r+1,a) -> (c+1,0,a)
#
# 3. If interfaces were added: now increment age:
# (c,r,a) -> (c,r+1,a) -> (c+1,0,a) -> (c+1,0,a+1)
# or if interfaces were removed or changed (breaking backward compatibility):
# now set age to zero. (c,r,a) -> (c,r+1,a) -> (c+1,0,a) -> (c+1,0,0)
#
# NB The suffix of the library name (libec.so here) is (c-a).a.r
LT_CURRENT=14
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# Checks for programs:
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
LT_INIT
# Checks for system features and libraries, via macros defined in m4/ directory
AX_CXX_COMPILE_STDCXX([14],,mandatory)
# NB At present if configure finds boost on your system then it WILL
# define ECLIB_MULTITHREAD which you may not want, if you have not put
# --with-boost on the configure line. This should be fixed. Until
# then, if your system has boost but you do not want to use
# multithreading, manually edit out the lines in configure which
# define ECLIB_MULTITHREAD=1.
#
# Boost 1.35.0+ required for Asio (1.25.0 for Thread)
AX_BOOST_BASE([1.35.0], [
AX_BOOST_SYSTEM
AX_BOOST_ASIO
AX_BOOST_THREAD
])
if [test "$ax_cv_boost_system" = "yes"] &&
[test "$ax_cv_boost_asio" = "yes"] &&
[test "$ax_cv_boost_thread" = "yes"]; then
AC_DEFINE([ECLIB_MULTITHREAD],[1],[Define if multithreading available and requested])
fi
AX_PTHREAD
# Check for libraries
# The following AC_ARG_WITH section were written by Volker Braun
dnl Find PARI
AC_ARG_WITH(pari,
[AS_HELP_STRING([--with-pari=<path>],
[prefix of PARI installation. e.g. /usr/local or /usr])],
[],
[AC_CHECK_LIB([pari], [pari_kernel_init],[ ],
AC_MSG_ERROR([Pari library not found.
Maybe you want to call configure with the --with-pari=<path> option?
This tells configure where to find the PARI library and headers.
e.g. --with-pari=/usr/local or --with-pari=/usr]),[ ])]
)
case "$with_pari" in
""|yes)
PARI_LDFLAGS=""
PARI_CFLAGS=""
GP="gp"
;;
no)
AC_MSG_ERROR([Compiling without libpari impossible (but --without-pari given)])
;;
*)
PARI_LDFLAGS="-L${with_pari}/lib"
PARI_CFLAGS="-I${with_pari}/include"
GP="${with_pari}/bin/gp"
;;
esac
PARI_LIBS="-lpari"
AC_SUBST(PARI_LIBS)
AC_SUBST(PARI_CFLAGS)
AC_SUBST(PARI_LDFLAGS)
AC_SUBST(GP)
dnl Find the NTL Library
AC_ARG_WITH(ntl,
[AS_HELP_STRING([--with-ntl=<path>],
[prefix of NTL installation. e.g. /usr/local or /usr])],
[],
[]
)
case "$with_ntl" in
""|yes)
NTL_LDFLAGS=""
NTL_CFLAGS=""
;;
no)
AC_MSG_ERROR([Compiling without libntl impossible (but --without-ntl given)])
;;
*)
NTL_LDFLAGS="-L${with_ntl}/lib"
NTL_CFLAGS="-I${with_ntl}/include"
;;
esac
AC_LANG_PUSH(C++)
CPPFLAGS_save="$CPPFLAGS"
LDFLAGS_save="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $NTL_CFLAGS"
LDFLAGS="$LDFLAGS $NTL_LDFLAGS"
dnl We first check for NTL/ZZ.h with a plain c++ compiler.
dnl if it fails we unset the cache, check if we have a c++11
dnl capable compiler and try again with c++11 enabled, in case
dnl NTL has been compiled with c++11 threads
AC_CHECK_HEADER(NTL/ZZ.h, [],
[AC_MSG_ERROR([Could not find NTL, you might want to use --with-ntl=<path> to point to its location])]
)
LDFLAGS="$LDFLAGS_save"
CPPFLAGS="$CPPFLAGS_save"
AC_LANG_POP(C++)
NTL_LIBS="-lntl"
AC_SUBST(NTL_LIBS)
AC_SUBST(NTL_CFLAGS)
AC_SUBST(NTL_LDFLAGS)
dnl Find the FLINT Library and determine if it has the nmod_mat module
dnl (in FLINT from version 2.3)
dnl
dnl First set defaults for when no suitable FLINT is found
dnl
AC_ARG_WITH(flint,
[AS_HELP_STRING([--with-flint=<path>],[prefix of FLINT installation.])],
[
if test "$withval" = "no"; then
want_flint=no
elif test "$withval" = "yes" -o "$withval" = ""; then
want_flint=yes
AC_CHECK_LIB([flint], [fmpz_init, nmod_mat_rref],
[FLINT_CFLAGS="-DFLINT=1";
FLINT_LIBS="-lflint";
AC_MSG_NOTICE([Building with FLINT support from system install])],
[AC_MSG_NOTICE([No suitable FLINT Library (version >=2.3) found])],
[])
else
want_flint=yes
FLINT_CFLAGS="-DFLINT=1 -I$withval/include"
FLINT_LDFLAGS="-L$withval/lib";
FLINT_LIBS="-lflint"
fi
],
[want_flint=no]
)
if test "x$want_flint" = "xno"; then
FLINT_CFLAGS="-DFLINT=0"
FLINT_LDFLAGS=""
FLINT_LIBS=""
fi
AC_SUBST(FLINT_LIBS)
AC_SUBST(FLINT_CFLAGS)
AC_SUBST(FLINT_LDFLAGS)
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT64_T
AC_C_RESTRICT
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([floor memmove memset pow sqrt strchr])
# use --disable-allprogs to prevent building any executable programs except mwrank
AC_ARG_ENABLE([allprogs],
AS_HELP_STRING([--disable-allprogs],
[only build the library and mwrank, otherwise build all programs and tests]),
[case "${enableval}" in
yes) allprogs=true ;;
no) allprogs=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-allprogs]) ;;
esac],[allprogs=true])
AM_CONDITIONAL([ALLPROGS], [test x$allprogs = xtrue])
# use --disable-mpfp to use standard C doubles only, not NTL RR
AC_ARG_ENABLE([mpfp],
AS_HELP_STRING([--enable-mpfp],
[use NTL RR for floating point instead of standard C doubles]),
[case "${enableval}" in
yes) mpfp=true ;;
no) mpfp=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mpfp]) ;;
esac],[mpfp=true])
AM_CONDITIONAL([NO_MPFP], [test x$mpfp = xfalse])
AC_CONFIG_FILES([
libsrc/Makefile
tests/Makefile
progs/Makefile
doc/Makefile
man/Makefile
Makefile
eclib.pc
])
AC_OUTPUT