summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-07-27 08:45:50 +0200
committerHarshavardhana <harsha@harshavardhana.net>2014-07-27 11:57:24 -0700
commit5986d22e621e0c682f319bb6a0a8e622a8c0970d (patch)
treea46bcdeeaf475f5121ab18abd5ffe1f98b0eb6a6
parent35c6ca05d8ee0e1be1b67ac64d32c21b195aaeea (diff)
Attempt to fix cmockery2 build
The current code assumes cmockery2 is installed in default paths. Use PKG_MODULES_CHECK to find it using pkg-config if it is not. If not found by pkg-config, try AC_CHECK_LIB. There are also some build flag adjustement so that local overrides do not loose the required -I flags. This includes and enhance http://review.gluster.org/8340/ BUG: 764655 Change-Id: Ide9f77d1e70afe3c1c5c57ae2b93127af6a425f9 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/8365 Reviewed-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--configure.ac32
-rw-r--r--libglusterfs/src/Makefile.am2
-rw-r--r--xlators/cluster/dht/src/Makefile.am2
3 files changed, 31 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 5cab04a7f22..ca657347ea4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,7 +315,20 @@ AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required
AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
-AC_CHECK_LIB([cmockery], [mock_assert], , AC_MSG_ERROR([cmockery2 library is required to build glusterfs]))
+
+PKG_CHECK_MODULES([UNITTEST], [cmockery2], [
+ UNITTEST_CPPFLAGS=`${PKG_CONFIG} --print-errors --cflags-only-I "cmockery2"`
+ UNITTEST_CFLAGS=`${PKG_CONFIG} --print-errors --cflags-only-other "cmockery2"`
+ UNITTEST_LDFLAGS=`${PKG_CONFIG} --print-errors --libs-only-L "cmockery2"`
+ UNITTEST_LIBS=`${PKG_CONFIG} --print-errors --libs-only-l "cmockery2"`
+],[
+ AC_CHECK_LIB([cmockery], [mock_assert], [
+ UNITTEST_LDFLAGS="-lcmockery -lgcov"
+ UNITTEST_CFLAGS="-Wall -Werror -DUNIT_TESTING=1"
+ ], [
+ AC_MSG_ERROR([cmockery2 library is required to build glusterfs])
+ ])
+])
AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
@@ -688,8 +701,18 @@ dnl check for Monotonic clock
AC_CHECK_FUNC([clock_gettime], [has_monotonic_clock=yes], AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_WARN([System doesn't have monotonic clock using contrib])))
dnl Add cmockery2 for unit tests
-UNITTEST_CFLAGS='-g -Wall -DUNIT_TESTING=1 -DDEBUG -Werror -O0 --coverage'
-UNITTEST_LDFLAGS='-lcmockery -lgcov'
+case $host_os in
+ freebsd*)
+ dnl remove --coverage on FreeBSD due to a known llvm packaging bug
+ UNITTEST_CFLAGS="${UNITTEST_CPPFLAGS} ${UNITTEST_CFLAGS} -g -DDEBUG -O0"
+ UNITTEST_LDFLAGS="${UNITTEST_LIBS} ${UNITTEST_LDFLAGS}"
+ ;;
+ *)
+ UNITTEST_CFLAGS="${UNITTEST_CPPFLAGS} ${UNITTEST_CFLAGS} -g -DDEBUG -O0 --coverage"
+ UNITTEST_LDFLAGS="${UNITTEST_LIBS} ${UNITTEST_LDFLAGS}"
+ ;;
+esac
+
AC_SUBST(UNITTEST_CFLAGS)
AC_SUBST(UNITTEST_LDFLAGS)
@@ -1025,6 +1048,9 @@ fi
AC_SUBST(CFLAGS)
# end enable debug section
+dnl Required if cmockery2 headers are not in standar paths
+GF_CFLAGS="${GF_CFLAGS} ${UNITTEST_CPPFLAGS}"
+
AC_SUBST(GF_HOST_OS)
AC_SUBST([GF_GLUSTERFS_LIBS])
AC_SUBST(GF_CFLAGS)
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index de1b9b0b1f2..0ca945a9575 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -4,7 +4,7 @@ libglusterfs_la_CFLAGS = -Wall $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) \
libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \
-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
-I$(top_srcdir)/rpc/rpc-lib/src/ -I$(CONTRIBDIR)/rbtree \
- -I$(CONTRIBDIR)/libexecinfo
+ -I$(CONTRIBDIR)/libexecinfo ${ARGP_STANDALONE_CPPFLAGS}
libglusterfs_la_LIBADD = @LEXLIB@
libglusterfs_la_LDFLAGS = -version-info $(LIBGLUSTERFS_LT_VERSION)
diff --git a/xlators/cluster/dht/src/Makefile.am b/xlators/cluster/dht/src/Makefile.am
index 9b5d6897984..46a2bcd06b8 100644
--- a/xlators/cluster/dht/src/Makefile.am
+++ b/xlators/cluster/dht/src/Makefile.am
@@ -45,7 +45,7 @@ dht_layout_unittest_CPPFLAGS = $(AM_CPPFLAGS)
dht_layout_unittest_SOURCES = unittest/dht_layout_unittest.c \
unittest/dht_layout_mock.c \
dht-layout.c
-dht_layout_unittest_CFLAGS = $(UNITTEST_CFLAGS)
+dht_layout_unittest_CFLAGS = $(AM_CFLAGS) $(UNITTEST_CFLAGS)
dht_layout_unittest_LDFLAGS = $(UNITTEST_LDFLAGS)
noinst_PROGRAMS += dht_layout_unittest
TESTS += dht_layout_unittest