Skip to content

Commit

Permalink
Configure: fixed static compilation with OpenSSL 1.1.1.
Browse files Browse the repository at this point in the history
OpenSSL now uses pthread_atfork(), and this requires -lpthread on Linux
to compile.  Introduced NGX_LIBPTHREAD to add it as appropriate, similar
to existing NGX_LIBDL.
  • Loading branch information
mdounin committed Mar 22, 2018
1 parent 25a26bb commit 90ca107
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
21 changes: 14 additions & 7 deletions auto/lib/openssl/conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if [ $OPENSSL != NONE ]; then
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"

if [ "$NGX_PLATFORM" = win32 ]; then
CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
Expand All @@ -59,7 +60,7 @@ else
ngx_feature_run=no
ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_path=
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD"
ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
. auto/feature

Expand All @@ -71,11 +72,13 @@ else
ngx_feature_path="/usr/local/include"

if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto"
fi

ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"

. auto/feature
fi

Expand All @@ -87,11 +90,13 @@ else
ngx_feature_path="/usr/pkg/include"

if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto"
fi

ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"

. auto/feature
fi

Expand All @@ -103,11 +108,13 @@ else
ngx_feature_path="/opt/local/include"

if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto"
else
ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto $NGX_LIBDL"
ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto"
fi

ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"

. auto/feature
fi

Expand Down
1 change: 1 addition & 0 deletions auto/threads
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ END
CORE_DEPS="$CORE_DEPS $THREAD_POOL_DEPS"
CORE_SRCS="$CORE_SRCS $THREAD_POOL_SRCS"
CORE_LIBS="$CORE_LIBS -lpthread"
NGX_LIBPTHREAD="-lpthread"
fi
1 change: 1 addition & 0 deletions auto/unix
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ if [ $ngx_found = no ]; then

if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS -lpthread"
NGX_LIBPTHREAD="-lpthread"
fi
fi

Expand Down

0 comments on commit 90ca107

Please sign in to comment.