Skip to content

Commit

Permalink
configure: check for -pthread vs -lpthread (rofl0r#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
rofl0r committed Apr 30, 2021
1 parent 918855d commit 6af2686
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6af2686

Please sign in to comment.