changeset 26943:b4cb230ced82 stable

configure: prevent overlinking when SUNDIALS is disabled (bug #55956) * configure.ac: Conditionally assign SUNDIALS_X* build variables only when HAVE_SUNDIALS is true. Clear all SUNDIALS related build variables otherwise.
author Mike Miller <mtmiller@octave.org>
date Tue, 19 Mar 2019 10:05:15 -0700
parents aa9745a1114a
children 791cb021ccb8 86f439ba2d47
files configure.ac
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri Mar 15 23:41:48 2019 +0100
+++ b/configure.ac	Tue Mar 19 10:05:15 2019 -0700
@@ -2231,20 +2231,23 @@
     && test $octave_cv_sundials_ida_dense = yes \
     && test $octave_cv_sundials_realtype_is_double = yes; then
   AC_DEFINE(HAVE_SUNDIALS, 1, [Define to 1 if SUNDIALS is available.])
+
+  ## Collections of options needed to build with SUNDIALS and its dependencies.
+  SUNDIALS_XCPPFLAGS="$SUNDIALS_IDA_CPPFLAGS $SUNDIALS_NVECSERIAL_CPPFLAGS $KLU_CPPFLAGS"
+  SUNDIALS_XLDFLAGS="$SUNDIALS_IDA_LDFLAGS $SUNDIALS_NVECSERIAL_LDFLAGS $KLU_LDFLAGS"
+  SUNDIALS_XLIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS"
+else
+  SUNDIALS_IDA_CPPFLAGS=
+  SUNDIALS_IDA_LDFLAGS=
+  SUNDIALS_IDA_LIBS=
+  SUNDIALS_NVECSERIAL_CPPFLAGS=
+  SUNDIALS_NVECSERIAL_LDFLAGS=
+  SUNDIALS_NVECSERIAL_LIBS=
+  SUNDIALS_XCPPFLAGS=
+  SUNDIALS_XLDFLAGS=
+  SUNDIALS_XLIBS=
 fi
 
-## Collections of flags.
-dnl These are here instead of just in the Makefile.am file because we
-dnl substitute some of them into other source files like mkoctfile.
-
-dnl Order matters, at least on some systems (Cygwin, for example).
-
-SUNDIALS_XCPPFLAGS="$SUNDIALS_IDA_CPPFLAGS $SUNDIALS_NVECSERIAL_CPPFLAGS $KLU_CPPFLAGS"
-
-SUNDIALS_XLDFLAGS="$SUNDIALS_IDA_LDFLAGS $SUNDIALS_NVECSERIAL_LDFLAGS $KLU_LDFLAGS"
-
-SUNDIALS_XLIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS"
-
 AC_SUBST(SUNDIALS_XCPPFLAGS)
 AC_SUBST(SUNDIALS_XLDFLAGS)
 AC_SUBST(SUNDIALS_XLIBS)