* acinclude.m4: Link against in-tree libiconv by adding
authorJoel Brobecker <brobecker@gnat.com>
Wed, 9 Dec 2009 10:07:15 +0000 (10:07 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 9 Dec 2009 10:07:15 +0000 (10:07 +0000)
            libiconv.a to the LIBS instead of using -liconv.
            * configure: Regenerate.

gdb/ChangeLog
gdb/acinclude.m4
gdb/configure

index 23a7bc019426e1235a8daec8cad9b81342804a22..7197d12468a8f5f9e4ea83e95f32a048551c1cb0 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-09  Joel Brobecker  <brobecker@adacore.com>
+
+       * acinclude.m4: Link against in-tree libiconv by adding
+       libiconv.a to the LIBS instead of using -liconv.
+       * configure: Regenerate.
+
 2009-12-08  Phil Muldoon  <pmuldoon@redhat.com>
 
        PR python/10804
index af4639b3250e79f38cb10fa10ada82229f40c03f..3684c1861c7b8c396f2349d69449e173517d6c2b 100644 (file)
@@ -184,7 +184,7 @@ AC_DEFUN([AM_ICONV],
     done
    ])
 
-  BUILD_LIBICONV_LIBDIR="-L../libiconv/lib/.libs -L../libiconv/lib/_libs"
+  BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
   BUILD_LIBICONV_INCLUDE="-I../libiconv/include"
 
   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
@@ -195,20 +195,26 @@ AC_DEFUN([AM_ICONV],
     # If libiconv is part of the build tree, then try using it over
     # any system iconv.
     if test -d ../libiconv; then
-      am_save_LIBS="$LIBS"
-      am_save_CPPFLAGS="$CPPFLAGS"
-      LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
-      CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
-      AC_TRY_LINK([#include <stdlib.h>
+      for lib_dir in $BUILD_LIBICONV_LIBDIRS; do
+        am_save_LIBS="$LIBS"
+        am_save_CPPFLAGS="$CPPFLAGS"
+        LIBS="$LIBS $lib_dir/libiconv.a"
+        CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
+        AC_TRY_LINK([#include <stdlib.h>
 #include <iconv.h>],
-        [iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);],
-       am_cv_use_build_libiconv=yes
-        am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes)
-      LIBS="$am_save_LIBS"
-      CPPFLAGS="$am_save_CPPFLAGS"
+          [iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);],
+          am_cv_use_build_libiconv=yes
+          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
     fi
 
     # Next, try to find iconv in libc.
@@ -253,7 +259,8 @@ AC_DEFUN([AM_ICONV],
     LIBICONV_INCLUDE=
   fi
   if test "$am_cv_use_build_libiconv" = yes; then
-    LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
+    LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+    LIBICONV_LIBDIR=""
     LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
   fi
   CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"
index e74b64f2bbae332f4c5d2e3767130fdecd1f89e3..de8de9124586ed2bdad8f24e9e4bc9c52d921c39 100755 (executable)
@@ -8316,7 +8316,7 @@ if test "${with_libiconv_prefix+set}" = set; then :
 fi
 
 
-  BUILD_LIBICONV_LIBDIR="-L../libiconv/lib/.libs -L../libiconv/lib/_libs"
+  BUILD_LIBICONV_LIBDIRS="../libiconv/lib/.libs ../libiconv/lib/_libs"
   BUILD_LIBICONV_INCLUDE="-I../libiconv/include"
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
@@ -8332,11 +8332,12 @@ else
     # If libiconv is part of the build tree, then try using it over
     # any system iconv.
     if test -d ../libiconv; then
-      am_save_LIBS="$LIBS"
-      am_save_CPPFLAGS="$CPPFLAGS"
-      LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv"
-      CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      for lib_dir in $BUILD_LIBICONV_LIBDIRS; do
+        am_save_LIBS="$LIBS"
+        am_save_CPPFLAGS="$CPPFLAGS"
+        LIBS="$LIBS $lib_dir/libiconv.a"
+        CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <iconv.h>
@@ -8344,21 +8345,26 @@ int
 main ()
 {
 iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   am_cv_use_build_libiconv=yes
-        am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes
+          am_cv_lib_iconv=yes
+          am_cv_func_iconv=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-      LIBS="$am_save_LIBS"
-      CPPFLAGS="$am_save_CPPFLAGS"
+        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
     fi
 
     # Next, try to find iconv in libc.
@@ -8432,7 +8438,8 @@ $as_echo "$am_cv_func_iconv" >&6; }
     LIBICONV_INCLUDE=
   fi
   if test "$am_cv_use_build_libiconv" = yes; then
-    LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
+    LIBICONV="$BUILD_LIBICONV_LIBDIR/libiconv.a"
+    LIBICONV_LIBDIR=""
     LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
   fi
   CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE"