Commit 20574c73 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix problem with linkers that don't support the '-E' flag

The '-E' flag is necessary with GNU ld so that all dynamic symbols are
properly exported, and things like typeid() work across DSO
boundaries. However there are other linkers out there which don't accept
this option. This commit checks for this and drops the option in that
case. Let us hope those linkers do the right thing, or wait until
someone complains...
parent 6ce01477
......@@ -835,3 +835,44 @@ if test "$ac_cv_boost_python" = "yes"; then
AC_SUBST(BOOST_PYTHON_LIB)
fi
])dnl
# This macro tests if the C++ compiler supports the flag FLAG-TO-CHECK. If
# successfull execute ACTION-IF-SUCCESS otherwise ACTION-IF-FAILURE. PROLOGUE
# and BODY are optional and should be used as in AC_LANG_PROGRAM macro.
AC_DEFUN([AX_LD_CHECK_FLAG],[
AC_PREREQ([2.61])
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PROG_SED])
flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
AC_CACHE_CHECK([whether the linker accepts the $1 flag],
[ax_cv_ld_check_flag_$flag],[
#AC_LANG_PUSH([C])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([$2],[$3])
],[
eval "ax_cv_ld_check_flag_$flag=yes"
],[
eval "ax_cv_ld_check_flag_$flag=no"
])
LDFLAGS="$save_LDFLAGS"
#AC_LANG_POP
])
AS_IF([eval "test \"`echo '$ax_cv_ld_check_flag_'$flag`\" = yes"],[
:
$4
],[
:
$5
])
])
......@@ -17,6 +17,14 @@ AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_INSTALL
dnl needed for typeinfo objects to work across DSO boundaries. (see
dnl http://gcc.gnu.org/faq.html#dso). however this only works for GNU
dnl ld. Hopefully other linkers will behave properly...
AX_LD_CHECK_FLAG([-Wl,-E],[],[],
[LD_EXPORT_DYNAMIC="-Wl,-E"],
[LD_EXPORT_DYNAMIC=""])
AC_SUBST(LD_EXPORT_DYNAMIC)
dnl Checks for options
dnl Turn debugging on or off
......
......@@ -75,5 +75,4 @@ libgraph_tool_la_LDFLAGS = \
-avoid-version \
-export-dynamic \
-no-undefined \
-Wl,-E
$(LD_EXPORT_DYNAMIC)
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