aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-03-26 01:18:35 +0000
committerTom Tromey <tromey@redhat.com>2009-03-26 01:18:35 +0000
commit94ae1714190d492723cc34ff51d6f45eb8beb4cc (patch)
tree61f2b290041d1994a3f16484fafe1ab7a2152624
parent2bc57ae31d16179dbe6b7401d497b071c8ce4459 (diff)
downloadgdb-94ae1714190d492723cc34ff51d6f45eb8beb4cc.zip
gdb-94ae1714190d492723cc34ff51d6f45eb8beb4cc.tar.gz
gdb-94ae1714190d492723cc34ff51d6f45eb8beb4cc.tar.bz2
* configure: Rebuild.
* acinclude.m4 (AM_ICONV): Set am_cv_use_build_libiconv. Rearrange flags setting. Add comments.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/acinclude.m425
-rwxr-xr-xgdb/configure27
3 files changed, 51 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc0d8ab..d52404d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-25 Tom Tromey <tromey@redhat.com>
+
+ * configure: Rebuild.
+ * acinclude.m4 (AM_ICONV): Set am_cv_use_build_libiconv.
+ Rearrange flags setting. Add comments.
+
2009-03-25 Pierre Muller <muller@ics.u-strasbg.fr>
* config/i386/nm-i386.h: Remove code within
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 1897045..5e77230 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,14 +189,23 @@ 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 <stdlib.h>
#include <iconv.h>],
[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"
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 <stdlib.h>
#include <iconv.h>],
@@ -206,8 +215,10 @@ AC_DEFUN([AM_ICONV],
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
+ CPPFLAGS="$am_save_CPPFLAGS"
fi
- # Look for libiconv in the build tree.
+
+ # 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"
@@ -218,15 +229,22 @@ AC_DEFUN([AM_ICONV],
[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 fceba2a..51f35f5 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,8 +10079,16 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+
+ # 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"
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. */
@@ -10131,8 +10140,10 @@ fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS="$am_save_LIBS"
+ CPPFLAGS="$am_save_CPPFLAGS"
fi
- # Look for libiconv in the build tree.
+
+ # 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"
@@ -10178,7 +10189,8 @@ 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_use_build_libiconv=yes
+ am_cv_lib_iconv=yes
am_cv_func_iconv=yes
else
echo "$as_me: failed program was:" >&5
@@ -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