This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Check decls in C, not C++
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Tue, 23 Jun 2009 07:39:23 -0700
- Subject: gold patch committed: Check decls in C, not C++
For AC_CHECK_DECLS autoconf generates tests which simply assign the
function pointer to a variable. When compiling with C++, this fails if
the function is overloaded. The current version of glibc does in fact
overload some functions when compiling with C++. This causes confusion
over whether basename is defined.
I committed this patch to gold to try to avoid this problem by running
AC_CHECK_DECLS using C rather than C++.
Ian
2009-06-23 Ian Lance Taylor <iant@google.com>
* configure.ac: Call AC_CHECK_DECLS using C, not C++.
* configure: Rebuild.
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gold/configure.ac,v
retrieving revision 1.44
diff -u -r1.44 configure.ac
--- configure.ac 22 Jun 2009 06:51:53 -0000 1.44
+++ configure.ac 23 Jun 2009 14:36:30 -0000
@@ -321,13 +321,18 @@
AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_search_zlibVersion" != "no")
+dnl We have to check these in C, not C++, because autoconf generates
+dnl tests which have no type information, and current glibc provides
+dnl multiple declarations of functions like basename when compiling
+dnl with C++.
+AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
+
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_HEADERS(byteswap.h)
AC_CHECK_FUNCS(mallinfo posix_fallocate)
-AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
# at link time with some versions of GCC.