summaryrefslogtreecommitdiffstats
path: root/configure.ac
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 /configure.ac
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>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 29 insertions, 3 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)