This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Ping^2: [Patch] PR 37454 - Fix -rdynamic check in gcc/configure
* Steve Ellcey wrote on Mon, Jan 11, 2010 at 06:55:44PM CET:
> On Sun, 2010-01-10 at 08:59 +0100, Ralf Wildenhues wrote:
>
> > It would be a bit nicer on the next person trying to debug failures here
> > to use AC_TRY_LINK (or, preferably, AC_LINK_IFELSE) so that the command
> > and its output are logged in config.log. The generated program is
> > available for further testing in the ACTION-IF-TRUE argument of the
> > respective macro. (Speak up if you want me to hack up a patch.)
> Is this what you had in mind?
Mostly, yes.
AC_LANG_PROGRAM already provides a main function for you, all you need
to do is provide a prologue in the first argument, and an optional body
of main in the second (it can be empty).
> I haven't fully tested it yet, but if it
> looks good to you I can finish testing and then propose it as an
> official patch.
>
> Actually, I see now this isn't right, I am using conftest as the
> executable name and that probably isn't right. How do I access the name
> of the executable in the ACTION-IF-TRUE section? I didn't see that in
> the autoconf documentation.
It's conftest$EXEEXT and I think we fixed the Autoconf documentation to
mention it a while ago, but thanks.
> --- configure.ac (revision 155813)
> +++ configure.ac (working copy)
> @@ -4298,20 +4298,26 @@ enable_plugin=yes; default_plugin=yes)
> pluginlibs=
> if test x"$enable_plugin" = x"yes"; then
>
> + # Check if -rdynamic is needed.
> AC_MSG_CHECKING([for exported symbols])
[...]
> + AC_LINK_IFELSE(
> + [AC_LANG_PROGRAM(
> + [int main() {return 0;} int foobar() {return 0;}])],
This can just be [AC_LANG_PROGRAM([int foobar () { return 0; }], [])],
otherwise you have two definitions of main.
> + [if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
> + : # No need to use a flag
> + else
> + AC_MSG_CHECKING([for -rdynamic])
> + AC_LINK_IFELSE(
> + [AC_LANG_PROGRAM(
> + [int main() {return 0;} int foobar() {return 0;}])],
Likewise.
> + [if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
> + pluginlibs="-rdynamic"
> + else
> + enable_plugin=no
> + fi],
> + [enable_plubin=no]
typo s/plubin/plugin/
> + fi)],
This closin paren ) is too late here, it needs to end the previous line,
I think
> + [enable_plugin=no])
>
> # Check -ldl
> saved_LIBS="$LIBS"