1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 dnl Several autoconf functions AC_REQUIRE AC_PROG_CPP/AC_PROG_CXXCPP
6 dnl or AC_HEADER_STDC, meaning they are called even when we don't call
8 dnl However, theses checks are not necessary and python configure sets
9 dnl the corresponding variables already, so just skip those tests
11 define([AC_PROG_CPP],[])
12 define([AC_PROG_CXXCPP],[])
13 define([AC_HEADER_STDC], [])
15 AC_DEFUN([MOZ_TOOL_VARIABLES],
21 if test "$CC_TYPE" = "gcc"; then
26 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
34 if test "$CC_TYPE" = "clang"; then
40 if test "$CC_TYPE" = "clang-cl"; then
44 if test "$GNU_CC"; then
45 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
54 AC_DEFUN([MOZ_CROSS_COMPILER],
56 echo "cross compiling from $host to $target"
58 if test -z "$HOST_AR_FLAGS"; then
59 HOST_AR_FLAGS="$AR_FLAGS"
61 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
62 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
64 dnl AC_CHECK_PROGS manually goes through $PATH, and as such fails to handle
65 dnl absolute or relative paths. Relative paths wouldn't work anyways, but
66 dnl absolute paths would. Trick AC_CHECK_PROGS into working in that case by
67 dnl adding / to PATH. This is temporary until this moves to moz.configure
70 case "${TOOLCHAIN_PREFIX}" in
78 AC_CHECK_PROGS(RANLIB, "${TOOLCHAIN_PREFIX}ranlib", :)
79 AC_CHECK_PROGS(AR, "${TOOLCHAIN_PREFIX}ar", :)
80 AC_CHECK_PROGS(AS, "${TOOLCHAIN_PREFIX}as", :)
81 AC_CHECK_PROGS(LIPO, "${TOOLCHAIN_PREFIX}lipo", :)
82 AC_CHECK_PROGS(STRIP, "${TOOLCHAIN_PREFIX}strip", :)
83 AC_CHECK_PROGS(WINDRES, "${TOOLCHAIN_PREFIX}windres", :)
84 AC_CHECK_PROGS(OTOOL, "${TOOLCHAIN_PREFIX}otool", :)
85 AC_CHECK_PROGS(OBJCOPY, "${TOOLCHAIN_PREFIX}objcopy", :)
91 dnl Updates to the test below should be duplicated further below for the
92 dnl cross-compiling case.
94 if test "$GNU_CXX"; then
95 AC_CACHE_CHECK([whether 64-bits std::atomic requires -latomic],
100 [ std::atomic<uint64_t> foo; foo = 1; ],
101 ac_cv_needs_atomic=no,
103 LIBS="$LIBS -latomic"
107 [ std::atomic<uint64_t> foo; foo = 1; ],
108 ac_cv_needs_atomic=yes,
109 ac_cv_needs_atomic="do not know; assuming no")
113 if test "$ac_cv_needs_atomic" = yes; then
114 MOZ_NEEDS_LIBATOMIC=1
118 AC_SUBST(MOZ_NEEDS_LIBATOMIC)