5c952178b7
libpagekite is a C implementation of the backend of the PageKite relay protocol. It allows external access to embedded devices without public IP address. There is a bundled version of libev but we prefer to use the global libev library. Although the configure script has a --without-openssl option, it doesn't actually build without openssl. Patch 0001-configure.ac-fix-handling-of-with.patch is needed because we want to explicitly pass --with and --without options, even if they are the default. The way the AC_ARG_WITH macros were used, --with and --without both had the effect of enabling the option. Patch 0002-configure.ac-use-AS_HELP_STRING-for-with-openssl.patch is not needed for Buildroot, but it is part of the same upstream PR and would generate a conflict for the next patch. Patch 0003-configure.ac-use-pkg-config-for-openssl.patch is needed to pass -lz (needed by openssl) in static compilation. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reviewed-by: Romain Naour <romain.naour@smile.fr> [Thomas: - As noticed by Romain Naour, fix the prompt of the package in the Config.in - Add entry to DEVELOPERS file - Drop the dependency on BR2_bfin, since this architecture has been dropped from Buildroot.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
138 lines
4.9 KiB
Diff
138 lines
4.9 KiB
Diff
From 6a8b5ee14acee6c258bbaeb8b148ee0dd0d62d3d Mon Sep 17 00:00:00 2001
|
|
From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
|
|
Date: Fri, 16 Feb 2018 15:36:59 +0100
|
|
Subject: [PATCH] configure.ac: use pkg-config for openssl
|
|
|
|
It is better to use pkg-config to detect openssl if that is possible.
|
|
pkg-config will add e.g. -lz and -ldl when needed. If pkg-config
|
|
fails, fall back to the old approach of detecting headers and libs.
|
|
Some of the additional openssl support (e.g. adding -ldl) is moved
|
|
inside the non-pkg-config path.
|
|
|
|
Since AC_CHECK_LIBS adds the library found to LIBS, do the same in
|
|
the pkg-config case. Normally the Makefile.am should instead use
|
|
OPENSSL_LIBS where needed, but this is not done consistently.
|
|
|
|
When --with-openssl=DIR is given, still perform the test (both with
|
|
pkg-config and by checking headers and libs). I.e., remove
|
|
$specialssldir.
|
|
|
|
While we're at it, simplify the headers checks by merging them into a
|
|
single AC_CHECK_HEADERS.
|
|
|
|
Note that it is (still) not an error when openssl is not found,
|
|
although the build will then fail.
|
|
|
|
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
|
---
|
|
configure.ac | 67 ++++++++++++++++++++++--------------------------------------
|
|
1 file changed, 24 insertions(+), 43 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 4874c0b..ccab9f4 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -16,7 +16,6 @@ AC_CANONICAL_HOST
|
|
use_openssl="yes"
|
|
use_libev="yes"
|
|
|
|
-specialssldir=""
|
|
AC_ARG_WITH(openssl,
|
|
[AS_HELP_STRING([--with-openssl=DIR],
|
|
[Use optional openssl libs and includes from [DIR]/lib/ and [DIR]/include/openssl/])],
|
|
@@ -27,7 +26,6 @@ AC_ARG_WITH(openssl,
|
|
use_openssl="no"
|
|
;;
|
|
*)
|
|
- specialssldir="$with_openssl"
|
|
LDFLAGS="$LDFLAGS -L$with_openssl/lib"
|
|
CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
|
|
;;
|
|
@@ -139,59 +137,42 @@ AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
|
AC_FUNC_REALLOC
|
|
AC_CHECK_FUNCS([clock_gettime dup2 gethostbyname gettimeofday inet_ntoa malloc memmove memset select socket strcasecmp strchr strdup strerror strncasecmp strrchr uname sched_yield pthread_yield pthread_yield_np])
|
|
|
|
-# OpenSSL requires dlopen on some platforms
|
|
-AC_SEARCH_LIBS(dlopen, dl)
|
|
-
|
|
# If they didn't specify it, we try to find it
|
|
-if test "$use_openssl" = "yes" -a -z "$specialssldir" ; then
|
|
- AC_CHECK_HEADER(openssl/ssl.h,,
|
|
+if test "$use_openssl" = "yes" ; then
|
|
+ # First try pkg-config; fall back to headers/libs check
|
|
+ PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.0],
|
|
+ [LIBS="$OPENSSL_LIBS $LIBS"],
|
|
+ [AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h openssl/rand.h],,
|
|
[ use_openssl="no"
|
|
- AC_MSG_WARN([Failed to find openssl/ssl.h so OpenSSL will not be used.
|
|
- If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
-
|
|
- if test "$use_openssl" = "yes"; then
|
|
- AC_CHECK_HEADER(openssl/err.h,,
|
|
- [ use_openssl="no"
|
|
- AC_MSG_WARN([Failed to find openssl/err.h so OpenSSL will not be used.
|
|
- If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
- fi
|
|
-
|
|
- if test "$use_openssl" = "yes"; then
|
|
- AC_CHECK_HEADER(openssl/rand.h,,
|
|
- [ use_openssl="no"
|
|
- AC_MSG_WARN([Failed to find openssl/rand.h so OpenSSL will not be used.
|
|
- If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
- fi
|
|
-
|
|
- if test "$use_openssl" = "yes"; then
|
|
- AC_CHECK_LIB(crypto, BIO_int_ctrl,
|
|
- [],
|
|
- [ use_openssl="no"
|
|
- AC_MSG_WARN([Failed to find libcrypto so OpenSSL will not be used.
|
|
- If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
- fi
|
|
-
|
|
- if test "$use_openssl" = "yes"; then
|
|
- AC_CHECK_LIB(ssl, SSL_new,
|
|
- [],
|
|
- [ use_openssl="no"
|
|
- AC_MSG_WARN([Failed to find libssl so OpenSSL will not be used.
|
|
+ AC_MSG_WARN([Failed to find openssl headers so OpenSSL will not be used.
|
|
If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
- fi
|
|
+ if test "$use_openssl" = "yes"; then
|
|
+ AC_CHECK_LIB(crypto, BIO_int_ctrl, [],
|
|
+ [ use_openssl="no"
|
|
+ AC_MSG_WARN([Failed to find libcrypto so OpenSSL will not be used.
|
|
+If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
+ fi
|
|
+ if test "$use_openssl" = "yes"; then
|
|
+ AC_CHECK_LIB(ssl, SSL_new, [],
|
|
+ [ use_openssl="no"
|
|
+ AC_MSG_WARN([Failed to find libssl so OpenSSL will not be used.
|
|
+If it is installed you can try the --with-openssl=DIR argument]) ])
|
|
+ fi
|
|
+ if test "$use_openssl" = "yes"; then
|
|
+ # OpenSSL requires dlopen on some platforms
|
|
+ AC_SEARCH_LIBS(dlopen, dl)
|
|
+ OPENSSL_LIBS="-lssl -lcrypto"
|
|
+ fi])
|
|
fi
|
|
|
|
-OPENSSL_CFLAGS=""
|
|
-OPENSSL_LIBS=""
|
|
if test "$use_openssl" = "yes"; then
|
|
AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have OpenSSL.])
|
|
- OPENSSL_LIBS="-lssl -lcrypto"
|
|
# Define in Makefile also.
|
|
HAVE_OPENSSL=yes
|
|
- AC_SUBST(HAVE_OPENSSL)
|
|
fi
|
|
AC_SUBST([OPENSSL_CFLAGS])
|
|
AC_SUBST([OPENSSL_LIBS])
|
|
-
|
|
+AC_SUBST([HAVE_OPENSSL])
|
|
|
|
|
|
LIBEV_CFLAGS=""
|
|
--
|
|
2.15.1
|
|
|