bfd273d83a
Building sngrep with OpenSSL support in static linking configurations currently fails due to undefined symbols in the OpenSSL library. It's the usual problem with using AC_CHECK_LIB() to discover libraries instead of the pkg-config based PKG_CHECK_MODULES(). Therefore, this commit introduces a patch that switches to using pkg-config to discover OpenSSL. A preliminary patch is needed, without which appending to LIBS/CFLAGS doesn't work. Both patches have been submitted upstream. Fixes: http://autobuild.buildroot.net/results/911143de823b2c749ac0a59dfa06adb6ddd3de50/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
76 lines
2.6 KiB
Diff
76 lines
2.6 KiB
Diff
From 22b08ab1a45eb3773b3c90dc37a31a7574520daa Mon Sep 17 00:00:00 2001
|
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
Date: Sat, 4 Mar 2017 14:56:53 +0100
|
|
Subject: [PATCH 2/2] configure.ac: switch to pkg-config to find openssl
|
|
|
|
Using AC_CHECK_LIB() doesn't work properly for static linking, because
|
|
it doesn't return information on transitive dependencies of
|
|
libraries. For example, if library A internally uses library B, then
|
|
with dynamic linking, doing -lA is sufficient. However, with static
|
|
linking, one must do -lA -lB, and AC_CHECK_LIB() will only give the -lA
|
|
information. This for example causes a build failure when building
|
|
sngrep statically with openssl enabled:
|
|
|
|
checking for SSL_new in -lssl... no
|
|
configure: error: You need to have libssl installed to compile sngrep
|
|
|
|
due to undefined symbols in the OpenSSL library.
|
|
|
|
The proper solution for this is to discover the library using
|
|
pkg-config, because pkg-config properly returns the list of necessary
|
|
libraries, as it understands the concept of "list of libraries needed
|
|
when dynamic linking" and "list of libraries needed for static linking".
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
Upstream-status: https://github.com/irontec/sngrep/pull/176
|
|
---
|
|
configure.ac | 9 +--------
|
|
src/Makefile.am | 4 ++++
|
|
2 files changed, 5 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 42e00e9..9f8e6d2 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -129,14 +129,7 @@ AS_IF([test "x$WITH_OPENSSL" == "xyes"], [
|
|
AS_IF([test "x$WITH_GNUTLS" == "xyes"], [
|
|
AC_MSG_ERROR([ GnuTLS and OpenSSL can not be enabled at the same time ])
|
|
], [])
|
|
-
|
|
- AC_CHECK_LIB([ssl], [SSL_new], [], [
|
|
- AC_MSG_ERROR([ You need to have libssl installed to compile sngrep])
|
|
- ])
|
|
-
|
|
- AC_CHECK_LIB([crypto], [EVP_get_cipherbyname], [], [
|
|
- AC_MSG_ERROR([ You need to have libcrypto installed to compile sngrep])
|
|
- ])
|
|
+ PKG_CHECK_MODULES([SSL], [libssl libcrypto])
|
|
AC_DEFINE([WITH_OPENSSL],[],[Compile With Openssl compatibility])
|
|
], [])
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
index 961f4a0..3a471b7 100644
|
|
--- a/src/Makefile.am
|
|
+++ b/src/Makefile.am
|
|
@@ -1,6 +1,8 @@
|
|
AUTOMAKE_OPTIONS=subdir-objects
|
|
bin_PROGRAMS=sngrep
|
|
sngrep_SOURCES=capture.c
|
|
+sngrep_CFLAGS=
|
|
+sngrep_LDADD=
|
|
if USE_EEP
|
|
sngrep_SOURCES+=capture_eep.c
|
|
endif
|
|
@@ -9,6 +11,8 @@ sngrep_SOURCES+=capture_gnutls.c
|
|
endif
|
|
if WITH_OPENSSL
|
|
sngrep_SOURCES+=capture_openssl.c
|
|
+sngrep_CFLAGS+=$(SSL_CFLAGS)
|
|
+sngrep_LDADD+=$(SSL_LIBS)
|
|
endif
|
|
sngrep_SOURCES+=address.c packet.c sip.c sip_call.c sip_msg.c sip_attr.c main.c
|
|
sngrep_SOURCES+=option.c group.c filter.c keybinding.c media.c setting.c rtp.c
|
|
--
|
|
2.7.4
|
|
|