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

Message ID 1497391207-13288-6-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Rework the way ODP links with other libraries
Related show

Commit Message

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


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

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
 **/
 test/common_plat/common/Makefile.am          |  1 +
 test/common_plat/m4/validation.m4            | 19 +++++++++++--------
 test/common_plat/validation/api/Makefile.inc |  2 ++
 test/linux-generic/Makefile.inc              |  2 ++
 4 files changed, 16 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/common_plat/common/Makefile.am b/test/common_plat/common/Makefile.am
index fd41fb42..7d88d2ea 100644
--- a/test/common_plat/common/Makefile.am
+++ b/test/common_plat/common/Makefile.am
@@ -4,6 +4,7 @@  include $(top_srcdir)/test/Makefile.inc
 noinst_LTLIBRARIES = libcunit_common.la libcpumask_common.la libthrmask_common.la
 
 libcunit_common_la_SOURCES = odp_cunit_common.c
+libcunit_common_la_LIBADD = $(CUNIT_LIBS)
 
 libcpumask_common_la_SOURCES = mask_common.c
 
diff --git a/test/common_plat/m4/validation.m4 b/test/common_plat/m4/validation.m4
index d32f675a..67edac7a 100644
--- a/test/common_plat/m4/validation.m4
+++ b/test/common_plat/m4/validation.m4
@@ -26,24 +26,24 @@  AC_ARG_WITH([cunit-path],
 AC_HELP_STRING([--with-cunit-path=DIR   path to CUnit libs and headers],
                [(or in the default path if not specified).]),
     [CUNIT_PATH=$withval
-    AM_CPPFLAGS="$AM_CPPFLAGS -I$CUNIT_PATH/include"
-    AM_LDFLAGS="$AM_LDFLAGS -L$CUNIT_PATH/lib"
-    cunit_support=yes],[])
+     CUNIT_CPPFLAGS="-I$CUNIT_PATH/include"
+     CUNIT_LIBS="-L$CUNIT_PATH/lib"
+     cunit_support=yes],[])
 
 ##########################################################################
 # Save and set temporary compilation flags
 ##########################################################################
-OLD_LDFLAGS=$LDFLAGS
+OLD_LIBS=$LIBS
 OLD_CPPFLAGS=$CPPFLAGS
-LDFLAGS="$AM_LDFLAGS $LDFLAGS"
-CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
+LIBS="$CUNIT_LIBS $LIBS"
+CPPFLAGS="$CUNIT_CPPFLAGS $CPPFLAGS"
 
 ##########################################################################
 # Check for CUnit availability
 ##########################################################################
 if test x$cunit_support = xyes
 then
-    AC_CHECK_LIB([cunit],[CU_get_error], [],
+    AC_CHECK_LIB([cunit],[CU_get_error], [CUNIT_LIBS="$CUNIT_LIBS -lcunit"],
         [AC_MSG_ERROR([CUnit libraries required])])
     AC_CHECK_HEADERS([CUnit/Basic.h], [],
         [AC_MSG_FAILURE(["can't find cunit headers"])])
@@ -51,8 +51,11 @@  else
     cunit_support=no
 fi
 
+AC_SUBST([CUNIT_CPPFLAGS])
+AC_SUBST([CUNIT_LIBS])
+
 ##########################################################################
 # Restore old saved variables
 ##########################################################################
-LDFLAGS=$OLD_LDFLAGS
+LIBS=$OLD_LIBS
 CPPFLAGS=$OLD_CPPFLAGS
diff --git a/test/common_plat/validation/api/Makefile.inc b/test/common_plat/validation/api/Makefile.inc
index 6069ee6b..177d2ac3 100644
--- a/test/common_plat/validation/api/Makefile.inc
+++ b/test/common_plat/validation/api/Makefile.inc
@@ -11,6 +11,8 @@  AM_CFLAGS += -I$(top_srcdir)/test/common_plat/common
 AM_LDFLAGS += -static
 AM_LDFLAGS += $(DPDK_PMDS)
 
+AM_CPPFLAGS += $(CUNIT_CPPFLAGS)
+
 LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
 LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
 LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc
index 6e165d8d..30b56e26 100644
--- a/test/linux-generic/Makefile.inc
+++ b/test/linux-generic/Makefile.inc
@@ -4,6 +4,8 @@ 
 
 AM_LDFLAGS += -static
 
+AM_CPPFLAGS += $(CUNIT_CPPFLAGS)
+
 LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la
 LIB   = $(top_builddir)/lib
 LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la $(DPDK_PMDS)