Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist Check in mods from Alan Horn...



details:   https://anonhg.NetBSD.org/src/rev/04ecdaac0550
branches:  trunk
changeset: 756858:04ecdaac0550
user:      agc <agc%NetBSD.org@localhost>
date:      Fri Aug 06 06:58:53 2010 +0000

description:
Check in mods from Alan Horn to allow an alternate location for (a more
up to date?) version of openssl to be specified at configuration time.

diffstat:

 crypto/external/bsd/netpgp/dist/ax_check_openssl.m4 |  124 ++++++++++++++++++++
 crypto/external/bsd/netpgp/dist/configure.ac        |   15 +-
 2 files changed, 136 insertions(+), 3 deletions(-)

diffs (168 lines):

diff -r 299ff1e8e484 -r 04ecdaac0550 crypto/external/bsd/netpgp/dist/ax_check_openssl.m4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/ax_check_openssl.m4       Fri Aug 06 06:58:53 2010 +0000
@@ -0,0 +1,124 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for OpenSSL in a number of default spots, or in a user-selected
+#   spot (via --with-openssl).  Sets
+#
+#     OPENSSL_INCLUDES to the include directives required
+#     OPENSSL_LIBS to the -l directives required
+#     OPENSSL_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets OPENSSL_INCLUDES such that source files should use the
+#   openssl/ directory in include directives:
+#
+#     #include <openssl/hmac.h>
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Zmanda Inc. <http://www.zmanda.com/>
+#   Copyright (c) 2009 Dustin J. Mitchell <dustin%zmanda.com@localhost>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 5
+
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
+AC_DEFUN([AX_CHECK_OPENSSL], [
+    found=false
+    AC_ARG_WITH(openssl,
+        AS_HELP_STRING([--with-openssl=DIR],
+            [root of the OpenSSL directory]),
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-openssl value])
+              ;;
+            *) ssldirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and openssl has installed a .pc file,
+            # then use that information and don't search ssldirs
+            AC_PATH_PROG(PKG_CONFIG, pkg-config)
+            if test x"$PKG_CONFIG" != x""; then
+                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
+                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+                    found=true
+                fi
+            fi
+
+            # no such luck; use some default ssldirs
+            if ! $found; then
+                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
+    # an 'openssl' subdirectory
+
+    if ! $found; then
+        OPENSSL_INCLUDES=
+        for ssldir in $ssldirs; do
+            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+            if test -f "$ssldir/include/openssl/ssl.h"; then
+                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_LDFLAGS="-L$ssldir/lib"
+                OPENSSL_LIBS="-lssl -lcrypto"
+                found=true
+                AC_MSG_RESULT([yes])
+                break
+            else
+                AC_MSG_RESULT([no])
+            fi
+        done
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
+    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE(
+        AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)]),
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_LIBS])
+    AC_SUBST([OPENSSL_LDFLAGS])
+])
diff -r 299ff1e8e484 -r 04ecdaac0550 crypto/external/bsd/netpgp/dist/configure.ac
--- a/crypto/external/bsd/netpgp/dist/configure.ac      Fri Aug 06 06:29:38 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure.ac      Fri Aug 06 06:58:53 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.33 2010/07/09 05:36:28 agc Exp $
+# $NetBSD: configure.ac,v 1.34 2010/08/06 06:58:53 agc Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([netpgp],[20100707],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
+AC_INIT([netpgp],[20100710],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
 AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.33 $])
+AC_REVISION([$Revision: 1.34 $])
 
 AS_SHELL_SANITIZE
 
@@ -38,6 +38,9 @@
        AC_MSG_RESULT([no])])
 AC_SUBST([WARNCFLAGS])
 
+# try to see if we need to link with -ldl
+AC_SEARCH_LIBS(dlopen, dl)
+
 # Checks for header files.
 #
 AC_HEADER_STDC
@@ -64,6 +67,12 @@
 AC_TYPE_UINT64_T
 AC_TYPE_UINT8_T
 
+# check for openssl
+m4_include([ax_check_openssl.m4])
+
+AX_CHECK_OPENSSL([LIBS="$LIBS $OPENSSL_LIBS" INCLUDES="$INCLUDES $OPENSSL_INCLUDES"],
+       [AC_MSG_ERROR([Missing OpenSSL])])
+
 AC_CHECK_TYPES([SHA256_CTX],
                [],
                [AC_MSG_FAILURE([missing SHA256_CTX; is openssl 0.9.8 or newer installed?])],



Home | Main Index | Thread Index | Old Index