]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Have --with-crypto take an optional argument, specifying where libcrypto
authorguy <guy>
Tue, 26 Feb 2008 20:48:10 +0000 (20:48 +0000)
committerguy <guy>
Tue, 26 Feb 2008 20:48:10 +0000 (20:48 +0000)
can be found.  If --with-crypto is specified, and libcrypto isn't found,
fail, as presumably the user expected libcrypto to be available.

aclocal.m4
configure
configure.in

index 79e7c4aec5d637ec6506fcc7acdcd7b4302724f3..164a42ab0f68f78bfb51f5fc4526e9d0f556cef5 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.113.2.1 2008-02-26 19:21:25 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.113.2.2 2008-02-26 20:48:10 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
@@ -1254,3 +1254,30 @@ else
 fi
 AC_MSG_RESULT($ac_cv___attribute__)
 ])
+
+AC_DEFUN(AC_LBL_SSLEAY,
+    [
+       #
+       # XXX - is there a better way to check if a given library is
+       # in a given directory than checking each of the possible
+       # shared library suffixes?
+       #
+       # Are there any other suffixes we need to look for?  Do we
+       # have to worry about ".so.{version}"?
+       #
+       # Or should we just look for "libcrypto.*"?
+       #
+       if test -d "$1/lib" -a \( -f "$1/lib/libcrypto.a" -o \
+                                   -f "$1/lib/libcrypto.so" -o \
+                                   -f "$1/lib/libcrypto.sl" -o \
+                                   -f "$1/lib/libcrypto.dylib" \); then
+               ac_cv_ssleay_path="$1"
+       fi
+
+       #
+       # Make sure we have the headers as well.
+       #
+       if test -d "$1/include/openssl" -a -f "$1/include/openssl/des.h"; then
+               incdir="-I$1/include"
+       fi
+])
index a8fcb06271bc6cb7218c4480cbd06df13b975d02..b6ef98bf562bbd18b9a0b4d3f008009fbf081f96 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.196.2.2 .
+# From configure.in Revision: 1.196.2.3 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -856,7 +856,9 @@ Optional Packages:
   --without-gcc           don't use gcc
   --with-user=USERNAME    drop privileges by default to USERNAME
   --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY
-  --without-crypto        disable crypto support
+  --with-crypto[=PATH]
+                          use SSLeay libcrypto (located in directory PATH, if
+                          supplied). [default=yes, if available]
 
 Some influential environment variables:
   CC          C compiler command
@@ -12928,66 +12930,136 @@ _ACEOF
        fi
 
 
+# Check for SSLeay
+echo "$as_me:$LINENO: checking whether to use SSLeay libcrypto" >&5
+echo $ECHO_N "checking whether to use SSLeay libcrypto... $ECHO_C" >&6
+# Specify location for both includes and libraries.
+want_libcrypto=youmama
 
 # Check whether --with-crypto or --without-crypto was given.
 if test "${with_crypto+set}" = set; then
   withval="$with_crypto"
 
+       if test $withval = no
+       then
+               want_libcrypto=no
+               echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+       elif test $withval = yes
+       then
+               want_libcrypto=yes
+               echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+               want_libcrypto=yes
+               echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+               crypto_dir=$withval
+       fi
+
 else
 
-echo "$as_me:$LINENO: checking for SSLeay" >&5
-echo $ECHO_N "checking for SSLeay... $ECHO_C" >&6
-ac_cv_ssleay_path=no
-incdir=no
+       #
+       # Use libcrypto if it's present, otherwise don't.
+       #
+       want_libcrypto=ifavailable
+       echo "$as_me:$LINENO: result: yes, if available" >&5
+echo "${ECHO_T}yes, if available" >&6
 
-#
-# If Xprefix is set in the environment, use that value.
-# XXX - this should arguably be done by having --with-crypto take an
-# optional argument, and have that argument be used to set Xprefix
-# if present.
-#
-if test -z "$Xprefix"; then
-       Xprefix=`eval echo $prefix`
-fi
+fi;
+if test "$want_libcrypto" != "no"; then
+       ac_cv_ssleay_path=no
+       incdir=no
+       if test "x$crypto_dir" = x; then
+               #
+               # Location not specified; check the default locations.
+               #
+               echo "$as_me:$LINENO: checking where SSLeay is located" >&5
+echo $ECHO_N "checking where SSLeay is located... $ECHO_C" >&6
+               dirs="/usr /usr/local /usr/local/ssl /usr/pkg"
+               if test "x${host_alias}" != x; then
+                       dirs="/usr/${host_alias} $dirs"
+               fi
+               for dir in $dirs; do
 
-for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
        #
        # XXX - is there a better way to check if a given library is
        # in a given directory than checking each of the possible
        # shared library suffixes?
        #
-       # Are there any other suffixes we need to look for?  Do we have to
-       # worry about ".so.{version}"?
+       # Are there any other suffixes we need to look for?  Do we
+       # have to worry about ".so.{version}"?
        #
        # Or should we just look for "libcrypto.*"?
        #
-       if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
-                                 -f $dir/lib/libcrypto.so -o \
-                                 -f $dir/lib/libcrypto.sl -o \
-                                 -f $dir/lib/libcrypto.dylib \); then
-               ac_cv_ssleay_path=$dir
+       if test -d "$dir/lib" -a \( -f "$dir/lib/libcrypto.a" -o \
+                                   -f "$dir/lib/libcrypto.so" -o \
+                                   -f "$dir/lib/libcrypto.sl" -o \
+                                   -f "$dir/lib/libcrypto.dylib" \); then
+               ac_cv_ssleay_path="$dir"
        fi
-       if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
+
+       #
+       # Make sure we have the headers as well.
+       #
+       if test -d "$dir/include/openssl" -a -f "$dir/include/openssl/des.h"; then
                incdir="-I$dir/include"
        fi
-       if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
-               break;
+
+
+                       if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
+                               break;
+                       else
+                               ac_cv_ssleay_path=no
+                               incdir=no
+                       fi
+               done
+               if test "$ac_cv_ssleay_path" != no; then
+                       echo "$as_me:$LINENO: result: $ac_cv_ssleay_path" >&5
+echo "${ECHO_T}$ac_cv_ssleay_path" >&6
+               fi
        else
-               ac_cv_ssleay_path=no
-               incdir=no
+               echo "$as_me:$LINENO: checking for SSLeay in $crypto_dir" >&5
+echo $ECHO_N "checking for SSLeay in $crypto_dir... $ECHO_C" >&6
+
+       #
+       # XXX - is there a better way to check if a given library is
+       # in a given directory than checking each of the possible
+       # shared library suffixes?
+       #
+       # Are there any other suffixes we need to look for?  Do we
+       # have to worry about ".so.{version}"?
+       #
+       # Or should we just look for "libcrypto.*"?
+       #
+       if test -d "$crypto_dir/lib" -a \( -f "$crypto_dir/lib/libcrypto.a" -o \
+                                   -f "$crypto_dir/lib/libcrypto.so" -o \
+                                   -f "$crypto_dir/lib/libcrypto.sl" -o \
+                                   -f "$crypto_dir/lib/libcrypto.dylib" \); then
+               ac_cv_ssleay_path="$crypto_dir"
        fi
-done
-echo "$as_me:$LINENO: result: $ac_cv_ssleay_path" >&5
-echo "${ECHO_T}$ac_cv_ssleay_path" >&6
-if test "$ac_cv_ssleay_path" != no; then
-       V_INCLS="$V_INCLS $incdir"
-       LDFLAGS="-L$dir/lib $LDFLAGS"
-       if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
-               LIBS="$LIBS -lRSAglue"
+
+       #
+       # Make sure we have the headers as well.
+       #
+       if test -d "$crypto_dir/include/openssl" -a -f "$crypto_dir/include/openssl/des.h"; then
+               incdir="-I$crypto_dir/include"
        fi
-       if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
-               LIBS="$LIBS -lrsaref"
+
+               if test "$ac_cv_ssleay_path" != no; then
+                       echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+               fi
        fi
+       if test "$ac_cv_ssleay_path" != no; then
+               V_INCLS="$V_INCLS $incdir"
+               LDFLAGS="-L$dir/lib $LDFLAGS"
+               if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
+                       LIBS="$LIBS -lRSAglue"
+               fi
+               if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
+                       LIBS="$LIBS -lrsaref"
+               fi
 
 echo "$as_me:$LINENO: checking for DES_cbc_encrypt in -lcrypto" >&5
 echo $ECHO_N "checking for DES_cbc_encrypt in -lcrypto... $ECHO_C" >&6
@@ -13063,7 +13135,7 @@ _ACEOF
 fi
 
 
-       CPPFLAGS="$CPPFLAGS $V_INCLS"
+               CPPFLAGS="$CPPFLAGS $V_INCLS"
 
 for ac_header in openssl/evp.h
 do
 
 done
 
+       else
+               #
+               # Not found.  Did the user explicitly ask for it?
+               #
+               echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6
+               if test "$want_libcrypto" = yes; then
+                       { { echo "$as_me:$LINENO: error: SSLeay not found" >&5
+echo "$as_me: error: SSLeay not found" >&2;}
+   { (exit 1); exit 1; }; }
+               fi
+       fi
 fi
 
-fi;
-
 if test "$missing_includes" = "yes"; then
        CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
        V_INCLS="$V_INCLS -I\$(srcdir)/missing"
index 1b165f800f9715f1055f05f28769b4a5591a48eb..eb985d1a62aae488aeb88a180fd8c389eee48ba3 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.196.2.2 2008-02-05 18:59:56 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.196.2.3 2008-02-26 20:48:10 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.196.2.2 $)
+AC_REVISION($Revision: 1.196.2.3 $)
 AC_PREREQ(2.50)
 AC_INIT(tcpdump.c)
 
