Changeset: b6bc0412f484 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6bc0412f484
Modified Files:
        MonetDB.spec
        configure.ag
        debian/rules
Branch: default
Log Message:

Make it possible to choose at configure time which regex library to use.
--with-regex=pcre vs. --with-regex=posix (default --with-regex=auto)


diffs (167 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -78,6 +78,14 @@
 %endif
 %endif
 
+# If the _without_pcre macro is not set, the PCRE library is used for
+# the implementation of the SQL LIKE and ILIKE operators.  Otherwise
+# the POSIX regex functions are used.  The macro can be set when using
+# mock by passing it the flag --without=pcre.
+%if %{?_without_pcre:0}%{!?_without_pcre:1}
+%define with_pcre 1
+%endif
+
 %if %{fedpkgs}
 # If the _without_rintegration macro is not set, the MonetDB-R RPM
 # will be created.  The macro can be set when using mock by passing it
@@ -155,7 +163,9 @@ BuildRequires: xz-devel
 BuildRequires: libuuid-devel
 BuildRequires: libxml2-devel
 BuildRequires: openssl-devel
+%if %{?with_pcre:1}%{!?with_pcre:0}
 BuildRequires: pcre-devel >= 4.5
+%endif
 BuildRequires: readline-devel
 BuildRequires: unixODBC-devel
 # BuildRequires: uriparser-devel
@@ -901,6 +911,7 @@ developer, but if you do want to test, t
        --with-libxml2=yes \
        --with-lzma=yes \
        --with-openssl=yes \
+       --with-regex=%{?with_pcre:PCRE}%{!?with_pcre:POSIX} \
        --with-proj=no \
        --with-pthread=yes \
        --with-python2=yes \
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1679,38 +1679,59 @@ AS_CASE([$host],
                        AC_DEFINE([HAVE_OPENSSL], 1, [Define if you have the 
OpenSSL library])])])])
 
 
-# PCRE library
-# required on Windows, optional on POSIX systems with GNU regex
-req_pcre_ver='4.5'
-PKG_CHECK_MODULES([pcre], [libpcre >= $req_pcre_ver],
-       [have_pcre=yes], [have_pcre=no; why_have_pcre="(libpcre >= 
$req_pcre_ver not found)"])
-AS_VAR_IF([have_pcre], [yes], [
-       AC_MSG_CHECKING([whether pcre comes with UTF-8 support])
-       save_LIBS="$LIBS"
-       LIBS="$LIBS $pcre_LIBS"
-       save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS $pcre_CFLAGS"
-       AC_RUN_IFELSE([AC_LANG_PROGRAM(
-               [[@%:@include <pcre.h>]],
-               [[int rc; pcre_config(PCRE_CONFIG_UTF8, &rc); exit(!rc);]])],
-               [AC_MSG_RESULT([yes])],
-               [have_pcre=no; why_have_pcre="(libpcre found but no UTF-8 
support)"; AC_MSG_RESULT([no])],
-               [AC_MSG_RESULT([assuming yes])])
-       LIBS="$save_LIBS"
-       CFLAGS="$save_CFLAGS"])
+org_have_regex=auto
+dft_regex=auto
+AC_ARG_WITH([regex],
+       [AS_HELP_STRING([--with-regex=TYPE],
+       [use either PRCE or POSIX regular expressions (default=PCRE if 
available)])],
+       [AS_CASE([$withval],
+               [pcre|PCRE], [have_regex=pcre],
+               [posix|POSIX], [have_regex=posix],
+               [auto|AUTO], [have_regex=auto],
+               [AC_MSG_ERROR([--with-regex argument must be either PCRE or 
POSIX])])],
+       [have_regex=$dft_regex])
+
+AS_VAR_IF([have_regex], [posix],
+       [have_pcre=no; why_have_pcre="(PCRE disabled)"],
+       [
+       # PCRE library
+       # required on Windows, optional on POSIX systems with GNU regex
+       req_pcre_ver='4.5'
+       PKG_CHECK_MODULES([pcre], [libpcre >= $req_pcre_ver],
+               [have_pcre=yes],
+               [AS_VAR_IF([have_regex], [pcre],
+                       [AC_MSG_ERROR([PCRE library not found or not usable])],
+                       [have_pcre=no; why_have_pcre="(libpcre >= $req_pcre_ver 
not found)"])])
+       AS_VAR_IF([have_pcre], [yes], [
+               AC_MSG_CHECKING([whether pcre comes with UTF-8 support])
+               save_LIBS="$LIBS"
+               LIBS="$LIBS $pcre_LIBS"
+               save_CFLAGS="$CFLAGS"
+               CFLAGS="$CFLAGS $pcre_CFLAGS"
+               AC_RUN_IFELSE([AC_LANG_PROGRAM(
+                       [[@%:@include <pcre.h>]],
+                       [[int rc; pcre_config(PCRE_CONFIG_UTF8, &rc); 
exit(!rc);]])],
+                       [AC_MSG_RESULT([yes])],
+                       [have_pcre=no; why_have_pcre="(libpcre found but no 
UTF-8 support)"; AC_MSG_RESULT([no])],
+                       [AC_MSG_RESULT([assuming yes])])
+               LIBS="$save_LIBS"
+               CFLAGS="$save_CFLAGS"
+               have_regex=PCRE])
+       ])
 
 AS_VAR_IF([have_pcre], [yes], [
        AC_DEFINE([HAVE_LIBPCRE], 1, [Define if you have the pcre library])])
 AM_CONDITIONAL([HAVE_PCRE], [test x"$have_pcre" != xno])
 
 have_gnuregex=yes
-AS_VAR_IF([have_pcre], [yes], [], [
+AS_VAR_IF([have_pcre], [no], [
+       AC_MSG_CHECKING([whether for POSIX regex support])
        AC_RUN_IFELSE([AC_LANG_PROGRAM(
                [[@%:@include <regex.h>]],
                [[regex_t re; regcomp(&re, "hello", 
REG_EXTENDED|REG_NOSUB);]])],
-               [AC_MSG_RESULT([yes])],
-               [have_gnuregex=no],
-               [have_gnuregex=no])
+               [AC_MSG_RESULT([yes]); have_regex=POSIX],
+               [AC_MSG_RESULT([no]); have_gnuregex=no],
+               [AC_MSG_RESULT([no]); have_gnuregex=no])
 ])
 
 AS_CASE([$enable_monetdb5-$have_pcre-$have_gnuregex],
@@ -2267,7 +2288,7 @@ AS_VAR_IF([have_gdal], [no], [], [
 AS_VAR_IF([have_gdal], [no],
        [],
        [AS_VAR_IF([have_gdal], [pkgconf],
-               [],
+               [have_gdal=yes],
                [save_CPPFLAGS="$CPPFLAGS"
                 save_LDFLAGS="$LDFLAGS"
                 save_LIBS="$LIBS"
@@ -3059,12 +3080,12 @@ for comp in \
        'lidar        ' \
        'netcdf       ' \
        'openssl      ' \
-       'pcre         ' \
        'proj         ' \
        'pthread      ' \
        'python2      ' \
        'python3      ' \
        'readline     ' \
+       'regex        ' \
        'samtools     ' \
        'shp          ' \
        'sphinxclient ' \
@@ -3080,7 +3101,9 @@ for comp in \
                [-no-no], [why="(by default)"],
                [-no-*], [why="(by command line option)"])
        echo $ECHO_N "    $comp = $ECHO_C"
-       AS_VAR_IF([have], [no], [echo "no  $why"], [echo "yes"])
+       AS_VAR_IF([have], [no],
+               [echo "no  $why"],
+               [AS_VAR_IF([have], [auto], [echo "yes"], [echo "$have"])])
 done
 AS_VAR_IF([have_hge], [yes], [
        hge_bits='128'
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -50,6 +50,7 @@ override_dh_auto_configure:
        --with-python2=yes \
        --with-python3=no \
        --with-readline=yes \
+       --with-regex=PCRE \
        --with-samtools=yes \
        --with-sphinxclient=no \
        --with-unixodbc=yes \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to