1 ?RCS: $Id: d_gnulibc.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1996,1998 Andy Dougherty
4 ?RCS: Copyright (c) 1996, Sven Verdoolaege
5 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
7 ?RCS: You may redistribute only under the terms of the Artistic Licence,
8 ?RCS: as specified in the README file that comes with the distribution.
9 ?RCS: You may reuse parts of this distribution only within the terms of
10 ?RCS: that same Artistic Licence; a copy of which may be found at the root
11 ?RCS: of the source tree for dist 4.0.
13 ?MAKE:d_gnulibc gnulibc_version: Myread Oldconfig Setvar rm \
15 ?MAKE: -pick add $@ %<
17 ?S: Defined if we're dealing with the GNU C Library.
20 ?S: This variable contains the version number of the GNU C library.
21 ?S: It is usually something like '2.2.5'. It is a plain '' if this
22 ?S: is not the GNU C library, or if the version is unknown.
25 ?C: This symbol, if defined, indicates to the C program that
26 ?C: the GNU C library is being used. A better check is to use
27 ?C: the __GLIBC__ and __GLIBC_MINOR__ symbols supplied with glibc.
29 ?H:?%<:#$d_gnulibc HAS_GNULIBC /**/
30 ?H:?%<:#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)
31 ?H:?%<:#define _GNU_SOURCE
34 ?F:!glibc.ver !try.c !try
37 ?LINT: known _GNU_SOURCE
38 ?X: gnulibc can be executed by calling __libc_main().
39 ?X: Ulrich Drepper doesn't think any other libc does that,
40 ?X: but we check if it says 'GNU C Library' to be sure.
42 ?X: Alas, as of 3/1998 glibc 2.0.7 reportedly isn't going to
43 ?X: have __libc_main() anymore. :-(. Fortunately, all released
44 ?X: versions of glibc 2.x.x _do_ have CPP variables. For 2.0.6,
46 ?X: #define __GLIBC__ 2
47 ?X: #define__GLIBC_MINOR__ 0.
48 ?X: (The '6' isn't available :-(.
49 ?X: glibc2.1 will also have
50 ?X: extern const char * __gnu_get_libc_release(void);
51 ?X: extern const char * __gnu_get_libc_version(void);
52 ?X: functions. --thanks to Andreas Jaeger. --AD 6/1998.
53 ?X: Although the exact format isn't documented, __gnu_get_libc_version()
54 ?X: returns a simple string '2.1.3' in glibc 2.1.3.
56 : determine whether we are using a GNU C library
58 echo "Checking for GNU C Library..." >&4
60 /* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
61 alone are insufficient to distinguish different versions, such as
62 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
63 libc version 2.1.0. A. Dougherty, June 3, 2002.
69 # ifdef __GLIBC_MINOR__
70 # if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
71 # include <gnu/libc-version.h>
72 printf("%s\n", gnu_get_libc_version());
74 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
77 printf("%d\n", __GLIBC__);
86 if eval $compile_ok && $run ./try > glibc.ver; then
88 gnulibc_version=`$cat glibc.ver`
89 echo "You are using the GNU C Library version $gnulibc_version"
93 echo "You are not using the GNU C Library"
95 $rm -f try try.* glibc.ver