Make configure fail with an error if the user requests --with-openssl (without

giving a directory) and OpenSSL is not found. This is meant to guard against
mistakenly building an RPM without OpenSSL on a machine where it is not
available.

If you don't give any arguments, configure still works the same way: it checks
for OpenSSL and doesn't use it if it's not present. If you use
--with-openssl=DIR or --without-openssl then configure takes you at your word
without checking anything. If you say --with-openssl and OpenSSL is fine then
Nmap is built with OpenSSL. The only difference this change introduces is if
you say --with-openssl and OpenSSL is not found. Now the configure script
quits, where previously it would continue with a warning.
This commit is contained in:
david 2008-09-08 23:37:03 +00:00
parent f3d8cf7674
commit 25cb95db56
2 changed files with 30 additions and 2 deletions

17
configure vendored
View file

@ -6050,8 +6050,14 @@ if test $ac_cv_header_openssl_ssl_h = yes; then
:
else
use_openssl="no"
if test "$with_openssl" = "yes"; then
{ { echo "$as_me:$LINENO: error: OpenSSL was explicitly requested but openssl/ssl.h was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&5
echo "$as_me: error: OpenSSL was explicitly requested but openssl/ssl.h was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5
echo "$as_me: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;}
fi
@ -6123,8 +6129,14 @@ if test $ac_cv_lib_crypto_BIO_int_ctrl = yes; then
use_openssl="yes"
else
use_openssl="no"
if test "$with_openssl" = "yes"; then
{ { echo "$as_me:$LINENO: error: OpenSSL was explicitly requested but libcrypto was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&5
echo "$as_me: error: OpenSSL was explicitly requested but libcrypto was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5
echo "$as_me: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;}
fi
fi
@ -6195,6 +6207,11 @@ if test $ac_cv_lib_ssl_SSL_new = yes; then
use_openssl="yes"
else
use_openssl="no"
if test "$with_openssl" = "yes"; then
{ { echo "$as_me:$LINENO: error: OpenSSL was explicitly requested but libssl was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&5
echo "$as_me: error: OpenSSL was explicitly requested but libssl was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5
echo "$as_me: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;}
fi

View file

@ -252,20 +252,31 @@ AC_HELP_STRING([--with-openssl=DIR],[Use optional openssl libs and includes from
if test "$use_openssl" = "yes" -a -z "$specialssldir"; then
AC_CHECK_HEADER(openssl/ssl.h,,
[ use_openssl="no"
AC_MSG_WARN([Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument]) ])
if test "$with_openssl" = "yes"; then
AC_MSG_ERROR([OpenSSL was explicitly requested but openssl/ssl.h was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.])
fi
AC_MSG_WARN([Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument])
])
# use_openssl="yes" given explicitly in next 2 rules to avoid adding lib to $LIBS
if test "$use_openssl" = "yes"; then
AC_CHECK_LIB(crypto, BIO_int_ctrl,
[ use_openssl="yes"],
[ use_openssl="no"
AC_MSG_WARN([Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument]) ])
if test "$with_openssl" = "yes"; then
AC_MSG_ERROR([OpenSSL was explicitly requested but libcrypto was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.])
fi
AC_MSG_WARN([Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument])
])
fi
if test "$use_openssl" = "yes"; then
AC_CHECK_LIB(ssl, SSL_new,
[ use_openssl="yes" ],
[ use_openssl="no"
if test "$with_openssl" = "yes"; then
AC_MSG_ERROR([OpenSSL was explicitly requested but libssl was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.])
fi
AC_MSG_WARN([Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument]) ],
[ -lcrypto ])
fi