From 4edb1e84b10c08cf1606165ec3918aa1724b219f Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 6 May 2009 23:05:28 +0000 Subject: [PATCH] * acinclude.m4 (AM_ICONV): Prefer in-tree libiconv if present over system iconv. * configure: Regenerate. --- gdb/ChangeLog | 6 ++++++ gdb/acinclude.m4 | 48 ++++++++++++++++++++++-------------------- gdb/configure | 54 ++++++++++++++++++++++++++---------------------- 3 files changed, 61 insertions(+), 47 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e219552a8a6..8271e5a5112 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-05-06 Joel Brobecker + + * acinclude.m4 (AM_ICONV): Prefer in-tree libiconv if present over + system iconv. + * configure: Regenerate. + 2009-05-06 Joel Brobecker * utils.c: Add include of gdb_usleep.h. diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index d1f71c185bc..c32e1ea4d3b 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -189,47 +189,51 @@ AC_DEFUN([AM_ICONV], am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_cv_use_build_libiconv=no - # First, try to find iconv in libc. - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) - # If iconv was not in libc, try -liconv. In this case, arrange to - # look in the libiconv prefix, if it was specified by the user. - if test "$am_cv_func_iconv" != yes; then - am_save_CPPFLAGS="$CPPFLAGS" + # 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" - if test -n "$LIBICONV_INCLUDE"; then - CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" - LIBS="$LIBS $LIBICONV_LIBDIR" - fi - LIBS="$LIBS -liconv" + am_save_CPPFLAGS="$CPPFLAGS" + LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv" + CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE" AC_TRY_LINK([#include #include ], [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" fi - # If that didn't work, try to find libiconv in the build tree. - if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then - am_save_LIBS="$LIBS" + # Next, try to find iconv in libc. + if test "$am_cv_func_iconv" != yes; then + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + fi + + # If iconv was not in libc, try -liconv. In this case, arrange to + # look in the libiconv prefix, if it was specified by the user. + if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" - LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv" - CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE" + am_save_LIBS="$LIBS" + if test -n "$LIBICONV_INCLUDE"; then + CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" + LIBS="$LIBS $LIBICONV_LIBDIR" + fi + LIBS="$LIBS -liconv" AC_TRY_LINK([#include #include ], [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" diff --git a/gdb/configure b/gdb/configure index 4444ffa3f5b..449e8762481 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10116,8 +10116,15 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_cv_use_build_libiconv=no - # First, try to find iconv in libc. - cat >conftest.$ac_ext <<_ACEOF + + # 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10129,8 +10136,8 @@ 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; } @@ -10157,7 +10164,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_func_iconv=yes + am_cv_use_build_libiconv=yes + am_cv_lib_iconv=yes + am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10165,17 +10174,12 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + CPPFLAGS="$am_save_CPPFLAGS" + fi - # If iconv was not in libc, try -liconv. In this case, arrange to - # look in the libiconv prefix, if it was specified by the user. + # Next, try to find iconv in libc. if test "$am_cv_func_iconv" != yes; then - am_save_CPPFLAGS="$CPPFLAGS" - am_save_LIBS="$LIBS" - if test -n "$LIBICONV_INCLUDE"; then - CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" - LIBS="$LIBS $LIBICONV_LIBDIR" - fi - LIBS="$LIBS -liconv" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -10216,8 +10220,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes + am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10225,16 +10228,18 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - CPPFLAGS="$am_save_CPPFLAGS" fi - # If that didn't work, try to find libiconv in the build tree. - if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then - am_save_LIBS="$LIBS" + # If iconv was not in libc, try -liconv. In this case, arrange to + # look in the libiconv prefix, if it was specified by the user. + if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" - LIBS="$LIBS $BUILD_LIBICONV_LIBDIR -liconv" - CPPFLAGS="$CPPFLAGS $BUILD_LIBICONV_INCLUDE" + am_save_LIBS="$LIBS" + if test -n "$LIBICONV_INCLUDE"; then + CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" + LIBS="$LIBS $LIBICONV_LIBDIR" + fi + LIBS="$LIBS -liconv" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -10275,8 +10280,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_use_build_libiconv=yes - am_cv_lib_iconv=yes + am_cv_lib_iconv=yes am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 -- 2.30.2