Re: Building 4.1.0 rc1 on Solaris 8 and 9 with gcc 3.3.2

Chad Walstrom <[email protected]> Thu, 18 Nov 2004 12:04:34 -0600
Newsgroups gmane.comp.bug-tracking.gnats.bugs
Message-ID <[email protected]>
--===============0985252024==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw"
Content-Disposition: inline


--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Tim Buck wrote:
> For what it's worth, I get the same error on FreeBSD 4.9 (with gcc
> 2.95.4) that Yngve gets on Solaris.

*sigh*  I had a bad feeling about the whole libiberty/*, include/*
update.  I'm glad I tagged CVS before making changes.  Anyway, time to
track down the problems:

With respect to the Solaris 8 & 9 builds, libiberty.h and getopt.h fail
at the notorious triple-state macro attempt at resolving declarations
for getopt() and basename().  Here's the explanation in libiberty.h for
basename():

    /* Return the last component of a path name.  Note that we can't use a
       prototype here because the parameter is declared inconsistently
       across different systems, sometimes as "char *" and sometimes as
       "const char *" */

    /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
       undefined, we haven't run the autoconf check so provide the
       declaration without arguments.  If it is 0, we checked and failed
       to find the declaration so provide a fully prototyped one.  If it
       is 1, we found it so don't provide any declaration at all.  */
    #if !HAVE_DECL_BASENAME
    #if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__Fre=
eBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWI=
N__) || defined (__CYGWIN32__) || defined (HAVE_DECL_BASENAME)
    extern char *basename PARAMS ((const char *));
    #else
    extern char *basename ();
    #endif
    #endif

So, it appears that the autoconf check for basename() didn't happen...
Looking in the configure.ac file, I found this wonderful exclusion:

# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
if test "x" =3D "y"; then
  AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc c=
lock \
    getcwd getpagesize index insque mkstemps memchr memcmp memcpy \
=2E..

Not sure if it really matters or not.  I'll dig into this deeper.

Nowhere in the config.in is HAVE_DECL_GETOPT defined, nor is configure
testing for it at all.  It appears that getopt and basename both require
manual definitions of HAVE_DECL_*=3D1 to skip the function declaration or
0 to use it.  Try throwing these defines in your CFLAGS and see what
happens.

Maybe we should ask the gcc folks why this "three-state macro" doesn't
have the glue in configure.ac?

--=20
Chad Walstrom <[email protected]>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */

--GvXjxJ+pjyke8COw
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBnOQxDMcLGCBsWv0RAkqjAKCF6prRvyMg0aYhFG2t4yx783IS6wCgvPLd
yNfqCQdACaxlrUhs+z7duhg=
=sXav
-----END PGP SIGNATURE-----

--GvXjxJ+pjyke8COw--



--===============0985252024==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Bug-gnats mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnats

--===============0985252024==--