From 4e2ea4ccc948e867ec3781ce2eaeca491c6b9912 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Mon, 20 May 2019 23:58:11 -0700 Subject: Allow the regular expression engine to be replaced with PCRE POSIX diff --git a/cmd2.c b/cmd2.c index 81275b6..2d8ab53 100644 --- a/cmd2.c +++ b/cmd2.c @@ -26,7 +26,9 @@ #include #include -#ifdef USE_REGEXP +#ifdef USE_PCREPOSIX +# include +#elif defined(USE_REGEXP) # include #endif diff --git a/configure.ac b/configure.ac index a6b3fcd..bc51bdd 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,16 @@ AC_ARG_ENABLE(vt100, AS_IF([ test "${enable_vt100}" = yes ], [ AC_DEFINE(USE_VT100) ]) +AC_ARG_ENABLE(pcreposix, + AC_HELP_STRING([--enable-pcreposix], + [Use PCRE POSIX library for regular expressions [[default=no]]]), + , + [enable_pcreposix="no"] +) +AS_IF([ test "${enable_pcreposix}" = yes ], + [ AC_DEFINE(USE_PCREPOSIX) ]) + + AC_ARG_ENABLE(sort, AC_HELP_STRING([--enable-sort], [Sort aliases and actions [[default=no]]]), @@ -99,6 +109,12 @@ AC_CHECK_HEADERS([stdlib.h unistd.h]) AC_CHECK_HEADER([locale.h], [AC_CHECK_FUNC([putwc],[AC_DEFINE(USE_LOCALE)])]) +if test "x${enable_pcreposix}" == "xyes"; then + AC_CHECK_HEADER([pcreposix.h], + [AC_CHECK_FUNC([regcomp], [AC_CHECK_LIB(pcreposix,regcomp)])], + [AC_MSG_ERROR([*** pcreposix libraries not found])], []) +fi + AC_ARG_WITH([plugindir], AC_HELP_STRING([--with-plugindir=DIR], [Plugin installation directory [[default=LIBDIR/powwow]]])], @@ -128,6 +144,7 @@ Data directory: $(eval eval eval echo "${datadir}/${PACKAGE}") Plugin directory: $(eval eval eval echo "${plugindir}") enable-vt100: ${enable_vt100} +enable-pcreposix: ${enable_pcreposix} enable-sort: ${enable_sort} enable-noshell: ${enable_noshell} enable-ansibug: ${enable_ansibug} diff --git a/list.c b/list.c index e38021f..1bb0a65 100644 --- a/list.c +++ b/list.c @@ -18,7 +18,9 @@ #include #include -#ifdef USE_REGEXP +#ifdef USE_PCREPOSIX +# include +#elif defined(USE_REGEXP) # include #endif diff --git a/main.c b/main.c index 4da7606..e92d2ea 100644 --- a/main.c +++ b/main.c @@ -75,7 +75,9 @@ extern int errno; extern int select(); -#ifdef USE_REGEXP +#ifdef USE_PCREPOSIX +# include +#elif defined(USE_REGEXP) # include #endif @@ -437,6 +439,9 @@ void printver(void) #else " no regexp," #endif +#ifdef USE_PCREPOSIX + " pcreposix," +#endif #ifdef USE_LOCALE " locale," #endif -- cgit v0.10.2