]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blobdiff - ac_cf_gnu_source.m4
Imported Upstream version 0.4.0
[deb_pkgs/spamass-milter.git] / ac_cf_gnu_source.m4
diff --git a/ac_cf_gnu_source.m4 b/ac_cf_gnu_source.m4
new file mode 100644 (file)
index 0000000..52c1f6f
--- /dev/null
@@ -0,0 +1,31 @@
+dnl BEGIN CF_GNU_SOURCE from lynx 2.8.5 distibution
+dnl $Id: ac_cf_gnu_source.m4,v 1.1 2003/06/07 02:56:50 dnelson Exp $
+dnl ---------------------------------------------------------------------------
+dnl Check if we must define _GNU_SOURCE to get a reasonable value for
+dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
+dnl (or misfeature) of glibc2, which breaks portability of many applications,
+dnl since it is interwoven with GNU extensions.
+dnl
+dnl Well, yes we could work around it...
+AC_DEFUN([CF_GNU_SOURCE],
+[
+AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
+AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+       [cf_cv_gnu_source=no],
+       [cf_save="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+        AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+       [cf_cv_gnu_source=no],
+       [cf_cv_gnu_source=yes])
+       CPPFLAGS="$cf_save"
+       ])
+])
+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+])dnl
+dnl END CF_GNU_SOURCE from lynx 2.8.5 distibution