1# Copyright (c) 2002, 2019 Jens Keiner, Stefan Kunis, Daniel Potts
2#
3# This program is free software; you can redistribute it and/or modify it under
4# the terms of the GNU General Public License as published by the Free Software
5# Foundation; either version 2 of the License, or (at your option) any later
6# version.
7#
8# This program is distributed in the hope that it will be useful, but WITHOUT
9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
11# details.
12#
13# You should have received a copy of the GNU General Public License along with
14# this program; if not, write to the Free Software Foundation, Inc., 51
15# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16#
17################################################################################
18# Process this file with autoconf to produce a configure script.
19################################################################################
20
21m4_define([nfft_version_major], [3])
22m4_define([nfft_version_minor], [5])
23m4_define([nfft_version_patch], [2])
24m4_define([nfft_version_type], [alpha])
25m4_append([NFFT_VERSION], m4_expand([nfft_version_major.nfft_version_minor.nfft_version_patch]))
26m4_append([NFFT_VERSION], m4_expand([nfft_version_type]))
27...
28# autoconf initialization
29AC_INIT([NFFT],[NFFT_VERSION],[mail@nfft.org])
30
31# copyright notice
32AC_COPYRIGHT([2003, 2019, Jens Keiner, Stefan Kunis, Daniel Potts])
33
34AC_DEFINE_UNQUOTED([NFFT_VERSION_MAJOR], [nfft_version_major], [Major version number.])
35AC_DEFINE_UNQUOTED([NFFT_VERSION_MINOR], [nfft_version_minor], [Minor version number.])
36AC_DEFINE_UNQUOTED([NFFT_VERSION_PATCH], [nfft_version_patch], [Patch version number.])
37AC_DEFINE_UNQUOTED([NFFT_VERSION_TYPE], [nfft_version_type], [Release type.])
38
39# m4 macros go here
40AC_CONFIG_MACRO_DIR([m4])
41
42# where to put auxilliary files
43AC_CONFIG_AUX_DIR([config])
44
45# how to recognize the source directory
46AC_CONFIG_SRCDIR([include/nfft3.h])
47
48# header to create
49AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
50
51# canonical host system type string
52AC_CANONICAL_HOST
53
54# number of CPUs
55#AX_COUNT_CPUS
56#AC_DEFINE_UNQUOTED(NFFT_NUM_CORES,$cpu_count,[Define to number of cores.])
57
58# substitute abs_srcdir in generated Makefiles.
59AC_SUBST([abs_srcdir])
60if test "x${host_os}" = "xmingw32" -o "x${host_os}" = "xmingw64"; then
61  ABS_SRCDIR=`cd "$srcdir" && pwd -W`
62else
63  ABS_SRCDIR=`cd "$srcdir" && pwd`
64fi
65AC_DEFINE_UNQUOTED([ABS_SRCDIR], ["$ABS_SRCDIR"], [Absolute path to source directory.])
66AC_SUBST([ABS_SRCDIR])
67
68AC_SUBST([abs_top_srcdir])
69AC_SUBST([top_builddir])
70AC_SUBST([abs_top_builddir])
71
72# minimum required libtool version
73LT_PREREQ([2.4.2])
74
75# libtool initialization
76LT_INIT([win32-dll])
77
78# substitute LIBTOOL_DEPS variable in generated Makefiles
79AC_SUBST([LIBTOOL_DEPS])
80
81# version information for shared library
82SHARED_VERSION_INFO="4:2:0"
83
84# substitute SHARED_VERSION_INFO in generated Makefiles
85AC_SUBST(SHARED_VERSION_INFO)
86
87# check for make
88AC_PROG_MAKE_SET
89
90# automake initialization
91AM_INIT_AUTOMAKE(1.10)
92
93# doxygen ${PACKAGE_STRING}
94DX_DOT_FEATURE(ON)
95DX_HTML_FEATURE(ON)
96DX_CHM_FEATURE(OFF)
97DX_CHI_FEATURE(OFF)
98DX_MAN_FEATURE(OFF)
99DX_RTF_FEATURE(OFF)
100DX_XML_FEATURE(OFF)
101DX_PDF_FEATURE(OFF)
102DX_PS_FEATURE(OFF)
103DX_INIT_DOXYGEN([NFFT], [doxygen/doxygen.Doxyfile], [doc])
104
105################################################################################
106# options for customizing the build process
107################################################################################
108
109# maintainer mode option
110AM_MAINTAINER_MODE
111
112# Precision.
113AC_ARG_ENABLE(single, [AS_HELP_STRING([--enable-single],[compile NFFT in single precision])], ok=$enableval, ok=no)
114AC_ARG_ENABLE(float, [AS_HELP_STRING([--enable-float],[synonym for --enable-single])], ok=$enableval)
115if test "$ok" = "yes"; then
116  AC_DEFINE(NFFT_SINGLE,1,[Define to compile in single precision.])
117  PRECISION=s
118else
119  PRECISION=d
120fi
121
122AC_ARG_ENABLE(long-double, [AS_HELP_STRING([--enable-long-double],[compile NFFT in long-double precision])], ok=$enableval, ok=no)
123if test "$ok" = "yes"; then
124  if test "$PRECISION" = "s"; then
125    AC_MSG_ERROR([--enable-single/--enable-long-double conflict])
126  fi
127  AC_DEFINE(NFFT_LDOUBLE,1,[Define to compile in long-double precision.])
128  PRECISION=l
129fi
130AC_SUBST(PRECISION)
131
132# Library suffix
133case "$PRECISION" in
134     s) PREC_SUFFIX=f;;
135     d) PREC_SUFFIX=;;
136     l) PREC_SUFFIX=l;;
137esac
138AC_SUBST(PREC_SUFFIX)
139
140# Library suffix
141case "$PRECISION" in
142     s) NFFT_PRECISION_MACRO=NFFT_PRECISION_SINGLE;;
143     d) NFFT_PRECISION_MACRO=NFFT_PRECISION_DOUBLE;;
144     l) NFFT_PRECISION_MACRO=NFFT_PRECISION_LONG_DOUBLE;;
145esac
146AC_SUBST(NFFT_PRECISION_MACRO)
147
148AM_CONDITIONAL(HAVE_NON_DOUBLE_PRECISION, test "x$PRECISION" != "xd" )
149
150# enable or disable parts of NFFT
151
152# whether we need the fpt module
153need_fpt="no"
154
155# build all modules by default in maintainer mode or if option is given
156AC_ARG_ENABLE(all, [AC_HELP_STRING([--enable-all],[build all modules])],
157  ok=$enableval, ok=$USE_MAINTAINER_MODE)
158nfft_module_default=$ok
159
160# option for example programs
161nfft_examples_default="yes"
162AC_ARG_ENABLE(examples, [AC_HELP_STRING([--enable-examples],
163  [enable example programs])], enable_examples=$enableval, enable_examples=$nfft_examples_default)
164AM_CONDITIONAL(HAVE_EXAMPLES, test "x$enable_examples" = "xyes" )
165
166# option for application programs
167nfft_applications_default="yes"
168AC_ARG_ENABLE(applications, [AC_HELP_STRING([--enable-applications],
169  [enable application programs])], enable_applications=$enableval, enable_applications=$nfft_applications_default)
170AM_CONDITIONAL(HAVE_APPLICATIONS, test "x$enable_applications" = "xyes" )
171
172# default option for julia interface, may be overwritten (enabled by default
173#   if --enable-all is specified for double precision and enable-shared)
174if test "x$PRECISION" = "xd" -a "x$enable_shared" = "xyes"; then
175  nfft_julia_default=$nfft_module_default
176else
177  nfft_julia_default="no"
178fi
179AC_ARG_ENABLE(julia, [AC_HELP_STRING([--enable-julia],
180  [enable julia interface])], enable_julia=$enableval, enable_julia=$nfft_julia_default)
181AM_CONDITIONAL(HAVE_JULIA, test "x$enable_julia" = "xyes" )
182
183if test "x$enable_julia" = "xyes" -a "x$PRECISION" != "xd"; then
184  AC_MSG_ERROR([Building the julia interface requires double precision.])
185fi
186
187if test "x$enable_julia" = "xyes" -a "x$enable_shared" = "xno"; then
188  AC_MSG_ERROR([Building the julia interface requires --enable-shared.])
189fi
190
191# options for modules
192AX_NFFT_MODULE([nfct],[NFCT],[nonequispaced fast cosine transform],["yes"])
193AX_NFFT_MODULE([nfst],[NFST],[nonequispaced fast sine transform],["yes"])
194AX_NFFT_MODULE([nfsft],[NFSFT],[nonequispaced fast spherical Fourier transform],["no"],
195  [need_fpt="yes"])
196AX_NFFT_MODULE([nfsoft],[NFSOFT],[nonequispaced fast SO(3) Fourier transform],["no"],
197  [need_fpt="yes"])
198AX_NFFT_MODULE([nnfft],[NNFFT],[nonequispaced fast Fourier transform -- ]#
199  [nonequispaced in both domains],["no"])
200AX_NFFT_MODULE([nsfft],[NSFFT],[nonequispaced sparse fast Fourier transform],["no"])
201AX_NFFT_MODULE([mri],[MRI],[magnet resonance imaging],["no"])
202AX_NFFT_MODULE([fpt],[FPT],[fast polynomial transform],["no"],[],[],
203  [test "x$ok" = "xyes" -o "x$need_fpt" = "xyes"])
204
205# multithreaded code
206#AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],
207#  [enable OpenMP multithreaded code])], [enable_threads=$enableval; AC_DEFINE(ENABLE_OPENMP, 1, ["Define to enable OpenMP code."])], enable_threads=no)
208AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],
209  [enable OpenMP multithreaded code])], enable_threads=$enableval, enable_threads=no)
210AM_CONDITIONAL(HAVE_THREADS, test "x$enable_threads" = "xyes" )
211
212# debug mode
213AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],
214  [compile with extra runtime checks for debugging])], enable_debug=$enableval,
215  enable_debug=no)
216if test "x$enable_debug" = "xyes"; then
217  AC_DEFINE(NFFT_DEBUG,1,[Define to enable extra debugging code.])
218fi
219
220# runtime time measurements
221AC_ARG_ENABLE(measure-time, [AC_HELP_STRING([--enable-measure-time],
222  [measure time during execution])], ok=$enableval, ok=no)
223if test "x$ok" = "xyes"; then
224  AC_DEFINE(MEASURE_TIME,1,[Define to enable runtime time measurements.])
225fi
226
227# runtime time measurements for FFTW part
228AC_ARG_ENABLE(measure-time-fftw, [AC_HELP_STRING([--enable-measure-time-fftw],
229  [measure time of FFTW transforms during execution])], ok=$enableval, ok=no)
230if test "x$ok" = "xyes"; then
231  AC_DEFINE(MEASURE_TIME_FFTW,1,[Define to enable time measurements for FFTW]
232  [transforms.])
233fi
234
235AC_ARG_ENABLE(mips_zbus_timer, [AC_HELP_STRING([--enable-mips-zbus-timer],
236  [use MIPS ZBus cycle-counter])], have_mips_zbus_timer=$enableval,
237  have_mips_zbus_timer=no)
238if test "$have_mips_zbus_timer" = "yes"; then
239  AC_DEFINE(HAVE_MIPS_ZBUS_TIMER,1,
240    [Define to enable use of MIPS ZBus cycle-counter.])
241fi
242
243# select window function
244AC_ARG_WITH(window, [AC_HELP_STRING([--with-window=ARG],[choose window function
245  (ARG can be one of: kaiserbessel (default), gaussian, bspline, sinc,
246  dirac)])],
247  window=$withval, window="kaiserbessel")
248
249AC_MSG_CHECKING([window function])
250case "$window" in
251  kaiserbessel)
252    AC_DEFINE(KAISER_BESSEL,1,[Define to enable Kaiser-Bessel window function.]);;
253  gaussian)
254    AC_DEFINE(GAUSSIAN,1,[Define to enable Gaussian window function.]);;
255  bspline)
256    AC_DEFINE(B_SPLINE,1,[Define to enable B-spline window function.]);;
257  sinc)
258    AC_DEFINE(SINC_POWER,1,[Define to enable sinc power window function.]);;
259  delta)
260    AC_DEFINE(DIRAC_DELTA,1,[Define to enable Dirac delta window function.]);;
261  *)
262    AC_MSG_ERROR([Unknown window function "$window".]);;
263esac
264AC_MSG_RESULT([$window])
265AC_DEFINE_UNQUOTED(WINDOW_NAME,$window,[The name of the window function.])
266
267AC_ARG_ENABLE(exhaustive-unit-tests, [AS_HELP_STRING([--enable-exhaustive-unit-tests],[enable exhaustive unit tests])], ok=$enableval, ok=no)
268matlab_exhaustive_unit_tests_flag=0
269if test "$ok" = "yes"; then
270  AC_DEFINE(NFFT_EXHAUSTIVE_UNIT_TESTS,1,[Define to enable exhaustive unit tests.])
271  matlab_exhaustive_unit_tests_flag=1
272fi
273AC_SUBST(matlab_exhaustive_unit_tests_flag)
274
275################################################################################
276# compiler characteristis
277################################################################################
278
279# select programming language
280AC_LANG(C)
281
282# compiler vendor
283AX_COMPILER_VENDOR
284
285# check for C99 compliant mode (possibly with GNU extensions)
286AC_PROG_CC_C99
287
288# per-target flags
289AM_PROG_CC_C_O
290
291# enable "const" keyword
292AC_C_CONST
293
294# enable "restrict" keyword
295AC_C_RESTRICT
296
297# enable "inline" keyword
298AC_C_INLINE
299
300# reset CC variable (the C99 option is added back below)
301CC="$ac_save_CC"
302
303################################################################################
304# program checks
305################################################################################
306
307# C preprocessor
308AC_PROG_CPP_WERROR
309
310# assembler
311AM_PROG_AS
312
313# BSD-compatible install
314AC_PROG_INSTALL
315
316# mkdir
317AC_PROG_MKDIR_P
318
319# whether ln -s works
320AC_PROG_LN_S
321
322################################################################################
323# 3rd party libraries
324################################################################################
325
326# Check for fftw3.
327AX_LIB_FFTW3
328
329if test "x$ax_lib_fftw3" = "xno"; then
330  AC_MSG_ERROR([You don't seem to have the FFTW 3 library installed. You can ]#
331     [download it from http://www.fftw.org. If you have installed FFTW 3, ]#
332     [make sure that this configure script can find it. See ./configure ]#
333     [--help for more information.])
334fi
335
336if  test "x$enable_threads" = "xyes" -a "x$ax_lib_fftw3_threads" = "xno"; then
337  AC_MSG_ERROR([You don't seem to have the threaded FFTW 3 library installed.])
338fi
339
340AX_OPENMP
341AM_CONDITIONAL(HAVE_OPENMP, test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xunknown" )
342AC_SUBST(OPENMP_CFLAGS)
343
344if  test "x$enable_threads" = "xyes" -a "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
345  AC_MSG_ERROR([You don't seem to have a C compiler with OpenMP support installed which is required for threaded NFFT.])
346fi
347
348# Check for MATLAB.
349AX_PROG_MATLAB
350
351if test "x$ax_prog_matlab" = "xyes" -a "x$PRECISION" != "xd"; then
352  AC_MSG_ERROR([Building the Matlab interfaces requires double precision.])
353fi
354
355if test "x$matlab_threads" = "xyes" -a "x$enable_threads" != "xyes"; then
356  AC_MSG_ERROR([The NFFT Matlab interface with thread support requires the threaded NFFT to be built. Please re-run configure with \"--enable-openmp\".])
357fi
358
359
360################################################################################
361# compiler options
362################################################################################
363
364# Try to choose good compiler options.
365if test "x$ac_test_CFLAGS" != "xset"; then
366  saved_CPPFLAGS="$CPPFLAGS"
367  saved_LDFLAGS="$LDFLAGS"
368  saved_LIBS="$LIBS"
369  CPPFLAGS="$CPPFLAGS $fftw3_CPPFLAGS"
370  LIBS="$LIBS $fftw3_LIBS"
371  LDFLAGS="$LDFLAGS $fftw3_LDFLAGS"
372  AX_CC_MAXOPT
373  CPPFLAGS="$saved_CPPFLAGS"
374  LDFLAGS="$saved_LDFLAGS"
375  LIBS="$saved_LIBS"
376fi
377
378# override CFLAGS selection when debugging
379if test "x${enable_debug}" = "xyes"; then
380  CFLAGS="-g"
381#  if test "x$ax_cv_c_compiler_vendor" = "xapple"; then
382#    CFLAGS="$CFLAGS $ax_cv_apple_gcc_archflag"
383#  fi
384fi
385
386# add gcc warnings, in debug/maintainer mode only
387if test "x${enable_debug}" = "xyes" || test "x$USE_MAINTAINER_MODE" = "xyes";
388then
389  if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
390    CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
391    CFLAGS="$CFLAGS -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings"
392    CFLAGS="$CFLAGS -Wstrict-prototypes -Wredundant-decls -Wnested-externs"
393    CFLAGS="$CFLAGS -Wundef -Wconversion -Wmissing-prototypes "
394    CFLAGS="$CFLAGS -Wmissing-declarations"
395  fi
396fi
397
398# option to accept C99
399CFLAGS="$CFLAGS $ac_cv_prog_cc_c99"
400
401# use MinGW implementation of printf
402if test "x${host_os}" = "xmingw32" -o "x${host_os}" = "xmingw64"; then
403  CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1"
404fi
405
406CPPFLAGS="$CPPFLAGS $fftw3_CPPFLAGS"
407
408# add Matlab CFLAGS
409if test "x$ax_prog_matlab" = "xyes"; then
410  CFLAGS="$CFLAGS $matlab_CFLAGS"
411fi
412
413################################################################################
414# check if mex.h can be included without undefinition of
415################################################################################
416ax_prog_matlab_gcc_require_undef_stdc_utf_16=no
417if test "x$ax_prog_matlab" = "xyes"; then
418  AC_MSG_CHECKING([if inclusion of mex.h succeeds])
419  saved_CPPFLAGS="$CPPFLAGS"
420  CPPFLAGS="$CPPFLAGS $matlab_CPPFLAGS"
421  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])
422  AC_MSG_RESULT([$ax_prog_matlab_check_compile_mex_h])
423  if test "x$ax_prog_matlab_check_compile_mex_h" = "xno"; then
424    AC_MSG_CHECKING([if undefining __STDC_UTF_16__ solves this issue])
425    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#undef __STDC_UTF_16__
426    #include "mex.h"]],[[]])],[ax_prog_matlab_gcc_require_undef_stdc_utf_16=yes], [])
427    AC_MSG_RESULT([$ax_prog_matlab_gcc_require_undef_stdc_utf_16])
428  fi
429  CPPFLAGS="$saved_CPPFLAGS"
430fi
431if test "x$ax_prog_matlab_gcc_require_undef_stdc_utf_16" =  "xyes"; then
432  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.])
433fi
434
435################################################################################
436# header files/data types/compiler characteristics
437################################################################################
438
439AC_CHECK_HEADERS([math.h stdio.h stdlib.h time.h  sys/time.h \
440  complex.h string.h float.h limits.h stdarg.h stddef.h sys/types.h stdint.h \
441  inttypes.h stdbool.h malloc.h c_asm.h intrinsics.h mach/mach_time.h])
442
443AC_HEADER_TIME
444
445AC_TYPE_SIZE_T
446AC_CHECK_TYPE([long double],
447  [AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports]
448  ['long double'])],[])
449AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t]
450  [is defined in <sys/time.h>])],,
451  [
452#if HAVE_SYS_TIME_H
453#include <sys/time.h>
454#endif
455  ])
456AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
457#ifdef HAVE_STDINT_H
458#  include <stdint.h>
459#endif])
460
461AC_CHECK_SIZEOF(int)
462AC_CHECK_SIZEOF(unsigned int)
463AC_CHECK_SIZEOF(long)
464AC_CHECK_SIZEOF(unsigned long)
465AC_CHECK_SIZEOF(long long)
466AC_CHECK_SIZEOF(unsigned long long)
467AC_CHECK_SIZEOF(size_t)
468AC_CHECK_SIZEOF(ptrdiff_t)
469AC_CHECK_SIZEOF(float)
470AC_CHECK_SIZEOF(double)
471AC_CHECK_SIZEOF(long double)
472
473# library functions
474AC_FUNC_ALLOCA
475AC_FUNC_STRTOD
476AC_FUNC_VPRINTF
477saved_LIBS=$LIBS
478AC_CHECK_LIB(m, sin, [])
479LIBS=$saved_LIBS
480
481AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time])
482
483AC_CHECK_FUNCS([memset posix_memalign memalign])
484AC_CHECK_FUNCS([_mm_malloc _mm_free sysctl])
485AC_CHECK_FUNCS([abort snprintf sqrt])
486AC_CHECK_FUNCS([sleep usleep nanosleep drand48 srand48])
487AC_CHECK_FUNCS([gethostname])
488
489AC_CHECK_DECLS([memalign, posix_memalign])
490AC_CHECK_DECLS([sleep],[],[],[#include <unistd.h>])
491AC_CHECK_DECLS([nanosleep],[],[],[#include <time.h>])
492AC_CHECK_DECLS([drand48],[],[],[#include <stdlib.h>])
493AC_CHECK_DECLS([srand48],[],[],[#include <stdlib.h>])
494
495# Cray UNICOS _rtc() (real-time clock) intrinsic
496AC_MSG_CHECKING([for _rtc intrinsic])
497rtc_ok=yes
498AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H
499#include <intrinsics.h>
500#endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no])
501AC_MSG_RESULT($rtc_ok)
502
503AC_MSG_CHECKING([whether a cycle counter is available])
504save_CPPFLAGS=$CPPFLAGS
505CPPFLAGS="$CPPFLAGS -I$srcdir/include"
506AC_TRY_CPP([#include "cycle.h"
507#ifndef HAVE_TICK_COUNTER
508#  error No cycle counter
509#endif], [ok=yes], [ok=no])
510AC_MSG_RESULT($ok)
511TICKS_PER_SECOND=1
512if test $ok = no; then
513  echo "***************************************************************"
514  echo "WARNING: No cycle counter found. Time measurements in NFFT will"
515  echo "         show incorrect results.                               "
516  echo "***************************************************************"
517else
518  AC_TRY_RUN([#include "cycle.h"
519#include <stdio.h>
520#if defined(HAVE_NANOSLEEP)
521#include <stdlib.h>
522static struct timespec ts = {1,0};
523#define SLEEP nanosleep(&ts, 0)
524#elif defined(HAVE_SLEEP)
525#include <unistd.h>
526#define SLEEP sleep(1)
527#elif defined(HAVE_USLEEP)
528#include <unistd.h>
529#define SLEEP usleep(1000)
530#else
531#error wtf!
532#endif
533int main(){
534ticks t0 = getticks();
535SLEEP;{
536  double tps = elapsed(getticks(),t0)/1.0;
537  FILE *f = fopen("ticks.tmp","w");
538  fprintf(f,"%.1f\n",tps);
539  fclose(f);}
540return 0;}],[read TICKS_PER_SECOND < ticks.tmp],[],[TICKS_PER_SECOND=1])
541    rm -f ticks.tmp
542  if test "$TICKS_PER_SECOND" = "1"; then
543    echo "***************************************************************"
544    echo "WARNING: Number of ticks per second could not be determined.   "
545    echo "         Time measurements in NFFT will be in arbitrary units  "
546    echo "         instead of seconds.                                   "
547    echo "***************************************************************"
548  fi
549fi
550
551CPPFLAGS=$save_CPPFLAGS
552AC_SUBST(TICKS_PER_SECOND)
553
554if test "$PRECISION" = "l"; then
555#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])
556AC_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],[],[],
557  [#include <math.h>
558#include <complex.h>])
559fi
560
561if test "$PRECISION" = "d"; then
562#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])
563AC_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],[],[],
564  [#include <math.h>
565#include <complex.h>])
566fi
567
568if test "$PRECISION" = "s"; then
569#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])
570AC_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],[],[],
571  [#include <math.h>
572#include <complex.h>])
573fi
574
575# CUnit
576AX_CUNIT
577AM_CONDITIONAL(HAVE_CUNIT, test "x$ax_cv_cunit" = "xyes" )
578
579# The output files to be generated
580AC_CONFIG_FILES(Makefile \
581                nfft3.pc \
582                doxygen/doxygen.Doxyfile \
583                include/Makefile \
584                include/ticks.h \
585                kernel/Makefile \
586                kernel/fpt/Makefile \
587                kernel/mri/Makefile \
588                kernel/nfct/Makefile \
589                kernel/nfft/Makefile \
590                kernel/nfsft/Makefile \
591                kernel/nfsoft/Makefile \
592                kernel/nfst/Makefile \
593                kernel/nnfft/Makefile \
594                kernel/nsfft/Makefile \
595                kernel/solver/Makefile \
596                kernel/util/Makefile \
597                tests/Makefile \
598                tests/data/Makefile \
599                examples/Makefile \
600                examples/fpt/Makefile \
601                examples/mri/Makefile \
602                examples/nfct/Makefile \
603                examples/nfct/simple_test.c \
604                examples/nfft/Makefile \
605                examples/nfft/simple_test.c \
606                examples/nfft/simple_test_threads.c \
607                examples/nfsft/Makefile \
608                examples/nfsoft/Makefile \
609                examples/nfst/Makefile \
610                examples/nfst/simple_test.c \
611                examples/nnfft/Makefile \
612                examples/nsfft/Makefile \
613                examples/solver/Makefile \
614		examples/solver/glacier.c \
615		examples/solver/simple_test.c \
616                applications/Makefile \
617                applications/fastgauss/Makefile \
618		applications/fastgauss/fastgauss.c \
619                applications/fastsum/Makefile \
620                applications/fastsumS2/Makefile \
621                applications/quadratureS2/Makefile \
622                applications/mri/Makefile \
623                applications/mri/mri2d/Makefile \
624                applications/mri/mri3d/Makefile \
625                applications/polarFFT/Makefile \
626                applications/polarFFT/linogram_fft_test.c \
627                applications/polarFFT/mpolar_fft_test.c \
628                applications/polarFFT/polar_fft_test.c \
629                applications/radon/Makefile \
630		applications/radon/inverse_radon.c \
631		applications/radon/radon.c \
632                matlab/Makefile \
633                matlab/fpt/Makefile \
634                matlab/nfsft/Makefile \
635                matlab/nfft/Makefile \
636                matlab/nfct/Makefile \
637                matlab/nfst/Makefile \
638                matlab/nnfft/Makefile \
639                matlab/fastsum/Makefile \
640                matlab/infft1d/Makefile \
641                matlab/nfsft/@f_hat/Makefile \
642                matlab/nfsoft/Makefile \
643                matlab/tests/Makefile \
644		matlab/tests/check_nfft_matlab.sh \
645		matlab/tests/check_nfft_octave.sh \
646		matlab/tests/check_nfsft_matlab.sh \
647		matlab/tests/check_nfsft_octave.sh \
648		matlab/tests/check_nfsoft_matlab.sh \
649		matlab/tests/check_nfsoft_octave.sh \
650		matlab/tests/nfftUnitTests.m \
651		matlab/tests/nfsftUnitTests.m \
652		julia/Makefile \
653		julia/nfft/Makefile \
654		julia/fastsum/Makefile \
655		julia/nfct/Makefile \
656		julia/nfst/Makefile \
657                doxygen/Makefile \
658                support/Makefile)
659# temproarily removed:
660#  applications/iterS2/Makefile \
661# 3rdparty/Makefile \ 3rdparty/cstripack/Makefile \
662
663AC_OUTPUT
664