]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - ac_cf_gnu_source.m4
[svn-inject] Installing original source of spamass-milter
[deb_pkgs/spamass-milter.git] / ac_cf_gnu_source.m4
1 dnl BEGIN CF_GNU_SOURCE from lynx 2.8.5 distibution
2 dnl $Id: ac_cf_gnu_source.m4,v 1.1 2003/06/07 02:56:50 dnelson Exp $
3 dnl ---------------------------------------------------------------------------
4 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
5 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
6 dnl (or misfeature) of glibc2, which breaks portability of many applications,
7 dnl since it is interwoven with GNU extensions.
8 dnl
9 dnl Well, yes we could work around it...
10 AC_DEFUN([CF_GNU_SOURCE],
11 [
12 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
13 AC_TRY_COMPILE([#include <sys/types.h>],[
14 #ifndef _XOPEN_SOURCE
15 make an error
16 #endif],
17         [cf_cv_gnu_source=no],
18         [cf_save="$CPPFLAGS"
19          CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
20          AC_TRY_COMPILE([#include <sys/types.h>],[
21 #ifdef _XOPEN_SOURCE
22 make an error
23 #endif],
24         [cf_cv_gnu_source=no],
25         [cf_cv_gnu_source=yes])
26         CPPFLAGS="$cf_save"
27         ])
28 ])
29 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
30 ])dnl
31 dnl END CF_GNU_SOURCE from lynx 2.8.5 distibution