Skip to content

Commit

Permalink
Add -pthread to pkgconfig's Libs.private if enabled
Browse files Browse the repository at this point in the history
Allows static builds to correctly inherit the pthread dependency when
used with pkg-config --static --libs libsodium
  • Loading branch information
bluca authored and jedisct1 committed Jan 14, 2019
1 parent b3725dc commit 3933a74
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ AC_SUBST(DLL_VERSION)

AC_LANG_ASSERT(C)
LX_CFLAGS=${CFLAGS-NONE}
PKGCONFIG_LIBS_PRIVATE=""

dnl Path check

Expand Down Expand Up @@ -127,6 +128,7 @@ AS_IF([test "x$withval" = "xyes"], [
AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files])
with_threads="yes"
LIBS="$PTHREAD_LIBS $LIBS"
PKGCONFIG_LIBS_PRIVATE="$PTHREAD_LIBS $PTHREAD_CFLAGS $PKGCONFIG_LIBS_PRIVATE"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"])
], [with_threads="no"])
Expand Down Expand Up @@ -193,6 +195,7 @@ AC_ARG_ENABLE(opt,
])

AC_SUBST([MAINT])
AC_SUBST(PKGCONFIG_LIBS_PRIVATE, $PKGCONFIG_LIBS_PRIVATE)

AX_VALGRIND_CHECK

Expand Down
1 change: 1 addition & 0 deletions libsodium-uninstalled.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Version: @PACKAGE_VERSION@
Description: A modern and easy-to-use crypto library

Libs: -L${pcfiledir}/src/libsodium -lsodium
Libs.private: @PKGCONFIG_LIBS_PRIVATE@
Cflags: -I${pcfiledir}/src/libsodium/include -I@top_srcdir@/src/libsodium/include -I@top_srcdir@/src/libsodium/include/sodium
1 change: 1 addition & 0 deletions libsodium.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Version: @PACKAGE_VERSION@
Description: A modern and easy-to-use crypto library

Libs: -L${libdir} -lsodium
Libs.private: @PKGCONFIG_LIBS_PRIVATE@
Cflags: -I${includedir}

0 comments on commit 3933a74

Please sign in to comment.