Add libasprintf subpackage.

This commit is contained in:
Bruno Haible 2002-10-28 13:18:01 +00:00
parent aae1f6d248
commit 8c68133ecd
14 changed files with 183 additions and 16 deletions

View File

@ -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.

View 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 \

View File

@ -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/*

View 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 \

View 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

View 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

View 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

View 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

32
m4/intmax.m4 Normal file
View File

@ -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
])

30
m4/longdouble.m4 Normal file
View File

@ -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
])

27
m4/longlong.m4 Normal file
View File

@ -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
])

22
m4/wchar_t.m4 Normal file
View File

@ -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
])

View 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

View File

@ -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"