aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-08-24 18:46:25 -0700
committerThomas White <taw@physics.org>2012-02-22 15:27:37 +0100
commit819a380195c63640e1f95058dc73596259ee49f5 (patch)
tree49078511ee686dddf38413a544a3a5de3d66e69a
parent3942b5dcae527b696e243ce6f7771cbb4ba6c907 (diff)
Improve check for FFTW
-rw-r--r--Makefile.in2
-rw-r--r--config.h.in2
-rwxr-xr-xconfigure113
-rw-r--r--configure.ac9
-rw-r--r--doc/reference/Makefile.in2
-rw-r--r--lib/Makefile.in2
6 files changed, 84 insertions, 46 deletions
diff --git a/Makefile.in b/Makefile.in
index 245041db..bdbe7bfd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -460,6 +460,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFTW_CFLAGS = @FFTW_CFLAGS@
+FFTW_LIBS = @FFTW_LIBS@
GDK_pixbuf_2_CFLAGS = @GDK_pixbuf_2_CFLAGS@
GDK_pixbuf_2_LIBS = @GDK_pixbuf_2_LIBS@
GDK_pixbuf_CFLAGS = @GDK_pixbuf_CFLAGS@
diff --git a/config.h.in b/config.h.in
index b09f25d8..4a1d38f0 100644
--- a/config.h.in
+++ b/config.h.in
@@ -38,7 +38,7 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if FFTW is available. */
+/* Define to 1 if FFTW is available */
#undef HAVE_FFTW
/* Define to 1 if you have the `forkpty' function. */
diff --git a/configure b/configure
index 569d2a6b..b7f111b8 100755
--- a/configure
+++ b/configure
@@ -626,6 +626,8 @@ BUILD_HDFSEE_FALSE
BUILD_HDFSEE_TRUE
HAVE_OPENCL_FALSE
HAVE_OPENCL_TRUE
+FFTW_LIBS
+FFTW_CFLAGS
GDK_pixbuf_2_LIBS
GDK_pixbuf_2_CFLAGS
GDK_pixbuf_LIBS
@@ -861,7 +863,9 @@ Cairo_LIBS
GDK_pixbuf_CFLAGS
GDK_pixbuf_LIBS
GDK_pixbuf_2_CFLAGS
-GDK_pixbuf_2_LIBS'
+GDK_pixbuf_2_LIBS
+FFTW_CFLAGS
+FFTW_LIBS'
# Initialize some variables set by options.
@@ -1537,6 +1541,8 @@ Some influential environment variables:
C compiler flags for GDK_pixbuf_2, overriding pkg-config
GDK_pixbuf_2_LIBS
linker flags for GDK_pixbuf_2, overriding pkg-config
+ FFTW_CFLAGS C compiler flags for FFTW, overriding pkg-config
+ FFTW_LIBS linker flags for FFTW, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -7539,59 +7545,88 @@ fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw_plan_dft_r2c_1d in -lfftw3" >&5
-$as_echo_n "checking for fftw_plan_dft_r2c_1d in -lfftw3... " >&6; }
-if test "${ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfftw3 $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char fftw_plan_dft_r2c_1d ();
-int
-main ()
-{
-return fftw_plan_dft_r2c_1d ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d=yes
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFTW" >&5
+$as_echo_n "checking for FFTW... " >&6; }
+
+if test -n "$FFTW_CFLAGS"; then
+ pkg_cv_FFTW_CFLAGS="$FFTW_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fftw3\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fftw3") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FFTW_CFLAGS=`$PKG_CONFIG --cflags "fftw3" 2>/dev/null`
else
- ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d=no
+ pkg_failed=yes
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ else
+ pkg_failed=untried
+fi
+if test -n "$FFTW_LIBS"; then
+ pkg_cv_FFTW_LIBS="$FFTW_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fftw3\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fftw3") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FFTW_LIBS=`$PKG_CONFIG --libs "fftw3" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d" >&5
-$as_echo "$ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d" >&6; }
-if test "x$ac_cv_lib_fftw3_fftw_plan_dft_r2c_1d" = x""yes; then :
-$as_echo "#define HAVE_FFTW 1" >>confdefs.h
- FFTW_LIBS="-lfftw3"
- have_fftw=true
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ FFTW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fftw3" 2>&1`
+ else
+ FFTW_PKG_ERRORS=`$PKG_CONFIG --print-errors "fftw3" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$FFTW_PKG_ERRORS" >&5
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ReAx indexing will not be available." >&5
$as_echo "$as_me: WARNING: ReAx indexing will not be available." >&2;}
have_fftw=false
-fi
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ReAx indexing will not be available." >&5
+$as_echo "$as_me: WARNING: ReAx indexing will not be available." >&2;}
+ have_fftw=false
+else
+ FFTW_CFLAGS=$pkg_cv_FFTW_CFLAGS
+ FFTW_LIBS=$pkg_cv_FFTW_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+ have_fftw=true
+$as_echo "#define HAVE_FFTW 1" >>confdefs.h
+
+
+fi
if test x$have_opencl = xtrue; then
HAVE_OPENCL_TRUE=
@@ -7702,7 +7737,7 @@ $as_echo "$gl_cv_prog_c_ignore_unused_libraries" >&6; }
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
-CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
+CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS $FFTW_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
diff --git a/configure.ac b/configure.ac
index 01a89553..9f5ab51b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,18 +230,15 @@ AC_CHECK_LIB([rt], [clock_gettime],
])
-AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c_1d],
+PKG_CHECK_MODULES([FFTW], [fftw3],
[
- AC_DEFINE([HAVE_FFTW], [1],
- [Define to 1 if FFTW is available.])
- FFTW_LIBS="-lfftw3"
have_fftw=true
+ AC_DEFINE([HAVE_FFTW], [1], [Define to 1 if FFTW is available])
], [
AC_MSG_WARN([ReAx indexing will not be available.])
have_fftw=false
])
-
dnl Conditionals...
AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue)
@@ -261,7 +258,7 @@ gl_IGNORE_UNUSED_LIBRARIES
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
-CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
+CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS $FFTW_CFLAGS"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
diff --git a/doc/reference/Makefile.in b/doc/reference/Makefile.in
index 1e22250d..f81c0504 100644
--- a/doc/reference/Makefile.in
+++ b/doc/reference/Makefile.in
@@ -91,6 +91,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFTW_CFLAGS = @FFTW_CFLAGS@
+FFTW_LIBS = @FFTW_LIBS@
GDK_pixbuf_2_CFLAGS = @GDK_pixbuf_2_CFLAGS@
GDK_pixbuf_2_LIBS = @GDK_pixbuf_2_LIBS@
GDK_pixbuf_CFLAGS = @GDK_pixbuf_CFLAGS@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 820c9948..c80e4442 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -165,6 +165,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFTW_CFLAGS = @FFTW_CFLAGS@
+FFTW_LIBS = @FFTW_LIBS@
GDK_pixbuf_2_CFLAGS = @GDK_pixbuf_2_CFLAGS@
GDK_pixbuf_2_LIBS = @GDK_pixbuf_2_LIBS@
GDK_pixbuf_CFLAGS = @GDK_pixbuf_CFLAGS@