summaryrefslogtreecommitdiff
path: root/m4/gnu-source.m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-07-09 17:24:41 +0000
committerJim Meyering <jim@meyering.net>2000-07-09 17:24:41 +0000
commita27a4be2d0edad4cc0057b58c75795508ba98abe (patch)
treec61b4f7e1b22fcc8198816eb5e58cb63562036fe /m4/gnu-source.m4
parent07cdecb35d095d4afcd03178208b7557834f2ff0 (diff)
downloadcoreutils-a27a4be2d0edad4cc0057b58c75795508ba98abe.tar.xz
(AC__GNU_SOURCE): New file/macro.
Diffstat (limited to 'm4/gnu-source.m4')
-rw-r--r--m4/gnu-source.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/m4/gnu-source.m4 b/m4/gnu-source.m4
new file mode 100644
index 000000000..ad410d1f9
--- /dev/null
+++ b/m4/gnu-source.m4
@@ -0,0 +1,25 @@
+#serial 1
+# Make sure _GNU_SOURCE is defined where necessary: as early as possible
+# for configure-time tests, as well as for every source file that includes
+# config.h.
+
+# From Jim Meyering.
+
+AC_DEFUN(AC__GNU_SOURCE,
+[
+ # Make sure that _GNU_SOURCE is defined for all subsequent
+ # configure-time compile tests.
+ # This definition must be emitted (into confdefs.h) before any
+ # test that involves compilation.
+ AC_DEFINE(_GNU_SOURCE_KLUDGE, [1
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif], [This definition has a four-line value, the last three of which
+ensure that _GNU_SOURCE is defined in confdefs.h.])
+
+ # Emit this code into config.h.in.
+ # The ifndef is to avoid redefinition warnings.
+ AH_VERBATIM([_GNU_SOURCE], [#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif])
+])