LP 1669868: Fix make check for all distros.
authorJason Stephenson <jason@sigio.com>
Tue, 21 Mar 2017 19:34:21 +0000 (15:34 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 22 Mar 2017 15:41:11 +0000 (11:41 -0400)
Chris Sharp found that make check was failing on Ubuntu 14.04 and 16.04.

I borrowed a few lines from the OpenSRF configure.ac and modified the
Open-ILS/src/c-apps/tests/Makefile.am to use a more autoconf-oriented
approach that won't lead to unnecessary checks in the install scripts.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/c-apps/tests/Makefile.am
configure.ac

index 67b258d..a782624 100644 (file)
@@ -10,12 +10,12 @@ TESTS = check_util check_idl
 check_PROGRAMS = check_util check_idl
 
 check_util_SOURCES = $(COMMON) check_util.c
-check_util_CFLAGS = $(AM_CFLAGS)
-check_util_LDFLAGS = $(AM_LDFLAGS) -loils_idl -loils_utils -lcheck
+check_util_CFLAGS = $(AM_CFLAGS) $(CHECK_CFLAGS)
+check_util_LDFLAGS = $(AM_LDFLAGS) $(CHECK_LIBS) -loils_idl -loils_utils 
 check_util_DEPENDENCIES = ../liboils_idl.la ../liboils_utils.la
 
 check_idl_SOURCES = $(COMMON) check_idl.c
-check_idl_CFLAGS = $(AM_CFLAGS)
-check_idl_LDFLAGS = $(AM_LDFLAGS) -loils_idl -loils_utils -lcheck
+check_idl_CFLAGS = $(AM_CFLAGS) $(CHECK_CFLAGS)
+check_idl_LDFLAGS = $(AM_LDFLAGS) $(CHECK_LIBS) -loils_idl -loils_utils 
 check_idl_DEPENDENCIES = ../liboils_idl.la ../liboils_utils.la
 
index d49a437..a7685ad 100644 (file)
@@ -344,6 +344,16 @@ if test "x$openils_core" = "xtrue"; then
     AC_FUNC_STRTOD
     AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
 
+    #---------------------------------
+    # Check for unit test framework.
+    #---------------------------------
+    PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], [enable_tests=yes],
+                      [enable_tests=no])
+    AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
+    if test "x$enable_tests" = "xno"; then
+        AC_MSG_WARN(Check unit testing framework not found.)
+    fi
+
     #----------------------------
     # Create Makefiles/Output
     #----------------------------