autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arm gcc 4.1.3 -O2 dead code removal breaks configure test


From: Dave Hart
Subject: Re: arm gcc 4.1.3 -O2 dead code removal breaks configure test
Date: Wed, 30 Mar 2011 06:17:53 +0000

On Tue, Mar 29, 2011 at 17:18 UTC, Ralf Wildenhues wrote:
> * Dave Hart wrote on Tue, Mar 29, 2011 at 11:58:53AM CEST:
> > We have a solution, changing the test to assign the address of
> > in6addr_any to a global variable preserves the reference:
>
> > struct in6_addr * pin6addr_any = &in6addr_any;
>
> > Is our fix the best you can imagine?
>
> In order to be absolutely sure that the compiler can't optimize away the
> reference, I'd say you need to modify external state depending on it.
> Typically, you can do that by printing its contents, or, if those aren't
> well-defined (so the compiler might warn about that), its address (with
> %lu and cast to unsigned long, for portability).  Of course this means
> the test needs to include AC_INCLUDES_DEFAULT in the test header, for
> stdio.h.  The latter means you can then drop including sys/types another
> time.

Hi Ralf, thank your for your thoughtful and timely response.  I've
changed as you suggest:

                printf("%x", in6addr_any.s6_addr[15]);

in6_addr has one standard member: u_int8_t s6_addr[16];

The entirety is below.  I'd like to say for the record:  Autoconf
Rocks!  Autotools rock my world!   ;)

Seriously, the folks maintaining the NTP reference implementation care
about supporting users on ancient, decrepit systems.  We care about
supporting use of ntpd on embedded systems with esoteric processors
and tools.  While we may have a user or three who think of ntpd as
merely a component of their favorite latest Linux distribution, those
of us maintaining the distribution value portability.  We do not like
to hear from would-be users their platform can't build NTP.  If a
system has an adjustable clock, an ANSI C/ISO C90 compiler and the few
basic POSIX tools relied upon by Autotooled tarballs, we want to
support it.  Autoconf, automake, and libtool are giants I proudly
stand on the shoulders of.   Thanks to everyone maintaining Autotools,
and don't let the bastards wear you down!

Cheers,
Dave Hart

AC_CACHE_CHECK(
    [for in6addr_any],
    [isc_cv_in6addr_any_links],
    [
        SAVED_LIBS="$LIBS"
        LIBS="$LDADD_LIBNTP $LIBS"
        AC_LINK_IFELSE(
            [AC_LANG_PROGRAM(
                AC_INCLUDES_DEFAULT [[
                    #include <sys/socket.h>
                    #include <netinet/in.h>
                    $isc_netinetin6_hack
                    $isc_netinet6in6_hack
                ]],
                [[
                    printf("%x", in6addr_any.s6_addr[15]);
                ]]
            )],
            [isc_cv_in6addr_any_links=yes],
            [isc_cv_in6addr_any_links=no]
        )
        LIBS="$SAVED_LIBS"
        AS_UNSET([SAVED_LIBS])
    ]
)

case "$isc_cv_in6addr_any_links" in
 no)
    AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
esac



reply via email to

[Prev in Thread] Current Thread [Next in Thread]