check if we need to link pthread dynamically

On Linux, bionic and musl for instance do not need libpthread. With
bionic, there is not even a stub library for compatibility.
This commit is contained in:
Brent Cook 2019-01-01 22:59:47 -06:00
parent 4eb8da3e07
commit 3f189a24f2
2 changed files with 2 additions and 3 deletions

View File

@ -130,6 +130,7 @@ AC_CHECK_FUNCS([getauxval])
AC_SEARCH_LIBS([dl_iterate_phdr],[dl]) AC_SEARCH_LIBS([dl_iterate_phdr],[dl])
AC_CHECK_FUNCS([dl_iterate_phdr]) AC_CHECK_FUNCS([dl_iterate_phdr])
AC_SEARCH_LIBS([pthread_once],[pthread])
AC_SEARCH_LIBS([clock_gettime],[rt posix4]) AC_SEARCH_LIBS([clock_gettime],[rt posix4])
AC_CHECK_FUNCS([clock_gettime]) AC_CHECK_FUNCS([clock_gettime])
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "x$ac_cv_func_clock_gettime" = xyes]) AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "x$ac_cv_func_clock_gettime" = xyes])

View File

@ -9,7 +9,7 @@ case $host_os in
if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then
CFLAGS="-qnoansialias $USER_CFLAGS" CFLAGS="-qnoansialias $USER_CFLAGS"
fi fi
AC_SUBST([PLATFORM_LDADD], ['-lperfstat -lpthread']) AC_SUBST([PLATFORM_LDADD], ['-lperfstat'])
;; ;;
*cygwin*) *cygwin*)
HOST_OS=cygwin HOST_OS=cygwin
@ -74,13 +74,11 @@ char buf[1]; getentropy(buf, 1);
CFLAGS="-g -O2 +DD64 +Otype_safety=off $USER_CFLAGS" CFLAGS="-g -O2 +DD64 +Otype_safety=off $USER_CFLAGS"
fi fi
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT"
AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
;; ;;
*linux*) *linux*)
HOST_OS=linux HOST_OS=linux
HOST_ABI=elf HOST_ABI=elf
CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE"
AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
;; ;;
*netbsd*) *netbsd*)
HOST_OS=netbsd HOST_OS=netbsd