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]

Patch: FYI: fix charset configury bug


I'm checking this in.

This fixes a charset configury bug that Pedro ran across.
The problem manifested on Cygwin, where he was unable to change the
target charset.  This turned out to happen because configure did not
correctly detect 'iconvlist', leading to the wrong find_charset_names
being used.

I rebuilt with this on x86 F9 without problems, and Pedro built on
Cygwin.

Tom

2009-03-24  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <pedro@codesourcery.com>

	* configure, config.in: Rebuild.
	* configure.ac: Check for libiconvlist.
	* charset.c: Check HAVE_LIBICONVLIST.
	* acinclude.m4 (AM_ICONV): Don't subst LIBICONV, LIBICONV_INCLUDE,
	LIBICONV_LIBDIR.  Update CPPFLAGS and LIBS.
	* Makefile.in (LIBICONV, LIBICONV_INCLUDE, LIBICONV_LIBDIR):
	Remove.
	(INTERNAL_CFLAGS_BASE): Update.
	(INTERNAL_LDFLAGS): Update.
	(CLIBS): Update.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1074
diff -u -r1.1074 Makefile.in
--- Makefile.in	24 Mar 2009 01:37:48 -0000	1.1074
+++ Makefile.in	25 Mar 2009 00:56:14 -0000
@@ -163,11 +163,6 @@
 INTL_DEPS = @LIBINTL_DEP@
 INTL_CFLAGS = @INCINTL@
 
-# Where is the ICONV library?  This can be empty if libc has iconv.
-LIBICONV = @LIBICONV@
-LIBICONV_INCLUDE = @LIBICONV_INCLUDE@
-LIBICONV_LIBDIR = @LIBICONV_LIBDIR@
-
 # Did the user give us a --with-sysroot option?
 TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
@@ -392,8 +387,7 @@
 	$(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
 	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \
 	$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
-	$(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) \
-	$(LIBICONV_INCLUDE)
+	$(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS)
 INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
 INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
 
@@ -405,7 +399,7 @@
 # I think it's perfectly reasonable for a user to set -pg in CFLAGS
 # and have it work; that's why CFLAGS is here.
 # PROFILE_CFLAGS is _not_ included, however, because we use monstartup.
-INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_LDFLAGS) $(LIBICONV_LIBDIR)
+INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_LDFLAGS)
 
 # If your system is missing alloca(), or, more likely, it's there but
 # it doesn't work, then refer to libiberty.
@@ -420,7 +414,7 @@
 	-lintl -liberty $(LIBGNU)
 CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
 	$(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
-	$(LIBICONV) $(LIBEXPAT) \
+	$(LIBEXPAT) \
 	$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU)
 CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
 	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.25
diff -u -r1.25 acinclude.m4
--- acinclude.m4	20 Mar 2009 23:04:27 -0000	1.25
+++ acinclude.m4	25 Mar 2009 00:56:14 -0000
@@ -221,13 +221,19 @@
         am_cv_lib_iconv=yes
         am_cv_func_iconv=yes)
       LIBS="$am_save_LIBS"
-      if test "$am_cv_func_iconv" = "yes"; then
-         am_cv_use_build_libiconv=yes
-      else
-      	 CPPFLAGS="$am_save_CPPFLAGS"
-      fi
+      CPPFLAGS="$am_save_CPPFLAGS"
     fi
   ])
+  LIBICONV=
+  if test "$am_cv_lib_iconv" = yes; then
+    LIBICONV="-liconv"
+  fi
+  if test "$am_cv_use_build_libiconv" = yes; then
+    LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
+    LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
+  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])
@@ -252,17 +258,6 @@
     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
       [Define as const if the declaration of iconv() needs const.])
   fi
-  LIBICONV=
-  if test "$am_cv_lib_iconv" = yes; then
-    LIBICONV="-liconv"
-  fi
-  if test "$am_cv_use_build_libiconv" = yes; then
-    LIBICONV_LIBDIR="$BUILD_LIBICONV_LIBDIR"
-    LIBICONV_INCLUDE="$BUILD_LIBICONV_INCLUDE"
-  fi
-  AC_SUBST(LIBICONV)
-  AC_SUBST(LIBICONV_INCLUDE)
-  AC_SUBST(LIBICONV_LIBDIR)
 ])
 
 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva 
Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.18
diff -u -r1.18 charset.c
--- charset.c	23 Mar 2009 17:48:09 -0000	1.18
+++ charset.c	25 Mar 2009 00:56:14 -0000
@@ -664,7 +664,13 @@
 }
 
 #else /* PHONY_ICONV */
-#ifdef HAVE_ICONVLIST
+
+/* Sometimes, libiconv redefines iconvlist as libiconvlist -- but
+   provides different symbols in the static and dynamic libraries.
+   So, configure may see libiconvlist but not iconvlist.  But, calling
+   iconvlist is the right thing to do and will work.  Hence we do a
+   check here but unconditionally call iconvlist below.  */
+#if defined (HAVE_ICONVLIST) || defined (HAVE_LIBICONVLIST)
 
 /* A helper function that adds some character sets to the vector of
    all character sets.  This is a callback function for iconvlist.  */
@@ -723,7 +729,7 @@
   VEC_safe_push (char_ptr, charsets, NULL);
 }
 
-#endif /* HAVE_ICONVLIST */
+#endif /* HAVE_ICONVLIST || HAVE_LIBICONVLIST */
 #endif /* PHONY_ICONV */
 
 void
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.90
diff -u -r1.90 configure.ac
--- configure.ac	24 Mar 2009 17:01:34 -0000	1.90
+++ configure.ac	25 Mar 2009 00:56:16 -0000
@@ -796,7 +796,7 @@
 AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \
                 getgid poll pread64 sbrk setpgid setpgrp setsid \
 		sigaction sigprocmask sigsetmask socketpair syscall \
-		ttrace wborder setlocale iconvlist])
+		ttrace wborder setlocale iconvlist libiconvlist])
 AM_LANGINFO_CODESET
 
 # Check the return and argument types of ptrace.  No canned test for


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