This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: config.if for glibc 2.2

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  <>

	* 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 W. Rozycki, Technical University of Gdansk, Poland   +
+        e-mail:, PGP key available        +

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
-      # 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}-

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]