diff mbox series

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

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

Commit Message

Github ODP bot June 30, 2017, 11 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: ceeab69f3af67701adb524c7b9757d19cefb1110
 ** Merge commit sha: bc5ee5a9b895a630b180cd264a55c8e4817de750
 **/
 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 989a65b6..eb7b0422 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
@@ -254,6 +256,7 @@  __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
 endif
 
 __LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS)
+__LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS)
 
 # Create symlink for ABI header files. Application does not need to use the arch
 # specific include path for installed files.
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