[PATCH 1/4] Use _POSIX_VERSION to determine support for %m

Michael Forney
2013-10-03T09:36:42Z

%m is included in POSIX 2008, so we can check if the libc implements
that before failing.
---
configure.ac | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index cbcda46..95ff8b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,6 +430,7 @@ AC_CACHE_VAL([scanf_cv_alloc_modifier],

[AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <stdio.h>
+ #include <unistd.h>

#ifdef __GLIBC__

@@ -437,8 +438,13 @@ AC_CACHE_VAL([scanf_cv_alloc_modifier],
#error %m is not available
#endif

- #else
+ #elif defined(_POSIX_VERSION)

+ #if _POSIX_VERSION < 200809L
+ #error %m is not available
+ #endif
+
+ #else
#error Your C-library is not supported.
#endif
])],
--
1.8.4