libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext libintl.la dependency_libs problem


From: Albert Chin
Subject: Re: gettext libintl.la dependency_libs problem
Date: Thu, 2 Jan 2003 19:07:42 -0600
User-agent: Mutt/1.4i

On Thu, Jan 02, 2003 at 06:30:58PM -0600, Tim Mooney wrote:
> I'm on the libtool list, but not the bug-gnu-gettext list.  I haven't
> looked at this problem long enough to know with any certainty where the
> bug is, but my guess is libtool.
> 
> Take a platform like alphaev56-dec-osf5.1 or mips-sgi-irix6.5.  Build
> GNU libiconv 1.8, and install it somewhere, say /usr/local/gnu.  Now
> build GNU gettext 0.11.5 to install under the same path.  Gettext's
> configure should detect libiconv and use it.  The problem is, in
> the `libintl.la' file that is generated for gettext, the dependency_libs
> line ends up like:
> 
> # Libraries that this one depends upon.
> dependency_libs=' -R/usr/local/gnu/lib -L/usr/local/gnu/lib 
> /usr/local/gnu/lib/libiconv.la -lc'

This is obviously wrong.

> Now say you build some package (for me it was glib-2.2.0) that depends on
> gettext.  When you go to link the package on a platform like Tru64 or
> IRIX, the link will fail because libtool passes the `-R/usr/local/gnu/lib'
> to whatever is doing the linking on the platform in question (ld
> generally).
> 
> Many vendor compilers and linkers don't understand `-R', so the link
> bombs.
> 
> I tried rebuilding the configure machinery that comes with gettext 0.11.5
> to use libtool 1.4.3 (currently it uses 1.4.2), and the results were the
> same, so it's not something that was a bug in older libtool but is fixed
> with recent libtool.
> 
> My initial impression is that either
> 
> 1) `-R/some/path' should never be getting into the lib<whatever>.la file
> in the first place
> 
> or
> 
> 2) libtool should be translating -R when it sees it to whatever is
> appropriate for the current compiler and/or linker, when libtool later
> links something with `lib<whatever>.la'.

I always apply something like the following to gettext. What is of
main interest is the last context diff. The rest is to make it
autoconf 2.5x compatible.

-- 
albert chin (address@hidden)

-- snip snip
--- m4/lib-link.m4.orig Fri Jul 26 18:57:36 2002
+++ m4/lib-link.m4      Wed Sep 11 11:39:34 2002
@@ -19,21 +19,21 @@
   define([Name],[translit([$1],[./-], [___])])
   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+  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"
+    [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"
+  [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 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
+  [HAVE_LIB]NAME=yes
   undefine([Name])
   undefine([NAME])
 ])
@@ -54,34 +54,34 @@
   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
-  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  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,
-  dnl because if the user has installed lib[]Name and not disabled its use
-  dnl via --without-lib[]Name-prefix, he wants to use it.
+  dnl Add [$INC]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed [lib]Name and not disabled its use
+  dnl via [--without-lib]Name-prefix, he wants to use it.
   ac_save_CPPFLAGS="$CPPFLAGS"
   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
-  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+  AC_CACHE_CHECK([for [lib]$1], [[ac_cv_lib]Name], [
     ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIB[]NAME"
-    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    LIBS="$LIBS [$LIB]NAME"
+    AC_TRY_LINK([$3], [$4], [[ac_cv_lib]Name=yes], [[ac_cv_lib]Name=no])
     LIBS="$ac_save_LIBS"
   ])
-  if test "$ac_cv_lib[]Name" = yes; then
-    HAVE_LIB[]NAME=yes
+  if test "[$ac_cv_lib]Name" = yes; then
+    [HAVE_LIB]NAME=yes
     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
-    AC_MSG_CHECKING([how to link with lib[]$1])
-    AC_MSG_RESULT([$LIB[]NAME])
+    AC_MSG_CHECKING([how to link with [lib]$1])
+    AC_MSG_RESULT([[$LIB]NAME])
   else
-    HAVE_LIB[]NAME=no
-    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
-    dnl $INC[]NAME either.
+    [HAVE_LIB]NAME=no
+    dnl If [$LIB]NAME didn't lead to a usable library, we don't need
+    dnl [$INC]NAME either.
     CPPFLAGS="$ac_save_CPPFLAGS"
-    LIB[]NAME=
-    LTLIB[]NAME=
+    [LIB]NAME=
+    [LTLIB]NAME=
   fi
   AC_SUBST([HAVE_LIB]NAME)
   AC_SUBST([LIB]NAME)
