Re: [RFC] sg3_utils: sgp_dd: work around on pthread_cancel for android

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux