Skip to content

Commit

Permalink
soft require openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ortmann committed Oct 2, 2023
1 parent 45445f2 commit f6046e6
Showing 1 changed file with 49 additions and 44 deletions.
93 changes: 49 additions & 44 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1530,13 +1530,10 @@ AC_DEFUN([EGG_TLS_ENABLE],
[
AC_MSG_CHECKING([whether to enable TLS support])
AC_ARG_ENABLE(tls,
[ --enable-tls enable TLS support (autodetect)],
[enable_tls="$enableval"])
AC_ARG_ENABLE(tls,
[ --disable-tls disable TLS support ], [enable_tls="$enableval"],
[enable_tls="autodetect"])
[ --disable-tls disable TLS support ], [tls_enabled="$enableval"],
[tls_enabled="$enableval"])
AC_MSG_RESULT([$enable_tls])
AC_MSG_RESULT([$tls_enabled])
])


Expand All @@ -1546,46 +1543,58 @@ AC_DEFUN(EGG_TLS_WITHSSL,
[
save_LIBS="$LIBS"
AC_ARG_WITH(sslinc, [ --with-sslinc=PATH Path to OpenSSL headers], [
if test "$enable_tls" != "no"; then
if test -d "$withval"; then
save_CC="$CC"
save_CPP="$CPP"
CC="$CC -I$withval"
CPP="$CPP -I$withval"
AC_CHECK_HEADERS([openssl/ssl.h openssl/x509v3.h], [sslinc="-I$withval"], [
if test -d "$withval"; then
save_CC="$CC"
save_CPP="$CPP"
CC="$CC -I$withval"
CPP="$CPP -I$withval"
AC_CHECK_HEADERS([openssl/ssl.h openssl/x509v3.h], [sslinc="-I$withval"], [
if test "$tls_enabled" != "no"; then
AC_MSG_WARN([Invalid path to OpenSSL headers. $withval/openssl/ doesn't contain the required files.])
sslinc=""
break
], [[
#ifdef CYGWIN_HACKS
# ifndef __int64
# define __int64 long long
# endif
#endif
]])
AC_SUBST(SSL_INCLUDES, [$sslinc])
CC="$save_CC"
CPP="$save_CPP"
else
else
AC_MSG_ERROR([Invalid path to OpenSSL headers. $withval/openssl/ doesn't contain the required files.])
fi
sslinc=""
break
], [[
#ifdef CYGWIN_HACKS
# ifndef __int64
# define __int64 long long
# endif
#endif
]])
AC_SUBST(SSL_INCLUDES, [$sslinc])
CC="$save_CC"
CPP="$save_CPP"
else
if test "$tls_enabled" != "no"; then
AC_MSG_WARN([Invalid path to OpenSSL headers. $withval is not a directory.])
else
AC_MSG_ERROR([Invalid path to OpenSSL headers. $withval is not a directory.])
fi
fi
])
AC_ARG_WITH(ssllib, [ --with-ssllib=PATH Path to OpenSSL libraries],
[
if test "$enable_tls" != "no"; then
if test -d "$withval"; then
AC_CHECK_LIB(crypto, X509_digest, , [havessllib="no"], [-L$withval -lssl])
AC_CHECK_LIB(ssl, SSL_accept, , [havessllib="no"], [-L$withval -lcrypto])
if test "$havessllib" = "no"; then
if test -d "$withval"; then
AC_CHECK_LIB(crypto, X509_digest, , [havessllib="no"], [-L$withval -lssl])
AC_CHECK_LIB(ssl, SSL_accept, , [havessllib="no"], [-L$withval -lcrypto])
if test "$havessllib" = "no"; then
if test "$tls_enabled" != "no"; then
AC_MSG_WARN([Invalid path to OpenSSL libs. $withval doesn't contain the required files.])
else
AC_SUBST(SSL_LIBS, [-L$withval])
LDFLAGS="${LDFLAGS} -L$withval"
AC_MSG_ERROR([Invalid path to OpenSSL libs. $withval doesn't contain the required files.])
fi
else
AC_SUBST(SSL_LIBS, [-L$withval])
LDFLAGS="${LDFLAGS} -L$withval"
fi
else
if test "$tls_enabled" != "no"; then
AC_MSG_WARN([You have specified an invalid path to OpenSSL libs. $withval is not a directory.])
else
AC_MSG_ERROR([You have specified an invalid path to OpenSSL libs. $withval is not a directory.])
fi
fi
])
Expand All @@ -1596,7 +1605,6 @@ dnl EGG_TLS_DETECT
dnl
AC_DEFUN([EGG_TLS_DETECT],
[
tls_enabled="no"
if test "$enable_tls" != "no"; then
if test -z "$SSL_INCLUDES"; then
AC_CHECK_HEADERS([openssl/ssl.h openssl/x509v3.h], , [havesslinc="no"], [
Expand Down Expand Up @@ -1632,15 +1640,13 @@ AC_DEFUN([EGG_TLS_DETECT],
break
]])
)
if test "$enable_tls" = "yes"; then
if test "$havesslinc" = "no"; then
AC_MSG_WARN([Cannot find OpenSSL headers.])
AC_MSG_WARN([Please specify the path to the openssl include dir using --with-sslinc=path])
fi
if test "$havessllib" = "no"; then
AC_MSG_WARN([Cannot find OpenSSL libraries.])
AC_MSG_WARN([Please specify the path to libssl and libcrypto using --with-ssllib=path])
fi
if test "$havesslinc" = "no"; then
AC_MSG_ERROR([Cannot find OpenSSL headers.])
AC_MSG_ERROR([Please specify the path to the openssl include dir using --with-sslinc=path])
fi
if test "$havessllib" = "no"; then
AC_MSG_ERROR([Cannot find OpenSSL libraries.])
AC_MSG_ERROR([Please specify the path to libssl and libcrypto using --with-ssllib=path])
fi
AC_MSG_CHECKING([for OpenSSL])
if test "$havesslinc" = "no" || test "$havessllib" = "no"; then
Expand All @@ -1660,7 +1666,6 @@ AC_DEFUN([EGG_TLS_DETECT],
)
dnl EVP_PKEY_get1_EC_KEY: OpenSSL without EC (SunOS 5.11 Solaris 11.3 I love you Oracle)
AC_CHECK_FUNCS([EVP_PKEY_get1_EC_KEY])
tls_enabled="yes"
EGG_MD5_COMPAT
fi
fi
Expand Down

0 comments on commit f6046e6

Please sign in to comment.