@@ -910,65 +910,89 @@ AC_LBL_UNALIGNED_ACCESS
 
 AC_VAR_H_ERRNO
 
-AC_ARG_WITH(crypto, [  --without-crypto        disable crypto support],
-       [], [
-AC_MSG_CHECKING(for SSLeay)
-ac_cv_ssleay_path=no
-incdir=no
-
-#
-# If Xprefix is set in the environment, use that value.
-# XXX - this should arguably be done by having --with-crypto take an
-# optional argument, and have that argument be used to set Xprefix
-# if present.
-#
-if test -z "$Xprefix"; then
-       Xprefix=`eval echo $prefix`
-fi
-
-for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
-       #
-       # XXX - is there a better way to check if a given library is
-       # in a given directory than checking each of the possible
-       # shared library suffixes?
-       #
-       # Are there any other suffixes we need to look for?  Do we have to
-       # worry about ".so.{version}"?
+# Check for SSLeay
+AC_MSG_CHECKING(whether to use SSLeay libcrypto)
+# Specify location for both includes and libraries.
+want_libcrypto=youmama
+AC_ARG_WITH(crypto,
+    AS_HELP_STRING([--with-crypto@<:@=PATH@:>@],
+                  [use SSLeay libcrypto (located in directory PATH, if supplied).  @<:@default=yes, if available@:>@]),
+[
+       if test $withval = no
+       then
+               want_libcrypto=no
+               AC_MSG_RESULT(no)
+       elif test $withval = yes
+       then
+               want_libcrypto=yes
+               AC_MSG_RESULT(yes)
+       else
+               want_libcrypto=yes
+               AC_MSG_RESULT(yes)
+               crypto_dir=$withval
+       fi
+],[
        #
-       # Or should we just look for "libcrypto.*"?
+       # Use libcrypto if it's present, otherwise don't.
        #
-       if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
-                                 -f $dir/lib/libcrypto.so -o \
-                                 -f $dir/lib/libcrypto.sl -o \
-                                 -f $dir/lib/libcrypto.dylib \); then
-               ac_cv_ssleay_path=$dir
-       fi
-       if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
-               incdir="-I$dir/include"
-       fi
-       if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
-               break;
+       want_libcrypto=ifavailable
+       AC_MSG_RESULT([yes, if available])
+])
+if test "$want_libcrypto" != "no"; then
+       ac_cv_ssleay_path=no
+       incdir=no
+       if test "x$crypto_dir" = x; then
+               #
+               # Location not specified; check the default locations.
+               #
+               AC_MSG_CHECKING(where SSLeay is located)
+               dirs="/usr /usr/local /usr/local/ssl /usr/pkg"
+               if test "x${host_alias}" != x; then
+                       dirs="/usr/${host_alias} $dirs"
+               fi
+               for dir in $dirs; do
+                       AC_LBL_SSLEAY($dir)
+
+                       if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
+                               break;
+                       else
+                               ac_cv_ssleay_path=no
+                               incdir=no
+                       fi
+               done
+               if test "$ac_cv_ssleay_path" != no; then
+                       AC_MSG_RESULT($ac_cv_ssleay_path)
+               fi
        else
-               ac_cv_ssleay_path=no
-               incdir=no
-       fi
-done
-AC_MSG_RESULT($ac_cv_ssleay_path)
-if test "$ac_cv_ssleay_path" != no; then
-       V_INCLS="$V_INCLS $incdir"
-       LDFLAGS="-L$dir/lib $LDFLAGS"
-       if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
-               LIBS="$LIBS -lRSAglue"
-       fi
-       if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
-               LIBS="$LIBS -lrsaref"
+               AC_MSG_CHECKING(for SSLeay in $crypto_dir)
+               AC_LBL_SSLEAY($crypto_dir)
+               if test "$ac_cv_ssleay_path" != no; then
+                       AC_MSG_RESULT(found)
+               fi
        fi
-       AC_CHECK_LIB(crypto, DES_cbc_encrypt)
+       if test "$ac_cv_ssleay_path" != no; then
+               V_INCLS="$V_INCLS $incdir"
+               LDFLAGS="-L$dir/lib $LDFLAGS"
+               if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
+                       LIBS="$LIBS -lRSAglue"
+               fi
+               if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
+                       LIBS="$LIBS -lrsaref"
+               fi
+               AC_CHECK_LIB(crypto, DES_cbc_encrypt)
 
-       CPPFLAGS="$CPPFLAGS $V_INCLS"
-       AC_CHECK_HEADERS(openssl/evp.h)
+               CPPFLAGS="$CPPFLAGS $V_INCLS"
+               AC_CHECK_HEADERS(openssl/evp.h)
+       else
+               #
+               # Not found.  Did the user explicitly ask for it?
+               #
+               AC_MSG_RESULT(not found)
+               if test "$want_libcrypto" = yes; then
+                       AC_MSG_ERROR(SSLeay not found)
+               fi
+       fi
 fi
-])
 
 dnl
 dnl set additional include path if necessary