aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--dfa.c12
-rw-r--r--extension/ChangeLog7
-rw-r--r--extension/Makefile.am3
-rw-r--r--extension/Makefile.in3
-rwxr-xr-xextension/configure14
-rw-r--r--extension/configure.ac11
-rw-r--r--main.c8
8 files changed, 69 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 88047c4d..d7a0abd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-03-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ For systems where libc is borked (MirBSD, maybe others).
+
+ * dfa.c: Force use of gawk_mb_cur_max instead of MB_CUR_MAX and make
+ mbrtowc a macro that always fails.
+ (using_utf8): Force utf8 to be 0 if libc borked and gawk_mb_cur_max
+ is one.
+ * main.c (main): If libc is borked and LC_ALL or LANG exist in the
+ environment and are set to "C" or "c", force gawk_mb_cur_max to one.
+
2013-03-11 Arnold D. Robbins <arnold@skeeve.com>
* re.c (check_bracket_exp): Make handling of embedded ] in
diff --git a/dfa.c b/dfa.c
index 88d34d55..df0dc4a1 100644
--- a/dfa.c
+++ b/dfa.c
@@ -92,6 +92,14 @@ is_blank (int c)
}
#endif /* GAWK */
+#ifdef LIBC_IS_BORKED
+extern int gawk_mb_cur_max;
+#undef MB_CUR_MAX
+#define MB_CUR_MAX gawk_mb_cur_max
+#undef mbrtowc
+#define mbrtowc(a, b, c, d) (-1)
+#endif
+
/* HPUX, define those as macros in sys/param.h */
#ifdef setbit
# undef setbit
@@ -794,6 +802,10 @@ using_utf8 (void)
#else
utf8 = 0;
#endif
+#ifdef LIBC_IS_BORKED
+ if (gawk_mb_cur_max == 1)
+ utf8 = 0;
+#endif
}
return utf8;
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 62638fcc..1d85469d 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,10 @@
+2013-03-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.ac: Add AC_OUTPUT_COMMANDS that drops in a do-nothing
+ Makefile for MirBSD, since the extensions can't be built on MirBSD.
+ * configure: Regenerated.
+ * Makefile.am (check-for-shared-lib-support): Update comment some.
+
2013-03-04 Arnold D. Robbins <arnold@skeeve.com>
* filefuncs.c (fill_stat_array): Adjust computation for block
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 61e26976..d0484977 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -115,6 +115,9 @@ SUBDIRS =
# This is an ugly hack, initially for MirBSD but probably needed for other
# systems. If gawk doesn't have the API built in, don't try to build the
# extensions.
+#
+# Given the workaround in configure, this isn't strictly necessary, but
+# we're leaving it in, in case of some other system needing it.
check-recursive all-recursive: check-for-shared-lib-support
check-for-shared-lib-support:
diff --git a/extension/Makefile.in b/extension/Makefile.in
index 9aa75cee..87529d95 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -1186,6 +1186,9 @@ uninstall-man: uninstall-man3
# This is an ugly hack, initially for MirBSD but probably needed for other
# systems. If gawk doesn't have the API built in, don't try to build the
# extensions.
+#
+# Given the workaround in configure, this isn't strictly necessary, but
+# we're leaving it in, in case of some other system needing it.
check-recursive all-recursive: check-for-shared-lib-support
check-for-shared-lib-support:
diff --git a/extension/configure b/extension/configure
index 797cf606..1f6b937c 100755
--- a/extension/configure
+++ b/extension/configure
@@ -14031,6 +14031,7 @@ ac_config_headers="$ac_config_headers config.h:configh.in"
ac_config_files="$ac_config_files Makefile"
+ac_config_commands="$ac_config_commands default-1"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -15034,6 +15035,7 @@ fi
+
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -15047,6 +15049,7 @@ do
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:configh.in" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -16478,6 +16481,17 @@ fi
chmod +x "$ofile"
;;
+ "default-1":C)
+case `uname` in
+MirBSD | MirOS)
+ cat << \EOF > Makefile
+all dist check clean distclean install uninstall distcheck:
+ @exit 0
+EOF
+ ;;
+*)
+esac
+ ;;
esac
done # for ac_tag
diff --git a/extension/configure.ac b/extension/configure.ac
index b1d00e57..a1f42db6 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -78,4 +78,15 @@ AC_C_INLINE
AC_CONFIG_HEADERS([config.h:configh.in])
AC_CONFIG_FILES(Makefile)
+AC_OUTPUT_COMMANDS([
+case `uname` in
+MirBSD | MirOS)
+ cat << \EOF > Makefile
+all dist check clean distclean install uninstall distcheck:
+ @exit 0
+EOF
+ ;;
+*)
+esac
+])dnl
AC_OUTPUT
diff --git a/main.c b/main.c
index 785935e4..e2aff0c9 100644
--- a/main.c
+++ b/main.c
@@ -210,6 +210,7 @@ main(int argc, char **argv)
char *extra_stack;
int have_srcfile = 0;
SRCFILE *s;
+ const char *env_lc;
/* do these checks early */
if (getenv("TIDYMEM") != NULL)
@@ -261,6 +262,13 @@ main(int argc, char **argv)
*/
gawk_mb_cur_max = MB_CUR_MAX;
/* Without MBS_SUPPORT, gawk_mb_cur_max is 1. */
+#ifdef LIBC_IS_BORKED
+ env_lc = getenv("LC_ALL");
+ if (env_lc == NULL)
+ env_lc = getenv("LANG");
+ if (env_lc != NULL && env_lc[1] == '\0' && tolower(env_lc[0]) == 'c')
+ gawk_mb_cur_max = 1;
+#endif
/* init the cache for checking bytes if they're characters */
init_btowc_cache();