This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/commit] Cannot find in-tree libiconv.a after reconfigure.


To reproduce the problem: build GDB once with an in-tree lilbiconv.
Then touch configure and rebuild.  The build will fail because
the path to libiconv.a has suddenly disappeared.

    gcc -g [...] /libiconv.a [...]

That's my mistake, when I changed the AM_ICONV to link against
/path/to/libiconv.a instead of using -L/path/to -liconv.
The /path/to was stored inside a variable (BUILD_LIBICONV_LIBDIR)
which is computed inside a region that is only evaluated during
the first configure, due to an AC_CACHE_CHECK. As a result, during
the reconfigure, the variable was undefined.

The fix was to change the variable name to am_cv_build_libiconv_path.
That way, this variable gets cached as well.  I am not sure whether
this is relying on a implementation side-effect, or whether all _cv_
variables were meant to be cached - the autoconf documentation is not
entirely clear about that.

2009-12-30  Joel Brobecker  <brobecker@adacore.com>

        * acinclude.m4 (AM_ICONV): If we find an in-tree libiconv.a
        that we can use, then cache the path to this archive.
        * configure: Regenerate.

Tested on x86_linux by building GDB from scratch, and then rebuilding GDB
after having touch'ed gdb/configure.

I'm planning on committing this change in a few days, if there are no
objections.

-- 
Joel
commit 0f0d82e703f5fd966125d9715bd662f7da305ebf
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Wed Dec 30 11:46:09 2009 +0400

    Cannot find in-tree libiconv.a after reconfigure.
    
            * acinclude.m4 (AM_ICONV): If we find an in-tree libiconv.a
            that we can use, then cache the path to this archive.
            * configure: Regenerate.
    
    Tested on x86_linux by building GDB from scratch, and then rebuilding GDB
    after having touch'ed gdb/configure.

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 84a9084..e3f604e 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -192,6 +192,7 @@ AC_DEFUN([AM_ICONV],
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     am_cv_use_build_libiconv=no
+    am_cv_build_libiconv_path=
 
     # If libiconv is part of the build tree, then try using it over
     # any system iconv.
@@ -207,12 +208,12 @@ AC_DEFUN([AM_ICONV],
            iconv(cd,NULL,NULL,NULL,NULL);
            iconv_close(cd);],
           am_cv_use_build_libiconv=yes
+          am_cv_build_libiconv_path=$lib_dir/libiconv.a
           am_cv_lib_iconv=yes
           am_cv_func_iconv=yes)
         LIBS="$am_save_LIBS"
         CPPFLAGS="$am_save_CPPFLAGS"
         if test "$am_cv_use_build_libiconv" = "yes"; then
-          BUILD_LIBICONV_LIBDIR=$lib_dir
           break
         fi
       done
@@ -260,7 +261,7 @@ AC_DEFUN([AM_ICONV],
     LIBICONV_INCLUDE=
   fi
   if test "$am_cv_use_build_libiconv" = yes; then
-    LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+    LIBICONV="$am_cv_build_libiconv_path"
     LIBICONV_LIBDIR=""
     LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
   fi
diff --git a/gdb/configure b/gdb/configure
index de8de91..862c230 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -8328,6 +8328,7 @@ else
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     am_cv_use_build_libiconv=no
+    am_cv_build_libiconv_path=
 
     # If libiconv is part of the build tree, then try using it over
     # any system iconv.
@@ -8353,6 +8354,7 @@ iconv_t cd = iconv_open("","");
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   am_cv_use_build_libiconv=yes
+          am_cv_build_libiconv_path=$lib_dir/libiconv.a
           am_cv_lib_iconv=yes
           am_cv_func_iconv=yes
 fi
@@ -8361,7 +8363,6 @@ rm -f core conftest.err conftest.$ac_objext \
         LIBS="$am_save_LIBS"
         CPPFLAGS="$am_save_CPPFLAGS"
         if test "$am_cv_use_build_libiconv" = "yes"; then
-          BUILD_LIBICONV_LIBDIR=$lib_dir
           break
         fi
       done
@@ -8438,7 +8439,7 @@ $as_echo "$am_cv_func_iconv" >&6; }
     LIBICONV_INCLUDE=
   fi
   if test "$am_cv_use_build_libiconv" = yes; then
-    LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+    LIBICONV="$am_cv_build_libiconv_path"
     LIBICONV_LIBDIR=""
     LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
   fi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]