annotate src/fftw-3.3.3/configure.ac @ 10:37bf6b4a2645

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