Hi, Bart > >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 >[...]". I checked these. My changes are below: Configure.ac: +# check for pthread_cancel +AC_SEARCH_LIBS(pthread_cancel, pthread, + [AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [have pthread_cancel])], [], []) Src/Makefile.am -sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@ -lpthread +sgp_dd_LDADD = ../lib/libsgutils2.la @os_libs@ @LIBS@ In the Src/sgp_dd.c, I can use macro definition " HAVE_PTHREAD_CANCEL" to differentiate pthread_cancel supports or not. It works. But I got one warning below while run autoreconf , do you know what is wrong with that? configure.ac:15: warning: AC_PROG_LIBTOOL was called before AM_PROG_AR configure.ac:15: warning: LT_INIT was called before AM_PROG_AR thanks in advance! Bean Huo