| diff --git a/configure.ac b/configure.ac |
| index f4073d0..9afcc90 100644 |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -1211,6 +1211,21 @@ if test "${enable_async_push}" = "yes"; then |
| ) |
| fi |
| |
| +AC_ARG_ENABLE( |
| + [tests], |
| + AS_HELP_STRING([--enable-tests], [enable unit tests @<:@default=no@:>@]) |
| +) |
| + |
| +if test "${enable_tests}" = "yes"; then |
| + PKG_CHECK_MODULES([CMOCKA], [cmocka]) |
| + TEST_CFLAGS="${CMOCKA_CFLAGS}" |
| + TEST_LDFLAGS="${CMOCKA_LIBS}" |
| + AC_SUBST([TEST_CFLAGS]) |
| + AC_SUBST([TEST_LDFLAGS]) |
| +fi |
| +AM_CONDITIONAL([ENABLE_TESTS], [test "${enable_tests}" = "yes"]) |
| +AM_CONDITIONAL([CMOCKA_INITIALIZED], [false]) |
| + |
| CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" |
| AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings]) |
| |
| @@ -1257,28 +1272,6 @@ AC_SUBST([VENDOR_SRC_ROOT]) |
| AC_SUBST([VENDOR_BUILD_ROOT]) |
| AC_SUBST([VENDOR_DIST_ROOT]) |
| |
| -TEST_LDFLAGS="-lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib" |
| -TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include" |
| - |
| -AC_SUBST([TEST_LDFLAGS]) |
| -AC_SUBST([TEST_CFLAGS]) |
| - |
| -# Check if cmake is available and cmocka git submodule is initialized, |
| -# needed for unit testing |
| -AC_CHECK_PROGS([CMAKE], [cmake]) |
| -if test -n "${CMAKE}"; then |
| - if test -f "${srcdir}/vendor/cmocka/CMakeLists.txt"; then |
| - AM_CONDITIONAL([CMOCKA_INITIALIZED], [true]) |
| - else |
| - AM_CONDITIONAL([CMOCKA_INITIALIZED], [false]) |
| - AC_MSG_RESULT([!! WARNING !! The cmoka git submodule has not been initialized or updated. Unit testing cannot be performed.]) |
| - fi |
| -else |
| - AC_MSG_RESULT([!! WARNING !! CMake is NOT available. Unit testing cannot be performed.]) |
| - AM_CONDITIONAL([CMOCKA_INITIALIZED], [false]) |
| -fi |
| - |
| - |
| AC_CONFIG_FILES([ |
| version.sh |
| Makefile |
| diff --git a/tests/unit_tests/Makefile.am b/tests/unit_tests/Makefile.am |
| index 31d37b8..4b7fb41 100644 |
| --- a/tests/unit_tests/Makefile.am |
| +++ b/tests/unit_tests/Makefile.am |
| @@ -3 +3 @@ AUTOMAKE_OPTIONS = foreign |
| -if CMOCKA_INITIALIZED |
| +if ENABLE_TESTS |