Bug 967556 - Divert AC_CHECK_FUNC so that the #includes it uses can't interfere with the function it tests. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 14 Feb 2014 08:15:02 +0900
changeset 168723 95c7723f382f2ba770e123729650f8c79be7a364
parent 168722 37b53e9bf06fa0e2e2b03870842ca61729a3814a
child 168724 5ae4fa0b13400c728dfe5617410e2c5290475e78
push id5094
push userryanvm@gmail.com
push dateFri, 14 Feb 2014 13:58:22 +0000
treeherderfx-team@7a3adc5aac28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs967556
milestone30.0a1
Bug 967556 - Divert AC_CHECK_FUNC so that the #includes it uses can't interfere with the function it tests. r=gps
aclocal.m4
build/autoconf/hotfixes.m4
js/src/aclocal.m4
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,13 +1,14 @@
 dnl
 dnl Local autoconf macros used with mozilla
 dnl The contents of this file are under the Public Domain.
 dnl
 
+builtin(include, build/autoconf/hotfixes.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 builtin(include, build/autoconf/hooks.m4)dnl
 builtin(include, build/autoconf/config.status.m4)dnl
 builtin(include, build/autoconf/toolchain.m4)dnl
 builtin(include, build/autoconf/ccache.m4)dnl
 builtin(include, build/autoconf/wrapper.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
 builtin(include, build/autoconf/nss.m4)dnl
new file mode 100644
--- /dev/null
+++ b/build/autoconf/hotfixes.m4
@@ -0,0 +1,23 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Set of hotfixes to address issues in autoconf 2.13
+
+dnl Divert AC_CHECK_FUNC so that the #includes it uses can't interfere
+dnl with the function it tests.
+dnl So, when testing e.g. posix_memalign, any #include that AC_CHECK_FUNC
+dnl prints is replaced with:
+dnl   #define posix_memalign innocuous_posix_memalign
+dnl   #include "theinclude"
+dnl   #undef posix_memalign
+dnl This avoids double declaration of that function when the header normally
+dnl declares it, while the test itself is just expecting the function not to be
+dnl declared at all, and declares it differently (which doesn't matter for the
+dnl test itself).
+dnl More recent versions of autoconf are essentially doing this.
+define([_AC_CHECK_FUNC],defn([AC_CHECK_FUNC]))dnl
+define([AC_CHECK_FUNC], [dnl
+patsubst(_AC_CHECK_FUNC($@), [#include.*], [#define $1 innocuous_$1
+\&
+#undef $1])])dnl
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -1,13 +1,14 @@
 dnl
 dnl Local autoconf macros used with mozilla
 dnl The contents of this file are under the Public Domain.
 dnl
 
+builtin(include, ../../build/autoconf/hotfixes.m4)dnl
 builtin(include, ../../build/autoconf/acwinpaths.m4)dnl
 builtin(include, ../../build/autoconf/hooks.m4)dnl
 builtin(include, ../../build/autoconf/config.status.m4)dnl
 builtin(include, ../../build/autoconf/toolchain.m4)dnl
 builtin(include, ../../build/autoconf/ccache.m4)dnl
 builtin(include, ../../build/autoconf/wrapper.m4)dnl
 builtin(include, ../../build/autoconf/pkg.m4)dnl
 builtin(include, ../../build/autoconf/nspr.m4)dnl