File: configure.in

package info (click to toggle)
fftw 2.1.3-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,892 kB
  • ctags: 4,501
  • sloc: ansic: 63,617; sh: 7,559; ml: 3,171; perl: 2,894; makefile: 451; fortran: 79
file content (383 lines) | stat: -rw-r--r-- 12,839 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
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 <math.h>
], 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 <sys/time.h>
#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.h>],
			    [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 <pthread.h>], 
                            [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.h>
		], 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