From 0020f1aa27674141c81bf3339a40d14edc55423a Mon Sep 17 00:00:00 2001 From: Snaipe Date: Mon, 4 May 2015 00:05:52 +0200 Subject: [PATCH] Added autoconf conditional for PCRE --- configure.ac | 4 ++-- src/main.c | 8 ++++---- src/report.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index a0d8d93..4d9b7a0 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/main.c b/src/main.c index 32859c9..0402d71 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/report.c b/src/report.c index 4ebbd8f..59e3738 100644 --- a/src/report.c +++ b/src/report.c @@ -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); }