Add -pthread to pkgconfig's Libs.private if enabled

Allows static builds to correctly inherit the pthread dependency when
used with pkg-config --static --libs libsodium

AC_SUBST doesn't require explicit values

Regen autoconf

Fixes #800
This commit is contained in:
Luca Boccassi 2019-01-14 21:53:12 +00:00 committed by Frank Denis
parent 59f55cd420
commit ecdcf55173
14 changed files with 96 additions and 3 deletions

View File

@ -207,7 +207,9 @@ am__DIST_COMMON = $(srcdir)/Makefile.in \
$(top_srcdir)/src/libsodium/include/sodium/version.h.in \
AUTHORS ChangeLog THANKS build-aux/compile \
build-aux/config.guess build-aux/config.sub \
build-aux/install-sh build-aux/ltmain.sh build-aux/missing
build-aux/install-sh build-aux/ltmain.sh build-aux/missing \
compile config.guess config.sub depcomp install-sh ltmain.sh \
missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -336,6 +338,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -214,6 +214,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

78
configure vendored
View File

@ -704,6 +704,7 @@ VALGRIND_ENABLED
VALGRIND_ENABLED_FALSE
VALGRIND_ENABLED_TRUE
VALGRIND
PKGCONFIG_LIBS_PRIVATE
SAFECODE_HOME
PTHREAD_CFLAGS
PTHREAD_LIBS
@ -3275,7 +3276,7 @@ fi
SODIUM_LIBRARY_VERSION_MAJOR=10
SODIUM_LIBRARY_VERSION_MINOR=2
DLL_VERSION=8
DLL_VERSION=23
SODIUM_LIBRARY_VERSION=25:0:2
# | | |
# +------+ | +---+
@ -3295,6 +3296,7 @@ SODIUM_LIBRARY_VERSION=25:0:2
LX_CFLAGS=${CFLAGS-NONE}
PKGCONFIG_LIBS_PRIVATE=""
if pwd | fgrep ' ' > /dev/null 2>&1; then :
@ -5463,6 +5465,7 @@ $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
with_threads="yes"
LIBS="$PTHREAD_LIBS $LIBS"
PKGCONFIG_LIBS_PRIVATE="$PTHREAD_LIBS $PTHREAD_CFLAGS $PKGCONFIG_LIBS_PRIVATE"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
:
@ -5745,6 +5748,78 @@ else
:
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ftree-vectorize" >&5
$as_echo_n "checking whether C compiler accepts -ftree-vectorize... " >&6; }
if ${ax_cv_check_cflags___ftree_vectorize+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -ftree-vectorize"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
int
main ()
{
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ax_cv_check_cflags___ftree_vectorize=yes
else
ax_cv_check_cflags___ftree_vectorize=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___ftree_vectorize" >&5
$as_echo "$ax_cv_check_cflags___ftree_vectorize" >&6; }
if test "x$ax_cv_check_cflags___ftree_vectorize" = xyes; then :
CFLAGS="$CFLAGS -ftree-vectorize"
else
:
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ftree-slp-vectorize" >&5
$as_echo_n "checking whether C compiler accepts -ftree-slp-vectorize... " >&6; }
if ${ax_cv_check_cflags___ftree_slp_vectorize+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -ftree-slp-vectorize"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
int
main ()
{
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ax_cv_check_cflags___ftree_slp_vectorize=yes
else
ax_cv_check_cflags___ftree_slp_vectorize=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___ftree_slp_vectorize" >&5
$as_echo "$ax_cv_check_cflags___ftree_slp_vectorize" >&6; }
if test "x$ax_cv_check_cflags___ftree_slp_vectorize" = xyes; then :
CFLAGS="$CFLAGS -ftree-slp-vectorize"
else
:
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fomit-frame-pointer" >&5
$as_echo_n "checking whether C compiler accepts -fomit-frame-pointer... " >&6; }
if ${ax_cv_check_cflags___fomit_frame_pointer+:} false; then :
@ -5826,6 +5901,7 @@ fi
# Check whether --enable-valgrind was given.
if test "${enable_valgrind+set}" = set; then :
enableval=$enable_valgrind; enable_valgrind=$enableval

View File

@ -36,6 +36,7 @@ AC_SUBST(DLL_VERSION)
AC_LANG_ASSERT(C)
LX_CFLAGS=${CFLAGS-NONE}
PKGCONFIG_LIBS_PRIVATE=""
dnl Path check
@ -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"])
@ -192,7 +194,8 @@ AC_ARG_ENABLE(opt,
])
])
AC_SUBST([MAINT])
AC_SUBST(MAINT)
AC_SUBST(PKGCONFIG_LIBS_PRIVATE)
AX_VALGRIND_CHECK

View File

@ -214,6 +214,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -214,6 +214,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -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

View File

@ -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}

View File

@ -214,6 +214,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -274,6 +274,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -834,6 +834,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -306,6 +306,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -274,6 +274,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@

View File

@ -804,6 +804,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKGCONFIG_LIBS_PRIVATE = @PKGCONFIG_LIBS_PRIVATE@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@