annotate fft/fftw/fftw-3.3.4/configure.ac @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents 26056e866c29
children
rev   line source
Chris@19 1 dnl Process this file with autoconf to produce a configure script.
Chris@19 2
Chris@19 3 dnl Define the fftw version number as M4 macros, so that we can enforce
Chris@19 4 dnl the invariant that the minor version number in FFTW-X.Y.MINOR is the same
Chris@19 5 dnl as the revision number in SHARED_VERSION_INFO.
Chris@19 6 define(FFTW_MAJOR_VERSION, 3.3)dnl
Chris@19 7 define(FFTW_MINOR_VERSION, 4)dnl
Chris@19 8
Chris@19 9 dnl Version number of the FFTW source package.
Chris@19 10 AC_INIT(fftw, FFTW_MAJOR_VERSION.FFTW_MINOR_VERSION, fftw@fftw.org)
Chris@19 11 AC_CONFIG_SRCDIR(kernel/ifftw.h)
Chris@19 12
Chris@19 13 dnl Version number for libtool shared libraries. Libtool wants a string
Chris@19 14 dnl of the form CURRENT:REVISION:AGE. We adopt the convention that
Chris@19 15 dnl REVISION is the same as the FFTW minor version number.
Chris@19 16 dnl fftw-3.1.x was 4:x:1
Chris@19 17 dnl fftw-3.2.x was 5:x:2
Chris@19 18 dnl fftw-3.3.x was 6:x:3 for x < 4 and 7:x:4 for x >= 4
Chris@19 19 SHARED_VERSION_INFO="7:FFTW_MINOR_VERSION:4" # CURRENT:REVISION:AGE
Chris@19 20
Chris@19 21 AM_INIT_AUTOMAKE(1.7)
Chris@19 22 AM_CONFIG_HEADER(config.h)
Chris@19 23 AC_CONFIG_MACRO_DIR([m4])
Chris@19 24 AM_MAINTAINER_MODE
Chris@19 25 AC_SUBST(SHARED_VERSION_INFO)
Chris@19 26 AC_DISABLE_SHARED dnl to hell with shared libraries
Chris@19 27 AC_CANONICAL_HOST
Chris@19 28
Chris@19 29 dnl configure options
Chris@19 30 case "${host_cpu}" in
Chris@19 31 powerpc*) have_fma=yes;;
Chris@19 32 ia64*) have_fma=yes;;
Chris@19 33 hppa*) have_fma=yes;;
Chris@19 34 mips64*) have_fma=yes;;
Chris@19 35 *) have_fma=no;;
Chris@19 36 esac
Chris@19 37
Chris@19 38 AC_ARG_ENABLE(fma, [AC_HELP_STRING([--enable-fma],[enable optimizations for machines with fused multiply-add])], have_fma=$enableval)
Chris@19 39 if test "$have_fma"x = "yes"x; then
Chris@19 40 AC_DEFINE(HAVE_FMA,1,[Define if you have a machine with fused multiply-add])
Chris@19 41 fi
Chris@19 42
Chris@19 43
Chris@19 44 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile fftw with extra runtime checks for debugging])], ok=$enableval, ok=no)
Chris@19 45 if test "$ok" = "yes"; then
Chris@19 46 AC_DEFINE(FFTW_DEBUG,1,[Define to enable extra FFTW debugging code.])
Chris@19 47 debug_malloc=yes
Chris@19 48 else
Chris@19 49 debug_malloc=no
Chris@19 50 fi
Chris@19 51
Chris@19 52 AC_ARG_ENABLE(debug-malloc, [AC_HELP_STRING([--enable-debug-malloc],[enable malloc debugging version])], ok=$enableval, ok=$debug_malloc)
Chris@19 53 if test "$ok" = "yes"; then
Chris@19 54 AC_DEFINE(FFTW_DEBUG_MALLOC,1,[Define to enable debugging malloc.])
Chris@19 55 fi
Chris@19 56
Chris@19 57 AC_ARG_ENABLE(debug-alignment, [AC_HELP_STRING([--enable-debug-alignment],[enable alignment debugging hacks])], ok=$enableval, ok=no)
Chris@19 58 if test "$ok" = "yes"; then
Chris@19 59 AC_DEFINE(FFTW_DEBUG_ALIGNMENT,1,[Define to enable alignment debugging hacks.])
Chris@19 60 fi
Chris@19 61
Chris@19 62 AC_ARG_ENABLE(random-estimator, [AC_HELP_STRING([--enable-random-estimator],[enable pseudorandom estimator (debugging hack)])], ok=$enableval, ok=no)
Chris@19 63 if test "$ok" = "yes"; then
Chris@19 64 AC_DEFINE(FFTW_RANDOM_ESTIMATOR,1,[Define to enable pseudorandom estimate planning for debugging.])
Chris@19 65 CHECK_PL_OPTS="--estimate"
Chris@19 66 fi
Chris@19 67
Chris@19 68 AC_ARG_ENABLE(alloca, [AC_HELP_STRING([--disable-alloca],[disable use of the alloca() function (may be broken on mingw64)])], ok=$enableval, ok=yes)
Chris@19 69 if test "$ok" = "yes"; then
Chris@19 70 AC_DEFINE(FFTW_ENABLE_ALLOCA,1,[Define to enable the use of alloca().])
Chris@19 71 fi
Chris@19 72
Chris@19 73 AC_ARG_ENABLE(single, [AC_HELP_STRING([--enable-single],[compile fftw in single precision])], ok=$enableval, ok=no)
Chris@19 74 AC_ARG_ENABLE(float, [AC_HELP_STRING([--enable-float],[synonym for --enable-single])], ok=$enableval)
Chris@19 75 if test "$ok" = "yes"; then
Chris@19 76 AC_DEFINE(FFTW_SINGLE,1,[Define to compile in single precision.])
Chris@19 77 AC_DEFINE(BENCHFFT_SINGLE,1,[Define to compile in single precision.])
Chris@19 78 PRECISION=s
Chris@19 79 else
Chris@19 80 PRECISION=d
Chris@19 81 fi
Chris@19 82 AM_CONDITIONAL(SINGLE, test "$ok" = "yes")
Chris@19 83
Chris@19 84 AC_ARG_ENABLE(long-double, [AC_HELP_STRING([--enable-long-double],[compile fftw in long-double precision])], ok=$enableval, ok=no)
Chris@19 85 if test "$ok" = "yes"; then
Chris@19 86 if test "$PRECISION" = "s"; then
Chris@19 87 AC_MSG_ERROR([--enable-single/--enable-long-double conflict])
Chris@19 88 fi
Chris@19 89 AC_DEFINE(FFTW_LDOUBLE,1,[Define to compile in long-double precision.])
Chris@19 90 AC_DEFINE(BENCHFFT_LDOUBLE,1,[Define to compile in long-double precision.])
Chris@19 91 PRECISION=l
Chris@19 92 fi
Chris@19 93 AM_CONDITIONAL(LDOUBLE, test "$ok" = "yes")
Chris@19 94
Chris@19 95 AC_ARG_ENABLE(quad-precision, [AC_HELP_STRING([--enable-quad-precision],[compile fftw in quadruple precision if available])], ok=$enableval, ok=no)
Chris@19 96 if test "$ok" = "yes"; then
Chris@19 97 if test "$PRECISION" != "d"; then
Chris@19 98 AC_MSG_ERROR([conflicting precisions specified])
Chris@19 99 fi
Chris@19 100 AC_DEFINE(FFTW_QUAD,1,[Define to compile in quad precision.])
Chris@19 101 AC_DEFINE(BENCHFFT_QUAD,1,[Define to compile in quad precision.])
Chris@19 102 PRECISION=q
Chris@19 103 fi
Chris@19 104 AM_CONDITIONAL(QUAD, test "$ok" = "yes")
Chris@19 105
Chris@19 106 AC_SUBST(PRECISION)
Chris@19 107 AC_SUBST(CHECK_PL_OPTS)
Chris@19 108
Chris@19 109 AC_ARG_ENABLE(sse, [AC_HELP_STRING([--enable-sse],[enable SSE optimizations])], have_sse=$enableval, have_sse=no)
Chris@19 110 if test "$have_sse" = "yes"; then
Chris@19 111 if test "$PRECISION" != "s"; then
Chris@19 112 AC_MSG_ERROR([SSE requires single precision])
Chris@19 113 fi
Chris@19 114 fi
Chris@19 115
Chris@19 116 AC_ARG_ENABLE(sse2, [AC_HELP_STRING([--enable-sse2],[enable SSE/SSE2 optimizations])], have_sse2=$enableval, have_sse2=no)
Chris@19 117 if test "$have_sse" = "yes"; then have_sse2=yes; fi
Chris@19 118 if test "$have_sse2" = "yes"; then
Chris@19 119 AC_DEFINE(HAVE_SSE2,1,[Define to enable SSE/SSE2 optimizations.])
Chris@19 120 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
Chris@19 121 AC_MSG_ERROR([SSE2 requires single or double precision])
Chris@19 122 fi
Chris@19 123 fi
Chris@19 124 AM_CONDITIONAL(HAVE_SSE2, test "$have_sse2" = "yes")
Chris@19 125
Chris@19 126 AC_ARG_ENABLE(avx, [AC_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=no)
Chris@19 127 if test "$have_avx" = "yes"; then
Chris@19 128 AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.])
Chris@19 129 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
Chris@19 130 AC_MSG_ERROR([AVX requires single or double precision])
Chris@19 131 fi
Chris@19 132 fi
Chris@19 133 AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes")
Chris@19 134
Chris@19 135 AC_ARG_ENABLE(altivec, [AC_HELP_STRING([--enable-altivec],[enable Altivec optimizations])], have_altivec=$enableval, have_altivec=no)
Chris@19 136 if test "$have_altivec" = "yes"; then
Chris@19 137 AC_DEFINE(HAVE_ALTIVEC,1,[Define to enable Altivec optimizations.])
Chris@19 138 if test "$PRECISION" != "s"; then
Chris@19 139 AC_MSG_ERROR([Altivec requires single precision])
Chris@19 140 fi
Chris@19 141 fi
Chris@19 142 AM_CONDITIONAL(HAVE_ALTIVEC, test "$have_altivec" = "yes")
Chris@19 143
Chris@19 144 AC_ARG_ENABLE(neon, [AC_HELP_STRING([--enable-neon],[enable ARM NEON optimizations])], have_neon=$enableval, have_neon=no)
Chris@19 145 if test "$have_neon" = "yes"; then
Chris@19 146 AC_DEFINE(HAVE_NEON,1,[Define to enable ARM NEON optimizations.])
Chris@19 147 if test "$PRECISION" != "s"; then
Chris@19 148 AC_MSG_ERROR([NEON requires single precision])
Chris@19 149 fi
Chris@19 150 fi
Chris@19 151 AM_CONDITIONAL(HAVE_NEON, test "$have_neon" = "yes")
Chris@19 152
Chris@19 153 dnl FIXME:
Chris@19 154 dnl AC_ARG_ENABLE(mips-ps, [AC_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no)
Chris@19 155 dnl if test "$have_mips_ps" = "yes"; then
Chris@19 156 dnl AC_DEFINE(HAVE_MIPS_PS,1,[Define to enable MIPS paired-single optimizations.])
Chris@19 157 dnl if test "$PRECISION" != "s"; then
Chris@19 158 dnl AC_MSG_ERROR([MIPS paired-single requires single precision])
Chris@19 159 dnl fi
Chris@19 160 dnl fi
Chris@19 161 dnl AM_CONDITIONAL(HAVE_MIPS_PS, test "$have_mips_ps" = "yes")
Chris@19 162
Chris@19 163 AC_ARG_WITH(slow-timer, [AC_HELP_STRING([--with-slow-timer],[use low-precision timers (SLOW)])], with_slow_timer=$withval, with_slow_timer=no)
Chris@19 164 if test "$with_slow_timer" = "yes"; then
Chris@19 165 AC_DEFINE(WITH_SLOW_TIMER,1,[Use low-precision timers, making planner very slow])
Chris@19 166 fi
Chris@19 167
Chris@19 168 AC_ARG_ENABLE(mips_zbus_timer, [AC_HELP_STRING([--enable-mips-zbus-timer],[use MIPS ZBus cycle-counter])], have_mips_zbus_timer=$enableval, have_mips_zbus_timer=no)
Chris@19 169 if test "$have_mips_zbus_timer" = "yes"; then
Chris@19 170 AC_DEFINE(HAVE_MIPS_ZBUS_TIMER,1,[Define to enable use of MIPS ZBus cycle-counter.])
Chris@19 171 fi
Chris@19 172
Chris@19 173 AC_ARG_WITH(our-malloc, [AC_HELP_STRING([--with-our-malloc],[use our aligned malloc (helpful for Win32)])], with_our_malloc=$withval, with_our_malloc=no)
Chris@19 174 AC_ARG_WITH(our-malloc16, [AC_HELP_STRING([--with-our-malloc16],[Obsolete alias for --with-our-malloc16])], with_our_malloc=$withval)
Chris@19 175 if test "$with_our_malloc" = "yes"; then
Chris@19 176 AC_DEFINE(WITH_OUR_MALLOC,1,[Use our own aligned malloc routine; mainly helpful for Windows systems lacking aligned allocation system-library routines.])
Chris@19 177 fi
Chris@19 178
Chris@19 179 AC_ARG_WITH(windows-f77-mangling, [AC_HELP_STRING([--with-windows-f77-mangling],[use common Win32 Fortran interface styles])], with_windows_f77_mangling=$withval, with_windows_f77_mangling=no)
Chris@19 180 if test "$with_windows_f77_mangling" = "yes"; then
Chris@19 181 AC_DEFINE(WINDOWS_F77_MANGLING,1,[Use common Windows Fortran mangling styles for the Fortran interfaces.])
Chris@19 182 fi
Chris@19 183
Chris@19 184 AC_ARG_WITH(incoming-stack-boundary, [AC_HELP_STRING([--with-incoming-stack-boundary=X],[Assume that stack is aligned to (1<<X) bytes])], with_incoming_stack_boundary=$withval, with_incoming_stack_boundary=no)
Chris@19 185
Chris@19 186 dnl compute library suffix
Chris@19 187 case "$PRECISION" in
Chris@19 188 s) PREC_SUFFIX=f;;
Chris@19 189 d) PREC_SUFFIX=;;
Chris@19 190 l) PREC_SUFFIX=l;;
Chris@19 191 q) PREC_SUFFIX=q;;
Chris@19 192 esac
Chris@19 193 AC_SUBST(PREC_SUFFIX)
Chris@19 194
Chris@19 195 dnl Checks for programs.
Chris@19 196 AC_PROG_CC
Chris@19 197 AM_PROG_CC_C_O
Chris@19 198 AX_COMPILER_VENDOR
Chris@19 199 AC_PROG_CC_STDC
Chris@19 200 AC_PROG_INSTALL
Chris@19 201 AC_PROG_LN_S
Chris@19 202 AC_PROG_MAKE_SET
Chris@19 203 AC_LIBTOOL_WIN32_DLL
Chris@19 204 AC_PROG_LIBTOOL
Chris@19 205
Chris@19 206 AC_CHECK_PROG(OCAMLBUILD, ocamlbuild, ocamlbuild)
Chris@19 207
Chris@19 208 dnl -----------------------------------------------------------------------
Chris@19 209
Chris@19 210 AC_ARG_ENABLE(mpi, [AC_HELP_STRING([--enable-mpi],[compile FFTW MPI library])], enable_mpi=$enableval, enable_mpi=no)
Chris@19 211
Chris@19 212 if test "$enable_mpi" = "yes"; then
Chris@19 213 if test $PRECISION = q; then
Chris@19 214 AC_MSG_ERROR([quad precision is not supported in MPI])
Chris@19 215 fi
Chris@19 216 ACX_MPI([],[AC_MSG_ERROR([could not find mpi library for --enable-mpi])])
Chris@19 217 AC_CHECK_PROG(MPIRUN, mpirun, mpirun)
Chris@19 218 AC_SUBST(MPIRUN)
Chris@19 219
Chris@19 220 save_CC=$CC
Chris@19 221 CC=$MPICC
Chris@19 222 AC_CHECK_SIZEOF(MPI_Fint, [], [#include <mpi.h>])
Chris@19 223 CC=$save_CC
Chris@19 224 if test 0 = $ac_cv_sizeof_MPI_Fint; then
Chris@19 225 AC_MSG_WARN([sizeof(MPI_Fint) test failed]);
Chris@19 226 dnl As a backup, assume Fortran integer == C int
Chris@19 227 AC_CHECK_SIZEOF(int)
Chris@19 228 if test 0 = $ac_cv_sizeof_int; then AC_MSG_ERROR([sizeof(int) test failed]); fi
Chris@19 229 ac_cv_sizeof_MPI_Fint=$ac_cv_sizeof_int
Chris@19 230 fi
Chris@19 231 C_MPI_FINT=C_INT`expr $ac_cv_sizeof_MPI_Fint \* 8`_T
Chris@19 232 AC_SUBST(C_MPI_FINT)
Chris@19 233 fi
Chris@19 234 AM_CONDITIONAL(MPI, test "$enable_mpi" = "yes")
Chris@19 235
Chris@19 236 dnl -----------------------------------------------------------------------
Chris@19 237
Chris@19 238 dnl determine CFLAGS first
Chris@19 239 AX_CC_MAXOPT
Chris@19 240
Chris@19 241 case "${ax_cv_c_compiler_vendor}" in
Chris@19 242 intel) # Stop icc from defining __GNUC__, except on MacOS where this fails
Chris@19 243 case "${host_os}" in
Chris@19 244 *darwin*) ;; # icc -no-gcc fails to compile some system headers
Chris@19 245 *)
Chris@19 246 AX_CHECK_COMPILER_FLAGS([-no-gcc], [CC="$CC -no-gcc"])
Chris@19 247 ;;
Chris@19 248 esac
Chris@19 249 ;;
Chris@19 250
Chris@19 251 hp) # must (sometimes) manually increase cpp limits to handle fftw3.h
Chris@19 252 AX_CHECK_COMPILER_FLAGS([-Wp,-H128000],
Chris@19 253 [CC="$CC -Wp,-H128000"])
Chris@19 254 ;;
Chris@19 255
Chris@19 256 portland) # -Masmkeyword required for asm("") cycle counters
Chris@19 257 AX_CHECK_COMPILER_FLAGS([-Masmkeyword],
Chris@19 258 [CC="$CC -Masmkeyword"])
Chris@19 259 ;;
Chris@19 260 esac
Chris@19 261
Chris@19 262 dnl Determine SIMD CFLAGS at least for gcc and icc
Chris@19 263 case "${ax_cv_c_compiler_vendor}" in
Chris@19 264 gnu|intel)
Chris@19 265 # SSE/SSE2
Chris@19 266 if test "$have_sse2" = "yes" -a "x$SSE2_CFLAGS" = x; then
Chris@19 267 if test "$PRECISION" = d; then flag=msse2; else flag=msse; fi
Chris@19 268 AX_CHECK_COMPILER_FLAGS(-$flag, [SSE2_CFLAGS="-$flag"],
Chris@19 269 [AC_MSG_ERROR([Need a version of gcc with -$flag])])
Chris@19 270 fi
Chris@19 271
Chris@19 272 # AVX
Chris@19 273 if test "$have_avx" = "yes" -a "x$AVX_CFLAGS" = x; then
Chris@19 274 AX_CHECK_COMPILER_FLAGS(-mavx, [AVX_CFLAGS="-mavx"],
Chris@19 275 [AC_MSG_ERROR([Need a version of gcc with -mavx])])
Chris@19 276 fi
Chris@19 277
Chris@19 278 if test "$have_altivec" = "yes" -a "x$ALTIVEC_CFLAGS" = x; then
Chris@19 279 # -DFAKE__VEC__ is a workaround because gcc-3.3 does not
Chris@19 280 # #define __VEC__ with -maltivec.
Chris@19 281 AX_CHECK_COMPILER_FLAGS(-faltivec, [ALTIVEC_CFLAGS="-faltivec"],
Chris@19 282 [AX_CHECK_COMPILER_FLAGS(-maltivec -mabi=altivec,
Chris@19 283 [ALTIVEC_CFLAGS="-maltivec -mabi=altivec -DFAKE__VEC__"],
Chris@19 284 [AX_CHECK_COMPILER_FLAGS(-fvec, [ALTIVEC_CFLAGS="-fvec"],
Chris@19 285 [AC_MSG_ERROR([Need a version of gcc with -maltivec])])])])
Chris@19 286 fi
Chris@19 287
Chris@19 288 if test "$have_neon" = "yes" -a "x$NEON_CFLAGS" = x; then
Chris@19 289 AX_CHECK_COMPILER_FLAGS(-mfpu=neon, [NEON_CFLAGS="-mfpu=neon"],
Chris@19 290 [AC_MSG_ERROR([Need a version of gcc with -mfpu=neon])])
Chris@19 291 fi
Chris@19 292
Chris@19 293 dnl FIXME:
Chris@19 294 dnl elif test "$have_mips_ps" = "yes"; then
Chris@19 295 dnl # Just punt here and use only new 4.2 compiler :(
Chris@19 296 dnl # Should add section for older compilers...
Chris@19 297 dnl AX_CHECK_COMPILER_FLAGS(-mpaired-single,
Chris@19 298 dnl [SIMD_CFLAGS="-mpaired-single"],
Chris@19 299 dnl #[AC_MSG_ERROR([Need a version of gcc with -mpaired-single])])
Chris@19 300 dnl [AX_CHECK_COMPILER_FLAGS(-march=mips64,
Chris@19 301 dnl [SIMD_CFLAGS="-march=mips64"],
Chris@19 302 dnl [AC_MSG_ERROR(
Chris@19 303 dnl [Need a version of gcc with -mpaired-single or -march=mips64])
Chris@19 304 dnl ])])
Chris@19 305 dnl fi
Chris@19 306 ;;
Chris@19 307 esac
Chris@19 308
Chris@19 309 AC_SUBST(SSE2_CFLAGS)
Chris@19 310 AC_SUBST(AVX_CFLAGS)
Chris@19 311 AC_SUBST(ALTIVEC_CFLAGS)
Chris@19 312 AC_SUBST(NEON_CFLAGS)
Chris@19 313
Chris@19 314 dnl add stack alignment CFLAGS if so requested
Chris@19 315 if test "$with_incoming_stack_boundary"x != "no"x; then
Chris@19 316 case "${ax_cv_c_compiler_vendor}" in
Chris@19 317 gnu)
Chris@19 318 tentative_flags="-mincoming-stack-boundary=$with_incoming_stack_boundary";
Chris@19 319 AX_CHECK_COMPILER_FLAGS($tentative_flags,
Chris@19 320 [STACK_ALIGN_CFLAGS=$tentative_flags])
Chris@19 321 ;;
Chris@19 322 esac
Chris@19 323 fi
Chris@19 324 AC_SUBST(STACK_ALIGN_CFLAGS)
Chris@19 325
Chris@19 326 dnl Checks for header files.
Chris@19 327 AC_HEADER_STDC
Chris@19 328 AC_CHECK_HEADERS([libintl.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h limits.h c_asm.h intrinsics.h stdint.h mach/mach_time.h sys/sysctl.h])
Chris@19 329 dnl c_asm.h: Header file for enabling asm() on Digital Unix
Chris@19 330 dnl intrinsics.h: cray unicos
Chris@19 331 dnl sys/sysctl.h: MacOS X altivec detection
Chris@19 332
Chris@19 333 dnl altivec.h requires $ALTIVEC_CFLAGS
Chris@19 334 save_CFLAGS="$CFLAGS"
Chris@19 335 save_CPPFLAGS="$CPPFLAGS"
Chris@19 336 CFLAGS="$CFLAGS $ALTIVEC_CFLAGS"
Chris@19 337 CPPFLAGS="$CPPFLAGS $ALTIVEC_CFLAGS"
Chris@19 338 AC_CHECK_HEADERS([altivec.h])
Chris@19 339 CFLAGS="$save_CFLAGS"
Chris@19 340 CPPFLAGS="$save_CPPFLAGS"
Chris@19 341
Chris@19 342
Chris@19 343 dnl Checks for typedefs, structures, and compiler characteristics.
Chris@19 344 AC_C_CONST
Chris@19 345 AC_C_INLINE
Chris@19 346 AC_TYPE_SIZE_T
Chris@19 347 AC_HEADER_TIME
Chris@19 348 AC_CHECK_TYPE([long double],
Chris@19 349 [AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports `long double'])],
Chris@19 350 [
Chris@19 351 if test $PRECISION = l; then
Chris@19 352 AC_MSG_ERROR([long double is not a supported type with your compiler.])
Chris@19 353 fi
Chris@19 354 ])
Chris@19 355 AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,
Chris@19 356 [
Chris@19 357 #if HAVE_SYS_TIME_H
Chris@19 358 #include <sys/time.h>
Chris@19 359 #endif
Chris@19 360 ])
Chris@19 361
Chris@19 362 AC_CHECK_SIZEOF(int)
Chris@19 363 AC_CHECK_SIZEOF(unsigned int)
Chris@19 364 AC_CHECK_SIZEOF(long)
Chris@19 365 AC_CHECK_SIZEOF(unsigned long)
Chris@19 366 AC_CHECK_SIZEOF(long long)
Chris@19 367 AC_CHECK_SIZEOF(unsigned long long)
Chris@19 368 AC_CHECK_SIZEOF(size_t)
Chris@19 369 AC_CHECK_SIZEOF(ptrdiff_t)
Chris@19 370
Chris@19 371 AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
Chris@19 372 #ifdef HAVE_STDINT_H
Chris@19 373 # include <stdint.h>
Chris@19 374 #endif])
Chris@19 375
Chris@19 376 AC_CHECK_SIZEOF(float)
Chris@19 377 AC_CHECK_SIZEOF(double)
Chris@19 378
Chris@19 379 dnl Check sizeof fftw_r2r_kind for Fortran interface [it has == sizeof(int)
Chris@19 380 dnl for years, but being paranoid]. Note: the definition here must match
Chris@19 381 dnl the one in api/fftw3.h!
Chris@19 382 AC_CHECK_SIZEOF(fftw_r2r_kind, [], [typedef enum {
Chris@19 383 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
Chris@19 384 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
Chris@19 385 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
Chris@19 386 } fftw_r2r_kind;])
Chris@19 387 if test 0 = $ac_cv_sizeof_fftw_r2r_kind; then AC_MSG_ERROR([sizeof(fftw_r2r_kind) test failed]); fi
Chris@19 388 C_FFTW_R2R_KIND=C_INT`expr $ac_cv_sizeof_fftw_r2r_kind \* 8`_T
Chris@19 389 AC_SUBST(C_FFTW_R2R_KIND)
Chris@19 390
Chris@19 391 dnl Checks for library functions.
Chris@19 392 AC_FUNC_ALLOCA
Chris@19 393 AC_FUNC_STRTOD
Chris@19 394 AC_FUNC_VPRINTF
Chris@19 395 AC_CHECK_LIB(m, sin)
Chris@19 396
Chris@19 397 if test $PRECISION = q; then
Chris@19 398 AX_GCC_VERSION(4,6,0,[],[AC_MSG_ERROR([gcc 4.6 or later required for quad precision support])])
Chris@19 399 AC_CHECK_LIB(quadmath, sinq, [], [AC_MSG_ERROR([quad precision requires libquadmath for quad-precision trigonometric routines])])
Chris@19 400 LIBQUADMATH=-lquadmath
Chris@19 401 fi
Chris@19 402 AC_SUBST(LIBQUADMATH)
Chris@19 403
Chris@19 404 AC_CHECK_FUNCS([BSDgettimeofday gettimeofday gethrtime read_real_time time_base_to_time drand48 sqrt memset posix_memalign memalign _mm_malloc _mm_free clock_gettime mach_absolute_time sysctl abort sinl cosl snprintf])
Chris@19 405 AC_CHECK_DECLS([sinl, cosl, sinq, cosq],,,[#include <math.h>])
Chris@19 406 AC_CHECK_DECLS([memalign],,,[
Chris@19 407 #ifdef HAVE_MALLOC_H
Chris@19 408 #include <malloc.h>
Chris@19 409 #endif])
Chris@19 410 AC_CHECK_DECLS([drand48, srand48, posix_memalign]) dnl in stdlib.h
Chris@19 411
Chris@19 412 dnl Cray UNICOS _rtc() (real-time clock) intrinsic
Chris@19 413 AC_MSG_CHECKING([for _rtc intrinsic])
Chris@19 414 rtc_ok=yes
Chris@19 415 AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H
Chris@19 416 #include <intrinsics.h>
Chris@19 417 #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no])
Chris@19 418 AC_MSG_RESULT($rtc_ok)
Chris@19 419
Chris@19 420 if test "$PRECISION" = "l"; then
Chris@19 421 AC_CHECK_FUNCS([cosl sinl tanl], [], [AC_MSG_ERROR([long-double precision requires long-double trigonometric routines])])
Chris@19 422 fi
Chris@19 423
Chris@19 424 AC_MSG_CHECKING([for isnan])
Chris@19 425 AC_TRY_LINK([#include <math.h>
Chris@19 426 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
Chris@19 427 if test "$ok" = "yes"; then
Chris@19 428 AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
Chris@19 429 fi
Chris@19 430 AC_MSG_RESULT(${ok})
Chris@19 431
Chris@19 432 dnl TODO
Chris@19 433 AX_GCC_ALIGNS_STACK()
Chris@19 434
Chris@19 435 dnl override CFLAGS selection when debugging
Chris@19 436 if test "${enable_debug}" = "yes"; then
Chris@19 437 CFLAGS="-g"
Chris@19 438 fi
Chris@19 439
Chris@19 440 dnl add gcc warnings, in debug/maintainer mode only
Chris@19 441 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
Chris@19 442 if test "$ac_test_CFLAGS" != "set"; then
Chris@19 443 if test $ac_cv_prog_gcc = yes; then
Chris@19 444 CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs" # -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations
Chris@19 445 fi
Chris@19 446 fi
Chris@19 447 fi
Chris@19 448
Chris@19 449 dnl -----------------------------------------------------------------------
Chris@19 450
Chris@19 451 AC_ARG_ENABLE(fortran, [AC_HELP_STRING([--disable-fortran],[don't include Fortran-callable wrappers])], enable_fortran=$enableval, enable_fortran=yes)
Chris@19 452
Chris@19 453 if test "$enable_fortran" = "yes"; then
Chris@19 454 AC_PROG_F77
Chris@19 455 if test -z "$F77"; then
Chris@19 456 enable_fortran=no
Chris@19 457 AC_MSG_WARN([*** Couldn't find f77 compiler; using default Fortran wrappers.])
Chris@19 458 else
Chris@19 459 AC_F77_DUMMY_MAIN([], [enable_fortran=no
Chris@19 460 AC_MSG_WARN([*** Couldn't figure out how to link C and Fortran; using default Fortran wrappers.])])
Chris@19 461 fi
Chris@19 462 else
Chris@19 463 AC_DEFINE([DISABLE_FORTRAN], 1, [Define to disable Fortran wrappers.])
Chris@19 464 fi
Chris@19 465
Chris@19 466 if test "x$enable_fortran" = xyes; then
Chris@19 467 AC_F77_WRAPPERS
Chris@19 468 AC_F77_FUNC(f77foo)
Chris@19 469 AC_F77_FUNC(f77_foo)
Chris@19 470 f77_foo2=`echo $f77foo | sed 's/77/77_/'`
Chris@19 471 if test "$f77_foo" = "$f77_foo2"; then
Chris@19 472 AC_DEFINE(F77_FUNC_EQUIV, 1, [Define if F77_FUNC and F77_FUNC_ are equivalent.])
Chris@19 473
Chris@19 474 # Include g77 wrappers by default for GNU systems or gfortran
Chris@19 475 with_g77_wrappers=$ac_cv_f77_compiler_gnu
Chris@19 476 case $host_os in *gnu*) with_g77_wrappers=yes ;; esac
Chris@19 477 fi
Chris@19 478 else
Chris@19 479 with_g77_wrappers=no
Chris@19 480 fi
Chris@19 481
Chris@19 482 AC_ARG_WITH(g77-wrappers, [AC_HELP_STRING([--with-g77-wrappers],[force inclusion of g77-compatible wrappers in addition to any other Fortran compiler that is detected])], with_g77_wrappers=$withval)
Chris@19 483 if test "x$with_g77_wrappers" = "xyes"; then
Chris@19 484 AC_DEFINE(WITH_G77_WRAPPERS,1,[Include g77-compatible wrappers in addition to any other Fortran wrappers.])
Chris@19 485 fi
Chris@19 486
Chris@19 487 dnl -----------------------------------------------------------------------
Chris@19 488 have_smp="no"
Chris@19 489 AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],[use OpenMP directives for parallelism])], enable_openmp=$enableval, enable_openmp=no)
Chris@19 490
Chris@19 491 if test "$enable_openmp" = "yes"; then
Chris@19 492 AC_DEFINE(HAVE_OPENMP,1,[Define to enable OpenMP])
Chris@19 493 AX_OPENMP([], [AC_MSG_ERROR([don't know how to enable OpenMP])])
Chris@19 494 fi
Chris@19 495
Chris@19 496 AC_ARG_ENABLE(threads, [AC_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no)
Chris@19 497
Chris@19 498 if test "$enable_threads" = "yes"; then
Chris@19 499 AC_DEFINE(HAVE_THREADS,1,[Define to enable SMP threads])
Chris@19 500 fi
Chris@19 501
Chris@19 502 AC_ARG_WITH(combined-threads, [AC_HELP_STRING([--with-combined-threads],[combine threads into main libfftw3])], with_combined_threads=$withval, with_combined_threads=no)
Chris@19 503
Chris@19 504 if test "$with_combined_threads" = yes; then
Chris@19 505 if test "$enable_openmp" = "yes"; then
Chris@19 506 AC_MSG_ERROR([--with-combined-threads incompatible with --enable-openmp])
Chris@19 507 fi
Chris@19 508 if test "$enable_threads" != "yes"; then
Chris@19 509 AC_MSG_ERROR([--with-combined-threads requires --enable-threads])
Chris@19 510 fi
Chris@19 511 fi
Chris@19 512
Chris@19 513 dnl Check for threads library...
Chris@19 514 THREADLIBS=""
Chris@19 515 if test "$enable_threads" = "yes"; then
Chris@19 516 # Win32 threads are the default on Windows:
Chris@19 517 if test -z "$THREADLIBS"; then
Chris@19 518 AC_MSG_CHECKING([for Win32 threads])
Chris@19 519 AC_TRY_LINK([#include <windows.h>],
Chris@19 520 [_beginthreadex(0,0,0,0,0,0);],
Chris@19 521 [THREADLIBS=" "; AC_MSG_RESULT(yes)],
Chris@19 522 [AC_MSG_RESULT(no)])
Chris@19 523 fi
Chris@19 524
Chris@19 525 # POSIX threads, the default choice everywhere else:
Chris@19 526 if test -z "$THREADLIBS"; then
Chris@19 527 ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
Chris@19 528 CC="$PTHREAD_CC"
Chris@19 529 AC_DEFINE(USING_POSIX_THREADS, 1, [Define if we have and are using POSIX threads.])])
Chris@19 530 fi
Chris@19 531
Chris@19 532 if test -z "$THREADLIBS"; then
Chris@19 533 AC_MSG_ERROR([couldn't find threads library for --enable-threads])
Chris@19 534 fi
Chris@19 535 AC_DEFINE(HAVE_THREADS, 1, [Define if we have a threads library.])
Chris@19 536 fi
Chris@19 537 AC_SUBST(THREADLIBS)
Chris@19 538 AM_CONDITIONAL(THREADS, test "$enable_threads" = "yes")
Chris@19 539 AM_CONDITIONAL(OPENMP, test "$enable_openmp" = "yes")
Chris@19 540 AM_CONDITIONAL(SMP, test "$enable_threads" = "yes" -o "$enable_openmp" = "yes")
Chris@19 541 AM_CONDITIONAL(COMBINED_THREADS, test x"$with_combined_threads" = xyes)
Chris@19 542
Chris@19 543 dnl -----------------------------------------------------------------------
Chris@19 544
Chris@19 545 AC_MSG_CHECKING([whether a cycle counter is available])
Chris@19 546 save_CPPFLAGS=$CPPFLAGS
Chris@19 547 CPPFLAGS="$CPPFLAGS -I$srcdir/kernel"
Chris@19 548 AC_TRY_CPP([#include "cycle.h"
Chris@19 549 #ifndef HAVE_TICK_COUNTER
Chris@19 550 # error No cycle counter
Chris@19 551 #endif], [ok=yes], [ok=no])
Chris@19 552 CPPFLAGS=$save_CPPFLAGS
Chris@19 553 AC_MSG_RESULT($ok)
Chris@19 554 if test $ok = no && test "x$with_slow_timer" = xno; then
Chris@19 555 echo "***************************************************************"
Chris@19 556 echo "WARNING: No cycle counter found. FFTW will use ESTIMATE mode "
Chris@19 557 echo " for all plans. See the manual for more information."
Chris@19 558 echo "***************************************************************"
Chris@19 559 fi
Chris@19 560
Chris@19 561 dnl -----------------------------------------------------------------------
Chris@19 562
Chris@19 563 AC_DEFINE_UNQUOTED(FFTW_CC, "$CC $CFLAGS", [C compiler name and flags])
Chris@19 564
Chris@19 565 AC_CONFIG_FILES([
Chris@19 566 Makefile
Chris@19 567 support/Makefile
Chris@19 568 genfft/Makefile
Chris@19 569 kernel/Makefile
Chris@19 570 simd-support/Makefile
Chris@19 571
Chris@19 572 dft/Makefile
Chris@19 573 dft/scalar/Makefile
Chris@19 574 dft/scalar/codelets/Makefile
Chris@19 575 dft/simd/Makefile
Chris@19 576 dft/simd/common/Makefile
Chris@19 577 dft/simd/sse2/Makefile
Chris@19 578 dft/simd/avx/Makefile
Chris@19 579 dft/simd/altivec/Makefile
Chris@19 580 dft/simd/neon/Makefile
Chris@19 581
Chris@19 582 rdft/Makefile
Chris@19 583 rdft/scalar/Makefile
Chris@19 584 rdft/scalar/r2cf/Makefile
Chris@19 585 rdft/scalar/r2cb/Makefile
Chris@19 586 rdft/scalar/r2r/Makefile
Chris@19 587 rdft/simd/Makefile
Chris@19 588 rdft/simd/common/Makefile
Chris@19 589 rdft/simd/sse2/Makefile
Chris@19 590 rdft/simd/avx/Makefile
Chris@19 591 rdft/simd/altivec/Makefile
Chris@19 592 rdft/simd/neon/Makefile
Chris@19 593
Chris@19 594 reodft/Makefile
Chris@19 595
Chris@19 596 threads/Makefile
Chris@19 597
Chris@19 598 api/Makefile
Chris@19 599
Chris@19 600 mpi/Makefile
Chris@19 601
Chris@19 602 libbench2/Makefile
Chris@19 603 tests/Makefile
Chris@19 604 doc/Makefile
Chris@19 605 doc/FAQ/Makefile
Chris@19 606
Chris@19 607 tools/Makefile
Chris@19 608 tools/fftw_wisdom.1
Chris@19 609 tools/fftw-wisdom-to-conf
Chris@19 610
Chris@19 611 m4/Makefile
Chris@19 612
Chris@19 613 fftw.pc
Chris@19 614 ])
Chris@19 615
Chris@19 616 AC_OUTPUT