summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--m4/snprintf-posix.m441
-rw-r--r--m4/sprintf-posix.m426
-rw-r--r--m4/vasnprintf-posix.m429
-rw-r--r--m4/vasprintf-posix.m429
-rw-r--r--m4/vsnprintf-posix.m441
-rw-r--r--m4/vsprintf-posix.m426
7 files changed, 157 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fcb2f9b23..41bc514c91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2007-03-08 Bruno Haible <bruno@clisp.org>
+ * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Use 'case' statements
+ instead of 'expr' invocations.
+ * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise.
+ * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise.
+ * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise.
+ * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise.
+ * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise.
+ Suggested by Paul Eggert.
+
+2007-03-08 Bruno Haible <bruno@clisp.org>
+
* modules/fseterr-tests: New file.
* tests/test-fseterr.c: New file.
diff --git a/m4/snprintf-posix.m4 b/m4/snprintf-posix.m4
index 44c0dbf8ae..d1f889ed88 100644
--- a/m4/snprintf-posix.m4
+++ b/m4/snprintf-posix.m4
@@ -17,16 +17,37 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
gl_SNPRINTF_TRUNCATION_C99
gl_SNPRINTF_RETVAL_C99
gl_SNPRINTF_DIRECTIVE_N
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_truncation_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_retval_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_directive_n" : ".*yes" > /dev/null; then
- # snprintf exists and is already POSIX compliant.
- gl_cv_func_snprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ case "$gl_cv_func_snprintf_truncation_c99" in
+ *yes)
+ case "$gl_cv_func_snprintf_retval_c99" in
+ *yes)
+ case "$gl_cv_func_snprintf_directive_n" in
+ *yes)
+ # snprintf exists and is already POSIX
+ # compliant.
+ gl_cv_func_snprintf_posix=yes
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
fi
if test $gl_cv_func_snprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
diff --git a/m4/sprintf-posix.m4 b/m4/sprintf-posix.m4
index bd28762ec8..99321940f5 100644
--- a/m4/sprintf-posix.m4
+++ b/m4/sprintf-posix.m4
@@ -11,12 +11,26 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_POSITIONS])
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null; then
- : # sprintf exists and is already POSIX compliant.
- else
+ gl_cv_func_sprintf_posix=no
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ # sprintf exists and is already POSIX compliant.
+ gl_cv_func_sprintf_posix=yes
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ if test $gl_cv_func_sprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
[Define if the vasnprintf implementation needs special code for
diff --git a/m4/vasnprintf-posix.m4 b/m4/vasnprintf-posix.m4
index a79a267063..ea282a1bb3 100644
--- a/m4/vasnprintf-posix.m4
+++ b/m4/vasnprintf-posix.m4
@@ -11,14 +11,29 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_POSITIONS])
+ gl_cv_func_vasnprintf_posix=no
AC_CHECK_FUNCS_ONCE([vasnprintf])
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \
- && test $ac_cv_func_vasnprintf = yes; then
- : # vasnprintf exists and is already POSIX compliant.
- else
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ if test $ac_cv_func_vasnprintf = yes; then
+ # vasnprintf exists and is already POSIX compliant.
+ gl_cv_func_vasnprintf_posix=yes
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ if test $gl_cv_func_vasnprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
[Define if the vasnprintf implementation needs special code for
diff --git a/m4/vasprintf-posix.m4 b/m4/vasprintf-posix.m4
index 6c5fc58acd..079ac768bc 100644
--- a/m4/vasprintf-posix.m4
+++ b/m4/vasprintf-posix.m4
@@ -11,14 +11,29 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_POSITIONS])
+ gl_cv_func_vasprintf_posix=no
AC_CHECK_FUNCS([vasprintf])
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \
- && test $ac_cv_func_vasprintf = yes; then
- : # vasprintf exists and is already POSIX compliant.
- else
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ if test $ac_cv_func_vasprintf = yes; then
+ # vasprintf exists and is already POSIX compliant.
+ gl_cv_func_vasprintf_posix=yes
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ if test $gl_cv_func_vasprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
[Define if the vasnprintf implementation needs special code for
diff --git a/m4/vsnprintf-posix.m4 b/m4/vsnprintf-posix.m4
index dcf0397328..c90ad8ef2e 100644
--- a/m4/vsnprintf-posix.m4
+++ b/m4/vsnprintf-posix.m4
@@ -18,16 +18,37 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
gl_SNPRINTF_TRUNCATION_C99
gl_SNPRINTF_RETVAL_C99
gl_SNPRINTF_DIRECTIVE_N
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_truncation_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_retval_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_snprintf_directive_n" : ".*yes" > /dev/null; then
- # vsnprintf exists and is already POSIX compliant.
- gl_cv_func_vsnprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ case "$gl_cv_func_snprintf_truncation_c99" in
+ *yes)
+ case "$gl_cv_func_snprintf_retval_c99" in
+ *yes)
+ case "$gl_cv_func_snprintf_directive_n" in
+ *yes)
+ # vsnprintf exists and is already POSIX
+ # compliant.
+ gl_cv_func_vsnprintf_posix=yes
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
fi
if test $gl_cv_func_vsnprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
diff --git a/m4/vsprintf-posix.m4 b/m4/vsprintf-posix.m4
index 580bc1c20d..ef5d2e8a19 100644
--- a/m4/vsprintf-posix.m4
+++ b/m4/vsprintf-posix.m4
@@ -11,12 +11,26 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_POSITIONS])
- if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
- && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null; then
- : # vsprintf exists and is already POSIX compliant.
- else
+ gl_cv_func_vsprintf_posix=no
+ case "$gl_cv_func_printf_sizes_c99" in
+ *yes)
+ case "$gl_cv_func_printf_directive_a" in
+ *yes)
+ case "$gl_cv_func_printf_directive_n" in
+ *yes)
+ case "$gl_cv_func_printf_positions" in
+ *yes)
+ # vsprintf exists and is already POSIX compliant.
+ gl_cv_func_vsprintf_posix=yes
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ if test $gl_cv_func_vsprintf_posix = no; then
if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
[Define if the vasnprintf implementation needs special code for