1
dnl Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
3
dnl Copying and distribution of this file, with or without modification,
4
dnl are permitted in any medium without royalty provided the copyright
5
dnl notice and this notice are preserved.
8
dnl @synopsis AX_LIB_GLIBC
10
dnl Defines HAVE_GLIBC if libc is the GNU libc.
12
dnl This macro only performs the glibc detection, and not responsible for
13
dnl defining any extension specifiers such as _GNU_SOURCE or _BSD_SOURCE. Do it
14
dnl by separate code as needed, or simply use AC_GNU_SOURCE instead.
16
dnl Although __GLIBC__ is provided by glibc, it is available only after
17
dnl including feature.h. But some extensions of glibc requires that
18
dnl corresponding macro is defined by user before feature.h is included,
19
dnl to be enabled. For example, _GNU_SOURCE is required to enable
20
dnl asprintf(3). So this macro provide HAVE_GLIBC to define such extension
21
dnl specifier macros only if the libc is glibc, to avoid that unneeded
22
dnl macros that may cause an incompatible effect are defined in non-glibc
26
dnl @author YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
27
dnl @version 2006-12-13
28
dnl @license AllPermissive
30
AC_DEFUN([AX_LIB_GLIBC], [
31
AC_CACHE_CHECK([if libc is the GNU libc],
33
[AC_EGREP_CPP([^ax_cv_lib_glibc_yes$], [[
34
/* To avoid being affected from possible header reorganization, this macro
35
* does not include features.h directly. */
37
#if (defined(__GLIBC__) || defined(__GNU_LIBRARY__))
41
[ax_cv_lib_glibc=yes],
42
[ax_cv_lib_glibc=no])])
43
if test "x$ax_cv_lib_glibc" = xyes; then
44
AC_DEFINE(HAVE_GLIBC, 1, [Define to 1 if you have the GNU libc.])