regex: Remove --disable-regex option

https://bugzilla.gnome.org/show_bug.cgi?id=622149
This commit is contained in:
Christian Persch 2012-02-11 23:51:11 +01:00 committed by Matthias Clasen
parent 3e7f42654f
commit d70634526d
4 changed files with 49 additions and 95 deletions

View File

@ -2471,76 +2471,60 @@ AC_MSG_RESULT($broken_poll)
dnl *********************
dnl *** GRegex checks ***
dnl *********************
PCRE_REQUIRED_VERSION=8.11
# Check if we should compile GRegex
AC_ARG_ENABLE(regex, AC_HELP_STRING([--disable-regex],
[disable the compilation of GRegex]),
[case "${enableval}" in
yes) enable_regex=true ;;
no) enable_regex=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-regex) ;;
esac],
[enable_regex=true])
# Check if we should use the internal or the system-supplied pcre
AC_ARG_WITH(pcre,
[AC_HELP_STRING([--with-pcre=@<:@internal/system@:>@],
[whether to use system PCRE [default=internal]])])
AM_CONDITIONAL(ENABLE_REGEX, $enable_regex)
AM_CONDITIONAL(USE_SYSTEM_PCRE, [test "x$with_pcre" = xsystem])
if test x$enable_regex = xtrue; then
AC_DEFINE(ENABLE_REGEX, [], [include GRegex])
# Check if we should use the internal or the system-supplied pcre
AC_ARG_WITH(pcre,
[AC_HELP_STRING([--with-pcre=@<:@internal/system@:>@],
[whether to use system PCRE [default=internal]])])
AM_CONDITIONAL(USE_SYSTEM_PCRE, [test "x$with_pcre" = xsystem])
if test "x$with_pcre" = xsystem; then
PKG_CHECK_MODULES(PCRE,
libpcre >= $PCRE_REQUIRED_VERSION)
AC_CACHE_CHECK([for Unicode support in PCRE],glib_cv_pcre_has_unicode,[
glib_save_CFLAGS="$CFLAGS"
glib_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PCRE_CFLAGS" LIBS="$PCRE_LIBS"
AC_TRY_RUN([#include <pcre.h>
int main () {
int support;
pcre_config (PCRE_CONFIG_UTF8, &support);
if (!support)
return 1;
pcre_config (PCRE_CONFIG_UNICODE_PROPERTIES, &support);
if (!support)
return 1;
return 0;
}],
glib_cv_pcre_has_unicode=yes,
glib_cv_pcre_has_unicode=no,
glib_cv_pcre_has_unicode=yes)
CFLAGS="$glib_save_CFLAGS"
LIBS="$glib_save_LIBS"
])
if test "$glib_cv_pcre_has_unicode" = "no"; then
AC_MSG_ERROR([*** The system-supplied PCRE does not support Unicode properties or UTF-8.])
fi
AC_SUBST(PCRE_CFLAGS)
AC_SUBST(PCRE_LIBS)
AC_DEFINE(USE_SYSTEM_PCRE, [], [using the system-supplied PCRE library])
PCRE_REQUIRES=libpcre
AC_SUBST(PCRE_REQUIRES)
else
# If using gcc 4 pass -Wno-pointer-sign when compiling the internal PCRE
if test x"$GCC" = xyes; then
AC_MSG_CHECKING([whether compiler understands -Wno-pointer-sign])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_TRY_COMPILE([],[],[PCRE_WARN_CFLAGS="$PCRE_WARN_CFLAGS -Wno-pointer-sign"
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
fi
if test "x$with_pcre" = xsystem; then
PKG_CHECK_MODULES(PCRE,
libpcre >= $PCRE_REQUIRED_VERSION)
AC_CACHE_CHECK([for Unicode support in PCRE],glib_cv_pcre_has_unicode,[
glib_save_CFLAGS="$CFLAGS"
glib_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PCRE_CFLAGS" LIBS="$PCRE_LIBS"
AC_TRY_RUN([#include <pcre.h>
int main () {
int support;
pcre_config (PCRE_CONFIG_UTF8, &support);
if (!support)
return 1;
pcre_config (PCRE_CONFIG_UNICODE_PROPERTIES, &support);
if (!support)
return 1;
return 0;
}],
glib_cv_pcre_has_unicode=yes,
glib_cv_pcre_has_unicode=no,
glib_cv_pcre_has_unicode=yes)
CFLAGS="$glib_save_CFLAGS"
LIBS="$glib_save_LIBS"
])
if test "$glib_cv_pcre_has_unicode" = "no"; then
AC_MSG_ERROR([*** The system-supplied PCRE does not support Unicode properties or UTF-8.])
fi
AC_SUBST(PCRE_WARN_CFLAGS)
AC_SUBST(PCRE_CFLAGS)
AC_SUBST(PCRE_LIBS)
AC_DEFINE(USE_SYSTEM_PCRE, [], [using the system-supplied PCRE library])
PCRE_REQUIRES=libpcre
AC_SUBST(PCRE_REQUIRES)
else
AM_CONDITIONAL(USE_SYSTEM_PCRE, false])
# If using gcc 4 pass -Wno-pointer-sign when compiling the internal PCRE
if test x"$GCC" = xyes; then
AC_MSG_CHECKING([whether compiler understands -Wno-pointer-sign])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_TRY_COMPILE([],[],[PCRE_WARN_CFLAGS="$PCRE_WARN_CFLAGS -Wno-pointer-sign"
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
fi
fi
AC_SUBST(PCRE_WARN_CFLAGS)
dnl **********************
dnl *** Win32 API libs ***

View File

@ -30,17 +30,10 @@ PRINTF_SUBDIR = gnulib
printf_la = gnulib/libgnulib.la
endif
if ENABLE_REGEX
if USE_SYSTEM_PCRE
else
MAYBE_PCRE = pcre
endif
gregex_c = gregex.c
gregex_h = gregex.h
else
gregex_c =
gregex_h =
endif
SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
@ -173,7 +166,7 @@ libglib_2_0_la_SOURCES = \
gqsort.c \
gqueue.c \
grand.c \
$(gregex_c) \
gregex.c \
gscanner.c \
gscripttable.h \
gsequence.c \
@ -299,7 +292,7 @@ glibsubinclude_HEADERS = \
gquark.h \
gqueue.h \
grand.h \
$(gregex_h) \
gregex.h \
gscanner.h \
gsequence.h \
gshell.h \
@ -368,7 +361,6 @@ uninstall-def-file:
export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
endif
if ENABLE_REGEX
if USE_SYSTEM_PCRE
pcre_lib = $(PCRE_LIBS)
pcre_inc = $(PCRE_CFLAGS)
@ -376,10 +368,6 @@ else
pcre_lib = pcre/libpcre.la
pcre_inc =
endif
else
pcre_lib =
pcre_inc =
endif
libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib) $(G_THREAD_LIBS_EXTRA) $(G_THREAD_LIBS_FOR_GTHREAD)
libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)

View File

@ -27,8 +27,6 @@
#include <locale.h>
#include "glib.h"
#ifdef ENABLE_REGEX
/* U+20AC EURO SIGN (symbol, currency) */
#define EURO "\xe2\x82\xac"
/* U+00E0 LATIN SMALL LETTER A WITH GRAVE (letter, lowercase) */
@ -2659,14 +2657,3 @@ main (int argc, char *argv[])
return g_test_run ();
}
#else /* ENABLE_REGEX false */
int
main (int argc, char *argv[])
{
g_print ("GRegex is disabled.\n");
return 0;
}
#endif /* ENABLE_REGEX */

View File

@ -132,13 +132,8 @@ G_DEFINE_BOXED_TYPE (GPtrArray, g_ptr_array,g_ptr_array_ref, g_ptr_array_unref)
G_DEFINE_BOXED_TYPE (GByteArray, g_byte_array, g_byte_array_ref, g_byte_array_unref)
G_DEFINE_BOXED_TYPE (GBytes, g_bytes, g_bytes_ref, g_bytes_unref);
#ifdef ENABLE_REGEX
G_DEFINE_BOXED_TYPE (GRegex, g_regex, g_regex_ref, g_regex_unref)
G_DEFINE_BOXED_TYPE (GMatchInfo, g_match_info, g_match_info_ref, g_match_info_unref)
#else
GType g_regex_get_type (void) { return G_TYPE_INVALID; }
GType g_match_info_get_type (void) { return G_TYPE_INVALID; }
#endif /* ENABLE_REGEX */
#define g_variant_type_get_type g_variant_type_get_gtype
G_DEFINE_BOXED_TYPE (GVariantType, g_variant_type, g_variant_type_copy, g_variant_type_free)