On Tue, Mar 14, 2017 at 08:43:10AM +0100, Helmut Grohne wrote:
> We plan on moving glibc's headers to /usr/include/<triplet>. That
> includes headers such as stdint.h. Unfortunately, libunistring's build
> system contains unportable things such as "test -f
> /usr/include/stdint.h" (while also checking for stdint.h portably at
> configure time). This causes a misbuild (assumes that stdint.h is
> absent) and (among other things) breaks coinstallability of
> libunistring-dev. The proper solution is to rely on autoconf's results.
> That's what the attached patch does. Please consider applying it after
> stretch is released.

I noticed that my original patch has a few shortcomings.

 * Nothing guaranteed that necessary headers were actually checked and
   indeed sys/inttypes.h wasn't checked. Issue AC_CHECK_HEADERS_ONCE to
   force the checks.
 * When a header is absent, the value of @HAVE_*@ is an empty string,
   but the use expects a 0. Let make substitute that with $(or $(v),0).

Please find the updated patch attached.

Helmut
diff --minimal -Nru libunistring-0.9.6+really0.9.3/debian/changelog 
libunistring-0.9.6+really0.9.3/debian/changelog
--- libunistring-0.9.6+really0.9.3/debian/changelog     2016-05-27 
10:11:04.000000000 +0200
+++ libunistring-0.9.6+really0.9.3/debian/changelog     2017-03-14 
08:24:16.000000000 +0100
@@ -1,3 +1,10 @@
+libunistring (0.9.6+really0.9.3-0.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix misbuild with multiarched glibc. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 14 Mar 2017 08:24:16 +0100
+
 libunistring (0.9.6+really0.9.3-0.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru 
libunistring-0.9.6+really0.9.3/debian/patches/multiarch-libc.patch 
libunistring-0.9.6+really0.9.3/debian/patches/multiarch-libc.patch
--- libunistring-0.9.6+really0.9.3/debian/patches/multiarch-libc.patch  
1970-01-01 01:00:00.000000000 +0100
+++ libunistring-0.9.6+really0.9.3/debian/patches/multiarch-libc.patch  
2017-03-14 08:24:16.000000000 +0100
@@ -0,0 +1,52 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: fix @HAVE_STDINT_H@ once stdint.h moves to /usr/include/<triplet>
+
+Index: libunistring-0.9.6+really0.9.3/lib/Makefile.am
+===================================================================
+--- libunistring-0.9.6+really0.9.3.orig/lib/Makefile.am
++++ libunistring-0.9.6+really0.9.3/lib/Makefile.am
+@@ -98,28 +98,13 @@
+         echo '#if __GLIBC__ >= 2'; \
+         echo '#include <stdint.h>'; \
+         echo '#else'; \
+-        if test -f /usr/include/stdint.h; then \
+-          HAVE_STDINT_H='1'; \
+-        else \
+-          HAVE_STDINT_H='defined __MINGW32__ || defined __HAIKU__'; \
+-        fi; \
+-        if test -f /usr/include/inttypes.h; then \
+-          HAVE_INTTYPES_H='1'; \
+-        else \
+-          HAVE_INTTYPES_H='defined __MINGW32__ || defined __HAIKU__'; \
+-        fi; \
+-        if test -f /usr/include/sys/inttypes.h; then \
+-          HAVE_SYS_INTTYPES_H='1'; \
+-        else \
+-          HAVE_SYS_INTTYPES_H='0'; \
+-        fi; \
+-        sed -e 's/@''HAVE_STDINT_H''@/'"$$HAVE_STDINT_H"'/g' \
++        sed -e 's/@''HAVE_STDINT_H''@/$(or @HAVE_STDINT_H@,0)/g' \
+             -e 's|@''INCLUDE_NEXT''@|include|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@||g' \
+             -e 's|@''NEXT_STDINT_H''@|<stdint.h>|g' \
+             -e 's/@''HAVE_SYS_TYPES_H''@/1/g' \
+-            -e 's/@''HAVE_INTTYPES_H''@/'"$$HAVE_INTTYPES_H"'/g' \
+-            -e 's/@''HAVE_SYS_INTTYPES_H''@/'"$$HAVE_SYS_INTTYPES_H"'/g' \
++            -e 's/@''HAVE_INTTYPES_H''@/$(or @HAVE_INTTYPES_H@,0)/g' \
++            -e 's/@''HAVE_SYS_INTTYPES_H''@/$(or @HAVE_SYS_INTTYPES_H@,0)/g' \
+             -e 's/@''HAVE_SYS_BITYPES_H''@/0/g' \
+             < $(srcdir)/stdint.mini.h; \
+         echo '#endif'; \
+Index: libunistring-0.9.6+really0.9.3/configure.ac
+===================================================================
+--- libunistring-0.9.6+really0.9.3.orig/configure.ac
++++ libunistring-0.9.6+really0.9.3/configure.ac
+@@ -136,6 +136,8 @@
+ HEXVERSION=0x`$AWK 'BEGIN { 
printf("%02d%02d"',"$version_major","$version_minor"') }'`
+ AC_SUBST([HEXVERSION])
+ 
++AC_CHECK_HEADERS_ONCE(stdint.h inttypes.h sys/inttypes.h)
++
+ dnl Check for tools needed for formatting the documentation.
+ ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
+ AC_PATH_PROG([TEXI2DVI], [texi2dvi], [$ac_aux_dir_abs/missing texi2dvi])
diff --minimal -Nru libunistring-0.9.6+really0.9.3/debian/patches/series 
libunistring-0.9.6+really0.9.3/debian/patches/series
--- libunistring-0.9.6+really0.9.3/debian/patches/series        2016-05-26 
17:14:45.000000000 +0200
+++ libunistring-0.9.6+really0.9.3/debian/patches/series        2017-03-14 
08:14:51.000000000 +0100
@@ -1 +1,2 @@
 float-endian-detection.patch
+multiarch-libc.patch

Reply via email to