summaryrefslogtreecommitdiffstats
path: root/gettext-runtime/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-06-19 12:45:06 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:10:42 +0200
commitf58ba018630aa17c2636572aa557ee744b0e856a (patch)
tree8b56f98fe2c175fd115eda3579d8800f8d5a9cc5 /gettext-runtime/m4
parentaf9229b55c2873fdd7b2d07110094e137c96150d (diff)
downloadexternal_gettext-f58ba018630aa17c2636572aa557ee744b0e856a.zip
external_gettext-f58ba018630aa17c2636572aa557ee744b0e856a.tar.gz
external_gettext-f58ba018630aa17c2636572aa557ee744b0e856a.tar.bz2
Add an implementation of printf(), fprintf() etc. that supports formatting
with positions, for those systems that lack it (NetBSD, Woe32).
Diffstat (limited to 'gettext-runtime/m4')
-rw-r--r--gettext-runtime/m4/ChangeLog12
-rw-r--r--gettext-runtime/m4/Makefile.am1
-rw-r--r--gettext-runtime/m4/gettext.m444
-rw-r--r--gettext-runtime/m4/longlong.m432
-rw-r--r--gettext-runtime/m4/printf-posix.m443
5 files changed, 110 insertions, 22 deletions
diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog
index e553ded..3ef0b9c 100644
--- a/gettext-runtime/m4/ChangeLog
+++ b/gettext-runtime/m4/ChangeLog
@@ -1,3 +1,15 @@
+2003-06-19 Bruno Haible <bruno@clisp.org>
+
+ * printf-posix.m4: New file.
+ * Makefile.am (EXTRA_DIST): Add printf-posix.m4.
+ * gettext.m4 (AM_INTL_SUBDIR): Require bh_C_SIGNED,
+ jm_AC_TYPE_LONG_LONG, gt_TYPE_LONGDOUBLE, gt_TYPE_WCHAR_T,
+ gt_TYPE_WINT_T, jm_AC_HEADER_INTTYPES_H, jm_AC_HEADER_STDINT_H,
+ gt_TYPE_INTMAX_T, gt_PRINTF_POSIX. Check for ptrdiff_t, asprintf,
+ snprintf, wprintf.
+ * longlong.m4: Update from gnulib.
+ (jm_AC_TYPE_LONG_LONG): Replaces gt_TYPE_LONGLONG.
+
2003-01-11 Bruno Haible <bruno@clisp.org>
* ulonglong.m4 (jm_AC_TYPE_UNSIGNED_LONG_LONG): Also test the ULL
diff --git a/gettext-runtime/m4/Makefile.am b/gettext-runtime/m4/Makefile.am
index 2cb866b..1305391 100644
--- a/gettext-runtime/m4/Makefile.am
+++ b/gettext-runtime/m4/Makefile.am
@@ -19,6 +19,7 @@ longdouble.m4 \
longlong.m4 \
nls.m4 \
po.m4 \
+printf-posix.m4 \
progtest.m4 \
signed.m4 \
stdint_h.m4 \
diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4
index 16070b4..1bf54ff 100644
--- a/gettext-runtime/m4/gettext.m4
+++ b/gettext-runtime/m4/gettext.m4
@@ -1,4 +1,4 @@
-# gettext.m4 serial 20 (gettext-0.12)
+# gettext.m4 serial 21 (gettext-0.12.2)
dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
@@ -354,9 +354,18 @@ AC_DEFUN([AM_INTL_SUBDIR],
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_C_CONST])dnl
+ AC_REQUIRE([bh_C_SIGNED])dnl
AC_REQUIRE([AC_C_INLINE])dnl
AC_REQUIRE([AC_TYPE_OFF_T])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
+ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
+ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
+ AC_REQUIRE([gt_TYPE_WINT_T])dnl
+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
+ AC_REQUIRE([gt_TYPE_INTMAX_T])
+ AC_REQUIRE([gt_PRINTF_POSIX])
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_REQUIRE([jm_GLIBC21])dnl
@@ -365,12 +374,37 @@ AC_DEFUN([AM_INTL_SUBDIR],
AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
AC_REQUIRE([gt_INTTYPES_PRI])dnl
+ AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
stdlib.h string.h unistd.h sys/param.h])
- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
-geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
-strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
-__fsetlocking])
+ AC_CHECK_FUNCS([asprintf feof_unlocked fgets_unlocked getc_unlocked getcwd \
+getegid geteuid getgid getuid mempcpy munmap putenv setenv setlocale snprintf \
+stpcpy strcasecmp strdup strtoul tsearch wprintf __argz_count \
+__argz_stringify __argz_next __fsetlocking])
+
+ case $gt_cv_func_printf_posix in
+ *yes) HAVE_POSIX_PRINTF=1 ;;
+ *) HAVE_POSIX_PRINTF=0 ;;
+ esac
+ AC_SUBST([HAVE_POSIX_PRINTF])
+ if test "$ac_cv_func_asprintf" = yes; then
+ HAVE_ASPRINTF=1
+ else
+ HAVE_ASPRINTF=0
+ fi
+ AC_SUBST([HAVE_ASPRINTF])
+ if test "$ac_cv_func_snprintf" = yes; then
+ HAVE_SNPRINTF=1
+ else
+ HAVE_SNPRINTF=0
+ fi
+ AC_SUBST([HAVE_SNPRINTF])
+ if test "$ac_cv_func_wprintf" = yes; then
+ HAVE_WPRINTF=1
+ else
+ HAVE_WPRINTF=0
+ fi
+ AC_SUBST([HAVE_WPRINTF])
AM_ICONV
AM_LANGINFO_CODESET
diff --git a/gettext-runtime/m4/longlong.m4 b/gettext-runtime/m4/longlong.m4
index b4f472d..d7d7350 100644
--- a/gettext-runtime/m4/longlong.m4
+++ b/gettext-runtime/m4/longlong.m4
@@ -1,27 +1,25 @@
-# longlong.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# longlong.m4 serial 4
+dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
-dnl From Bruno Haible.
-dnl Test whether the compiler supports the 'long long' type.
-dnl Prerequisite: AC_PROG_CC
+dnl From Paul Eggert.
-AC_DEFUN([gt_TYPE_LONGLONG],
+# Define HAVE_LONG_LONG if 'long long' works.
+
+AC_DEFUN([jm_AC_TYPE_LONG_LONG],
[
- AC_CACHE_CHECK([for long long], gt_cv_c_long_long,
- [if test "$GCC" = yes; then
- gt_cv_c_long_long=yes
- else
- AC_TRY_COMPILE([long long foo = 0LL;
- int array [2*(sizeof(long long) >= sizeof(long)) - 1];
- ], ,
- gt_cv_c_long_long=yes, gt_cv_c_long_long=no)
- fi])
- if test $gt_cv_c_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the 'long long' type.])
+ AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
+ [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
+ [long long llmax = (long long) -1;
+ return ll << i | ll >> i | llmax / ll | llmax % ll;],
+ ac_cv_type_long_long=yes,
+ ac_cv_type_long_long=no)])
+ if test $ac_cv_type_long_long = yes; then
+ AC_DEFINE(HAVE_LONG_LONG, 1,
+ [Define if you have the 'long long' type.])
fi
])
diff --git a/gettext-runtime/m4/printf-posix.m4 b/gettext-runtime/m4/printf-posix.m4
new file mode 100644
index 0000000..d96c32c
--- /dev/null
+++ b/gettext-runtime/m4/printf-posix.m4
@@ -0,0 +1,43 @@
+# printf-posix.m4 serial 1 (gettext-0.12.2)
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+dnl Test whether the printf() function supports POSIX/XSI format strings with
+dnl positions.
+
+AC_DEFUN([gt_PRINTF_POSIX],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
+ gt_cv_func_printf_posix,
+ [
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+ sprintf (buf, "%2$d %1$d", 33, 55);
+ return (strcmp (buf, "55 33") == 0);
+}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
+ [
+ AC_EGREP_CPP(notposix, [
+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__
+ notposix
+#endif
+ ], gt_cv_func_printf_posix="guessing no",
+ gt_cv_func_printf_posix="guessing yes")
+ ])
+ ])
+ case $gt_cv_func_printf_posix in
+ *yes)
+ AC_DEFINE(HAVE_POSIX_PRINTF, 1,
+ [Define if your printf() function supports format strings with positions.])
+ ;;
+ esac
+])