From 94ae1714190d492723cc34ff51d6f45eb8beb4cc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 26 Mar 2009 01:18:35 +0000 Subject: [PATCH] * configure: Rebuild. * acinclude.m4 (AM_ICONV): Set am_cv_use_build_libiconv. Rearrange flags setting. Add comments. --- gdb/ChangeLog | 6 ++ gdb/acinclude.m4 | 55 +++++++++++++------ gdb/configure | 139 +++++++++++++++++++++++++++-------------------- 3 files changed, 122 insertions(+), 78 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc0d8ab12a..d52404d373 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-03-25 Tom Tromey + + * configure: Rebuild. + * acinclude.m4 (AM_ICONV): Set am_cv_use_build_libiconv. + Rearrange flags setting. Add comments. + 2009-03-25 Pierre Muller * config/i386/nm-i386.h: Remove code within diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 1897045be8..5e77230d7b 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -177,8 +177,8 @@ AC_DEFUN([AM_ICONV], AC_ARG_WITH([libiconv-prefix], [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; LDFLAGS="$LDFLAGS -L$dir/lib"; fi + if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; fi + if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; fi done ]) @@ -189,30 +189,24 @@ 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_LIBS="$LIBS" - LIBS="$LIBS -liconv" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) - LIBS="$am_save_LIBS" - fi - # Look for libiconv in the build tree. - if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then - am_save_LIBS="$LIBS" 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("",""); @@ -223,10 +217,34 @@ AC_DEFUN([AM_ICONV], 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" + 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 ]) + + # Set the various flags based on the cache variables. We can't rely + # on the flags to remain set from the above code, due to caching. LIBICONV= if test "$am_cv_lib_iconv" = yes; then LIBICONV="-liconv" + else + LIBICONV_LIBDIR= + LIBICONV_INCLUDE= fi if test "$am_cv_use_build_libiconv" = yes; then LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR" @@ -234,6 +252,7 @@ AC_DEFUN([AM_ICONV], fi CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" LIBS="$LIBS $LIBICONV_LIBDIR $LIBICONV" + if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) AC_MSG_CHECKING([for iconv declaration]) diff --git a/gdb/configure b/gdb/configure index fceba2aa14..51f35f5c1f 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10012,8 +10012,8 @@ if test "${with_libiconv_prefix+set}" = set; then withval="$with_libiconv_prefix" for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; LDFLAGS="$LDFLAGS -L$dir/lib"; fi + if test -d $dir/include; then LIBICONV_INCLUDE="-I$dir/include"; fi + if test -d $dir/lib; then LIBICONV_LIBDIR="-L$dir/lib"; fi done fi; @@ -10030,6 +10030,7 @@ 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 /* confdefs.h. */ _ACEOF @@ -10078,66 +10079,17 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - # Look for 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 @@ -10184,6 +10136,66 @@ else echo "$as_me: failed program was:" >&5 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" + 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 +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&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_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -10194,9 +10206,15 @@ rm -f conftest.err conftest.$ac_objext \ fi echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 echo "${ECHO_T}$am_cv_func_iconv" >&6 + + # Set the various flags based on the cache variables. We can't rely + # on the flags to remain set from the above code, due to caching. LIBICONV= if test "$am_cv_lib_iconv" = yes; then LIBICONV="-liconv" + else + LIBICONV_LIBDIR= + LIBICONV_INCLUDE= fi if test "$am_cv_use_build_libiconv" = yes; then LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR" @@ -10204,6 +10222,7 @@ echo "${ECHO_T}$am_cv_func_iconv" >&6 fi CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" LIBS="$LIBS $LIBICONV_LIBDIR $LIBICONV" + if test "$am_cv_func_iconv" = yes; then cat >>confdefs.h <<\_ACEOF