From 76566f88d9984cc870aa6ccb4eca64ef43ff40d2 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 16 May 2008 14:32:58 +0000 Subject: simplify library autoconfigure --- auto/lib/conf | 2 + auto/lib/md5/conf | 55 +++++++++++---------------- auto/lib/pcre/conf | 107 +++++++++++++---------------------------------------- auto/lib/sha1/conf | 38 ++++++++----------- auto/summary | 16 +------- 5 files changed, 68 insertions(+), 150 deletions(-) diff --git a/auto/lib/conf b/auto/lib/conf index 6411dabfb..fcf2b3f63 100644 --- a/auto/lib/conf +++ b/auto/lib/conf @@ -16,6 +16,7 @@ if [ $USE_MD5 = YES ]; then have=NGX_HAVE_OPENSSL_MD5_H . auto/have have=NGX_OPENSSL_MD5 . auto/have MD5=YES + MD5_LIB=OpenSSL else . auto/lib/md5/conf @@ -28,6 +29,7 @@ if [ $USE_SHA1 = YES ]; then if [ $OPENSSL != NONE -a $OPENSSL != NO ]; then have=NGX_HAVE_OPENSSL_SHA1_H . auto/have SHA1=YES + SHA1_LIB=OpenSSL else . auto/lib/sha1/conf diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf index 0c80fd59c..e081e4953 100644 --- a/auto/lib/md5/conf +++ b/auto/lib/md5/conf @@ -45,6 +45,7 @@ if [ $MD5 != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + MD5=NO # Solaris 8/9 @@ -58,55 +59,43 @@ else ngx_feature_test="MD5_CTX md5; MD5Init(&md5)" . auto/feature - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - MD5=YES - MD5_LIB=md5 - ngx_found=no + ngx_md5_lib="system md5" + + if [ $ngx_found = no ]; then - else # FreeBSD ngx_feature="rsaref md library" - ngx_feature_name= - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= ngx_feature_libs="-lmd" - ngx_feature_test="MD5_CTX md5; MD5Init(&md5)" . auto/feature + + ngx_md5_lib="system md" fi + if [ $ngx_found = no ]; then - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - MD5=YES - MD5_LIB=md - ngx_found=no - - else - if [ $MD5 = NO ]; then - - # OpenSSL crypto library - - ngx_feature="OpenSSL md5 crypto library" - ngx_feature_name="NGX_OPENSSL_MD5" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= - ngx_feature_libs="-lcrypto" - ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)" - . auto/feature + # OpenSSL crypto library + + ngx_feature="OpenSSL md5 crypto library" + ngx_feature_name="NGX_OPENSSL_MD5" + ngx_feature_incs="#include " + ngx_feature_libs="-lcrypto" + ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)" + . auto/feature + + ngx_md5_lib="system crypto" + + if [ $ngx_found = yes ]; then + have=NGX_HAVE_OPENSSL_MD5_H . auto/have fi fi - if [ $ngx_found = yes ]; then - have=NGX_HAVE_OPENSSL_MD5_H . auto/have CORE_LIBS="$CORE_LIBS $ngx_feature_libs" MD5=YES - MD5_LIB=crypto + MD5_LIB=$ngx_md5_lib fi + fi fi diff --git a/auto/lib/pcre/conf b/auto/lib/pcre/conf index 555143c8c..9a9c6ee4f 100644 --- a/auto/lib/pcre/conf +++ b/auto/lib/pcre/conf @@ -84,6 +84,7 @@ if [ $PCRE != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + PCRE=NO ngx_feature="PCRE library" @@ -95,20 +96,11 @@ else ngx_feature_test="pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL)" . auto/feature - if [ $ngx_found = yes ]; then - CORE_DEPS="$CORE_DEPS $REGEX_DEPS" - CORE_SRCS="$CORE_SRCS $REGEX_SRCS" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - PCRE=YES - ngx_found=no + if [ $ngx_found = no ]; then - else # FreeBSD port ngx_feature="PCRE library in /usr/local/" - ngx_feature_name="NGX_PCRE" - ngx_feature_run=no - ngx_feature_incs="#include " ngx_feature_path="/usr/local/include" if [ $NGX_RPATH = YES ]; then @@ -117,96 +109,50 @@ else ngx_feature_libs="-L/usr/local/lib -lpcre" fi - ngx_feature_test="pcre *re; - re = pcre_compile(NULL, 0, NULL, 0, NULL)" . auto/feature fi - if [ $ngx_found = yes ]; then - CORE_DEPS="$CORE_DEPS $REGEX_DEPS" - CORE_SRCS="$CORE_SRCS $REGEX_SRCS" - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - PCRE=YES - ngx_found=no + if [ $ngx_found = no ]; then - else # Linux package - if [ $PCRE = NO ]; then - - ngx_feature="PCRE library in /usr/include/pcre/" - ngx_feature_name="NGX_PCRE" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path="/usr/include/pcre" - ngx_feature_libs="-lpcre" - ngx_feature_test="pcre *re; - re = pcre_compile(NULL, 0, NULL, 0, NULL)" - . auto/feature - fi + ngx_feature="PCRE library in /usr/include/pcre/" + ngx_feature_path="/usr/include/pcre" + ngx_feature_libs="-lpcre" + + . auto/feature fi - if [ $ngx_found = yes ]; then - CORE_DEPS="$CORE_DEPS $REGEX_DEPS" - CORE_SRCS="$CORE_SRCS $REGEX_SRCS" - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - PCRE=YES - ngx_found=no + if [ $ngx_found = no ]; then - else # NetBSD port - if [ $PCRE = NO ]; then - - ngx_feature="PCRE library in /usr/pkg/" - ngx_feature_name="NGX_PCRE" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path="/usr/pkg/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre" - else - ngx_feature_libs="-L/usr/pkg/lib -lpcre" - fi + ngx_feature="PCRE library in /usr/pkg/" + ngx_feature_path="/usr/pkg/include" - ngx_feature_test="pcre *re; - re = pcre_compile(NULL, 0, NULL, 0, NULL)" - . auto/feature + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre" + else + ngx_feature_libs="-L/usr/pkg/lib -lpcre" fi + + . auto/feature fi - if [ $ngx_found = yes ]; then - CORE_DEPS="$CORE_DEPS $REGEX_DEPS" - CORE_SRCS="$CORE_SRCS $REGEX_SRCS" - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - PCRE=YES - ngx_found=no + if [ $ngx_found = no ]; then - else # MacPorts - if [ $PCRE = NO ]; then - - ngx_feature="PCRE library in /opt/local/" - ngx_feature_name="NGX_PCRE" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path="/opt/local/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre" - else - ngx_feature_libs="-L/opt/local/lib -lpcre" - fi + ngx_feature="PCRE library in /opt/local/" + ngx_feature_path="/opt/local/include" - ngx_feature_test="pcre *re; - re = pcre_compile(NULL, 0, NULL, 0, NULL)" - . auto/feature + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre" + else + ngx_feature_libs="-L/opt/local/lib -lpcre" fi + + . auto/feature fi if [ $ngx_found = yes ]; then @@ -215,7 +161,6 @@ else CORE_INCS="$CORE_INCS $ngx_feature_path" CORE_LIBS="$CORE_LIBS $ngx_feature_libs" PCRE=YES - ngx_found=no fi fi diff --git a/auto/lib/sha1/conf b/auto/lib/sha1/conf index 52ca97f59..888537779 100644 --- a/auto/lib/sha1/conf +++ b/auto/lib/sha1/conf @@ -35,6 +35,7 @@ if [ $SHA1 != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + SHA1=NO # FreeBSD @@ -48,35 +49,28 @@ else ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)" . auto/feature + ngx_sha1_lib="system md" - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - SHA1=YES - SHA1_LIB=md - ngx_found=no - - else - if [ $SHA1 = NO ]; then - - # OpenSSL crypto library - - ngx_feature="OpenSSL sha1 crypto library" - ngx_feature_name= - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= - ngx_feature_libs="-lcrypto" - ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)" - . auto/feature + if [ $ngx_found = no ]; then + + # OpenSSL crypto library + + ngx_feature="OpenSSL sha1 crypto library" + ngx_feature_incs="#include " + ngx_feature_libs="-lcrypto" + . auto/feature + + ngx_sha1_lib="system crypto" + + if [ $ngx_found = yes ]; then + have=NGX_HAVE_OPENSSL_SHA1_H . auto/have fi fi - if [ $ngx_found = yes ]; then - have=NGX_HAVE_OPENSSL_SHA1_H . auto/have CORE_LIBS="$CORE_LIBS $ngx_feature_libs" SHA1=YES - SHA1_LIB=crypto + SHA1_LIB=$ngx_sha1_lib fi fi diff --git a/auto/summary b/auto/summary index a8ed45446..bcb8bcd12 100644 --- a/auto/summary +++ b/auto/summary @@ -51,26 +51,14 @@ case $OPENSSL in esac case $MD5 in - YES) - case $OPENSSL in - NONE|NO) echo " + md5: using system $MD5_LIB library" ;; - *) echo " + md5: using OpenSSL library" ;; - esac - ;; - + YES) echo " + md5: using $MD5_LIB library" ;; NONE) echo " + md5 library is not used" ;; NO) echo " + md5 library is not found" ;; *) echo " + using md5 library: $MD5" ;; esac case $SHA1 in - YES) - case $OPENSSL in - NONE|NO) echo " + sha1: using system $SHA1_LIB library" ;; - *) echo " + sha1: using OpenSSL library" ;; - esac - ;; - + YES) echo " + sha1: using $SHA1_LIB library" ;; NONE) echo " + sha1 library is not used" ;; NO) echo " + sha1 library is not found" ;; *) echo " + using sha1 library: $SHA1" ;; -- cgit v1.2.3