Skip to content

Commit 7ce7f2b

Browse files
committed
Merge #17396: build: modest Android improvements
366913e build: AX_BOOST_THREAD serial 33 (Igor Cota) cf06811 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 366913e Tree-SHA512: 31465fd228a5877c20aa2a05f98242d4eeb328b9b35bd1a7a3dcfb1ef51379d84053a81ade5a65436ffc1bc8ccd21f11ed0539eb10e827d182c0c04394629af0
2 parents 8e94275 + 366913e commit 7ce7f2b

File tree

2 files changed

+49
-16
lines changed

2 files changed

+49
-16
lines changed

build-aux/m4/ax_boost_thread.m4

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# and this notice are preserved. This file is offered as-is, without any
3131
# warranty.
3232

33-
#serial 32
33+
#serial 33
3434

3535
AC_DEFUN([AX_BOOST_THREAD],
3636
[
@@ -67,13 +67,24 @@ AC_DEFUN([AX_BOOST_THREAD],
6767
[AC_LANG_PUSH([C++])
6868
CXXFLAGS_SAVE=$CXXFLAGS
6969
70-
if test "x$host_os" = "xsolaris" ; then
71-
CXXFLAGS="-pthreads $CXXFLAGS"
72-
elif test "x$host_os" = "xmingw32" ; then
73-
CXXFLAGS="-mthreads $CXXFLAGS"
74-
else
75-
CXXFLAGS="-pthread $CXXFLAGS"
76-
fi
70+
case "x$host_os" in
71+
xsolaris )
72+
CXXFLAGS="-pthreads $CXXFLAGS"
73+
break;
74+
;;
75+
xmingw32 )
76+
CXXFLAGS="-mthreads $CXXFLAGS"
77+
break;
78+
;;
79+
*android* )
80+
break;
81+
;;
82+
* )
83+
CXXFLAGS="-pthread $CXXFLAGS"
84+
break;
85+
;;
86+
esac
87+
7788
AC_COMPILE_IFELSE([
7889
AC_LANG_PROGRAM(
7990
[[@%:@include <boost/thread/thread.hpp>]],
@@ -84,13 +95,23 @@ AC_DEFUN([AX_BOOST_THREAD],
8495
AC_LANG_POP([C++])
8596
])
8697
if test "x$ax_cv_boost_thread" = "xyes"; then
87-
if test "x$host_os" = "xsolaris" ; then
88-
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
89-
elif test "x$host_os" = "xmingw32" ; then
90-
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
91-
else
92-
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
93-
fi
98+
case "x$host_os" in
99+
xsolaris )
100+
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
101+
break;
102+
;;
103+
xmingw32 )
104+
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
105+
break;
106+
;;
107+
*android* )
108+
break;
109+
;;
110+
* )
111+
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
112+
break;
113+
;;
114+
esac
94115
95116
AC_SUBST(BOOST_CPPFLAGS)
96117
@@ -148,6 +169,9 @@ AC_DEFUN([AX_BOOST_THREAD],
148169
xmingw32 )
149170
break;
150171
;;
172+
*android* )
173+
break;
174+
;;
151175
* )
152176
BOOST_THREAD_LIB="$BOOST_THREAD_LIB -lpthread"
153177
break;

build-aux/m4/bitcoin_qt.m4

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,19 @@ AC_DEFUN([BITCOIN_QT_INIT],[
7272
7373
AC_ARG_WITH([qtdbus],
7474
[AS_HELP_STRING([--with-qtdbus],
75-
[enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
75+
[enable DBus support (default is yes if qt is enabled and QtDBus is found, except on Android)])],
7676
[use_dbus=$withval],
7777
[use_dbus=auto])
7878
79+
dnl Android doesn't support D-Bus and certainly doesn't use it for notifications
80+
case $host in
81+
*android*)
82+
if test "x$use_dbus" != xyes; then
83+
use_dbus=no
84+
fi
85+
;;
86+
esac
87+
7988
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
8089
])
8190

0 commit comments

Comments
 (0)