@@ -155,9 +155,9 @@
 ])
   dnl Search the library and its dependencies in $additional_libdir and
   dnl $LDFLAGS. Using breadth-first-seach.
-  LIB[]NAME=
-  LTLIB[]NAME=
-  INC[]NAME=
+  [LIB]NAME=
+  [LTLIB]NAME=
+  [INC]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
@@ -182,9 +182,9 @@
         if test -n "$value"; then
           if test "$value" = yes; then
             eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            test -z "$value" || [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$value"
             eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ 
}$value"
+            test -z "$value" || [LTLIB]NAME="${[LTLIB]NAME}${[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.
@@ -215,7 +215,7 @@
             fi
           fi
           if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIB[]NAME; do
+            for x in $LDFLAGS [$LTLIB]NAME; do
               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
               case "$x" in
                 -L*)
@@ -244,14 +244,14 @@
           fi
           if test "X$found_dir" != "X"; then
             dnl Found the library.
-            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            [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 "$enable_rpath" = no || test "X$found_dir" = 
"X/usr/lib"; then
                 dnl No hardcoding is needed.
-                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$found_so"
               else
                 dnl Use an explicit option to hardcode DIR into the resulting
                 dnl binary.
@@ -271,12 +271,13 @@
                 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"
+                  [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$found_so"
                 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"
+                  if test -n "$hardcode_libdir_flag_spec" && \
+                  test "$hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into
+                    dnl the resulting binary.
+                    [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }-L$found_dir -l$name"
                     dnl Potentially add DIR to rpathdirs.
                     dnl The rpathdirs will be appended to $LIBNAME at the end.
                     haveit=
@@ -294,7 +295,7 @@
                     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
+                    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
@@ -302,13 +303,13 @@
                       fi
                     done
                     if test -z "$haveit"; then
-                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                      [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"
+                      [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
@@ -317,7 +318,7 @@
                       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"
+                      [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }-l$name"
                     fi
                   fi
                 fi
@@ -325,11 +326,11 @@
             else
               if test "X$found_a" != "X"; then
                 dnl Linking with a static library.
-                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+                [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"
+                [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }-L$found_dir -l$name"
               fi
             fi
             dnl Assume the include files are nearby.
@@ -358,7 +359,7 @@
                   fi
                 fi
                 if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INC[]NAME; do
+                  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
@@ -368,7 +369,7 @@
                   if test -z "$haveit"; then
                     if test -d "$additional_includedir"; then
                       dnl Really add $additional_includedir to $INCNAME.
-                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ 
}-I$additional_includedir"
+                      [INC]NAME="${[INC]NAME}${[INC]NAME:+ 
}-I$additional_includedir"
                     fi
                   fi
                 fi
@@ -408,7 +409,7 @@
                       fi
                       if test -z "$haveit"; then
                         haveit=
-                        for x in $LDFLAGS $LIB[]NAME; do
+                        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
@@ -418,11 +419,11 @@
                         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"
+                            [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ 
}-L$additional_libdir"
                           fi
                         fi
                         haveit=
-                        for x in $LDFLAGS $LTLIB[]NAME; do
+                        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
@@ -432,7 +433,7 @@
                         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"
+                            [LTLIB]NAME="${[LTLIB]NAME}${[LTLIB]NAME:+ 
}-L$additional_libdir"
                           fi
                         fi
                       fi
@@ -479,8 +480,8 @@
                     ;;
                   *)
                     dnl Most likely an immediate library name.
-                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
-                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$dep"
+                    [LTLIB]NAME="${[LTLIB]NAME}${[LTLIB]NAME:+ }$dep"
                     ;;
                 esac
               done
@@ -490,8 +491,8 @@
             dnl known to the linker and runtime loader. (All the system
             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"
+            [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }-l$name"
+            [LTLIB]NAME="${[LTLIB]NAME}${[LTLIB]NAME:+ }-l$name"
           fi
         fi
       fi
@@ -511,7 +512,7 @@
       libdir="$alldirs"
       eval flag=\"$hardcode_libdir_flag_spec\"
       libdir="$acl_save_libdir"
-      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$flag"
     else
       dnl The -rpath options are cumulative.
       for found_dir in $rpathdirs; do
@@ -519,16 +520,9 @@
         libdir="$found_dir"
         eval flag=\"$hardcode_libdir_flag_spec\"
         libdir="$acl_save_libdir"
-        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+        [LIB]NAME="${[LIB]NAME}${[LIB]NAME:+ }$flag"
       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
 ])
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]