Bug 1747970 - Add `extern "C"` to symbols checks using the C++ compiler. r=firefox-build-system-reviewers,mhentges
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 31 Dec 2021 06:50:29 +0000
changeset 603506 356b8ae1f11ffe618487670ecdbdaf6daa445983
parent 603505 a0d55807c6b12dd8a9ab3ad6a0094520b9983002
child 603507 4343f0bf8d112cbcb2f50c5f3e5b043ff5087c83
push id39105
push userabutkovits@mozilla.com
push dateFri, 31 Dec 2021 09:17:02 +0000
treeherdermozilla-central@356b8ae1f11f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, mhentges
bugs1747970
milestone97.0a1
first release with
nightly linux32
356b8ae1f11f / 97.0a1 / 20211231091702 / files
nightly linux64
356b8ae1f11f / 97.0a1 / 20211231091702 / files
nightly mac
356b8ae1f11f / 97.0a1 / 20211231091702 / files
nightly win32
356b8ae1f11f / 97.0a1 / 20211231091702 / files
nightly win64
356b8ae1f11f / 97.0a1 / 20211231091702 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1747970 - Add `extern "C"` to symbols checks using the C++ compiler. r=firefox-build-system-reviewers,mhentges That's what AC_CHECK_FUNC does, and is necessary to check functions in the C++ runtime (e.g. __cxa_demangle). Differential Revision: https://phabricator.services.mozilla.com/D134856
build/moz.configure/compile-checks.configure
--- a/build/moz.configure/compile-checks.configure
+++ b/build/moz.configure/compile-checks.configure
@@ -98,31 +98,31 @@ def check_headers(*headers, **kwargs):
 # Checks for the presence of the given symbol on the target system by compiling
 # a test program. The return value of the template is a check function
 # returning True if the symbol can be found, and None if it is not.
 @template
 def check_symbol(symbol, language="C", flags=None, when=None, onerror=lambda: None):
     if when is None:
         when = always
 
-    compiler = {
-        "C": c_compiler,
-        "C++": cxx_compiler,
+    compiler, extern_c = {
+        "C": (c_compiler, ""),
+        "C++": (cxx_compiler, 'extern "C" '),
     }[language]
 
     # Stolen from autoconf 2.13 ; might be irrelevant now, but it doesn't hurt to
     # keep using a char return type.
     comment = [
         "/* Override any gcc2 internal prototype to avoid an error.  */",
         "/* We use char because int might match the return type of a gcc2",
         "    builtin and then its argument prototype would still apply.  */",
     ]
 
     return compiler.try_run(
-        header=comment + ["char %s();" % symbol],
+        header=comment + ["%schar %s();" % (extern_c, symbol)],
         body="%s();" % symbol,
         flags=flags,
         check_msg="for %s" % symbol,
         when=when,
         onerror=onerror,
     )