[gnome-terminal] build: Add PCRE2 support



commit da1ba7b96ca0a15876055af6a0e33eb792a4c1f0
Author: Christian Persch <chpe gnome org>
Date:   Wed Sep 30 16:53:41 2015 +0200

    build: Add PCRE2 support

 configure.ac              |   30 +++++++++++++++++++++++++++++-
 src/terminal-libgsystem.h |   10 ----------
 src/terminal-pcre2.h      |   25 +++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2da8c5d..31baec7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,7 @@ GLIB_MAX_ALLOWED=2.42
 GIO_REQUIRED=2.34.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.1.0
 DCONF_REQUIRED=0.14.0
+PCRE2_REQUIRED=10.00
 
 AC_MSG_CHECKING([which gtk+ version to compile against])
 AC_ARG_WITH([gtk],
@@ -62,6 +63,8 @@ case "$with_gtk" in
        ;;
 esac
 
+#
+
 PLATFORM_DEPS=
 for target in $($PKG_CONFIG --variable targets gdk-$GTK_API_VERSION); do
   case "$target" in
@@ -73,6 +76,29 @@ for target in $($PKG_CONFIG --variable targets gdk-$GTK_API_VERSION); do
   esac
 done
 
+# PCRE2
+
+AC_MSG_CHECKING([whether PCRE2 support is requested])
+AC_ARG_WITH([pcre2],
+  [AS_HELP_STRING([--without-pcre2],[Disable pcre2 support])],
+  [],[with_pcre2=yes])
+AC_MSG_RESULT([$with_pcre2])
+
+PCRE2_PKGS=
+if test "$with_pcre2" = "yes"; then
+  PCRE2_PKGS="libpcre2-8 >= $PCRE2_REQUIRED"
+
+  PKG_CHECK_MODULES([PCRE2],[$PCRE2_PKGS],,
+    [AC_MSG_ERROR([PCRE2 requested but libpcre2-8 not found. Use --without-pcre2 to disable PCRE2])])
+
+  AC_DEFINE([WITH_PCRE2],[1],[Define to 1 to enable pcre2 support])
+  EXTRA_DEPS="$EXTRA_DEPS $PCRE2_PKGS"
+fi
+
+AM_CONDITIONAL([WITH_PCRE2],[test "$with_pcre2" = "yes"])
+
+# pkg-config checks
+
 PKG_CHECK_MODULES([TERM],
   [vte-$VTE_API_VERSION >= $VTE_REQUIRED
    glib-2.0 >= $GLIB_REQUIRED
@@ -81,7 +107,8 @@ PKG_CHECK_MODULES([TERM],
    gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
    dconf >= $DCONF_REQUIRED
    uuid
-   $PLATFORM_DEPS])
+   $PLATFORM_DEPS
+   $PCRE2_PKGS])
 
 # ****
 # Vala
@@ -369,6 +396,7 @@ gnome-terminal-$VERSION:
       prefix:                 ${prefix}
       source code location:   ${srcdir}
       compiler:               ${CC}
+      PCRE2:                  ${with_pcre2}
       gterminal:              ${enable_gterminal}
       DBus interface dir:     ${dbusinterfacedir}
       DBus service dir:       ${dbusservicedir}
diff --git a/src/terminal-libgsystem.h b/src/terminal-libgsystem.h
index 2d23c86..3a91c7f 100644
--- a/src/terminal-libgsystem.h
+++ b/src/terminal-libgsystem.h
@@ -56,7 +56,6 @@ GS_DEFINE_CLEANUP_FUNCTION0(GHashTable*, gs_local_hashtable_unref, g_hash_table_
 GS_DEFINE_CLEANUP_FUNCTION0(GList*, gs_local_list_free, g_list_free)
 GS_DEFINE_CLEANUP_FUNCTION0(GObject*, gs_local_obj_unref, g_object_unref)
 GS_DEFINE_CLEANUP_FUNCTION0(GPtrArray*, gs_local_ptrarray_unref, g_ptr_array_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GRegex*, gs_local_regex_unref, g_regex_unref)
 GS_DEFINE_CLEANUP_FUNCTION0(GVariant*, gs_local_variant_unref, g_variant_unref)
 GS_DEFINE_CLEANUP_FUNCTION0(GVariantBuilder*, gs_local_variant_builder_unref, g_variant_builder_unref)
 GS_DEFINE_CLEANUP_FUNCTION0(GVariantIter*, gs_local_variant_iter_free, g_variant_iter_free)
@@ -81,15 +80,6 @@ GS_DEFINE_CLEANUP_FUNCTION(void*, gs_local_free, g_free)
 #define gs_unref_object __attribute__ ((cleanup(gs_local_obj_unref)))
 
 /**
- * gs_unref_regex:
- *
- * Call g_regex_unref() on a variable location when it goes out of
- * scope.  Note that unlike g_regex_unref(), the variable may be
- * %NULL.
- */
-#define gs_unref_regex __attribute__ ((cleanup(gs_local_regex_unref)))
-
-/**
  * gs_unref_variant:
  *
  * Call g_variant_unref() on a variable location when it goes out of
diff --git a/src/terminal-pcre2.h b/src/terminal-pcre2.h
new file mode 100644
index 0000000..7754e46
--- /dev/null
+++ b/src/terminal-pcre2.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright © 2015 Christian Persch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#ifdef __VTE_VTE_H__
+#error "Must include terminal-pcre2.h before vte/vte.h"
+#endif
+
+#define PCRE2_CODE_UNIT_WIDTH 0
+#include <pcre2.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]