aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schimmelmann <nschimme@gmail.com>2019-05-21 06:58:11 (GMT)
committerNils Schimmelmann <nschimme@gmail.com>2019-06-29 17:25:52 (GMT)
commit4e2ea4ccc948e867ec3781ce2eaeca491c6b9912 (patch)
treead8106689f3b9014c697f0649438282a64797452
parentc9ab529d933f2ad070b0a898f87cc083365d533c (diff)
downloadpowwow-4e2ea4ccc948e867ec3781ce2eaeca491c6b9912.zip
powwow-4e2ea4ccc948e867ec3781ce2eaeca491c6b9912.tar.gz
powwow-4e2ea4ccc948e867ec3781ce2eaeca491c6b9912.tar.bz2
Allow the regular expression engine to be replaced with PCRE POSIX
-rw-r--r--cmd2.c4
-rw-r--r--configure.ac17
-rw-r--r--list.c4
-rw-r--r--main.c7
4 files changed, 29 insertions, 3 deletions
diff --git a/cmd2.c b/cmd2.c
index 81275b6..2d8ab53 100644
--- a/cmd2.c
+++ b/cmd2.c
@@ -26,7 +26,9 @@
#include <unistd.h>
#include <errno.h>
-#ifdef USE_REGEXP
+#ifdef USE_PCREPOSIX
+# include <pcreposix.h>
+#elif defined(USE_REGEXP)
# include <regex.h>
#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 <sys/types.h>
#include <sys/time.h>
-#ifdef USE_REGEXP
+#ifdef USE_PCREPOSIX
+# include <pcreposix.h>
+#elif defined(USE_REGEXP)
# include <regex.h>
#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 <pcreposix.h>
+#elif defined(USE_REGEXP)
# include <regex.h>
#endif
@@ -437,6 +439,9 @@ void printver(void)
#else
" no regexp,"
#endif
+#ifdef USE_PCREPOSIX
+ " pcreposix,"
+#endif
#ifdef USE_LOCALE
" locale,"
#endif