-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.ac.in
538 lines (478 loc) · 17.5 KB
/
configure.ac.in
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
dnl This file was part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl modified by Walter Tasin (tasin@kdevelop.org)
dnl for c++ console applications
dnl modified by Paul Leopardi (paul.leopardi@anu.edu.au)
dnl for GluCat
dnl includes code from admin/acinclude.m4 also
dnl modified by Paul Leopardi (paul.leopardi@anu.edu.au)
dnl for GluCat
dnl incorporated code from KDE version of acinclude.m4
dnl modified by Paul Leopardi (paul.leopardi@anu.edu.au)
dnl for GluCat
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT([glucat],[0.12.1])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/m4_ax_cxx_compile_stdcxx.m4])
m4_include([m4/m4_ax_blas.m4])
m4_include([m4/m4_ax_lapack.m4])
m4_include([m4/acinclude.m4])
AC_CONFIG_SRCDIR([aclocal.m4]) dnl a source file from your sub dir
AC_DEFUN([GLUCAT_TOUPPER],[$(echo $1 | tr ["[a-z]" "[A-Z]"])])
dnl checks specific to GluCat
glucat_deprecated_warning="is deprecated and will be removed in future releases. See INSTALL for details."
AC_DEFUN([GLUCAT_MSG_WARN_DEPRECATED],
[
AC_MSG_WARN([The option $1 $glucat_deprecated_warning])
])
AC_DEFUN([GLUCAT_MSG_WARN_DEPRECATED_VAL],
[
AC_MSG_WARN([The option $1=$2 $glucat_deprecated_warning])
])
AC_DEFUN([GLUCAT_CHECK_COMPILERS],
[
dnl As a side effect of testing introduced by autoconf, CXXFLAGS has been changed. Restore it.
CXXFLAGS="$saved_CXXFLAGS"
dnl Use all_libraries as a local variable to track which libraries to add.
all_libraries=""
dnl process the command line arguments
AC_ARG_ENABLE([debug], [[ --enable-debug[=ARG] enable debug symbols (yes|no|full) [default=no]]],
[
case "$enableval" in
yes)
glucat_use_debug_code="yes"
glucat_use_ndebug_define="yes"
;;
full)
glucat_use_debug_code="full"
glucat_use_ndebug_define="no"
;;
no)
glucat_use_debug_code="no"
glucat_use_ndebug_define="yes"
;;
*)
glucat_use_debug_code="yes"
glucat_use_ndebug_define="yes"
;;
esac
],
[glucat_use_debug_code="no"
glucat_use_ndebug_define="yes"
])
dnl Just for configure --help
AC_ARG_ENABLE([dummyoption],[[ --disable-debug disable debug output and debug symbols [default=yes]]],[],[])
AC_ARG_ENABLE([strict], [[ --enable-strict compile with strict compiler options (may not work!)]],
[
if [[[ "$enableval" == "no" ]]]; then
glucat_use_strict_options="no"
else
glucat_use_strict_options="yes"
fi
],[glucat_use_strict_options="no"])
AC_ARG_ENABLE([warnings], [[ --disable-warnings disable compilation with -Wall and similiar]],
[
if [[[ "$enableval" == "no" ]]]; then
glucat_use_warnings="no"
else
glucat_use_warnings="yes"
fi
],[glucat_use_warnings="yes"])
dnl enable warnings for debug build
if [[[ "$glucat_use_debug_code" != "no" ]]]; then
glucat_use_warnings="yes"
fi
AC_ARG_ENABLE([profile], [[ --enable-profile create profiling infos [default=no]]],
[glucat_use_profiling="$enableval"],
[glucat_use_profiling="no"])
AC_ARG_ENABLE([pyclical], [[ --enable-pyclical use Cython to build the PyClical Python extension module [default=yes]]],
[glucat_use_pyclical="$enableval"],
[glucat_use_pyclical="yes"])
AC_ARG_WITH([demo-dir],
AS_HELP_STRING([--with-demo-dir=DIR], [define the installation directory for the PyClical demos [default=$DATAROOTDIR/pyclical/demos]]),,
[with_demo_dir="${datarootdir}/pyclical/demos"])
demodir="$with_demo_dir"
AC_SUBST([demodir])
AC_ARG_WITH([qd], [[ --with-qd use dd_real and qd_real [default=no]]],
[glucat_use_qd="$withval"],
[glucat_use_qd="no"])
AC_ARG_WITH([eig], [[ --with-eig[=ARG] library to use for eigenvalues (no|bindings|blaze) [default=no]]],
[
case "$withval" in
no)
glucat_use_eigenvalues="no"
;;
bindings)
glucat_use_eigenvalues="bindings"
;;
blaze)
glucat_use_eigenvalues="blaze"
;;
*)
AC_MSG_ERROR([Unknown option for --with-eig])
;;
esac
],[glucat_use_eigenvalues="no"])
dnl Check for a C++ compiler
AC_LANG([C]++)
dnl Set the language standard
saved_CXX=$CXX
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
basename_cxx=[$(basename $(cut -d' ' -f1 <<<$CXX))]
dnl Check the compiler version
AC_MSG_CHECKING([for $CXX version])
case "$basename_cxx" in
"clang++"*)
CXXVERSION=[$($CXX --version | head -n 1 | sed 's/^.*version //' | cut -d'-' -f1)]
AC_MSG_RESULT([$CXXVERSION])
;;
"g++"*)
CXXVERSION=[$($CXX --version | head -n1 | sed 's/^[^)]*) //' | cut -d' ' -f1)]
AC_MSG_RESULT([$CXXVERSION])
;;
icpc)
CXXVERSION=[$($CXX -dumpversion)]
AC_MSG_RESULT([$CXXVERSION])
;;
icpx)
CXXVERSION=[$($CXX --version | head -n 1 | cut -d'(' -f3 | cut -d')' -f1)]
AC_MSG_RESULT([$CXXVERSION])
;;
*)
CXXVERSION=''
AC_MSG_RESULT([unknown])
;;
esac
AC_SUBST([CXXVERSION])
dnl Handle $glucat_use_debug_code: debug symbols and debug level
GLUCAT_CXX_DEBUG_FLAG=""
case "$glucat_use_debug_code" in
full|yes)
case "$basename_cxx" in
"clang++"*|icpc|icpx)
;;
"g++"*)
GLUCAT_CHECK_COMPILER_FLAG([finline-limit=400],
[CXXFLAGS="-finline-limit=400 $CXXFLAGS"])
;;
*)
;;
esac
case "$glucat_use_debug_code" in
full)
CXXFLAGS="-O0 $CXXFLAGS"
GLUCAT_CXX_DEBUG_FLAG="-g3"
;;
yes)
CXXFLAGS="-O1 $CXXFLAGS"
GLUCAT_CXX_DEBUG_FLAG="-g"
;;
esac
;;
no)
CXXFLAGS="-O3 $CXXFLAGS"
case "$basename_cxx" in
"clang++"*|icpc|icpx)
;;
"g++"*)
GLUCAT_CHECK_COMPILER_FLAG([march=native],
[CXXFLAGS="$CXXFLAGS -march=native"])
GLUCAT_CHECK_COMPILER_FLAG([finline-limit=8000],
[CXXFLAGS="$CXXFLAGS -finline-limit=8000"])
GLUCAT_CHECK_COMPILER_FLAG([-param large-function-insns=8000],
[CXXFLAGS="$CXXFLAGS --param large-function-insns=8000"])
GLUCAT_CHECK_COMPILER_FLAG([-param max-inline-insns-auto=8000],
[CXXFLAGS="$CXXFLAGS --param max-inline-insns-auto=8000"])
GLUCAT_CHECK_COMPILER_FLAG([-param max-inline-insns-single=8000],
[CXXFLAGS="$CXXFLAGS --param max-inline-insns-single=8000"])
GLUCAT_CHECK_COMPILER_FLAG([-param inline-unit-growth=200],
[CXXFLAGS="$CXXFLAGS --param inline-unit-growth=200"])
GLUCAT_CHECK_COMPILER_FLAG([-param large-function-growth=200],
[CXXFLAGS="$CXXFLAGS --param large-function-growth=200"])
GLUCAT_CHECK_COMPILER_FLAG([funroll-loops],
[CXXFLAGS="$CXXFLAGS -funroll-loops"])
GLUCAT_CHECK_COMPILER_FLAG([fvariable-expansion-in-unroller],
[CXXFLAGS="$CXXFLAGS -fvariable-expansion-in-unroller"])
GLUCAT_CHECK_COMPILER_FLAG([flto=auto],
[CXXFLAGS="$CXXFLAGS -flto=auto"])
GLUCAT_CHECK_COMPILER_FLAG([fuse-linker-plugin],
[CXXFLAGS="$CXXFLAGS -fuse-linker-plugin"])
GLUCAT_CXX_DEBUG_FLAG="-g"
;;
*)
;;
esac
esac
CXXFLAGS="$GLUCAT_CXX_DEBUG_FLAG $CXXFLAGS"
dnl Handle $glucat_use_ndebug_define: NDEBUG definition used by uBLAS
if [[[ "$glucat_use_ndebug_define" == "yes" ]]]; then
CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi
if [[[ "$glucat_use_profiling" == "yes" ]]]; then
GLUCAT_CHECK_COMPILER_FLAG([pg],
[CXXFLAGS="$CXXFLAGS -pg"])
fi
dnl Handle $glucat_use_pyclical: build the PyClical Python extension module
glucat_extra_cxxflags_pyclical=""
glucat_use_cython="no"
if [[[ "$glucat_use_pyclical" != "no" ]]]; then
AM_PATH_PYTHON([3])
AC_MSG_CHECKING([for Cython version])
cythonversion=[$($PYTHON -c $'try:\n import Cython\n print(Cython.__version__)\nexcept:\n pass')]
if [[[ "$cythonversion" == "" ]]]; then
AC_MSG_RESULT([not found])
else
AC_MSG_RESULT([$cythonversion])
glucat_use_cython="yes"
fi
case "$basename_cxx" in
"clang++"*)
;;
"g++"*)
GLUCAT_CHECK_COMPILER_FLAG([fno-strict-aliasing],
[glucat_extra_cxxflags_pyclical="$glucat_extra_cxxflags_pyclical -fno-strict-aliasing"])
GLUCAT_CHECK_COMPILER_FLAG([Wno-unused],
[glucat_extra_cxxflags_pyclical="$glucat_extra_cxxflags_pyclical -Wno-unused"])
;;
icpc|icpx)
case "$basename_cxx" in
icpc)
GLUCAT_CHECK_COMPILER_FLAG([diag-disable=1292],
[glucat_extra_cxxflags_pyclical="$glucat_extra_cxxflags_pyclical -diag-disable=1292"])
;;
icpx)
GLUCAT_CHECK_COMPILER_FLAG([Wno-deprecated],
[glucat_extra_cxxflags_pyclical="$glucat_extra_cxxflags_pyclical -Wno-deprecated"])
;;
esac
GLUCAT_CHECK_LIB([imf],[cos],
[],
[glucat_use_pyclical="no"])
;;
*)
;;
esac
if [[[ "$glucat_use_cython" == "no" ]]]; then
AC_MSG_WARN([Cannot build using Cython.])
AC_CHECK_FILE([pyclical/PyClical_nocython.cpp],
[],
[glucat_use_pyclical="no"])
fi
if [[[ "$glucat_use_pyclical" == "no" ]]]; then
AC_MSG_WARN([Cannot build PyClical.])
fi
fi
if [[[ "$glucat_use_pyclical" == "no" ]]]; then
DO_NOT_COMPILE="$DO_NOT_COMPILE pyclical"
fi
AC_SUBST([glucat_extra_cxxflags_pyclical])
dnl Handle $glucat_use_qd: use dd_real and qd_real
if [[[ "$glucat_use_qd" != "no" ]]]; then
glucat_have_qd="yes"
glucat_add_libs=""
GLUCAT_CHECK_LIB([qd],[main],
[glucat_add_libs="-lqd $glucat_add_libs"],
[glucat_have_qd="no"])
if [[[ "$glucat_have_qd" != "no" ]]]; then
GLUCAT_CHECK_HEADERS([qd/qd_real.h],
[
CXXFLAGS="$CXXFLAGS -D_GLUCAT_USE_QD";
all_libraries="$all_libraries $glucat_add_libs"
],[glucat_have_qd="no"],[])
fi
if [[[ "$glucat_have_qd" == "no" ]]]; then
AC_MSG_WARN([Cannot build using QD.])
fi
fi
dnl Handle $glucat_use_eigenvalues: library to use for eigenvalues
case "$glucat_use_eigenvalues" in
bindings|blaze)
glucat_have_lapack="yes"
glucat_add_libs=""
case "$basename_cxx" in
"g++"*)
ac_cv_fc_compiler_gnu="yes"
;;
*)
;;
esac
AX_BLAS(
[glucat_add_libs="$BLAS_LIBS $glucat_add_libs"],
[glucat_have_lapack="no"])
AX_LAPACK(
[glucat_add_libs="$LAPACK_LIBS $glucat_add_libs"],
[glucat_have_lapack="no"])
if [[[ "$glucat_have_lapack" == "no" ]]]; then
AC_MSG_WARN([Cannot build using LAPACK.])
fi
;;
*)
;;
esac
case "$glucat_use_eigenvalues" in
bindings)
GLUCAT_MSG_WARN_DEPRECATED_VAL([--with-eig], [bindings])
if [[[ "$glucat_have_lapack" != "no" ]]]; then
glucat_have_bindings="yes"
GLUCAT_CHECK_HEADERS([boost/numeric/bindings/lapack/driver/gees.hpp],
[
CXXFLAGS="$CXXFLAGS -D_GLUCAT_USE_EIGENVALUES -D_GLUCAT_USE_BINDINGS"
all_libraries="$all_libraries $glucat_add_libs"
],
[glucat_have_bindings="no"],[])
fi
if [[[ "$glucat_have_bindings" == "no" ]]]; then
AC_MSG_WARN([Cannot build using Boost bindings.])
fi
;;
blaze)
if [[[ "$glucat_have_lapack" != "no" ]]]; then
glucat_have_blaze="yes"
CXX=$saved_CXX
AX_CXX_COMPILE_STDCXX(14, noext, mandatory)
GLUCAT_CHECK_HEADERS([blaze/Math.h],
[
CXXFLAGS="$CXXFLAGS -D_GLUCAT_USE_EIGENVALUES -D_GLUCAT_USE_BLAZE"
all_libraries="$all_libraries $glucat_add_libs"
],
[glucat_have_blaze="no"],[])
fi
if [[[ "$glucat_have_blaze" == "no" ]]]; then
AC_MSG_WARN([Cannot build using Blaze library.])
CXX=$saved_CXX
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
fi
;;
*)
;;
esac
dnl Handle $glucat_use_warnings: enable compilation with -Wall and similiar
if [[[ "$glucat_use_warnings" == "yes" ]]]; then
CXXFLAGS="-Wall $CXXFLAGS"
case "$basename_cxx" in
"clang++"*|"g++"*|icpx)
GLUCAT_CHECK_COMPILER_FLAG([Wno-unused-local-typedefs],
[CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"])
GLUCAT_CHECK_COMPILER_FLAG([Wno-deprecated-register],
[CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"])
;;
*)
;;
esac
fi
dnl Handle $glucat_use_strict_options: compile with strict compiler options
if [[[ "$glucat_use_strict_options" == "yes" ]]]; then
GLUCAT_CHECK_COMPILER_FLAG([pedantic],
[CXXFLAGS="$CXXFLAGS -pedantic"])
GLUCAT_CHECK_COMPILER_FLAG([Wextra],
[CXXFLAGS="$CXXFLAGS -Wextra"])
GLUCAT_CHECK_COMPILER_FLAG([Wno-unused-parameter],
[CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"])
fi
dnl Cater to compiler quirks
case "$basename_cxx" in
"clang++"*)
;;
"g++"*)
GLUCAT_CHECK_COMPILER_FLAG([fno-check-new],
[CXXFLAGS="$CXXFLAGS -fno-check-new"])
dnl For compatibility with Cygwin gcc
GLUCAT_CHECK_HEADERS([bits/wordsize.h],[CXXFLAGS="$CXXFLAGS -DHAVE_BITS_WORDSIZE_H"],[],[])
if [[[ "$CXXVERSION" > "4.8" && "$CXXVERSION" < "5" ]]]; then
CXXFLAGS="$CXXFLAGS -D_GLUCAT_GCC_IGNORE_UNUSED_LOCAL_TYPEDEFS"
fi
;;
icpc|icpx)
GLUCAT_CHECK_LIB([imf],[cos],
[all_libraries="$all_libraries -limf"],
[],
[glucat_have_gsl="no"])
GLUCAT_CHECK_COMPILER_FLAG([fp-model source],
[CXXFLAGS="-fp-model source $CXXFLAGS"])
GLUCAT_CHECK_COMPILER_FLAG([fp-model precise],
[CXXFLAGS="-fp-model precise $CXXFLAGS"])
GLUCAT_CHECK_COMPILER_FLAG([xHost],
[CXXFLAGS="$CXXFLAGS -xHost"])
CXXFLAGS="$CXXFLAGS -DBOOST_UBLAS_USE_LONG_DOUBLE"
;;
*)
;;
esac
dnl To work around backwards incompatibility of boost::serialization changes
GLUCAT_CHECK_HEADERS([boost/serialization/array_wrapper.hpp],
[CXXFLAGS="$CXXFLAGS -D_GLUCAT_HAVE_BOOST_SERIALIZATION_ARRAY_WRAPPER_H"],[],[])
GLUCAT_CHECK_COMPILER_FLAG([fexceptions],
[USE_EXCEPTIONS="-fexceptions"],
[USE_EXCEPTIONS=""])
AC_SUBST([USE_EXCEPTIONS])
GLUCAT_CHECK_COMPILER_FLAG([Woverloaded-virtual],
[WOVERLOADED_VIRTUAL="-Woverloaded-virtual"],
[WOVERLOADED_VIRTUAL=""])
AC_SUBST([WOVERLOADED_VIRTUAL])
AC_PROG_CXXCPP
ifdef([AM_DEPENDENCIES],AC_REQUIRE([GLUCAT_ADD_DEPENDENCIES]),[])
dnl Use LIBS as a result variable to determine which libraries to add.
LIBS="$all_libraries"
])
AC_DEFUN([GLUCAT_ADD_DEPENDENCIES],
[
[A]M_DEPENDENCIES([CXX])
])
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR([admin])
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_TARGET
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE([gnu tar-pax])
dnl almost the same as GLUCAT_SET_PREFIX but the path is /usr/local
dnl
unset CDPATH
dnl make /usr/local the default for the installation
AC_PREFIX_DEFAULT([/usr/local])
if [[[ "x$prefix" == "xNONE" ]]]; then
prefix="$ac_default_prefix"
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
dnl without this order in this file, automake will be confused!
dnl
AC_CONFIG_HEADERS([config.h])
AX_PREFIX_CONFIG_H([glucat/glucat_config.h])
GLUCAT_CHECK_EXTRA_LIBS
all_includes="-I. -I.. $all_includes $USER_INCLUDES"
dnl checks for programs.
dnl first check for C++ compilers
saved_CXXFLAGS="$CXXFLAGS"
GLUCAT_CHECK_COMPILERS
CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS"
# From http://chris-miceli.blogspot.com.au/2011/01/integrating-doxygen-with-autotools.html
AC_CHECK_PROGS([DOXYGEN],[doxygen])
if [[[ -z "$DOXYGEN" ]]]; then
AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
fi
AC_SUBST([doxydir],[$(pwd)])
AM_CONDITIONAL([HAVE_DOXYGEN],[test -n "$DOXYGEN"])
AM_COND_IF([HAVE_DOXYGEN],[AC_CONFIG_FILES([Doxyfile])])
AC_SUBST([all_includes])
AC_SUBST([LIBS])
AC_SUBST([AUTODIRS])
AM_CONDITIONAL([make_pyclical],[test "$glucat_use_pyclical" == "yes"])
AM_CONDITIONAL([use_cython],[test "$glucat_use_cython" == "yes"])