File: ax_lib_glibc.m4

package info (click to toggle)
sigscheme 0.8.5-4.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,752 kB
  • ctags: 7,396
  • sloc: lisp: 37,498; ansic: 30,976; sh: 10,329; makefile: 746; asm: 333; ruby: 288
file content (46 lines) | stat: -rw-r--r-- 1,767 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
dnl Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
dnl
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright
dnl notice and this notice are preserved.
dnl
dnl
dnl @synopsis AX_LIB_GLIBC
dnl
dnl Defines HAVE_GLIBC if libc is the GNU libc.
dnl
dnl This macro only performs the glibc detection, and not responsible for
dnl defining any extension specifiers such as _GNU_SOURCE or _BSD_SOURCE. Do it
dnl by separate code as needed, or simply use AC_GNU_SOURCE instead.
dnl 
dnl Although __GLIBC__ is provided by glibc, it is available only after
dnl including feature.h. But some extensions of glibc requires that
dnl corresponding macro is defined by user before feature.h is included,
dnl to be enabled. For example, _GNU_SOURCE is required to enable
dnl asprintf(3). So this macro provide HAVE_GLIBC to define such extension
dnl specifier macros only if the libc is glibc, to avoid that unneeded
dnl macros that may cause an incompatible effect are defined in non-glibc
dnl environment.
dnl
dnl @category LIB
dnl @author YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
dnl @version 2006-12-13
dnl @license AllPermissive

AC_DEFUN([AX_LIB_GLIBC], [
  AC_CACHE_CHECK([if libc is the GNU libc],
    ax_cv_lib_glibc,
    [AC_EGREP_CPP([^ax_cv_lib_glibc_yes$], [[
/* To avoid being affected from possible header reorganization, this macro
 * does not include features.h directly. */
#include <stdlib.h>
#if (defined(__GLIBC__) || defined(__GNU_LIBRARY__))
ax_cv_lib_glibc_yes
#endif
      ]],
      [ax_cv_lib_glibc=yes],
      [ax_cv_lib_glibc=no])])
  if test "x$ax_cv_lib_glibc" = xyes; then
    AC_DEFINE(HAVE_GLIBC, 1, [Define to 1 if you have the GNU libc.])
  fi
])