summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2017-07-26 08:24:02 -0700
committerGitHub <noreply@github.com>2017-07-26 08:24:02 -0700
commita354816a5d6b9026383e9982f3cf25996eddd3ba (patch)
tree442f6731b7040e186e939dd933c937d13916bf70 /configure.ac
parentfe9f28c7899da2782c2c779f959a48ae3b2c1544 (diff)
Use TEST_CPPFLAGS/TEST_CXXFLAGS to add path to CxxTest headers in configure.ac. (#200)
CxxTest headers were included in test/unit/Makefile.am as -I@CXXTEST@. However, in configure.ac if CXXTEST was not set by the user, it was initially set to `dirname "$CXXTESTGEN"` while determining the path to the header files. If CXXTESTGEN pointed to /usr/bin and if the headers were found in /usr/include, CXXTEST was not reset, which led to CXXTEST being replaced by /usr/bin in test/unit/Makefile.am. As a consequence, the locale binary in /usr/bin got included instead of the locale header file.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac114
1 files changed, 58 insertions, 56 deletions
diff --git a/configure.ac b/configure.ac
index 6efae69cb..b32bbc9b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -925,23 +925,10 @@ DX_INIT_DOXYGEN($PACKAGE_NAME, config/doxygen.cfg, $srcdir/doc/doxygen)
AC_ARG_ENABLE([unit-testing], AS_HELP_STRING([--disable-unit-testing], [don't build support for unit testing, even if available]), , [enable_unit_testing=check])
AC_ARG_VAR(CXXTEST, [path to CxxTest installation])
-
-AC_SUBST([CXXTEST])
-
AC_ARG_WITH([cxxtest-dir],
[AS_HELP_STRING([--with-cxxtest-dir=DIR], [path to CxxTest installation])],
[CXXTEST="$withval"])
-# In the case of "./configure --with-cxxtest-dir=../cxxtest" (or other
-# relative path) and having switched the configure directory (see above),
-# search with respect to the top source dir, not the build dir
-if test "$CVC4_CONFIGURE_IN_BUILDS" = yes -a -n "$CXXTEST"; then
- case "$CXXTEST" in
- /*) ;;
- *) CXXTEST="$srcdir/$CXXTEST" ;;
- esac
-fi
-
TESTS_ENVIRONMENT=
RUN_REGRESSION_ARGS=
if test "$enable_proof" = yes; then
@@ -950,40 +937,73 @@ fi
AC_SUBST([TESTS_ENVIRONMENT])
AC_SUBST([RUN_REGRESSION_ARGS])
+AC_ARG_VAR(TEST_CPPFLAGS, [CPPFLAGS to use when testing (default=$CPPFLAGS)])
+AC_ARG_VAR(TEST_CXXFLAGS, [CXXFLAGS to use when testing (default=$CXXFLAGS)])
+AC_ARG_VAR(TEST_LDFLAGS, [LDFLAGS to use when testing (default=$LDFLAGS)])
+
CXXTESTGEN=
-AC_PATH_PROG(CXXTESTGEN, cxxtestgen.pl, [], [$CXXTEST:$PATH])
-if test -z "$CXXTESTGEN"; then
- AC_PATH_PROG(CXXTESTGEN, cxxtestgen.py, [], [$CXXTEST:$PATH])
-fi
-if test -z "$CXXTESTGEN"; then
- AC_PATH_PROG(CXXTESTGEN, cxxtestgen, [], [$CXXTEST:$PATH])
-fi
-# The latest version of cxxtest distributed from the git repository places
-# cxxtest under <cxxtest-root>/bin/cxxtest
-if test -z "$CXXTESTGEN"; then
- AC_PATH_PROG(CXXTESTGEN, cxxtestgen, [], [$CXXTEST/bin:$PATH])
-fi
if test "$enable_unit_testing" = "no"; then
AC_MSG_NOTICE([unit tests disabled by user request.])
- CXXTESTGEN=
CXXTEST=
-elif test -z "$CXXTESTGEN"; then
- AC_MSG_NOTICE([unit tests disabled, could not find cxxtestgen.pl or cxxtestgen.py or cxxtestgen])
-elif test -z "$CXXTEST"; then
- CXXTEST=`dirname "$CXXTESTGEN"`
- AC_MSG_CHECKING([for location of CxxTest headers])
- if test -e "$CXXTEST/cxxtest/TestRunner.h"; then
- AC_MSG_RESULT([$CXXTEST])
- else
- if test -e "/usr/include/cxxtest/TestRunner.h"; then
- AC_MSG_RESULT([/usr/include])
+else
+ # The latest version of cxxtest distributed from the git repository places
+ # cxxtest under <cxxtest-root>/bin/cxxtest
+ AC_PATH_PROGS(CXXTESTGEN,
+ cxxtestgen.pl cxxtestgen.py cxxtestgen,
+ [
+ AC_MSG_NOTICE([unit tests disabled, \
+ could not find cxxtestgen.pl or \
+ cxxtestgen.py or cxxtestgen])
+ CXXTEST=
+ ],
+ [$CXXTEST:$CXXTEST/bin:$PATH])
+
+ if test -n "$CXXTESTGEN" -a "`basename $CXXTESTGEN`" = "cxxtestgen.pl"; then
+ if test -z "$PERL"; then
+ AC_CHECK_PROGS(PERL, perl, perl, [])
else
- AC_MSG_RESULT([not found])
- AC_MSG_WARN([unit tests disabled, CxxTest headers not found.])
+ AC_CHECK_PROG(PERL, "$PERL", "$PERL", [])
+ fi
+
+ if test -z "$PERL"; then
+ AC_MSG_WARN([unit tests disabled, perl not found.])
CXXTESTGEN=
CXXTEST=
fi
fi
+
+ # check if CxxTest headers exist and set include paths accordingly
+ if test -n "$CXXTESTGEN"; then
+ AC_MSG_CHECKING([for location of CxxTest headers])
+ if test -n "$CXXTEST"; then
+ if test -e "$CXXTEST/cxxtest/TestRunner.h"; then
+ AC_MSG_RESULT([$CXXTEST])
+ TEST_CPPFLAGS="${TEST_CPPFLAGS} -I$CXXTEST"
+ TEST_CXXFLAGS="${TEST_CXXFLAGS} -I$CXXTEST"
+ else
+ AC_MSG_RESULT([not found])
+ AC_MSG_WARN([unit tests disabled, CxxTest headers not found at $CXXTEST.])
+ CXXTESTGEN=
+ CXXTEST=
+ fi
+ # TODO: use more generic way to find cxxtest/TestRunner.h in system headers
+ elif test -e "/usr/include/cxxtest/TestRunner.h"; then
+ CXXTEST=/usr/include
+ AC_MSG_RESULT([$CXXTEST])
+ else
+ CXXTEST=`dirname "$CXXTESTGEN"`
+ if test -e "$CXXTEST/cxxtest/TestRunner.h"; then
+ AC_MSG_RESULT([$CXXTEST])
+ TEST_CPPFLAGS="${TEST_CPPFLAGS} -I$CXXTEST"
+ TEST_CXXFLAGS="${TEST_CXXFLAGS} -I$CXXTEST"
+ else
+ AC_MSG_RESULT([not found])
+ AC_MSG_WARN([unit tests disabled, CxxTest headers not found.])
+ CXXTESTGEN=
+ CXXTEST=
+ fi
+ fi
+ fi
fi
if test "$enable_unit_testing" = yes -a -z "$CXXTESTGEN"; then
@@ -992,26 +1012,8 @@ fi
AM_CONDITIONAL([HAVE_CXXTESTGEN], [test -n "$CXXTESTGEN"])
-AC_ARG_VAR(TEST_CPPFLAGS, [CPPFLAGS to use when testing (default=$CPPFLAGS)])
-AC_ARG_VAR(TEST_CXXFLAGS, [CXXFLAGS to use when testing (default=$CXXFLAGS)])
-AC_ARG_VAR(TEST_LDFLAGS, [LDFLAGS to use when testing (default=$LDFLAGS)])
-
AC_ARG_VAR(PERL, [PERL interpreter (used when testing)])
-if test -n "$CXXTEST"; then
- if test -z "$PERL"; then
- AC_CHECK_PROGS(PERL, perl, perl, [])
- else
- AC_CHECK_PROG(PERL, "$PERL", "$PERL", [])
- fi
-
- if test -z "$PERL"; then
- AC_MSG_WARN([unit tests disabled, perl not found.])
- CXXTESTGEN=
- CXXTEST=
- fi
-fi
-
AC_ARG_VAR(PYTHON, [PYTHON interpreter (used for building legacy Java library interface)])
if test -z "$PYTHON"; then
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback