|
@@ -0,0 +1,163 @@
|
|
|
+From 5009fc3c273622c35a31ba5d600124117b484fd9 Mon Sep 17 00:00:00 2001
|
|
|
+From: Corey Minyard <cminyard@mvista.com>
|
|
|
+Date: Sun, 26 Jan 2020 21:26:07 -0600
|
|
|
+Subject: [PATCH] configure: Modify --with-openssl to take yes and no
|
|
|
+
|
|
|
+Allow openssl to be disabled with --with-openssl=no. Otherwise works as
|
|
|
+before.
|
|
|
+
|
|
|
+Signed-off-by: Corey Minyard <cminyard@mvista.com>
|
|
|
+[Retrieved from:
|
|
|
+https://github.com/cminyard/gensio/commit/5009fc3c273622c35a31ba5d600124117b484fd9]
|
|
|
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
|
+---
|
|
|
+ m4/ax_check_openssl.m4 | 117 ++++++++++++++++++++++-------------------
|
|
|
+ 1 file changed, 63 insertions(+), 54 deletions(-)
|
|
|
+
|
|
|
+diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
|
|
|
+index a87c5a6..489fd88 100644
|
|
|
+--- a/m4/ax_check_openssl.m4
|
|
|
++++ b/m4/ax_check_openssl.m4
|
|
|
+@@ -37,18 +37,25 @@
|
|
|
+ AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
|
|
|
+ AC_DEFUN([AX_CHECK_OPENSSL], [
|
|
|
+ found=false
|
|
|
++ tryopenssl=true
|
|
|
++ ssldirs=""
|
|
|
+ AC_ARG_WITH([openssl],
|
|
|
+- [AS_HELP_STRING([--with-openssl=DIR],
|
|
|
+- [root of the OpenSSL directory])],
|
|
|
++ [AS_HELP_STRING([--with-openssl[[=yes|no|PATH]]],
|
|
|
++ [Look for OpenSSL, with optional root of the OpenSSL directory])],
|
|
|
+ [
|
|
|
+ case "$withval" in
|
|
|
+- "" | y | ye | yes | n | no)
|
|
|
+- AC_MSG_ERROR([Invalid --with-openssl value])
|
|
|
++ "" | y | ye | yes)
|
|
|
++ ;;
|
|
|
++ n | no)
|
|
|
++ tryopenssl=false
|
|
|
+ ;;
|
|
|
+ *) ssldirs="$withval"
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+- ], [
|
|
|
++ ], [])
|
|
|
++
|
|
|
++ if $tryopenssl; then
|
|
|
++ if test x"$ssldirs" == x""; then
|
|
|
+ # 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])
|
|
|
+@@ -65,60 +72,62 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
|
|
|
+ if ! $found; then
|
|
|
+ ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
|
|
|
+ fi
|
|
|
+- ]
|
|
|
+- )
|
|
|
++ fi
|
|
|
+
|
|
|
++ # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
|
|
|
++ # an 'openssl' subdirectory
|
|
|
+
|
|
|
+- # 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 ! $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
|
|
|
++ # 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
|
|
|
++ # 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
|
|
|
++ 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"
|
|
|
++ 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])
|
|
|
++ AC_SUBST([OPENSSL_INCLUDES])
|
|
|
++ AC_SUBST([OPENSSL_LIBS])
|
|
|
++ AC_SUBST([OPENSSL_LDFLAGS])
|
|
|
++ else
|
|
|
++ AC_MSG_NOTICE([Skipping openssl check, openssl disabled])
|
|
|
++ $2
|
|
|
++ fi
|
|
|
+ ])
|