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>
This commit is contained in:
parent
35c6ca05d8
commit
5986d22e62
32
configure.ac
32
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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user