This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generate /usr/libexec/getconf files when cross-compiling


On Thu, 15 Nov 2012, Roland McGrath wrote:

> I'd be more inclined toward:
> 
> 	#if _POSIX_V7_ILP32_OFF32 > 0
> 	KNOWN_ENVIRONMENT (V7_ILP32_OFF32)
> 	#else
> 	UNKNOWN_ENVIRONMENT (V7_ILP32_OFF32)
> 	#endif
> 
> or something like that.  Then the definitions of the macros can be
> just magic marker strings for grepping in the build-time case, and
> can be code fragments in the other cases.

Here is a refactoring of the existing confstr / sysconf code along
those lines, with a structure and using macros designed to be suitable
for the build-time use as well (which is not included in this patch).

Tested x86_64.  Note that the preprocessed code is not identical
before and after this patch (the cases in sysconf.c were in a
different order to those in confstr.c, for example), but the only
change to the code generated for libc.so was a reordering of some code
in __sysconf.

2012-11-15  Joseph Myers  <joseph@codesourcery.com>

	* posix/posix-envs.c: New file.
	* posix/confstr.c (START_ENV_GROUP): New macro.
	(END_ENV_GROUP): Likewise.
	(KNOWN_ABSENT_ENVIRONMENT): Likewise.
	(KNOWN_PRESENT_ENV_STRING): Likewise.
	(KNOWN_PRESENT_ENVIRONMENT): Likewise.
	(UNKNOWN_ENVIRONMENT): Likewise.
	(confstr): Include posix-envs.c instead of handling
	_CS_V7_WIDTH_RESTRICTED_ENVS, _CS_V6_WIDTH_RESTRICTED_ENVS and
	_CS_V5_WIDTH_RESTRICTED_ENVS directly here.
	* sysdeps/posix/sysconf.c (START_ENV_GROUP): New macro.
	(END_ENV_GROUP): Likewise.
	(KNOWN_ABSENT_ENVIRONMENT): Likewise.
	(KNOWN_PRESENT_ENVIRONMENT): Likewise.
	(UNKNOWN_ENVIRONMENT): Likewise.
	(__sysconf): Include posix-envs.c instead of handling associated
	cases directly here.

diff --git a/posix/confstr.c b/posix/confstr.c
index cad6561..3a402af 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -48,182 +48,45 @@ confstr (name, buf, len)
       }
       break;
 
-    case _CS_V7_WIDTH_RESTRICTED_ENVS:
-      /* We have to return a newline-separated list of named of
+      /* 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 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.  */
+
+#define START_ENV_GROUP(VERSION)		\
+    case _CS_##VERSION##_WIDTH_RESTRICTED_ENVS:	\
       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;
+
+#define END_ENV_GROUP(VERSION)			\
+      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.
+#define KNOWN_ABSENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)
 
-	 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;
+#define KNOWN_PRESENT_ENV_STRING(STR)		\
+      if (string_len)				\
+	restenvs[string_len++] = '\n';		\
+      memcpy (restenvs + string_len, STR,	\
+	      sizeof STR - 1);			\
+      string_len += sizeof STR - 1;
 
-    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.
+#define KNOWN_PRESENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)	\
+      KNOWN_PRESENT_ENV_STRING (#ENV_PREFIX "_" #SUFFIX)
 
-	 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;
+#define UNKNOWN_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)		\
+      if (__sysconf (_SC_##SC_PREFIX##_##SUFFIX) > 0)			\
+	{								\
+	  KNOWN_PRESENT_ENVIRONMENT (SC_PREFIX, ENV_PREFIX, SUFFIX)	\
 	}
-#endif
-      restenvs[string_len++] = '\0';
-      string = restenvs;
-      break;
+
+#include "posix-envs.c"
 
     case _CS_XBS5_ILP32_OFF32_CFLAGS:
     case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
diff --git a/posix/posix-envs.c b/posix/posix-envs.c
new file mode 100644
index 0000000..c32ea8a
--- /dev/null
+++ b/posix/posix-envs.c
@@ -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)
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index bfe28b4..8d7014b 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -790,80 +790,23 @@ __sysconf (name)
       return -1;
 #endif
 
-    case _SC_XBS5_ILP32_OFF32:
-#ifdef _XBS5_ILP32_OFF32
-      return _XBS5_ILP32_OFF32;
-#else
-      return __sysconf_check_spec ("ILP32_OFF32");
-#endif
-    case _SC_XBS5_ILP32_OFFBIG:
-#ifdef _XBS5_ILP32_OFFBIG
-      return _XBS5_ILP32_OFFBIG;
-#else
-      return __sysconf_check_spec ("ILP32_OFFBIG");
-#endif
-    case _SC_XBS5_LP64_OFF64:
-#ifdef _XBS5_LP64_OFF64
-      return _XBS5_LP64_OFF64;
-#else
-      return __sysconf_check_spec ("LP64_OFF64");
-#endif
-    case _SC_XBS5_LPBIG_OFFBIG:
-#ifdef _XBS5_LPBIG_OFFBIG
-      return _XBS5_LPBIG_OFFBIG;
-#else
-      return __sysconf_check_spec ("LPBIG_OFFBIG");
-#endif
+#define START_ENV_GROUP(VERSION)
 
-    case _SC_V6_ILP32_OFF32:
-#ifdef _POSIX_V6_ILP32_OFF32
-      return _POSIX_V6_ILP32_OFF32;
-#else
-      return __sysconf_check_spec ("ILP32_OFF32");
-#endif
-    case _SC_V6_ILP32_OFFBIG:
-#ifdef _POSIX_V6_ILP32_OFFBIG
-      return _POSIX_V6_ILP32_OFFBIG;
-#else
-      return __sysconf_check_spec ("ILP32_OFFBIG");
-#endif
-    case _SC_V6_LP64_OFF64:
-#ifdef _POSIX_V6_LP64_OFF64
-      return _POSIX_V6_LP64_OFF64;
-#else
-      return __sysconf_check_spec ("LP64_OFF64");
-#endif
-    case _SC_V6_LPBIG_OFFBIG:
-#ifdef _POSIX_V6_LPBIG_OFFBIG
-      return _POSIX_V6_LPBIG_OFFBIG;
-#else
-      return __sysconf_check_spec ("LPBIG_OFFBIG");
-#endif
+#define END_ENV_GROUP(VERSION)
 
-    case _SC_V7_ILP32_OFF32:
-#ifdef _POSIX_V7_ILP32_OFF32
-      return _POSIX_V7_ILP32_OFF32;
-#else
-      return __sysconf_check_spec ("ILP32_OFF32");
-#endif
-    case _SC_V7_ILP32_OFFBIG:
-#ifdef _POSIX_V7_ILP32_OFFBIG
-      return _POSIX_V7_ILP32_OFFBIG;
-#else
-      return __sysconf_check_spec ("ILP32_OFFBIG");
-#endif
-    case _SC_V7_LP64_OFF64:
-#ifdef _POSIX_V7_LP64_OFF64
-      return _POSIX_V7_LP64_OFF64;
-#else
-      return __sysconf_check_spec ("LP64_OFF64");
-#endif
-    case _SC_V7_LPBIG_OFFBIG:
-#ifdef _POSIX_V7_LPBIG_OFFBIG
-      return _POSIX_V7_LPBIG_OFFBIG;
-#else
-      return __sysconf_check_spec ("LPBIG_OFFBIG");
-#endif
+#define KNOWN_ABSENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)	\
+    case _SC_##SC_PREFIX##_##SUFFIX:				\
+      return _##ENV_PREFIX##_##SUFFIX;
+
+#define KNOWN_PRESENT_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)	\
+    case _SC_##SC_PREFIX##_##SUFFIX:					\
+      return _##ENV_PREFIX##_##SUFFIX;
+
+#define UNKNOWN_ENVIRONMENT(SC_PREFIX, ENV_PREFIX, SUFFIX)	\
+    case _SC_##SC_PREFIX##_##SUFFIX:				\
+      return __sysconf_check_spec (#SUFFIX);
+
+#include <posix/posix-envs.c>
 
     case _SC_XOPEN_LEGACY:
       return _XOPEN_LEGACY;

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]