Repository navigation
Expand file tree
/
Copy pathconfigure.ac
More file actions
752 lines (659 loc) · 32.2 KB
/
Copy pathconfigure.ac
File metadata and controls
752 lines (659 loc) · 32.2 KB
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
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
# Copyright (c) 2002, 2019 Jens Keiner, Stefan Kunis, Daniel Potts
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
################################################################################
# Process this file with autoconf to produce a configure script.
################################################################################
m4_define([nfft_version_major], [3])
m4_define([nfft_version_minor], [6])
m4_define([nfft_version_patch], [0])
m4_define([nfft_version_type], [])
m4_append([NFFT_VERSION], m4_expand([nfft_version_major.nfft_version_minor.nfft_version_patch]))
m4_append([NFFT_VERSION], m4_expand([nfft_version_type]))
# Version number of the NFFT source package.
AC_INIT([NFFT],[NFFT_VERSION],[mail@nfft.org])
AC_CONFIG_SRCDIR([include/nfft3.h])
# Version number for libtool shared libraries. Libtool wants a string
# of the form CURRENT:REVISION:AGE.
# NFFT 3.6.0 is 4:4:0 (implementation changes only, no API changes)
# NFFT 3.5.3 was 4:3:0 (added nfft_set_num_threads)
# NFFT 3.5.2 was 4:2:0
# NFFT 3.5.2 was 4:1:0
SHARED_VERSION_INFO="4:4:0"
# Copyright notice.
AC_COPYRIGHT([2003, 2025, Jens Keiner, Stefan Kunis, Daniel Potts])
AC_DEFINE_UNQUOTED([NFFT_VERSION_MAJOR], [nfft_version_major], [Major version number.])
AC_DEFINE_UNQUOTED([NFFT_VERSION_MINOR], [nfft_version_minor], [Minor version number.])
AC_DEFINE_UNQUOTED([NFFT_VERSION_PATCH], [nfft_version_patch], [Patch version number.])
AC_DEFINE_UNQUOTED([NFFT_VERSION_TYPE], [nfft_version_type], [Release type.])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE(1.10)
AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
AC_SUBST(SHARED_VERSION_INFO)
AC_CANONICAL_HOST
# TODO: This part has a smell. abs_srcdir is substituted in generated files.
# It should not be necessary to define ABS_SRCDIR as well.
# substitute abs_srcdir in generated Makefiles.
AC_SUBST([abs_srcdir])
if test "x${host_os}" = "xmingw32" -o "x${host_os}" = "xmingw64"; then
ABS_SRCDIR=`cd "$srcdir" && pwd -W`
else
ABS_SRCDIR=`cd "$srcdir" && pwd`
fi
AC_DEFINE_UNQUOTED([ABS_SRCDIR], ["$ABS_SRCDIR"], [Absolute path to source directory.])
AC_SUBST([ABS_SRCDIR])
# TODO: These are pre-set precious output variables. It should not be necessary to explicitly SUBST them.
# see https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Setting-Output-Variables.html#Setting-Output-Variables
AC_SUBST([abs_top_srcdir])
AC_SUBST([top_builddir])
AC_SUBST([abs_top_builddir])
# Set programming language.
AC_LANG(C)
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AX_COMPILER_VENDOR
AC_C_CONST
AC_C_RESTRICT
AC_C_INLINE
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
LT_PREREQ([2.4.2])
LT_INIT([win32-dll])
AC_SUBST([LIBTOOL_DEPS])
# doxygen ${PACKAGE_STRING}
DX_DOT_FEATURE(ON)
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN([NFFT], [doxygen/doxygen.Doxyfile], [doc])
################################################################################
# options for customizing the build process
################################################################################
# Precision.
AC_ARG_ENABLE(single, [AS_HELP_STRING([--enable-single],[compile NFFT in single precision])], ok=$enableval, ok=no)
AC_ARG_ENABLE(float, [AS_HELP_STRING([--enable-float],[synonym for --enable-single])], ok=$enableval)
if test "$ok" = "yes"; then
AC_DEFINE(NFFT_SINGLE,1,[Define to compile in single precision.])
PRECISION=s
else
PRECISION=d
fi
AC_ARG_ENABLE(long-double, [AS_HELP_STRING([--enable-long-double],[compile NFFT in long-double precision])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
if test "$PRECISION" = "s"; then
AC_MSG_ERROR([--enable-single/--enable-long-double conflict])
fi
AC_DEFINE(NFFT_LDOUBLE,1,[Define to compile in long-double precision.])
PRECISION=l
fi
AC_SUBST(PRECISION)
# Library suffix.
case "$PRECISION" in
s) PREC_SUFFIX=f;;
d) PREC_SUFFIX=;;
l) PREC_SUFFIX=l;;
esac
AC_SUBST(PREC_SUFFIX)
# TODO: Do we really need these macros? It seems they are used in nfft3mp.h to conditionally define
# an API specific to the used floating-point type. This is unlike nfft3.h and fftw3.h which always
# define the APIs for all floating-point types. Since nfft3mp.h is redistributed, we probably should
# have similar behavior.
case "$PRECISION" in
s) NFFT_PRECISION_MACRO=NFFT_PRECISION_SINGLE;;
d) NFFT_PRECISION_MACRO=NFFT_PRECISION_DOUBLE;;
l) NFFT_PRECISION_MACRO=NFFT_PRECISION_LONG_DOUBLE;;
esac
AC_SUBST(NFFT_PRECISION_MACRO)
# TODO: Eventually, this conditional should be removed in favor of handling similar to FFTW3:
# Build nfft3@@PREC_SUFFIX@.la from nfft.pc. But we need to be careful since nfft3.pc is
# hardcoded in some place son renaming can easily have unintended side effects.
AM_CONDITIONAL(HAVE_NON_DOUBLE_PRECISION, test "x$PRECISION" != "xd" )
# enable or disable parts of NFFT
# whether we need the fpt module
need_fpt="no"
# build all modules by default in maintainer mode or if option is given
AC_ARG_ENABLE(all, [AS_HELP_STRING([--enable-all],[build all modules])],
ok=$enableval, ok=$USE_MAINTAINER_MODE)
nfft_module_default=$ok
# option for example programs
nfft_examples_default="yes"
AC_ARG_ENABLE(examples, [AS_HELP_STRING([--enable-examples],[enable example programs])], enable_examples=$enableval, enable_examples=$nfft_examples_default)
AM_CONDITIONAL(HAVE_EXAMPLES, test "x$enable_examples" = "xyes" )
# option for application programs
nfft_applications_default="yes"
AC_ARG_ENABLE(applications, [AS_HELP_STRING([--enable-applications],[enable application programs])], enable_applications=$enableval, enable_applications=$nfft_applications_default)
AM_CONDITIONAL(HAVE_APPLICATIONS, test "x$enable_applications" = "xyes" )
# default option for julia interface, may be overwritten (enabled by default
# if --enable-all is specified for double precision and enable-shared)
if test "x$PRECISION" = "xd" -a "x$enable_shared" = "xyes"; then
nfft_julia_default=$nfft_module_default
else
nfft_julia_default="no"
fi
AC_ARG_ENABLE(julia, [AS_HELP_STRING([--enable-julia],[enable julia interface])], enable_julia=$enableval, enable_julia=$nfft_julia_default)
AM_CONDITIONAL(HAVE_JULIA, test "x$enable_julia" = "xyes" )
if test "x$enable_julia" = "xyes" -a "x$PRECISION" != "xd"; then
AC_MSG_ERROR([Building the julia interface requires double precision.])
fi
if test "x$enable_julia" = "xyes" -a "x$enable_shared" = "xno"; then
AC_MSG_ERROR([Building the julia interface requires --enable-shared.])
fi
# options for modules
AX_NFFT_MODULE([nfct],[NFCT],[nonequispaced fast cosine transform],["yes"])
AX_NFFT_MODULE([nfst],[NFST],[nonequispaced fast sine transform],["yes"])
AX_NFFT_MODULE([nfsft],[NFSFT],[nonequispaced fast spherical Fourier transform],["no"],
[need_fpt="yes"])
AX_NFFT_MODULE([nfsoft],[NFSOFT],[nonequispaced fast SO(3) Fourier transform],["no"],
[need_fpt="yes"])
AX_NFFT_MODULE([nnfft],[NNFFT],[nonequispaced fast Fourier transform -- ]#
[nonequispaced in both domains],["no"])
AX_NFFT_MODULE([nsfft],[NSFFT],[nonequispaced sparse fast Fourier transform],["no"])
AX_NFFT_MODULE([mri],[MRI],[magnetic resonance imaging],["no"])
AX_NFFT_MODULE([fpt],[FPT],[fast polynomial transform],["no"],[],[],
[test "x$ok" = "xyes" -o "x$need_fpt" = "xyes"])
# multithreaded code
AC_ARG_ENABLE(openmp, [AS_HELP_STRING([--enable-openmp], [enable OpenMP multithreaded code])], enable_threads=$enableval, enable_threads=no)
# debug mode
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [compile with extra runtime checks for debugging])], enable_debug=$enableval,
enable_debug=no)
if test "x$enable_debug" = "xyes"; then
AC_DEFINE(NFFT_DEBUG,1,[Define to enable extra debugging code.])
fi
# Preprocessor flags handed to the example and application programs. They must
# not include config.h, so everything they need arrives as -D.
NFFT_PROGRAM_CPPFLAGS=""
# runtime time measurements
AC_ARG_ENABLE(measure-time, [AS_HELP_STRING([--enable-measure-time],[measure time during execution])], ok=$enableval, ok=no)
if test "x$ok" = "xyes"; then
AC_DEFINE(MEASURE_TIME,1,[Define to enable runtime time measurements.])
NFFT_PROGRAM_CPPFLAGS="$NFFT_PROGRAM_CPPFLAGS -DMEASURE_TIME"
fi
# runtime time measurements for FFTW part
AC_ARG_ENABLE(measure-time-fftw, [AS_HELP_STRING([--enable-measure-time-fftw],[measure time of FFTW transforms during execution])], ok=$enableval, ok=no)
if test "x$ok" = "xyes"; then
AC_DEFINE(MEASURE_TIME_FFTW,1,[Define to enable time measurements for FFTW]
[transforms.])
NFFT_PROGRAM_CPPFLAGS="$NFFT_PROGRAM_CPPFLAGS -DMEASURE_TIME_FFTW"
fi
AC_ARG_ENABLE(mips_zbus_timer, [AS_HELP_STRING([--enable-mips-zbus-timer],[use MIPS ZBus cycle-counter])], have_mips_zbus_timer=$enableval,
have_mips_zbus_timer=no)
if test "$have_mips_zbus_timer" = "yes"; then
AC_DEFINE(HAVE_MIPS_ZBUS_TIMER,1,
[Define to enable use of MIPS ZBus cycle-counter.])
fi
# select window function
AC_ARG_WITH(window, [AS_HELP_STRING([--with-window=ARG],[choose window function
(ARG can be one of: kaiserbessel (default), gaussian, bspline, sinc)])],
window=$withval, window="kaiserbessel")
AC_MSG_CHECKING([window function])
case "$window" in
kaiserbessel)
AC_DEFINE(KAISER_BESSEL,1,[Define to enable Kaiser-Bessel window function.]);;
gaussian)
AC_DEFINE(GAUSSIAN,1,[Define to enable Gaussian window function.]);;
bspline)
AC_DEFINE(B_SPLINE,1,[Define to enable B-spline window function.]);;
sinc)
AC_DEFINE(SINC_POWER,1,[Define to enable sinc power window function.]);;
*)
AC_MSG_ERROR([Unknown window function "$window".]);;
esac
AC_MSG_RESULT([$window])
AC_DEFINE_UNQUOTED(WINDOW_NAME,$window,[The name of the window function.])
AC_ARG_ENABLE(exhaustive-unit-tests, [AS_HELP_STRING([--enable-exhaustive-unit-tests],[enable exhaustive unit tests])], ok=$enableval, ok=no)
matlab_exhaustive_unit_tests_flag=0
if test "$ok" = "yes"; then
AC_DEFINE(NFFT_EXHAUSTIVE_UNIT_TESTS,1,[Define to enable exhaustive unit tests.])
matlab_exhaustive_unit_tests_flag=1
fi
AC_SUBST(matlab_exhaustive_unit_tests_flag)
AC_ARG_ENABLE(benchmarks, [AS_HELP_STRING([--enable-benchmarks],[enable building benchmark programs])], enable_benchmarks=$enableval, enable_benchmarks=no)
AC_ARG_WITH(benchmarks-prefix, [AS_HELP_STRING([--with-benchmarks-prefix=PREFIX],[prefix for benchmark names])], benchmarks_prefix=$withval, benchmarks_prefix="")
AC_DEFINE_UNQUOTED(BENCHMARKS_PREFIX, "${benchmarks_prefix}", [Prefix for benchmark names])
# Flags for benchmarks agnostic to certain parameters. Used only in CI.
AC_ARG_WITH(agnostic-benchmarks, [AS_HELP_STRING([--with-agnostic-benchmarks=FLAGS],[specify which benchmarks should be built based on agnostic parameters. FLAGS should be a comma-separated list of parameter:flag pairs, e.g., window:1,openmp:0,precision:1,os:0,compiler:1])], agnostic_benchmarks=$withval, agnostic_benchmarks="")
# Parse agnostic benchmarks flags.
if test -z "$agnostic_benchmarks"; then
# All on by default.
BENCHMARK_AGNOSTIC_WINDOW=1 BENCHMARK_AGNOSTIC_OPENMP=1 BENCHMARK_AGNOSTIC_PRECISION=1
else
# All off by default, unless specified otherwise.
BENCHMARK_AGNOSTIC_WINDOW=0 BENCHMARK_AGNOSTIC_OPENMP=0 BENCHMARK_AGNOSTIC_PRECISION=0
saved_IFS="$IFS"; IFS=','
for flag in $agnostic_benchmarks; do
case "$flag" in
precision:1) BENCHMARK_AGNOSTIC_PRECISION=1 ;;
precision:0) BENCHMARK_AGNOSTIC_PRECISION=0 ;;
window:1) BENCHMARK_AGNOSTIC_WINDOW=1 ;;
window:0) BENCHMARK_AGNOSTIC_WINDOW=0 ;;
openmp:1) BENCHMARK_AGNOSTIC_OPENMP=1 ;;
openmp:0) BENCHMARK_AGNOSTIC_OPENMP=0 ;;
'') ;;
*) AC_MSG_ERROR([Unknown agnostic benchmark flag "$flag". Valid flags are: precision:0/1, window:0/1, openmp:0/1]) ;;
esac
done
IFS="$saved_IFS"
fi
# Create automake conditionals for agnostic benchmark flags.
AM_CONDITIONAL(BENCHMARK_AGNOSTIC_PRECISION, test "x$BENCHMARK_AGNOSTIC_PRECISION" = "x1")
AM_CONDITIONAL(BENCHMARK_AGNOSTIC_WINDOW, test "x$BENCHMARK_AGNOSTIC_WINDOW" = "x1")
AM_CONDITIONAL(BENCHMARK_AGNOSTIC_OPENMP, test "x$BENCHMARK_AGNOSTIC_OPENMP" = "x1")
################################################################################
# floating-point characteristics
################################################################################
# Determine mantissa width for selected floating-point type.
AC_MSG_CHECKING([Mantissa width of floating-point type])
# Extract MANT_DIG value
AC_COMPUTE_INT([nfft_mant_dig], [MANT_DIG], [
#include <float.h>
#if defined(NFFT_LDOUBLE)
#define MANT_DIG LDBL_MANT_DIG
#elif defined(NFFT_SINGLE)
#define MANT_DIG FLT_MANT_DIG
#else
#define MANT_DIG DBL_MANT_DIG
#endif
], [AC_MSG_ERROR([Cannot determine MANT_DIG])])
AC_MSG_RESULT([$nfft_mant_dig bits])
if test "x$nfft_mant_dig" != "x113" -a "x$nfft_mant_dig" != "x64" -a "x$nfft_mant_dig" != "x53" -a "x$nfft_mant_dig" != "x24"; then
AC_MSG_WARN([Unknown floating-point type with unexpected mantissa width! Assuming IEEE 754 double precision which may lead to incorrect results.])
fi
################################################################################
# program checks
################################################################################
# C preprocessor
AC_PROG_CPP_WERROR
# assembler
AM_PROG_AS
################################################################################
# compiler options
################################################################################
# Prefer -march=native. AX_GCC_ARCHFLAG caches its guess in ax_cv_gcc_archflag,
# so pre-setting that variable makes it skip its own CPUID tables. Those tables
# stop at Broadwell, which leaves every later Intel part on core2 and every AMD
# Zen part on amdfam10, neither of which has AVX2 or FMA. Skipped when the guess
# would be wrong or unwanted: a cross build detects the build machine, and
# --with-gcc-arch and --enable-portable-binary are explicit requests.
if test "x$cross_compiling" != "xyes" \
-a "x$enable_portable_binary" != "xyes" \
-a "x$with_gcc_arch" = "x"; then
AX_CHECK_COMPILE_FLAG([-march=native], [ax_cv_gcc_archflag="-march=native"])
fi
# Try to choose good compiler options.
AX_CC_MAXOPT
# override CFLAGS selection when debugging
if test "x${enable_debug}" = "xyes"; then
CFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-sanitize-recover=all -v"
# if test "x$ax_cv_c_compiler_vendor" = "xapple"; then
# CFLAGS="$CFLAGS $ax_cv_apple_gcc_archflag"
# fi
fi
# add gcc warnings, in debug/maintainer mode only
if test "x${enable_debug}" = "xyes" || test "x$USE_MAINTAINER_MODE" = "xyes";
then
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
CFLAGS="$CFLAGS -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings"
CFLAGS="$CFLAGS -Wstrict-prototypes -Wredundant-decls -Wnested-externs"
CFLAGS="$CFLAGS -Wundef -Wconversion -Wmissing-prototypes "
CFLAGS="$CFLAGS -Wmissing-declarations"
fi
fi
# option to accept C99
CFLAGS="$CFLAGS $ac_cv_prog_cc_c99"
# use MinGW implementation of printf
if test "x${host_os}" = "xmingw32" -o "x${host_os}" = "xmingw64"; then
CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1"
fi
################################################################################
# OpenMP support
################################################################################
# OpenMP compiler support
AX_OPENMP
if test "x$enable_threads" = "xyes" -a "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
AC_MSG_ERROR([You have enabled building NFFT with OpenMP multi-threading support, but your compiler does not seem to support OpenMP.])
fi
OPENMP_LIBS=""
if test "x$enable_threads" = "xyes"; then
NFFT_OPENMP_ATOMIC_FLOAT
if test "x$OPENMP_ATOMIC_FLOAT_LIBS" = "xunknown"; then
AC_MSG_ERROR([OpenMP atomic operations do not work.])
elif test "x$OPENMP_ATOMIC_FLOAT_LIBS" = "x"; then
# No additional flags required.
:
else
# Add additional flags.
OPENMP_LIBS="$OPENMP_ATOMIC_FLOAT_LIBS"
fi
fi
################################################################################
# 3rd party libraries
################################################################################
# Check for fftw3.
NFFT_LIB_FFTW3
if test "x$nfft_fftw3_have_lib" != "xyes"; then
AC_MSG_ERROR([You don't seem to have the FFTW 3 library's developer sources installed.]
[Use your OS' package manager to install the necessary packages. Alternatively, you can ]
[download FFTW 3 from http://www.fftw.org and build it yourself. If you are sure you have]
[FFTW 3 set up correctly, ensure that this configure script can find it, e.g. by setting]
[CPPFLAGS/LDFLAGS environment variables, or by using --with-fftw3, --with-fftw3-includedir]
[and/or --with-fftw3-libdir options; see ./configure --help.])
fi
if test "x$enable_threads" = "xyes"; then
# Check which FFTW3 threading variant is available and provide appropriate warnings.
if test "x$nfft_fftw3_have_lib_omp" = "xyes"; then
# FFTW3 OpenMP variant found - no warning needed (optimal case)
fftw3_LIBS_omp="$nfft_fftw3_LIBS_omp"
AC_DEFINE([HAVE_FFTW_THREADS],[1],[Define to 1 if multi-threaded FFTW can be used.])
NFFT_OPENMP_MATCH_FFTW3
NFFT_PROGRAM_CPPFLAGS="$NFFT_PROGRAM_CPPFLAGS -DHAVE_FFTW_THREADS"
elif test "x$nfft_fftw3_have_lib_threads" = "xyes"; then
# Only generic multi-threaded FFTW3 found - warn about potential inefficiency
AC_MSG_WARN([Only generic multi-threaded FFTW3 library found. This may be less efficient because NFFT will use OpenMP threads while FFTW3 uses its own threading mechanism.])
fftw3_LIBS_omp="$nfft_fftw3_LIBS_threads"
AC_DEFINE([HAVE_FFTW_THREADS],[1],[Define to 1 if multi-threaded FFTW can be used.])
NFFT_PROGRAM_CPPFLAGS="$NFFT_PROGRAM_CPPFLAGS -DHAVE_FFTW_THREADS"
else
# Only single-threaded FFTW3 found - warn that only NFFT code will be multi-threaded
AC_MSG_WARN([Only single-threaded FFTW3 library found. Multi-threading will only be used in NFFT code, not in FFTW3 computations.])
fftw3_LIBS_omp=""
fi
fi
AC_SUBST(fftw3_CPPFLAGS)
AC_SUBST(fftw3_LDFLAGS)
AC_SUBST(fftw3_LIBS)
AC_SUBST(fftw3_LIBS_omp)
AM_CONDITIONAL(ENABLE_OPENMP, test "x$enable_threads" = "xyes" )
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP_LIBS)
# Check for MATLAB.
AX_PROG_MATLAB
if test "x$ax_prog_matlab" = "xyes" -a "x$PRECISION" != "xd" -a "x$PRECISION" != "xs"; then
AC_MSG_ERROR([Building the Matlab interfaces requires double precision.])
fi
if test "x$matlab_threads" = "xyes" -a "x$enable_threads" != "xyes"; then
AC_MSG_ERROR([The NFFT Matlab interface with thread support requires the threaded NFFT to be built. Please re-run configure with --enable-openmp.])
fi
# Add FFTW preprocessor flags.
CPPFLAGS="$CPPFLAGS $nfft_fftw3_CPPFLAGS"
################################################################################
# check if mex.h can be included without undefinition of
################################################################################
ax_prog_matlab_gcc_require_undef_stdc_utf_16=no
if test "x$ax_prog_matlab" = "xyes"; then
AC_MSG_CHECKING([if inclusion of mex.h succeeds])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $matlab_CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "mex.h"]],[[]])],[ax_prog_matlab_check_compile_mex_h=yes], [ax_prog_matlab_check_compile_mex_h=no])
AC_MSG_RESULT([$ax_prog_matlab_check_compile_mex_h])
if test "x$ax_prog_matlab_check_compile_mex_h" = "xno"; then
AC_MSG_CHECKING([if undefining __STDC_UTF_16__ solves this issue])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#undef __STDC_UTF_16__
#include "mex.h"]],[[]])],[ax_prog_matlab_gcc_require_undef_stdc_utf_16=yes], [])
AC_MSG_RESULT([$ax_prog_matlab_gcc_require_undef_stdc_utf_16])
fi
CPPFLAGS="$saved_CPPFLAGS"
fi
if test "x$ax_prog_matlab_gcc_require_undef_stdc_utf_16" = "xyes"; then
AC_DEFINE([HAVE_MATLAB_GCC_REQUIRE_UNDEF_STDC_UTF_16],[1],[Define to 1 if compilation of Matlab interface only succeeds when macro __STDC_UTF_16__ not defined.])
fi
################################################################################
# header files/data types/compiler characteristics
################################################################################
AC_CHECK_HEADERS([math.h stdio.h stdlib.h time.h sys/time.h \
complex.h string.h float.h limits.h stdarg.h stddef.h sys/types.h stdint.h \
inttypes.h stdbool.h malloc.h c_asm.h intrinsics.h mach/mach_time.h])
AC_TYPE_SIZE_T
AC_CHECK_TYPE([long double],
[AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports]
['long double'])],[])
AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t]
[is defined in <sys/time.h>])],,
[
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
])
AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ptrdiff_t)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
# library functions
AC_FUNC_ALLOCA
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
saved_LIBS=$LIBS
AC_CHECK_LIB(m, sin, [])
LIBS=$saved_LIBS
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time])
AC_CHECK_FUNCS([memset posix_memalign memalign])
AC_CHECK_FUNCS([_mm_malloc _mm_free sysctl])
AC_CHECK_FUNCS([abort snprintf sqrt])
AC_CHECK_FUNCS([sleep usleep nanosleep drand48 srand48])
AC_SUBST(NFFT_PROGRAM_CPPFLAGS)
AC_CHECK_DECLS([memalign, posix_memalign])
AC_CHECK_DECLS([sleep],[],[],[#include <unistd.h>])
AC_CHECK_DECLS([nanosleep],[],[],[#include <time.h>])
AC_CHECK_DECLS([drand48],[],[],[#include <stdlib.h>])
AC_CHECK_DECLS([srand48],[],[],[#include <stdlib.h>])
# Cray UNICOS _rtc() (real-time clock) intrinsic
AC_MSG_CHECKING([for _rtc intrinsic])
rtc_ok=yes
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_INTRINSICS_H
#include <intrinsics.h>
#endif]], [[_rtc()]])],[AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])],[rtc_ok=no])
AC_MSG_RESULT($rtc_ok)
AC_MSG_CHECKING([whether a cycle counter is available])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$srcdir/include"
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include "cycle.h"
#ifndef HAVE_TICK_COUNTER
# error No cycle counter
#endif]])],[ok=yes],[ok=no])
AC_MSG_RESULT($ok)
TICKS_PER_SECOND=1
if test $ok = no; then
echo "***************************************************************"
echo "WARNING: No cycle counter found. Time measurements in NFFT will"
echo " show incorrect results. "
echo "***************************************************************"
else
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "cycle.h"
#include <stdio.h>
#if defined(HAVE_NANOSLEEP)
#include <stdlib.h>
static struct timespec ts = {1,0};
#define SLEEP nanosleep(&ts, 0)
#elif defined(HAVE_SLEEP)
#include <unistd.h>
#define SLEEP sleep(1)
#elif defined(HAVE_USLEEP)
#include <unistd.h>
#define SLEEP usleep(1000)
#else
#error wtf!
#endif
int main(){
ticks t0 = getticks();
SLEEP;{
double tps = elapsed(getticks(),t0)/1.0;
FILE *f = fopen("ticks.tmp","w");
fprintf(f,"%.1f\n",tps);
fclose(f);}
return 0;}]])],[read TICKS_PER_SECOND < ticks.tmp],[],[TICKS_PER_SECOND=1])
rm -f ticks.tmp
if test "$TICKS_PER_SECOND" = "1"; then
echo "***************************************************************"
echo "WARNING: Number of ticks per second could not be determined. "
echo " Time measurements in NFFT will be in arbitrary units "
echo " instead of seconds. "
echo "***************************************************************"
fi
fi
CPPFLAGS=$save_CPPFLAGS
AC_SUBST(TICKS_PER_SECOND)
if test "$PRECISION" = "l"; then
#AC_CHECK_FUNCS([copysignl nextafterl nanl ceill floorl nearbyintl rintl roundl lrintl lroundl llrintl llroundl truncl fmodl remainderl remquol fdiml fmaxl fminl fmal fabsl sqrtl cbrtl hypotl expl exp2l expm1l logl log2l log10l log1pl logbl ilogbl modfl frexpl ldexpl scalbnl scalblnl powl cosl sinl tanl coshl sinhl tanhl acosl asinl atanl atan2l acoshl asinhl atanhl tgammal lgammal j0l j1l jnl jnl y0l y1l ynl erfl erfcl creall cimagl cabsl cargl conjl cprojl csqrtl cexpl clogl cpowl csinl ccosl ctanl casinl cacosl catanl csinhl ccoshl ctanhl casinhl cacoshl catanhl])
AC_CHECK_DECLS([copysignl, nextafterl, nanl, ceill, floorl, nearbyintl, rintl, roundl, lrintl, lroundl, llrintl, llroundl, truncl, fmodl, remainderl, remquol, fdiml, fmaxl, fminl, fmal, fabsl, sqrtl, cbrtl, hypotl, expl, exp2l, expm1l, logl, log2l, log10l, log1pl, logbl, ilogbl, modfl, frexpl, ldexpl, scalbnl, scalblnl, powl, cosl, sinl, tanl, coshl, sinhl, tanhl, acosl, asinl, atanl, atan2l, acoshl, asinhl, atanhl, tgammal, lgammal, j0l, j1l, jnl, y0l, y1l, ynl, erfl, erfcl, creall, cimagl, cabsl, cargl, conjl, cprojl, csqrtl, cexpl, clogl, cpowl, csinl, ccosl, ctanl, casinl, cacosl, catanl, csinhl, ccoshl, ctanhl, casinhl, cacoshl, catanhl],[],[],
[#include <math.h>
#include <complex.h>])
fi
if test "$PRECISION" = "d"; then
#AC_CHECK_FUNCS([copysign nextafter nan ceil floor nearbyint rint round lrint lround llrint llround trunc fmod remainder remquo fdim fmax fmin fma fabs sqrt cbrt hypot exp exp2 expm1 log log2 log10 log1p logb ilogb modf frexp ldexp scalbn scalbln pow cos sin tan cosh sinh tanh acos asin atan atan2 acosh asinh atanh tgamma lgamma j0 j1 jn y0 y1 yn erf erfc creal cimag cabs carg conj cproj csqrt cexp clog cpow csin ccos ctan casin cacos catan csinh ccosh ctanh casinh cacosh catanh])
AC_CHECK_DECLS([copysign, nextafter, nan, ceil, floor, nearbyint, rint, round, lrint, lround, llrint, llround, trunc, fmod, remainder, remquo, fdim, fmax, fmin, fma, fabs, sqrt, cbrt, hypot, exp, exp2, expm1, log, log2, log10, log1p, logb, ilogb, modf, frexp, ldexp, scalbn, scalbln, pow, cos, sin, tan, cosh, sinh, tanh, acos, asin, atan, atan2, acosh, asinh, atanh, tgamma, lgamma, j0, j1, jn, y0, y1, yn, erf, erfc, creal, cimag, cabs, carg, conj, cproj, csqrt, cexp, clog, cpow, csin, ccos, ctan, casin, cacos, catan, csinh, ccosh, ctanh, casinh, cacosh, catanh],[],[],
[#include <math.h>
#include <complex.h>])
fi
if test "$PRECISION" = "s"; then
#AC_CHECK_FUNCS([copysignf nextafterf nanf ceilf floorf nearbyintf rintf roundf lrintf lroundf llrintf llroundf truncf fmodf remainderf remquof fdimf fmaxf fminf fmaf fabsf sqrtf cbrtf hypotf expf exp2f expm1f logf log2f log10f log1pf logbf ilogbf modff frexpf ldexpf scalbnf scalblnf powf cosf sinf tanf coshf sinhf tanhf acosf asinf atanf atan2f acoshf asinhf atanhf tgammaf lgammaf j0f j1f jnf y0f y1f ynf erff erfcf crealf cimagf cabsf cargf conjf cprojf csqrtf cexpf clogf cpowf csinf ccosf ctanf casinf cacosf catanf csinhf ccoshf ctanhf casinhf cacoshf catanhf])
AC_CHECK_DECLS([copysignf, nextafterf, nanf, ceilf, floorf, nearbyintf, rintf, roundf, lrintf, lroundf, llrintf, llroundf, truncf, fmodf, remainderf, remquof, fdimf, fmaxf, fminf, fmaf, fabsf, sqrtf, cbrtf, hypotf, expf, exp2f, expm1f, logf, log2f, log10f, log1pf, logbf, ilogbf, modff, frexpf, ldexpf, scalbnf, scalblnf, powf, cosf, sinf, tanf, coshf, sinhf, tanhf, acosf, asinf, atanf, atan2f, acoshf, asinhf, atanhf, tgammaf, lgammaf, j0f, j1f, jnf, y0f, y1f, ynf, erff, erfcf, crealf, cimagf, cabsf, cargf, conjf, cprojf, csqrtf, cexpf, clogf, cpowf, csinf, ccosf, ctanf, casinf, cacosf, catanf, csinhf, ccoshf, ctanhf, casinhf, cacoshf, catanhf],[],[],
[#include <math.h>
#include <complex.h>])
fi
# option for the CUnit test suite (requires CUnit, disabled by default)
AC_ARG_ENABLE(tests, [AS_HELP_STRING([--enable-tests],[enable the CUnit test suite])], enable_tests=$enableval, enable_tests=no)
# CUnit
cunit_have_lib="no"
if test "x$enable_tests" = "xyes"; then
NFFT_LIB_CUNIT
if test "x$cunit_have_lib" != "xyes"; then
AC_MSG_ERROR([You have enabled the test suite (--enable-tests), but the CUnit library was not found.])
fi
fi
AM_CONDITIONAL(HAVE_CUNIT, test "x$enable_tests" = "xyes" -a "x$cunit_have_lib" = "xyes" )
AC_SUBST(cunit_CPPFLAGS)
AC_SUBST(cunit_LDFLAGS)
AC_SUBST(cunit_LIBS)
nfft_cv_benchmarks="no"
nfft_benchmarks_CPPFLAGS=""
nfft_benchmarks_CXXFLAGS=""
nfft_benchmarks_LDFLAGS=""
nfft_benchmarks_LIBS=""
if test "x$enable_benchmarks" = "xyes"; then
NFFT_LIB_CODSPEED
if test "x$nfft_cv_codspeed" = "xno"; then
AC_MSG_ERROR([You have enabled the build of benchmark programs, but the CodSpeed C++ integration library was not found.])
else
nfft_cv_benchmarks="yes"
nfft_benchmarks_CPPFLAGS="$nfft_codspeed_CPPFLAGS"
nfft_benchmarks_CXXFLAGS="$nfft_codspeed_CXXFLAGS"
nfft_benchmarks_LDFLAGS="$nfft_codspeed_LDFLAGS"
nfft_benchmarks_LIBS="$nfft_codspeed_LIBS"
fi
else
nfft_cv_benchmarks="no"
fi
AM_CONDITIONAL(HAVE_BENCHMARKS, test "x$nfft_cv_benchmarks" = "xyes" )
AC_SUBST(nfft_benchmarks_CPPFLAGS)
AC_SUBST(nfft_benchmarks_CXXFLAGS)
AC_SUBST(nfft_benchmarks_LDFLAGS)
AC_SUBST(nfft_benchmarks_LIBS)
# The output files to be generated
AC_CONFIG_FILES(Makefile \
nfft3.pc \
doxygen/doxygen.Doxyfile \
include/Makefile \
include/ticks.h \
kernel/Makefile \
kernel/fpt/Makefile \
kernel/mri/Makefile \
kernel/nfct/Makefile \
kernel/nfft/Makefile \
kernel/nfsft/Makefile \
kernel/nfsoft/Makefile \
kernel/nfst/Makefile \
kernel/nnfft/Makefile \
kernel/nsfft/Makefile \
kernel/solver/Makefile \
kernel/util/Makefile \
tests/Makefile \
tests/data/Makefile \
examples/Makefile \
examples/fpt/Makefile \
examples/mri/Makefile \
examples/nfct/Makefile \
examples/nfft/Makefile \
examples/nfsft/Makefile \
examples/nfsoft/Makefile \
examples/nfst/Makefile \
examples/nnfft/Makefile \
examples/nsfft/Makefile \
examples/solver/Makefile \
applications/Makefile \
applications/fastgauss/Makefile \
applications/fastsum/Makefile \
applications/fastsumS2/Makefile \
applications/quadratureS2/Makefile \
applications/mri/Makefile \
applications/mri/mri2d/Makefile \
applications/mri/mri3d/Makefile \
applications/polarFFT/Makefile \
applications/radon/Makefile \
matlab/Makefile \
matlab/fpt/Makefile \
matlab/nfsft/Makefile \
matlab/nfft/Makefile \
matlab/nfct/Makefile \
matlab/nfst/Makefile \
matlab/nnfft/Makefile \
matlab/fastsum/Makefile \
matlab/infft1d/Makefile \
matlab/nfsft/@f_hat/Makefile \
matlab/nfsoft/Makefile \
matlab/tests/Makefile \
matlab/tests/check_nfft_matlab.sh \
matlab/tests/check_nfft_octave.sh \
matlab/tests/check_nfsft_matlab.sh \
matlab/tests/check_nfsft_octave.sh \
matlab/tests/check_nfsoft_matlab.sh \
matlab/tests/check_nfsoft_octave.sh \
matlab/tests/nfftUnitTests.m \
matlab/tests/nfsftUnitTests.m \
julia/Makefile \
julia/nfft/Makefile \
julia/fastsum/Makefile \
julia/nfct/Makefile \
julia/nfst/Makefile \
julia/nfsft/Makefile \
benchmarks/Makefile \
doxygen/Makefile \
support/Makefile)
# temproarily removed:
# applications/iterS2/Makefile \
# 3rdparty/Makefile \ 3rdparty/cstripack/Makefile \
AC_OUTPUT