From: Bruno Haible Date: Thu, 24 Jan 2002 12:34:28 +0000 (+0000) Subject: Make the rpath thing work in projects that use libtool. X-Git-Tag: v0.11~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d279c6f057517809b7b2733a87828343842f4e15;p=thirdparty%2Fgettext.git Make the rpath thing work in projects that use libtool. --- diff --git a/ChangeLog b/ChangeLog index c4cef8709..6b78857d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-01-24 Bruno Haible + + * Makefile.am ($(srcdir)/tests/rpathy/aclocal.m4): Fix dependencies. + 2002-01-21 Bruno Haible * Makefile.am (EXTRA_DIST): Add os2/configure.awk. diff --git a/Makefile.am b/Makefile.am index 862aa30ed..31b9e2a06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,7 @@ $(srcdir)/tests/rpathx/configure: $(srcdir)/tests/rpathx/configure.in $(srcdir)/ CONFIGURES_RPATHY = $(srcdir)/tests/rpathy/Makefile.in $(srcdir)/tests/rpathy/aclocal.m4 $(srcdir)/tests/rpathy/configure $(srcdir)/tests/rpathy/Makefile.in: $(srcdir)/tests/rpathy/Makefile.am $(srcdir)/tests/rpathy/configure.in cd $(srcdir)/tests/rpathy && automake Makefile -$(srcdir)/tests/rpathy/aclocal.m4: $(srcdir)/tests/rpathy/configure.in +$(srcdir)/tests/rpathy/aclocal.m4: $(srcdir)/tests/rpathy/configure.in $(srcdir)/m4/lib-link.m4 $(srcdir)/m4/lib-prefix.m4 $(srcdir)/m4/lib-ld.m4 cd $(srcdir)/tests/rpathy && aclocal -I ../../m4 $(srcdir)/tests/rpathy/configure: $(srcdir)/tests/rpathy/configure.in $(srcdir)/tests/rpathy/aclocal.m4 cd $(srcdir)/tests/rpathy && autoconf diff --git a/doc/ChangeLog b/doc/ChangeLog index 232cf12fd..3adff334f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2002-01-24 Bruno Haible + + * gettext.texi (src/Makefile): Recommend @LIBINTL@, @LTLIBINTL@ + instead of @INTLLIBS@. + (AM_GNU_GETTEXT): Likewise. + (AM_ICONV): Document variable @LTLIBICONV@. + 2002-01-12 Bruno Haible * gettext.texi: Remove the parentheses around the expansions of N_ and diff --git a/doc/gettext.texi b/doc/gettext.texi index 43cff90b1..031f2962c 100644 --- a/doc/gettext.texi +++ b/doc/gettext.texi @@ -5521,12 +5521,14 @@ Note that @code{@@datadir@@} defaults to @samp{$(prefix)/share}, thus @code{$(localedir)} defaults to @samp{$(prefix)/share/locale}. @item -You should ensure that the final linking will use @code{@@INTLLIBS@@} as -a library. An easy way to achieve this is to manage that it gets into -@code{LIBS}, like this: +You should ensure that the final linking will use @code{@@LIBINTL@@} or +@code{@@LTLIBINTL@@} as a library. @code{@@LIBINTL@@} is for use without +@code{libtool}, @code{@@LTLIBINTL@@} is for use with @code{libtool}. An +easy way to achieve this is to manage that it gets into @code{LIBS}, like +this: @example -LIBS = @@INTLLIBS@@ @@LIBS@@ +LIBS = @@LIBINTL@@ @@LIBS@@ @end example In most packages internationalized with GNU @code{gettext}, one will @@ -5535,11 +5537,11 @@ functions will be build. (You need at least the few functions which the GNU @code{gettext} Library itself needs.) However some of the functions in the @file{lib/} also give messages to the user which of course should be translated, too. Taking care of this, the support library (say -@file{libsupport.a}) should be placed before @code{@@INTLLIBS@@} and +@file{libsupport.a}) should be placed before @code{@@LIBINTL@@} and @code{@@LIBS@@} in the above example. So one has to write this: @example -LIBS = ../lib/libsupport.a @@INTLLIBS@@ @@LIBS@@ +LIBS = ../lib/libsupport.a @@LIBINTL@@ @@LIBS@@ @end example @item @@ -5670,10 +5672,12 @@ The @code{AM_GNU_GETTEXT} macro determines whether GNU gettext is available and should be used. If so, it sets the @code{USE_NLS} variable to @samp{yes}; it defines @code{ENABLE_NLS} to 1 in the autoconf generated configuration file (usually called @file{config.h}); it sets -the variable @code{LIBINTL} to the linker options for use in a Makefile; -it adds an @samp{-I} option to @code{CPPFLAGS} if necessary. -In the negative case, it sets @code{USE_NLS} to @samp{no}; it sets -@code{LIBINTL} to empty and doesn't change @code{CPPFLAGS}. +the variables @code{LIBINTL} and @code{LTLIBINTL} to the linker options +for use in a Makefile (@code{LIBINTL} for use without libtool, +@code{LTLIBINTL} for use with libtool); it adds an @samp{-I} option to +@code{CPPFLAGS} if necessary. In the negative case, it sets +@code{USE_NLS} to @samp{no}; it sets @code{LIBINTL} and @code{LTLIBINTL} +to empty and doesn't change @code{CPPFLAGS}. The complexities that @code{AM_GNU_GETTEXT} deals with are the following: @@ -5698,14 +5702,14 @@ to the user's locale encoding. GNU @code{libintl}, if installed, is not necessarily already in the run time library search path. To avoid the need for setting an environment variable like @code{LD_LIBRARY_PATH}, the macro adds the appropriate -run time search path options to the @code{LIBINTL} variable. This works -on most systems, but not on some operating systems with limited shared -library support, like SCO. +run time search path options to the @code{LIBINTL} and @code{LTLIBINTL} +variables. This works on most systems, but not on some operating systems +with limited shared library support, like SCO. @item GNU @code{libintl} relies on POSIX @code{iconv}. The macro checks for linker options needed to use iconv and appends them to the @code{LIBINTL} -variable. +and @code{LTLIBINTL} variables. @end itemize @node AM_ICONV, , AM_GNU_GETTEXT, autoconf macros @@ -5718,10 +5722,12 @@ variable to @samp{yes}; it defines @code{HAVE_ICONV} to 1 in the autoconf generated configuration file (usually called @file{config.h}); it defines @code{ICONV_CONST} to @samp{const} or to empty, depending on whether the second argument of @code{iconv()} is of type @samp{const char **} or -@samp{char **}; it sets the variable @code{LIBICONV} to the linker options -for use in a Makefile; it adds an @samp{-I} option to @code{CPPFLAGS} if -necessary. If not found, it sets @code{LIBICONV} to empty and doesn't -change @code{CPPFLAGS}. +@samp{char **}; it sets the variables @code{LIBICONV} and +@code{LTLIBICONV} to the linker options for use in a Makefile +(@code{LIBICONV} for use without libtool, @code{LTLIBICONV} for use with +libtool); it adds an @samp{-I} option to @code{CPPFLAGS} if +necessary. If not found, it sets @code{LIBICONV} and @code{LTLIBICONV} to +empty and doesn't change @code{CPPFLAGS}. The complexities that @code{AM_ICONV} deals with are the following: diff --git a/intl/ChangeLog b/intl/ChangeLog index ddb7823a3..51b9c9962 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,7 @@ +2002-01-24 Bruno Haible + + * Makefile.in (libintl.la): Use @LTLIBICONV@ instead of @LIBICONV@. + 2002-01-10 Andrew Zabolotny Bruno Haible diff --git a/intl/Makefile.in b/intl/Makefile.in index 9a8d294dd..a00f92d43 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -119,7 +119,7 @@ libintl.a libgnuintl.a: $(OBJECTS) libintl.la libgnuintl.la: $(OBJECTS) $(LIBTOOL) --mode=link \ $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \ - $(OBJECTS) @LIBICONV@ -lc \ + $(OBJECTS) @LTLIBICONV@ -lc \ -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ -rpath $(libdir) \ -no-undefined diff --git a/lib/ChangeLog b/lib/ChangeLog index feda4f4dc..1a9d0c27f 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2002-01-24 Bruno Haible + + * Makefile.am (libgettextlib_la_LDFLAGS): Use @LTLIBINTL@ instead of + @INTLLIBS@, and @LTLIBICONV@ instead of @LIBICONV@. + 2002-01-19 Bruno Haible * xerror.c (multiline_warning): Add a newline if the message doesn't diff --git a/lib/Makefile.am b/lib/Makefile.am index fdeb4748b..bb1b0306a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -86,11 +86,11 @@ UNUSED_SOURCE = \ libgettextlib_la_LIBADD = @LTALLOCA@ @LTLIBOBJS@ -# Need @INTLLIBS@ because many source files use gettext(). -# Need @LIBICONV@ because linebreak.c uses iconv(). +# Need @LTLIBINTL@ because many source files use gettext(). +# Need @LTLIBICONV@ because linebreak.c uses iconv(). libgettextlib_la_LDFLAGS = \ -release @VERSION@ \ - @INTLLIBS@ @LIBICONV@ -lc -no-undefined + @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined # Extra files to be installed. diff --git a/m4/ChangeLog b/m4/ChangeLog index 503c9b26b..5898de054 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,12 @@ +2002-01-24 Bruno Haible + + * lib-link.m4 (AC_LIB_LINKFLAGS): Also define LTLIB${NAME}. + (AC_LIB_HAVE_LINKFLAGS): Likewise. + (AC_LIB_LINKFLAGS_BODY): Also define LTLIB${NAME}. + * iconv.m4 (AM_ICONV_LINK): Also define LTLIBICONV. + * gettext.m4 (AM_GNU_GETTEXT): Define LIBINTL and LTLIBINTL instead + of INTLLIBS. + 2002-01-20 Bruno Haible * lib-link.m4 (AC_LIB_LINKFLAGS): Fix quoting so that multiple diff --git a/m4/gettext.m4 b/m4/gettext.m4 index bd83f81d5..30ea48957 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -87,7 +87,8 @@ AC_DEFUN([AM_GNU_GETTEXT], BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) - INTLLIBS= + LIBINTL= + LTLIBINTL= POSUB= dnl If we use NLS figure out what method @@ -126,9 +127,10 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) - dnl Search for libintl and define LIBINTL and INCINTL accordingly. - dnl Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) because that would - dnl add "-liconv" to LIBINTL even if libiconv doesn't exist. + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, @@ -151,6 +153,7 @@ extern int _nl_msg_cat_cntr;], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext_libintl=yes ]) fi @@ -181,7 +184,8 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", INTLOBJS="\$(GETTOBJS)" BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes - INTLLIBS="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi @@ -208,7 +212,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", if test "$gt_cv_func_gnugettext_libintl" = "yes"; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) - INTLLIBS="$LIBINTL" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi @@ -257,8 +260,13 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) - dnl Make all documented variables known to autoconf. + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) AC_SUBST(POSUB) ]) diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 58b8a093d..f81e8b995 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -17,7 +17,8 @@ AC_DEFUN([AM_ICONV_LINK], AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) - dnl Search for libiconv and define LIBICONV and INCICONV accordingly. + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, @@ -60,8 +61,10 @@ AC_DEFUN([AM_ICONV_LINK], dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= + LTLIBICONV= fi AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) ]) AC_DEFUN([AM_ICONV], diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 index 77f511403..e4633587e 100644 --- a/m4/lib-link.m4 +++ b/m4/lib-link.m4 @@ -10,8 +10,8 @@ dnl From Bruno Haible. dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} variable and augments the CPPFLAGS -dnl variable. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) @@ -22,12 +22,15 @@ AC_DEFUN([AC_LIB_LINKFLAGS], AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes @@ -39,10 +42,10 @@ dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} variable -dnl and augments the CPPFLAGS variable, and #defines HAVE_LIB${NAME} to 1. -dnl Otherwise, it sets and AC_SUBSTs HAVE_LIB${NAME}=no and LIB${NAME} to -dnl empty. +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) @@ -51,7 +54,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl Search for lib[]Name and define LIB[]NAME and INC[]NAME accordingly. + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, @@ -77,9 +81,11 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= + LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) @@ -114,7 +120,7 @@ AC_DEFUN([AC_LIB_RPATH], dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the INC${NAME} and LIB${NAME} variables. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], @@ -146,8 +152,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= + LTLIB[]NAME= INC[]NAME= rpathdirs= + ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do @@ -171,6 +179,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], if test "$value" = yes; then eval value=\"\$LIB$uppername\" AC_LIB_APPENDTOVAR(LIB[]NAME, [$value]) + eval value=\"\$LTLIB$uppername\" + AC_LIB_APPENDTOVAR(LTLIB[]NAME, [$value]) else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. @@ -178,7 +188,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME. + dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= @@ -201,7 +211,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi fi if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LIB[]NAME; do + for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) @@ -230,84 +240,94 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi if test "X$found_dir" != "X"; then dnl Found the library. - dnl Most of the following complexities is not needed when libtool - dnl is used. - ifdef([AC_PROG_][LIBTOOL], [], [ - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - dnl FIXME: Which systems does this affect? - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - ]) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - ifdef([AC_PROG_][LIBTOOL], [], [ - fi + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi - ]) + fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in @@ -320,27 +340,27 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS or the already + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac fi - done + fi if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break fi - fi + done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. @@ -366,36 +386,51 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME. + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS or the already + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/lib"; then haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac fi - done + fi if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break fi - fi + done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi fi fi ;; @@ -412,6 +447,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done @@ -422,6 +458,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi @@ -453,6 +490,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], done fi fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, diff --git a/src/ChangeLog b/src/ChangeLog index 0e0ddaf71..cea966f7f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2002-01-24 Bruno Haible + + * Makefile.am (LDADD): Use @LTLIBINTL@ instead of @INTLLIBS@. + (libgettextsrc_la_LDFLAGS): Likewise. Use @LTLIBICONV@ instead of + @LIBICONV@. + 2002-01-21 Bruno Haible * msggrep.c (main): On SunOS4, don't pass option "-q" to grep. diff --git a/src/Makefile.am b/src/Makefile.am index 25a7a326e..1233ed909 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,7 @@ INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/lib -I../intl \ -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" -DGETTEXTJAR=\"$(jardir)/gettext.jar\" \ -DLIBDIR=\"$(libdir)\" -DPROJECTSDIR=\"$(projectsdir)\" @DEFS@ -LDADD = ../lib/libgettextlib.la @INTLLIBS@ +LDADD = ../lib/libgettextlib.la @LTLIBINTL@ SED = sed YACC = @YACC@ -d @@ -99,12 +99,12 @@ urlget_SOURCES = urlget.c # How to build libgettextsrc.la. # Need ../lib/libgettextlib.la. -# Need @INTLLIBS@ because many source files use gettext(). -# Need @LIBICONV@ because po-charset.c, po-lex.c, msgl-iconv.c, write-po.c use -# iconv(). +# Need @LTLIBINTL@ because many source files use gettext(). +# Need @LTLIBICONV@ because po-charset.c, po-lex.c, msgl-iconv.c, write-po.c +# use iconv(). libgettextsrc_la_LDFLAGS = \ -release @VERSION@ \ - ../lib/libgettextlib.la @INTLLIBS@ @LIBICONV@ -lc -no-undefined + ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined # Link dependencies. msgcmp_LDADD = libgettextsrc.la diff --git a/tests/ChangeLog b/tests/ChangeLog index 3e4bff3c4..4feac0468 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2002-01-24 Bruno Haible + + * lang-c: Use $LTLIBINTL instead of $INTLLIBS. + * lang-c++: Likewise. + * lang-objc: Likewise. + * Makefile.am (TESTS_ENVIRONMENT): Set LTLIBINTL instead of INTLLIBS. + (LDADD_no): Use @LTLIBINTL@ instead of @INTLLIBS@. + 2002-01-20 Bruno Haible * rpathx: New subdirectory. diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a13fe18f..0dccbcfd8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -99,7 +99,7 @@ TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) PATH=.:../src:$$PATH \ CC='@CC@' CFLAGS='@CFLAGS@' \ CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' \ CPPFLAGS='@CPPFLAGS@' LDFLAGS='@LDFLAGS@' \ - INTLLIBS='@INTLLIBS@' \ + LTLIBINTL='@LTLIBINTL@' \ TESTJAVA='@TESTJAVA@' \ CONFIG_SHELL='$(SHELL)' \ $(SHELL) @@ -116,7 +116,7 @@ INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ LDADD = $(LDADD_@USE_INCLUDED_LIBINTL@) LDADD_yes = ../intl/libintl.la -LDADD_no = ../intl/libgnuintl.la @INTLLIBS@ +LDADD_no = ../intl/libgnuintl.la @LTLIBINTL@ noinst_PROGRAMS = tstgettext tstngettext cake tstgettext_SOURCES = tstgettext.c setlocale.c tstgettext_LDADD = ../lib/libgettextlib.la $(LDADD) diff --git a/tests/lang-c b/tests/lang-c index b99413a3d..f18a737d6 100755 --- a/tests/lang-c +++ b/tests/lang-c @@ -46,11 +46,11 @@ int main (argc, argv) } EOF -# Variable needed by INTLLIBS. +# Variable needed by LTLIBINTL. top_builddir=.. tmpfiles="$tmpfiles prog.${OBJEXT} prog${EXEEXT}" -${LIBTOOL} --quiet --mode=link ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.c -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${INTLLIBS} \ +${LIBTOOL} --quiet --mode=link ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.c -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${LTLIBINTL} \ || exit 1 tmpfiles="$tmpfiles prog.pot" diff --git a/tests/lang-c++ b/tests/lang-c++ index cd63a0b85..47c07281f 100755 --- a/tests/lang-c++ +++ b/tests/lang-c++ @@ -47,11 +47,11 @@ int main (int argc, char *argv[]) } EOF -# Variable needed by INTLLIBS. +# Variable needed by LTLIBINTL. top_builddir=.. tmpfiles="$tmpfiles prog.${OBJEXT} prog${EXEEXT}" -${LIBTOOL} --quiet --mode=link ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.cc -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${INTLLIBS} \ +${LIBTOOL} --quiet --mode=link ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.cc -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${LTLIBINTL} \ || exit 1 tmpfiles="$tmpfiles prog.pot" diff --git a/tests/lang-objc b/tests/lang-objc index 9dbd6be77..160dc59a7 100755 --- a/tests/lang-objc +++ b/tests/lang-objc @@ -60,11 +60,11 @@ int main (argc, argv) } EOF -# Variable needed by INTLLIBS. +# Variable needed by LTLIBINTL. top_builddir=.. tmpfiles="$tmpfiles prog.${OBJEXT} prog${EXEEXT}" -${LIBTOOL} --quiet --mode=link ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.m -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${INTLLIBS} \ +${LIBTOOL} --quiet --mode=link ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o prog prog.m -I.. -I$top_srcdir/lib ../lib/libgettextlib.la -I../intl ${LTLIBINTL} \ || exit 1 tmpfiles="$tmpfiles prog.pot" diff --git a/tests/rpath-2.README b/tests/rpath-2.README index 0a7305b78..be2e9c0f1 100644 --- a/tests/rpath-2.README +++ b/tests/rpath-2.README @@ -17,18 +17,7 @@ rpath-2 u v w AC_LIB_LINKFLAGS argument instead. The rpath-2* tests are sensitive to - - incomplete shared library in the system, + - incomplete shared library support in the system, - bugs in libtool that creates the shared libraries, - bugs in lib-link.m4. -Known failures: - -* FreeBSD4: rpath-2bad, rpath-2bbd fail because of a combination of a bug - in libtool (the libtool command line for creating librpathy.la contains - a -rpath command, but the resulting gcc command line doesn't) and a bug - in FreeBSD's runtime loader (it searches for librpathx.so.0 twice, and - in the second search it not only ignores the success in the first search - but also the rpath given in the executable). - -* OSF/1 4.0: rpath-2bbd fails. -