From: Bruno Haible Date: Tue, 21 Jun 2022 00:50:34 +0000 (+0200) Subject: gettext-runtime: Provide helper script to build against uninstalled binaries. X-Git-Tag: v0.21.1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c699b551dec1d41f65ffbb234a7c01599178c717;p=thirdparty%2Fgettext.git gettext-runtime: Provide helper script to build against uninstalled binaries. Prompted by . * gettext-runtime/uninstalled-config.sh.in: New file. * gettext-runtime/configure.ac: New variable ENABLE_SHARED. Generate uninstalled-config.sh at configure time. --- diff --git a/.gitignore b/.gitignore index 0b269b341..f7f4850a8 100644 --- a/.gitignore +++ b/.gitignore @@ -565,6 +565,7 @@ autom4te.cache/ /gettext-runtime/javacomp.sh /gettext-runtime/libtool /gettext-runtime/stamp-h1 +/gettext-runtime/uninstalled-config.sh /gettext-runtime/doc/Makefile /gettext-runtime/intl/Makefile /gettext-runtime/intl-csharp/Makefile diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac index aef12e9fd..e0afe2e30 100644 --- a/gettext-runtime/configure.ac +++ b/gettext-runtime/configure.ac @@ -188,9 +188,14 @@ if test "$CXX" = "no"; then fi AM_CONDITIONAL([ENABLE_LIBASPRINTF], [test -n "$SUBDIR_libasprintf"]) +dnl Determine variables used by uninstalled-config.sh. +ENABLE_SHARED="$enable_shared" +AC_SUBST([ENABLE_SHARED]) + AC_CONFIG_SUBDIRS([libasprintf]) AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([uninstalled-config.sh]) AC_CONFIG_FILES([doc/Makefile]) diff --git a/gettext-runtime/uninstalled-config.sh.in b/gettext-runtime/uninstalled-config.sh.in new file mode 100644 index 000000000..62bea4afe --- /dev/null +++ b/gettext-runtime/uninstalled-config.sh.in @@ -0,0 +1,113 @@ +#! /bin/sh +# +# Copyright (C) 2022 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.1 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 . +# + +# This script makes it possible to build this package in a sibling directory +# of a package such as GCC, gdb, or binutils, and use the binaries in the +# build tree without doing 'make install'. +# +# Use from within a Bourne-compatible shell: +# relative_builddir='${top_builddir}/../gettext-runtime' +# . ${top_builddir}/../gettext-runtime/uninstalled-config.sh + +# Note: Another option for the same use-case would be a Makefile target +# 'install-lib', such that the sibling package could do +# cd ${top_builddir}/../gettext-runtime \ +# && $(MAKE) all \ +# && $(MAKE) install-lib libdir=... includedir=... +# This is how it's done in GNU libiconv. However, the 'uninstalled-config.sh' +# approach has two advantages: +# - it does not copy artifacts around, +# - it even allows for Makefile rules to depend on the uninstalled binaries. +# It has also a drawback: +# - On platforms with weird shared library mechanisms (e.g. AIX, HP-UX, +# native Windows) it works only with '--disable-shared'. + +# ================= Configuration variables for using libintl ================= + +# INCINTL is a set of compiler options, to use when preprocessing or compiling, +# that ensures that the uninstalled gets found. +# Attention! This variable needs to be used _after_ the -I options that ensure +# access to config.h (because INCINTL may contain a -I option that would allow +# access to libintl's private config.h, which you should not use). +if test @USE_INCLUDED_LIBINTL@ = yes; then + # The intl/ subdirectory contains the that "make install" would + # install. + INCINTL="-I ${relative_builddir}/intl" +else + # No file is needed, as it is provided by libc. + INCINTL= +fi + +# LIBINTL is a set of compiler options, to use when linking without libtool, +# that ensures that the library that contains the *gettext() family of functions +# gets found. +if test @USE_INCLUDED_LIBINTL@ = yes; then + if test '@ENABLE_SHARED@' = yes; then + # NB: This case is not supported on AIX and HP-UX. + LIBINTL="${relative_builddir}/intl/.libs/libintl.so -Wl,-rpath,${relative_builddir}/intl/.libs @LIBICONV@ @INTL_MACOSX_LIBS@" + else + LIBINTL="${relative_builddir}/intl/.libs/libintl.a @LIBICONV@ @INTL_MACOSX_LIBS@" + fi +else + # The functionality is provided by libc. + LIBINTL= +fi + +# LTLIBINTL is a set of compiler options, to use when linking with libtool, +# that ensures that the library that contains the *gettext() family of functions +# gets found. +if test @USE_INCLUDED_LIBINTL@ = yes; then + LTLIBINTL="${relative_builddir}/intl/libintl.la @LTLIBICONV@ @INTL_MACOSX_LIBS@" +else + # The functionality is provided by libc. + LTLIBINTL= +fi + +# LIBINTL_DEP is a list of files, that can be used in Makefile dependency lists, +# that indicate that binaries linked with LIBINTL or LTLIBINTL need to be +# rebuilt. +if test @USE_INCLUDED_LIBINTL@ = yes; then + LIBINTL_DEP="${relative_builddir}/intl/libintl.la" +else + LIBINTL_DEP= +fi + +# ============== Configuration variables for compiling PO files ============== + +# USE_NLS is 'yes' if the build is NLS enabled and therefore .po files should +# be compiled and .mo files should be installed. It is 'no' otherwise. +USE_NLS='@USE_NLS@' + +# POSUB is 'po' if the build is NLS enabled and therefore the build needs to +# recurse into the 'po' directory. It is empty otherwise. +POSUB='@POSUB@' + +# XGETTEXT is a GNU xgettext version ≥ 0.12, if found in $PATH, or ':' if +# not found. +XGETTEXT='@XGETTEXT@' + +# XGETTEXT_015 is a GNU xgettext version ≥ 0.15, if found in $PATH, or ':' if +# not found. +XGETTEXT_015='@XGETTEXT_015@' + +# GMSGFMT is a GNU msgfmt, if found in $PATH, or ':' if not found. +GMSGFMT='@GMSGFMT@' + +# GMSGFMT_015 is a GNU msgfmt version ≥ 0.15, if found in $PATH, or ':' if +# not found. +GMSGFMT_015='@GMSGFMT_015@'