@@ -25,8 +25,16 @@ AC_LANG_PUSH(C)
2525AC_PROG_CC_C99
2626AC_LANG_POP ( C )
2727
28- # Check we have -std=c++11 support
29- AX_CXX_COMPILE_STDCXX_11 ( noext ,mandatory )
28+ # Allow us to just build the tools without the unit tests
29+ AC_ARG_ENABLE (
30+ [ unit-tests] ,
31+ [ AS_HELP_STRING ( [ --disable-unit-tests] ,
32+ [ Just build the tools without the unit tests] ) ] )
33+ AM_CONDITIONAL(BUILD_UNIT_TESTS, test "x$enable_unit_tests" != xno)
34+
35+ # Check we have -std=c++11 support if required
36+ AM_COND_IF([ BUILD_UNIT_TESTS] ,
37+ [ AX_CXX_COMPILE_STDCXX_11 ( noext ,mandatory ) ] )
3038
3139# Checks for header files.
3240AC_CHECK_HEADERS ( [ arpa/inet.h stdint.h stdlib.h string.h] )
@@ -84,7 +92,10 @@ GTEST_LIBS="$with_gmock/googletest/lib/libgtest.la $with_gmock/googletest/lib/li
8492old_cppflags=$CPPFLAGS
8593CPPFLAGS="$GMOCK_INCLUDES $GTEST_INCLUDES"
8694
87- AC_CHECK_HEADER ( [ gmock/gmock.h] , [ ] , [ AC_MSG_ERROR ( [ Missing gmock/gmock.h] ) ] )
95+ AM_COND_IF([ BUILD_UNIT_TESTS] ,
96+ [ AC_CHECK_HEADER ( [ gmock/gmock.h] ,
97+ [ ] ,
98+ [ AC_MSG_ERROR ( [ Missing gmock/gmock.h] ) ] ) ] )
8899
89100# restore CPPFLAGS
90101CPPFLAGS=$old_cppflags
@@ -104,12 +115,11 @@ AC_ARG_WITH(
104115 [ ola] ,
105116 [ AS_HELP_STRING ( [ --without-ola] ,
106117 [ Skip OLA checks, unittests will not work correctly] ) ] )
107- AS_IF ( [ test "x$with_ola" != xno] ,
108- [ PKG_CHECK_MODULES(
109- OLA,
110- [ libola] ,
111- [ ] ,
112- [ AC_MSG_ERROR ( [ Missing OLA, please install] ) ] )] )
118+ AS_IF ( [ test "x$enable_unit_tests" != xno && test "x$with_ola" != xno] ,
119+ [ PKG_CHECK_MODULES(OLA,
120+ [ libola] ,
121+ [ ] ,
122+ [ AC_MSG_ERROR ( [ Missing OLA, please install] ) ] )] )
113123
114124# Output
115125# ####################################################
@@ -125,6 +135,8 @@ C++ Compiler: '${CXX} ${CXXFLAGS} ${CPPFLAGS}'
125135C Compiler: '${CC} ${CFLAGS} ${CPPFLAGS}'
126136Linker: '${LD} ${LDFLAGS} ${LIBS}'
127137
138+ Unit Tests: ${enable_unit_tests}
139+
128140Now type 'make @<:@<target>@:>@'
129141 where the optional <target> is:
130142 check - run the tests
0 commit comments