Commit 880090a2 authored by Karl Wette's avatar Karl Wette

lalsuite_swig.m4: refine test for compatibility between C++ compilers

- Link a simple C++ program with both ${CXX} and ${octave_CXX} and
  check that they link against the same standard C++ libraries
- Refs #4536
Original: fd0fbe558d731e1ddd7b32a4580cc42a8160e777
parent 8d72fc82
......@@ -2,7 +2,7 @@
# lalsuite_swig.m4 - SWIG configuration
# Author: Karl Wette, 2011--2014
#
# serial 87
# serial 88
AC_DEFUN([_LALSUITE_CHECK_SWIG_VERSION],[
# $0: check the version of $1, and store it in ${swig_version}
......@@ -275,18 +275,48 @@ AC_DEFUN([LALSUITE_USE_SWIG_OCTAVE],[
AC_MSG_RESULT([${octexecdir}])
AC_SUBST([octexecdir])
# check that wrappings are being compiled with the
# same C++ compiler used to compile Octave itself
# determine C++ compiler used to compile Octave itself
AC_MSG_CHECKING([C++ compiler used for building ${OCTAVE}])
octave_CXX=`${mkoctfile} -p CXX 2>/dev/null`
AC_MSG_RESULT([${octave_CXX}])
CXX_version_regex=['s|([^)]*) *||g;s|^ *||g;s| *$||g']
octave_CXX_version=`${octave_CXX} --version 2>/dev/null | ${SED} -n -e '1p' | ${SED} -e "${CXX_version_regex}"`
_AS_ECHO_LOG([octave_CXX_version: '${octave_CXX_version}'])
lalsuite_CXX_version=`${CXX} --version 2>/dev/null | ${SED} -n -e '1p' | ${SED} -e "${CXX_version_regex}"`
_AS_ECHO_LOG([lalsuite_CXX_version: '${lalsuite_CXX_version}'])
AS_IF([test "x${lalsuite_CXX_version}" != "x${octave_CXX_version}"],[
AC_MSG_ERROR([configured C++ compiler "${CXX}" differs from ${OCTAVE} C++ compiler "${octave_CXX}"])
# check that configured C++ compiler is compatible with C++ compiler used to
# compile Octave itself, i.e. that both compilers link against compatible C++
# libraries (e.g. libstdc++ vs libc++).
AC_MSG_CHECKING([configured C++ compiler "${CXX}" is compatible with ${OCTAVE} C++ compiler "${octave_CXX}"])
AS_IF([test "x${build_vendor}" = xapple && otool --version >/dev/null 2>&1],[
print_shared_libs="otool -L"
],[ldd --version >/dev/null 2>&1],[
print_shared_libs="ldd"
],[
AC_MSG_ERROR([could not determine tool to print shared library dependencies])
])
swig_save_CXX=${CXX}
LALSUITE_PUSH_UVARS
LALSUITE_CLEAR_UVARS
m4_foreach([cxxloop],[CXX,octave_CXX],[
CXX=${cxxloop}
AC_LINK_IFELSE([
AC_LANG_SOURCE([[
#include <string>
int main() { std::string s = "a"; return 0; }
]])
],[
print_shared_libs_regex=["\|conftest${EXEEXT}|d;"'s|(0x[^)]*)||g;s|^ *||g;s| *$||g']
${print_shared_libs} conftest${EXEEXT} | ${SED} -e "${print_shared_libs_regex}" | sort > conftest_lalsuite_swig_[]cxxloop[]_shared_libs
echo "${as_me}:${as_lineno-$LINENO}:${CXX} shared libraries:" >&AS_MESSAGE_LOG_FD
${SED} -e ["s/^/${as_me}:${as_lineno-$LINENO}:/"] conftest_lalsuite_swig_[]cxxloop[]_shared_libs >&AS_MESSAGE_LOG_FD
],[
AC_MSG_ERROR([could not link using ${CXX}])
])
])
LALSUITE_POP_UVARS
CXX=${swig_save_CXX}
AS_IF([diff conftest_lalsuite_swig_CXX_shared_libs conftest_lalsuite_swig_octave_CXX_shared_libs >/dev/null 2>&1],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([configured C++ compiler "${CXX}" is incompatible with ${OCTAVE} C++ compiler "${octave_CXX}"])
])
# determine Octave preprocessor flags
......
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