Mercurial > hg > octave-lojdl
changeset 9523:0ce82753dd72
more configure changes for libraries
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Aug 2009 18:20:31 -0400 |
parents | e79470be3ecb |
children | ace0febd263e |
files | ChangeLog Makeconf.in aclocal.m4 configure.in liboctave/CMatrix.cc liboctave/CNDArray.cc liboctave/ChangeLog liboctave/Makefile.in liboctave/dMatrix.cc liboctave/dNDArray.cc liboctave/fCMatrix.cc liboctave/fCNDArray.cc liboctave/fMatrix.cc liboctave/fNDArray.cc liboctave/oct-fftw.cc liboctave/oct-fftw.h src/ChangeLog src/DLD-FUNCTIONS/fft.cc src/DLD-FUNCTIONS/fft2.cc src/DLD-FUNCTIONS/fftn.cc src/DLD-FUNCTIONS/fftw.cc src/Makefile.in src/oct-conf.h.in src/toplev.cc |
diffstat | 24 files changed, 554 insertions(+), 358 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2009-08-13 John W. Eaton <jwe@octave.org> + + * Makeconf.in (GLPK_CPPFLAGS, GLPK_LDFLAGS, + AMD_CPPFLAGS, AMD_LDFLAGS, CAMD_CPPFLAGS, CAMD_LDFLAGS, + CCOLAMD_CPPFLAGS, CCOLAMD_LDFLAGS, CHOLMOD_CPPFLAGS, + CHOLMOD_LDFLAGS, COLAMD_CPPFLAGS, COLAMD_LDFLAGS, + CXSPARSE_CPPFLAGS, CXSPARSE_LDFLAGS): New variables. + (do-subst-config-vals): Substitute Them. + (SPARSE_CPPFLAGS, SPARSE_LDFLAGS, SPARSE_LIBS, FFTW_CPPFLAGS, + FFTW_LDFLAGS, FFTW_LIBS): New variables. + + * configure.in: Use OCTAVE_CHECK_LIBRARY to check for GLPK, AMD, + CAMD, CCOLAMD, CHOLMOD, COLAMD, CXSPARSE, FFTW3, and FFTW3F + libraries. Print GLPK_CPPFLAGS, GLPK_LDFLAGS, AMD_CPPFLAGS, + AMD_LDFLAGS, CAMD_CPPFLAGS, CAMD_LDFLAGS, CCOLAMD_CPPFLAGS, + CCOLAMD_LDFLAGS, CHOLMOD_CPPFLAGS, CHOLMOD_LDFLAGS, + COLAMD_CPPFLAGS, COLAMD_LDFLAGS, CXSPARSE_CPPFLAGS, + CXSPARSE_LDFLAGS, FFTW3_CPPFLAGS, FFTW3_LDFLAGS, FFTW3_LIBS, + FFTW3F_CPPFLAGS, FFTW3F_LDFLAGS, and FFTW3F_LIBS in the summary. + (AH_BOTTOM): Define HAVE_FFTW if HAVE_FFTW3 and HAVE_FFTW3F are + both defined. + + * aclocal.m4 (OCTAVE_CHECK_LIBRARY): New optional arguments for + language and doc string. + 2009-08-13 Jaroslav Hajek <highegg@gmail.com> * aclocal.m4 (OCTAVE_CHECK_LIBRARY): Prepend to LIBS rather than
--- a/Makeconf.in +++ b/Makeconf.in @@ -238,20 +238,49 @@ REGEX_LIBS = @REGEX_LIBS@ BLAS_LIBS = @BLAS_LIBS@ -FFTW_LIBS = @FFTW_LIBS@ + +FFTW3_CPPFLAGS = @FFTW3_CPPFLAGS@ +FFTW3_LDFLAGS = @FFTW3_LDFLAGS@ +FFTW3_LIBS = @FFTW3_LIBS@ + +FFTW3F_CPPFLAGS = @FFTW3F_CPPFLAGS@ +FFTW3F_LDFLAGS = @FFTW3F_LDFLAGS@ +FFTW3F_LIBS = @FFTW3F_LIBS@ + +GLPK_CPPFLAGS = @GLPK_CPPFLAGS@ +GLPK_LDFLAGS = @GLPK_LDFLAGS@ GLPK_LIBS = @GLPK_LIBS@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_LIBS = @CURL_LIBS@ +AMD_CPPFLAGS = @AMD_CPPFLAGS@ +AMD_LDFLAGS = @AMD_LDFLAGS@ AMD_LIBS = @AMD_LIBS@ + +CAMD_CPPFLAGS = @CAMD_CPPFLAGS@ +CAMD_LDFLAGS = @CAMD_LDFLAGS@ CAMD_LIBS = @CAMD_LIBS@ -UMFPACK_LIBS = @UMFPACK_LIBS@ + +COLAMD_CPPFLAGS = @COLAMD_CPPFLAGS@ +COLAMD_LDFLAGS = @COLAMD_LDFLAGS@ COLAMD_LIBS = @COLAMD_LIBS@ + +CCOLAMD_CPPFLAGS = @CCOLAMD_CPPFLAGS@ +CCOLAMD_LDFLAGS = @CCOLAMD_LDFLAGS@ CCOLAMD_LIBS = @CCOLAMD_LIBS@ + +CHOLMOD_CPPFLAGS = @CHOLMOD_CPPFLAGS@ +CHOLMOD_LDFLAGS = @CHOLMOD_LDFLAGS@ CHOLMOD_LIBS = @CHOLMOD_LIBS@ + +CXSPARSE_CPPFLAGS = @CXSPARSE_CPPFLAGS@ +CXSPARSE_LDFLAGS = @CXSPARSE_LDFLAGS@ CXSPARSE_LIBS = @CXSPARSE_LIBS@ + +UMFPACK_LIBS = @UMFPACK_LIBS@ + OPENGL_LIBS = @OPENGL_LIBS@ QRUPDATE_LIBS = @QRUPDATE_LIBS@ READLINE_LIBS = @READLINE_LIBS@ @@ -260,6 +289,32 @@ DL_LIBS = @DL_LIBS@ LIBS = @LIBS@ +## Use sort to remove duplicates. +SPARSE_CPPFLAGS = \ + $(sort $(AMD_CPPFLAGS) $(CAMD_CPPFLAGS) $(COLAMD_CPPFLAGS) \ + $(CCOLAMD_CPPFLAGS) $(CHOLMOD_CPPFLAGS) $(CXSPARSE_CPPFLAGS) \ + $(UMFPACK_CPPFLAGS)) + +## Use sort to remove duplicates. +SPARSE_LDFLAGS = \ + $(sort $(AMD_LDFLAGS) $(CAMD_LDFLAGS) $(COLAMD_LDFLAGS) \ + $(CCOLAMD_LDFLAGS) $(CHOLMOD_LDFLAGS) $(CXSPARSE_LDFLAGS) \ + $(UMFPACK_LDFLAGS)) + +## FIXME -- does order matter here? +SPARSE_LIBS = \ + $(AMD_LIBS) $(CAMD_LIBS) $(COLAMD_LIBS) \ + $(CCOLAMD_LIBS) $(CHOLMOD_LIBS) $(CXSPARSE_LIBS) \ + $(UMFPACK_LIBS) + +## Use sort to remove duplicates. +FFTW_CPPFLAGS = $(sort $(FFTW3_CPPFLAGS) $(FFTW3F_CPPFLAGS)) + +## Use sort to remove duplicates. +FFTW_LDFLAGS = $(sort $(FFTW3_LDFLAGS) $(FFTW3F_LDFLAGS)) + +FFTW_LIBS = $(FFTW3_LIBS) $(FFTW3F_LIBS) + USE_64_BIT_IDX_T = @USE_64_BIT_IDX_T@ TEXINFO_COLAMD = @TEXINFO_COLAMD@ @@ -487,25 +542,37 @@ -e "s|%OCTAVE_CONF_ALL_CXXFLAGS%|\"${ALL_CXXFLAGS}\"|" \ -e "s|%OCTAVE_CONF_ALL_FFLAGS%|\"${ALL_FFLAGS}\"|" \ -e "s|%OCTAVE_CONF_ALL_LDFLAGS%|\"${ALL_LDFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_AMD_CPPFLAGS%|\"${AMD_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_AMD_LDFLAGS%|\"${AMD_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_AMD_LIBS%|\"${AMD_LIBS}\"|" \ -e "s|%OCTAVE_CONF_AR%|\"${AR}\"|" \ -e "s|%OCTAVE_CONF_ARFLAGS%|\"${ARFLAGS}\"|" \ -e "s|%OCTAVE_CONF_ARPACK_LIBS%|\"${ARPACK_LIBS}\"|" \ -e "s|%OCTAVE_CONF_BLAS_LIBS%|\"${BLAS_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_CAMD_CPPFLAGS%|\"${CAMD_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_CAMD_LDFLAGS%|\"${CAMD_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CAMD_LIBS%|\"${CAMD_LIBS}\"|" \ -e "s|%OCTAVE_CONF_CANONICAL_HOST_TYPE%|\"${canonical_host_type}\"|" \ -e "s|%OCTAVE_CONF_CARBON_LIBS%|\"${CARBON_LIBS}\"|" \ -e "s|%OCTAVE_CONF_CC%|\"${CC}\"|" \ -e "s|%OCTAVE_CONF_CC_VERSION%|\"${CC_VERSION}\"|" \ + -e "s|%OCTAVE_CONF_CCOLAMD_CPPFLAGS%|\"${CCOLAMD_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_CCOLAMD_LDFLAGS%|\"${CCOLAMD_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CCOLAMD_LIBS%|\"${CCOLAMD_LIBS}\"|" \ -e "s|%OCTAVE_CONF_CFLAGS%|\"${CFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_CHOLMOD_CPPFLAGS%|\"${CHOLMOD_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_CHOLMOD_LDFLAGS%|\"${CHOLMOD_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CHOLMOD_LIBS%|\"${CHOLMOD_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_COLAMD_CPPFLAGS%|\"${COLAMD_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_COLAMD_LDFLAGS%|\"${COLAMD_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_COLAMD_LIBS%|\"${COLAMD_LIBS}\"|" \ -e "s|%OCTAVE_CONF_CPICFLAG%|\"${CPICFLAG}\"|" \ -e "s|%OCTAVE_CONF_CPPFLAGS%|\"${CPPFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CURL_CPPFLAGS%|\"${CURL_CPPFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CURL_LDFLAGS%|\"${CURL_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CURL_LIBS%|\"${CURL_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_CXSPARSE_CPPFLAGS%|\"${CXSPARSE_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_CXSPARSE_LDFLAGS%|\"${CXSPARSE_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_CXSPARSE_LIBS%|\"${CXSPARSE_LIBS}\"|" \ -e "s|%OCTAVE_CONF_CXX%|\"${CXX}\"|" \ -e "s|%OCTAVE_CONF_CXXCPP%|\"${CXXCPP}\"|" \ @@ -523,10 +590,17 @@ -e "s|%OCTAVE_CONF_F77_FLOAT_STORE_FLAG%|\"${F77_FLOAT_STORE_FLAG}\"|" \ -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \ -e "s|%OCTAVE_CONF_FFLAGS%|\"${FFLAGS}\"|" \ - -e "s|%OCTAVE_CONF_FFTW_LIBS%|\"${FFTW_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3_CPPFLAGS%|\"${FFTW3_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3_LDFLAGS%|\"${FFTW3_LDFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3_LIBS%|\"${FFTW3_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3F_CPPFLAGS%|\"${FFTW3F_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3F_LDFLAGS%|\"${FFTW3F_LDFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_FFTW3F_LIBS%|\"${FFTW3F_LIBS}\"|" \ -e "s|%OCTAVE_CONF_FLIBS%|\"${FLIBS}\"|" \ -e "s|%OCTAVE_CONF_FPICFLAG%|\"${FPICFLAG}\"|" \ -e "s|%OCTAVE_CONF_FT2_LIBS%|\"${FT2_LIBS}\"|" \ + -e "s|%OCTAVE_CONF_GLPK_CPPFLAGS%|\"${GLPK_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_GLPK_LDFLAGS%|\"${GLPK_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_GLPK_LIBS%|\"${GLPK_LIBS}\"|" \ -e "s|%OCTAVE_CONF_GNUPLOT%|\"${GNUPLOT}\"|" \ -e "s|%OCTAVE_CONF_GRAPHICS_LIBS%|\"${GRAPHICS_LIBS}\"|" \
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -413,22 +413,25 @@ dnl dnl dnl -dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, EXTRA-CHECK) +dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, +dnl LANG, DOC-STRING, EXTRA-CHECK) AC_DEFUN(OCTAVE_CHECK_LIBRARY, [ - AC_ARG_WITH($1-includedir, + AC_ARG_WITH([$1-includedir], [AS_HELP_STRING([--with-$1-includedir=DIR], [look for $2 include files in DIR])], [m4_toupper([$1])_CPPFLAGS="-I$withval"]) AC_SUBST(m4_toupper([$1])_CPPFLAGS) - AC_ARG_WITH($1-libdir, + AC_ARG_WITH([$1-libdir], [AS_HELP_STRING([--with-$1-libdir=DIR], [look for $2 libraries in DIR])], [m4_toupper([$1])_LDFLAGS="-L$withval"]) AC_SUBST(m4_toupper([$1])_LDFLAGS) - AC_ARG_WITH($1, - [AS_HELP_STRING([--without-$1], [don't use $2])], + AC_ARG_WITH([$1], + [m4_ifblank([$7], + [AS_HELP_STRING([--without-$1], [don't use $2 library])], + [AS_HELP_STRING([--without-$1], [$7])])], with_$1=$withval, with_$1=yes) m4_toupper([$1])_LIBS= @@ -449,6 +452,7 @@ if test -n "$m4_toupper([$1])_LIBS"; then save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" + m4_ifnblank([$6], [AC_LANG_PUSH($6)]) AC_CHECK_HEADERS($4, [ save_LDFLAGS="$LDFLAGS" LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS" @@ -460,14 +464,15 @@ [octave_$1_ok=yes], [m4_toupper([$1])_LIBS=""]) AC_MSG_RESULT($octave_$1_ok) if test $octave_$1_ok = yes; then - ifelse($#, 6, [$6], [ + m4_ifblank([$8], [ warn_$1= AC_DEFINE([HAVE_]m4_toupper([$1]), 1, [Define if $2 is available.]) - [TEXINFO_]m4_toupper([$1])="@set [HAVE_]m4_toupper([$1])"]) + [TEXINFO_]m4_toupper([$1])="@set [HAVE_]m4_toupper([$1])"], [$8]) fi LIBS="$save_LIBS" LDFLAGS="$save_LDFLAGS"]) + m4_ifnblank([$6], [AC_LANG_POP($6)]) CPPFLAGS="$save_CPPFLAGS" fi AC_SUBST(m4_toupper([$1])_LIBS)
--- a/configure.in +++ b/configure.in @@ -426,7 +426,7 @@ OCTAVE_CHECK_LIBRARY(qhull, QHull, [Qhull library not found -- this will result in loss of functionality of some geometry functions.], - [qhull/qhull_a.h], [qh_qhull], + [qhull/qhull_a.h], [qh_qhull], [], [], [warn_qhull= OCTAVE_CHECK_QHULL_VERSION OCTAVE_CHECK_QHULL_OK([TEXINFO_QHULL="@set HAVE_QHULL" @@ -559,71 +559,29 @@ fi AC_SUBST(HDF5_LIBS) -# Checks for FFTW header and library. - -# subdirectories of libcruft to build if they aren't found on the system: +# Subdirectories of libcruft to build if they aren't found on the system: FFT_DIR="fftpack" AC_SUBST(FFT_DIR) -# Installed fftw library, if any. -FFTW_LIBS='' -AC_SUBST(FFTW_LIBS) +# Checks for FFTW header and library. -AC_ARG_WITH(fftw, - [AS_HELP_STRING([--without-fftw], - [use included fftpack instead of installed fftw])], - with_fftw=$withval, with_fftw=yes) +OCTAVE_CHECK_LIBRARY(fftw3, FFTW3, + [FFTW3 library not found. The slower FFTPACK library will be used instead.], + [fftw3.h], [fftw_plan_dft_1d]) -if test "$with_fftw" = yes; then - have_fftw3_header=no - with_fftw3=no - AC_CHECK_HEADER(fftw3.h, [have_fftw3_header=yes]) - if test "$have_fftw3_header" = yes; then - AC_CHECK_LIB(fftw3, fftw_plan_dft_1d, [ - AC_CHECK_LIB(fftw3f, fftwf_plan_dft_1d, [FFTW_LIBS="-lfftw3 -lfftw3f"; with_fftw3=yes])]) - fi -fi +OCTAVE_CHECK_LIBRARY(fftw3f, FFTW3F, + [FFTW3F library not found. The slower FFTPACK library will be used instead.], + [fftw3.h], [fftwf_plan_dft_1d]) -if test "$with_fftw" = yes && test "$with_fftw3" = yes; then - FFT_DIR='' - AC_DEFINE(HAVE_FFTW3, 1, [Define if the FFTW3 library is used.]) -else - warn_fftw="FFTW library not found. Octave will use the (slower) FFTPACK library instead." - AC_MSG_WARN($warn_fftw) +if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then + FFT_DIR= fi # Checks for GLPK header and library. -AC_ARG_WITH(glpk, - [AS_HELP_STRING([--without-glpk], [don't use GLPK])], - with_glpk=$withval, with_glpk=yes) - -glpk_lib= -if test "$with_glpk" = yes; then - glpk_lib="glpk" -elif test "$with_glpk" != no; then - glpk_lib="$with_glpk" -fi - -GLPK_LIBS= -if test -n "$glpk_lib"; then - AC_CHECK_HEADERS([glpk/glpk.h glpk.h], [ - AC_CHECK_LIB($glpk_lib, glp_lpx_simplex, [ - GLPK_LIBS="-l$glpk_lib" - AC_DEFINE(GLPK_PRE_4_14, 1, [Define if GLPK version is less than 4.14.])], [ - AC_CHECK_LIB($glpk_lib, _glp_lpx_simplex, [ - GLPK_LIBS="-l$glpk_lib"], [])]) - - if test -n "$GLPK_LIBS"; then - AC_DEFINE(HAVE_GLPK, 1, [Define if GLPK is available.]) - fi - break]) -fi -AC_SUBST(GLPK_LIBS) -if test -z "$GLPK_LIBS"; then - warn_glpk="GLPK library not found. The glpk function for solving linear programs will be disabled." - AC_MSG_WARN($warn_glpk) -fi +OCTAVE_CHECK_LIBRARY(glpk, GLPK, + [GLPK library not found. The glpk function for solving linear programs will be disabled.], + [glpk/glpk.h glpk.h], [_glp_lpx_simplex]) # Checks for CURL header and library. @@ -911,33 +869,56 @@ fi # Check for AMD library -AMD_LIBS= -AC_SUBST(AMD_LIBS) -AC_ARG_WITH(amd, - [AS_HELP_STRING([--without-amd], - [don't use AMD, disable some sparse functionality])], - with_amd=$withval, with_amd=yes) - -warn_amd="AMD not found. This will result in some lack of functionality for sparse matrices." -if test "$with_amd" = yes; then - with_amd=no - AC_CHECK_HEADERS([suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h], [ - AC_CHECK_LIB(amd, amd_postorder, [AMD_LIBS="-lamd"; with_amd=yes]) - if test "$with_amd" = yes; then - AC_DEFINE(HAVE_AMD, 1, [Define if the AMD library is used.]) - warn_amd= - fi - break]) -fi -if test -n "$warn_amd"; then - AC_MSG_WARN($warn_amd) -fi +OCTAVE_CHECK_LIBRARY(amd, AMD, + [AMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h], + [amd_postorder], + [], [don't use AMD library, disable some sparse functionality]) # Check for CAMD library -CAMD_LIBS= -AC_SUBST(CAMD_LIBS) -AC_CHECK_LIB(camd, camd_postorder, [CAMD_LIBS="-lcamd"; with_camd=yes],[with_camd=no]) + +OCTAVE_CHECK_LIBRARY(camd, CAMD, + [CAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/camd.h ufsparse/camd.h amd/camd.h camd.h], + [camd_postorder], + [], [don't use CAMD library, disable some sparse functionality]) + +# Check for COLAMD library + +OCTAVE_CHECK_LIBRARY(colamd, COLAMD, + [COLAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/colamd.h ufsparse/colamd.h amd/colamd.h colamd.h], + [colamd], + [], [don't use COLAMD library, disable some sparse functionality]) + +# Check for CCOLAMD library + +OCTAVE_CHECK_LIBRARY(ccolamd, CCOLAMD, + [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/ccolamd.h ufsparse/ccolamd.h amd/ccolamd.h ccolamd.h], + [ccolamd], + [], [don't use CCOLAMD library, disable some sparse functionality]) + +# Check for CHOLMOD library. If your cholmod library requires cblas, +# then you will need to configure with --with-cholmod="-lcholmod -lcblas". + +save_LIBS="$LIBS" +LIBS="$BLAS_LIBS $FLIBS $LIBS" +OCTAVE_CHECK_LIBRARY(cholmod, CHOLMOD, + [CHOLMOD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h], + [cholmod_start], + [], [don't use CHOLMOD library, disable some sparse functionality]) +LIBS="$save_LIBS" + +# Check for CXSparse library + +OCTAVE_CHECK_LIBRARY(cxsparse, CXSparse, + [CXSparse library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/cs.h ufsparse/cs.h amd/cs.h cs.h], + [cs_di_sqr], + [C++], [don't use CXSparse library, disable some sparse functionality]) # Check for UMFPACK library. @@ -982,119 +963,12 @@ AC_SUBST(TEXINFO_UMFPACK) -COLAMD_LIBS= -AC_SUBST(COLAMD_LIBS) - -AC_ARG_WITH(colamd, - [AS_HELP_STRING([--without-colamd], - [don't use COLAMD, disable some sparse functionality])], - with_colamd=$withval, with_colamd=yes) - -warn_colamd="COLAMD not found. This will result in some lack of functionality for sparse matrices." -if test "$with_colamd" = yes; then - with_colamd=no - AC_CHECK_HEADERS([suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h], [ - AC_CHECK_LIB(colamd, colamd, [COLAMD_LIBS="-lcolamd"; with_colamd=yes]) - if test "$with_colamd" = yes; then - AC_DEFINE(HAVE_COLAMD, 1, [Define if the COLAMD library is used.]) - TEXINFO_COLAMD="@set HAVE_COLAMD" - warn_colamd= - fi - break]) -fi -if test -n "$warn_colamd"; then - AC_MSG_WARN($warn_colamd) -fi - -AC_SUBST(TEXINFO_COLAMD) - -CCOLAMD_LIBS= -AC_SUBST(CCOLAMD_LIBS) - -AC_ARG_WITH(ccolamd, - [AS_HELP_STRING([--without-ccolamd], - [don't use CCOLAMD, disable some sparse functionality])], - with_ccolamd=$withval, with_ccolamd=yes) - -warn_ccolamd="CCOLAMD not found. This will result in some lack of functionality for sparse matrices." -if test "$with_ccolamd" = yes; then - with_ccolamd=no - AC_CHECK_HEADERS([suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h], [ - AC_CHECK_LIB(ccolamd, ccolamd, [CCOLAMD_LIBS="-lccolamd"; with_ccolamd=yes]) - if test "$with_ccolamd" = yes; then - AC_DEFINE(HAVE_CCOLAMD, 1, [Define if the CCOLAMD library is used.]) - warn_ccolamd= - fi - break]) -fi -if test -n "$warn_ccolamd"; then - AC_MSG_WARN($warn_ccolamd) -fi - -CHOLMOD_LIBS= -AC_SUBST(CHOLMOD_LIBS) - -AC_ARG_WITH(cholmod, - [AS_HELP_STRING([--without-cholmod], - [don't use CHOLMOD, disable some sparse functionality])], - with_cholmod=$withval, with_cholmod=yes) - -warn_cholmod="CHOLMOD not found. This will result in some lack of functionality for sparse matrices." -if test "$with_cholmod" = yes && test "$with_colamd" = yes && - test "$with_ccolamd" = yes && test "$with_amd" = yes; then - with_cholmod=no - AC_CHECK_HEADERS([suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h], [ - AC_CHECK_LIB(cholmod, cholmod_start, [CHOLMOD_LIBS="-lcholmod"; - with_cholmod=yes], [ - AC_CHECK_LIB(cholmod, cholmod_start, [CHOLMOD_LIBS="-lcholmod -cblas"; - with_cholmod=yes], [], - $CAMD_LIBS $AMD_LIBS $COLAMD_LIBS $CCOLAMD_LIBS $BLAS_LIBS $FLIBS)], - $CAMD_LIBS $AMD_LIBS $COLAMD_LIBS $CCOLAMD_LIBS $BLAS_LIBS $FLIBS) - - if test "$with_cholmod" = yes; then - AC_DEFINE(HAVE_CHOLMOD, 1, [Define if the CHOLMOD library is used.]) - TEXINFO_CHOLMOD="@set HAVE_CHOLMOD" - warn_cholmod= - fi - break]) -fi -if test -n "$warn_cholmod"; then - AC_MSG_WARN($warn_cholmod) -fi - -AC_SUBST(TEXINFO_CHOLMOD) - -CXSPARSE_LIBS= -AC_SUBST(CXSPARSE_LIBS) - -AC_ARG_WITH(cxsparse, - [AS_HELP_STRING([--without-cxsparse], - [don't use CXSparse, disable some sparse functionality])], - with_cxsparse=$withval, with_cxsparse=yes) - -warn_cxsparse="CXSparse not found. This will result in some lack of functionality for sparse matrices." -if test "$with_cxsparse" = yes; then - with_cxsparse=no - AC_LANG_PUSH(C++) - AC_CHECK_HEADERS([suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h], [ - AC_CHECK_LIB(cxsparse, cs_di_sqr, [CXSPARSE_LIBS="-lcxsparse"; with_cxsparse=yes]) - if test "$with_cxsparse" = yes; then - AC_DEFINE(HAVE_CXSPARSE, 1, [Define if the CXSparse library is used.]) - warn_cxsparse= - fi - break]) - AC_LANG_POP(C++) -fi -if test -n "$warn_cxsparse"; then - AC_MSG_WARN($warn_cxsparse) -fi - ARPACK_LIBS= AC_SUBST(ARPACK_LIBS) AC_ARG_WITH(arpack, [AS_HELP_STRING([--without-arpack], - [don't use ARPACK, disable some sparse functionality])], + [don't use ARPACK library, disable some sparse functionality])], with_arpack=$withval, with_arpack=yes) warn_arpack="arpack not found. This will result in a lack of the eigs function." @@ -2128,6 +2002,12 @@ #define OCTAVE_EMPTY_CPP_ARG +// Octave is currently unable to use FFTW unless both float +// and double versions are both available. +#if defined (HAVE_FFTW3) && defined (HAVE_FFTW3F) +#define HAVE_FFTW +#endif + #include "oct-dlldefs.h" #include "oct-types.h" ]) @@ -2172,21 +2052,40 @@ Fortran libraries: $FLIBS LIBS: $LIBS + AMD CPPFLAGS: $AMD_CPPFLAGS + AMD LDFLAGS: $AMD_LDFLAGS AMD libraries: $AMD_LIBS ARPACK libraries: $ARPACK_LIBS BLAS libraries: $BLAS_LIBS + CAMD CPPFLAGS: $CAMD_CPPFLAGS + CAMD LDFLAGS: $CAMD_LDFLAGS CAMD libraries: $CAMD_LIBS CARBON libraries: $CARBON_LIBS + CCOLAMD CPPFLAGS: $CCOLAMD_CPPFLAGS + CCOLAMD LDFLAGS: $CCOLAMD_LDFLAGS CCOLAMD libraries: $CCOLAMD_LIBS + CHOLMOD CPPFLAGS: $CHOLMOD_CPPFLAGS + CHOLMOD LDFLAGS: $CHOLMOD_LDFLAGS CHOLMOD libraries: $CHOLMOD_LIBS + COLAMD CPPFLAGS: $COLAMD_CPPFLAGS + COLAMD LDFLAGS: $COLAMD_LDFLAGS COLAMD libraries: $COLAMD_LIBS CURL CPPFLAGS: $CURL_CPPFLAGS CURL LDFLAGS: $CURL_LDFLAGS CURL libraries: $CURL_LIBS + CXSPARSE CPPFLAGS: $CXSPARSE_CPPFLAGS + CXSPARSE LDFLAGS: $CXSPARSE_LDFLAGS CXSPARSE libraries: $CXSPARSE_LIBS DL libraries: $DL_LIBS - FFTW libraries: $FFTW_LIBS + FFTW3 CPPFLAGS: $FFTW3_CPPFLAGS + FFTW3 LDFLAGS: $FFTW3_LDFLAGS + FFTW3 libraries: $FFTW3_LIBS + FFTW3F CPPFLAGS: $FFTW3F_CPPFLAGS + FFTW3F LDFLAGS: $FFTW3F_LDFLAGS + FFTW3F libraries: $FFTW3F_LIBS FLTK backend libs: $GRAPHICS_LIBS + GLPK CPPFLAGS: $GLPK_CPPFLAGS + GLPK LDFLAGS: $GLPK_LDFLAGS GLPK libraries: $GLPK_LIBS HDF5 libraries: $HDF5_LIBS OPENGL libraries: $OPENGL_LIBS
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -40,30 +40,27 @@ #include "Array-util.h" #include "CMatrix.h" #include "CmplxAEPBAL.h" -#include "DET.h" +#include "CmplxCHOL.h" #include "CmplxSCHUR.h" #include "CmplxSVD.h" -#include "CmplxCHOL.h" +#include "DET.h" #include "f77-fcn.h" #include "functor.h" #include "lo-error.h" -#include "oct-locbuf.h" #include "lo-ieee.h" #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" #include "mx-cm-dm.h" +#include "mx-cm-s.h" #include "mx-dm-cm.h" -#include "mx-cm-s.h" #include "mx-inlines.cc" #include "mx-op-defs.h" #include "oct-cmplx.h" +#include "oct-fftw.h" +#include "oct-locbuf.h" #include "oct-norm.h" -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" -#endif - // Fortran functions we call. extern "C" @@ -211,20 +208,6 @@ F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); - // Note that the original complex fft routines were not written for - // double complex arguments. They have been modified by adding an - // implicit double precision (a-h,o-z) statement at the beginning of - // each subroutine. - - F77_RET_T - F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); - - F77_RET_T - F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); - - F77_RET_T - F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); - F77_RET_T F77_FUNC (zlartg, ZLARTG) (const Complex&, const Complex&, double&, Complex&, Complex&); @@ -1217,7 +1200,7 @@ return retval; } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) ComplexMatrix ComplexMatrix::fourier (void) const @@ -1307,6 +1290,23 @@ #else +extern "C" +{ + // Note that the original complex fft routines were not written for + // double complex arguments. They have been modified by adding an + // implicit double precision (a-h,o-z) statement at the beginning of + // each subroutine. + + F77_RET_T + F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); + + F77_RET_T + F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); + + F77_RET_T + F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); +} + ComplexMatrix ComplexMatrix::fourier (void) const {
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -32,34 +32,14 @@ #include "Array-util.h" #include "CNDArray.h" -#include "mx-base.h" #include "f77-fcn.h" #include "functor.h" #include "lo-ieee.h" #include "lo-mappers.h" -#include "oct-locbuf.h" +#include "mx-base.h" #include "mx-op-defs.h" - -#if defined (HAVE_FFTW3) #include "oct-fftw.h" -#else -extern "C" -{ - // Note that the original complex fft routines were not written for - // double complex arguments. They have been modified by adding an - // implicit double precision (a-h,o-z) statement at the beginning of - // each subroutine. - - F77_RET_T - F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); - - F77_RET_T - F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); - - F77_RET_T - F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); -} -#endif +#include "oct-locbuf.h" ComplexNDArray::ComplexNDArray (const charNDArray& a) : MArrayN<Complex> (a.dims ()) @@ -69,7 +49,8 @@ xelem (i) = static_cast<unsigned char> (a(i)); } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) + ComplexNDArray ComplexNDArray::fourier (int dim) const { @@ -203,6 +184,24 @@ } #else + +extern "C" +{ + // Note that the original complex fft routines were not written for + // double complex arguments. They have been modified by adding an + // implicit double precision (a-h,o-z) statement at the beginning of + // each subroutine. + + F77_RET_T + F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); + + F77_RET_T + F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); + + F77_RET_T + F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); +} + ComplexNDArray ComplexNDArray::fourier (int dim) const {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,12 @@ +2009-08-13 John W. Eaton <jwe@octave.org> + + * CMatrix.cc, CNDArray.cc, dMatrix.cc, dNDArray.cc, fCMatrix.cc, + fCNDArray.cc, fMatrix.cc, fNDARray.cc, oct-fftw.cc, oct-fftw.h: + Update for new FFTW defines. + + * Makefile.in: Add library-specific CPPFLAGS and LDFLAGS variables + to CPPFLAGS and LDFLAGS for files that use sparse matrices or fftw. + 2009-08-12 Jaroslav Hajek <highegg@gmail.com> * Makefile.in: Include LDFLAGS when linking shared executable.
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -37,9 +37,11 @@ LINK_DEPS = \ $(RLD_FLAG) \ -L../libcruft $(LIBCRUFT) \ - $(CHOLMOD_LIBS) $(UMFPACK_LIBS) $(AMD_LIBS) $(CAMD_LIBS) \ - $(COLAMD_LIBS) $(CCOLAMD_LIBS) $(CXSPARSE_LIBS) $(ARPACK_LIBS) \ - $(QRUPDATE_LIBS) $(FFTW_LIBS) $(READLINE_LIBS) $(TERM_LIBS) $(LIBGLOB) \ + $(SPARSE_LDFLAGS) $(SPARSE_LIBS) \ + $(ARPACK_LIBS) \ + $(QRUPDATE_LIBS) \ + $(FFTW_LDFLAGS) $(FFTW_LIBS) \ + $(READLINE_LIBS) $(TERM_LIBS) $(LIBGLOB) \ $(REGEX_LIBS) $(DL_LIBS) $(LIBS) $(FLIBS) $(PTHREAD_LIBS) MATRIX_INC := Array.h Array2.h Array3.h ArrayN.h DiagArray2.h \ @@ -385,6 +387,46 @@ $(AWK) -f $(srcdir)/mk-ops.awk prefix=mx make_inclusive_header=mx-ops.h $(srcdir)/mx-ops > $@-t $(simple-move-if-change-rule) +CSparse.d CSparse.df pic/CSparse.o CSparse.o: CPPFLAGS += $(SPARSE_CPPFLAGS) + +dSparse.d dSparse.df pic/dSparse.o dSparse.o: CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparseCmplxLU.d SparseCmplxLU.df pic/SparseCmplxLU.o SparseCmplxLU.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparsedbleLU.d SparsedbleLU.df pic/SparsedbleLU.o SparsedbleLU.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparseCmplxQR.d SparseCmplxQR.df pic/SparseCmplxQR.o SparseCmplxQR.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparsedbleQR.d SparsedbleQR.df pic/SparsedbleQR.o SparsedbleQR.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparseCmplxCHOL.d SparseCmplxCHOL.df pic/SparseCmplxCHOL.o SparseCmplxCHOL.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +SparsedbleCHOL.d SparsedbleCHOL.df pic/SparsedbleCHOL.o SparsedbleCHOL.o: \ + CPPFLAGS += $(SPARSE_CPPFLAGS) + +CMatrix.d CMatrix.df pic/CMatrix.o CMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +CNDArray.d CNDArray.df pic/CNDArray.o CNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +dMatrix.d dMatrix.df pic/dMatrix.o dMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +dNDArray.d dNDArray.df pic/dNDArray.o dNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +fCMatrix.d fCMatrix.df pic/fCMatrix.o fCMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +fCNDArray.d fCNDArray.df pic/fCNDArray.o fCNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +fMatrix.d fMatrix.df pic/fMatrix.o fMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +fNDArray.d fNDArray.df pic/fNDArray.o fNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS) + +oct-fftw.d oct-fftw.df pic/oct-fftw.o oct-fftw.o: CPPFLAGS += $(FFTW_CPPFLAGS) + ifdef omit_deps .PHONY: $(MAKEDEPS) endif
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -53,13 +53,10 @@ #include "mx-inlines.cc" #include "mx-op-defs.h" #include "oct-cmplx.h" +#include "oct-fftw.h" #include "oct-norm.h" #include "quit.h" -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" -#endif - // Fortran functions we call. extern "C" @@ -192,20 +189,6 @@ F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); - // Note that the original complex fft routines were not written for - // double complex arguments. They have been modified by adding an - // implicit double precision (a-h,o-z) statement at the beginning of - // each subroutine. - - F77_RET_T - F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); - - F77_RET_T - F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); - - F77_RET_T - F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); - F77_RET_T F77_FUNC (dlartg, DLARTG) (const double&, const double&, double&, double&, double&); @@ -894,7 +877,7 @@ } } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) ComplexMatrix Matrix::fourier (void) const @@ -982,6 +965,23 @@ #else +extern "C" +{ + // Note that the original complex fft routines were not written for + // double complex arguments. They have been modified by adding an + // implicit double precision (a-h,o-z) statement at the beginning of + // each subroutine. + + F77_RET_T + F77_FUNC (zffti, ZFFTI) (const octave_idx_type&, Complex*); + + F77_RET_T + F77_FUNC (zfftf, ZFFTF) (const octave_idx_type&, Complex*, Complex*); + + F77_RET_T + F77_FUNC (zfftb, ZFFTB) (const octave_idx_type&, Complex*, Complex*); +} + ComplexMatrix Matrix::fourier (void) const {
--- a/liboctave/dNDArray.cc +++ b/liboctave/dNDArray.cc @@ -32,18 +32,15 @@ #include "Array-util.h" #include "dNDArray.h" +#include "f77-fcn.h" #include "functor.h" -#include "mx-base.h" -#include "f77-fcn.h" #include "lo-error.h" #include "lo-ieee.h" #include "lo-mappers.h" -#include "oct-locbuf.h" +#include "mx-base.h" #include "mx-op-defs.h" - -#if defined (HAVE_FFTW3) #include "oct-fftw.h" -#endif +#include "oct-locbuf.h" NDArray::NDArray (const Array<octave_idx_type>& a, bool zero_based, bool negative_to_nan) @@ -95,7 +92,7 @@ xelem (i) = static_cast<unsigned char> (a(i)); } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) ComplexNDArray NDArray::fourier (int dim) const
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -38,31 +38,28 @@ #endif #include "Array-util.h" +#include "DET.h" +#include "f77-fcn.h" #include "fCMatrix.h" -#include "DET.h" +#include "fCmplxCHOL.h" #include "fCmplxSCHUR.h" #include "fCmplxSVD.h" -#include "fCmplxCHOL.h" -#include "f77-fcn.h" #include "functor.h" #include "lo-error.h" -#include "oct-locbuf.h" #include "lo-ieee.h" #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" #include "mx-fcm-fdm.h" +#include "mx-fcm-fs.h" #include "mx-fdm-fcm.h" -#include "mx-fcm-fs.h" #include "mx-inlines.cc" #include "mx-op-defs.h" #include "oct-cmplx.h" +#include "oct-fftw.h" +#include "oct-locbuf.h" #include "oct-norm.h" -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" -#endif - // Fortran functions we call. extern "C" @@ -211,15 +208,6 @@ F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); - - F77_RET_T F77_FUNC (clartg, CLARTG) (const FloatComplex&, const FloatComplex&, float&, FloatComplex&, FloatComplex&); @@ -1211,7 +1199,7 @@ return retval; } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) FloatComplexMatrix FloatComplexMatrix::fourier (void) const @@ -1301,6 +1289,18 @@ #else +extern "C" +{ + F77_RET_T + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); +} + FloatComplexMatrix FloatComplexMatrix::fourier (void) const {
--- a/liboctave/fCNDArray.cc +++ b/liboctave/fCNDArray.cc @@ -31,30 +31,15 @@ #include <vector> #include "Array-util.h" +#include "f77-fcn.h" #include "fCNDArray.h" -#include "mx-base.h" -#include "f77-fcn.h" #include "functor.h" #include "lo-ieee.h" #include "lo-mappers.h" -#include "oct-locbuf.h" +#include "mx-base.h" #include "mx-op-defs.h" - -#if defined (HAVE_FFTW3) #include "oct-fftw.h" -#else -extern "C" -{ - F77_RET_T - F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); -} -#endif +#include "oct-locbuf.h" FloatComplexNDArray::FloatComplexNDArray (const charNDArray& a) : MArrayN<FloatComplex> (a.dims ()) @@ -64,7 +49,8 @@ xelem (i) = static_cast<unsigned char> (a(i)); } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) + FloatComplexNDArray FloatComplexNDArray::fourier (int dim) const { @@ -198,6 +184,19 @@ } #else + +extern "C" +{ + F77_RET_T + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); +} + FloatComplexNDArray FloatComplexNDArray::fourier (int dim) const {
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -33,32 +33,29 @@ #include <vector> #include "Array-util.h" +#include "DET.h" #include "byte-swap.h" +#include "f77-fcn.h" #include "fMatrix.h" -#include "DET.h" +#include "floatCHOL.h" #include "floatSCHUR.h" #include "floatSVD.h" -#include "floatCHOL.h" -#include "f77-fcn.h" #include "functor.h" #include "lo-error.h" -#include "oct-locbuf.h" #include "lo-ieee.h" #include "lo-mappers.h" #include "lo-utils.h" #include "mx-base.h" +#include "mx-fdm-fm.h" #include "mx-fm-fdm.h" -#include "mx-fdm-fm.h" #include "mx-inlines.cc" #include "mx-op-defs.h" #include "oct-cmplx.h" +#include "oct-fftw.h" +#include "oct-locbuf.h" #include "oct-norm.h" #include "quit.h" -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" -#endif - // Fortran functions we call. extern "C" @@ -191,20 +188,6 @@ F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); - // Note that the original complex fft routines were not written for - // float complex arguments. They have been modified by adding an - // implicit float precision (a-h,o-z) statement at the beginning of - // each subroutine. - - F77_RET_T - F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); - - F77_RET_T - F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); - F77_RET_T F77_FUNC (slartg, SLARTG) (const float&, const float&, float&, float&, float&); @@ -893,7 +876,7 @@ } } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) FloatComplexMatrix FloatMatrix::fourier (void) const @@ -981,6 +964,23 @@ #else +extern "C" +{ + // Note that the original complex fft routines were not written for + // float complex arguments. They have been modified by adding an + // implicit float precision (a-h,o-z) statement at the beginning of + // each subroutine. + + F77_RET_T + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); + + F77_RET_T + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); +} + FloatComplexMatrix FloatMatrix::fourier (void) const {
--- a/liboctave/fNDArray.cc +++ b/liboctave/fNDArray.cc @@ -31,15 +31,16 @@ #include <vector> #include "Array-util.h" +#include "f77-fcn.h" #include "fNDArray.h" #include "functor.h" -#include "mx-base.h" -#include "f77-fcn.h" #include "lo-error.h" #include "lo-ieee.h" #include "lo-mappers.h" +#include "mx-base.h" +#include "mx-op-defs.h" +#include "oct-fftw.h" #include "oct-locbuf.h" -#include "mx-op-defs.h" FloatNDArray::FloatNDArray (const charNDArray& a) : MArrayN<float> (a.dims ()) @@ -49,8 +50,7 @@ xelem (i) = static_cast<unsigned char> (a(i)); } -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" +#if defined (HAVE_FFTW) FloatComplexNDArray FloatNDArray::fourier (int dim) const
--- a/liboctave/oct-fftw.cc +++ b/liboctave/oct-fftw.cc @@ -24,7 +24,7 @@ #include <config.h> #endif -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) #include <iostream> #include <vector> @@ -1019,7 +1019,6 @@ return 0; } - #endif /*
--- a/liboctave/oct-fftw.h +++ b/liboctave/oct-fftw.h @@ -24,11 +24,16 @@ #define octave_oct_fftw_h 1 #include <cstddef> + +#if defined (HAVE_FFTW3_H) #include <fftw3.h> +#endif #include "oct-cmplx.h" #include "dim-vector.h" +#if defined (HAVE_FFTW) + class OCTAVE_API octave_fftw_planner @@ -292,6 +297,7 @@ octave_fftw { public: + static int fft (const double *in, Complex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int fft (const Complex *in, Complex *out, size_t npts, @@ -319,13 +325,15 @@ const dim_vector &); private: - octave_fftw (); + octave_fftw (void); octave_fftw (const octave_fftw&); octave_fftw& operator = (const octave_fftw&); }; #endif +#endif + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2009-08-13 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/fft.cc, DLD-FUNCTIONS/fft2.cc, + DLD-FUNCTIONS/fftn.cc, DLD-FUNCTIONS/fftw.cc: Update for new FFTW + defines. + + * Makefile.in (amd.oct, colamd.oct, dmperm.oct, symcrm.oct, + qr.oct, fft.oct, fft2.oct, fftn.oct, fftw.oct): Add + library-specific CPPFLAGS and LDFLAGS variables to CPPFLAGS + and LDFLAGS. + * oct-conf.h.in: New #defines for GLPK_CPPFLAGS, GLPK_LDFLAGS, + AMD_CPPFLAGS, AMD_LDFLAGS, CAMD_CPPFLAGS, CAMD_LDFLAGS, + CCOLAMD_CPPFLAGS, CCOLAMD_LDFLAGS, CHOLMOD_CPPFLAGS, + CHOLMOD_LDFLAGS, COLAMD_CPPFLAGS, COLAMD_LDFLAGS, + CXSPARSE_CPPFLAGS, CXSPARSE_LDFLAGS, FFTW3_CPPFLAGS, + FFTW3_LDFLAGS, FFTW3_LIBS, FFTW3F_CPPFLAGS, FFTW3F_LDFLAGS, and + FFTW3F_LIBS. + * toplev.cc (octave_config_info): Include them in the list. + 2009-08-13 Jaroslav Hajek <highegg@gmail.com> * ov-class.h (octave_class): Derive from octave_struct.
--- a/src/DLD-FUNCTIONS/fft.cc +++ b/src/DLD-FUNCTIONS/fft.cc @@ -33,7 +33,7 @@ #include "oct-obj.h" #include "utils.h" -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) #define FFTSRC "@sc{fftw}" #else #define FFTSRC "@sc{fftpack}"
--- a/src/DLD-FUNCTIONS/fft2.cc +++ b/src/DLD-FUNCTIONS/fft2.cc @@ -36,7 +36,7 @@ // This function should be merged with Fifft. -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) #define FFTSRC "@sc{fftw}" #else #define FFTSRC "@sc{fftpack}"
--- a/src/DLD-FUNCTIONS/fftn.cc +++ b/src/DLD-FUNCTIONS/fftn.cc @@ -34,7 +34,7 @@ // This function should be merged with Fifft. -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) #define FFTSRC "@sc{fftw}" #else #define FFTSRC "@sc{fftpack}"
--- a/src/DLD-FUNCTIONS/fftw.cc +++ b/src/DLD-FUNCTIONS/fftw.cc @@ -25,13 +25,12 @@ #endif #include <algorithm> -#include "ov.h" + +#include "oct-fftw.h" + #include "defun-dld.h" #include "error.h" - -#if defined (HAVE_FFTW3) -#include "oct-fftw.h" -#endif +#include "ov.h" DEFUN_DLD (fftw, args, , "-*- texinfo -*-\n\ @@ -122,7 +121,7 @@ return retval; } -#if defined (HAVE_FFTW3) +#if defined (HAVE_FFTW) if (args(0).is_string ()) { std::string arg0 = args(0).string_value (); @@ -260,7 +259,7 @@ } #else - warning ("fftw: this copy of Octave was not configured to use FFTW3"); + warning ("fftw: this copy of Octave was not configured to use the FFTW3 planner"); #endif
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -680,7 +680,34 @@ fltk_backend.oct: \ OCT_LINK_DEPS += $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) $(FT2_LDFLAGS) $(FT2_LIBS) -check: all +amd.d amd.df pic/amd.o amd.o: CPPFLAGS += $(SPARSE_CPPFLAGS) +amd.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS) + +colamd.d colamd.df pic/colamd.o colamd.o: CPPFLAGS += $(SPARSE_CPPFLAGS) +colamd.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS) + +dmperm.d dmperm.df pic/dmperm.o dmperm.o: CPPFLAGS += $(SPARSE_CPPFLAGS) +dmperm.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS) + +symrcm.d symrcm.df pic/symrcm.o symrcm.o: CPPFLAGS += $(SPARSE_CPPFLAGS) +symrcm.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS) + +qr.d qr.df pic/qr.o qr.o: CPPFLAGS += $(SPARSE_CPPFLAGS) +qr.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS) + +fft.d fft.df pic/fft.o fft.o: CPPFLAGS += $(FFTW_CPPFLAGS) +fft.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS) + +fft2.d fft2.df pic/fft2.o fft2.o: CPPFLAGS += $(FFTW_CPPFLAGS) +fft2.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS) + +fftn.d fftn.df pic/fftn.o fftn.o: CPPFLAGS += $(FFTW_CPPFLAGS) +fftn.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS) + +fftw.d fftw.df pic/fftw.o fftw.o: CPPFLAGS += $(FFTW_CPPFLAGS) +fftw.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS) + +pcheck: all .PHONY: check ifdef omit_deps
--- a/src/oct-conf.h.in +++ b/src/oct-conf.h.in @@ -41,6 +41,14 @@ #define OCTAVE_CONF_ALL_LDFLAGS %OCTAVE_CONF_ALL_LDFLAGS% #endif +#ifndef OCTAVE_CONF_AMD_CPPFLAGS +#define OCTAVE_CONF_AMD_CPPFLAGS %OCTAVE_CONF_AMD_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_AMD_LDFLAGS +#define OCTAVE_CONF_AMD_LDFLAGS %OCTAVE_CONF_AMD_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_AMD_LIBS #define OCTAVE_CONF_AMD_LIBS %OCTAVE_CONF_AMD_LIBS% #endif @@ -61,6 +69,14 @@ #define OCTAVE_CONF_BLAS_LIBS %OCTAVE_CONF_BLAS_LIBS% #endif +#ifndef OCTAVE_CONF_CAMD_CPPFLAGS +#define OCTAVE_CONF_CAMD_CPPFLAGS %OCTAVE_CONF_CAMD_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_CAMD_LDFLAGS +#define OCTAVE_CONF_CAMD_LDFLAGS %OCTAVE_CONF_CAMD_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_CAMD_LIBS #define OCTAVE_CONF_CAMD_LIBS %OCTAVE_CONF_CAMD_LIBS% #endif @@ -77,6 +93,14 @@ #define OCTAVE_CONF_CC_VERSION %OCTAVE_CONF_CC_VERSION% #endif +#ifndef OCTAVE_CONF_CCOLAMD_CPPFLAGS +#define OCTAVE_CONF_CCOLAMD_CPPFLAGS %OCTAVE_CONF_CCOLAMD_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_CCOLAMD_LDFLAGS +#define OCTAVE_CONF_CCOLAMD_LDFLAGS %OCTAVE_CONF_CCOLAMD_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_CCOLAMD_LIBS #define OCTAVE_CONF_CCOLAMD_LIBS %OCTAVE_CONF_CCOLAMD_LIBS% #endif @@ -85,10 +109,26 @@ #define OCTAVE_CONF_CFLAGS %OCTAVE_CONF_CFLAGS% #endif +#ifndef OCTAVE_CONF_CHOLMOD_CPPFLAGS +#define OCTAVE_CONF_CHOLMOD_CPPFLAGS %OCTAVE_CONF_CHOLMOD_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_CHOLMOD_LDFLAGS +#define OCTAVE_CONF_CHOLMOD_LDFLAGS %OCTAVE_CONF_CHOLMOD_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_CHOLMOD_LIBS #define OCTAVE_CONF_CHOLMOD_LIBS %OCTAVE_CONF_CHOLMOD_LIBS% #endif +#ifndef OCTAVE_CONF_COLAMD_CPPFLAGS +#define OCTAVE_CONF_COLAMD_CPPFLAGS %OCTAVE_CONF_COLAMD_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_COLAMD_LDFLAGS +#define OCTAVE_CONF_COLAMD_LDFLAGS %OCTAVE_CONF_COLAMD_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_COLAMD_LIBS #define OCTAVE_CONF_COLAMD_LIBS %OCTAVE_CONF_COLAMD_LIBS% #endif @@ -113,6 +153,14 @@ #define OCTAVE_CONF_CURL_LIBS %OCTAVE_CONF_CURL_LIBS% #endif +#ifndef OCTAVE_CONF_CXSPARSE_CPPFLAGS +#define OCTAVE_CONF_CXSPARSE_CPPFLAGS %OCTAVE_CONF_CXSPARSE_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_CXSPARSE_LDFLAGS +#define OCTAVE_CONF_CXSPARSE_LDFLAGS %OCTAVE_CONF_CXSPARSE_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_CXSPARSE_LIBS #define OCTAVE_CONF_CXSPARSE_LIBS %OCTAVE_CONF_CXSPARSE_LIBS% #endif @@ -177,8 +225,28 @@ #define OCTAVE_CONF_FFLAGS %OCTAVE_CONF_FFLAGS% #endif -#ifndef OCTAVE_CONF_FFTW_LIBS -#define OCTAVE_CONF_FFTW_LIBS %OCTAVE_CONF_FFTW_LIBS% +#ifndef OCTAVE_CONF_FFTW3_CPPFLAGSS +#define OCTAVE_CONF_FFTW3_CPPFLAGS %OCTAVE_CONF_FFTW3_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_FFTW3_LDFLAGSS +#define OCTAVE_CONF_FFTW3_LDFLAGS %OCTAVE_CONF_FFTW3_LDFLAGS% +#endif + +#ifndef OCTAVE_CONF_FFTW3_LIBS +#define OCTAVE_CONF_FFTW3_LIBS %OCTAVE_CONF_FFTW3_LIBS% +#endif + +#ifndef OCTAVE_CONF_FFTW3F_CPPFLAGSS +#define OCTAVE_CONF_FFTW3F_CPPFLAGS %OCTAVE_CONF_FFTW3F_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_FFTW3F_LDFLAGSS +#define OCTAVE_CONF_FFTW3F_LDFLAGS %OCTAVE_CONF_FFTW3F_LDFLAGS% +#endif + +#ifndef OCTAVE_CONF_FFTW3F_LIBS +#define OCTAVE_CONF_FFTW3F_LIBS %OCTAVE_CONF_FFTW3F_LIBS% #endif #ifndef OCTAVE_CONF_FLIBS @@ -193,6 +261,14 @@ #define OCTAVE_CONF_FT2_LIBS %OCTAVE_CONF_FT2_LIBS% #endif +#ifndef OCTAVE_CONF_GLPK_CPPFLAGS +#define OCTAVE_CONF_GLPK_CPPFLAGS %OCTAVE_CONF_GLPK_CPPFLAGS% +#endif + +#ifndef OCTAVE_CONF_GLPK_LDFLAGS +#define OCTAVE_CONF_GLPK_LDFLAGS %OCTAVE_CONF_GLPK_LDFLAGS% +#endif + #ifndef OCTAVE_CONF_GLPK_LIBS #define OCTAVE_CONF_GLPK_LIBS %OCTAVE_CONF_GLPK_LIBS% #endif
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -1195,24 +1195,36 @@ { false, "ALL_CXXFLAGS", OCTAVE_CONF_ALL_CXXFLAGS }, { false, "ALL_FFLAGS", OCTAVE_CONF_ALL_FFLAGS }, { false, "ALL_LDFLAGS", OCTAVE_CONF_ALL_LDFLAGS }, + { false, "AMD_CPPFLAGS", OCTAVE_CONF_AMD_CPPFLAGS }, + { false, "AMD_LDFLAGS", OCTAVE_CONF_AMD_LDFLAGS }, { false, "AMD_LIBS", OCTAVE_CONF_AMD_LIBS }, { false, "AR", OCTAVE_CONF_AR }, { false, "ARFLAGS", OCTAVE_CONF_ARFLAGS }, { false, "ARPACK_LIBS", OCTAVE_CONF_ARPACK_LIBS }, { false, "BLAS_LIBS", OCTAVE_CONF_BLAS_LIBS }, { false, "CARBON_LIBS", OCTAVE_CONF_CARBON_LIBS }, + { false, "CAMD_CPPFLAGS", OCTAVE_CONF_CAMD_CPPFLAGS }, + { false, "CAMD_LDFLAGS", OCTAVE_CONF_CAMD_LDFLAGS }, { false, "CAMD_LIBS", OCTAVE_CONF_CAMD_LIBS }, { false, "CC", OCTAVE_CONF_CC }, { false, "CC_VERSION", OCTAVE_CONF_CC_VERSION }, + { false, "CCOLAMD_CPPFLAGS", OCTAVE_CONF_CCOLAMD_CPPFLAGS }, + { false, "CCOLAMD_LDFLAGS", OCTAVE_CONF_CCOLAMD_LDFLAGS }, { false, "CCOLAMD_LIBS", OCTAVE_CONF_CCOLAMD_LIBS }, { false, "CFLAGS", OCTAVE_CONF_CFLAGS }, + { false, "CHOLMOD_CPPFLAGS", OCTAVE_CONF_CHOLMOD_CPPFLAGS }, + { false, "CHOLMOD_LDFLAGS", OCTAVE_CONF_CHOLMOD_LDFLAGS }, { false, "CHOLMOD_LIBS", OCTAVE_CONF_CHOLMOD_LIBS }, + { false, "COLAMD_CPPFLAGS", OCTAVE_CONF_COLAMD_CPPFLAGS }, + { false, "COLAMD_LDFLAGS", OCTAVE_CONF_COLAMD_LDFLAGS }, { false, "COLAMD_LIBS", OCTAVE_CONF_COLAMD_LIBS }, { false, "CPICFLAG", OCTAVE_CONF_CPICFLAG }, { false, "CPPFLAGS", OCTAVE_CONF_CPPFLAGS }, { false, "CURL_CPPFLAGS", OCTAVE_CONF_CURL_CPPFLAGS }, { false, "CURL_LDFLAGS", OCTAVE_CONF_CURL_LDFLAGS }, { false, "CURL_LIBS", OCTAVE_CONF_CURL_LIBS }, + { false, "CXSPARSE_CPPFLAGS", OCTAVE_CONF_CXSPARSE_CPPFLAGS }, + { false, "CXSPARSE_LDFLAGS", OCTAVE_CONF_CXSPARSE_LDFLAGS }, { false, "CXSPARSE_LIBS", OCTAVE_CONF_CXSPARSE_LIBS }, { false, "CXX", OCTAVE_CONF_CXX }, { false, "CXXCPP", OCTAVE_CONF_CXXCPP }, @@ -1230,10 +1242,17 @@ { false, "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG }, { false, "FC", OCTAVE_CONF_FC }, { false, "FFLAGS", OCTAVE_CONF_FFLAGS }, - { false, "FFTW_LIBS", OCTAVE_CONF_FFTW_LIBS }, + { false, "FFTW3_CPPFLAGS", OCTAVE_CONF_FFTW3_CPPFLAGS }, + { false, "FFTW3_LDFLAGS", OCTAVE_CONF_FFTW3_LDFLAGS }, + { false, "FFTW3_LIBS", OCTAVE_CONF_FFTW3_LIBS }, + { false, "FFTW3F_CPPFLAGS", OCTAVE_CONF_FFTW3F_CPPFLAGS }, + { false, "FFTW3F_LDFLAGS", OCTAVE_CONF_FFTW3F_LDFLAGS }, + { false, "FFTW3F_LIBS", OCTAVE_CONF_FFTW3F_LIBS }, { false, "FLIBS", OCTAVE_CONF_FLIBS }, { false, "FPICFLAG", OCTAVE_CONF_FPICFLAG }, { false, "FT2_LIBS", OCTAVE_CONF_FT2_LIBS }, + { false, "GLPK_CPPFLAGS", OCTAVE_CONF_GLPK_CPPFLAGS }, + { false, "GLPK_LDFLAGS", OCTAVE_CONF_GLPK_LDFLAGS }, { false, "GLPK_LIBS", OCTAVE_CONF_GLPK_LIBS }, { false, "GNUPLOT", OCTAVE_CONF_GNUPLOT }, { false, "GRAPHICS_LIBS", OCTAVE_CONF_GRAPHICS_LIBS },