diff options
author | Guillem Jover <guillem@debian.org> | 2015-01-22 02:09:07 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-01-28 20:50:33 +0100 |
commit | 5294116c6d0f290fd13096d3b70904159078ecf3 (patch) | |
tree | 23e0393f70ec1e124e45049ef15eac1ff2ac0c4d | |
parent | 950be3fcbdf373d43dea6f5b18fcf3c61747fd33 (diff) | |
download | dpkg-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.
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | m4/dpkg-funcs.m4 | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 08c2bba1e..78afb2770 100644 --- a/debian/changelog +++ b/debian/changelog @@ -51,6 +51,8 @@ dpkg (1.18.0) UNRELEASED; urgency=low reproducible regardless of the build system filesystem, and document how the value is computed and that it is just an approximation. Closes: #650077 + * Fix support for cross-building dpkg: + - Assume a working C99 snprintf on SUS >= v3. -- Guillem Jover <guillem@debian.org> Tue, 09 Dec 2014 23:53:18 +0100 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])], |