summaryrefslogtreecommitdiff
path: root/libc/posix
diff options
context:
space:
mode:
Diffstat (limited to 'libc/posix')
-rw-r--r--libc/posix/Makefile36
-rw-r--r--libc/posix/confstr.c50
-rw-r--r--libc/posix/confstr.inc198
-rw-r--r--libc/posix/cross-getconf.c144
-rw-r--r--libc/posix/getconf-speclist.c42
-rw-r--r--libc/posix/posix-envs.def151
6 files changed, 244 insertions, 377 deletions
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index a9028ac62..7ec8485ee 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -165,6 +165,7 @@ $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
CFLAGS-regex.c = -Wno-strict-prototypes
CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions
+CFLAGS-pause.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
@@ -335,36 +336,7 @@ $(inst_libexecdir)/getconf: $(inst_bindir)/getconf \
mv -f $@/$$spec.new $@/$$spec; \
done < $(objpfx)getconf.speclist
-# eglibc: If we are cross-compiling, build cross-getconf utility and use it
-# instead of getconf.
-
-# We moved a piece of confstr.c to confstr.inc to share the later with
-# cross-getconf.c.
-confstr.c: confstr.inc
-
-ifeq (no,$(cross-compiling))
-getconf-dep = $(objpfx)getconf
-getconf-cmd = $(run-program-prefix) $(objpfx)getconf
-else
-getconf-dep = $(objpfx)cross-getconf
-getconf-cmd = $(objpfx)cross-getconf
-
-# Get configuration defines for cross-getconf by preprocessing confstr.c.
-$(objpfx)cross-getconf.h: confstr.c
- $(compile.c) -E -dM -o - | grep "define _POSIX_V7_ILP32_OFF32\|define _POSIX_V7_ILP32_OFFBIG\|define _POSIX_V7_LP64_OFF64\|define _POSIX_V7_LPBIG_OFFBIG\|_POSIX_V6_ILP32_OFF32\|define _POSIX_V6_ILP32_OFFBIG\|define _POSIX_V6_LP64_OFF64\|define _POSIX_V6_LPBIG_OFFBIG\|_XBS5_ILP32_OFF32\|define _XBS5_ILP32_OFFBIG\|define _XBS5_LP64_OFF64\|define _XBS5_LPBIG_OFFBIG" > $(objpfx)cross-getconf.h
-
-cross-getconf-CFLAGS = -O -I$(objpfx)
-
-$(objpfx)cross-getconf: cross-getconf.c $(objpfx)cross-getconf.h
- $(native-compile)
-endif
-
-$(objpfx)getconf.speclist: $(getconf-dep)
- LC_ALL=C GETCONF_DIR=/dev/null \
- $(getconf-cmd) _POSIX_V7_WIDTH_RESTRICTED_ENVS > $@.new
- LC_ALL=C GETCONF_DIR=/dev/null \
- $(getconf-cmd) _POSIX_V6_WIDTH_RESTRICTED_ENVS >> $@.new
- LC_ALL=C GETCONF_DIR=/dev/null \
- $(getconf-cmd) _XBS5_WIDTH_RESTRICTED_ENVS >> $@.new
+$(objpfx)getconf.speclist: getconf-speclist.c posix-envs.def
+ $(compile.c) -E -o - \
+ | sed -n -e '/@@@PRESENT_/s/@@@PRESENT_//p' > $@.new
mv -f $@.new $@
-# eglibc: end.
diff --git a/libc/posix/confstr.c b/libc/posix/confstr.c
index 3f79d459a..7d86d60bc 100644
--- a/libc/posix/confstr.c
+++ b/libc/posix/confstr.c
@@ -48,9 +48,53 @@ confstr (name, buf, len)
}
break;
- /* eglibc: We share code in confstr.inc with cross-getconf.c. */
-#include "confstr.inc"
- /* eglibc: end. */
+ /* For _CS_V7_WIDTH_RESTRICTED_ENVS, _CS_V6_WIDTH_RESTRICTED_ENVS
+ and _CS_V5_WIDTH_RESTRICTED_ENVS:
+
+ We have to return a newline-separated list of names of
+ programming environments in which the widths of blksize_t,
+ cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
+ ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
+ wint_t types are no greater than the width of type long.
+
+ Currently this means all environments that the system allows. */
+
+#define START_ENV_GROUP(VERSION) \
+ case _CS_##VERSION##_WIDTH_RESTRICTED_ENVS: \
+ string_len = 0;
+
+#define END_ENV_GROUP(VERSION) \
+ restenvs[string_len++] = '\0'; \
+ string = restenvs; \
+ break;
+
+#define KNOWN_ABSENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ /* Empty. */
+
+#define KNOWN_PRESENT_ENV_STRING(STR) \
+ if (string_len > 0) \
+ restenvs[string_len++] = '\n'; \
+ memcpy (restenvs + string_len, STR, \
+ sizeof STR - 1); \
+ string_len += sizeof STR - 1;
+
+#define KNOWN_PRESENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ KNOWN_PRESENT_ENV_STRING (#ENV_PREFIX "_" #SUFFIX)
+
+#define UNKNOWN_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ if (__sysconf (_SC_##SC_PREFIX##_##SUFFIX) > 0) \
+ { \
+ KNOWN_PRESENT_ENVIRONMENT (SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ }
+
+#include "posix-envs.def"
+
+#undef START_ENV_GROUP
+#undef END_ENV_GROUP
+#undef KNOWN_ABSENT_ENVIRONMENT
+#undef KNOWN_PRESENT_ENV_STRING
+#undef KNOWN_PRESENT_ENVIRONMENT
+#undef UNKNOWN_ENVIRONMENT
case _CS_XBS5_ILP32_OFF32_CFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
diff --git a/libc/posix/confstr.inc b/libc/posix/confstr.inc
deleted file mode 100644
index 9f1a0711e..000000000
--- a/libc/posix/confstr.inc
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Copyright (C) 2008, 2009, 2010
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* eglibc: The following piece of code was extracted from
- confstr.c to share it with cross-getconf.c. */
-
- case _CS_V7_WIDTH_RESTRICTED_ENVS:
- /* We have to return a newline-separated list of named of
- programming environements in which the widths of blksize_t,
- cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
- ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
- wint_t types are no greater than the width of type long.
-
- Currently this means all environment which the system allows. */
- string_len = 0;
-#ifndef _POSIX_V7_ILP32_OFF32
- if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
-#endif
-#if !defined _POSIX_V7_ILP32_OFF32 || _POSIX_V7_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
- sizeof "POSIX_V7_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
- }
-#endif
-#ifndef _POSIX_V7_ILP32_OFFBIG
- if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
-#endif
-#if !defined _POSIX_V7_ILP32_OFFBIG || _POSIX_V7_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
- sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
- }
-#endif
-#ifndef _POSIX_V7_LP64_OFF64
- if (__sysconf (_SC_V7_LP64_OFF64) > 0)
-#endif
-#if !defined _POSIX_V7_LP64_OFF64 || _POSIX_V7_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
- sizeof "POSIX_V7_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
- }
-#endif
-#ifndef _POSIX_V7_LPBIG_OFFBIG
- if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
-#endif
-#if !defined _POSIX_V7_LPBIG_OFFBIG || _POSIX_V7_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
- sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- break;
-
- case _CS_V6_WIDTH_RESTRICTED_ENVS:
- /* We have to return a newline-separated list of named of
- programming environements in which the widths of blksize_t,
- cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
- ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
- wint_t types are no greater than the width of type long.
-
- Currently this means all environment which the system allows. */
- string_len = 0;
-#ifndef _POSIX_V6_ILP32_OFF32
- if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
-#endif
-#if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32",
- sizeof "POSIX_V6_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1;
- }
-#endif
-#ifndef _POSIX_V6_ILP32_OFFBIG
- if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
-#endif
-#if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG",
- sizeof "POSIX_V6_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1;
- }
-#endif
-#ifndef _POSIX_V6_LP64_OFF64
- if (__sysconf (_SC_V6_LP64_OFF64) > 0)
-#endif
-#if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64",
- sizeof "POSIX_V6_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V6_LP64_OFF64" - 1;
- }
-#endif
-#ifndef _POSIX_V6_LPBIG_OFFBIG
- if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
-#endif
-#if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG",
- sizeof "POSIX_V6_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- break;
-
- case _CS_V5_WIDTH_RESTRICTED_ENVS:
- /* We have to return a newline-separated list of named of
- programming environements in which the widths of blksize_t,
- cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
- ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
- wint_t types are no greater than the width of type long.
-
- Currently this means all environment which the system allows. */
- string_len = 0;
-#ifndef _XBS5_ILP32_OFF32
- if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
-#endif
-#if !defined _XBS5_ILP32_OFF32 || _XBS5_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
- sizeof "XBS5_ILP32_OFF32" - 1);
- string_len += sizeof "XBS5_ILP32_OFF32" - 1;
- }
-#endif
-#ifndef _XBS5_ILP32_OFFBIG
- if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
-#endif
-#if !defined _XBS5_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
- sizeof "XBS5_ILP32_OFFBIG" - 1);
- string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
- }
-#endif
-#ifndef _XBS5_LP64_OFF64
- if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
-#endif
-#if !defined _XBS5_LP64_OFF64 || _XBS5_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
- sizeof "XBS5_LP64_OFF64" - 1);
- string_len += sizeof "XBS5_LP64_OFF64" - 1;
- }
-#endif
-#ifndef _XBS5_LPBIG_OFFBIG
- if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
-#endif
-#if !defined _XBS5_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
- sizeof "XBS5_LPBIG_OFFBIG" - 1);
- string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- break;
diff --git a/libc/posix/cross-getconf.c b/libc/posix/cross-getconf.c
deleted file mode 100644
index 7cbd9c7bc..000000000
--- a/libc/posix/cross-getconf.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Undefine macros that should be defined in cross-getconf.h. */
-#undef _POSIX_V7_ILP32_OFF32
-#undef _POSIX_V7_ILP32_OFFBIG
-#undef _POSIX_V7_LP64_OFF64
-#undef _POSIX_V7_LPBIG_OFFBIG
-#undef _POSIX_V6_ILP32_OFF32
-#undef _POSIX_V6_ILP32_OFFBIG
-#undef _POSIX_V6_LP64_OFF64
-#undef _POSIX_V6_LPBIG_OFFBIG
-#undef _XBS5_ILP32_OFF32
-#undef _XBS5_ILP32_OFFBIG
-#undef _XBS5_LP64_OFF64
-#undef _XBS5_LPBIG_OFFBIG
-
-#include "cross-getconf.h"
-
-/* Define macros cross-getconf.h doesn't define to (-1).
- This will prevent using host's __sysconf in confstr.inc. */
-#ifndef _POSIX_V7_ILP32_OFF32
-# define _POSIX_V7_ILP32_OFF32 (-1)
-#endif
-#ifndef _POSIX_V7_ILP32_OFFBIG
-# define _POSIX_V7_ILP32_OFFBIG (-1)
-#endif
-#ifndef _POSIX_V7_LP64_OFF64
-# define _POSIX_V7_LP64_OFF64 (-1)
-#endif
-#ifndef _POSIX_V7_LPBIG_OFFBIG
-# define _POSIX_V7_LPBIG_OFFBIG (-1)
-#endif
-#ifndef _POSIX_V6_ILP32_OFF32
-# define _POSIX_V6_ILP32_OFF32 (-1)
-#endif
-#ifndef _POSIX_V6_ILP32_OFFBIG
-# define _POSIX_V6_ILP32_OFFBIG (-1)
-#endif
-#ifndef _POSIX_V6_LP64_OFF64
-# define _POSIX_V6_LP64_OFF64 (-1)
-#endif
-#ifndef _POSIX_V6_LPBIG_OFFBIG
-# define _POSIX_V6_LPBIG_OFFBIG (-1)
-#endif
-#ifndef _XBS5_ILP32_OFF32
-# define _XBS5_ILP32_OFF32 (-1)
-#endif
-#ifndef _XBS5_ILP32_OFFBIG
-# define _XBS5_ILP32_OFFBIG (-1)
-#endif
-#ifndef _XBS5_LP64_OFF64
-# define _XBS5_LP64_OFF64 (-1)
-#endif
-#ifndef _XBS5_LPBIG_OFFBIG
-# define _XBS5_LPBIG_OFFBIG (-1)
-#endif
-
-#undef _CS_V5_WIDTH_RESTRICTED_ENVS
-#define _CS_V5_WIDTH_RESTRICTED_ENVS 5
-
-#undef _CS_V6_WIDTH_RESTRICTED_ENVS
-#define _CS_V6_WIDTH_RESTRICTED_ENVS 6
-
-#undef _CS_V7_WIDTH_RESTRICTED_ENVS
-#define _CS_V7_WIDTH_RESTRICTED_ENVS 7
-
-/* Cross-getconf is a very simple program that assumes fixed
- input and produces fixed output. It handles only cases
- that are necessary to cross-compile EGLIBC. */
-
-void
-cross_getconf (int name)
-{
- const char *string = "";
- size_t string_len = 1;
-
- /* Note that this buffer must be large enough for the longest strings
- used below. */
- char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"];
-
- switch (name)
- {
-#include "confstr.inc"
- }
-
- printf ("%.*s\n", (int) string_len, string);
-}
-
-int
-main (int argc, char *argv[])
-{
- const char *getconf_dir;
-
- if (argc != 2)
- {
- fprintf (stderr,
- "%s: must be called with exactly one argument\n", argv[0]);
- return 1;
- }
-
- getconf_dir = getenv ("GETCONF_DIR");
- if (getconf_dir == NULL
- || strcmp (getconf_dir, "/dev/null") != 0)
- {
- fprintf (stderr, "%s: GETCONF_DIR should be /dev/null\n", argv[0]);
- return 1;
- }
-
- if (strcmp (argv[1], "_POSIX_V7_WIDTH_RESTRICTED_ENVS") == 0)
- cross_getconf (_CS_V7_WIDTH_RESTRICTED_ENVS);
- else if (strcmp (argv[1], "_POSIX_V6_WIDTH_RESTRICTED_ENVS") == 0)
- cross_getconf (_CS_V6_WIDTH_RESTRICTED_ENVS);
- else if (strcmp (argv[1], "_XBS5_WIDTH_RESTRICTED_ENVS") == 0)
- cross_getconf (_CS_V5_WIDTH_RESTRICTED_ENVS);
- else
- {
- fprintf (stderr,
- "%s: the only supported arguments value are "
- "_POSIX_V7_WIDTH_RESTRICTED_ENVS, "
- "_POSIX_V6_WIDTH_RESTRICTED_ENVS, and "
- "_XBS5_WIDTH_RESTRICTED_ENVS\n", argv[0]);
- return 1;
- }
- return 0;
-}
diff --git a/libc/posix/getconf-speclist.c b/libc/posix/getconf-speclist.c
new file mode 100644
index 000000000..72c5c3de8
--- /dev/null
+++ b/libc/posix/getconf-speclist.c
@@ -0,0 +1,42 @@
+/* List POSIX compilation environments for this libc.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+#define START_ENV_GROUP(VERSION) \
+ /* Empty. */
+
+#define END_ENV_GROUP(VERSION) \
+ /* Empty. */
+
+#define KNOWN_ABSENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ /* Empty. */
+
+#define KNOWN_PRESENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ @@@PRESENT_##ENV_PREFIX##_##SUFFIX
+
+#define UNKNOWN_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX) \
+ /* Empty. */
+
+#include "posix-envs.def"
+
+#undef START_ENV_GROUP
+#undef END_ENV_GROUP
+#undef KNOWN_ABSENT_ENVIRONMENT
+#undef KNOWN_PRESENT_ENVIRONMENT
+#undef UNKNOWN_ENVIRONMENT
diff --git a/libc/posix/posix-envs.def b/libc/posix/posix-envs.def
new file mode 100644
index 000000000..c32ea8acf
--- /dev/null
+++ b/libc/posix/posix-envs.def
@@ -0,0 +1,151 @@
+/* Handle POSIX compilation environments that may or may not be present.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Before including this file, the including file must have included
+ <bits/environments.h> (generally via <unistd.h>) and must have
+ defined the following macros, exactly one of which will be called
+ for each POSIX environment:
+
+ KNOWN_PRESENT_ENVIRONMENT, for POSIX environments that are known to
+ be supported in this libc.
+
+ KNOWN_ABSENT_ENVIRONMENT, for POSIX environments that are known not
+ to be supported on this system.
+
+ UNKNOWN_ENVIRONMENT, for POSIX environments not supported in this
+ libc but possibly supported by another libc on the same system,
+ that can be selected using the same compiler but different
+ compilation options.
+
+ Each macro has arguments (SC_PREFIX, ENV_PREFIX, SUFFIX). The
+ corresponding argument to sysconf is _SC_##SC_PREFIX##_##SUFFIX.
+ The environment name, as used with getconf, is
+ ENV_PREFIX##_##SUFFIX, and the corresponding macro is the same with
+ a leading "_".
+
+ In addition, the macros START_ENV_GROUP and END_ENV_GROUP must be
+ defined. These are called with arguments V5, V6, V7 before and
+ after the relevant groups of environments. */
+
+START_ENV_GROUP (V7)
+
+#if _POSIX_V7_ILP32_OFF32 > 0
+KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
+#elif defined _POSIX_V7_ILP32_OFF32
+KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
+#else
+UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
+#endif
+
+#if _POSIX_V7_ILP32_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
+#elif defined _POSIX_V7_ILP32_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
+#endif
+
+#if _POSIX_V7_LP64_OFF64 > 0
+KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
+#elif defined _POSIX_V7_LP64_OFF64
+KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
+#else
+UNKNOWN_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
+#endif
+
+#if _POSIX_V7_LPBIG_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
+#elif defined _POSIX_V7_LPBIG_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
+#endif
+
+END_ENV_GROUP (V7)
+
+START_ENV_GROUP (V6)
+
+#if _POSIX_V6_ILP32_OFF32 > 0
+KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
+#elif defined _POSIX_V6_ILP32_OFF32
+KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
+#else
+UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
+#endif
+
+#if _POSIX_V6_ILP32_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
+#elif defined _POSIX_V6_ILP32_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
+#endif
+
+#if _POSIX_V6_LP64_OFF64 > 0
+KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
+#elif defined _POSIX_V6_LP64_OFF64
+KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
+#else
+UNKNOWN_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
+#endif
+
+#if _POSIX_V6_LPBIG_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
+#elif defined _POSIX_V6_LPBIG_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
+#endif
+
+END_ENV_GROUP (V6)
+
+START_ENV_GROUP (V5)
+
+#if _XBS5_ILP32_OFF32 > 0
+KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
+#elif defined _XBS5_ILP32_OFF32
+KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
+#else
+UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
+#endif
+
+#if _XBS5_ILP32_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
+#elif defined _XBS5_ILP32_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
+#endif
+
+#if _XBS5_LP64_OFF64 > 0
+KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
+#elif defined _XBS5_LP64_OFF64
+KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
+#else
+UNKNOWN_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
+#endif
+
+#if _XBS5_LPBIG_OFFBIG > 0
+KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
+#elif defined _XBS5_LPBIG_OFFBIG
+KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
+#else
+UNKNOWN_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
+#endif
+
+END_ENV_GROUP (V5)