aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--configh.in3
-rwxr-xr-xconfigure8
-rw-r--r--configure.ac7
-rw-r--r--regcomp.c12
5 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 12b01829..3e47061c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,18 @@
2013-03-01 Arnold D. Robbins <arnold@skeeve.com>
+ Don't build extensions if API isn't supported:
+
* Makefile.am (SUBDIRS): Move extension directory to last in case
building the extensions is not supported.
* configure.ac: Add check for MirBSD and don't even try to run the
checks for DYNAMIC if so.
+ Check for systems (MirBSD) where libc doesn't understand not
+ to use UTF-8 for LC_ALL=C.
+
+ * configure.ac (LIBC_IS_BORKED): AC_DEFINE if needed.
+ * regcomp.c (init_dfa): Change logic as needed if LIBC_IS_BORKED.
+
2013-02-28 Arnold D. Robbins <arnold@skeeve.com>
Cause profiling / pretty printing to include a list of
diff --git a/configh.in b/configh.in
index 350aac5f..661b117a 100644
--- a/configh.in
+++ b/configh.in
@@ -324,6 +324,9 @@
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
+/* libc is broken for regex handling */
+#undef LIBC_IS_BORKED
+
/* disable lint checks */
#undef NO_LINT
diff --git a/configure b/configure
index 271ac8a2..689b01fa 100755
--- a/configure
+++ b/configure
@@ -5875,6 +5875,14 @@ then
CFLAGS="$CFLAGS -D_SYSV3"
fi
+case `uname` in
+MirBSD | MirOS)
+
+$as_echo "#define LIBC_IS_BORKED 1" >>confdefs.h
+
+ ;;
+esac
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/configure.ac b/configure.ac
index 2f42f4e7..b3087686 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,13 @@ dnl need -D_SYSV3 for ISC
CFLAGS="$CFLAGS -D_SYSV3"
fi
+dnl check for systems where libc is borked for regex handling
+case `uname` in
+MirBSD | MirOS)
+ AC_DEFINE([LIBC_IS_BORKED], 1, [libc is broken for regex handling])
+ ;;
+esac
+
dnl Set the programming language for checks. Fortunately,
dnl this only needs to be set once, since everything is in C.
AC_LANG([C])
diff --git a/regcomp.c b/regcomp.c
index 70a0d38a..fd490d02 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -856,6 +856,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
#ifndef _LIBC
char *codeset_name;
#endif
+#if defined(GAWK) && defined(LIBC_IS_BORKED)
+ /* Needed for brain damaged systems */
+ extern int gawk_mb_cur_max;
+#endif
memset (dfa, '\0', sizeof (re_dfa_t));
@@ -877,7 +881,11 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
dfa->state_hash_mask = table_size - 1;
+#if defined(GAWK) && defined(LIBC_IS_BORKED)
+ dfa->mb_cur_max = gawk_mb_cur_max;
+#else
dfa->mb_cur_max = MB_CUR_MAX;
+#endif
#ifdef _LIBC
if (dfa->mb_cur_max == 6
&& strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
@@ -912,6 +920,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
? codeset_name[4] == '8' && codeset_name[5] == '\0'
: codeset_name[3] == '8' && codeset_name[4] == '\0'))
dfa->is_utf8 = 1;
+#if defined(GAWK) && defined(LIBC_IS_BORKED)
+ if (gawk_mb_cur_max == 1)
+ dfa->is_utf8 = 0;
+#endif /* defined(GAWK) && defined(LIBC_IS_BORKED) */
#endif
/* We check exhaustively in the loop below if this charset is a