]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add libasprintf subpackage.
authorBruno Haible <bruno@clisp.org>
Mon, 28 Oct 2002 13:18:01 +0000 (13:18 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:47 +0000 (12:08 +0200)
14 files changed:
ChangeLog
Makefile.am
PACKAGING
configure.in
doc/ChangeLog
doc/gettext.texi
m4/ChangeLog
m4/Makefile.am
m4/intmax.m4 [new file with mode: 0644]
m4/longdouble.m4 [new file with mode: 0644]
m4/longlong.m4 [new file with mode: 0644]
m4/wchar_t.m4 [new file with mode: 0644]
tests/ChangeLog
tests/lang-c++

index 8423595df9382ba2a0df770c6c63485372162fda..0ce7162404baf5e081d4212c2ec34cf32f3e2550 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-10-27  Bruno Haible  <bruno@clisp.org>
+
+       * libasprintf: New subdirectory.
+       * configure.in (CXX): Adjust to match the result in the libasprintf
+       subdirectory.
+       (SUBDIR_libasprintf): New AC_SUBST.
+       (AC_CONFIG_SUBDIRS): Recurse into libasprintf.
+       * Makefile.am (SUBDIRS): Add libasprintf conditionally.
+       (DIST_SUBDIRS): New variable.
+       * PACKAGING: Add libasprintf.*, autosprintf.h, and its documentation
+       autosprintf.html, autosprintf.info.
+
 2002-10-27  Bruno Haible  <bruno@clisp.org>
 
        * PACKAGING: Update list of installed .m4 files.
index 8e100fb80d6c92c86c5e30c1e11e761ee7db4c71..74ff5a2a41223fdacb81d0a8d33f264908ca3f2a 100644 (file)
@@ -26,7 +26,12 @@ gettextsrcdir = $(datadir)/gettext
 gettextsrc_DATA = ABOUT-NLS
 gettextsrc_SCRIPTS = config.rpath mkinstalldirs
 
-SUBDIRS = doc intl intl-java lib libuniname src po projects misc man m4 tests
+SUBDIRS = \
+  doc intl intl-java lib @SUBDIR_libasprintf@ libuniname \
+  src po projects misc man m4 tests
+DIST_SUBDIRS = \
+  doc intl intl-java lib libasprintf libuniname \
+  src po projects misc man m4 tests
 
 EXTRA_DIST = config.rpath BUGS DISCLAIM PACKAGING README.gemtext \
              djgpp/COPYING.DJ djgpp/Makefile.maint djgpp/README.DJ \
index 779ec6aaa816371cda76150dc24d1fc91a77e051..fafad36a944447e5f074a7443441ffb7708423e8 100644 (file)
--- a/PACKAGING
+++ b/PACKAGING
@@ -37,6 +37,8 @@ following file list.
       $prefix/lib/charset.alias           (not installed on glibc systems)
       $prefix/share/locale/locale.alias   (not installed on glibc systems)
       $prefix/include/libintl.h           (not installed on glibc systems)
+      $prefix/lib/libasprintf.*
+      $prefix/include/autosprintf.h
 
    gettext-tools
 
@@ -59,7 +61,9 @@ following file list.
       $prefix/doc/gettext/javadoc1/*
       $prefix/doc/gettext/javadoc2/*
       $prefix/doc/gettext/gettext_*.html
+      $prefix/doc/libasprintf/autosprintf.html
       $prefix/info/gettext.info*
+      $prefix/info/autosprintf.info
       $prefix/lib/libgettextlib*
       $prefix/lib/libgettextsrc*
       $prefix/lib/gettext/*
index 7a844d59c962ece780119108c07aa0a2a02cb761..76d51e33884de87358d43772f01bb8fcb343e63c 100644 (file)
@@ -2,8 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
 AC_INIT
 AC_CONFIG_SRCDIR(src/msgfmt.c)
-AM_INIT_AUTOMAKE(gettext, 0.11.4)
-RELEASE_DATE=2002-07-25      dnl in "date +%Y-%m-%d" format
+AM_INIT_AUTOMAKE(gettext, 0.11.6-pre1)
+RELEASE_DATE=2002-08-06      dnl in "date +%Y-%m-%d" format
 AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
@@ -182,7 +182,7 @@ CROSS_COMPILING=$cross_compiling
 AC_SUBST(CROSS_COMPILING)
 
 dnl Checks for optional programs for the tests/lang-* tests.
-AC_CHECK_PROGS(CXX, $CCC c++ g++ gpp gcc CC cxx cc++ cl, :)
+AC_CHECK_PROGS(CXX, $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC, :)
 if test "$CXX" != ":"; then
   dnl Use a modified version of AC_PROG_CXX_WORKS that does not exit
   dnl upon failure.
@@ -209,6 +209,14 @@ if test "$CXX" != ":"; then
   fi
 fi
 
+dnl Determine whether to build libasprintf.
+if test "$CXX" != ":"; then
+  SUBDIR_libasprintf=libasprintf
+else
+  SUBDIR_libasprintf=
+fi
+AC_SUBST(SUBDIR_libasprintf)
+
 dnl Checks for tests/rpathcfg.
 AC_SUBST(GCC)
 AC_SUBST(LD)
@@ -234,9 +242,11 @@ LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
 changequote([, ])dnl
 AC_SUBST(LTALLOCA)
 
+AC_CONFIG_SUBDIRS(libasprintf)
+
 AC_OUTPUT([Makefile \
-           lib/Makefile lib/javacomp.sh lib/javaexec.sh \
            intl/Makefile intl-java/Makefile \
+           lib/Makefile lib/javacomp.sh lib/javaexec.sh \
            libuniname/Makefile \
            src/Makefile src/user-email \
            po/Makefile.in \
index 09a0f56b7e0f3d3735a453fd9c3d52d70e38d37e..8c316ef798f3e59b0dfe2b5010b92caf3a6f3a0e 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-27  Bruno Haible  <bruno@clisp.org>
+
+       * gettext.texi (C): Add reference to autosprintf for C++.
+
 2002-10-27  Bruno Haible  <bruno@clisp.org>
 
        * gettext.texi (@direntry): Add more entry points: one for every
index 1bcc7edc2cf610bb50ca2f556f43e2594a2de66f..da9d5089ca49b38089fcea46633cec836dd8ecf3 100644 (file)
@@ -6985,6 +6985,8 @@ Use
 
 @item Formatting with positions
 @code{fprintf "%2$d %1$d"} (POSIX but not C 99)
+@*In C++: @code{autosprintf "%2$d %1$d"}
+(@pxref{, , Introduction, autosprintf, GNU autosprintf})
 
 @item Portability
 autoconf (gettext.m4) and #if ENABLE_NLS
index ee8b35794055b06079cb0b2d7594c2c1a90da645..c90b25efb0853262b6eac227d707b74f21afcb4d 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-27  Bruno Haible  <bruno@clisp.org>
+
+       * intmax.m4: New file.
+       * longlong.m4: New file.
+       * longdouble.m4: New file.
+       * wchar_t.m4: New file.
+       * Makefile.am (EXTRA_DIST): Add them.
+
 2002-08-25  Bruno Haible  <bruno@clisp.org>
 
        * gettext.m4 (AM_PO_SUBDIRS): New variable POMAKEFILEDEPS. Substitute
index ca156c9432c5861f42483ab19d1608479ed6d00d..dffd1b65a080a4152154c2b4768df5fbc568cfb0 100644 (file)
@@ -8,9 +8,10 @@ aclocal_DATA = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4
 #   |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
 EXTRA_DIST = README \
 backupfile.m4 c-bs-a.m4 codeset.m4 error.m4 flex.m4 fnmatch.m4 gcj.m4 \
-getline.m4 gettext.m4 glibc21.m4 hostname.m4 iconv.m4 intdiv0.m4 inttypes.m4 \
-inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 javacomp.m4 javaexec.m4 \
-lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 libtool.m4 mbrtowc.m4 \
-mbstate_t.m4 mbswidth.m4 mkdtemp.m4 progtest.m4 setenv.m4 setlocale.m4 \
-siginfo.m4 signalblocking.m4 signed.m4 ssize_t.m4 stdbool.m4 stdint_h.m4 \
-tmpdir.m4 uintmax_t.m4 ulonglong.m4 unionwait.m4
+getline.m4 gettext.m4 glibc21.m4 hostname.m4 iconv.m4 intdiv0.m4 intmax.m4 \
+inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 javacomp.m4 \
+javaexec.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 libtool.m4 \
+longdouble.m4 longlong.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 \
+progtest.m4 setenv.m4 setlocale.m4 siginfo.m4 signalblocking.m4 signed.m4 \
+ssize_t.m4 stdbool.m4 stdint_h.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 \
+unionwait.m4 wchar_t.m4
diff --git a/m4/intmax.m4 b/m4/intmax.m4
new file mode 100644 (file)
index 0000000..431d25a
--- /dev/null
@@ -0,0 +1,32 @@
+# intmax.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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 system has the 'intmax_t' type, but don't attempt to
+dnl find a replacement if it is lacking.
+
+AC_DEFUN([gt_TYPE_INTMAX_T],
+[
+  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
+  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
+    [AC_TRY_COMPILE([
+#include <stddef.h> 
+#include <stdlib.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+#include <inttypes.h>
+#endif
+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+  if test $gt_cv_c_intmax_t = yes; then
+    AC_DEFINE(HAVE_INTMAX_T, 1,
+      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+  fi
+])
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4
new file mode 100644 (file)
index 0000000..056e60f
--- /dev/null
@@ -0,0 +1,30 @@
+# longdouble.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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 double' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_LONGDOUBLE],
+[
+  AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
+    [if test "$GCC" = yes; then
+       gt_cv_c_long_double=yes
+     else
+       AC_TRY_COMPILE([
+         /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
+         long double foo = 0.0;
+         /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
+         int array [2*(sizeof(long double) >= sizeof(double)) - 1];
+         ], ,
+         gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
+     fi])
+  if test $gt_cv_c_long_double = yes; then
+    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
+  fi
+])
diff --git a/m4/longlong.m4 b/m4/longlong.m4
new file mode 100644 (file)
index 0000000..92c1558
--- /dev/null
@@ -0,0 +1,27 @@
+# longlong.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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
+
+AC_DEFUN([gt_TYPE_LONGLONG],
+[
+  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.])
+  fi
+])
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4
new file mode 100644 (file)
index 0000000..ef42220
--- /dev/null
@@ -0,0 +1,22 @@
+# wchar_t.m4 serial 1 (gettext-0.11.6)
+dnl Copyright (C) 2002 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 <stddef.h> has the 'wchar_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WCHAR_T],
+[
+  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
+    [AC_TRY_COMPILE([#include <stddef.h>
+       wchar_t foo = (wchar_t)'\0';], ,
+       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
+  if test $gt_cv_c_wchar_t = yes; then
+    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
+  fi
+])
index 6b34f93bbf915bb3078767eb0ca5bdf707353fe7..f8aab57ad33ec83aecacda988e5e6e454743740e 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-27  Bruno Haible  <bruno@clisp.org>
+
+       * lang-c++: Include "autosprintf.h". Do output to cout, not stdout.
+       Link with libasprintf. Link in two steps.
+
 2002-10-27  Bruno Haible  <bruno@clisp.org>
 
        * msgmerge-16: Change expected result to match msgmerge behaviour
index 430fe274757a0fb75f57901da860462896405e5d..3750ea38f36739785090f9f63aab7022f094997d 100755 (executable)
@@ -29,6 +29,8 @@ using namespace std;
 #include <stdio.h>
 #include <stdlib.h>
 #include "xsetenv.h"
+#include "autosprintf.h"
+using gnu::autosprintf;
 #define _(string) gettext (string)
 
 int main (int argc, char *argv[])
@@ -47,11 +49,10 @@ int main (int argc, char *argv[])
 
   cout << _("'Your command, please?', asked the waiter.") << endl;
 
-  printf (ngettext ("a piece of cake", "%d pieces of cake", n), n);
-  printf ("\n");
+  cout << autosprintf (ngettext ("a piece of cake", "%d pieces of cake", n), n)
+       << endl;
 
-  printf (_("%s is replaced by %s."), "FF", "EUR");
-  printf ("\n");
+  cout << autosprintf (_("%s is replaced by %s."), "FF", "EUR") << endl;
 }
 EOF
 
@@ -59,7 +60,11 @@ EOF
 top_builddir=..
 
 tmpfiles="$tmpfiles prog.${OBJEXT} prog${EXEEXT}"
-${LIBTOOL} --quiet --mode=link ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.cc -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${LTLIBINTL} \
+# Compile in two steps from .cc to .o and from .o to 'prog'. This way,
+# relinking is faster because doesn't need to redo the first step.
+${CXX} ${CXXFLAGS} ${CPPFLAGS} -c prog.cc -I.. -I$top_srcdir/libasprintf -I$top_srcdir/lib -I../intl \
+  || exit 1
+${LIBTOOL} --quiet --mode=link ${CXX} ${CXXFLAGS} ${LDFLAGS} -o prog prog.${OBJEXT} ../libasprintf/libasprintf.la ../lib/libgettextlib.la ${LTLIBINTL} \
   || exit 1
 
 tmpfiles="$tmpfiles prog.pot"