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
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: PATCH: config.if for glibc 2.2
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- Date: Wed, 16 May 2001 18:56:56 +0200 (MET DST)
- cc: Mark Kettenis <kettenis at science dot uva dot nl>, binutils at sourceware dot cygnus dot com, gcc-patches at gcc dot gnu dot org
- Organization: Technical University of Gdansk
- Reply-To: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
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
;;
*)