@@ -78,8 +78,9 @@ ${MAKE:-make} V=1 install || exit 1 ) || return 1 SSLDIR="$(pwd)/libressl-${version}/INST" + addlibs="$(PKG_CONFIG_PATH="$(pwd)/libressl-${version}/INST/lib/pkgconfig" "${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs --static)" } ( cd 'build' || exit 1 @@ -217,10 +218,23 @@ if [ -n "${LINKADDFILE}" ]; then LINKADDFILE="${LINKADDFILE}.linkadd" ## XXX: TODO: Determine what we actually need to link against - addlibs="-L${SSL_LIB_DIR:-/lib} -lssl -lcrypto ${KC_TLS_LINKADD}" - addlibs_staticOnly="" + if [ -z "${addlibs}" ]; then + if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then + addlibs="$("${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs --static)" + else + addlibs="$("${PKG_CONFIG:-pkg-config}" libssl libcrypto --libs)" + fi + fi + + if [ -z "${addlibs}" ]; then + addlibs="-L${SSL_LIB_DIR:-/lib} -lssl -lcrypto" + addlibs_staticOnly="" + fi + + addlibs="${addlibs} ${KC_TLS_LINKADD}" + if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then echo "-Wl,-Bstatic ${addlibs} ${addlibs_staticOnly} -Wl,-Bdynamic" else echo "${addlibs}"