Added autoconf conditional for PCRE
This commit is contained in:
parent
b881d85b19
commit
0020f1aa27
3 changed files with 9 additions and 9 deletions
|
@ -24,13 +24,13 @@ AC_CHECK_LIB([csptr], [smalloc], [], [AC_MSG_ERROR([Could not find libcsptr depe
|
|||
Please go to https://github.com/Snaipe/c-smart-pointers.git \
|
||||
and follow the installation instructions.])])
|
||||
|
||||
AC_FUNC_FNMATCH
|
||||
|
||||
enable_rt_tests="no"
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [enable_rt_tests="yes"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_RT_TESTS], [test "x$enable_rt_tests" != "xno"])
|
||||
|
||||
AC_CHECK_LIB([pcre], [pcre_compile], [AC_DEFINE([HAVE_PCRE], [1], [Define to 1 if you have the `pcre` library (-lpcre)])])
|
||||
|
||||
AM_GNU_GETTEXT([external])
|
||||
AM_GNU_GETTEXT_VERSION([0.18])
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
# define VERSION_MSG "Tests compiled with Criterion v" VERSION "\n"
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
# define PATTERN_USAGE \
|
||||
" --pattern [PATTERN]: run tests matching the " \
|
||||
"given pattern\n"
|
||||
|
@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
|
|||
{"list", no_argument, 0, 'l'},
|
||||
{"ascii", no_argument, 0, 'k'},
|
||||
{"fail-fast", no_argument, 0, 'f'},
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
{"pattern", required_argument, 0, 'p'},
|
||||
#endif
|
||||
{"always-succeed", no_argument, 0, 'y'},
|
||||
|
@ -146,7 +146,7 @@ int main(int argc, char *argv[]) {
|
|||
opt->fail_fast = !strcmp("1", getenv("CRITERION_FAIL_FAST") ?: "0");
|
||||
opt->use_ascii = use_ascii;
|
||||
opt->logging_threshold = atoi(getenv("CRITERION_VERBOSITY_LEVEL") ?: "2");
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
opt->pattern = getenv("CRITERION_TEST_PATTERN");
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +162,7 @@ int main(int argc, char *argv[]) {
|
|||
case 'z': criterion_options.no_early_exit = true; break;
|
||||
case 'k': criterion_options.use_ascii = true; break;
|
||||
case 'f': criterion_options.fail_fast = true; break;
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
case 'p': criterion_options.pattern = optarg; break;
|
||||
#endif
|
||||
case 't': use_tap = true; break;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "report.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
#include "extmatch.h"
|
||||
#endif
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
__attribute__((always_inline))
|
||||
static inline void nothing() {}
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
void disable_unmatching(struct criterion_test_set *set) {
|
||||
FOREACH_SET(struct criterion_suite_set *s, set->suites) {
|
||||
if ((s->suite.data && s->suite.data->disabled) || !s->tests)
|
||||
|
@ -74,7 +74,7 @@ void disable_unmatching(struct criterion_test_set *set) {
|
|||
#endif
|
||||
|
||||
IMPL_REPORT_HOOK(PRE_ALL)(struct criterion_test_set *set) {
|
||||
#ifdef HAVE_FNMATCH
|
||||
#ifdef HAVE_PCRE
|
||||
if (criterion_options.pattern) {
|
||||
disable_unmatching(set);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue