Ver código fonte

getconf: only use specs that are available

On older glibc (like 2.7), the _SC_V7_* symbols are not defined,
making the build of current uClibc fail on Debian Lenny systems and
other systems using a fairly old glibc. So we make sure to only use
the specs names that are defined by the host C library.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Thomas Petazzoni 13 anos atrás
pai
commit
a1aaae7b87
1 arquivos alterados com 48 adições e 24 exclusões
  1. 48 24
      utils/getconf.c

+ 48 - 24
utils/getconf.c

@@ -1014,18 +1014,42 @@ static const struct conf vars[] =
 
 static const struct { const char *name; int num; } specs[] =
   {
+#ifdef _SC_XBS5_ILP32_OFF32
     { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
+#endif
+#ifdef _SC_XBS5_ILP32_OFFBIG
     { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
+#endif
+#ifdef _SC_XBS5_LP64_OFF64
     { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
+#endif
+#ifdef _SC_XBS5_LPBIG_OFFBIG
     { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
+#endif
+#ifdef _SC_V6_ILP32_OFF32
     { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
+#endif
+#ifdef _SC_V6_ILP32_OFFBIG
     { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
+#endif
+#ifdef _SC_V6_LP64_OFF64
     { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
+#endif
+#ifdef _SC_V6_LPBIG_OFFBIG
     { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
+#endif
+#ifdef _SC_V7_ILP32_OFF32
     { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
+#endif
+#ifdef _SC_V7_ILP32_OFFBIG
     { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
+#endif
+#ifdef _SC_V7_LP64_OFF64
     { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
+#endif
+#ifdef _SC_V7_LPBIG_OFFBIG
     { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
+#endif
   };
 static const int nspecs = sizeof (specs) / sizeof (specs[0]);
 
@@ -1177,41 +1201,41 @@ environment SPEC.\n\n");
 
       switch (specs[i].num)
 	{
-#ifndef _XBS5_ILP32_OFF32
-	  case _SC_XBS5_ILP32_OFF32:
+#if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32)
+	case _SC_XBS5_ILP32_OFF32:
 #endif
-#ifndef _XBS5_ILP32_OFFBIG
-	  case _SC_XBS5_ILP32_OFFBIG:
+#if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG)
+	case _SC_XBS5_ILP32_OFFBIG:
 #endif
-#ifndef _XBS5_LP64_OFF64
-	  case _SC_XBS5_LP64_OFF64:
+#if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64)
+	case _SC_XBS5_LP64_OFF64:
 #endif
-#ifndef _XBS5_LPBIG_OFFBIG
-	  case _SC_XBS5_LPBIG_OFFBIG:
+#if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG)
+	case _SC_XBS5_LPBIG_OFFBIG:
 #endif
-#ifndef _POSIX_V6_ILP32_OFF32
-	  case _SC_V6_ILP32_OFF32:
+#if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32)
+	case _SC_V6_ILP32_OFF32:
 #endif
-#ifndef _POSIX_V6_ILP32_OFFBIG
-	  case _SC_V6_ILP32_OFFBIG:
+#if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG)
+	case _SC_V6_ILP32_OFFBIG:
 #endif
-#ifndef _POSIX_V6_LP64_OFF64
-	  case _SC_V6_LP64_OFF64:
+#if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64)
+	case _SC_V6_LP64_OFF64:
 #endif
-#ifndef _POSIX_V6_LPBIG_OFFBIG
-	  case _SC_V6_LPBIG_OFFBIG:
+#if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG)
+	case _SC_V6_LPBIG_OFFBIG:
 #endif
-#ifndef _POSIX_V7_ILP32_OFF32
-	  case _SC_V7_ILP32_OFF32:
+#if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32)
+	case _SC_V7_ILP32_OFF32:
 #endif
-#ifndef _POSIX_V7_ILP32_OFFBIG
-	  case _SC_V7_ILP32_OFFBIG:
+#if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG)
+	case _SC_V7_ILP32_OFFBIG:
 #endif
-#ifndef _POSIX_V7_LP64_OFF64
-	  case _SC_V7_LP64_OFF64:
+#if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64)
+	case _SC_V7_LP64_OFF64:
 #endif
-#ifndef _POSIX_V7_LPBIG_OFFBIG
-	  case _SC_V7_LPBIG_OFFBIG:
+#if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG)
+	case _SC_V7_LPBIG_OFFBIG:
 #endif
 	    {
 	      const char *args[argc + 3];