* More fixes for configuring gettext correctly.
authorPaul Smith <psmith@gnu.org>
Wed, 14 Jun 2000 22:29:30 +0000 (22:29 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 14 Jun 2000 22:29:30 +0000 (22:29 +0000)
ChangeLog
acconfig.h
acinclude.m4
configure.in
file.c
gettext.h
make.h

index df101bbb99de5047ad2f266313443b80ee689333..f4885bb5613e900ee5d3171dc4bff97bd0250d1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-06-14  Paul D. Smith  <psmith@gnu.org>
+
+       * 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  <psmith@gnu.org>
 
        * gettext.h: If we have libintl.h, use that instead of any of the
index 5ac77ff0f4c67644778dd655495eb8888b4f3250..c656057cf3fddc21d34f93f16a082fd71ad37574 100644 (file)
@@ -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
 
 /* Define to the name of the SCCS `get' command.  */
 #undef SCCS_GET
 
-/* Define this if the SCCS `get' command understands the `-G<file>' 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 <sys/wait.h>.  */
-#undef HAVE_UNION_WAIT
-
 /* Define to `unsigned long' or `unsigned long long'
    if <inttypes.h> doesn't define.  */
 #undef uintmax_t
index e267b70f97598a40e705f8b574dc7e8bb1e72304..ad58ef6191678440fabb35f1d240d9a624f97862 100644 (file)
@@ -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 <psmith@gnu.org>
+dnl Original obtained from the libit 0.7 distribution
+dnl Rewritten by Paul D. Smith <psmith@gnu.org>
+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 <libintl.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#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 <libintl.h>.])
+    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
 
index 37a755bebf8c55614a3a63d518589747b400678a..97c28740d93f613a1092ebc7f84f891dbeef8d25 100644 (file)
@@ -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 <sys/wait.h>.])
 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<file>' option.]);;
   esac
 fi
 rm -f s.conftest conftoast
diff --git a/file.c b/file.c
index b583db98f44c44477ef34dccd170868a2033d76d..d9e4c1bd47a4fa36dd65043b0ed3daa9310b5468 100644 (file)
--- 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
            {
index 6a33cc16396bf6aeb0aa7c9829e6f1a30e27d004..c055176480666c6e4a1d165f8a40d3f15fb2c297 100644 (file)
--- a/gettext.h
+++ b/gettext.h
    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 <libintl.h>
-
-#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 f128618e792116389ca8d4b956661cec84135456..c7fc4b6a03e09db61a4726f2d29024d53f7c74d0 100644 (file)
--- 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 <libintl.h>
+# ifdef HAVE_LOCALE_H
+#  include <locale.h>
+# 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