From: Bruno Haible Date: Mon, 28 Oct 2002 13:18:01 +0000 (+0000) Subject: Add libasprintf subpackage. X-Git-Tag: v0.12~1257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c68133ecd43a561d80b060249a5c4e128763ee8;p=thirdparty%2Fgettext.git Add libasprintf subpackage. --- diff --git a/ChangeLog b/ChangeLog index 8423595df..0ce716240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-10-27 Bruno Haible + + * 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 * PACKAGING: Update list of installed .m4 files. diff --git a/Makefile.am b/Makefile.am index 8e100fb80..74ff5a2a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/PACKAGING b/PACKAGING index 779ec6aaa..fafad36a9 100644 --- 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/* diff --git a/configure.in b/configure.in index 7a844d59c..76d51e338 100644 --- a/configure.in +++ b/configure.in @@ -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 \ diff --git a/doc/ChangeLog b/doc/ChangeLog index 09a0f56b7..8c316ef79 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2002-10-27 Bruno Haible + + * gettext.texi (C): Add reference to autosprintf for C++. + 2002-10-27 Bruno Haible * gettext.texi (@direntry): Add more entry points: one for every diff --git a/doc/gettext.texi b/doc/gettext.texi index 1bcc7edc2..da9d5089c 100644 --- a/doc/gettext.texi +++ b/doc/gettext.texi @@ -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 diff --git a/m4/ChangeLog b/m4/ChangeLog index ee8b35794..c90b25efb 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2002-10-27 Bruno Haible + + * 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 * gettext.m4 (AM_PO_SUBDIRS): New variable POMAKEFILEDEPS. Substitute diff --git a/m4/Makefile.am b/m4/Makefile.am index ca156c943..dffd1b65a 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -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 index 000000000..431d25aab --- /dev/null +++ b/m4/intmax.m4 @@ -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 +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#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 or .]) + fi +]) diff --git a/m4/longdouble.m4 b/m4/longdouble.m4 new file mode 100644 index 000000000..056e60f0c --- /dev/null +++ b/m4/longdouble.m4 @@ -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 index 000000000..92c1558c8 --- /dev/null +++ b/m4/longlong.m4 @@ -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 index 000000000..ef422203d --- /dev/null +++ b/m4/wchar_t.m4 @@ -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 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 + 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 +]) diff --git a/tests/ChangeLog b/tests/ChangeLog index 6b34f93bb..f8aab57ad 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2002-10-27 Bruno Haible + + * lang-c++: Include "autosprintf.h". Do output to cout, not stdout. + Link with libasprintf. Link in two steps. + 2002-10-27 Bruno Haible * msgmerge-16: Change expected result to match msgmerge behaviour diff --git a/tests/lang-c++ b/tests/lang-c++ index 430fe2747..3750ea38f 100755 --- a/tests/lang-c++ +++ b/tests/lang-c++ @@ -29,6 +29,8 @@ using namespace std; #include #include #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"