diff mbox series

[v4,9/9] configure, travis: switch to pkg-config to locate CUnit

Message ID 1504112406-3108-10-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v4,1/9] configure: enable all tests by default | expand

Commit Message

Github ODP bot Aug. 30, 2017, 5 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

---
/** Email created from pull request 155 (lumag:improve-build-2)
 ** https://github.com/Linaro/odp/pull/155
 ** Patch: https://github.com/Linaro/odp/pull/155.patch
 ** Base sha: 7508c5ac906bb7cb1d339b4c5e924f3a18e504ca
 ** Merge commit sha: 82cd6ec8e88e93808778f00e24852395a62ae20b
 **/
 .travis.yml                                  | 17 ++++--------
 test/Makefile.inc                            |  2 +-
 test/common_plat/m4/validation.m4            | 40 +++-------------------------
 test/common_plat/validation/api/Makefile.inc |  2 +-
 test/linux-generic/Makefile.inc              |  2 +-
 5 files changed, 12 insertions(+), 51 deletions(-)
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index 45ffa396..a14974c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -108,6 +108,7 @@  before_install:
             sudo make install
             popd
           fi
+        - export PKG_CONFIG_PATH="$HOME/cunit-install/$CROSS_ARCH/lib/pkgconfig:${PKG_CONFIG_PATH}"
         - find $HOME/cunit-install
 
 install:
@@ -154,7 +155,7 @@  script:
           --enable-user-guides
           --with-dpdk-path=`pwd`/dpdk/${TARGET}
           --with-netmap-path=`pwd`/netmap
-          --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH $CONF
+          $CONF
           --enable-debug=full
           --enable-helper-linux
         - make -j $(nproc)
@@ -165,10 +166,10 @@  script:
         - echo "Checking linking and run from install..."
         - pushd $HOME
         - echo "Dynamic link.."
-        - ${CC} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig pkg-config --cflags --libs libodp-linux`
+        - ${CC} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig:${PKG_CONFIG_PATH} pkg-config --cflags --libs libodp-linux`
         - LD_LIBRARY_PATH="${HOME}/odp-install/lib:$LD_LIBRARY_PATH" ./odp_hello_inst
         - echo "Static link.."
-        - ${CC} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig pkg-config --cflags --libs libodp-linux --static` -static
+        - ${CC} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst `PKG_CONFIG_PATH=${HOME}/odp-install/lib/pkgconfig:${PKG_CONFIG_PATH} pkg-config --cflags --libs libodp-linux --static` -static
         - ./odp_hello_inst
         - ccache -s
 
@@ -184,7 +185,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   compiler: "\"clang-3.8 --target=aarch64-linux-gnu\""
@@ -196,7 +196,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   compiler: arm-linux-gnueabihf-gcc
@@ -208,7 +207,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   compiler: "\"clang-3.8 --target=arm-linux-gnueabihf\""
@@ -220,7 +218,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   compiler: powerpc-linux-gnu-gcc
@@ -232,7 +229,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   compiler: "\"clang-3.8 --target=powerpc-linux-gnu\""
@@ -244,7 +240,6 @@  jobs:
                             --enable-debug=full
                             --disable-test-cpp
                             --enable-helper-linux
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                           - make -j $(nproc)
                 - stage: test
                   env: TEST=coverage
@@ -256,7 +251,6 @@  jobs:
                             --with-dpdk-path=`pwd`/dpdk/${TARGET}
                             --with-netmap-path=`pwd`/netmap CFLAGS="-O0
                               -coverage"
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
                               CXXFLAGS="-O0 -coverage" LDFLAGS="--coverage"
                             --enable-debug=full
                             --enable-helper-linux
@@ -269,8 +263,7 @@  jobs:
                           - ./bootstrap
                           - ./configure --prefix=$HOME/odp-install
                             --enable-user-guides
-                            --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH
-                          - sudo PATH="$PATH" LD_LIBRARY_PATH="$HOME/cunit-install/$CROSS_ARCH/lib:$LD_LIBRARY_PATH" make distcheck DISTCHECK_CONFIGURE_FLAGS="--with-cunit-path=$HOME/cunit-install/$CROSS_ARCH"
+                          - sudo PATH="$PATH" LD_LIBRARY_PATH="$HOME/cunit-install/$CROSS_ARCH/lib:$LD_LIBRARY_PATH" make distcheck
                 - stage: test
                   env: TEST=doxygen
                   compiler: gcc
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 0fbc3c42..728868df 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -16,7 +16,7 @@  INCFLAGS = \
 	-I$(top_builddir)/include
 
 AM_CFLAGS += $(INCFLAGS)
-AM_CPPFLAGS += $(CUNIT_CPPFLAGS)
+AM_CFLAGS += $(CUNIT_CFLAGS)
 AM_CXXFLAGS = $(INCFLAGS)
 
 AM_LDFLAGS += -L$(LIB)
diff --git a/test/common_plat/m4/validation.m4 b/test/common_plat/m4/validation.m4
index b2a2f75d..e303f8f2 100644
--- a/test/common_plat/m4/validation.m4
+++ b/test/common_plat/m4/validation.m4
@@ -8,43 +8,11 @@  AC_ARG_ENABLE([test_vald],
 AM_CONDITIONAL([test_vald], [test x$test_vald = xyes ])
 
 ##########################################################################
-# Set optional CUnit path
-##########################################################################
-cunit_support=$test_vald
-AC_ARG_WITH([cunit-path],
-AC_HELP_STRING([--with-cunit-path=DIR],
-	       [path to CUnit libs and headers (if not present at default path)]),
-    [CUNIT_PATH=$withval
-     CUNIT_CPPFLAGS="-I$CUNIT_PATH/include"
-     CUNIT_LIBS="-L$CUNIT_PATH/lib"
-     cunit_support=yes],[])
-
-##########################################################################
-# Save and set temporary compilation flags
-##########################################################################
-OLD_LIBS=$LIBS
-OLD_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], [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"])])
-else
-    cunit_support=no
-fi
+cunit_support=$test_vald
+AS_IF([test "x$cunit_support" = "xyes"],
+      [PKG_CHECK_MODULES([CUNIT], [cunit])])
 
-AC_SUBST([CUNIT_CPPFLAGS])
+AC_SUBST([CUNIT_CFLAGS])
 AC_SUBST([CUNIT_LIBS])
-
-##########################################################################
-# Restore old saved variables
-##########################################################################
-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 767526ed..a9448b17 100644
--- a/test/common_plat/validation/api/Makefile.inc
+++ b/test/common_plat/validation/api/Makefile.inc
@@ -6,7 +6,7 @@  AM_CFLAGS += -I$(top_srcdir)/test/common_plat/common
 AM_LDFLAGS += -static
 AM_LDFLAGS += $(DPDK_PMDS)
 
-AM_CPPFLAGS += $(CUNIT_CPPFLAGS)
+AM_CFLAGS += $(CUNIT_PFLAGS)
 
 LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
 LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc
index 30b56e26..ff99fbc9 100644
--- a/test/linux-generic/Makefile.inc
+++ b/test/linux-generic/Makefile.inc
@@ -4,7 +4,7 @@ 
 
 AM_LDFLAGS += -static
 
-AM_CPPFLAGS += $(CUNIT_CPPFLAGS)
+AM_CFLAGS += $(CUNIT_CFLAGS)
 
 LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la
 LIB   = $(top_builddir)/lib