From: Ludovic Courtès Date: Tue, 17 Nov 2009 21:03:13 +0000 (+0100) Subject: Use Gnulib's `version-etc-fsf' for `--version' and `--help' output. X-Git-Url: http://git.hcoop.net/bpt/guile.git/commitdiff_plain/4f02b98d0ed4a314916c69a225d7a45dda3f5f8c Use Gnulib's `version-etc-fsf' for `--version' and `--help' output. * m4/gnulib-cache.m4: Add `version-etc-fsf'. Switch to LGPLv3+. * GUILE-VERSION (PACKAGE): Change to "GNU Guile". * Makefile.am (distdir): New variable. * libguile/script.c (scm_shell_usage): Improve formatting. Use `emit_bug_reporting_address ()'. (scm_compile_shell_switches): Use `version_etc ()'. --- diff --git a/GUILE-VERSION b/GUILE-VERSION index 7ec8d742b..a7942a188 100644 --- a/GUILE-VERSION +++ b/GUILE-VERSION @@ -9,7 +9,7 @@ GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION} # For automake. VERSION=${GUILE_VERSION} -PACKAGE=guile +PACKAGE="GNU Guile" # All of the shared lib versioning info. Right now, for this to work # properly, you'll also need to add AC_SUBST calls to the right place diff --git a/Makefile.am b/Makefile.am index 80231bb37..679329958 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,10 @@ ACLOCAL_AMFLAGS = -I m4 DISTCLEANFILES = check-guile.log +# Help Automake choose the right directory name (Automake 1.11 uses +# `$(PACKAGE)-$(PACKAGE_VERSION)' by default, which is wrong.) +distdir = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) + dist-hook: gen-ChangeLog clean-local: diff --git a/lib/Makefile.am b/lib/Makefile.am index 284ed16d9..248d777b5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects @@ -267,6 +267,12 @@ libgnu_la_SOURCES += full-write.h full-write.c ## end gnulib module full-write +## begin gnulib module gettext-h + +libgnu_la_SOURCES += gettext.h + +## end gnulib module gettext-h + ## begin gnulib module gperf GPERF = gperf @@ -590,6 +596,27 @@ EXTRA_libgnu_la_SOURCES += stat.c ## end gnulib module stat +## begin gnulib module stdarg + +BUILT_SOURCES += $(STDARG_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdarg.h: stdarg.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ + < $(srcdir)/stdarg.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += stdarg.h stdarg.h-t + +EXTRA_DIST += stdarg.in.h + +## end gnulib module stdarg + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) @@ -834,8 +861,9 @@ stdlib.h: stdlib.in.h -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ + -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ - -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \ + -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/stdlib.in.h; \ } > $@-t && \ @@ -1319,6 +1347,18 @@ libgnu_la_SOURCES += verify.h ## end gnulib module verify +## begin gnulib module version-etc + +libgnu_la_SOURCES += version-etc.h version-etc.c + +## end gnulib module version-etc + +## begin gnulib module version-etc-fsf + +libgnu_la_SOURCES += version-etc-fsf.c + +## end gnulib module version-etc-fsf + ## begin gnulib module vsnprintf diff --git a/lib/gettext.h b/lib/gettext.h new file mode 100644 index 000000000..72c8727f2 --- /dev/null +++ b/lib/gettext.h @@ -0,0 +1,279 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# undef gettext +# define gettext(Msgid) ((const char *) (Msgid)) +# undef dgettext +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# undef dcgettext +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# undef dngettext +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# undef dcngettext +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) +# undef textdomain +# define textdomain(Domainname) ((const char *) (Domainname)) +# undef bindtextdomain +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# undef bind_textdomain_codeset +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ + (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ + /* || __STDC_VERSION__ >= 199901L */ ) + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (translation != msg_ctxt_id) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (!(translation == msg_ctxt_id || translation == msgid_plural)) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + +#endif /* _LIBGETTEXT_H */ diff --git a/lib/printf-args.c b/lib/printf-args.c index c31d2042e..75af607a6 100644 --- a/lib/printf-args.c +++ b/lib/printf-args.c @@ -1,5 +1,6 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005-2007, 2009 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -89,7 +90,7 @@ PRINTF_FETCHARGS (va_list args, arguments *a) where wint_t is 'unsigned short'. */ ap->a.a_wide_char = (sizeof (wint_t) < sizeof (int) - ? va_arg (args, int) + ? (wint_t) va_arg (args, int) : va_arg (args, wint_t)); break; #endif diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h new file mode 100644 index 000000000..873e6c0c3 --- /dev/null +++ b/lib/stdarg.in.h @@ -0,0 +1,35 @@ +/* Substitute for and wrapper around . + Copyright (C) 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_STDARG_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDARG_H@ + +#ifndef _GL_STDARG_H +#define _GL_STDARG_H + +#ifndef va_copy +# define va_copy(a,b) ((a) = (b)) +#endif + +#endif /* _GL_STDARG_H */ +#endif /* _GL_STDARG_H */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 5e5550fce..61076cb93 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -384,11 +384,21 @@ extern int rpmatch (const char *response); #endif #if @GNULIB_SETENV@ -# if !@HAVE_SETENV@ +# if @REPLACE_SETENV@ +# undef setenv +# define setenv rpl_setenv +# endif +# if !@HAVE_SETENV@ || @REPLACE_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ extern int setenv (const char *name, const char *value, int replace); # endif +#elif defined GNULIB_POSIXCHECK +# undef setenv +# define setenv(n,v,o) \ + (GL_LINK_WARNING ("setenv is unportable - " \ + "use gnulib module setenv for portability"), \ + setenv (n, v, o)) #endif #if @GNULIB_STRTOD@ @@ -448,16 +458,20 @@ extern unsigned long long strtoull (const char *string, char **endptr, int base) #endif #if @GNULIB_UNSETENV@ -# if @HAVE_UNSETENV@ -# if @VOID_UNSETENV@ -/* On some systems, unsetenv() returns void. - This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ -# define unsetenv(name) ((unsetenv)(name), 0) -# endif -# else +# if @REPLACE_UNSETENV@ +# undef unsetenv +# define unsetenv rpl_unsetenv +# endif +# if !@HAVE_UNSETENV@ || @REPLACE_UNSETENV@ /* Remove the variable NAME from the environment. */ extern int unsetenv (const char *name); # endif +#elif defined GNULIB_POSIXCHECK +# undef unsetenv +# define unsetenv(n) \ + (GL_LINK_WARNING ("unsetenv is unportable - " \ + "use gnulib module unsetenv for portability"), \ + unsetenv (n)) #endif #ifdef __cplusplus diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index da43901fc..6495c7c78 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -2375,16 +2375,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; while (precision > 0) { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg_end == 0) /* Found the terminating null wide character. */ break; # if HAVE_WCRTOMB - count = wcrtomb (buf, *arg_end, &state); + count = wcrtomb (cbuf, *arg_end, &state); # else - count = wctomb (buf, *arg_end); + count = wctomb (cbuf, *arg_end); # endif if (count < 0) { @@ -2420,16 +2420,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; for (;;) { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg_end == 0) /* Found the terminating null wide character. */ break; # if HAVE_WCRTOMB - count = wcrtomb (buf, *arg_end, &state); + count = wcrtomb (cbuf, *arg_end, &state); # else - count = wctomb (buf, *arg_end); + count = wctomb (cbuf, *arg_end); # endif if (count < 0) { @@ -2470,20 +2470,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, # endif for (remaining = characters; remaining > 0; ) { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); # if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif if (count <= 0) /* Inconsistency. */ abort (); - memcpy (tmpptr, buf, count); + memcpy (tmpptr, cbuf, count); tmpptr += count; arg++; remaining -= count; @@ -2552,20 +2552,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, ENSURE_ALLOCATION (xsum (length, characters)); for (remaining = characters; remaining > 0; ) { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); # if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif if (count <= 0) /* Inconsistency. */ abort (); - memcpy (result + length, buf, count); + memcpy (result + length, cbuf, count); length += count; arg++; remaining -= count; @@ -2581,21 +2581,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, # endif while (arg < arg_end) { - char buf[64]; /* Assume MB_CUR_MAX <= 64. */ + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; if (*arg == 0) abort (); # if HAVE_WCRTOMB - count = wcrtomb (buf, *arg, &state); + count = wcrtomb (cbuf, *arg, &state); # else - count = wctomb (buf, *arg); + count = wctomb (cbuf, *arg); # endif if (count <= 0) /* Inconsistency. */ abort (); ENSURE_ALLOCATION (xsum (length, count)); - memcpy (result + length, buf, count); + memcpy (result + length, cbuf, count); length += count; arg++; } diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c new file mode 100644 index 000000000..efbb37eb6 --- /dev/null +++ b/lib/version-etc-fsf.c @@ -0,0 +1,30 @@ +/* Variable with FSF copyright information, for version-etc. + Copyright (C) 1999-2006 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Jim Meyering. */ + +#include + +/* Specification. */ +#include "version-etc.h" + +/* Default copyright goes to the FSF. */ + +const char version_etc_copyright[] = + /* Do *not* mark this string for translation. %s is a copyright + symbol suitable for this locale, and %d is the copyright + year. */ + "Copyright %s %d Free Software Foundation, Inc."; diff --git a/lib/version-etc.c b/lib/version-etc.c new file mode 100644 index 000000000..4f9de4800 --- /dev/null +++ b/lib/version-etc.c @@ -0,0 +1,252 @@ +/* Print --version and bug-reporting information in a consistent format. + Copyright (C) 1999-2009 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Jim Meyering. */ + +#include + +/* Specification. */ +#include "version-etc.h" + +#include +#include +#include + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +enum { COPYRIGHT_YEAR = 2009 }; + +/* The three functions below display the --version information the + standard way. + + If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of + the program. The formats are therefore: + + PACKAGE VERSION + + or + + COMMAND_NAME (PACKAGE) VERSION. + + The functions differ in the way they are passed author names. */ + +/* Display the --version information the standard way. + + Author names are given in the array AUTHORS. N_AUTHORS is the + number of elements in the array. */ +void +version_etc_arn (FILE *stream, + const char *command_name, const char *package, + const char *version, + const char * const * authors, size_t n_authors) +{ + if (command_name) + fprintf (stream, "%s (%s) %s\n", command_name, package, version); + else + fprintf (stream, "%s %s\n", package, version); + +#ifdef PACKAGE_PACKAGER +# ifdef PACKAGE_PACKAGER_VERSION + fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER, + PACKAGE_PACKAGER_VERSION); +# else + fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER); +# endif +#endif + + /* TRANSLATORS: Translate "(C)" to the copyright symbol + (C-in-a-circle), if this symbol is available in the user's + locale. Otherwise, do not translate "(C)"; leave it as-is. */ + fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR); + + fputs (_("\ +\n\ +License GPLv3+: GNU GPL version 3 or later .\n\ +This is free software: you are free to change and redistribute it.\n\ +There is NO WARRANTY, to the extent permitted by law.\n\ +\n\ +"), + stream); + + switch (n_authors) + { + case 0: + /* The caller must provide at least one author name. */ + abort (); + case 1: + /* TRANSLATORS: %s denotes an author name. */ + fprintf (stream, _("Written by %s.\n"), authors[0]); + break; + case 2: + /* TRANSLATORS: Each %s denotes an author name. */ + fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]); + break; + case 3: + /* TRANSLATORS: Each %s denotes an author name. */ + fprintf (stream, _("Written by %s, %s, and %s.\n"), + authors[0], authors[1], authors[2]); + break; + case 4: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), + authors[0], authors[1], authors[2], authors[3]); + break; + case 5: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4]); + break; + case 6: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4], + authors[5]); + break; + case 7: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4], + authors[5], authors[6]); + break; + case 8: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("\ +Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4], + authors[5], authors[6], authors[7]); + break; + case 9: + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("\ +Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4], + authors[5], authors[6], authors[7], authors[8]); + break; + default: + /* 10 or more authors. Use an abbreviation, since the human reader + will probably not want to read the entire list anyway. */ + /* TRANSLATORS: Each %s denotes an author name. + You can use line breaks, estimating that each author name occupies + ca. 16 screen columns and that a screen line has ca. 80 columns. */ + fprintf (stream, _("\ +Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"), + authors[0], authors[1], authors[2], authors[3], authors[4], + authors[5], authors[6], authors[7], authors[8]); + break; + } +} + +/* Display the --version information the standard way. See the initial + comment to this module, for more information. + + Author names are given in the NULL-terminated array AUTHORS. */ +void +version_etc_ar (FILE *stream, + const char *command_name, const char *package, + const char *version, const char * const * authors) +{ + size_t n_authors; + + for (n_authors = 0; authors[n_authors]; n_authors++) + ; + version_etc_arn (stream, command_name, package, version, authors, n_authors); +} + +/* Display the --version information the standard way. See the initial + comment to this module, for more information. + + Author names are given in the NULL-terminated va_list AUTHORS. */ +void +version_etc_va (FILE *stream, + const char *command_name, const char *package, + const char *version, va_list authors) +{ + size_t n_authors; + const char *authtab[10]; + + for (n_authors = 0; + n_authors < 10 + && (authtab[n_authors] = va_arg (authors, const char *)) != NULL; + n_authors++) + ; + version_etc_arn (stream, command_name, package, version, + authtab, n_authors); +} + + +/* Display the --version information the standard way. + + If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of + the program. The formats are therefore: + + PACKAGE VERSION + + or + + COMMAND_NAME (PACKAGE) VERSION. + + The authors names are passed as separate arguments, with an additional + NULL argument at the end. */ +void +version_etc (FILE *stream, + const char *command_name, const char *package, + const char *version, /* const char *author1, ...*/ ...) +{ + va_list authors; + + va_start (authors, version); + version_etc_va (stream, command_name, package, version, authors); + va_end (authors); +} + +void +emit_bug_reporting_address (void) +{ + /* TRANSLATORS: The placeholder indicates the bug-reporting address + for this package. Please add _another line_ saying + "Report translation bugs to <...>\n" with the address for translation + bugs (typically your translation team's web or email address). */ + printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT); +#ifdef PACKAGE_PACKAGER_BUG_REPORTS + printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER, + PACKAGE_PACKAGER_BUG_REPORTS); +#endif +#ifdef PACKAGE_URL + printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL); +#else + printf (_("%s home page: \n"), + PACKAGE_NAME, PACKAGE); +#endif + fputs (_("General help using GNU software: \n"), + stdout); +} diff --git a/lib/version-etc.h b/lib/version-etc.h new file mode 100644 index 000000000..bd427b04c --- /dev/null +++ b/lib/version-etc.h @@ -0,0 +1,78 @@ +/* Print --version and bug-reporting information in a consistent format. + Copyright (C) 1999, 2003, 2005, 2009 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Jim Meyering. */ + +#ifndef VERSION_ETC_H +# define VERSION_ETC_H 1 + +# include +# include + +/* The `sentinel' attribute was added in gcc 4.0. */ +#ifndef ATTRIBUTE_SENTINEL +# if 4 <= __GNUC__ +# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# else +# define ATTRIBUTE_SENTINEL /* empty */ +# endif +#endif + +extern const char version_etc_copyright[]; + +/* The three functions below display the --version information in the + standard way: command and package names, package version, followed + by a short GPLv3+ notice and a list of up to 10 author names. + + If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of + the program. The formats are therefore: + + PACKAGE VERSION + + or + + COMMAND_NAME (PACKAGE) VERSION. + + The functions differ in the way they are passed author names: */ + +/* N_AUTHORS names are supplied in array AUTHORS. */ +extern void version_etc_arn (FILE *stream, + const char *command_name, const char *package, + const char *version, + const char * const * authors, size_t n_authors); + +/* Names are passed in the NULL-terminated array AUTHORS. */ +extern void version_etc_ar (FILE *stream, + const char *command_name, const char *package, + const char *version, const char * const * authors); + +/* Names are passed in the NULL-terminated va_list. */ +extern void version_etc_va (FILE *stream, + const char *command_name, const char *package, + const char *version, va_list authors); + +/* Names are passed as separate arguments, with an additional + NULL argument at the end. */ +extern void version_etc (FILE *stream, + const char *command_name, const char *package, + const char *version, + /* const char *author1, ..., NULL */ ...) + ATTRIBUTE_SENTINEL; + +/* Display the usual `Report bugs to' stanza */ +extern void emit_bug_reporting_address (void); + +#endif /* VERSION_ETC_H */ diff --git a/libguile/script.c b/libguile/script.c index 8c4e8ef55..89ff7a0c4 100644 --- a/libguile/script.c +++ b/libguile/script.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 3 of @@ -26,6 +26,8 @@ #include #include +#include + #include "libguile/_scm.h" #include "libguile/eval.h" #include "libguile/feature.h" @@ -358,13 +360,13 @@ scm_shell_usage (int fatal, char *message) if (message) fprintf (fp, "%s\n", message); - fprintf (fp, - "Usage: %s OPTION ...\n" + fprintf (fp, + "Usage: %s [OPTION]... [FILE]...\n" "Evaluate Scheme code, interactively or from a script.\n" "\n" " [-s] FILE load Scheme source code from FILE, and exit\n" " -c EXPR evalute Scheme expression EXPR, and exit\n" - " -- stop scanning arguments; run interactively\n" + " -- stop scanning arguments; run interactively\n\n" "The above switches stop argument processing, and pass all\n" "remaining arguments as the value of (command-line).\n" "If FILE begins with `-' the -s switch is mandatory.\n" @@ -388,11 +390,11 @@ scm_shell_usage (int fatal, char *message) " which is a list of numbers like \"2,13,14\"\n" " -h, --help display this help and exit\n" " -v, --version display version information and exit\n" - " \\ read arguments from following script lines\n" - "\n" - "Please report bugs to bug-guile@gnu.org\n", + " \\ read arguments from following script lines\n", scm_usage_name); + emit_bug_reporting_address (); + if (fatal) exit (fatal); } @@ -656,13 +658,9 @@ scm_compile_shell_switches (int argc, char **argv) || ! strcmp (argv[i], "--version")) { /* Print version number. */ - printf ("Guile %s\n" - "Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation\n" - "Guile may be distributed under the terms of the GNU General Public Licence;\n" - "certain other uses are permitted as well. For details, see the file\n" - "`COPYING', which is included in the Guile distribution.\n" - "There is no warranty, to the extent permitted by law.\n", - scm_to_locale_string (scm_version ())); + version_etc (stdout, scm_usage_name, PACKAGE_NAME, PACKAGE_VERSION, + /* XXX: Use gettext for the string below. */ + "the Guile developers", NULL); exit (0); } diff --git a/m4/environ.m4 b/m4/environ.m4 index b17bb60a7..180382020 100644 --- a/m4/environ.m4 +++ b/m4/environ.m4 @@ -1,10 +1,10 @@ -# environ.m4 serial 2 +# environ.m4 serial 3 dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_ENVIRON], +AC_DEFUN_ONCE([gl_ENVIRON], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl Persuade glibc to declare environ. diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 9867d8619..aa094c90e 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify vsnprintf warnings +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -45,6 +45,7 @@ gl_MODULES([ striconveh string verify + version-etc-fsf vsnprintf warnings ]) @@ -55,7 +56,7 @@ gl_PO_BASE([]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libgnu]) -gl_LGPL +gl_LGPL([3]) gl_MAKEFILE_NAME([]) gl_LIBTOOL gl_MACRO_PREFIX([gl]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 869016005..a4ae1d284 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -29,6 +29,11 @@ AC_DEFUN([gl_EARLY], AB_INIT AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_FP_IEEE]) + dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode + dnl for the builtin va_copy to work. With Autoconf 2.60 or later, + dnl AC_PROG_CC_STDC arranges for this. With older Autoconf AC_PROG_CC_STDC + dnl shouldn't hurt, though installers are on their own to set c99 mode. + AC_REQUIRE([AC_PROG_CC_STDC]) ]) # This macro should be invoked from ./configure.ac, in the section @@ -58,6 +63,8 @@ AC_DEFUN([gl_INIT], gl_FLOAT_H gl_FUNC_FLOCK gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock]) + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) AM_ICONV gl_ICONV_H gl_FUNC_ICONV_OPEN @@ -101,6 +108,7 @@ AC_DEFUN([gl_INIT], gt_TYPE_SSIZE_T gl_FUNC_STAT gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_STDARG_H AM_STDBOOL_H gl_STDDEF_H gl_STDINT_H @@ -128,6 +136,7 @@ AC_DEFUN([gl_INIT], gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) gl_MODULE_INDICATOR([unistr/u8-uctomb]) gl_FUNC_VASNPRINTF + gl_VERSION_ETC gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) AC_SUBST([WARN_CFLAGS]) @@ -286,6 +295,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/full-read.h lib/full-write.c lib/full-write.h + lib/gettext.h lib/iconv.c lib/iconv.in.h lib/iconv_close.c @@ -326,6 +336,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/safe-write.h lib/size_max.h lib/stat.c + lib/stdarg.in.h lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h @@ -360,6 +371,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/vasnprintf.c lib/vasnprintf.h lib/verify.h + lib/version-etc-fsf.c + lib/version-etc.c + lib/version-etc.h lib/vsnprintf.c lib/wchar.in.h lib/write.c @@ -424,6 +438,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sockpfaf.m4 m4/ssize_t.m4 m4/stat.m4 + m4/stdarg.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 @@ -442,6 +457,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/tm_gmtoff.m4 m4/unistd_h.m4 m4/vasnprintf.m4 + m4/version-etc.m4 m4/visibility.m4 m4/vsnprintf.m4 m4/warnings.m4 diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 new file mode 100644 index 000000000..a9ada4f4e --- /dev/null +++ b/m4/stdarg.m4 @@ -0,0 +1,67 @@ +# stdarg.m4 serial 3 +dnl Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Provide a working va_copy in combination with . + +AC_DEFUN([gl_STDARG_H], +[ + STDARG_H=''; AC_SUBST([STDARG_H]) + NEXT_STDARG_H=''; AC_SUBST([NEXT_STDARG_H]) + AC_MSG_CHECKING([for va_copy]) + AC_CACHE_VAL([gl_cv_func_va_copy], [ + AC_TRY_COMPILE([#include ], [ +#ifndef va_copy +void (*func) (va_list, va_list) = va_copy; +#endif +], + [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])]) + AC_MSG_RESULT([$gl_cv_func_va_copy]) + if test $gl_cv_func_va_copy = no; then + dnl Provide a substitute. + dnl Usually a simple definition in is enough. Not so on AIX 5 + dnl with some versions of the /usr/vac/bin/cc compiler. It has an + dnl which does '#undef va_copy', leading to a missing va_copy symbol. For + dnl this platform, we use an substitute. But we cannot use this + dnl approach on other platforms, because often defines only + dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do + dnl not work in this situation. + AC_EGREP_CPP([vaccine], + [#if defined _AIX && !defined __GNUC__ + AIX vaccine + #endif + ], [gl_aixcc=yes], [gl_aixcc=no]) + if test $gl_aixcc = yes; then + dnl Provide a substitute file. + STDARG_H=stdarg.h + gl_CHECK_NEXT_HEADERS([stdarg.h]) + dnl Fallback for the case when contains only macro definitions. + if test "$gl_cv_next_stdarg_h" = '""'; then + gl_cv_next_stdarg_h='"///usr/include/stdarg.h"' + NEXT_STDARG_H="$gl_cv_next_stdarg_h" + fi + else + dnl Provide a substitute in , either __va_copy or as a simple + dnl assignment. + gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ + AC_TRY_COMPILE([#include ], [ +#ifndef __va_copy +error, bail out +#endif +], + [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])]) + if test $gl_cv_func___va_copy = yes; then + AC_DEFINE([va_copy], [__va_copy], + [Define as a macro for copying va_list variables.]) + else + AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */ +#define gl_va_copy(a,b) ((a) = (b))]) + AC_DEFINE([va_copy], [gl_va_copy], + [Define as a macro for copying va_list variables.]) + fi + fi + fi +]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 4556ac04c..10e010e42 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -80,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) + REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) - VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) + REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) ]) diff --git a/m4/version-etc.m4 b/m4/version-etc.m4 new file mode 100644 index 000000000..14d6eb6dc --- /dev/null +++ b/m4/version-etc.m4 @@ -0,0 +1,33 @@ +# version-etc.m4 serial 1 +# Copyright (C) 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl $1 - configure flag and define name +dnl $2 - human readable description +m4_define([gl_VERSION_ETC_FLAG], +[dnl + AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])], + [dnl + case $withval in + yes|no) ;; + *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;; + esac + ]) +]) + +AC_DEFUN([gl_VERSION_ETC], +[dnl + gl_VERSION_ETC_FLAG([packager], + [String identifying the packager of this software]) + gl_VERSION_ETC_FLAG([packager-version], + [Packager-specific version information]) + gl_VERSION_ETC_FLAG([packager-bug-reports], + [Packager info for bug reports (URL/e-mail/...)]) + if test "X$with_packager" = "X" && \ + test "X$with_packager_version$with_packager_bug_reports" != "X" + then + AC_MSG_ERROR([The --with-packager-{bug-reports,version} options require --with-packager]) + fi +])