This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: config.if for glibc 2.2
On Wed, May 16, 2001 at 06:56:56PM +0200, Maciej W. Rozycki wrote:
> On Tue, 15 May 2001, H . J . Lu wrote:
>
> > I don't think so. I created config.if for backward run-time binary
> > compatibility. If you need a file for some other purposes, you should
> > use a different file. You should either remove config.if all together
> > or keep it as is. I am ok with either option.
>
> If config.if is to be kept, the following patch would be more
> appropriate, I would say. Why to hardcode the glibc's version number when
> we can actually ask glibc what version it is?
>
> 2001-05-16 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
>
> * config.if (libc_interface): Use __GLIBC_MINOR__ from
> <features.h> if possible when cross-compiling.
>
> The patch applies cleanly both to 2.95.3 and to 3.0 20010514.
>
> Maciej
>
> --
> + Maciej W. Rozycki, Technical University of Gdansk, Poland +
> +--------------------------------------------------------------+
> + e-mail: macro@ds2.pg.gda.pl, PGP key available +
>
> gcc-2.95.3-libc_interface.patch
> diff -up --recursive --new-file gcc-2.95.3.macro/config.if gcc-2.95.3/config.if
> --- gcc-2.95.3.macro/config.if Sun Oct 18 17:37:10 1998
> +++ gcc-2.95.3/config.if Thu Apr 5 07:49:27 2001
> @@ -76,8 +76,13 @@ EOF
> exit 1
> fi
> else
> - # Cross compiling. Assume glibc 2.1.
> - libc_interface=-libc6.1-
> + # Cross compiling.
> + # Try to extract the version with cpp or fall back to glibc 2.1.
> + libc_minor="`{ echo "#include <features.h>";
> + echo "@@@ __GLIBC_MINOR__"; } |
> + ${CC-cc} -E - 2>/dev/null | sed -n 's/^@@@ //gp' | sed 's/[ ]//g'`"
> + test "${libc_minor}" -ge 0 2>/dev/null || libc_minor=1
> + libc_interface=-libc6.${libc_minor}-
> fi
> ;;
> *)
Wrong. Which compiler are you using to do such a test when you build a
cross compiler? The right compiler to use is the cross compiler you
are trying to configure/build. It may not even exist at this point. It
is a chicken and egg problem. That is why I hard coded it.
It is a very tricky problem. There are many ugly ways to detect
__GLIBC_MINOR__. I don't like them very much nor want to spend my
time on them.
H.J.