Commit c272986a authored by Adam Mercer's avatar Adam Mercer
Browse files

Merge branch 'mkoctfile-fix' into 'master'

gnuscripts/lalsuite_swig.m4: more robust calls to Octave configuration programs

See merge request lscsoft/lalsuite!1337
parents 27b112e4 eba92777
......@@ -2,7 +2,7 @@
# lalsuite_swig.m4 - SWIG configuration
# Author: Karl Wette, 2011--2017
#
# serial 107
# serial 108
AC_DEFUN([_LALSUITE_CHECK_SWIG_VERSION],[
# $0: check the version of $1, and store it in ${swig_version}
......@@ -299,6 +299,14 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
AC_MSG_RESULT([not found])
AC_MSG_ERROR([could not find octave-config in ${octave_dir}])
])
AC_MSG_CHECKING([if ${octave_cfg} works])
octave_cfg="env - PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${octave_cfg}"
AS_IF([${octave_cfg} --version >/dev/null 2>&1],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([could not find working octave-config in ${octave_dir}])
])
AC_MSG_CHECKING([for mkoctfile])
mkoctfile="${octave_dir}/mkoctfile"
AS_IF([test -x "${mkoctfile}"],[
......@@ -307,11 +315,19 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
AC_MSG_RESULT([not found])
AC_MSG_ERROR([could not find mkoctfile in ${octave_dir}])
])
AC_MSG_CHECKING([if ${mkoctfile} works])
mkoctfile="env - PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${mkoctfile}"
AS_IF([${mkoctfile} --version >/dev/null 2>&1],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([could not find working mkoctfile in ${octave_dir}])
])
# check Octave version
octave_min_version=3.2.0
AC_MSG_CHECKING([${OCTAVE} version])
octave_version=[`env -u VERSION ${octave_cfg} -p VERSION 2>/dev/null`]
octave_version=[`${octave_cfg} -p VERSION 2>/dev/null`]
AS_IF([test "x${octave_version}" = x],[
AC_MSG_ERROR([could not determine ${OCTAVE} version])
])
......@@ -347,7 +363,7 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
# Octave without having to add to OCTAVE_PATH
AC_MSG_CHECKING([${OCTAVE} .oct installation directory])
for octave_prefix_variable in OCTAVE_HOME PREFIX; do
octave_prefix=[`env -u ${octave_prefix_variable} ${octave_cfg} -p ${octave_prefix_variable} 2>/dev/null | ${SED} -e 's|/*$||'`]
octave_prefix=[`${octave_cfg} -p ${octave_prefix_variable} 2>/dev/null | ${SED} -e 's|/*$||'`]
AS_IF([test "x${octave_prefix}" != x],[
break
])
......@@ -355,7 +371,7 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
AS_IF([test "x${octave_prefix}" = x],[
AC_MSG_ERROR([could not determine ${OCTAVE} installation prefix])
])
octexecdir=[`env -u LOCALVEROCTFILEDIR ${octave_cfg} -p LOCALVEROCTFILEDIR 2>/dev/null | ${SED} -e 's|/*$||'`]
octexecdir=[`${octave_cfg} -p LOCALVEROCTFILEDIR 2>/dev/null | ${SED} -e 's|/*$||'`]
octexecdir=[`echo ${octexecdir} | ${SED} -e "s|^${octave_prefix}/||"`]
AS_IF([test "x`echo ${octexecdir} | ${SED} -n -e '\|^/|p'`" != x],[
AC_MSG_ERROR([could not build relative path from "${octexecdir}"])
......@@ -366,7 +382,7 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
# determine C++ compiler used to compile Octave itself
AC_MSG_CHECKING([C++ compiler used for building ${OCTAVE}])
octave_CXX=`env -u CXX ${mkoctfile} -p CXX 2>/dev/null`
octave_CXX=`${mkoctfile} -p CXX 2>/dev/null`
AS_IF([test "x${octave_CXX}" = x],[
AC_MSG_ERROR([could not determine C++ compiler used for building ${OCTAVE}])
])
......@@ -415,7 +431,7 @@ int main() { std::string s = "a"; return 0; }
AC_SUBST([SWIG_OCTAVE_CPPFLAGS],[])
AC_SUBST([SWIG_OCTAVE_CPPFLAGS_IOCTAVE],[])
for arg in CPPFLAGS INCFLAGS; do
for flag in `env -u ${arg} ${mkoctfile} -p ${arg} 2>/dev/null`; do
for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
AS_CASE([${flag}],
[-I*/octave],[SWIG_OCTAVE_CPPFLAGS_IOCTAVE="${flag}"],
[SWIG_OCTAVE_CPPFLAGS="${SWIG_OCTAVE_CPPFLAGS} ${flag}"]
......@@ -427,7 +443,7 @@ int main() { std::string s = "a"; return 0; }
AC_SUBST([SWIG_OCTAVE_CXXFLAGS],[])
swig_octave_cxxflags=
for arg in CXX CXXPICFLAG ALL_CXXFLAGS; do
for flag in `env -u ${arg} ${mkoctfile} -p ${arg} 2>/dev/null`; do
for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
AS_CASE([${flag}],
[-*],[swig_octave_cxxflags="${swig_octave_cxxflags} ${flag}"]
)
......@@ -451,7 +467,7 @@ int main() { std::string s = "a"; return 0; }
AC_SUBST([SWIG_OCTAVE_LDFLAGS],[])
swig_octave_ldflags=
for arg in OCTLIBDIR; do
for flag in `env -u ${arg} ${mkoctfile} -p ${arg} 2>/dev/null`; do
for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
AS_CASE([${flag}],
[/*],[swig_octave_ldflags="${swig_octave_ldflags}-L${flag} "],
[:]
......@@ -459,7 +475,7 @@ int main() { std::string s = "a"; return 0; }
done
done
for arg in LDFLAGS LFLAGS LIBOCTINTERP LIBOCTAVE LIBCRUFT OCT_LINK_OPTS OCT_LINK_DEPS; do
for flag in `env -u ${arg} ${mkoctfile} -p ${arg} 2>/dev/null`; do
for flag in `${mkoctfile} -p ${arg} 2>/dev/null`; do
AS_CASE([${flag}],
[-L/usr/lib|-L/usr/lib64],[:],
[-Xlinker],[swig_octave_ldflags="${swig_octave_ldflags}-Wl,"],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment