Merge #17396: build: modest Android improvements

366913e307d2dc13bc00d6bf7b6b2426c359ac30 build: AX_BOOST_THREAD serial 33 (Igor Cota)
cf0681133ae7301ead7091eaee55c945da5cdfcc build: disable D-Bus on Android by default (Igor Cota)

Pull request description:

  I've been trying to build for Android on different OSes/Gitian with varying success. Build system is quite the beast and sometimes it doesn't get it right. To make sure it does these three little tweaks make the Android build more robust:

  - disable D-Bus (Android doesn't support it and has its own way to trigger notifications)
  - don't flag `-lpthread` when linking Boost, [Bionic has built-in support](https://stackoverflow.com/questions/30801752/android-ndk-and-pthread)
  - ~~add `-static-libstdc++` to linker flags. This avoids having to bundle `libc++_shared` with CLI apps, still necessary with `bitcoin-qt` though (thanks Sjors)~~

  I think these are small and fairly straightforward so I put them all into this one PR.

ACKs for top commit:
  fanquake:
    ACK 366913e307d2dc13bc00d6bf7b6b2426c359ac30

Tree-SHA512: 31465fd228a5877c20aa2a05f98242d4eeb328b9b35bd1a7a3dcfb1ef51379d84053a81ade5a65436ffc1bc8ccd21f11ed0539eb10e827d182c0c04394629af0
This commit is contained in:
fanquake 2020-08-24 21:27:19 +08:00 committed by pasta
parent 1382c881df
commit 68f8cbf043
2 changed files with 49 additions and 16 deletions

View File

@ -30,7 +30,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 32
#serial 33
AC_DEFUN([AX_BOOST_THREAD],
[
@ -67,13 +67,24 @@ AC_DEFUN([AX_BOOST_THREAD],
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
if test "x$host_os" = "xsolaris" ; then
case "x$host_os" in
xsolaris )
CXXFLAGS="-pthreads $CXXFLAGS"
elif test "x$host_os" = "xmingw32" ; then
break;
;;
xmingw32 )
CXXFLAGS="-mthreads $CXXFLAGS"
else
break;
;;
*android* )
break;
;;
* )
CXXFLAGS="-pthread $CXXFLAGS"
fi
break;
;;
esac
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[@%:@include <boost/thread/thread.hpp>]],
@ -84,13 +95,23 @@ AC_DEFUN([AX_BOOST_THREAD],
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_thread" = "xyes"; then
if test "x$host_os" = "xsolaris" ; then
case "x$host_os" in
xsolaris )
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
elif test "x$host_os" = "xmingw32" ; then
break;
;;
xmingw32 )
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
else
break;
;;
*android* )
break;
;;
* )
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
fi
break;
;;
esac
AC_SUBST(BOOST_CPPFLAGS)
@ -148,6 +169,9 @@ AC_DEFUN([AX_BOOST_THREAD],
xmingw32 )
break;
;;
*android* )
break;
;;
* )
BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread"
break;

View File

@ -79,10 +79,19 @@ AC_DEFUN([BITCOIN_QT_INIT],[
AC_ARG_WITH([qtdbus],
[AS_HELP_STRING([--with-qtdbus],
[enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
[enable DBus support (default is yes if qt is enabled and QtDBus is found, except on Android)])],
[use_dbus=$withval],
[use_dbus=auto])
dnl Android doesn't support D-Bus and certainly doesn't use it for notifications
case $host in
*android*)
if test "x$use_dbus" != xyes; then
use_dbus=no
fi
;;
esac
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
])