comparison m4/acinclude.m4 @ 15969:139f4b19a3ac

build: Improve detection of FFTW multi-threading * build-aux/common.mk: Remove FFTW3_THREADS_LIBS and FFTW3F_THREADS_LIB. * m4/acinclude.m4 (OCTAVE_CHECK_FFTW_THREADS): New macro to encapsulate checking for multi-threading support in the FFTW library. * configure.ac: Call it.
author Mike Miller <mtmiller@ieee.org>
date Mon, 21 Jan 2013 01:58:07 -0500
parents b316429bfa89
children ca37c6023a79
comparison
equal deleted inserted replaced
15966:d56dd6794a20 15969:139f4b19a3ac
89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) 89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
90 else 90 else
91 AC_MSG_RESULT([no]) 91 AC_MSG_RESULT([no])
92 ifelse([$3], , , [$3]) 92 ifelse([$3], , , [$3])
93 fi 93 fi
94 ])
95 dnl
96 dnl Check whether the FFTW library supports multi-threading. This macro
97 dnl should be called once per FFTW precision passing in the library
98 dnl variant (e.g. "fftw3") and a function in the thread support API
99 dnl (e.g. "fftw_plan_with_nthreads"). Depending on how FFTW was built,
100 dnl the thread functions could be compiled into the main FFTW library or
101 dnl could be a separate add-on library that is passed to the linker
102 dnl ahead of the main FFTW library.
103 dnl
104 AC_DEFUN([OCTAVE_CHECK_FFTW_THREADS], [
105 ac_octave_save_CPPFLAGS="$CPPFLAGS"
106 ac_octave_save_LDFLAGS="$LDFLAGS"
107 ac_octave_save_LIBS="$LIBS"
108 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
109 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
110 LIBS="$m4_toupper([$1])_LIBS $LIBS"
111 AC_CACHE_CHECK([for $1 multi-threading support],
112 [octave_cv_[$1]_threads_lib],
113 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
114 #include <fftw3.h>
115 ]], [[
116 $2 (2);
117 ]])],
118 [octave_cv_[$1]_threads_lib=yes],
119 [LIBS="-l[$1]_threads $LIBS"
120 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
121 #include <fftw3.h>
122 ]], [[
123 $2 (2);
124 ]])],
125 [octave_cv_[$1]_threads_lib="-l[$1]_threads"],
126 [octave_cv_[$1]_threads_lib=no])
127 ])
128 ])
129 case $octave_cv_[$1]_threads_lib in
130 -l*)
131 m4_toupper([$1])_LIBS="$octave_cv_[$1]_threads_lib $m4_toupper([$1])_LIBS"
132 ;;
133 no)
134 AC_MSG_WARN([No $1 multi-threading support found.])
135 AC_MSG_WARN([The single-threaded library will be used instead.])
136 ;;
137 esac
138 if test $octave_cv_[$1]_threads_lib != no; then
139 AC_DEFINE([HAVE_]m4_toupper([$1])[_THREADS], 1,
140 [Define to 1 if ]m4_toupper([$1])[ has multi-threading support.])
141 fi
142 CPPFLAGS="$ac_octave_save_CPPFLAGS"
143 LDFLAGS="$ac_octave_save_LDFLAGS"
144 LIBS="$ac_octave_save_LIBS"
94 ]) 145 ])
95 dnl 146 dnl
96 dnl Check whether a math mapper function is available in <cmath>. 147 dnl Check whether a math mapper function is available in <cmath>.
97 dnl Will define HAVE_CMATH_FUNC if there is a double variant and 148 dnl Will define HAVE_CMATH_FUNC if there is a double variant and
98 dnl HAVE_CMATH_FUNCF if there is a float variant. 149 dnl HAVE_CMATH_FUNCF if there is a float variant.