1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00

1044: Check for -rdynamic with libraries.

With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
-dynamic"; then, cc proceeds anyway, but the option can prevent the
linker from finding the libraries listed in -l operands.  To detect
this, move the -rdynamic check in configure.in down to a place where
the libraries have already been added to $LDFLAGS.  So if -rdynamic
interferes with the search for libraries, ELinks won't use it.

Merely moving the test would also change the location of -rdynamic in
$LDFLAGS.  Counteract that by making the test add -rdynamic to the
beginning of $LDFLAGS, rather than to the end.  This may make the test
more reliable on Solaris.
This commit is contained in:
Kalle Olavi Niemitalo 2008-08-17 22:08:36 +03:00 committed by Kalle Olavi Niemitalo
parent 64f0f6e7a8
commit 49f529a582
2 changed files with 45 additions and 36 deletions

2
NEWS
View File

@ -30,6 +30,8 @@ includes the changes listed under "ELinks 0.11.4.GIT now" below.
SSL errors especially in HTTP POST requests using GnuTLS.
* minor bug 951: SpiderMonkey scripting objects used to prevent ELinks
from removing files from the memory cache.
* build bug 1044: Check whether -rdynamic works with libraries.
With Sun Studio 11 on Solaris 9, it reportedly doesn't.
Bugs that should be removed from NEWS before the 0.12.0 release:

View File

@ -250,42 +250,6 @@ EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
#define a(b,c...) printf(b,##c)],
[a("foo");a("%s","bar");a("%s%s","baz","quux");])
# Check for -rdynamic
#
# gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
# the executable to its dynamic symbol table. ELinks uses this for
# two purposes:
#
# 1. If ELinks detects a bug, it can try to display a backtrace by
# calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
# manual states users of GNU ld must pass -rdynamic to make the
# symbols available to the program.
#
# 2. It would eventually be nice to dynamically load shared
# libraries as plugins (bug 73). The plugins must be able to
# call ELinks functions. This can be implemented either by
# registering all callable functions in ELinks-specific data
# structures, or by letting the dynamic linker handle them.
# The latter way requires something equivalent to -rdynamic.
#
# Because backtraces are not needed for correct operation, and bug
# 73 is not yet being fixed, the configure script and makefiles
# should not complain to the user if they find that -rdynamic does
# not work. Besides, it was reported at elinks-users on 2006-09-12
# that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
# Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
# -rdynamic but does something equivalent automatically. (This was
# tested with "nm -D elinks | grep redraw_from_window".)
#
# FIXME: This check doesn't work. Something to do with the compiler
# happily ignoring it and stderr not being checked for error messages.
AC_MSG_CHECKING([for -rdynamic])
LDFLAGS_X="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
AC_MSG_RESULT($have_rdynamic)
# ===================================================================
# Check for POSIX <regex.h>
# ===================================================================
@ -1357,12 +1321,55 @@ AC_ARG_ENABLE(weehoofooboomookerchoo,
[AC_MSG_ERROR(Are you strange, or what?)])
# ===================================================================
# Further LDFLAGS tweaks
# ===================================================================
# == EMX hack
test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
# Check for -rdynamic
#
# gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
# the executable to its dynamic symbol table. ELinks uses this for
# two purposes:
#
# 1. If ELinks detects a bug, it can try to display a backtrace by
# calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
# manual states users of GNU ld must pass -rdynamic to make the
# symbols available to the program.
#
# 2. It would eventually be nice to dynamically load shared
# libraries as plugins (bug 73). The plugins must be able to
# call ELinks functions. This can be implemented either by
# registering all callable functions in ELinks-specific data
# structures, or by letting the dynamic linker handle them.
# The latter way requires something equivalent to -rdynamic.
#
# Because backtraces are not needed for correct operation, and bug
# 73 is not yet being fixed, the configure script and makefiles
# should not complain to the user if they find that -rdynamic does
# not work. Besides, it was reported at elinks-users on 2006-09-12
# that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
# Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
# -rdynamic but does something equivalent automatically. (This was
# tested with "nm -D elinks | grep redraw_from_window".)
#
# With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
# -dynamic"; then, cc proceeds anyway, but the option can prevent the
# linker from finding the libraries listed in -l operands. So this
# -rdynamic check needs to happen after the libraries have already
# been added to $LDFLAGS.
AC_MSG_CHECKING([for -rdynamic])
LDFLAGS_X="$LDFLAGS"
LDFLAGS="-rdynamic $LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
AC_MSG_RESULT($have_rdynamic)
# ===================================================================
# Export directory paths
# ===================================================================