# Older GNU ld supports --export-dynamic but --dynamic-list it does not.
RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
LDFLAGS="$LDFLAGS $RDYNAMIC"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ dynamic_list=false
+ if test "${have_libpython}" = no; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- found="-Wl,--dynamic-list"
- RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
+ dynamic_list=true
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ else
+ # Workaround http://bugs.python.org/issue4434 where static
+ # libpythonX.Y.a would get its symbols required for
+ # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
+ # Problem does not happen for the recommended libpythonX.Y.so linkage.
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+ if test "$cross_compiling" = yes; then :
+ true
else
- RDYNAMIC="-rdynamic"
- LDFLAGS="$old_LDFLAGS $RDYNAMIC"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "${have_libpython}/Python.h"
+int
+main ()
+{
+int err;
+ Py_Initialize ();
+ err = PyRun_SimpleString ("import itertools\n");
+ Py_Finalize ();
+ return err == 0 ? 0 : 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ dynamic_list=true
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ CFLAGS="$old_CFLAGS"
+ fi
+ if $dynamic_list;then
+ found="-Wl,--dynamic-list"
+ RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
+ else
+ RDYNAMIC="-rdynamic"
+ LDFLAGS="$old_LDFLAGS $RDYNAMIC"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
found="-rdynamic"
else
found="no"
- # Error on its usage by .mh file.
- RDYNAMIC="no-rdynamic-available"
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+ # Error on its usage by .mh file.
+ RDYNAMIC="no-rdynamic-available"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+ fi
LDFLAGS="$old_LDFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $found" >&5
# Older GNU ld supports --export-dynamic but --dynamic-list it does not.
RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
LDFLAGS="$LDFLAGS $RDYNAMIC"
- AC_TRY_LINK([], [],
- [found="-Wl,--dynamic-list"
- RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'],
- [RDYNAMIC="-rdynamic"
- LDFLAGS="$old_LDFLAGS $RDYNAMIC"
- AC_TRY_LINK([], [],
- [found="-rdynamic"],
- [found="no"
- # Error on its usage by .mh file.
- RDYNAMIC="no-rdynamic-available"])])
+ dynamic_list=false
+ if test "${have_libpython}" = no; then
+ AC_TRY_LINK([], [], [dynamic_list=true])
+ else
+ # Workaround http://bugs.python.org/issue4434 where static
+ # libpythonX.Y.a would get its symbols required for
+ # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
+ # Problem does not happen for the recommended libpythonX.Y.so linkage.
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+ AC_RUN_IFELSE(
+ AC_LANG_PROGRAM(
+ [#include "]${have_libpython}[/Python.h"],
+ [int err;
+ Py_Initialize ();
+ err = PyRun_SimpleString ("import itertools\n");
+ Py_Finalize ();
+ return err == 0 ? 0 : 1;]),
+ [dynamic_list=true], [], [true])
+ CFLAGS="$old_CFLAGS"
+ fi
+ if $dynamic_list;then
+ found="-Wl,--dynamic-list"
+ RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
+ else
+ RDYNAMIC="-rdynamic"
+ LDFLAGS="$old_LDFLAGS $RDYNAMIC"
+ AC_TRY_LINK([], [],
+ [found="-rdynamic"],
+ [found="no"
+ # Error on its usage by .mh file.
+ RDYNAMIC="no-rdynamic-available"])
+ fi
AC_SUBST(RDYNAMIC)
LDFLAGS="$old_LDFLAGS"
AC_MSG_RESULT($found)