From c392c19335891fddcb446e63cbe6aa43b4f4b3a2 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 14 Jun 2000 22:29:30 +0000 Subject: * More fixes for configuring gettext correctly. --- ChangeLog | 11 +++++++ acconfig.h | 12 -------- acinclude.m4 | 98 +++++++++++++++++++++++++++++++++++++++++++----------------- configure.in | 12 ++++---- file.c | 2 +- gettext.h | 18 ++--------- make.h | 19 +++++++++++- 7 files changed, 111 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index df101bb..f4885bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-06-14 Paul D. Smith + + * acinclude.m4 (pds_WITH_GETTEXT): rewrite fp_WITH_GETTEXT and + rename it to avoid confusion. This version is very specific: it + won't accept any gettext that isn't GNU. If the user doesn't + explicitly ask for the included gettext, we look to see if the + system gettext is GNU (testing both the actual libintl library, + and the libintl.h header file). Only if the system gettext is + really GNU gettext will we allow it to be used. + (pds_CHECK_SYSTEM_GETTEXT): A helper function. + 2000-06-13 Paul D. Smith * gettext.h: If we have libintl.h, use that instead of any of the diff --git a/acconfig.h b/acconfig.h index 5ac77ff..c656057 100644 --- a/acconfig.h +++ b/acconfig.h @@ -4,9 +4,6 @@ /* Version of this package (needed by automake) */ #undef VERSION -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES @@ -16,12 +13,6 @@ /* Define to the name of the SCCS `get' command. */ #undef SCCS_GET -/* Define this if the SCCS `get' command understands the `-G' option. */ -#undef SCCS_GET_MINUS_G - -/* Define this to enable job server support in GNU make. */ -#undef MAKE_JOBSERVER - /* Define to be the nanoseconds member of struct stat's st_mtim, if it exists. */ #undef ST_MTIM_NSEC @@ -32,9 +23,6 @@ /* Define this if the C library defines the variable `_sys_siglist'. */ #undef HAVE__SYS_SIGLIST -/* Define this if you have the `union wait' type in . */ -#undef HAVE_UNION_WAIT - /* Define to `unsigned long' or `unsigned long long' if doesn't define. */ #undef uintmax_t diff --git a/acinclude.m4 b/acinclude.m4 index e267b70..ad58ef6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -485,11 +485,62 @@ esac dnl --------------------------------------------------------------------------- dnl Enable internationalization support for GNU make. -dnl Obtained from the libit 0.7 distribution -dnl Modified to check for a system version of GNU gettext by -dnl Paul D. Smith +dnl Original obtained from the libit 0.7 distribution +dnl Rewritten by Paul D. Smith +dnl This version is much more straightforward than the original (I think); +dnl If the user doesn't disable NLS, check whether she asked for the +dnl included gettext. If so, we use that. If not, test to see if the +dnl system gettext is GNU. If not, use the included gettext. If so, +dnl use the system gettext. We are very strict about testing for GNU +dnl gettext; not only must the library be GNU gettext, but the libintl.h +dnl file must also be GNU. dnl -AC_DEFUN(fp_WITH_GETTEXT, [ +AC_DEFUN(pds_CHECK_SYSTEM_GETTEXT, [ + + # OK. What we're going to do is see if the system gettext is really + # GNU gettext, and we're going to make _sure_ (as we can) that if + # it's not we'll use the included gettext. + + pds_keep_LIBS="$LIBS" + + # Look around for gettext() and libintl.h on the system + AC_CHECK_HEADERS(locale.h) + AC_SEARCH_LIBS(gettext, intl) + if test "$ac_cv_search_gettext" = no; then + with_included_gettext=yes + + else + # We only want to deal with GNU's gettext; if we don't have that + # we'll just use our own, thanks very much. + AC_CACHE_CHECK([whether system uses GNU gettext], + pds_cv_system_gnu_gettext, [ + AC_TRY_LINK([ +#include +#ifdef HAVE_LOCALE_H +#include +#endif +], [ +#if __USE_GNU_GETTEXT + extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr; +#else +not GNU gettext +#endif +], + pds_cv_system_gnu_gettext=yes, pds_cv_system_gnu_gettext=no)]) + + if test "x$pds_cv_system_gnu_gettext" = xyes; then + with_included_gettext=no + AC_DEFINE(HAVE_LIBINTL_H, 1, [Define if you have .]) + else + with_included_gettext=yes + LIBS="$fp_keep_LIBS" + fi + fi +]) + + +AC_DEFUN(pds_WITH_GETTEXT, [ AC_MSG_CHECKING(whether NLS is wanted) AC_ARG_ENABLE(nls, @@ -500,41 +551,34 @@ AC_DEFUN(fp_WITH_GETTEXT, [ AM_CONDITIONAL(USE_NLS, test $use_nls = yes) if test $enable_nls = yes; then - AC_DEFINE(ENABLE_NLS) + AC_DEFINE(ENABLE_NLS, 1, [Define if NLS is requested.]) # We don't support catgets at all if test "x$with_catgets" != x; then - AC_MSG_WARN([catgets not supported, --with-catgets ignored]) + AC_MSG_WARN([catgets not supported; --with-catgets ignored]) fi - fp_keep_LIBS="$LIBS" + # Find out what the user wants. - # Look around for gettext() on the system - AC_SEARCH_LIBS(gettext, intl) - if test "$ac_cv_search_gettext" = no; then - with_included_gettext=yes - else - # We only want to deal with GNU's gettext; if we don't have that - # we'll just use our own, thanks very much. - AC_MSG_CHECKING(for GNU gettext) - AC_TRY_LINK(,[extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr;], - with_included_gettext=no, with_included_gettext=yes) - case "$with_included_gettext" in - no) AC_MSG_RESULT(yes) ;; - yes) AC_MSG_RESULT([no; using local copy]); LIBS="$fp_keep_LIBS" ;; - esac + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + with_included_gettext=yes, + with_included_gettext=maybe) + + if test "x$with_included_gettext" != xyes; then + pds_CHECK_SYSTEM_GETTEXT fi + AC_MSG_CHECKING([whether to use included gettext]) + AC_MSG_RESULT($with_included_gettext) + if test "$with_included_gettext" = yes; then LIBOBJS="$LIBOBJS gettext.o" - AC_DEFINE(HAVE_GETTEXT, 1, [Define if you have the gettext function.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if you have the dcgettext function.]) - else - AC_CHECK_HEADERS(libintl.h) - AC_CHECK_FUNCS(dcgettext gettext) fi - AC_CHECK_HEADERS(locale.h) + AC_DEFINE(HAVE_GETTEXT, 1, [Define if you have the gettext function.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if you have the dcgettext function.]) + AC_CHECK_FUNCS(getcwd setlocale stpcpy) AM_LC_MESSAGES diff --git a/configure.in b/configure.in index 37a755b..97c2874 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_REVISION([$Id$]) AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AM_INIT_AUTOMAKE(make, 3.79.1) +AM_INIT_AUTOMAKE(make, 3.79.0.1) AM_CONFIG_HEADER(config.h) dnl Regular configure stuff @@ -43,7 +43,7 @@ AC_HEADER_TIME dnl Handle internationalization ALL_LINGUAS="de es fr ja ko nl pl pt_BR ru" -fp_WITH_GETTEXT +pds_WITH_GETTEXT AC_STRUCT_ST_MTIM_NSEC jm_AC_TYPE_UINTMAX_T @@ -133,7 +133,7 @@ pid = waitpid (-1, &status, 0); ], [make_cv_union_wait=yes], [make_cv_union_wait=no])]) if test "$make_cv_union_wait" = yes; then - AC_DEFINE(HAVE_UNION_WAIT) + AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in .]) fi AC_MSG_RESULT($make_cv_union_wait) @@ -177,7 +177,8 @@ case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in esac case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$has_wait_nohang/$make_cv_job_server" in - yes/yes/yes/yes) AC_DEFINE(MAKE_JOBSERVER) ;; + yes/yes/yes/yes) AC_DEFINE(MAKE_JOBSERVER, 1, + [Define this to enable job server support in GNU make.]);; esac dnl Allow building with dmalloc @@ -213,7 +214,8 @@ if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 && make_cv_sys_get_minus_G=no fi]) case "$make_cv_sys_get_minus_G" in - yes) AC_DEFINE(SCCS_GET_MINUS_G);; + yes) AC_DEFINE(SCCS_GET_MINUS_G, 1, + [Define this if the SCCS \`get' command understands the \`-G' option.]);; esac fi rm -f s.conftest conftoast diff --git a/file.c b/file.c index b583db9..d9e4c1b 100644 --- a/file.c +++ b/file.c @@ -400,7 +400,7 @@ remove_intermediates (sig) /* If nothing would have created this file yet, don't print an "rm" command for it. */ continue; - else if (just_print_flag) + if (just_print_flag) status = 0; else { diff --git a/gettext.h b/gettext.h index 6a33cc1..c055176 100644 --- a/gettext.h +++ b/gettext.h @@ -17,14 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Include libintl.h, if it was found: we don't even look for it unless we - want to use the system's gettext(). If not, the rest of the file contains - the headers necessary for our own gettext.c. */ - -#ifdef HAVE_LIBINTL_H -# include - -#else +#ifndef _GETTEXT_H +#define _GETTEXT_H 1 /* We define an additional symbol to signal that we use the GNU implementation of gettext. */ @@ -166,12 +160,6 @@ extern int _nl_msg_cat_cntr; } #endif -#endif /* !HAVE_LIBINTL_H */ - -#ifndef gettext_noop -/* For automatical extraction of messages sometimes no real - translation is needed. Instead the string itself is the result. */ -# define gettext_noop(Str) (Str) -#endif +#endif /* _GETTEXT_H */ /* End of libgettext.h */ diff --git a/make.h b/make.h index f128618..c7fc4b6 100644 --- a/make.h +++ b/make.h @@ -39,11 +39,28 @@ Boston, MA 02111-1307, USA. */ # define PARAMS(protos) () #endif /* C++ or ANSI C. */ +/* Include libintl.h, if it was found: we don't even look for it unless we + want to use the system's gettext(). If not, use the included gettext.h. */ + +#ifdef HAVE_LIBINTL_H +# include +# ifdef HAVE_LOCALE_H +# include +# endif +#else +# include "gettext.h" +#endif + +#ifndef gettext_noop +/* For automatic extraction of messages sometimes no real translation is + needed. Instead the string itself is the result. */ +# define gettext_noop(Str) (Str) +#endif -#include "gettext.h" #define _(Text) gettext (Text) #define N_(Text) gettext_noop (Text) + #if !HAVE_SETLOCALE # define setlocale(Category, Locale) /* empty */ #endif -- cgit v1.2.3