dnl Process this file with autoconf to produce a configure script. AC_INIT(fftw/planner.c) AM_INIT_AUTOMAKE(fftw, 2.1.3) dnl This is the version info according to the libtool versioning system. dnl It does *not* correspond to the release number. SHARED_VERSION_INFO="2:5:0" AM_CONFIG_HEADER(fftw/config.h fftw/fftw.h) AM_ENABLE_SHARED(no) dnl ----------------------------------------------------------------------- AC_ARG_ENABLE(threads, [ --enable-threads compile FFTW SMP threads library], enable_threads=$enableval, enable_threads=no) AC_ARG_ENABLE(mpi, [ --enable-mpi compile FFTW MPI library], enable_mpi=$enableval, enable_mpi=no) AC_ARG_ENABLE(fortran, [ --disable-fortran don't include fortran-callable wrappers], enable_fortran=$enableval, enable_fortran=yes) AC_ARG_WITH(gcc, [ --with-gcc use gcc instead of the native compiler cc], ok=$withval, ok=no) if test "$ok" = "yes"; then CC=gcc fi AC_ARG_ENABLE(float, [ --enable-float compile fftw for single precision], enable_float=$enableval, enable_float=no) if test "$enable_float" = "yes"; then AC_DEFINE(FFTW_ENABLE_FLOAT) fi FFTW_PREFIX="" AC_ARG_ENABLE(type-prefix, [ --enable-type-prefix prefix files with d/s to indicate precision], ok=$enableval, ok=no) AC_MSG_CHECKING([type prefix for installed files]) if test "$ok" = "yes"; then if test "$enable_float" = "yes"; then FFTW_PREFIX="s" else FFTW_PREFIX="d" fi AC_MSG_RESULT($FFTW_PREFIX) elif test "$ok" = "no"; then AC_MSG_RESULT([(none)]) else FFTW_PREFIX="$ok" AC_MSG_RESULT($FFTW_PREFIX) fi ACX_SUBST_XXX(FFTW_PREFIX) AC_SUBST(FFTW_PREFIX) FFTW_PREFIX1="xyz" if test -n "$FFTW_PREFIX"; then FFTW_PREFIX1="$FFTW_PREFIX" fi ACX_SUBST_XXX(FFTW_PREFIX1) AC_ARG_ENABLE(i386-hacks, [ --enable-i386-hacks enable gcc/x86 specific performance hacks], ok=$enableval, ok=no) if test "$ok" = "yes"; then AC_DEFINE(FFTW_ENABLE_I386_HACKS) fi AC_ARG_ENABLE(pentium-timer, [ --enable-pentium-timer enable high resolution Pentium timer], ok=$enableval, ok=no) if test "$ok" = "yes"; then AC_DEFINE(FFTW_ENABLE_PENTIUM_TIMER) fi AC_ARG_ENABLE(debug, [ --enable-debug compile fftw with extra runtime checks for debugging], ok=$enableval, ok=no) if test "$ok" = "yes"; then AC_DEFINE(FFTW_DEBUG) fi AC_ARG_ENABLE(debug-alignment, [ --enable-debug-alignment enable runtime checks for alignment on x86], ok=$enableval, ok=no) if test "$ok" = "yes"; then AC_DEFINE(FFTW_DEBUG_ALIGNMENT) fi AC_ARG_ENABLE(vec-recurse, [ --enable-vec-recurse enable experimental performance hack], ok=$enableval, ok=no) if test "$ok" = "yes"; then AC_DEFINE(FFTW_ENABLE_VECTOR_RECURSE) fi dnl ----------------------------------------------------------------------- # Use native cc if present AC_MSG_CHECKING([for vendor's cc to be used instead of gcc]) AC_CHECK_PROG(CC, cc, cc) dnl Checks for programs. AC_PROG_CC ACX_PROG_CC_EGCS AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_LN_S AM_PROG_LIBTOOL AC_CHECK_PROG(PERL, perl, perl, echo perl) AC_SUBST(PERL) dnl ----------------------------------------------------------------------- if test "$enable_fortran" = "yes"; then AC_CHECK_PROGS(F77, f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90) if test -z "$F77"; then echo "*** Couldn't find f77 compiler. Switching to --disable-fortran." enable_fortran="no" fi fi if test "$enable_fortran" = "yes"; then ACX_F77_FUNC_MANGLE fi dnl ----------------------------------------------------------------------- AC_SUBST(SHARED_VERSION_INFO) AC_DEFINE_UNQUOTED(FFTW_VERSION, "$VERSION") # Get the version number that will be appended to shared libraries: SHARED_VERSION=`echo $SHARED_VERSION_INFO | awk -F':' '{ print $1 "." $3 "." $2 }'` AC_SUBST(SHARED_VERSION) ACX_PROG_CC_MAXOPT ACX_GCC_ALIGNS_STACK(AC_DEFINE(FFTW_GCC_ALIGNS_STACK), [ if test "$enable_i386_hacks" = yes; then if test "${acx_gcc_stack_align_bug-no}" = yes; then # we are using a gcc with a stack alignment bug, and we should # turn stack alignment off so that our own hacks work instead. ACX_CHECK_CC_FLAGS(-mpreferred-stack-boundary=2, m_psb_2, [CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"], AC_MSG_ERROR([can't disable buggy stack alignment])) fi fi]) if test "${enable_debug}" = "yes"; then CFLAGS="-g" fi dnl Checks for libraries. AC_CHECK_LIB(m, sqrt) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(sys/time.h unistd.h getopt.h malloc.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME if test $ac_cv_c_const = no; then echo "**************************************************************" echo "* WARNING: The "'``'"const'' keyword does not appear to work *" echo "* properly on this system. Expect problems. *" echo "* (It's >= 1998. Get an ANSI C compiler.) *" case "${host_cpu}-${host_os}" in sparc-solaris2*) echo "* Maybe you are using the wrong C compiler. Please see the *" echo "* FFTW FAQ for more information. *" ;; esac echo "**************************************************************" fi dnl Checks for library functions. AC_FUNC_ALLOCA AC_CHECK_FUNCS(gettimeofday) AC_CHECK_FUNCS(BSDgettimeofday) AC_CHECK_FUNCS(gethrtime) AC_CHECK_FUNCS(getopt) AC_CHECK_FUNCS(getopt_long) AC_MSG_CHECKING([for isnan]) AC_TRY_LINK([#include ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no) if test "$ok" = "yes"; then AC_DEFINE(HAVE_ISNAN) fi AC_MSG_RESULT(${ok}) # Check for hrtime_t data type; some systems (AIX) seem to have # a function called gethrtime but no hrtime_t! AC_MSG_CHECKING([for hrtime_t]) AC_TRY_LINK([ #ifdef HAVE_SYS_TIME_H #include #endif ], [hrtime_t foobar;], ok=yes, ok=no) if test "$ok" = "yes"; then AC_DEFINE(HAVE_HRTIME_T) fi AC_MSG_RESULT(${ok}) AC_CHECK_SIZEOF(int, 0) AC_CHECK_SIZEOF(long long, 0) AC_ARG_ENABLE(unsafe-mulmod, [ --enable-unsafe-mulmod risk overflow for large prime sizes], enable_unsafe_mulmod=$enableval, enable_unsafe_mulmod=no) if test "$enable_unsafe_mulmod" = "yes"; then AC_DEFINE(FFTW_ENABLE_UNSAFE_MULMOD) fi dnl make a couple of jokes for user's amusement. See gcc/future.options in dnl egcs distribution ACX_CHECK_CC_FLAGS("-fkeep-programmers-inline",fkeep_programmers_inline) ACX_CHECK_CC_FLAGS("-vomit-frame-pointer",vomit_frame_pointer) dnl ----------------------------------------------------------------------- dnl Check for threads library... FFTW_THREADS_LIBLIST="" FFTW_THREADS_INCLUDELIST="" FFTW_THREADS_PROGLIST="" THREADLIBS="" if test "$enable_threads" = "yes"; then # POSIX threads are the default choice: # POSIX threads library is plural on AIX (need to check for # this *first* due to AIX brokenness; also, need to check # for pthread_attr_init instead of pthread_create due to # DEC stupidity): if test -z "$THREADLIBS"; then AC_CHECK_LIB(pthreads, pthread_attr_init, [THREADLIBS="-lpthreads" AC_DEFINE(FFTW_USING_POSIX_THREADS)]) fi # Normally (e.g. on Linux), POSIX threads are in -lpthread. # We can't just use AC_CHECK_LIB, though, because DEC lossage # requires that pthread.h be included for linking to work. if test -z "$THREADLIBS"; then AC_MSG_CHECKING([for pthread_create in -lpthread]) save_LIBS="$LIBS" LIBS="-lpthread $LIBS" AC_TRY_LINK([#include ], [pthread_create(0,0,0,0);], ok=yes, ok=no) LIBS="$save_LIBS" if test "$ok" = "yes"; then THREADLIBS="-lpthread" AC_DEFINE(FFTW_USING_POSIX_THREADS) fi AC_MSG_RESULT(${ok}) fi # this is for irix, which has pthread_create in libc.so # and pthread_join in libpthread.so. Lose, lose, lose if test -z "$THREADLIBS"; then AC_CHECK_LIB(pthread, pthread_join, [THREADLIBS="-lpthread" AC_DEFINE(FFTW_USING_POSIX_THREADS)]) fi if test -z "$THREADLIBS"; then AC_CHECK_FUNC(pthread_create, [THREADLIBS=" " AC_DEFINE(FFTW_USING_POSIX_THREADS)]) fi if test -n "$THREADLIBS"; then # detect AIX lossage: threads are created detached by default # & the JOINABLE attribute has a nonstandard name (UNDETACHED). AC_MSG_CHECKING([for PTHREAD_CREATE_UNDETACHED attribute]) AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_UNDETACHED;], ok=yes, ok=no) if test "$ok" = "yes"; then AC_DEFINE(HAVE_PTHREAD_CREATE_UNDETACHED) fi AC_MSG_RESULT(${ok}) # more AIX lossage: must compile with cc_r AC_CHECK_PROG(CCthreads, cc_r, cc_r, ${CC}) CC="$CCthreads" # more AIX/DEC lossage: must compile with -D_THREAD_SAFE # or -D_REENTRANT: # (cc_r subsumes this on AIX, but it doesn't hurt to # do this as well, especially if cc_r is not available.) AC_MSG_CHECKING([if special flags are required for pthreads]) ok=no AC_REQUIRE([AC_CANONICAL_HOST]) case "${host_cpu}-${host_os}" in *-aix*) CFLAGS="-D_THREAD_SAFE $CFLAGS" ok="-D_THREAD_SAFE";; alpha*-osf*) CFLAGS="-D_REENTRANT $CFLAGS" ok="-D_REENTRANT";; esac AC_MSG_RESULT(${ok}) fi # Solaris threads: if test -z "$THREADLIBS"; then AC_CHECK_LIB(thread, thr_create, [THREADLIBS="-lthread" AC_DEFINE(FFTW_USING_SOLARIS_THREADS)]) fi # Mach C threads: if test -z "$THREADLIBS"; then AC_CHECK_FUNC(cthread_fork, [THREADLIBS=" " AC_DEFINE(FFTW_USING_MACH_THREADS)]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi if test -z "$THREADLIBS"; then AC_CHECK_LIB(cthread, cthread_fork, [THREADLIBS="-lcthread" AC_DEFINE(FFTW_USING_MACH_THREADS)]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi if test -z "$THREADLIBS"; then AC_CHECK_LIB(cthreads, cthread_fork, [THREADLIBS="-lcthreads" AC_DEFINE(FFTW_USING_MACH_THREADS)]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi # BeOS threads: if test -z "$THREADLIBS"; then AC_CHECK_FUNC(spawn_thread, [THREADLIBS=" " AC_DEFINE(FFTW_USING_BEOS_THREADS)]) fi if test -z "$THREADLIBS"; then AC_MSG_ERROR(couldn't find threads library for --enable-threads) else FFTW_THREADS_LIBLIST="lib${FFTW_PREFIX}fftw_threads.la lib${FFTW_PREFIX}rfftw_threads.la" FFTW_THREADS_INCLUDELIST="${FFTW_PREFIX}fftw_threads.h ${FFTW_PREFIX}rfftw_threads.h" FFTW_THREADS_PROGLIST="fftw_threads_test rfftw_threads_test" fi fi AC_SUBST(FFTW_THREADS_LIBLIST) AC_SUBST(FFTW_THREADS_INCLUDELIST) AC_SUBST(FFTW_THREADS_PROGLIST) AC_SUBST(THREADLIBS) dnl ----------------------------------------------------------------------- dnl Check for mpi library... FFTW_MPI_LIBLIST="" FFTW_MPI_INCLUDELIST="" FFTW_MPI_PROGLIST="" MPILIBS="" AC_CHECK_PROGS(MPICC, mpicc hcc, $CC) if test "$enable_mpi" = "yes"; then save_CC="$CC" CC="$MPICC" if test -z "$MPILIBS"; then AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "]) fi if test -z "$MPILIBS"; then AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) fi if test -z "$MPILIBS"; then AC_MSG_ERROR(couldn't find mpi library for --enable-mpi) else FFTW_MPI_LIBLIST="lib${FFTW_PREFIX}fftw_mpi.la lib${FFTW_PREFIX}rfftw_mpi.la" FFTW_MPI_INCLUDELIST="${FFTW_PREFIX}fftw_mpi.h ${FFTW_PREFIX}rfftw_mpi.h" FFTW_MPI_PROGLIST="test_sched test_transpose_mpi fftw_mpi_test rfftw_mpi_test" AC_MSG_CHECKING([for MPI_Comm_f2c]) ok=yes AC_TRY_LINK([#include ], MPI_Comm_f2c(0);, AC_DEFINE(HAVE_MPI_COMM_F2C), ok=no) AC_MSG_RESULT($ok) fi CC="$save_CC" fi AC_SUBST(FFTW_MPI_LIBLIST) AC_SUBST(FFTW_MPI_INCLUDELIST) AC_SUBST(FFTW_MPI_PROGLIST) AC_SUBST(MPILIBS) dnl ----------------------------------------------------------------------- AC_OUTPUT(fftw/Makefile tests/Makefile rfftw/Makefile doc/Makefile Makefile threads/Makefile mpi/Makefile fftw.spec) case "${host_cpu}" in i?86) if test "${enable_i386_hacks-no}" != "yes"; then if test "${enable_float-no}" != "yes"; then if test "${acx_gcc_aligns_stack-no}" != "yes"; then echo "**************************************************************" echo "* If you are running an x86 system with gcc, also try *" echo "* configure --enable-i386-hacks *" echo "* which might produce significant speed improvements. *" echo "* (See the Installation chapter of the manual for more *" echo "* details) *" echo "**************************************************************" fi fi fi esac