build-system: fix libdivecomputer build on macOS

In some Mac environments autotools somehow think that we have clock_gettime(),
even though it isn't supported. Somehow the previous workaround stopped working
as make ended up re-running ../configure and overwriting our change. This tries
to work around that problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-10-03 15:56:27 +02:00
parent 42eae7e48b
commit 1ac90199e5

View file

@ -346,14 +346,22 @@ if [ ! -f ../configure ] ; then
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 if [ $PLATFORM = Darwin ] ; then
# it seems that on my Mac some of the configure tests for libdivecomputer # remove some copmpiler options that aren't supported on Mac
# pass even though the feature tested for is actually missing # otherwise the log gets very noisy
# 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) for i in $(find . -name Makefile)
do do
sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' $i sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' $i
done done
# 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
# touch config.status, recreate config.h and then disable HAVE_CLOCK_GETTIME
# this seems to work so that the Makefile doesn't re-run the
# configure process and overwrite all the changes we just made
touch config.status
make config.h
grep CLOCK_GETTIME config.h
sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/#undef HAVE_CLOCK_GETTIME /' config.h
fi fi
make -j4 make -j4
make install make install