# HG changeset patch # User David Grundberg # Date 1284223028 -7200 # Node ID 66bd40c8d36e7225e00ff844aff9fe278e886b32 # Parent 9ddccdf6d3181157b363299288382af9922f69f4 Make Pytave compile against Octave 3.3+. Fix configuration bugs. diff -r 9ddccdf6d318 -r 66bd40c8d36e configure.ac --- a/configure.ac Mon Dec 21 15:30:13 2009 +0100 +++ b/configure.ac Sat Sep 11 18:37:08 2010 +0200 @@ -4,6 +4,27 @@ AC_PREREQ(2.61) AC_INIT(pytave, 0.1.1, [[https://bugs.launchpad.net/pytave]]) +AC_ARG_WITH(numpy, + [AS_HELP_STRING([--with-numpy], + [use NumPy module (experimental) + @<:@default=yes@:>@])], + [pytave_enable_numpy="$withval"], + [pytave_enable_numpy=yes]) + +AC_ARG_WITH(numeric, + [AS_HELP_STRING([--with-numeric], + [use legacy Numeric module. NumPy must be disabled. + @<:@default=no@:>@])], + [pytave_enable_numeric="$withval"], + [pytave_enable_numeric=no]) + +# Check for bad arguments. +AS_IF(test "x$pytave_enable_numpy" = "xyes" -a "x$pytave_enable_numeric" = "xyes" -o dnl +"x$pytave_enable_numpy" = "xno" -a "x$pytave_enable_numeric" = "xno", +[ + AC_ERROR([NumPy or Numeric: select one.]) +]) + # Some important programs. AC_LANG(C++) AC_PROG_CXX @@ -15,22 +36,6 @@ AC_CONFIG_SRCDIR([pytave.cc]) AC_CONFIG_HEADER([config.h]) -AC_PRESERVE_HELP_ORDER - -AC_ARG_WITH(numpy, - [AS_HELP_STRING([--with-numpy], - [use NumPy module (experimental) - @<:@default=yes@:>@])], - [pytave_enable_numpy="$enableval"], - [pytave_enable_numpy=yes]) - -AC_ARG_WITH(numeric, - [AS_HELP_STRING([--with-numeric], - [use legacy Numeric module. NumPy must be disabled. - @<:@default=no@:>@])], - [pytave_enable_numeric="$enableval"], - [pytave_enable_numeric=no]) - dnl Define a convenience m4 macro for appending to pytave_missing_libs define(addmissing,pytave_missing_libs="$1 $pytave_missing_libs") @@ -42,15 +47,8 @@ # Pick a Python library to use AX_PYTHON_DEVEL([], [], [addmissing([Python development files])]) -# Check for bad arguments. -AS_IF(test "x$pytave_enable_numpy" == "xyes" -a "x$pytave_enable_numeric" == "xyes" -o dnl -"x$pytave_enable_numpy" == "xno" -a "x$pytave_enable_numeric" == "xno", -[ - AC_ERROR([NumPy or Numeric: select one.]) -]) - # Select Python matrix interface, prefer numpy. -AS_IF(test "x$pytave_enable_numpy" == "xno", +AS_IF(test "x$pytave_enable_numpy" = "xno", [ pytave_matrix_interface="numeric" ], @@ -59,7 +57,7 @@ ]) # Look for selected matrix interface -AS_IF(test "$pytave_matrix_interface" == "numpy", +AS_IF(test "$pytave_matrix_interface" = "numpy", [ AX_PYTHON_NUMPY( [ @@ -174,6 +172,16 @@ ========================================================================]) +AS_IF(test "x$pytave_have_uselocale" = "xno", +[ + AC_MSG_WARN([This system doesn't have uselocale support. + The Octave interpreter will NOT work correctly in any + locale but the C (POSIX) locale. Pytave would use the + uselocale function to work around this limitation. Pytave + can be compiled without it but will only work correcly in C + (POSIX) locale.]) +]) + AS_IF(test -n "$pytave_missing_libs", [ AC_MSG_ERROR([[Configuration failure. Halt.]]) diff -r 9ddccdf6d318 -r 66bd40c8d36e m4/ax_octave.m4 --- a/m4/ax_octave.m4 Mon Dec 21 15:30:13 2009 +0100 +++ b/m4/ax_octave.m4 Sat Sep 11 18:37:08 2010 +0200 @@ -133,11 +133,21 @@ ]) AS_IF([test -z "$ax_octave_ok"], [ + # After the 3.2 series, the include path ends with + # /octave, but that part we don't want. + AC_MSG_CHECKING([[if the include directory is 3.3+ style]]) + if test -f "$OCTAVE_INCLUDEDIR/oct.h" ; then + OCTAVE_INCLUDEDIR="$OCTAVE_INCLUDEDIR/.." + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + OCTAVE_LDFLAGS="-L$OCTAVE_LIBRARYDIR" OCTAVE_LIBS="-loctave -lcruft -loctinterp" OCTAVE_CPPFLAGS="-I$OCTAVE_INCLUDEDIR" - AC_CACHE_CHECK([whether linking to Octave library works], [ax_octave_cv_lib_octave], + AC_CACHE_CHECK([whether linking to Octave works], [ax_octave_cv_lib_octave], [ ax_octave_cv_lib_octave=no @@ -146,9 +156,10 @@ ax_octave_old_ldflags="$LDFLAGS" ax_octave_old_cppflags="$CPPFLAGS" ax_octave_old_libs="$LIBS" - LDFLAGS="$OCTAVE_LDFLAGS $LDFLAGS" - CPPFLAGS="$OCTAVE_CPPFLAGS $CPPFLAGS" - LIBS="$OCTAVE_LIBS $LIBS" + + LDFLAGS="$OCTAVE_LDFLAGS $ax_octave_old_ldflags" + CPPFLAGS="$OCTAVE_CPPFLAGS $ax_octave_old_cppflags" + LIBS="$OCTAVE_LIBS $ax_octave_old_libs" AC_LANG_ASSERT(C++) AC_LINK_IFELSE( @@ -158,6 +169,7 @@ [[MatrixType()]]), [ax_octave_cv_lib_octave=yes], [ax_octave_cv_lib_octave=no]) + LDFLAGS="$ax_octave_old_ldflags" CPPFLAGS="$ax_octave_old_cppflags" LIBS="$ax_octave_old_libs" diff -r 9ddccdf6d318 -r 66bd40c8d36e pytave.cc --- a/pytave.cc Mon Dec 21 15:30:13 2009 +0100 +++ b/pytave.cc Sat Sep 11 18:37:08 2010 +0200 @@ -76,13 +76,14 @@ const char* argv[] = {"octave", "--no-line-editing", "--no-history", + "--no-init-file", "--silent", NULL}; - int argc = 4; + int argc = 5; if (silent) { - argv[3] = 0; - argc = 3; + argc--; + argv[argc] = 0; } #ifdef HAVE_USELOCALE