Re: minor portability patches

Jan Kratochvil
2010-09-23T19:44:50Z

On Tue, 21 Sep 2010 18:48:16 +0200, Peter O'Gorman wrote:
> -rdynamic was being added regardless, causing link failures on multiple
> platforms.
> 0003-Don-t-use-rdynamic-by-default-for-non-gcc.patch
[...]
> - found="-rdynamic"
> - RDYNAMIC="-rdynamic"
> + if test "$GCC" = "yes"; then
> + found="-rdynamic"
> + RDYNAMIC="-rdynamic"
> + else
> + found=none
> + RDYNAMIC=
> + fi

I would slightly prefer to bring it more on-par with gdbserver/configure.ac
using AC_TRY_LINK. On local OpenSolaris there is gcc but Sun linker. Still
it worked there, though - as gcc complains but works even with -dynamic.

Thanks,
Jan

2010-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>

* configure.ac: Use -rdynamic optionally, based on AC_TRY_LINK.
* configure: Regenerate.

--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1496,8 +1496,13 @@ if $dynamic_list; then
found="-Wl,--dynamic-list"
RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
else
- found="-rdynamic"
- RDYNAMIC="-rdynamic"
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$old_LDFLAGS -rdynamic"
+ AC_TRY_LINK([], [], [found="-rdynamic"
+ RDYNAMIC="-rdynamic"],
+ [found="no"
+ RDYNAMIC=""])
+ LDFLAGS="$old_LDFLAGS"
fi
AC_SUBST(RDYNAMIC)
AC_MSG_RESULT($found)