On Sat, 2017-12-23 at 10:19 +0000, Bean Huo (beanhuo) wrote: > Doug wrote: > > This seems to work in Linux but may not work in Android: > > AC_SEARCH_LIBS([pthread_cancel], [pthread], > > [AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Found pthread_cancel])], []) > > > > Bean, could you check? > > > > Doug, I had tried that, it works, but this is for C codes macro definition in the config.h. > How can I figure out in the /src/Makefile.ac between Android OS and non-Android? > Can you give me some suggestions? Like this: > if OS_ANDROID > sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@ > else > sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@ -lpthread > endif How about leaving out the following: - Use AC_SEARCH_LIBS([pthread_cancel], [pthread]) and AC_CHECK_FUNC([pthread_cancel]) in configure.ac. - Use @LIBS@ in Makefile.am. >From https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Libraries.html: "If action-if-found is not specified, the default action prepends -llibrary to LIBS [...]". Bart.