From 119ee4915344cedb05089680a84bca9ffaf3b0b9 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 13 Jul 2016 17:23:59 -0700 Subject: [PATCH] Allow building with libcrypto not in the default directory. Add support for an argument to --with-crypto, so that if you have one version of libcrypto installed under /usr and another version installed under /usr/local, you can force tcpdump to be built with the /usr/local version. Also, refer both to OpenSSL and libressl in comments and messages. --- configure | 29 ++++++++++++++++++++++++----- configure.in | 27 ++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/configure b/configure index aab7239a1..a5c1026a6 100755 --- a/configure +++ b/configure @@ -1343,7 +1343,8 @@ Optional Packages: --with-sandbox-capsicum use Capsicum security functions [default=yes, if available] --with-system-libpcap don't use local pcap library - --with-crypto use OpenSSL libcrypto [default=yes, if available] + --with-crypto[=DIR] use OpenSSL/libressl libcrypto (located in directory + DIR, if specified) [default=yes, if available] --with-cap-ng use libcap-ng [default=yes, if available] Some influential environment variables: @@ -7951,9 +7952,9 @@ $as_echo "#define LBL_ALIGN 1" >>confdefs.h fi -# Check for OpenSSL libcrypto -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use OpenSSL libcrypto" >&5 -$as_echo_n "checking whether to use OpenSSL libcrypto... " >&6; } +# Check for OpenSSL/libressl libcrypto +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use OpenSSL/libressl libcrypto" >&5 +$as_echo_n "checking whether to use OpenSSL/libressl libcrypto... " >&6; } # Specify location for both includes and libraries. want_libcrypto=ifavailable @@ -7962,20 +7963,38 @@ if test "${with_crypto+set}" = set; then : withval=$with_crypto; if test $withval = no then + # User doesn't want to link with libcrypto. want_libcrypto=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } elif test $withval = yes then + # User wants to link with libcrypto but hasn't specified + # a directory. want_libcrypto=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + else + # User wants to link with libcrypto and has specified + # a directory, so use the provided value. + want_libcrypto=yes + libcrypto_root=$withval + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, using the version installed in $withval" >&5 +$as_echo "yes, using the version installed in $withval" >&6; } + + # + # Put the subdirectories of the libcrypto root directory + # at the front of the header and library search path. + # + CFLAGS="-I$withval/include $CFLAGS" + LIBS="-L$withval/lib $LIBS" fi else # - # Use libcrypto if it's present, otherwise don't. + # Use libcrypto if it's present, otherwise don't; no directory + # was specified. # want_libcrypto=ifavailable { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, if available" >&5 diff --git a/configure.in b/configure.in index 22ecee6fc..d7484ede3 100644 --- a/configure.in +++ b/configure.in @@ -881,26 +881,43 @@ AC_LBL_SOCKADDR_SA_LEN AC_LBL_UNALIGNED_ACCESS -# Check for OpenSSL libcrypto -AC_MSG_CHECKING(whether to use OpenSSL libcrypto) +# Check for OpenSSL/libressl libcrypto +AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto) # Specify location for both includes and libraries. want_libcrypto=ifavailable AC_ARG_WITH(crypto, - AS_HELP_STRING([--with-crypto], - [use OpenSSL libcrypto @<:@default=yes, if available@:>@]), + AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@, + [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]), [ if test $withval = no then + # User doesn't want to link with libcrypto. want_libcrypto=no AC_MSG_RESULT(no) elif test $withval = yes then + # User wants to link with libcrypto but hasn't specified + # a directory. want_libcrypto=yes AC_MSG_RESULT(yes) + else + # User wants to link with libcrypto and has specified + # a directory, so use the provided value. + want_libcrypto=yes + libcrypto_root=$withval + AC_MSG_RESULT([yes, using the version installed in $withval]) + + # + # Put the subdirectories of the libcrypto root directory + # at the front of the header and library search path. + # + CFLAGS="-I$withval/include $CFLAGS" + LIBS="-L$withval/lib $LIBS" fi ],[ # - # Use libcrypto if it's present, otherwise don't. + # Use libcrypto if it's present, otherwise don't; no directory + # was specified. # want_libcrypto=ifavailable AC_MSG_RESULT([yes, if available])