Source: wit
Version: 2.31a-3
Tags: patch upstream
Control: block 798955 by -1
wit's setup.sh checks for headers by testing whether they exist in
/usr/include or /usr/local/include. That will stop working with
non-glibc libcs or with a glibc that moves all headers to
/usr/include/<triplet> (aka fixing #798955). wit will fail to build from
source. The attached patch replaces the tests with compile tests. In
doing so it removes assumptions about how functions are declared (e.g.
bits/fcntl.h) and makes setup.sh more reliable. Please consider applying
it.
Helmut
--- wit-2.31a.orig/setup.sh
+++ wit-2.31a/setup.sh
@@ -18,13 +18,14 @@
tim=($(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" '+%s %Y-%m-%d %T'))
defines=
+: "${CC:=cc}"
have_fuse=0
-[[ $NO_FUSE != 1 && -r /usr/include/fuse.h || -r /usr/local/include/fuse.h ]] \
+[[ $NO_FUSE != 1 ]] && echo '#include <fuse.h>' | "$CC" -E - >/dev/null 2>&1 \
&& have_fuse=1
have_zlib=0
-if [[ $NO_ZLIB != 1 && -r /usr/include/zlib.h || -r /usr/local/include/zlib.h ]]
+if [[ $NO_ZLIB != 1 ]] && echo '#include <zlib.h>' | "$CC" -E - >/dev/null 2>&1
then
have_zlib=1
defines="$defines -DHAVE_ZLIB=1"
@@ -41,16 +42,16 @@
xflags=
fi
-[[ -r /usr/include/bits/fcntl.h ]] \
- && grep -qw fallocate /usr/include/bits/fcntl.h \
+echo '#include <fcntl.h>' | "$CC" -E - >/dev/null 2>&1 \
+ && echo '#include <fcntl.h>' | "$CC" -E - 2>/dev/null | grep -qw fallocate \
&& defines="$defines -DHAVE_FALLOCATE=1"
-[[ -r /usr/include/fcntl.h ]] \
- && grep -qw posix_fallocate /usr/include/fcntl.h \
+echo '#include <fcntl.h>' | "$CC" -E - >/dev/null 2>&1 \
+ && echo '#include <fcntl.h>' | "$CC" -E - 2>/dev/null | grep -qw posix_fallocate \
&& defines="$defines -DHAVE_POSIX_FALLOCATE=1"
-[[ -r /usr/include/linux/fiemap.h ]] \
- && grep -qw fiemap_extent /usr/include/linux/fiemap.h \
+echo '#include <linux/fiemap.h>' | "$CC" -E - >/dev/null 2>&1 \
+ && echo '#include <linux/fiemap.h>' | "$CC" -E - 2>/dev/null | grep -qw fiemap_extent \
&& defines="$defines -DHAVE_FIEMAP=1"
[[ $STATIC = 1 ]] || STATIC=0