configure: check for -pthread vs -lpthread (#379)

pull/380/head
rofl0r 2021-04-30 16:15:30 +01:00
parent 918855deed
commit 6af2686a52
2 changed files with 10 additions and 1 deletions

View File

@ -30,7 +30,7 @@ GENH = src/version.h
CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe
NO_AS_NEEDED = -Wl,--no-as-needed
LIBDL = -ldl
LDFLAGS = -fPIC $(NO_AS_NEEDED) $(LIBDL) -lpthread
LDFLAGS = -fPIC $(NO_AS_NEEDED) $(LIBDL) $(PTHREAD)
INC =
PIC = -fPIC
AR = $(CROSS_COMPILE)ar

9
configure vendored
View File

@ -208,6 +208,15 @@ fi
echo "$LD_SONAME_FLAG"
echo "LD_SET_SONAME = -Wl,$LD_SONAME_FLAG," >> config.mak
if check_link "checking whether we can use -lpthread" "-lpthread" \
"int main(){return 0;}" ; then
echo "PTHREAD = -lpthread" >> config.mak
else
check_link "checking whether we can use -pthread" "-pthread" \
"int main(){return 0;}" || fail "no pthread support detected"
echo "PTHREAD = -pthread" >> config.mak
fi
make_cmd=make
if ismac ; then
echo LDSO_SUFFIX=dylib>>config.mak