Mac: update build.sh to hack around autotools problem

For reasons I cannot explain, running configure for libdivecomputer claims that
certain feature tests pass, even though those features demonstrably aren't
there. This is happening for two compiler warning flags (-Wrestrict &
-Wno-unused-but-set-variable) as well as the test for clock_gettime.

To work around this, we manually edit the config.h file and the created
Makefile before building libdivecomputer.

This happened on macOS 10.11.6 with clang-800.0.42.1 (part of Xcode 8.2.1).

Tangentially related to:
See #1263

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-05-11 21:07:58 -07:00
parent 2408134014
commit 387aee4cdf

View file

@ -362,6 +362,16 @@ if [ ! -f ../configure ] ; then
autoreconf --install .. autoreconf --install ..
fi fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
if [ $PLATFORM = Darwin ] ; then
# it seems that on my Mac some of the configure tests for libdivecomputer
# pass even though the feature tested for is actually missing
# let's hack around that
sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/\/* #undef HAVE_CLOCK_GETTIME *\//' config.h
for i in $(find . -name Makefile)
do
sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' $i
done
fi
make -j4 make -j4
make install make install