From: Roy T. Fielding Date: Thu, 10 May 2001 01:47:47 +0000 (+0000) Subject: Eventually we will want to only find openssl once regardless of how X-Git-Tag: 2.0.18~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba518019b5ede22be5ead1250120e82bdef9588c;p=thirdparty%2Fapache%2Fhttpd.git Eventually we will want to only find openssl once regardless of how many modules depend on it, so make the check an autoconf macro. Note that this still isn't being checked "the autoconf way", but it is better than what we have now. I'm not sure about the -R stuff, but I am told that Solaris won't build without it. This is something that should be tested using AC_TRY_LINK rather than assuming openssl isn't already on the ld path. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89063 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/acinclude.m4 b/acinclude.m4 index 4fc5ec396a4..f497965cee7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -349,3 +349,105 @@ AC_DEFUN(APACHE_REQUIRE_CXX,[ apache_cxx_done=yes fi ]) + +dnl +dnl APACHE_CHECK_SSL_TOOLKIT +dnl +dnl Find the openssl toolkit installation and check it for the right +dnl version, then add its flags to INCLUDES and LIBS. This should +dnl really be using a custom AC_TRY_COMPILE function to test the includes +dnl and then AC_TRY_LINK to test the libraries directly for the version, +dnl but that will require someone who knows how to program openssl. +dnl +AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[ + AC_MSG_CHECKING(for SSL/TLS toolkit base) + ap_ssltk_base="" + AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [ + if test "x$withval" != "xyes" -a "x$withval" != "x"; then + ap_ssltk_base="$withval" + fi + ]) + if test "x$ap_ssltk_base" = "x"; then + AC_CACHE_VAL(ap_cv_ssltk,[ + # + # shotgun approach: find all occurrences of the openssl program + # + ap_ssltk_try="" + for p in /usr/local/openssl/bin /usr/local/ssl/bin $path; do + if test -f "$p/openssl"; then + ap_ssltk_try="$ap_ssltk_try $p" + fi + done + if test "x$ap_ssltk_try" = "x"; then + AC_MSG_ERROR(['openssl' not found in path]) + fi + for p in $ap_ssltk_try; do + ap_ssltk_version="`$p/openssl version`" + case "$ap_ssltk_version" in + *[[^0-9a-z.]][[1-9]]* | \ + *[[^0-9a-z.]]0.9.[[6-9]]* | \ + *[[^0-9a-z.]]0.[[1-9]][[0-9]]* ) + ap_cv_ssltk="`(cd $p/.. && pwd)`" + break + ;; + *) + # skip because it is too old or a bad result + ;; + esac + done + if test "x$ap_cv_ssltk" = "x"; then + AC_MSG_ERROR([requires OpenSSL 0.9.6 or higher]) + fi + ]) + ap_ssltk_base="$ap_cv_ssltk" + fi + if test ! -d $ap_ssltk_base; then + AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ap_ssltk_base]) + fi + AC_MSG_RESULT($ap_ssltk_base) + + AC_MSG_CHECKING(for SSL/TLS toolkit version) + AC_MSG_RESULT($ap_ssltk_version) + + AC_MSG_CHECKING(for SSL/TLS toolkit includes) + ap_ssltk_incdir="" + for p in $ap_ssltk_base/include /usr/local/openssl/include \ + /usr/local/ssl/include /usr/local/include /usr/include; do + if test -f "$p/openssl/ssl.h"; then + ap_ssltk_incdir="$p" + break + fi + done + if test "x$ap_ssltk_incdir" = "x"; then + AC_MSG_ERROR([OpenSSL headers not found]) + fi + AC_MSG_RESULT($ap_ssltk_incdir) + + AC_MSG_CHECKING(for SSL/TLS toolkit libraries) + ap_ssltk_libdir="" + for p in $ap_ssltk_base/lib /usr/local/openssl/lib \ + /usr/local/ssl/lib /usr/local/lib /usr/lib /lib; do + if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then + ap_ssltk_libdir="$p" + break + fi + done + if test ".$ap_ssltk_libdir" = .; then + AC_MSG_ERROR([OpenSSL libraries not found]) + fi + AC_MSG_RESULT($ap_ssltk_libdir) + + dnl # annotate the Apache build environment with determined information + if test "x$ap_ssltk_incdir" != "x/usr/include"; then + APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir]) + fi + if test "x$ap_ssltk_libdir" != "x/usr/lib"; then + APR_ADDTO(LIBS, [-L$ap_ssltk_libdir]) + if test "x$ap_platform_needs_R" = "xyes"; then + APR_ADDTO(LIBS, [-R$ap_ssltk_libdir]) + fi + fi + APR_ADDTO(LIBS, [-lssl -lcrypto]) + ap_cv_ssltk="$ap_ssltk_base" +]) + diff --git a/hints.m4 b/hints.m4 index 4a3969c0faf..3187d05399c 100644 --- a/hints.m4 +++ b/hints.m4 @@ -57,6 +57,9 @@ dnl ;; APR_SETVAR(APACHE_MPM, [beos]) APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) ;; + *-solaris2*) + ap_platform_needs_R="yes" + ;; esac fi diff --git a/modules/ssl/config.m4 b/modules/ssl/config.m4 index dcc98c30026..86313301ee4 100644 --- a/modules/ssl/config.m4 +++ b/modules/ssl/config.m4 @@ -78,105 +78,7 @@ ssl_util_table.lo dnl " dnl # hook module into the Autoconf mechanism (--enable-ssl option) APACHE_MODULE(ssl, [SSL/TLS support (mod_ssl)], $ssl_objs, , no, [ - - dnl # hook into Autoconf mechanism (--with-ssl[=DIR] option) - AC_MSG_CHECKING(for SSL/TLS toolkit base) - ssltk_base="SYSTEM" - AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [ - if test ".$withval" != .yes -a ".$withval" != .; then - ssltk_base="$withval" - if test ! -d $ssltk_base; then - AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ssltk_base]) - fi - fi - ]) - AC_MSG_RESULT($ssltk_base) - - dnl # determine SSL/TLS toolkit frontend (openssl binary) - AC_MSG_CHECKING(for SSL/TLS toolkit frontend) - ssltk_frontend="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . `echo $PATH | sed -e 's/:/ /g'` /usr/local/openssl/bin /usr/local/ssl/bin; do - if test -f "$p/openssl"; then - ssltk_frontend="$p/openssl" - break - fi - done - if test ".$ssltk_frontend" = .; then - AC_MSG_ERROR(['openssl' not found in $PATH]) - fi - else - if test -f "$ssltk_base/bin/openssl"; then - ssltk_frontend="$ssltk_base/bin/openssl" - else - AC_MSG_ERROR(['openssl' not found in $ssltk_base/bin/]) - fi - fi - AC_MSG_RESULT($ssltk_frontend) - - dnl # determine SSL/TLS toolkit version - AC_MSG_CHECKING(for SSL/TLS toolkit version) - ssltk_version="`$ssltk_frontend version`" - case "$ssltk_version" in - *0.9.[[6789]]* ) ;; - * ) AC_MSG_ERROR([SSL/TLS toolkit version $ssltk_version not supported]) ;; - esac - AC_MSG_RESULT($ssltk_version) - - dnl # determine SSL/TLS toolkit include directory - AC_MSG_CHECKING(for SSL/TLS toolkit includes) - ssltk_incdir="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . /usr/local/openssl/include /usr/local/ssl/include /usr/local/include/ssl /usr/local/include /usr/include/ssl /usr/include; do - if test -f "$p/openssl/ssl.h"; then - ssltk_incdir="$p" - break - fi - done - if test ".$ssltk_incdir" = .; then - AC_MSG_ERROR([OpenSSL headers not found]) - fi - else - if test -f "$ssltk_base/include/openssl/ssl.h"; then - ssltk_incdir="$ssltk_base/include" - else - AC_MSG_ERROR([OpenSSL headers not found under $ssltk_base]) - fi - fi - AC_MSG_RESULT($ssltk_incdir) - - dnl # determine SSL/TLS toolkit library directory - AC_MSG_CHECKING(for SSL/TLS toolkit libraries) - ssltk_libdir="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . /usr/local/openssl/lib /usr/local/ssl/lib /usr/local/lib/ssl /usr/local/lib /usr/lib/ssl /usr/lib /lib; do - if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then - ssltk_libdir="$p" - break - fi - done - if test ".$ssltk_libdir" = .; then - AC_MSG_ERROR([OpenSSL libraries not found]) - fi - else - if test -f "$ssltk_base/libssl.a" -o -f "$ssltk_base/libssl.so"; then - ssltk_libdir="$ssltk_base" - elif test -f "$ssltk_base/lib/libssl.a" -o -f "$ssltk_base/lib/libssl.so"; then - ssltk_libdir="$ssltk_base/lib" - else - AC_MSG_ERROR([OpenSSL libraries not found under $ssltk_base]) - fi - fi - AC_MSG_RESULT($ssltk_libdir) - - dnl # annotate the Apache build environment with determined information - if test ".$ssltk_incdir" != "./usr/include"; then - APR_ADDTO(INCLUDES, [-I$ssltk_incdir]) - fi - if test ".$ssltk_libdir" != "./usr/lib"; then - APR_ADDTO(LIBS, [-L$ssltk_libdir]) - fi - APR_ADDTO(LIBS, [-lssl -lcrypto]) + APACHE_CHECK_SSL_TOOLKIT ]) dnl # end of module specific part