[11/11] libctf: support platforms with separate libintl

Message ID 20191216225357.87247-12-nick.alcock@oracle.com
State New
Headers show
Series
  • libctf: various portability fixes and small bugfixes
Related show

Commit Message

Nick Alcock Dec. 16, 2019, 10:53 p.m.
We were not using the right configure machinery to spot libintl on
platforms where it was required, leading to the spurious failure of
various configure tests (e.g. for things like ELF support in BFD).

libctf/
	* aclocal.m4: Add config/gettext-sister.m4: Shuffle into
	alphabetical order.
	* configure.ac: Add ZW_GNU_GETTEXT_SISTER_DIR.
	* config.h.in: Regenerated.
	* Makefile.in: Likewise.
	* configure: Likewise.
---
 libctf/ChangeLog    |  9 +++++
 libctf/Makefile.in  | 19 ++++++++--
 libctf/aclocal.m4   |  3 +-
 libctf/config.h.in  |  4 +++
 libctf/configure    | 86 +++++++++++++++++++++++++++++++++++++++++++--
 libctf/configure.ac |  1 +
 6 files changed, 116 insertions(+), 6 deletions(-)

-- 
2.24.1.242.gb57e918ca5

Patch

diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index f172cbf864..45616c29ae 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,12 @@ 
+2019-12-16  Nick Alcock  <nick.alcock@oracle.com>
+
+	* aclocal.m4: Add config/gettext-sister.m4: Shuffle into
+	alphabetical order.
+	* configure.ac: Add ZW_GNU_GETTEXT_SISTER_DIR.
+	* config.h.in: Regenerated.
+	* Makefile.in: Likewise.
+	* configure: Likewise.
+
 2019-12-16  Nick Alcock  <nick.alcock@oracle.com>
 
 	* ctf-create.c: Include <unistd.h>.
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index d6e73cac73..1ebf9f9c7c 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -110,13 +110,14 @@  host_triplet = @host@
 @NEED_CTF_QSORT_R_TRUE@am__append_1 = ctf-qsort_r.c
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+	$(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/depstand.m4 \
+	$(top_srcdir)/../config/gettext-sister.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/warnings.m4 \
-	$(top_srcdir)/../config/zlib.m4 \
-	$(top_srcdir)/../bfd/acinclude.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/configure.ac
@@ -297,12 +298,15 @@  AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BFD_DEPENDENCIES = @BFD_DEPENDENCIES@
 BFD_LIBADD = @BFD_LIBADD@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
@@ -313,14 +317,20 @@  ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+GENCAT = @GENCAT@
+GMSGFMT = @GMSGFMT@
 GREP = @GREP@
+INCINTL = @INCINTL@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
@@ -344,6 +354,7 @@  PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -351,10 +362,12 @@  SHARED_LDFLAGS = @SHARED_LDFLAGS@
 SHARED_LIBADD = @SHARED_LIBADD@
 SHELL = @SHELL@
 STRIP = @STRIP@
+USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_FLAGS = @VERSION_FLAGS@
 WARN_PEDANTIC = @WARN_PEDANTIC@
 WERROR = @WERROR@
+XGETTEXT = @XGETTEXT@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/libctf/aclocal.m4 b/libctf/aclocal.m4
index 04583b42f0..8ae4b53462 100644
--- a/libctf/aclocal.m4
+++ b/libctf/aclocal.m4
@@ -1227,13 +1227,14 @@  AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../bfd/acinclude.m4])
 m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
+m4_include([../config/gettext-sister.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/override.m4])
 m4_include([../config/warnings.m4])
 m4_include([../config/zlib.m4])
-m4_include([../bfd/acinclude.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libctf/config.h.in b/libctf/config.h.in
index e0e37398e0..95f08a9e3b 100644
--- a/libctf/config.h.in
+++ b/libctf/config.h.in
@@ -3,6 +3,10 @@ 
 /* Define if building universal (internal helper macro) */
 #undef AC_APPLE_UNIVERSAL_BUILD
 
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#undef ENABLE_NLS
+
 /* Whether libbfd was configured for an ELF target. */
 #undef HAVE_BFD_ELF
 
diff --git a/libctf/configure b/libctf/configure
index f56492ca80..71fcda3688 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -680,6 +680,18 @@  build_vendor
 build_cpu
 build
 LIBTOOL
+CATOBJEXT
+GENCAT
+INSTOBJEXT
+DATADIRNAME
+CATALOGS
+POSUB
+GMSGFMT
+XGETTEXT
+INCINTL
+LIBINTL_DEP
+LIBINTL
+USE_NLS
 ac_ct_AR
 AR
 RANLIB
@@ -5283,6 +5295,76 @@  unknown)
   ;;
 esac
 
+# If we haven't got the data from the intl directory,
+# assume NLS is disabled.
+USE_NLS=no
+LIBINTL=
+LIBINTL_DEP=
+INCINTL=
+XGETTEXT=
+GMSGFMT=
+POSUB=
+
+if test -f  ../intl/config.intl; then
+  .  ../intl/config.intl
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
+if test x"$USE_NLS" != xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define ENABLE_NLS 1" >>confdefs.h
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5
+$as_echo_n "checking for catalogs to be installed... " >&6; }
+  # Look for .po and .gmo files in the source directory.
+  CATALOGS=
+  XLINGUAS=
+  for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
+    # If there aren't any .gmo files the shell will give us the
+    # literal string "../path/to/srcdir/po/*.gmo" which has to be
+    # weeded out.
+    case "$cat" in *\**)
+      continue;;
+    esac
+    # The quadruple backslash is collapsed to a double backslash
+    # by the backticks, then collapsed again by the double quotes,
+    # leaving us with one backslash in the sed expression (right
+    # before the dot that mustn't act as a wildcard).
+    cat=`echo $cat | sed -e "s!$srcdir/po/!!" -e "s!\\\\.po!.gmo!"`
+    lang=`echo $cat | sed -e "s!\\\\.gmo!!"`
+    # The user is allowed to set LINGUAS to a list of languages to
+    # install catalogs for.  If it's empty that means "all of them."
+    if test "x$LINGUAS" = x; then
+      CATALOGS="$CATALOGS $cat"
+      XLINGUAS="$XLINGUAS $lang"
+    else
+      case "$LINGUAS" in *$lang*)
+        CATALOGS="$CATALOGS $cat"
+        XLINGUAS="$XLINGUAS $lang"
+        ;;
+      esac
+    fi
+  done
+  LINGUAS="$XLINGUAS"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5
+$as_echo "$LINGUAS" >&6; }
+
+
+    DATADIRNAME=share
+
+  INSTOBJEXT=.mo
+
+  GENCAT=gencat
+
+  CATOBJEXT=.gmo
+
+fi
 
 # Check whether --enable-shared was given.
 if test "${enable_shared+set}" = set; then :
@@ -11431,7 +11513,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11434 "configure"
+#line 11516 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11537,7 +11619,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11540 "configure"
+#line 11622 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libctf/configure.ac b/libctf/configure.ac
index ffd1f0edac..cc7701515c 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -31,6 +31,7 @@  AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_RANLIB
 AM_PROG_AR
+ZW_GNU_GETTEXT_SISTER_DIR
 
 dnl Default to a non shared library.  This may be overridden by the
 dnl configure option --enable-shared.