summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-01-22 02:09:07 +0100
committerGuillem Jover <guillem@debian.org>2015-01-28 20:50:33 +0100
commit5294116c6d0f290fd13096d3b70904159078ecf3 (patch)
tree23e0393f70ec1e124e45049ef15eac1ff2ac0c4d /m4
parent950be3fcbdf373d43dea6f5b18fcf3c61747fd33 (diff)
downloaddpkg-5294116c6d0f290fd13096d3b70904159078ecf3.tar.gz
build: When cross-building assume a working snprintf on SUS >= v3
SUSv2 and earlier had conflicting semantics with the C99 snprintf() ones. Because we expect a C99 environment, assume that if we are using SUSv3 or newer then we have a working snprintf() implementation.
Diffstat (limited to 'm4')
-rw-r--r--m4/dpkg-funcs.m419
1 files changed, 17 insertions, 2 deletions
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index e087bbdca..87e600d46 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -1,5 +1,5 @@
# Copyright © 2005 Scott James Remnant <scott@netsplit.com>
-# Copyright © 2008, 2009 Guillem Jover <guillem@debian.org>
+# Copyright © 2008-2009,2015 Guillem Jover <guillem@debian.org>
# DPKG_FUNC_VA_COPY
# -----------------
@@ -60,7 +60,22 @@ int main()
]])],
[dpkg_cv_c99_snprintf=yes],
[dpkg_cv_c99_snprintf=no],
- [dpkg_cv_c99_snprintf=no])])
+ [dpkg_cv_c99_snprintf=maybe])
+
+ AS_IF([test "x$dpkg_cv_c99_snprintf" = "xmaybe"],
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#define _GNU_SOURCE 1
+#include <unistd.h>
+#if !defined(_XOPEN_VERSION) || _XOPEN_VERSION < 600
+#error "snprintf() has conflicting semantics with C99 on SUSv2 and earlier"
+#endif
+]]
+ )],
+ [dpkg_cv_c99_snprintf=yes],
+ [dpkg_cv_c99_snprintf=no]
+ )
+ )
+])
AS_IF([test "x$dpkg_cv_c99_snprintf" = "xyes"],
[AC_DEFINE([HAVE_C99_SNPRINTF], 1,
[Define to 1 if the 'snprintf' family is C99 conformant])],