@@ -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
@@ -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
@@ -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
@@ -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)