diff --git a/posix/confstr.c b/posix/confstr.c
index a2a1bf2..2a98b4a 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -130,7 +130,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
     case _CS_POSIX_V7_LP64_OFF64_CFLAGS:
 #ifdef __LP64_OFF64_CFLAGS
-# if _POSIX_V7_LP64_OFF64 == -1
+# if defined _POSIX_V7_LP64_OFF64 && _POSIX_V7_LP64_OFF64 == -1
 #  error "__LP64_OFF64_CFLAGS should not be defined"
 # elif !defined _POSIX_V7_LP64_OFF64
       if (__sysconf (_SC_V7_LP64_OFF64) < 0)
@@ -175,7 +175,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
     case _CS_POSIX_V7_LP64_OFF64_LDFLAGS:
 #ifdef __LP64_OFF64_LDFLAGS
-# if _POSIX_V7_LP64_OFF64 == -1
+# if defined _POSIX_V7_LP64_OFF64 && _POSIX_V7_LP64_OFF64 == -1
 #  error "__LP64_OFF64_LDFLAGS should not be defined"
 # elif !defined _POSIX_V7_LP64_OFF64
       if (__sysconf (_SC_V7_LP64_OFF64) < 0)
diff --git a/posix/posix-envs.def b/posix/posix-envs.def
index 05043e9..344db28 100644
--- a/posix/posix-envs.def
+++ b/posix/posix-envs.def
@@ -44,7 +44,7 @@
 
 START_ENV_GROUP (V7)
 
-#if _POSIX_V7_ILP32_OFF32 > 0
+#if defined _POSIX_V7_ILP32_OFF32 && _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)
@@ -52,7 +52,7 @@ KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
 UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
 #endif
 
-#if _POSIX_V7_ILP32_OFFBIG > 0
+#if defined _POSIX_V7_ILP32_OFFBIG && _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)
@@ -60,7 +60,7 @@ KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
 UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
 #endif
 
-#if _POSIX_V7_LP64_OFF64 > 0
+#if defined _POSIX_V7_LP64_OFF64 && _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)
@@ -68,7 +68,7 @@ KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
 UNKNOWN_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
 #endif
 
-#if _POSIX_V7_LPBIG_OFFBIG > 0
+#if defined _POSIX_V7_LPBIG_OFFBIG && _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)
@@ -80,7 +80,7 @@ END_ENV_GROUP (V7)
 
 START_ENV_GROUP (V6)
 
-#if _POSIX_V6_ILP32_OFF32 > 0
+#if defined _POSIX_V6_ILP32_OFF32 && _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)
@@ -88,7 +88,7 @@ KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
 UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
 #endif
 
-#if _POSIX_V6_ILP32_OFFBIG > 0
+#if defined _POSIX_V6_ILP32_OFFBIG && _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)
@@ -96,7 +96,7 @@ KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
 UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
 #endif
 
-#if _POSIX_V6_LP64_OFF64 > 0
+#if defined _POSIX_V6_LP64_OFF64 && _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)
@@ -104,7 +104,7 @@ KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
 UNKNOWN_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
 #endif
 
-#if _POSIX_V6_LPBIG_OFFBIG > 0
+#if defined _POSIX_V6_LPBIG_OFFBIG && _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)
@@ -116,7 +116,7 @@ END_ENV_GROUP (V6)
 
 START_ENV_GROUP (V5)
 
-#if _XBS5_ILP32_OFF32 > 0
+#if defined _XBS5_ILP32_OFF32 && _XBS5_ILP32_OFF32 > 0
 KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
 #elif defined _XBS5_ILP32_OFF32
 KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
@@ -124,7 +124,7 @@ KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
 UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
 #endif
 
-#if _XBS5_ILP32_OFFBIG > 0
+#if defined _XBS5_ILP32_OFFBIG && _XBS5_ILP32_OFFBIG > 0
 KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
 #elif defined _XBS5_ILP32_OFFBIG
 KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
@@ -132,7 +132,7 @@ KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
 UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
 #endif
 
-#if _XBS5_LP64_OFF64 > 0
+#if defined _XBS5_LP64_OFF64 && _XBS5_LP64_OFF64 > 0
 KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
 #elif defined _XBS5_LP64_OFF64
 KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
@@ -140,7 +140,7 @@ KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
 UNKNOWN_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
 #endif
 
-#if _XBS5_LPBIG_OFFBIG > 0
+#if defined _XBS5_LPBIG_OFFBIG && _XBS5_LPBIG_OFFBIG > 0
 KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
 #elif defined _XBS5_LPBIG_OFFBIG
 KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
