?RCS: Revision 3.0.1.1 1997/02/28 15:34:33 ram
?RCS: patch61: created
?RCS:
-?MAKE:d_gnulibc: Myread Oldconfig Setvar rm \
- Compile run
+?MAKE:d_gnulibc gnulibc_version: Myread Oldconfig Setvar rm \
+ cat Compile run
?MAKE: -pick add $@ %<
?S:d_gnulibc:
?S: Defined if we're dealing with the GNU C Library.
?S:.
+?S:gnulibc_version:
+?S: This variable contains the version number of the GNU C library.
+?S: It is usually something like '2.2.5'. It is a plain '' if this
+?S: is not the GNU C library, or if the version is unknown.
+?S:.
?C:HAS_GNULIBC:
?C: This symbol, if defined, indicates to the C program that
-?C: the GNU C library is being used.
+?C: the GNU C library is being used. A better check is to use
+?C: the __GLIBC__ and __GLIBC_MINOR__ symbols supplied with glibc.
?C:.
+?F:!glibc.ver
?H:#$d_gnulibc HAS_GNULIBC /**/
?H:?%<:#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)
?H:?%<:# define _GNU_SOURCE
?H:?%<:#endif
?H.
?LINT: set d_gnulibc
-?X: gnulibc can be executed by calling this entry point.
+?X: gnulibc can be executed by calling __libc_main().
?X: Ulrich Drepper doesn't think any other libc does that,
?X: but we check if it says 'GNU C Library' to be sure.
?X:
?X: extern const char * __gnu_get_libc_release(void);
?X: extern const char * __gnu_get_libc_version(void);
?X: functions. --thanks to Andreas Jaeger. --AD 6/1998.
-?X:
+?X: Although the exact format isn't documented, __gnu_get_libc_version()
+?X: returns a simple string '2.1.3' in glibc 2.1.3.
+?X:
echo " "
echo "Checking for GNU C Library..." >&4
-cat >try.c <<EOM
+cat >try.c <<'EOCP'
+/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
+ alone are insufficient to distinguish different versions, such as
+ 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
+ libc version 2.1.0. A. Dougherty, June 3, 2002.
+*/
#include <stdio.h>
-int main()
+int main(void)
{
#ifdef __GLIBC__
- exit(0);
+# ifdef __GLIBC_MINOR__
+# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+# include <gnu/libc-version.h>
+ printf("%s\n", gnu_get_libc_version());
+# else
+ printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
+# endif
+# else
+ printf("%d\n", __GLIBC__);
+# endif
+ return 0;
#else
- exit(1);
+ return 1;
#endif
}
-EOM
+EOCP
set try
-if eval $compile_ok && $run ./try; then
+if eval $compile_ok && $run ./try > glibc.ver; then
val="$define"
- echo "You are using the GNU C Library"
+ gnulibc_version=`$cat glibc.ver`
+ echo "You are using the GNU C Library version $gnulibc_version"
else
val="$undef"
+ gnulibc_version=''
echo "You are not using the GNU C Library"
fi
-$rm -f try try.*
+$rm -f try try.* glibc.ver
set d_gnulibc
eval $setvar
?MAKE:d_stdstdio d_stdiobase stdio_ptr stdio_cnt \
d_stdio_ptr_lval_sets_cnt d_stdio_ptr_lval_nochange_cnt stdio_base \
stdio_bufsiz d_stdio_cnt_lval d_stdio_ptr_lval stdio_filbuf: cat \
- Compile contains rm \
+ Compile contains rm d_gnulibc gnulibc_version \
Setvar Findhdr Oldconfig run to
?MAKE: -pick weed $@ %<
?S:d_stdstdio:
echo "Your stdio doesn't appear very std."
fi
$rm -f try.c try
+
+# glibc 2.2.90 and above apparently change stdio streams so Perl's
+# direct buffer manipulation no longer works. The Configure tests
+# should be changed to correctly detect this, but until then,
+# the following check should at least let perl compile and run.
+# (This quick fix should be updated before 5.8.1.)
+# To be defensive, reject all unknown versions, and all versions > 2.2.9.
+# A. Dougherty, June 3, 2002.
+case "$d_gnulibc" in
+$define)
+ case "$gnulibc_version" in
+ 2.[01]*) ;;
+ 2.2) ;;
+ 2.2.[0-9]) ;;
+ *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
+ val="$undef"
+ ;;
+ esac
+ ;;
+esac
set d_stdstdio
eval $setvar