diff mbox

[PATCHv2,3/4] configure: always check for cunit (lib and headers)

Message ID 1417300979-6248-4-git-send-email-anders.roxell@linaro.org
State Accepted
Commit e804b120af8167b2138d689693aa7c778dad9aab
Headers show

Commit Message

Anders Roxell Nov. 29, 2014, 10:42 p.m. UTC
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 configure.ac                | 29 ++++++++++++++++++++---------
 test/validation/Makefile.am |  3 +--
 2 files changed, 21 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index acd0060..9df4754 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,18 +70,16 @@  AC_ARG_ENABLE([cunit],
         cunit_support=yes
     fi])
 
+##########################################################################
+# Set optional CUnit path
+##########################################################################
 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 cunit_support=yes],
-[
-    AS_IF([test x$cunit_support = xyes ], [
-        AC_CHECK_HEADERS([CUnit/Basic.h], [],
-        [AC_MSG_FAILURE(["can't find cunit headers"])])
-    ])
-])
-AC_SUBST(CUNIT_PATH)
-AM_CONDITIONAL([ODP_CUNIT_ENABLED], [test x$cunit_support = xyes ])
+    [CUNIT_PATH=$withval
+    AM_CFLAGS="$AM_CFLAGS -I$CUNIT_PATH/include"
+    AM_LDFLAGS="$AM_LDFLAGS -L$CUNIT_PATH/lib"
+    cunit_support=yes],[])
 
 ##########################################################################
 # Enable/disable ODP_DEBUG_PRINT
@@ -145,6 +143,19 @@  LDFLAGS="$AM_LDFLAGS $LDFLAGS"
 CFLAGS="$AM_CFLAGS $CFLAGS"
 
 ##########################################################################
+# Check for CUnit availability
+##########################################################################
+if test x$cunit_support = xyes
+then
+    AC_CHECK_LIB([cunit],[CU_get_error], [],
+        [AC_MSG_ERROR([CUnit libraries required])])
+    AC_CHECK_HEADERS([CUnit/Basic.h], [],
+        [AC_MSG_FAILURE(["can't find cunit headers"])])
+fi
+
+AM_CONDITIONAL([ODP_CUNIT_ENABLED], [test x$cunit_support = xyes ])
+
+##########################################################################
 # Check for OpenSSL availability
 ##########################################################################
 AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 0b831d0..874fd05 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -1,7 +1,6 @@ 
 include $(top_srcdir)/test/Makefile.inc
 
-AM_CFLAGS += -I$(CUNIT_PATH)/include
-AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
+AM_LDFLAGS += -static
 
 if ODP_CUNIT_ENABLED
 TESTS = ${bin_PROGRAMS}