1From e4b3a3f56fa6fc2a51769e286545f0631bb4837c Mon Sep 17 00:00:00 2001 2From: Bruno Haible <bruno@clisp.org> 3Date: Sat, 18 May 2019 23:33:06 +0200 4Subject: [PATCH] build: Restore the ability to build gettext-tools separately, part 1. 5MIME-Version: 1.0 6Content-Type: text/plain; charset=UTF-8 7Content-Transfer-Encoding: 8bit 8 9Reported by Hanspeter Niederstrasser <nieder@users.sourceforge.net> 10in <https://savannah.gnu.org/bugs/?56333>. 11 12Code based on patch by Miguel Ángel Arruga Vivas <rosen644835@gmail.com>. 13 14* autogen.sh: Copy libtextstyle.m4 for use by gettext-tools. 15* gettext-tools/configure.ac: New option --with-installed-libtextstyle. 16(USE_INSTALLED_LIBTEXTSTYLE): New conditional. 17* gettext-tools/src/Makefile.am (textstyle.h): Disable rule if 18USE_INSTALLED_LIBTEXTSTYLE is true. 19(LT_LIBTEXTSTYLE): New variable. 20(libgettextsrc_la_LDFLAGS): Use it instead of hardcoding a relative filename of 21libtextstyle.la. 22* configure.ac: Filter out --with-installed-libtextstyle from inherited --help 23output. 24* Makefile.am (distcheck-hook): Compare different copies of libtextstyle.m4. 25* PACKAGING: Document that gettext-tools's configure needs to be invoked with 26--with-installed-libtextstyle. 27 28Upstream-status: committed. 29https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=e4b3a3f56fa6fc2a51769e286545f0631bb4837c 30 31Signed-off-by: Bruno Haible <bruno@clisp.org> 32[Backported to 0.20.1] 33Signed-off-by: Adam Duskett <Aduskett@gmail.com> 34--- 35 PACKAGING | 2 +- 36 autogen.sh | 1 + 37 configure.ac | 2 +- 38 gettext-tools/configure.ac | 16 ++++++++++++++++ 39 gettext-tools/src/Makefile.am | 8 +++++++- 40 5 files changed, 26 insertions(+), 3 deletions(-) 41 42diff --git a/PACKAGING b/PACKAGING 43index a8ce979..52b80ac 100644 44--- a/PACKAGING 45+++ b/PACKAGING 46@@ -42,7 +42,7 @@ The 'libtextstyle' binary package can be installed by doing 47 The 'gettext-tools' binary package can be installed by doing 48 49 cd gettext-tools 50- ./configure 51+ ./configure --with-installed-libtextstyle 52 make 53 make install 54 55diff --git a/autogen.sh b/autogen.sh 56index 5c28b6f..2ccf373 100755 57--- a/autogen.sh 58+++ b/autogen.sh 59@@ -268,6 +268,7 @@ if ! $skip_gnulib; then 60 $GNULIB_TOOL --dir=gettext-tools --lib=libgettextlib --source-base=gnulib-lib --m4-base=gnulib-m4 --tests-base=gnulib-tests --makefile-name=Makefile.gnulib --libtool --with-tests --local-dir=gnulib-local --local-symlink \ 61 --import --avoid=array-list-tests --avoid=linkedhash-list-tests --avoid=hash-tests --avoid=fdutimensat-tests --avoid=futimens-tests --avoid=utime-tests --avoid=utimens-tests --avoid=utimensat-tests \ 62 `for m in $GNULIB_MODULES_TOOLS_LIBUNISTRING_TESTS; do echo --avoid=$m; done` $GNULIB_MODULES_TOOLS_FOR_SRC $GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES $GNULIB_MODULES_TOOLS_OTHER || exit $? 63+ $GNULIB_TOOL --copy-file m4/libtextstyle.m4 gettext-tools/gnulib-m4/libtextstyle.m4 || exit $? 64 # In gettext-tools/libgrep: 65 GNULIB_MODULES_TOOLS_FOR_LIBGREP=' 66 mbrlen 67diff --git a/configure.ac b/configure.ac 68index 38db6fd..0c84bdd 100644 69--- a/configure.ac 70+++ b/configure.ac 71@@ -49,7 +49,7 @@ AC_CANONICAL_HOST 72 dnl Optional Features: AC_ARG_ENABLE calls 73 dnl Optional Packages: AC_ARG_WITH calls 74 dnl Some influential environment variables: AC_ARG_VAR calls 75-esyscmd([{ cd gettext-runtime && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; cd libtextstyle && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; cd gettext-tools && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; } | sed -f build-aux/ac-help.sed ]) 76+esyscmd([{ cd gettext-runtime && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; cd libtextstyle && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; { cd gettext-tools && autoconf --trace=AC_ARG_ENABLE:'$n([$1],[$2])' --trace=AC_ARG_WITH:'$n([$1],[$2])' --trace=AC_ARG_VAR:'$n($@)' && cd ..; } | grep -v installed.libtextstyle; } | sed -f build-aux/ac-help.sed ]) 77 78 AC_CONFIG_FILES([Makefile]) 79 80diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac 81index cf1dd73..a6816b8 100644 82--- a/gettext-tools/configure.ac 83+++ b/gettext-tools/configure.ac 84@@ -121,6 +121,22 @@ AM_CONDITIONAL([PACKAGE_IS_GETTEXT_TOOLS], [true]) 85 AM_CONDITIONAL([PRELOADABLE_LIBINTL], 86 [test $USE_INCLUDED_LIBINTL = no && test $GLIBC2 = yes]) 87 88+dnl This option allows to build gettext-tools without (re)building libtextstyle. 89+AC_ARG_WITH([installed-libtextstyle], 90+ [AS_HELP_STRING([--with-installed-libtextstyle], 91+ [Use an already installed libtextstyle.])], 92+ [gt_use_installed_libtextstyle=$withval], 93+ [gt_use_installed_libtextstyle=no]) 94+if test "$gt_use_installed_libtextstyle" != no; then 95+ gl_LIBTEXTSTYLE 96+else 97+ test -f ../libtextstyle/Makefile || { 98+ AC_MSG_ERROR([When building the gettext-tools package without building the entire gettext package, you need to pass the --with-installed-libtextstyle option to configure.]) 99+ } 100+fi 101+AM_CONDITIONAL([USE_INSTALLED_LIBTEXTSTYLE], 102+ [test "$gt_use_installed_libtextstyle" != no]) 103+ 104 dnl This line internationalizes the bison generated parsers. 105 BISON_I18N 106 107diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am 108index b98b7ab..af3dcee 100644 109--- a/gettext-tools/src/Makefile.am 110+++ b/gettext-tools/src/Makefile.am 111@@ -250,6 +250,9 @@ cldr_plurals_SOURCES = cldr-plural.y cldr-plural-exp.c cldr-plurals.c 112 cldr_plurals_CFLAGS = $(AM_CFLAGS) $(INCXML) 113 cldr_plurals_LDADD = libgettextsrc.la $(LDADD) 114 115+if USE_INSTALLED_LIBTEXTSTYLE 116+LT_LIBTEXTSTYLE = @LTLIBTEXTSTYLE@ 117+else 118 # How to get the include files of libtextstyle. 119 textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h: 120 here=`pwd`; \ 121@@ -257,6 +260,9 @@ textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h: 122 $(MAKE) install-nobase_includeHEADERS install-nobase_nodist_includeHEADERS includedir="$$here" 123 BUILT_SOURCES += textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h 124 MOSTLYCLEANFILES += textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h 125+# Where to find the built libtextstyle library. 126+LT_LIBTEXTSTYLE = ../../libtextstyle/lib/libtextstyle.la 127+endif 128 129 # How to build libgettextsrc.la. 130 # Need ../gnulib-lib/libgettextlib.la. 131@@ -268,7 +274,7 @@ MOSTLYCLEANFILES += textstyle.h textstyle/stdbool.h textstyle/version.h textstyl 132 # use iconv(). 133 libgettextsrc_la_LDFLAGS = \ 134 -release @VERSION@ \ 135- ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) ../../libtextstyle/lib/libtextstyle.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined 136+ ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) $(LT_LIBTEXTSTYLE) @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined 137 138 # OS/2 does not support a DLL name longer than 8 characters. 139 if OS2 140-- 1412.24.1 142 143