diff mbox series

[v2,2/9] linux-gen: stop poisoning CPPFLAGS/LDFLAGS with OpenSSL flags

Message ID 1497391207-13288-3-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v2,1/9] pkgconfig: provide minimal proper static linking flags | expand

Commit Message

Github ODP bot June 13, 2017, 10 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Instead of poisoning global AM_CPPFLAGS/AM_LDFLAGS with OpenSSL flags,
use fine-grained controls for compiling/linking with OpenSSL.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 45 (lumag:m4)
 ** https://github.com/Linaro/odp/pull/45
 ** Patch: https://github.com/Linaro/odp/pull/45.patch
 ** Base sha: 7cf390d11e69f6b677e6fbfd6414944737406fc3
 ** Merge commit sha: 3808f2b5af9d034f6157eb2c7eec543ee8055fbf
 **/
 pkgconfig/libodp-linux.pc.in             |  2 +-
 platform/linux-generic/Makefile.am       |  3 +++
 platform/linux-generic/m4/odp_openssl.m4 | 17 +++++++++++------
 3 files changed, 15 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/pkgconfig/libodp-linux.pc.in b/pkgconfig/libodp-linux.pc.in
index 1a8d489f..0c5883b6 100644
--- a/pkgconfig/libodp-linux.pc.in
+++ b/pkgconfig/libodp-linux.pc.in
@@ -7,5 +7,5 @@  Name: libodp-linux
 Description: The ODP packet processing engine
 Version: @PKGCONFIG_VERSION@
 Libs: -L${libdir} -lodp-linux
-Libs.private: -lcrypto -ldl -lpcap @PTHREAD_LIBS@ -lrt -lpthread @ATOMIC_LIBS@
+Libs.private: @OPENSSL_STATIC_LIBS@ -lpcap @PTHREAD_LIBS@ -lrt -lpthread @ATOMIC_LIBS@
 Cflags: -I${includedir}
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 00ce80d7..c0e38243 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -11,6 +11,8 @@  AM_CFLAGS +=  -I$(top_builddir)/include
 AM_CFLAGS +=  -Iinclude
 AM_CFLAGS +=  -D_ODP_PKTIO_IPC
 
+AM_CPPFLAGS +=  $(OPENSSL_CPPFLAGS)
+
 include_HEADERS = \
 		  $(top_srcdir)/include/odp.h \
 		  $(top_srcdir)/include/odp_api.h
@@ -220,6 +222,7 @@  __LIB__libodp_linux_la_SOURCES = \
 			   arch/@ARCH_DIR@/odp_sysinfo_parse.c
 
 __LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS)
+__LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS)
 
 if HAVE_PCAP
 __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/m4/odp_openssl.m4 b/platform/linux-generic/m4/odp_openssl.m4
index 2344914b..1d520077 100644
--- a/platform/linux-generic/m4/odp_openssl.m4
+++ b/platform/linux-generic/m4/odp_openssl.m4
@@ -5,8 +5,8 @@  AC_ARG_WITH([openssl-path],
 AC_HELP_STRING([--with-openssl-path=DIR path to openssl libs and headers],
                [(or in the default path if not specified).]),
     [OPENSSL_PATH=$withval
-    AM_CPPFLAGS="$AM_CPPFLAGS -I$OPENSSL_PATH/include"
-    AM_LDFLAGS="$AM_LDFLAGS -L$OPENSSL_PATH/lib"
+    OPENSSL_CPPFLAGS="-I$OPENSSL_PATH/include"
+    OPENSSL_LIBS="-L$OPENSSL_PATH/lib"
     ],[])
 
 ##########################################################################
@@ -14,19 +14,24 @@  AC_HELP_STRING([--with-openssl-path=DIR path to openssl libs and headers],
 ##########################################################################
 OLD_LDFLAGS=$LDFLAGS
 OLD_CPPFLAGS=$CPPFLAGS
-LDFLAGS="$AM_LDFLAGS $LDFLAGS"
-CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
+LIBS="$OPENSSL_LIBS $LIBS"
+CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
 
 ##########################################################################
 # Check for OpenSSL availability
 ##########################################################################
-AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
+AC_CHECK_LIB([crypto], [EVP_EncryptInit], [OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto"
+					   OPENSSL_STATIC_LIBS="$OPENSSL_LIBS -ldl"],
              [AC_MSG_FAILURE([OpenSSL libraries required])])
 AC_CHECK_HEADERS([openssl/des.h openssl/rand.h openssl/hmac.h openssl/evp.h], [],
              [AC_MSG_ERROR([OpenSSL headers required])])
 
+AC_SUBST([OPENSSL_CPPFLAGS])
+AC_SUBST([OPENSSL_LIBS])
+AC_SUBST([OPENSSL_STATIC_LIBS])
+
 ##########################################################################
 # Restore old saved variables
 ##########################################################################
-LDFLAGS=$OLD_LDFLAGS
+LIBS=$OLD_LIBS
 CPPFLAGS=$OLD_CPPFLAGS