Advertisement
Guest User

Firefox 37.0.2 configure.in

a guest
Apr 25th, 2015
3,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
autoconf 311.03 KB | None | 0 0
  1. dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
  2. dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
  3. dnl This Source Code Form is subject to the terms of the Mozilla Public
  4. dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  5. dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6.  
  7. dnl Process this file with autoconf to produce a configure script.
  8. dnl ========================================================
  9.  
  10. AC_PREREQ(2.13)
  11. AC_INIT(config/config.mk)
  12. AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
  13. AC_CANONICAL_SYSTEM
  14. TARGET_CPU="${target_cpu}"
  15. TARGET_VENDOR="${target_vendor}"
  16. TARGET_OS="${target_os}"
  17.  
  18. dnl ========================================================
  19. dnl =
  20. dnl = Don't change the following two lines.  Doing so breaks:
  21. dnl =
  22. dnl = CFLAGS="-foo" ./configure
  23. dnl =
  24. dnl ========================================================
  25. CFLAGS="${CFLAGS=}"
  26. CPPFLAGS="${CPPFLAGS=}"
  27. CXXFLAGS="${CXXFLAGS=}"
  28. LDFLAGS="${LDFLAGS=}"
  29. HOST_CFLAGS="${HOST_CFLAGS=}"
  30. HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
  31. HOST_LDFLAGS="${HOST_LDFLAGS=}"
  32.  
  33. dnl ========================================================
  34. dnl = Preserve certain environment flags passed to configure
  35. dnl = We want sub projects to receive the same flags
  36. dnl = untainted by this configure script
  37. dnl ========================================================
  38. _SUBDIR_CC="$CC"
  39. _SUBDIR_CXX="$CXX"
  40. _SUBDIR_CFLAGS="$CFLAGS"
  41. _SUBDIR_CPPFLAGS="$CPPFLAGS"
  42. _SUBDIR_CXXFLAGS="$CXXFLAGS"
  43. _SUBDIR_LDFLAGS="$LDFLAGS"
  44. _SUBDIR_HOST_CC="$HOST_CC"
  45. _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
  46. _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
  47. _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
  48. _SUBDIR_CONFIG_ARGS="$ac_configure_args"
  49.  
  50. dnl Set the version number of the libs included with mozilla
  51. dnl ========================================================
  52. MOZJPEG=62
  53. MOZPNG=10616
  54. NSPR_VERSION=4
  55. NSPR_MINVER=4.10.8
  56. NSS_VERSION=3
  57.  
  58. dnl Set the minimum version of toolkit libs used by mozilla
  59. dnl ========================================================
  60. GLIB_VERSION=1.2.0
  61. PERL_VERSION=5.006
  62. CAIRO_VERSION=1.10
  63. PANGO_VERSION=1.22.0
  64. GTK2_VERSION=2.18.0
  65. GTK3_VERSION=3.0.0
  66. WINDRES_VERSION=2.14.90
  67. W32API_VERSION=3.14
  68. GNOMEVFS_VERSION=2.0
  69. GNOMEUI_VERSION=2.2.0
  70. GCONF_VERSION=1.2.1
  71. GIO_VERSION=2.20
  72. STARTUP_NOTIFICATION_VERSION=0.8
  73. DBUS_VERSION=0.60
  74. SQLITE_VERSION=3.8.7.4
  75.  
  76. MSMANIFEST_TOOL=
  77.  
  78. dnl Set various checks
  79. dnl ========================================================
  80. MISSING_X=
  81. AC_PROG_AWK
  82.  
  83. dnl Initialize the Pthread test variables early so they can be
  84. dnl  overridden by each platform.
  85. dnl ========================================================
  86. MOZ_USE_PTHREADS=
  87. _PTHREAD_LDFLAGS=""
  88.  
  89. dnl Do not allow objdir == srcdir builds.
  90. dnl ==============================================================
  91. _topsrcdir=`cd \`dirname $0\`; pwd`
  92. _objdir=`pwd`
  93.  
  94.  
  95. dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
  96. if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
  97.   echo "  ***"
  98.   echo "  * Building directly in the main source directory is not allowed."
  99.   echo "  *"
  100.   echo "  * To build, you must run configure from a separate directory"
  101.   echo "  * (referred to as an object directory)."
  102.   echo "  *"
  103.   echo "  * If you are building with a mozconfig, you will need to change your"
  104.   echo "  * mozconfig to point to a different object directory."
  105.   echo "  ***"
  106.   exit 1
  107. fi
  108.  
  109. # Check for a couple representative files in the source tree
  110. _conflict_files=
  111. for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
  112.   if test -f $file; then
  113.     _conflict_files="$_conflict_files $file"
  114.   fi
  115. done
  116. if test "$_conflict_files"; then
  117.   echo "***"
  118.   echo "*   Your source tree contains these files:"
  119.   for file in $_conflict_files; do
  120.     echo "*         $file"
  121.   done
  122.   cat 1>&2 <<-EOF
  123.   *   This indicates that you previously built in the source tree.
  124.   *   A source tree build can confuse the separate objdir build.
  125.   *
  126.   *   To clean up the source tree:
  127.   *     1. cd $_topsrcdir
  128.   *     2. gmake distclean
  129.   ***
  130. EOF
  131.   exit 1
  132.   break
  133. fi
  134. MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
  135.  
  136. MOZ_PYTHON
  137.  
  138. MOZ_DEFAULT_COMPILER
  139.  
  140. COMPILE_ENVIRONMENT=1
  141. MOZ_ARG_DISABLE_BOOL(compile-environment,
  142. [  --disable-compile-environment
  143.                           Disable compiler/library checks.],
  144.     COMPILE_ENVIRONMENT= )
  145. AC_SUBST(COMPILE_ENVIRONMENT)
  146.  
  147. MOZ_ARG_WITH_STRING(l10n-base,
  148. [  --with-l10n-base=DIR    path to l10n repositories],
  149.     L10NBASEDIR=$withval)
  150. if test -n "$L10NBASEDIR"; then
  151.     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
  152.         AC_MSG_ERROR([--with-l10n-base must specify a path])
  153.     elif test -d "$L10NBASEDIR"; then
  154.         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
  155.     else
  156.         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
  157.    fi
  158. fi
  159. AC_SUBST(L10NBASEDIR)
  160.  
  161. dnl Check for Perl first -- needed for win32 SDK checks
  162. MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
  163. if test -z "$PERL" -o "$PERL" = ":"; then
  164.    AC_MSG_ERROR([perl not found in \$PATH])
  165. fi
  166.  
  167. if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
  168.    AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
  169. fi
  170.  
  171. AC_SUBST(GAIADIR)
  172. if test -n "$GAIADIR" ; then
  173.     AC_DEFINE(PACKAGE_GAIA)
  174. fi
  175.  
  176. if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
  177.     AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
  178. fi
  179.  
  180. if test -n "$FXOS_SIMULATOR" ; then
  181.     AC_DEFINE(FXOS_SIMULATOR)
  182.     AC_SUBST(FXOS_SIMULATOR)
  183. fi
  184.  
  185. if test -n "$MOZTTDIR" -a ! -d "$MOZTTDIR" ; then
  186.     AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
  187. fi
  188.  
  189. AC_SUBST(MOZTTDIR)
  190. if test -n "$MOZTTDIR" ; then
  191.    AC_DEFINE(PACKAGE_MOZTT)
  192. fi
  193.  
  194. MOZ_ARG_WITH_STRING(gonk,
  195. [  --with-gonk=DIR
  196.               location of gonk dir],
  197.    gonkdir=$withval)
  198.  
  199. MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
  200. [  --with-gonk-toolchain-prefix=DIR
  201.                          prefix to gonk toolchain commands],
  202.    gonk_toolchain_prefix=$withval)
  203.  
  204. if test -n "$gonkdir" ; then
  205.    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
  206.    android_source="$gonkdir"
  207.    ANDROID_SOURCE="$android_source"
  208.    ANDROID_NDK="${ANDROID_SOURCE}/ndk"
  209.    dnl Default to ICS
  210.    ANDROID_VERSION=15
  211.    if test -n "${PLATFORM_SDK_VERSION}"; then
  212.        ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
  213.    fi
  214.  
  215.    dnl set up compilers
  216.    TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
  217.    AS="$gonk_toolchain_prefix"as
  218.    CC="$gonk_toolchain_prefix"gcc
  219.    CXX="$gonk_toolchain_prefix"g++
  220.    CPP="$gonk_toolchain_prefix"cpp
  221.    LD="$gonk_toolchain_prefix"ld
  222.    AR="$gonk_toolchain_prefix"ar
  223.    RANLIB="$gonk_toolchain_prefix"ranlib
  224.    STRIP="$gonk_toolchain_prefix"strip
  225.    OBJCOPY="$gonk_toolchain_prefix"objcopy
  226.  
  227.    if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
  228.        AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
  229.     fi
  230.     STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
  231.  
  232.     case "$ANDROID_VERSION" in
  233.     15)
  234.         GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
  235.         MOZ_B2G_BT=1
  236.         MOZ_B2G_BT_BLUEZ=1
  237.         MOZ_NFC=1
  238.         MOZ_B2G_CAMERA=1
  239.         MOZ_OMX_DECODER=1
  240.         AC_SUBST(MOZ_OMX_DECODER)
  241.         MOZ_RTSP=1
  242.         MOZ_FMP4=1
  243.         ;;
  244.     17|18)
  245.         GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
  246.         if test -d "$gonkdir/external/bluetooth/bluez"; then
  247.           GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
  248.             MOZ_B2G_BT=1
  249.             MOZ_B2G_BT_BLUEZ=1
  250.         elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
  251.             MOZ_B2G_BT=1
  252.             MOZ_B2G_BT_BLUEDROID=1
  253.             if test -d "$gonkdir/system/bluetoothd"; then
  254.                 MOZ_B2G_BT_DAEMON=1
  255.             fi
  256.         fi
  257.  
  258.         MOZ_RTSP=1
  259.         MOZ_NFC=1
  260.         MOZ_B2G_CAMERA=1
  261.         MOZ_OMX_DECODER=1
  262.         AC_SUBST(MOZ_OMX_DECODER)
  263.         MOZ_OMX_ENCODER=1
  264.         AC_SUBST(MOZ_OMX_ENCODER)
  265.         AC_DEFINE(MOZ_OMX_ENCODER)
  266.     MOZ_FMP4=1
  267.         ;;
  268.     19)
  269.         GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
  270.         MOZ_B2G_CAMERA=1
  271.         MOZ_B2G_BT=1
  272.         MOZ_B2G_BT_BLUEDROID=1
  273.         if test -d "$gonkdir/system/bluetoothd"; then
  274.             MOZ_B2G_BT_DAEMON=1
  275.         fi
  276.         MOZ_NFC=1
  277.         MOZ_RTSP=1
  278.         MOZ_OMX_DECODER=1
  279.         MOZ_OMX_ENCODER=1
  280.         AC_DEFINE(MOZ_OMX_ENCODER)
  281.         MOZ_AUDIO_OFFLOAD=1
  282.         AC_SUBST(MOZ_AUDIO_OFFLOAD)
  283.         AC_DEFINE(MOZ_AUDIO_OFFLOAD)
  284.         MOZ_FMP4=1
  285.         ;;
  286.     21)
  287.         GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
  288.         MOZ_AUDIO_OFFLOAD=1
  289.         MOZ_OMX_DECODER=1
  290.         AC_SUBST(MOZ_AUDIO_OFFLOAD)
  291.         AC_DEFINE(MOZ_AUDIO_OFFLOAD)
  292.         MOZ_FMP4=
  293.         MOZ_B2G_CAMERA=1
  294.         MOZ_B2G_BT=1
  295.         MOZ_B2G_BT_BLUEDROID=1
  296.         if test -d "$gonkdir/system/bluetoothd"; then
  297.             MOZ_B2G_BT_DAEMON=1
  298.         fi
  299.         ;;
  300.     *)
  301.         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
  302.         ;;
  303.     esac
  304.     CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
  305.     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
  306.     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
  307.     dnl Add -llog by default, since we use it all over the place.
  308.     LIBS="$LIBS -llog"
  309.  
  310.     LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
  311.  
  312.     dnl prevent cross compile section from using these flags as host flags
  313.     if test -z "$HOST_CPPFLAGS" ; then
  314.         HOST_CPPFLAGS=" "
  315.     fi
  316.     if test -z "$HOST_CFLAGS" ; then
  317.         HOST_CFLAGS=" "
  318.     fi
  319.     if test -z "$HOST_CXXFLAGS" ; then
  320.         HOST_CXXFLAGS=" "
  321.     fi
  322.     if test -z "$HOST_LDFLAGS" ; then
  323.         HOST_LDFLAGS=" "
  324.     fi
  325.  
  326.     AC_DEFINE(ANDROID)
  327.     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
  328.     AC_SUBST(ANDROID_VERSION)
  329.     AC_DEFINE(HAVE_SYS_UIO_H)
  330.     AC_DEFINE(HAVE_PTHREADS)
  331.     MOZ_CHROME_FILE_FORMAT=omni
  332.     direct_nspr_config=1
  333. else
  334.     MOZ_ANDROID_NDK
  335.  
  336.     case "$target" in
  337.     *-android*|*-linuxandroid*)
  338.         if test -z "$ANDROID_PACKAGE_NAME" ; then
  339.             ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
  340.         fi
  341.         MOZ_CHROME_FILE_FORMAT=omni
  342.         ZLIB_DIR=yes
  343.         ;;
  344.     *-linux*)
  345.         AC_PATH_PROG(OBJCOPY,objcopy)
  346.         ;;
  347.     esac
  348. fi
  349.  
  350. AC_SUBST(ANDROID_SOURCE)
  351. AC_SUBST(ANDROID_PACKAGE_NAME)
  352. AC_SUBST(OBJCOPY)
  353.  
  354. dnl ========================================================
  355. dnl Checks for compilers.
  356. dnl ========================================================
  357.  
  358. dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
  359. AR_FLAGS='crs $@'
  360.  
  361. if test "$COMPILE_ENVIRONMENT"; then
  362.  
  363. if test "$target" != "$host"; then
  364.     MOZ_CROSS_COMPILER
  365. else
  366.     AC_PROG_CC
  367.     case "$target" in
  368.     *-mingw*)
  369.       # Work around the conftest.exe access problem on Windows
  370.       sleep 2
  371.     esac
  372.     AC_PROG_CXX
  373.     AC_PROG_RANLIB
  374.     MOZ_PATH_PROGS(AS, $AS as, $CC)
  375.     AC_CHECK_PROGS(AR, ar, :)
  376.     AC_CHECK_PROGS(LD, ld, :)
  377.     AC_CHECK_PROGS(STRIP, strip, :)
  378.     AC_CHECK_PROGS(WINDRES, windres, :)
  379.     AC_CHECK_PROGS(OTOOL, otool, :)
  380.     if test -z "$HOST_CC"; then
  381.         HOST_CC="$CC"
  382.     fi
  383.     if test -z "$HOST_CFLAGS"; then
  384.         HOST_CFLAGS="$CFLAGS"
  385.     fi
  386.     if test -z "$HOST_CXX"; then
  387.         HOST_CXX="$CXX"
  388.     fi
  389.     if test -z "$HOST_CXXFLAGS"; then
  390.         HOST_CXXFLAGS="$CXXFLAGS"
  391.     fi
  392.     if test -z "$HOST_LDFLAGS"; then
  393.         HOST_LDFLAGS="$LDFLAGS"
  394.     fi
  395.     if test -z "$HOST_RANLIB"; then
  396.         HOST_RANLIB="$RANLIB"
  397.     fi
  398.     if test -z "$HOST_AR"; then
  399.         HOST_AR="$AR"
  400.     fi
  401.     if test -z "$HOST_AR_FLAGS"; then
  402.         HOST_AR_FLAGS="$AR_FLAGS"
  403.     fi
  404. fi
  405.  
  406. if test -n "$MOZ_WINCONSOLE"; then
  407.     AC_DEFINE(MOZ_WINCONSOLE)
  408. fi
  409.  
  410. MOZ_TOOL_VARIABLES
  411.  
  412. MOZ_CHECK_COMPILER_WRAPPER
  413.  
  414. dnl ========================================================
  415. dnl Special win32 checks
  416. dnl ========================================================
  417.  
  418. MOZ_ARG_ENABLE_BOOL(metro,
  419. [  --enable-metro           Enable Windows Metro build targets],
  420.     MOZ_METRO=1,
  421.     MOZ_METRO=)
  422. if test -n "$MOZ_METRO"; then
  423.     AC_DEFINE(MOZ_METRO)
  424.     # toolkit/library/makefile.in needs these, see nsDllMain.
  425.     CRTDLLVERSION=110
  426.     CRTEXPDLLVERSION=1-1-0
  427. fi
  428.  
  429. AC_SUBST(CRTDLLVERSION)
  430. AC_SUBST(CRTEXPDLLVERSION)
  431.  
  432. # Target the Windows 8.1 SDK by default
  433. WINSDK_TARGETVER=603
  434. WINVER=502
  435.  
  436. MOZ_ARG_WITH_STRING(windows-version,
  437. [  --with-windows-version=WINSDK_TARGETVER
  438.                           Windows SDK version to target. Win8.1 (603) is
  439.                           currently the minimum supported version.],
  440.   WINSDK_TARGETVER=$withval)
  441.  
  442. # Currently only version 603 is allowed
  443. case "$WINSDK_TARGETVER" in
  444. 603)
  445.     MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
  446.     ;;
  447.  
  448. *)
  449.     AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
  450.     ;;
  451. esac
  452.  
  453. case "$target" in
  454. *-mingw*)
  455.     if test "$GCC" != "yes"; then
  456.         # Check to see if we are really running in a msvc environemnt
  457.         _WIN32_MSVC=1
  458.         AC_CHECK_PROGS(MIDL, midl)
  459.  
  460.         # Make sure compilers are valid
  461.         CFLAGS="$CFLAGS -TC -nologo"
  462.         CXXFLAGS="$CXXFLAGS -TP -nologo"
  463.         AC_LANG_SAVE
  464.         AC_LANG_C
  465.         AC_TRY_COMPILE([#include <stdio.h>],
  466.             [ printf("Hello World\n"); ],,
  467.             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
  468.  
  469.         AC_LANG_CPLUSPLUS
  470.         AC_TRY_COMPILE([#include <new.h>],
  471.             [ unsigned *test = new unsigned(42); ],,
  472.             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
  473.         AC_LANG_RESTORE
  474.  
  475.         changequote(,)
  476.         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
  477.         changequote([,])
  478.  
  479.         # Determine compiler version
  480.         _CC_MAJOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 1-2`
  481.         _CC_MINOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 3-4`
  482.         _CC_BUILD_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 5-`
  483.         _MSC_VER=${CC_VERSION}
  484.  
  485.         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
  486.  
  487.         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
  488.             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
  489.         fi
  490.  
  491.         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
  492.         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
  493.  
  494.         if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" -ge "30723"; then
  495.             _CC_SUITE=12
  496.             MSVS_VERSION=2013
  497.             MSVC_C_RUNTIME_DLL=msvcr120.dll
  498.             MSVC_CXX_RUNTIME_DLL=msvcp120.dll
  499.         else
  500.             AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
  501. You must install Visual C++ 2013 Update 3 or newer in order to build.
  502. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
  503.         fi
  504.         AC_SUBST(MSVS_VERSION)
  505.         AC_SUBST(MSVC_C_RUNTIME_DLL)
  506.         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
  507.  
  508.         # Disable SEH on clang-cl because it doesn't implement them yet.
  509.         if test -z "$CLANG_CL"; then
  510.             AC_DEFINE(HAVE_SEH_EXCEPTIONS)
  511.         else
  512.             # Send our CFLAGS to NSS
  513.             MOZ_CFLAGS_NSS=1
  514.             AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
  515.         fi
  516.  
  517.         if test -n "$WIN32_REDIST_DIR"; then
  518.           if test ! -d "$WIN32_REDIST_DIR"; then
  519.             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
  520.           fi
  521.           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
  522.         fi
  523.  
  524.         dnl Confirm we have the pri tools on win8 builds
  525.         if test -n "$MOZ_METRO"; then
  526.           AC_MSG_CHECKING([for makepri])
  527.           AC_CHECK_PROGS(MAKEPRI, makepri, "")
  528.           if test -z "MAKEPRI" ; then
  529.               AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
  530.           fi
  531.           AC_SUBST(MAKEPRI)
  532.         fi
  533.  
  534.         dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
  535.         dnl not something else like "magnetic tape manipulation utility".
  536.         MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
  537.         if test -z "$MSMT_TOOL"; then
  538.           AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
  539.         fi
  540.  
  541.         changequote(,)
  542.         _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
  543.         changequote([,])
  544.         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
  545.         if test -z "$MSMANIFEST_TOOL_VERSION"; then
  546.           AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
  547.         fi
  548.  
  549.         MSMANIFEST_TOOL=1
  550.         unset MSMT_TOOL
  551.  
  552.         # Check linker version
  553.         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
  554.         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  555.         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
  556.             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
  557.         fi
  558.  
  559.         INCREMENTAL_LINKER=1
  560.  
  561.         # Set midl environment
  562.         case "$target" in
  563.         i*86-*)
  564.             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
  565.             ;;
  566.         x86_64-*)
  567.             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
  568.             ;;
  569.         esac
  570.  
  571.         unset _MSVC_VER_FILTER
  572.  
  573.         AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
  574.             [
  575.                 AC_LANG_SAVE
  576.                 AC_LANG_CPLUSPLUS
  577.                 _SAVE_CXXFLAGS="$CXXFLAGS"
  578.                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  579.                 AC_TRY_COMPILE([#include <exception>],
  580.                             [std::_Throw(std::exception()); return 0;],
  581.                             ac_cv_have_std__Throw="yes",
  582.                             ac_cv_have_std__Throw="no")
  583.                 CXXFLAGS="$_SAVE_CXXFLAGS"
  584.                 AC_LANG_RESTORE
  585.             ])
  586.  
  587.         if test "$ac_cv_have_std__Throw" = "yes"; then
  588.             AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
  589.                            ac_cv_have_dllimport_exception_bug,
  590.                 [
  591.                     AC_LANG_SAVE
  592.                     AC_LANG_CPLUSPLUS
  593.                     _SAVE_CXXFLAGS="$CXXFLAGS"
  594.                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  595.                     AC_TRY_LINK([#include <vector>],
  596.                                 [std::vector<int> v; return v.at(1);],
  597.                                 ac_cv_have_dllimport_exception_bug="no",
  598.                                 ac_cv_have_dllimport_exception_bug="yes")
  599.                     CXXFLAGS="$_SAVE_CXXFLAGS"
  600.                     AC_LANG_RESTORE
  601.                 ])
  602.             if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
  603.                 WRAP_STL_INCLUDES=1
  604.                 MOZ_MSVC_STL_WRAP__Throw=1
  605.                 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
  606.             fi
  607.         else
  608.             AC_CACHE_CHECK(for overridable _RAISE,
  609.                            ac_cv_have__RAISE,
  610.                 [
  611.                     AC_LANG_SAVE
  612.                     AC_LANG_CPLUSPLUS
  613.                     _SAVE_CXXFLAGS="$CXXFLAGS"
  614.                     CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  615.                     AC_TRY_COMPILE([#include <xstddef>
  616.                                     #undef _RAISE
  617.                                     #define _RAISE(x) externallyDefinedFunction((x).what())
  618.                                     #include <vector>
  619.                                    ],
  620.                                    [std::vector<int> v; return v.at(1);],
  621.                                    ac_cv_have__RAISE="no",
  622.                                    ac_cv_have__RAISE="yes")
  623.                     CXXFLAGS="$_SAVE_CXXFLAGS"
  624.                     AC_LANG_RESTORE
  625.                 ])
  626.             if test "$ac_cv_have__RAISE" = "yes"; then
  627.                 WRAP_STL_INCLUDES=1
  628.                 MOZ_MSVC_STL_WRAP__RAISE=1
  629.                 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
  630.             else
  631.                 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
  632.            fi
  633.        fi
  634.  
  635.        if test "$WRAP_STL_INCLUDES" = "1"; then
  636.            STL_FLAGS='-I$(DIST)/stl_wrappers'
  637.        fi
  638.        CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
  639.        CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
  640.  
  641.        MOZ_FIND_WINSDK_VERSION
  642.    else
  643.        # Check w32api version
  644.        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
  645.        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
  646.        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
  647.        AC_TRY_COMPILE([#include <w32api.h>],
  648.            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
  649.                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
  650.                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
  651.                #error "test failed."
  652.            #endif
  653.            , [ res=yes ], [ res=no ])
  654.        AC_MSG_RESULT([$res])
  655.        if test "$res" != "yes"; then
  656.            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
  657.        fi
  658.        # Check windres version
  659.        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
  660.        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
  661.        AC_MSG_RESULT([$_WINDRES_VERSION])
  662.        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  663.        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  664.        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  665.        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  666.        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  667.        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  668.        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
  669.                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  670.                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
  671.                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  672.                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
  673.                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
  674.        then
  675.            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
  676.        fi
  677.  
  678.        AC_CHECK_PROGS(MIDL, $target-widl widl)
  679.        if test -n "$MIDL"; then
  680.            case "$target" in
  681.            i*86-*)
  682.                MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
  683.                ;;
  684.            x86_64-*)
  685.                MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
  686.                ;;
  687.            esac
  688.        fi
  689.  
  690.        # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
  691.        # causing problems with local implementations with the same name.
  692.        AC_DEFINE(STRSAFE_NO_DEPRECATE)
  693.  
  694.        MOZ_WINSDK_MAXVER=0x06030000
  695.    fi # !GNU_CC
  696.  
  697.    AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
  698.    AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
  699.    # Require OS features provided by IE 6.0 SP2 (XP SP2)
  700.    AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
  701.  
  702.    # If the maximum version supported by this SDK is lower than the target
  703.    # version, error out
  704.    AC_MSG_CHECKING([for Windows SDK being recent enough])
  705.    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
  706.        AC_MSG_RESULT("yes")
  707.    else
  708.        AC_MSG_RESULT("no")
  709.        AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
  710.    fi
  711.  
  712.    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
  713.    # Definitions matching sdkddkver.h
  714.    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
  715.    AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
  716.    AC_SUBST(MOZ_WINSDK_MAXVER)
  717.    ;;
  718. esac
  719.  
  720. AC_PROG_CPP
  721. AC_PROG_CXXCPP
  722.  
  723. if test -n "$_WIN32_MSVC"; then
  724.    SKIP_PATH_CHECKS=1
  725.    SKIP_COMPILER_CHECKS=1
  726.    SKIP_LIBRARY_CHECKS=1
  727.  
  728.    # Since we're skipping compiler and library checks, hard-code
  729.     # some facts here.
  730.     AC_DEFINE(HAVE_IO_H)
  731.     AC_DEFINE(HAVE_SETBUF)
  732.     AC_DEFINE(HAVE_ISATTY)
  733. fi
  734.  
  735. fi # COMPILE_ENVIRONMENT
  736.  
  737. AC_SUBST(MIDL_FLAGS)
  738. AC_SUBST(_MSC_VER)
  739.  
  740. AC_SUBST(GNU_AS)
  741. AC_SUBST(GNU_LD)
  742. AC_SUBST(GNU_CC)
  743. AC_SUBST(GNU_CXX)
  744. AC_SUBST(INTEL_CC)
  745. AC_SUBST(INTEL_CXX)
  746.  
  747. AC_SUBST(STL_FLAGS)
  748. AC_SUBST(WRAP_STL_INCLUDES)
  749. AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
  750. AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
  751.  
  752. dnl ========================================================
  753. dnl Checks for programs.
  754. dnl ========================================================
  755. AC_PROG_INSTALL
  756. AC_PROG_LN_S
  757.  
  758. AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
  759. _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
  760. _perl_res=$?
  761. AC_MSG_RESULT([$_perl_version])
  762.  
  763. if test "$_perl_res" != 0; then
  764.     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
  765. fi
  766.  
  767. AC_MSG_CHECKING([for full perl installation])
  768. _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
  769. _perl_res=$?
  770. if test "$_perl_res" != 0; then
  771.     AC_MSG_RESULT([no])
  772.     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
  773. else
  774.     AC_MSG_RESULT([yes])
  775. fi
  776.  
  777. if test -z "$COMPILE_ENVIRONMENT"; then
  778.     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
  779. fi
  780. AC_SUBST(NSINSTALL_BIN)
  781.  
  782. MOZ_PATH_PROG(DOXYGEN, doxygen, :)
  783. MOZ_PATH_PROG(AUTOCONF, autoconf, :)
  784. MOZ_PATH_PROGS(UNZIP, unzip)
  785. if test -z "$UNZIP" -o "$UNZIP" = ":"; then
  786.     AC_MSG_ERROR([unzip not found in \$PATH])
  787. fi
  788. MOZ_PATH_PROGS(ZIP, zip)
  789. if test -z "$ZIP" -o "$ZIP" = ":"; then
  790.     AC_MSG_ERROR([zip not found in \$PATH])
  791. fi
  792. MOZ_PATH_PROG(XARGS, xargs)
  793. if test -z "$XARGS" -o "$XARGS" = ":"; then
  794.     AC_MSG_ERROR([xargs not found in \$PATH .])
  795. fi
  796.  
  797. MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
  798. AC_SUBST(RPMBUILD)
  799.  
  800. if test "$COMPILE_ENVIRONMENT"; then
  801.  
  802. dnl ========================================================
  803. dnl = Mac OS X toolchain support
  804. dnl ========================================================
  805.  
  806. dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
  807. dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
  808. dnl when we can run target binaries.
  809. AC_SUBST(UNIVERSAL_BINARY)
  810. AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
  811.  
  812. MOZ_ARG_WITH_STRING(unify-dist,
  813. [  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
  814.     UNIFY_DIST=$withval)
  815. if test -n "$UNIVERSAL_BINARY"; then
  816.     if test -z "$UNIFY_DIST"; then
  817.         AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
  818.     fi
  819.     case "$UNIFY_DIST" in
  820.     /*)
  821.         ;;
  822.     *)
  823.         UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
  824.         ;;
  825.     esac
  826. fi
  827. AC_SUBST(UNIFY_DIST)
  828.  
  829. dnl ========================================================
  830. dnl Check for MacOS deployment target version
  831. dnl ========================================================
  832.  
  833. MOZ_ARG_ENABLE_STRING(macos-target,
  834.                       [  --enable-macos-target=VER (default=10.6)
  835.                           Set the minimum MacOS version needed at runtime],
  836.                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
  837.  
  838. case "$target" in
  839. *-darwin*)
  840.     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
  841.         dnl Use the specified value
  842.         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
  843.     else
  844.         dnl No value specified on the command line or in the environment,
  845.         dnl use architecture minimum.
  846.         export MACOSX_DEPLOYMENT_TARGET=10.6
  847.     fi
  848.     ;;
  849. esac
  850.  
  851. AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
  852.  
  853. dnl ========================================================
  854. dnl = Mac OS X SDK support
  855. dnl ========================================================
  856. MACOS_SDK_DIR=
  857. MOZ_ARG_WITH_STRING(macos-sdk,
  858. [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
  859.     MACOS_SDK_DIR=$withval)
  860.  
  861. MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
  862. MOZ_ARG_WITH_STRING(macos-private-frameworks,
  863. [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
  864.     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
  865.     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
  866.     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
  867.  
  868. if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
  869.   if test -z "$CROSS_COMPILE"; then
  870.     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
  871.   fi
  872.   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
  873.     AC_MSG_ERROR([PrivateFrameworks directory not found.])
  874.   fi
  875. fi
  876.  
  877. dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
  878. AC_SUBST(MACOS_SDK_DIR)
  879. AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
  880.  
  881. if test "$MACOS_SDK_DIR"; then
  882.   dnl Sync this section with the ones in NSPR and NSS.
  883.   dnl Changes to the cross environment here need to be accounted for in
  884.   dnl the libIDL checks (below) and xpidl build.
  885.  
  886.   if test ! -d "$MACOS_SDK_DIR"; then
  887.     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
  888. specify a valid SDK.  SDKs are installed when the optional cross-development
  889. tools are selected during the Xcode/Developer Tools installation.])
  890.   fi
  891.  
  892.   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
  893.   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
  894.  
  895.   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
  896.   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
  897.   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
  898.  
  899.   AC_LANG_SAVE
  900.   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
  901.   AC_LANG_CPLUSPLUS
  902.   AC_TRY_COMPILE([#include <new>],[],
  903.    result=yes,
  904.    result=no)
  905.   AC_LANG_RESTORE
  906.   AC_MSG_RESULT($result)
  907.  
  908.   if test "$result" = "no" ; then
  909.     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
  910.   fi
  911. fi
  912.  
  913. fi # COMPILE_ENVIRONMENT
  914.  
  915. if test -n "$MAKE"; then
  916.   if test `echo $MAKE | grep -c make.py` != 1; then
  917.      NOT_PYMAKE=$MAKE
  918.   fi
  919. fi
  920.  
  921. case "$host_os" in
  922. mingw*)
  923.     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
  924.     ;;
  925. *)
  926.     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
  927.     ;;
  928. esac
  929. if test "$GMAKE" = ":"; then
  930.    AC_MSG_ERROR([GNU make not found])
  931. fi
  932. AC_SUBST(GMAKE)
  933.  
  934. if test -z "$MAKE"; then
  935.   MAKE=$GMAKE
  936. fi
  937.  
  938. if test "$COMPILE_ENVIRONMENT"; then
  939.  
  940. AC_PATH_XTRA
  941.  
  942. XCFLAGS="$X_CFLAGS"
  943.  
  944. fi # COMPILE_ENVIRONMENT
  945.  
  946. dnl ========================================================
  947. dnl set the defaults first
  948. dnl ========================================================
  949. AS_BIN=$AS
  950. AR_LIST='$(AR) t'
  951. AR_EXTRACT='$(AR) x'
  952. AR_DELETE='$(AR) d'
  953. AS='$(CC)'
  954. AS_DASH_C_FLAG='-c'
  955. DLL_PREFIX=lib
  956. LIB_PREFIX=lib
  957. DLL_SUFFIX=.so
  958. OBJ_SUFFIX=o
  959. LIB_SUFFIX=a
  960. ASM_SUFFIX=s
  961. IMPORT_LIB_SUFFIX=
  962. TARGET_MD_ARCH=unix
  963. DIRENT_INO=d_ino
  964. MOZ_USER_DIR=".mozilla"
  965.  
  966. MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
  967.  
  968. MOZ_FS_LAYOUT=unix
  969.  
  970. USE_DEPENDENT_LIBS=1
  971.  
  972. _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
  973.  
  974. if test -n "$CROSS_COMPILE"; then
  975.     OS_TARGET="${target_os}"
  976.     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
  977.     OS_RELEASE=
  978.     case "${target_os}" in
  979.         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
  980.         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
  981.         gnu*)         OS_ARCH=GNU ;;
  982.         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
  983.         mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
  984.         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
  985.         dragonfly*)   OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
  986.         freebsd*)     OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
  987.         netbsd*)      OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
  988.         openbsd*)     OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
  989.     esac
  990.     case "${target}" in
  991.         *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
  992.     esac
  993. else
  994.     OS_TARGET=`uname -s`
  995.     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
  996.     OS_RELEASE=`uname -r`
  997. fi
  998.  
  999. # Before this used `uname -m` when not cross compiling
  1000. # but that breaks when you have a 64 bit kernel with a 32 bit userland.
  1001. OS_TEST="${target_cpu}"
  1002.  
  1003. HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
  1004.  
  1005. #######################################################################
  1006. # Master "Core Components" macros for getting the OS target           #
  1007. #######################################################################
  1008.  
  1009. #
  1010. # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
  1011. # cross-compilation.
  1012. #
  1013.  
  1014. #
  1015. # Define and override various archtecture-specific variables, including
  1016. # HOST_OS_ARCH
  1017. # OS_ARCH
  1018. # OS_TEST
  1019. # OS_TARGET
  1020. # OS_RELEASE
  1021. # OS_MINOR_RELEASE
  1022. #
  1023.  
  1024. case "$HOST_OS_ARCH" in
  1025. mingw*)
  1026.     HOST_OS_ARCH=WINNT
  1027.     ;;
  1028. darwin*)
  1029.     HOST_OS_ARCH=Darwin
  1030.     ;;
  1031. linux*)
  1032.     HOST_OS_ARCH=Linux
  1033.     ;;
  1034. kfreebsd*-gnu)
  1035.     HOST_OS_ARCH=GNU_kFreeBSD
  1036.     ;;
  1037. gnu*)
  1038.     HOST_OS_ARCH=GNU
  1039.     ;;
  1040. dragonfly*)
  1041.     HOST_OS_ARCH=DragonFly
  1042.     ;;
  1043. freebsd*)
  1044.     HOST_OS_ARCH=FreeBSD
  1045.     ;;
  1046. netbsd*)
  1047.     HOST_OS_ARCH=NetBSD
  1048.     ;;
  1049. openbsd*)
  1050.     HOST_OS_ARCH=OpenBSD
  1051.     ;;
  1052. solaris*)
  1053.     HOST_OS_ARCH=SunOS
  1054.     SOLARIS_SUNPRO_CC=
  1055.     SOLARIS_SUNPRO_CXX=
  1056.     if test -z "$GNU_CC"; then
  1057.         if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
  1058.             SOLARIS_SUNPRO_CC=1
  1059.        fi
  1060.     fi
  1061.  
  1062.     if test -z "$GNU_CXX"; then
  1063.        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
  1064.            SOLARIS_SUNPRO_CXX=1
  1065.        fi
  1066.     fi
  1067.     AC_SUBST(SOLARIS_SUNPRO_CC)
  1068.     AC_SUBST(SOLARIS_SUNPRO_CXX)
  1069.     ;;
  1070. esac
  1071.  
  1072. case "$OS_ARCH" in
  1073. WINNT)
  1074.     if test -z "$CROSS_COMPILE" ; then
  1075.         OS_TEST=`uname -p`
  1076.     fi
  1077.     ;;
  1078. Windows_NT)
  1079. #
  1080. # If uname -s returns "Windows_NT", we assume that we are using
  1081. # the uname.exe in MKS toolkit.
  1082. #
  1083. # The -r option of MKS uname only returns the major version number.
  1084. # So we need to use its -v option to get the minor version number.
  1085. # Moreover, it doesn't have the -p option, so we need to use uname -m.
  1086. #
  1087.     OS_ARCH=WINNT
  1088.     OS_TARGET=WINNT
  1089.     OS_MINOR_RELEASE=`uname -v`
  1090.     if test "$OS_MINOR_RELEASE" = "00"; then
  1091.         OS_MINOR_RELEASE=0
  1092.     fi
  1093.     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
  1094.     ;;
  1095. MINGW*_NT*)
  1096. #
  1097. # If uname -s returns MINGW32_NT-5.1, we assume that we are using
  1098. # the uname.exe in the MSYS tools.
  1099. #
  1100.     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
  1101.     OS_ARCH=WINNT
  1102.     OS_TARGET=WINNT
  1103.     ;;
  1104. AIX)
  1105.     OS_RELEASE=`uname -v`.`uname -r`
  1106.     OS_TEST=${target_cpu}
  1107.     ;;
  1108. Darwin)
  1109.     case "${target_cpu}" in
  1110.     powerpc*)
  1111.         OS_TEST=ppc
  1112.         ;;
  1113.     i*86*)
  1114.         OS_TEST=i386
  1115.         ;;
  1116.     x86_64)
  1117.         OS_TEST=x86_64
  1118.         ;;
  1119.     *)
  1120.         if test -z "$CROSS_COMPILE" ; then
  1121.             OS_TEST=`uname -p`
  1122.         fi
  1123.         ;;
  1124.     esac
  1125.     ;;
  1126. esac
  1127.  
  1128. # Only set CPU_ARCH if we recognize the value of OS_TEST
  1129.  
  1130. case "$OS_TEST" in
  1131. *86 | i86pc)
  1132.     CPU_ARCH=x86
  1133.     ;;
  1134.  
  1135. powerpc64 | ppc64 | powerpc64le | ppc64le)
  1136.     CPU_ARCH=ppc64
  1137.     ;;
  1138.  
  1139. powerpc | ppc | rs6000)
  1140.     CPU_ARCH=ppc
  1141.     ;;
  1142.  
  1143. Alpha | alpha | ALPHA)
  1144.     CPU_ARCH=Alpha
  1145.     ;;
  1146.  
  1147. s390)
  1148.     CPU_ARCH=s390
  1149.     ;;
  1150.  
  1151. s390x)
  1152.     CPU_ARCH=s390x
  1153.     ;;
  1154.  
  1155. hppa* | parisc)
  1156.     CPU_ARCH=hppa
  1157.     ;;
  1158.  
  1159. sun4u | sparc*)
  1160.     CPU_ARCH=sparc
  1161.     ;;
  1162.  
  1163. x86_64 | ia64)
  1164.     CPU_ARCH="$OS_TEST"
  1165.     ;;
  1166.  
  1167. arm*)
  1168.     CPU_ARCH=arm
  1169.     ;;
  1170.  
  1171. mips|mipsel)
  1172.     CPU_ARCH="mips"
  1173.     ;;
  1174.  
  1175. aarch64*)
  1176.     CPU_ARCH=aarch64
  1177.     ;;
  1178. esac
  1179.  
  1180. if test -z "$OS_TARGET"; then
  1181.     OS_TARGET=$OS_ARCH
  1182. fi
  1183. OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
  1184.  
  1185. dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
  1186. dnl ===============================================================
  1187. INTEL_ARCHITECTURE=
  1188. case "$OS_TEST" in
  1189.     x86_64|i?86)
  1190.       INTEL_ARCHITECTURE=1
  1191. esac
  1192.  
  1193. dnl Configure platform-specific CPU architecture compiler options.
  1194. dnl ==============================================================
  1195. MOZ_ARCH_OPTS
  1196.  
  1197. dnl =================================================================
  1198. dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
  1199. dnl which is bad when cross compiling.
  1200. dnl =================================================================
  1201. if test "$COMPILE_ENVIRONMENT"; then
  1202. configure_static_assert_macros='
  1203. #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
  1204. #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
  1205. #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
  1206. '
  1207.  
  1208. dnl test that the macros actually work:
  1209. AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
  1210. AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
  1211.  [AC_LANG_SAVE
  1212.   AC_LANG_C
  1213.   ac_cv_static_assertion_macros_work="yes"
  1214.   AC_TRY_COMPILE([$configure_static_assert_macros],
  1215.                  [CONFIGURE_STATIC_ASSERT(1)],
  1216.                  ,
  1217.                  ac_cv_static_assertion_macros_work="no")
  1218.   AC_TRY_COMPILE([$configure_static_assert_macros],
  1219.                  [CONFIGURE_STATIC_ASSERT(0)],
  1220.                  ac_cv_static_assertion_macros_work="no",
  1221.                  )
  1222.   AC_LANG_CPLUSPLUS
  1223.   AC_TRY_COMPILE([$configure_static_assert_macros],
  1224.                  [CONFIGURE_STATIC_ASSERT(1)],
  1225.                  ,
  1226.                  ac_cv_static_assertion_macros_work="no")
  1227.   AC_TRY_COMPILE([$configure_static_assert_macros],
  1228.                  [CONFIGURE_STATIC_ASSERT(0)],
  1229.                  ac_cv_static_assertion_macros_work="no",
  1230.                  )
  1231.   AC_LANG_RESTORE
  1232.  ])
  1233. AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
  1234. if test "$ac_cv_static_assertion_macros_work" = "no"; then
  1235.     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
  1236. fi
  1237. fi # COMPILE_ENVIRONMENT
  1238.  
  1239. dnl ========================================================
  1240. dnl Android libstdc++, placed here so it can use MOZ_ARCH
  1241. dnl computed above.
  1242. dnl ========================================================
  1243.  
  1244. MOZ_ANDROID_STLPORT
  1245.  
  1246. dnl ========================================================
  1247. dnl Suppress Clang Argument Warnings
  1248. dnl ========================================================
  1249. if test -n "${CLANG_CC}${CLANG_CL}"; then
  1250.     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
  1251.     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
  1252. fi
  1253. if test -n "${CLANG_CXX}${CLANG_CL}"; then
  1254.     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
  1255. fi
  1256.  
  1257. dnl ========================================================
  1258. dnl = Use Address Sanitizer
  1259. dnl ========================================================
  1260. MOZ_ARG_ENABLE_BOOL(address-sanitizer,
  1261. [  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
  1262.     MOZ_ASAN=1,
  1263.     MOZ_ASAN= )
  1264. if test -n "$MOZ_ASAN"; then
  1265.     MOZ_LLVM_HACKS=1
  1266.     if test -n "$CLANG_CL"; then
  1267.         # Look for clang_rt.asan_dynamic-i386.dll
  1268.         MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-i386.dll
  1269.         # We use MOZ_PATH_PROG in order to get a Windows style path.
  1270.         MOZ_PATH_PROG(MOZ_CLANG_RT_ASAN_LIB_PATH, $MOZ_CLANG_RT_ASAN_LIB)
  1271.         if test -z "$MOZ_CLANG_RT_ASAN_LIB_PATH"; then
  1272.             AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB.  It should be available in the same location as clang-cl.])
  1273.        fi
  1274.        AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
  1275.    fi
  1276.    AC_DEFINE(MOZ_ASAN)
  1277.    MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
  1278. fi
  1279. AC_SUBST(MOZ_ASAN)
  1280.  
  1281. dnl ========================================================
  1282. dnl = Use Memory Sanitizer
  1283. dnl ========================================================
  1284. MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
  1285. [  --enable-memory-sanitizer       Enable Memory Sanitizer (default=no)],
  1286.    MOZ_MSAN=1,
  1287.    MOZ_MSAN= )
  1288. if test -n "$MOZ_MSAN"; then
  1289.    MOZ_LLVM_HACKS=1
  1290.    AC_DEFINE(MOZ_MSAN)
  1291.    MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
  1292. fi
  1293. AC_SUBST(MOZ_MSAN)
  1294.  
  1295. dnl ========================================================
  1296. dnl = Use Thread Sanitizer
  1297. dnl ========================================================
  1298. MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
  1299. [  --enable-thread-sanitizer       Enable Thread Sanitizer (default=no)],
  1300.   MOZ_TSAN=1,
  1301.   MOZ_TSAN= )
  1302. if test -n "$MOZ_TSAN"; then
  1303.    MOZ_LLVM_HACKS=1
  1304.    AC_DEFINE(MOZ_TSAN)
  1305.    MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
  1306. fi
  1307. AC_SUBST(MOZ_TSAN)
  1308.  
  1309. # The LLVM symbolizer is used by all sanitizers
  1310. AC_SUBST(LLVM_SYMBOLIZER)
  1311.  
  1312. dnl ========================================================
  1313. dnl = Enable hacks required for LLVM instrumentations
  1314. dnl ========================================================
  1315. MOZ_ARG_ENABLE_BOOL(llvm-hacks,
  1316. [  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
  1317.    MOZ_LLVM_HACKS=1,
  1318.    MOZ_LLVM_HACKS= )
  1319. if test -n "$MOZ_LLVM_HACKS"; then
  1320.    MOZ_NO_WLZDEFS=1
  1321.    MOZ_CFLAGS_NSS=1
  1322. fi
  1323. AC_SUBST(MOZ_NO_WLZDEFS)
  1324. AC_SUBST(MOZ_CFLAGS_NSS)
  1325.  
  1326. dnl ========================================================
  1327. dnl = Enable treating compiler warnings as errors
  1328. dnl ========================================================
  1329. MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
  1330. [  --enable-warnings-as-errors
  1331.                          Enable treating warnings as errors],
  1332.    MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
  1333.    MOZ_ENABLE_WARNINGS_AS_ERRORS=)
  1334.  
  1335. dnl ========================================================
  1336. dnl GNU specific defaults
  1337. dnl ========================================================
  1338. if test "$GNU_CC"; then
  1339.    MMX_FLAGS="-mmmx"
  1340.    SSE_FLAGS="-msse"
  1341.    SSE2_FLAGS="-msse2"
  1342.    # Per bug 719659 comment 2, some of the headers on ancient build machines
  1343.    # may require gnu89 inline semantics.  But otherwise, we use C99.
  1344.    # But on OS X we just use C99 plus GNU extensions, in order to fix
  1345.    # bug 917526.
  1346.    CFLAGS="$CFLAGS -std=gnu99"
  1347.    if test "${OS_ARCH}" != Darwin; then
  1348.        CFLAGS="$CFLAGS -fgnu89-inline"
  1349.    fi
  1350.    # FIXME: Let us build with strict aliasing. bug 414641.
  1351.    CFLAGS="$CFLAGS -fno-strict-aliasing"
  1352.    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
  1353.    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
  1354.    WARNINGS_AS_ERRORS='-Werror'
  1355.    DSO_CFLAGS=''
  1356.    DSO_PIC_CFLAGS='-fPIC'
  1357.    ASFLAGS="$ASFLAGS -fPIC"
  1358.    AC_MSG_CHECKING([for --noexecstack option to as])
  1359.    _SAVE_CFLAGS=$CFLAGS
  1360.    CFLAGS="$CFLAGS -Wa,--noexecstack"
  1361.    AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
  1362.                     [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
  1363.                     AC_MSG_RESULT([no]))
  1364.    CFLAGS=$_SAVE_CFLAGS
  1365.    AC_MSG_CHECKING([for -z noexecstack option to ld])
  1366.    _SAVE_LDFLAGS=$LDFLAGS
  1367.    LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  1368.    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
  1369.                  AC_MSG_RESULT([no])
  1370.                  LDFLAGS=$_SAVE_LDFLAGS)
  1371.  
  1372.    AC_MSG_CHECKING([for -z text option to ld])
  1373.    _SAVE_LDFLAGS=$LDFLAGS
  1374.    LDFLAGS="$LDFLAGS -Wl,-z,text"
  1375.    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1376.                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
  1377.                  AC_MSG_RESULT([no])
  1378.                  LDFLAGS=$_SAVE_LDFLAGS)
  1379.  
  1380.    AC_MSG_CHECKING([for --build-id option to ld])
  1381.    _SAVE_LDFLAGS=$LDFLAGS
  1382.    LDFLAGS="$LDFLAGS -Wl,--build-id"
  1383.    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1384.                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
  1385.                  AC_MSG_RESULT([no])
  1386.                  LDFLAGS=$_SAVE_LDFLAGS)
  1387.  
  1388.    AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
  1389.    HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
  1390.    _SAVE_LDFLAGS=$LDFLAGS
  1391.    LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
  1392.    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1393.                  [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
  1394.                  AC_MSG_RESULT([no]))
  1395.    LDFLAGS=$_SAVE_LDFLAGS
  1396.  
  1397.    # Check for -mssse3 on $CC
  1398.    AC_MSG_CHECKING([if toolchain supports -mssse3 option])
  1399.    HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
  1400.    _SAVE_CFLAGS=$CFLAGS
  1401.    CFLAGS="$CFLAGS -mssse3"
  1402.    AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
  1403.                     [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
  1404.                     AC_MSG_RESULT([no]))
  1405.    CFLAGS=$_SAVE_CFLAGS
  1406.  
  1407.    # Check for -msse4.1 on $CC
  1408.    AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
  1409.    HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
  1410.    _SAVE_CFLAGS=$CFLAGS
  1411.    CFLAGS="$CFLAGS -msse4.1"
  1412.    AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
  1413.                     [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
  1414.                     AC_MSG_RESULT([no]))
  1415.    CFLAGS=$_SAVE_CFLAGS
  1416.  
  1417.    case "${CPU_ARCH}" in
  1418.    x86 | x86_64)
  1419.      AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
  1420.      AC_TRY_COMPILE([],
  1421.                     [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
  1422.                     result="yes", result="no")
  1423.      AC_MSG_RESULT("$result")
  1424.      if test "$result" = "yes"; then
  1425.          HAVE_X86_AVX2=1
  1426.      fi
  1427.    esac
  1428.  
  1429.    DSO_LDOPTS='-shared'
  1430.    if test "$GCC_USE_GNU_LD"; then
  1431.        # Some tools like ASan use a runtime library that is only
  1432.        # linked against executables, so we must allow undefined
  1433.        # symbols for shared objects in some cases.
  1434.        if test -z "$MOZ_NO_WLZDEFS"; then
  1435.            # Don't allow undefined symbols in libraries
  1436.             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
  1437.  
  1438.             # BSDs need `environ' exposed for posix_spawn (bug 753046)
  1439.             case "$OS_TARGET" in
  1440.             DragonFly|FreeBSD|NetBSD|OpenBSD)
  1441.                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
  1442.                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
  1443.                 else
  1444.                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
  1445.                 fi
  1446.                 ;;
  1447.             esac
  1448.         fi
  1449.     fi
  1450.  
  1451.     # Turn on gcc/clang warnings:
  1452.     # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
  1453.     #
  1454.     # -Wall - turn on a lot of warnings
  1455.     # -Wchar-subscripts - catches array index using signed char
  1456.     # -Wcomment - catches nested comments
  1457.     # -Wdeclaration-after-statement - MSVC doesn't like these
  1458.     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1459.     # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
  1460.     # -Wenum-compare - catches comparison of different enum types
  1461.     # -Wignored-qualifiers - catches returns types with qualifiers like const
  1462.     # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
  1463.     # -Wmultichar - catches multicharacter integer constants like 'THIS'
  1464.     # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
  1465.     # -Wnonnull - catches NULL used with functions arguments marked as non-null
  1466.     # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
  1467.     # -Wpointer-sign - catches mixing pointers to signed and unsigned types
  1468.     # -Wpointer-to-int-cast - catches casts from pointer to different sized int
  1469.     # -Wreturn-type - catches missing returns, zero false positives
  1470.     # -Wsequence-point - catches undefined order behavior like `a = a++`
  1471.     # -Wsign-compare - catches comparison of signed and unsigned types
  1472.     # -Wtrigraphs - catches unlikely use of trigraphs
  1473.     # -Wtype-limits - catches overflow bugs, few false positives
  1474.     # -Wunknown-pragmas - catches unexpected #pragma directives
  1475.     #
  1476.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
  1477.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wdeclaration-after-statement"
  1478.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body"
  1479.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast"
  1480.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare"
  1481.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits"
  1482.  
  1483.     # Treat some warnings as errors if --enable-warnings-as-errors:
  1484.     if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  1485.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts"
  1486.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment"
  1487.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels"
  1488.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare"
  1489.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers"
  1490.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast"
  1491.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar"
  1492.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull"
  1493.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith"
  1494.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign"
  1495.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type"
  1496.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point"
  1497.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs"
  1498.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas"
  1499.  
  1500.         MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion)
  1501.     fi
  1502.  
  1503.     # Turn off the following warnings that -Wall turns on:
  1504.     # -Wno-unused - lots of violations in third-party code
  1505.     #
  1506.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
  1507.  
  1508.     if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
  1509.        # Don't use -Wcast-align with ICC or clang
  1510.        case "$CPU_ARCH" in
  1511.            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1512.            hppa | ia64 | sparc | arm)
  1513.            ;;
  1514.            *)
  1515.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
  1516.            ;;
  1517.        esac
  1518.     fi
  1519.  
  1520.     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
  1521.     _USE_CPP_INCLUDE_FLAG=1
  1522.     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
  1523.  
  1524. elif test "$SOLARIS_SUNPRO_CC"; then
  1525.     DSO_CFLAGS=''
  1526.     if test "$CPU_ARCH" = "sparc"; then
  1527.         # for Sun Studio on Solaris/SPARC
  1528.         DSO_PIC_CFLAGS='-xcode=pic32'
  1529.     else
  1530.         DSO_PIC_CFLAGS='-KPIC'
  1531.     fi
  1532.     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1533. else
  1534.     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  1535.     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  1536.  
  1537.     DSO_LDOPTS='-shared'
  1538.     if test "$GNU_LD"; then
  1539.         # Don't allow undefined symbols in libraries
  1540.         DSO_LDOPTS="$DSO_LDOPTS -z defs"
  1541.     fi
  1542.  
  1543.     DSO_CFLAGS=''
  1544.     DSO_PIC_CFLAGS='-KPIC'
  1545.     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1546. fi
  1547.  
  1548. if test "$GNU_CXX"; then
  1549.     # FIXME: Let us build with strict aliasing. bug 414641.
  1550.     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
  1551.  
  1552.     # Turn on gcc/clang warnings:
  1553.     # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
  1554.     #
  1555.     # -Wall - turn on a lot of warnings
  1556.     # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1557.     # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
  1558.     # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
  1559.     # -Wmissing-braces - catches aggregate initializers missing nested braces
  1560.     # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
  1561.     # -Woverloaded-virtual - function declaration hides virtual function from base class
  1562.     # -Wparentheses - catches `if (a=b)` and operator precedence bugs
  1563.     # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
  1564.     # -Wreturn-type - catches missing returns, zero false positives
  1565.     # -Wsequence-point - catches undefined order behavior like `a = a++`
  1566.     # -Wsign-compare - catches comparison of signed and unsigned types
  1567.     # -Wswitch - catches switches without all enum cases or default case
  1568.     # -Wtrigraphs - catches unlikely use of trigraphs
  1569.     # -Wtype-limits - catches overflow bugs, few false positives
  1570.     # -Wunused-label - catches unused goto labels
  1571.     # -Wwrite-strings - catches non-const char* pointers to string literals
  1572.     #
  1573.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
  1574.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body"
  1575.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
  1576.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare"
  1577.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings"
  1578.  
  1579.     # Treat some warnings as errors if --enable-warnings-as-errors:
  1580.     if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  1581.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels"
  1582.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast"
  1583.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces"
  1584.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses"
  1585.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith"
  1586.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
  1587.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point"
  1588.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch"
  1589.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs"
  1590.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits"
  1591.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label"
  1592.  
  1593.         MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion)
  1594.     fi
  1595.  
  1596.     # Turn off the following warnings that -Wall turns on:
  1597.     # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
  1598.     # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
  1599.     #   for performance reasons, and because GCC and clang accept it (though
  1600.     #   clang warns about it).
  1601.     #
  1602.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
  1603.  
  1604.     MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
  1605.  
  1606.     if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
  1607.        # Don't use -Wcast-align with ICC or clang
  1608.        case "$CPU_ARCH" in
  1609.            # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1610.            hppa | ia64 | sparc | arm)
  1611.            ;;
  1612.            *)
  1613.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
  1614.            ;;
  1615.        esac
  1616.     fi
  1617.  
  1618.     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
  1619.     _USE_CPP_INCLUDE_FLAG=1
  1620.  
  1621.     # Recent clang and gcc support C++11 deleted functions without warnings if
  1622.     # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
  1623.     # versions).  We can't use -std=c++0x yet, so gcc's support must remain
  1624.     # unused.  But clang's warning can be disabled, so when compiling with clang
  1625.     # we use it to opt out of the warning, enabling (macro-encapsulated) use of
  1626.     # deleted function syntax.
  1627.     if test "$CLANG_CXX"; then
  1628.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
  1629.         MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
  1630.     fi
  1631.  
  1632. else
  1633.     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
  1634. fi
  1635.  
  1636. dnl gcc can come with its own linker so it is better to use the pass-thru calls
  1637. dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
  1638. dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
  1639. dnl normal behavior.
  1640. dnl ========================================================
  1641. MKSHLIB_FORCE_ALL=
  1642. MKSHLIB_UNFORCE_ALL=
  1643.  
  1644. if test "$COMPILE_ENVIRONMENT"; then
  1645. if test "$GNU_CC"; then
  1646.   AC_MSG_CHECKING(whether ld has archive extraction flags)
  1647.   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
  1648.    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
  1649.     ac_cv_mkshlib_force_and_unforce="no"
  1650.     exec 3<&0 <<LOOP_INPUT
  1651.   force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
  1652.   force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
  1653.   force="-Wl,-all";              unforce="-Wl,-none"
  1654. LOOP_INPUT
  1655.     while read line
  1656.     do
  1657.       eval $line
  1658.       LDFLAGS=$force
  1659.       LIBS=$unforce
  1660.       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
  1661.     done
  1662.     exec 0<&3 3<&-
  1663.     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
  1664.    ])
  1665.   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
  1666.     AC_MSG_RESULT(no)
  1667.   else
  1668.     AC_MSG_RESULT(yes)
  1669.     eval $ac_cv_mkshlib_force_and_unforce
  1670.     MKSHLIB_FORCE_ALL=$force
  1671.     MKSHLIB_UNFORCE_ALL=$unforce
  1672.   fi
  1673. fi # GNU_CC
  1674. fi # COMPILE_ENVIRONMENT
  1675.  
  1676. dnl ========================================================
  1677. dnl Checking for 64-bit OS
  1678. dnl ========================================================
  1679. if test "$COMPILE_ENVIRONMENT"; then
  1680. AC_LANG_SAVE
  1681. AC_LANG_C
  1682. AC_MSG_CHECKING(for 64-bit OS)
  1683. AC_TRY_COMPILE([$configure_static_assert_macros],
  1684.                [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
  1685.                result="yes", result="no")
  1686. AC_MSG_RESULT("$result")
  1687. if test "$result" = "yes"; then
  1688.     AC_DEFINE(HAVE_64BIT_BUILD)
  1689.     HAVE_64BIT_BUILD=1
  1690. fi
  1691. AC_SUBST(HAVE_64BIT_BUILD)
  1692. AC_LANG_RESTORE
  1693. fi # COMPILE_ENVIRONMENT
  1694.  
  1695. dnl ========================================================
  1696. dnl = Use profiling compile flags
  1697. dnl ========================================================
  1698. MOZ_ARG_ENABLE_BOOL(profiling,
  1699. [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
  1700.     MOZ_PROFILING=1,
  1701.     MOZ_PROFILING= )
  1702.  
  1703. dnl ========================================================
  1704. dnl = Turn on systrace for android/b2g.
  1705. dnl ========================================================
  1706. MOZ_ARG_ENABLE_BOOL(systrace,
  1707. [  --enable-systrace       Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
  1708.     MOZ_USE_SYSTRACE=1,
  1709.     MOZ_USE_SYSTRACE= )
  1710. if test -n "$MOZ_USE_SYSTRACE"; then
  1711.     AC_DEFINE(MOZ_USE_SYSTRACE)
  1712. fi
  1713.  
  1714. # For profiling builds keep the symbol information
  1715. if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
  1716.     case "$OS_TARGET" in
  1717.     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
  1718.         STRIP_FLAGS="--strip-debug"
  1719.         ;;
  1720.     esac
  1721. fi
  1722.  
  1723. dnl ========================================================
  1724. dnl = Use Valgrind
  1725. dnl ========================================================
  1726. MOZ_ARG_ENABLE_BOOL(valgrind,
  1727. [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
  1728.     MOZ_VALGRIND=1,
  1729.     MOZ_VALGRIND= )
  1730. if test -n "$MOZ_VALGRIND"; then
  1731.     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
  1732.         AC_MSG_ERROR(
  1733.             [--enable-valgrind specified but Valgrind is not installed]))
  1734.     AC_DEFINE(MOZ_VALGRIND)
  1735. fi
  1736. AC_SUBST(MOZ_VALGRIND)
  1737.  
  1738. dnl ========================================================
  1739. dnl jprof
  1740. dnl ========================================================
  1741. MOZ_ARG_ENABLE_BOOL(jprof,
  1742. [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
  1743.     MOZ_JPROF=1,
  1744.     MOZ_JPROF= )
  1745. if test -n "$MOZ_JPROF"; then
  1746.     MOZ_PROFILING=1
  1747.     AC_DEFINE(MOZ_JPROF)
  1748. fi
  1749.  
  1750. dnl ========================================================
  1751. dnl SPS Profiler
  1752. dnl ========================================================
  1753. MOZ_ENABLE_PROFILER_SPS=1
  1754.  
  1755. case "${OS_TARGET}" in
  1756. Android)
  1757.     case "${CPU_ARCH}" in
  1758.     x86 | arm) ;;
  1759.     *)
  1760.         MOZ_ENABLE_PROFILER_SPS=
  1761.     esac
  1762.     ;;
  1763. Linux)
  1764.     case "${CPU_ARCH}" in
  1765.     x86 | x86_64) ;;
  1766.     *)
  1767.         MOZ_ENABLE_PROFILER_SPS=
  1768.     esac
  1769.     ;;
  1770. WINNT|Darwin) ;;
  1771. *)
  1772.     MOZ_ENABLE_PROFILER_SPS=
  1773.     ;;
  1774. esac
  1775.  
  1776. if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
  1777.     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
  1778. fi
  1779.  
  1780. dnl ========================================================
  1781. dnl shark
  1782. dnl ========================================================
  1783. MOZ_ARG_ENABLE_BOOL(shark,
  1784. [  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
  1785.     MOZ_SHARK=1,
  1786.     MOZ_SHARK= )
  1787. if test -n "$MOZ_SHARK"; then
  1788.     MOZ_PROFILING=1
  1789.     AC_DEFINE(MOZ_SHARK)
  1790. fi
  1791.  
  1792. dnl ========================================================
  1793. dnl instruments
  1794. dnl ========================================================
  1795. MOZ_ARG_ENABLE_BOOL(instruments,
  1796. [  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
  1797.     MOZ_INSTRUMENTS=1,
  1798.     MOZ_INSTRUMENTS= )
  1799. if test -n "$MOZ_INSTRUMENTS"; then
  1800.     MOZ_PROFILING=1
  1801.     AC_DEFINE(MOZ_INSTRUMENTS)
  1802. fi
  1803.  
  1804. dnl ========================================================
  1805. dnl callgrind
  1806. dnl ========================================================
  1807. MOZ_ARG_ENABLE_BOOL(callgrind,
  1808. [  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
  1809.     MOZ_CALLGRIND=1,
  1810.     MOZ_CALLGRIND= )
  1811. if test -n "$MOZ_CALLGRIND"; then
  1812.     MOZ_PROFILING=1
  1813.     AC_DEFINE(MOZ_CALLGRIND)
  1814. fi
  1815.  
  1816. dnl ========================================================
  1817. dnl vtune
  1818. dnl ========================================================
  1819. MOZ_ARG_ENABLE_BOOL(vtune,
  1820. [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
  1821.     MOZ_VTUNE=1,
  1822.     MOZ_VTUNE= )
  1823. if test -n "$MOZ_VTUNE"; then
  1824.     MOZ_PROFILING=1
  1825.     AC_DEFINE(MOZ_VTUNE)
  1826. fi
  1827.  
  1828. dnl ========================================================
  1829. dnl Profiling
  1830. dnl ========================================================
  1831. if test -n "$MOZ_PROFILING"; then
  1832.     AC_DEFINE(MOZ_PROFILING)
  1833. fi
  1834.  
  1835. dnl ========================================================
  1836. dnl System overrides of the defaults for host
  1837. dnl ========================================================
  1838. case "$host" in
  1839. *mingw*)
  1840.     if test -n "$_WIN32_MSVC"; then
  1841.         HOST_AR=lib
  1842.         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
  1843.         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
  1844.         HOST_RANLIB='echo ranlib'
  1845.     else
  1846.         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
  1847.     fi
  1848.     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
  1849.     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
  1850.     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1851.     HOST_BIN_SUFFIX=.exe
  1852.     case "$host" in
  1853.     *mingw*)
  1854.         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
  1855.         ;;
  1856.     esac
  1857.  
  1858.     case "${host_cpu}" in
  1859.     i*86)
  1860.         if test -n "$_WIN32_MSVC"; then
  1861.             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
  1862.         fi
  1863.         ;;
  1864.     x86_64)
  1865.         if test -n "$_WIN32_MSVC"; then
  1866.             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
  1867.         fi
  1868.         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
  1869.         ;;
  1870.     esac
  1871.     ;;
  1872.  
  1873. *-darwin*)
  1874.     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
  1875.     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  1876.     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1877.     ;;
  1878.  
  1879. *-linux*|*-kfreebsd*-gnu|*-gnu*)
  1880.     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1881.     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1882.     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1883.     ;;
  1884.  
  1885. *)
  1886.     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1887.     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1888.     ;;
  1889. esac
  1890.  
  1891. dnl ==============================================================
  1892. dnl Get mozilla version from central milestone file
  1893. dnl ==============================================================
  1894. MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
  1895. MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
  1896. MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
  1897.  
  1898. dnl Get version of various core apps from the version files.
  1899. FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
  1900.  
  1901. if test -z "$FIREFOX_VERSION"; then
  1902.     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
  1903. fi
  1904.  
  1905. AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
  1906. AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
  1907. AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
  1908. AC_SUBST(MOZILLA_SYMBOLVERSION)
  1909.  
  1910. MOZ_DOING_LTO(lto_is_enabled)
  1911.  
  1912. dnl ========================================================
  1913. dnl System overrides of the defaults for target
  1914. dnl ========================================================
  1915.  
  1916. case "$target" in
  1917. *-aix*)
  1918.     AC_DEFINE(AIX)
  1919.     if test ! "$GNU_CC"; then
  1920.         if test ! "$HAVE_64BIT_BUILD"; then
  1921.             # Compiling with Visual Age C++ object model compat is the
  1922.             # default. To compile with object model ibm, add
  1923.             # AIX_OBJMODEL=ibm to .mozconfig.
  1924.             if test "$AIX_OBJMODEL" = "ibm"; then
  1925.                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
  1926.             else
  1927.                 AIX_OBJMODEL=compat
  1928.             fi
  1929.         else
  1930.             AIX_OBJMODEL=compat
  1931.         fi
  1932.         AC_SUBST(AIX_OBJMODEL)
  1933.         DSO_LDOPTS='-qmkshrobj=1'
  1934.         DSO_CFLAGS='-qflag=w:w'
  1935.         DSO_PIC_CFLAGS=
  1936.         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
  1937.         MOZ_FIX_LINK_PATHS=
  1938.         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  1939.         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  1940.         if test "$COMPILE_ENVIRONMENT"; then
  1941.             AC_LANG_SAVE
  1942.             AC_LANG_CPLUSPLUS
  1943.             AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
  1944.             AC_TRY_COMPILE([],
  1945.                 [#if (__IBMCPP__ < 900)
  1946.                  #error "Bad compiler"
  1947.                  #endif],
  1948.                 _BAD_COMPILER=,_BAD_COMPILER=1)
  1949.             if test -n "$_BAD_COMPILER"; then
  1950.                 AC_MSG_RESULT([no])
  1951.                 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
  1952.             else
  1953.                 AC_MSG_RESULT([yes])
  1954.             fi
  1955.             AC_LANG_RESTORE
  1956.             TARGET_COMPILER_ABI="ibmc"
  1957.             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
  1958.             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
  1959.         fi
  1960.     fi
  1961.     case "${target_os}" in
  1962.     aix4.1*)
  1963.         DLL_SUFFIX='_shr.a'
  1964.         ;;
  1965.     esac
  1966.     if test "$COMPILE_ENVIRONMENT"; then
  1967.         MOZ_CHECK_HEADERS(sys/inttypes.h)
  1968.     fi
  1969.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1970.     ;;
  1971.  
  1972. *-darwin*)
  1973.     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1974.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1975.     MOZ_OPTIMIZE_FLAGS="-O3"
  1976.     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
  1977.     if test "$HAVE_64BIT_BUILD"; then
  1978.         MOZ_MEMORY=1
  1979.     fi
  1980.     DLL_SUFFIX=".dylib"
  1981.     DSO_LDOPTS=''
  1982.     STRIP_FLAGS="$STRIP_FLAGS -x -S"
  1983.     # Check whether we're targeting OS X or iOS
  1984.     AC_CACHE_CHECK(for iOS target,
  1985.                    ac_cv_ios_target,
  1986.                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
  1987. #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
  1988. #error not iOS
  1989. #endif],
  1990.                                    [],
  1991.                                    ac_cv_ios_target="yes",
  1992.                                    ac_cv_ios_target="no")])
  1993.     if test "$ac_cv_ios_target" = "yes"; then
  1994.         AC_DEFINE(XP_IOS)
  1995.         AC_DEFINE(XP_DARWIN)
  1996.         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
  1997.     else
  1998.         AC_DEFINE(XP_MACOSX)
  1999.         AC_DEFINE(XP_DARWIN)
  2000.         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
  2001.         # The ExceptionHandling framework is needed for Objective-C exception
  2002.         # logging code in nsObjCExceptions.h. Currently we only use that in debug
  2003.         # builds.
  2004.         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
  2005.     fi
  2006.     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  2007.  
  2008.     if test "x$lto_is_enabled" = "xyes"; then
  2009.         echo "Skipping -dead_strip because lto is enabled."
  2010.     dnl DTrace and -dead_strip don't interact well. See bug 403132.
  2011.     dnl ===================================================================
  2012.     elif test "x$enable_dtrace" = "xyes"; then
  2013.         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
  2014.     else
  2015.         dnl check for the presence of the -dead_strip linker flag
  2016.         AC_MSG_CHECKING([for -dead_strip option to ld])
  2017.         _SAVE_LDFLAGS=$LDFLAGS
  2018.         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
  2019.         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
  2020.         if test -n "$_HAVE_DEAD_STRIP" ; then
  2021.             AC_MSG_RESULT([yes])
  2022.             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
  2023.         else
  2024.             AC_MSG_RESULT([no])
  2025.         fi
  2026.  
  2027.         LDFLAGS=$_SAVE_LDFLAGS
  2028.     fi
  2029.  
  2030.     dnl With newer linkers we need to pass -allow_heap_execute because of
  2031.     dnl Microsoft Silverlight (5.1.10411.0 at least).
  2032.     AC_MSG_CHECKING([for -allow_heap_execute option to ld])
  2033.     _SAVE_LDFLAGS=$LDFLAGS
  2034.     LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
  2035.     AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
  2036.                 _HAVE_ALLOW_HEAP_EXECUTE=)
  2037.     if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
  2038.         AC_MSG_RESULT([yes])
  2039.         MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
  2040.     else
  2041.         AC_MSG_RESULT([no])
  2042.     fi
  2043.     LDFLAGS=$_SAVE_LDFLAGS
  2044.  
  2045.     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
  2046.     ;;
  2047.  
  2048. ia64*-hpux*)
  2049.     DLL_SUFFIX=".so"
  2050.     if test ! "$GNU_CC"; then
  2051.        DSO_LDOPTS='-b'
  2052.        DSO_CFLAGS=""
  2053.        DSO_PIC_CFLAGS=
  2054.        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  2055.        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  2056.        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  2057.     else
  2058.        DSO_LDOPTS='-b -E'
  2059.        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  2060.        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  2061.     fi
  2062.     MOZ_FIX_LINK_PATHS=
  2063.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  2064.     AC_DEFINE(_LARGEFILE64_SOURCE)
  2065.     ;;
  2066.  
  2067. *-hpux*)
  2068.     DLL_SUFFIX=".sl"
  2069.     if test ! "$GNU_CC"; then
  2070.         DSO_LDOPTS='-b -Wl,+s'
  2071.         DSO_CFLAGS=""
  2072.         DSO_PIC_CFLAGS="+Z"
  2073.         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
  2074.         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
  2075.         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  2076.     else
  2077.         DSO_LDOPTS='-b -E +s'
  2078.         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  2079.         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  2080.     fi
  2081.     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
  2082.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  2083.     ;;
  2084.  
  2085. *-android*|*-linuxandroid*)
  2086.     AC_DEFINE(NO_PW_GECOS)
  2087.     no_x=yes
  2088.     if test -n "$gonkdir"; then
  2089.         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
  2090.         _PLATFORM_HAVE_RIL=1
  2091.         MOZ_B2G_FM=1
  2092.         MOZ_SYNTH_PICO=1
  2093.     else
  2094.         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
  2095.         MOZ_LINKER=1
  2096.     fi
  2097.     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  2098.  
  2099.     MOZ_GFX_OPTIMIZE_MOBILE=1
  2100.     MOZ_OPTIMIZE_FLAGS="-Os -fno-reorder-functions"
  2101.     if test -z "$CLANG_CC"; then
  2102.        MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
  2103.     fi
  2104.     ;;
  2105.  
  2106. *-*linux*)
  2107.     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
  2108.     # Similarly for GNU_CXX and INTEL_CXX.
  2109.     if test "$INTEL_CC" -o "$INTEL_CXX"; then
  2110.         # -Os has been broken on Intel's C/C++ compilers for quite a
  2111.         # while; Intel recommends against using it.
  2112.         MOZ_OPTIMIZE_FLAGS="-O2"
  2113.     elif test "$GNU_CC" -o "$GNU_CXX"; then
  2114.         case $GCC_VERSION in
  2115.         4.5.*)
  2116.             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
  2117.             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
  2118.         esac
  2119.         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
  2120.         MOZ_OPTIMIZE_FLAGS="-Os $MOZ_OPTIMIZE_SIZE_TWEAK"
  2121.         if test -z "$CLANG_CC"; then
  2122.            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
  2123.         fi
  2124.     fi
  2125.  
  2126.     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  2127.  
  2128.     MOZ_MEMORY=1
  2129.  
  2130.     case "${target_cpu}" in
  2131.     alpha*)
  2132.         CFLAGS="$CFLAGS -mieee"
  2133.         CXXFLAGS="$CXXFLAGS -mieee"
  2134.     ;;
  2135.     esac
  2136.  
  2137.     if test -z "$MC"; then
  2138.         MC=mc.exe
  2139.     fi
  2140.     ;;
  2141. *-mingw*)
  2142.     DSO_CFLAGS=
  2143.     DSO_PIC_CFLAGS=
  2144.     DLL_SUFFIX=.dll
  2145.     RC=rc.exe
  2146.     MC=mc.exe
  2147.     # certain versions of cygwin's makedepend barf on the
  2148.     # #include <string> vs -I./dist/include/string issue so don't use it
  2149.     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
  2150.         CC="$CC -mwindows"
  2151.         CXX="$CXX -mwindows"
  2152.         CPP="$CPP -mwindows"
  2153.         CFLAGS="$CFLAGS -mms-bitfields"
  2154.         CXXFLAGS="$CXXFLAGS -mms-bitfields"
  2155.         DSO_LDOPTS='-shared'
  2156.         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  2157.         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  2158.         RC='$(WINDRES)'
  2159.         # Use static libgcc and libstdc++
  2160.         LDFLAGS="$LDFLAGS -static"
  2161.         NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
  2162.         # Use temp file for windres (bug 213281)
  2163.         RCFLAGS='-O coff --use-temp-file'
  2164.         # mingw doesn't require kernel32, user32, and advapi32 explicitly
  2165.         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
  2166.         MOZ_FIX_LINK_PATHS=
  2167.         DLL_PREFIX=
  2168.         IMPORT_LIB_SUFFIX=a
  2169.  
  2170.         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
  2171.         WIN32_GUI_EXE_LDFLAGS=-mwindows
  2172.  
  2173.         # We use mix of both POSIX and Win32 printf format across the tree, so format
  2174.         # warnings are useless on mingw.
  2175.         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
  2176.         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
  2177.     else
  2178.         TARGET_COMPILER_ABI=msvc
  2179.         HOST_CC='$(CC)'
  2180.         HOST_CXX='$(CXX)'
  2181.         HOST_LD='$(LD)'
  2182.         if test "$AS_BIN"; then
  2183.             AS="$(basename "$AS_BIN")"
  2184.         fi
  2185.         AR='lib'
  2186.         AR_FLAGS='-NOLOGO -OUT:$@'
  2187.         AR_EXTRACT=
  2188.         RANLIB='echo not_ranlib'
  2189.         STRIP='echo not_strip'
  2190.         PKG_SKIP_STRIP=1
  2191.         XARGS=xargs
  2192.         ZIP=zip
  2193.         UNZIP=unzip
  2194.         DOXYGEN=:
  2195.         ASM_SUFFIX=asm
  2196.         OBJ_SUFFIX=obj
  2197.         LIB_SUFFIX=lib
  2198.         DLL_PREFIX=
  2199.         LIB_PREFIX=
  2200.         IMPORT_LIB_SUFFIX=lib
  2201.         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  2202.         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  2203.         MKSHLIB_FORCE_ALL=
  2204.         MKSHLIB_UNFORCE_ALL=
  2205.         dnl Set subsystem version 5 for Windows XP.
  2206.         if test "$CPU_ARCH" = "x86"; then
  2207.             WIN32_SUBSYSTEM_VERSION=5.01
  2208.         else
  2209.             WIN32_SUBSYSTEM_VERSION=6.01
  2210.         fi
  2211.         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
  2212.         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
  2213.         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
  2214.         _USE_CPP_INCLUDE_FLAG=1
  2215.         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
  2216.         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
  2217.         CFLAGS="$CFLAGS -W3 -Gy"
  2218.         CXXFLAGS="$CXXFLAGS -W3 -Gy"
  2219.         if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
  2220.             dnl VS2012+ defaults to -arch:SSE2.
  2221.             CFLAGS="$CFLAGS -arch:IA32"
  2222.             CXXFLAGS="$CXXFLAGS -arch:IA32"
  2223.         fi
  2224.         if test "$_CC_SUITE" -ge "12"; then
  2225.             dnl VS2013+ requires -FS when parallel building by make -jN.
  2226.             dnl If nothing, compiler sometimes causes C1041 error.
  2227.             CFLAGS="$CFLAGS -FS"
  2228.             CXXFLAGS="$CXXFLAGS -FS"
  2229.         fi
  2230.         # khuey says we can safely ignore MSVC warning C4251
  2231.         # MSVC warning C4244 (implicit type conversion may lose data) warns
  2232.         # and requires workarounds for perfectly valid code.  Also, GCC/clang
  2233.         # don't warn about it by default. So for consistency/sanity, we turn
  2234.         # it off on MSVC, too.
  2235.         # MSVC warning C4267 warns for narrowing type conversions from size_t
  2236.         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
  2237.         # the same thing as C4244, we disable C4267, too.
  2238.         # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
  2239.         # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
  2240.         # MSVC warning C4482 warns when an enum value is refered specifing the
  2241.         # name of the enum itself.  This behavior is allowed in C++11, and the
  2242.         # warning has been removed in VS2012.
  2243.         # MSVC warning C4800 warns when a value is implicitly cast to bool,
  2244.         # because this also forces narrowing to a single byte, which can be a
  2245.         # perf hit.  But this matters so little in practice (and often we want
  2246.         # that behavior) that it's better to turn it off.
  2247.         # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
  2248.         # on non-Western system locales even if it is in a comment.
  2249.         CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
  2250.         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
  2251.         if test -n "$CLANG_CL"; then
  2252.             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
  2253.             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
  2254.         fi
  2255.         # make 'foo == bar;' error out
  2256.         CFLAGS="$CFLAGS -we4553"
  2257.         CXXFLAGS="$CXXFLAGS -we4553"
  2258.         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
  2259.         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
  2260.         WARNINGS_AS_ERRORS='-WX'
  2261.         MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
  2262.         MOZ_FIX_LINK_PATHS=
  2263.         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
  2264.         # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
  2265.         # autoconf insists on passing $LDFLAGS to the compiler.
  2266.         if test -z "$CLANG_CL"; then
  2267.             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
  2268.             if test -z "$DEVELOPER_OPTIONS"; then
  2269.                 LDFLAGS="$LDFLAGS -RELEASE"
  2270.             fi
  2271.         fi
  2272.         dnl For profile-guided optimization
  2273.         PROFILE_GEN_CFLAGS="-GL"
  2274.         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
  2275.         dnl XXX: PGO builds can fail with warnings treated as errors,
  2276.         dnl specifically "no profile data available" appears to be
  2277.         dnl treated as an error sometimes. This might be a consequence
  2278.         dnl of using WARNINGS_AS_ERRORS in some modules, combined
  2279.         dnl with the linker doing most of the work in the whole-program
  2280.         dnl optimization/PGO case. I think it's probably a compiler bug,
  2281.         dnl but we work around it here.
  2282.         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
  2283.         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
  2284.         dnl Probably also a compiler bug, but what can you do?
  2285.         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
  2286.         LDFLAGS="$LDFLAGS -DYNAMICBASE"
  2287.         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
  2288.         dnl both SSSE3 and SSE4.1.
  2289.         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
  2290.         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
  2291.         if test "$_CC_SUITE" -ge "11"; then
  2292.             dnl allow AVX2 code from VS2012
  2293.             HAVE_X86_AVX2=1
  2294.         fi
  2295.         MOZ_MEMORY=1
  2296.     fi
  2297.     AC_DEFINE(HAVE_SNPRINTF)
  2298.     AC_DEFINE(_WINDOWS)
  2299.     AC_DEFINE(WIN32)
  2300.     AC_DEFINE(XP_WIN)
  2301.     AC_DEFINE(XP_WIN32)
  2302.     AC_DEFINE(HW_THREADS)
  2303.     AC_DEFINE(STDC_HEADERS)
  2304.     AC_DEFINE(WIN32_LEAN_AND_MEAN)
  2305.     TARGET_MD_ARCH=win32
  2306.     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
  2307.     BIN_SUFFIX='.exe'
  2308.     MOZ_USER_DIR="Mozilla"
  2309.  
  2310.     dnl Hardcode to win95 for now - cls
  2311.     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
  2312.  
  2313.     dnl set NO_X11 defines here as the general check is skipped on win32
  2314.     no_x=yes
  2315.     AC_DEFINE(NO_X11)
  2316.  
  2317.     case "$host" in
  2318.     *-mingw*)
  2319.         if test -n "$L10NBASEDIR"; then
  2320.             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
  2321.         fi
  2322.         ;;
  2323.     esac
  2324.  
  2325.     case "$host" in
  2326.     *-mingw*)
  2327.         if test -z "$MOZ_TOOLS"; then
  2328.             AC_MSG_ERROR([MOZ_TOOLS is not set])
  2329.         fi
  2330.         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
  2331.         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
  2332.             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
  2333.         fi
  2334.         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
  2335.         if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
  2336.             AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
  2337.         fi
  2338.         ;;
  2339.     esac
  2340.  
  2341.     case "$host_os" in
  2342.     cygwin*|msvc*|mks*)
  2343.         AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
  2344.         ;;
  2345.     esac
  2346.  
  2347.     case "$target" in
  2348.     i*86-*)
  2349.         if test "$HAVE_64BIT_BUILD"; then
  2350.             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
  2351.         fi
  2352.  
  2353.         if test -n "$GNU_CC"; then
  2354.             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
  2355.             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
  2356.             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
  2357.         else
  2358.             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
  2359.             # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
  2360.             # autoconf insists on passing $LDFLAGS to the compiler.
  2361.             if test -z "$CLANG_CL"; then
  2362.                 LDFLAGS="$LDFLAGS -SAFESEH"
  2363.             fi
  2364.         fi
  2365.  
  2366.         AC_DEFINE(_X86_)
  2367.         ;;
  2368.     x86_64-*)
  2369.         if test -n "$_WIN32_MSVC"; then
  2370.             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
  2371.         fi
  2372.         AC_DEFINE(_AMD64_)
  2373.         ;;
  2374.     *)
  2375.         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
  2376.         ;;
  2377.     esac
  2378.     ;;
  2379.  
  2380. *-netbsd*)
  2381.     DSO_CFLAGS=''
  2382.     CFLAGS="$CFLAGS -Dunix"
  2383.     CXXFLAGS="$CXXFLAGS -Dunix"
  2384.     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
  2385.         DLL_SUFFIX=".so"
  2386.         DSO_PIC_CFLAGS='-fPIC -DPIC'
  2387.         DSO_LDOPTS='-shared'
  2388.         BIN_FLAGS='-Wl,--export-dynamic'
  2389.     else
  2390.         DSO_PIC_CFLAGS='-fPIC -DPIC'
  2391.         DLL_SUFFIX=".so.1.0"
  2392.         DSO_LDOPTS='-shared'
  2393.     fi
  2394.     # This will fail on a.out systems prior to 1.5.1_ALPHA.
  2395.     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
  2396.     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
  2397.     if test "$LIBRUNPATH"; then
  2398.         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
  2399.     fi
  2400.     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
  2401.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
  2402.     ;;
  2403.  
  2404. *-openbsd*)
  2405.     if test "$SO_VERSION"; then
  2406.         DLL_SUFFIX=".so.$SO_VERSION"
  2407.     else
  2408.         DLL_SUFFIX=".so.1.0"
  2409.     fi
  2410.     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
  2411.     DSO_CFLAGS=''
  2412.     DSO_PIC_CFLAGS='-fPIC'
  2413.     DSO_LDOPTS='-shared -fPIC'
  2414.     if test "$LIBRUNPATH"; then
  2415.         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
  2416.     fi
  2417.     ;;
  2418.  
  2419. *-solaris*)
  2420.     AC_DEFINE(SOLARIS)
  2421.     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
  2422.     MOZ_FIX_LINK_PATHS=
  2423.     # $ORIGIN/.. is for shared libraries under components/ to locate shared
  2424.     # libraries one level up (e.g. libnspr4.so)
  2425.     if test "$SOLARIS_SUNPRO_CC"; then
  2426.        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
  2427.        LIBS="-lCrun -lCstd -lc $LIBS"
  2428.        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  2429.        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
  2430.        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
  2431.        LDFLAGS="-xildoff $LDFLAGS"
  2432.        MMX_FLAGS="-xarch=mmx -xO4"
  2433.        SSE_FLAGS="-xarch=sse"
  2434.        SSE2_FLAGS="-xarch=ssei2 -xO4"
  2435.        if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
  2436.            _SAVE_LDFLAGS=$LDFLAGS
  2437.            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
  2438.            AC_TRY_LINK([#include <stdio.h>],
  2439.                        [printf("Hello World\n");],
  2440.                        ,
  2441.                        [LDFLAGS=$_SAVE_LDFLAGS])
  2442.        fi
  2443.        MOZ_OPTIMIZE_FLAGS="-xO4"
  2444.        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  2445.        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  2446.        MKSHLIB_FORCE_ALL='-z allextract'
  2447.        MKSHLIB_UNFORCE_ALL='-z defaultextract'
  2448.        DSO_LDOPTS='-G'
  2449.        AR_LIST="$AR t"
  2450.        AR_EXTRACT="$AR x"
  2451.        AR_DELETE="$AR d"
  2452.        AR='$(CXX) -xar'
  2453.        AR_FLAGS='-o $@'
  2454.        AS='/usr/ccs/bin/as'
  2455.        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
  2456.        AS_DASH_C_FLAG=''
  2457.        TARGET_COMPILER_ABI="sunc"
  2458.        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  2459.        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  2460.        AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
  2461.        AC_LANG_SAVE
  2462.        AC_LANG_CPLUSPLUS
  2463.        AC_TRY_COMPILE([],
  2464.            [#if (__SUNPRO_CC < 0x590)
  2465.            #error "Denied"
  2466.            #endif],
  2467.            _BAD_COMPILER=,_BAD_COMPILER=1)
  2468.        if test -n "$_BAD_COMPILER"; then
  2469.            _res="no"
  2470.            AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
  2471.        else
  2472.            _res="yes"
  2473.        fi
  2474.        AC_TRY_COMPILE([],
  2475.            [#if (__SUNPRO_CC >= 0x5100)
  2476.            #error "Sun C++ 5.10 or above"
  2477.            #endif],
  2478.            _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
  2479.        if test "$_ABOVE_SS12U1"; then
  2480.            # disable xannotate
  2481.            CXXFLAGS="$CXXFLAGS -xannotate=no"
  2482.        fi
  2483.        AC_MSG_RESULT([$_res])
  2484.        AC_LANG_RESTORE
  2485.     else
  2486.        LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
  2487.        LIBS="-lc $LIBS"
  2488.        MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
  2489.        MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
  2490.        ASFLAGS="$ASFLAGS -fPIC"
  2491.        DSO_LDOPTS='-shared'
  2492.        WARNINGS_AS_ERRORS='-Werror'
  2493.        _WARNINGS_CFLAGS=''
  2494.        _WARNINGS_CXXFLAGS=''
  2495.        if test "$OS_RELEASE" = "5.3"; then
  2496.            AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
  2497.        fi
  2498.     fi
  2499.     if test "$OS_RELEASE" = "5.5.1"; then
  2500.         AC_DEFINE(NEED_USLEEP_PROTOTYPE)
  2501.     fi
  2502.     ;;
  2503.  
  2504. *-sunos*)
  2505.     DSO_LDOPTS='-Bdynamic'
  2506.     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  2507.     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  2508.     AC_DEFINE(SUNOS4)
  2509.     AC_DEFINE(SPRINTF_RETURNS_STRING)
  2510.     case "$(target_os)" in
  2511.     sunos4.1*)
  2512.         DLL_SUFFIX='.so.1.0'
  2513.         ;;
  2514.     esac
  2515.     ;;
  2516.  
  2517. esac
  2518.  
  2519. AC_SUBST_LIST(MMX_FLAGS)
  2520. AC_SUBST_LIST(SSE_FLAGS)
  2521. AC_SUBST_LIST(SSE2_FLAGS)
  2522.  
  2523. case "$target" in
  2524. *-*linux*)
  2525.     # Includes linux-android
  2526.     AC_DEFINE(XP_LINUX)
  2527.     ;;
  2528. esac
  2529.  
  2530. AC_SUBST(MOZ_LINKER)
  2531. if test -n "$MOZ_LINKER"; then
  2532.   AC_DEFINE(MOZ_LINKER)
  2533. fi
  2534.  
  2535. dnl Only one oddball right now (QNX), but this gives us flexibility
  2536. dnl if any other platforms need to override this in the future.
  2537. AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
  2538.  
  2539. dnl ========================================================
  2540. dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
  2541. dnl by now will not have any way to link most binaries (tests
  2542. dnl as well as viewer, apprunner, etc.), because some symbols
  2543. dnl will be left out of the "composite" .so's by ld as unneeded.
  2544. dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
  2545. dnl they can link in the static libs that provide the missing
  2546. dnl symbols.
  2547. dnl ========================================================
  2548. NO_LD_ARCHIVE_FLAGS=
  2549. if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
  2550.     NO_LD_ARCHIVE_FLAGS=1
  2551. fi
  2552. case "$target" in
  2553. *-aix4.3*|*-aix5*)
  2554.     NO_LD_ARCHIVE_FLAGS=
  2555.     ;;
  2556. *-mingw*)
  2557.     if test -z "$GNU_CC"; then
  2558.         NO_LD_ARCHIVE_FLAGS=
  2559.     fi
  2560.     ;;
  2561. esac
  2562. AC_SUBST(NO_LD_ARCHIVE_FLAGS)
  2563.  
  2564. dnl ========================================================
  2565. dnl = Flags to strip unused symbols from .so components and
  2566. dnl = to export jemalloc symbols when linking a program
  2567. dnl ========================================================
  2568. case "$target" in
  2569.     *-linux*|*-kfreebsd*-gnu|*-gnu*)
  2570.         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  2571.         ;;
  2572.     *-solaris*)
  2573.         if test -z "$GNU_CC"; then
  2574.          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  2575.         else
  2576.          if test -z "$GCC_USE_GNU_LD"; then
  2577.           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  2578.          else
  2579.           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  2580.          fi
  2581.         fi
  2582.         ;;
  2583.     *-darwin*)
  2584.         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
  2585.         ;;
  2586.     *-mingw*)
  2587.         if test -n "$GNU_CC"; then
  2588.            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  2589.         fi
  2590.         ;;
  2591. esac
  2592.  
  2593. if test -z "$COMPILE_ENVIRONMENT"; then
  2594.     SKIP_COMPILER_CHECKS=1
  2595.     SKIP_LIBRARY_CHECKS=1
  2596. else
  2597.     MOZ_COMPILER_OPTS
  2598. fi
  2599.  
  2600. if test -z "$SKIP_COMPILER_CHECKS"; then
  2601. dnl Checks for typedefs, structures, and compiler characteristics.
  2602. dnl ========================================================
  2603. AC_HEADER_STDC
  2604. AC_C_CONST
  2605. AC_TYPE_MODE_T
  2606. AC_TYPE_OFF_T
  2607. AC_TYPE_PID_T
  2608. AC_TYPE_SIZE_T
  2609. AC_LANG_CPLUSPLUS
  2610. AC_LANG_C
  2611.  
  2612. AC_LANG_CPLUSPLUS
  2613.  
  2614. MOZ_CXX11
  2615.  
  2616. AC_LANG_C
  2617.  
  2618. dnl Check for .hidden assembler directive and visibility attribute.
  2619. dnl Borrowed from glibc configure.in
  2620. dnl ===============================================================
  2621. if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
  2622.   AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
  2623.   AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
  2624.   case "$OS_TARGET" in
  2625.   Darwin)
  2626.     VISIBILITY_FLAGS='-fvisibility=hidden'
  2627.     ;;
  2628.   *)
  2629.     case $GCC_VERSION in
  2630.     4.4*|4.6*)
  2631.       VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
  2632.       ;;
  2633.     *)
  2634.       VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
  2635.       ;;
  2636.     esac
  2637.     WRAP_SYSTEM_INCLUDES=1
  2638.     ;;
  2639.   esac
  2640. fi         # GNU_CC
  2641.  
  2642. # visibility hidden flag for Sun Studio on Solaris
  2643. if test "$SOLARIS_SUNPRO_CC"; then
  2644. VISIBILITY_FLAGS='-xldscope=hidden'
  2645. fi         # Sun Studio on Solaris
  2646.  
  2647. case "${OS_TARGET}" in
  2648. WINNT|Darwin|Android)
  2649.   ;;
  2650. *)
  2651.   STL_FLAGS='-I$(DIST)/stl_wrappers'
  2652.   WRAP_STL_INCLUDES=1
  2653.   ;;
  2654. esac
  2655.  
  2656. AC_SUBST(WRAP_SYSTEM_INCLUDES)
  2657. AC_SUBST(VISIBILITY_FLAGS)
  2658.  
  2659. MOZ_GCC_PR49911
  2660. MOZ_LLVM_PR8927
  2661.  
  2662. dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
  2663. dnl ========================================================
  2664. if test "$GNU_CC"; then
  2665.   CFLAGS_save="${CFLAGS}"
  2666.   CFLAGS="${CFLAGS} -Werror"
  2667.   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
  2668.                  ac_cv_force_align_arg_pointer,
  2669.                  [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
  2670.                                  [],
  2671.                                  ac_cv_force_align_arg_pointer="yes",
  2672.                                  ac_cv_force_align_arg_pointer="no")])
  2673.   CFLAGS="${CFLAGS_save}"
  2674.   if test "$ac_cv_force_align_arg_pointer" = "yes"; then
  2675.     HAVE_GCC_ALIGN_ARG_POINTER=1
  2676.   else
  2677.     HAVE_GCC_ALIGN_ARG_POINTER=
  2678.   fi
  2679. fi
  2680. AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
  2681.  
  2682. dnl Checks for header files.
  2683. dnl ========================================================
  2684. AC_HEADER_DIRENT
  2685. case "$target_os" in
  2686. freebsd*|openbsd*)
  2687. # for stuff like -lXshm
  2688.     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  2689.     ;;
  2690. esac
  2691. MOZ_CHECK_COMMON_HEADERS
  2692.  
  2693. dnl These are all the places some variant of statfs can be hiding.
  2694. MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
  2695.  
  2696. dnl Quota support
  2697. MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
  2698. MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
  2699.  
  2700. dnl SCTP support - needs various network include headers
  2701. MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
  2702.  
  2703. MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
  2704.  
  2705. dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
  2706. AC_CACHE_CHECK(for sockaddr_in.sin_len,
  2707.                    ac_cv_sockaddr_in_sin_len,
  2708.                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  2709.                                     #include <sys/types.h>
  2710.                                     #endif
  2711.                                     #include <netinet/in.h>
  2712.                                     struct sockaddr_in x;
  2713.                                     void *foo = (void*) &x.sin_len;],
  2714.                                    [],
  2715.                                    [ac_cv_sockaddr_in_sin_len=true],
  2716.                                    [ac_cv_sockaddr_in_sin_len=false])])
  2717. if test "$ac_cv_sockaddr_in_sin_len" = true ; then
  2718.   AC_DEFINE(HAVE_SIN_LEN)
  2719. dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
  2720.   AC_DEFINE(HAVE_SCONN_LEN)
  2721. fi
  2722.  
  2723. AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
  2724.                ac_cv_sockaddr_in6_sin6_len,
  2725.                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  2726.                                 #include <sys/types.h>
  2727.                                 #endif
  2728.                                 #include <netinet/in.h>
  2729.                                 struct sockaddr_in6 x;
  2730.                                 void *foo = (void*) &x.sin6_len;],
  2731.                                [],
  2732.                                [ac_cv_sockaddr_in6_sin6_len=true],
  2733.                                [ac_cv_sockaddr_in6_sin6_len=false])])
  2734. if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
  2735.   AC_DEFINE(HAVE_SIN6_LEN)
  2736. fi
  2737.  
  2738. AC_CACHE_CHECK(for sockaddr.sa_len,
  2739.                ac_cv_sockaddr_sa_len,
  2740.                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  2741.                                 #include <sys/types.h>
  2742.                                 #endif
  2743.                                 #include <sys/socket.h>
  2744.                                 struct sockaddr x;
  2745.                                 void *foo = (void*) &x.sa_len;],
  2746.                                [],
  2747.                                [ac_cv_sockaddr_sa_len=true],
  2748.                                [ac_cv_sockaddr_sa_len=false])])
  2749. if test "$ac_cv_sockaddr_sa_len" = true ; then
  2750.   AC_DEFINE(HAVE_SA_LEN)
  2751. fi
  2752.  
  2753. MOZ_ARG_ENABLE_BOOL(dtrace,
  2754.               [  --enable-dtrace         build with dtrace support if available (default=no)],
  2755.               [enable_dtrace="yes"],)
  2756. if test "x$enable_dtrace" = "xyes"; then
  2757.   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
  2758.   if test -n "$HAVE_DTRACE"; then
  2759.       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
  2760.   else
  2761.       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
  2762.   fi
  2763. fi
  2764. AC_SUBST(HAVE_DTRACE)
  2765.  
  2766. case $target in
  2767. *-aix4.3*|*-aix5*)
  2768.     ;;
  2769. *)
  2770.     MOZ_CHECK_HEADERS(sys/cdefs.h)
  2771.     ;;
  2772. esac
  2773.  
  2774. MOZ_LINUX_PERF_EVENT
  2775.  
  2776. dnl Checks for libraries.
  2777. dnl ========================================================
  2778. case $target in
  2779. *-hpux11.*)
  2780.     ;;
  2781. *)
  2782.     AC_CHECK_LIB(c_r, gethostbyname_r)
  2783.     ;;
  2784. esac
  2785.  
  2786. dnl We don't want to link with libdl even if it's present on OS X, since
  2787. dnl it's not used and not part of the default installation. OS/2 has dlfcn
  2788. dnl in libc.
  2789. dnl We don't want to link against libm or libpthread on Darwin since
  2790. dnl they both are just symlinks to libSystem and explicitly linking
  2791. dnl against libSystem causes issues when debugging (see bug 299601).
  2792. case $target in
  2793. *-darwin*)
  2794.     ;;
  2795. *)
  2796.     AC_SEARCH_LIBS(dlopen, dl,
  2797.         MOZ_CHECK_HEADER(dlfcn.h,
  2798.         AC_DEFINE(HAVE_DLOPEN)))
  2799.     ;;
  2800. esac
  2801.  
  2802. _SAVE_CFLAGS="$CFLAGS"
  2803. CFLAGS="$CFLAGS -D_GNU_SOURCE"
  2804. AC_CHECK_FUNCS(dladdr memmem)
  2805. CFLAGS="$_SAVE_CFLAGS"
  2806.  
  2807. if test ! "$GNU_CXX"; then
  2808.  
  2809.     case $target in
  2810.     *-aix*)
  2811.         AC_CHECK_LIB(C_r, demangle)
  2812.         ;;
  2813.      *)
  2814.         AC_CHECK_LIB(C, demangle)
  2815.         ;;
  2816.      esac
  2817. fi
  2818.  
  2819. AC_CHECK_LIB(socket, socket)
  2820.  
  2821. XLDFLAGS="$X_LIBS"
  2822. XLIBS="$X_EXTRA_LIBS"
  2823.  
  2824. dnl ========================================================
  2825. dnl Checks for X libraries.
  2826. dnl Ordering is important.
  2827. dnl Xt is dependent upon SM as of X11R6
  2828. dnl ========================================================
  2829. if test "$no_x" = "yes"; then
  2830.     AC_DEFINE(NO_X11)
  2831. else
  2832.     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
  2833.     XLIBS="-lX11 $XLIBS"
  2834.     _SAVE_LDFLAGS="$LDFLAGS"
  2835.     LDFLAGS="$XLDFLAGS $LDFLAGS"
  2836.     AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
  2837.         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
  2838.     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
  2839.         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
  2840.  
  2841.     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
  2842.         unset ac_cv_lib_Xt_XtFree
  2843.         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
  2844.         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
  2845.         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
  2846.             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
  2847.         ])
  2848.  
  2849.     # AIX needs the motif library linked before libXt to prevent
  2850.     # crashes in plugins linked against Motif - Bug #98892
  2851.     case "${target_os}" in
  2852.     aix*)
  2853.         XT_LIBS="-lXm $XT_LIBS"
  2854.         ;;
  2855.     esac
  2856.  
  2857.     dnl ========================================================
  2858.     dnl = Check for XShm
  2859.     dnl ========================================================
  2860.     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
  2861.         $XLIBS $XEXT_LIBS)
  2862.  
  2863.     dnl ========================================================
  2864.     dnl = Check for Xss
  2865.     dnl ========================================================
  2866.     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
  2867.         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
  2868.             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
  2869.              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
  2870.  
  2871.     LDFLAGS="$_SAVE_LDFLAGS"
  2872. fi # $no_x
  2873.  
  2874. AC_SUBST_LIST(XCFLAGS)
  2875. AC_SUBST_LIST(XLDFLAGS)
  2876. AC_SUBST_LIST(XLIBS)
  2877. AC_SUBST_LIST(XEXT_LIBS)
  2878. AC_SUBST_LIST(XT_LIBS)
  2879. AC_SUBST_LIST(XSS_LIBS)
  2880.  
  2881. dnl ========================================================
  2882. dnl = pthread support
  2883. dnl = Start by checking whether the system support pthreads
  2884. dnl ========================================================
  2885. case "$target_os" in
  2886. darwin*)
  2887.     MOZ_USE_PTHREADS=1
  2888.     ;;
  2889. *)
  2890.     AC_CHECK_LIB(pthreads, pthread_create,
  2891.         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
  2892.         AC_CHECK_LIB(pthread, pthread_create,
  2893.             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
  2894.             AC_CHECK_LIB(c_r, pthread_create,
  2895.                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
  2896.                 AC_CHECK_LIB(c, pthread_create,
  2897.                     MOZ_USE_PTHREADS=1
  2898.                 )
  2899.             )
  2900.         )
  2901.     )
  2902.     ;;
  2903. esac
  2904.  
  2905. dnl ========================================================
  2906. dnl Check the command line for --with-pthreads
  2907. dnl ========================================================
  2908. MOZ_ARG_WITH_BOOL(pthreads,
  2909. [  --with-pthreads         Force use of system pthread library with NSPR ],
  2910. [ if test "$MOZ_USE_PTHREADS"x = x; then
  2911.     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
  2912. fi],
  2913.     MOZ_USE_PTHREADS=
  2914.     _PTHREAD_LDFLAGS=
  2915. )
  2916.  
  2917. dnl ========================================================
  2918. dnl Do the platform specific pthread hackery
  2919. dnl ========================================================
  2920. if test "$MOZ_USE_PTHREADS"x != x
  2921. then
  2922.     dnl
  2923.     dnl See if -pthread is supported.
  2924.     dnl
  2925.     rm -f conftest*
  2926.     ac_cv_have_dash_pthread=no
  2927.     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
  2928.     echo 'int main() { return 0; }' | cat > conftest.c
  2929.     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
  2930.     if test $? -eq 0; then
  2931.         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  2932.             ac_cv_have_dash_pthread=yes
  2933.             case "$target_os" in
  2934.             freebsd*)
  2935. # Freebsd doesn't use -pthread for compiles, it uses them for linking
  2936.                 ;;
  2937.             *)
  2938.                 CFLAGS="$CFLAGS -pthread"
  2939.                 CXXFLAGS="$CXXFLAGS -pthread"
  2940.                 ;;
  2941.             esac
  2942.         fi
  2943.     fi
  2944.     rm -f conftest*
  2945.     AC_MSG_RESULT($ac_cv_have_dash_pthread)
  2946.  
  2947.     dnl
  2948.     dnl See if -pthreads is supported.
  2949.     dnl
  2950.     ac_cv_have_dash_pthreads=no
  2951.     if test "$ac_cv_have_dash_pthread" = "no"; then
  2952.         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
  2953.         echo 'int main() { return 0; }' | cat > conftest.c
  2954.         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
  2955.         if test $? -eq 0; then
  2956.             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  2957.                 ac_cv_have_dash_pthreads=yes
  2958.                 CFLAGS="$CFLAGS -pthreads"
  2959.                 CXXFLAGS="$CXXFLAGS -pthreads"
  2960.             fi
  2961.         fi
  2962.         rm -f conftest*
  2963.         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
  2964.     fi
  2965.  
  2966.     case "$target" in
  2967.         *-*-freebsd*)
  2968.             AC_DEFINE(_REENTRANT)
  2969.             AC_DEFINE(_THREAD_SAFE)
  2970.             dnl -pthread links in -lpthread, so don't specify it explicitly.
  2971.             if test "$ac_cv_have_dash_pthread" = "yes"; then
  2972.                 _PTHREAD_LDFLAGS="-pthread"
  2973.             fi
  2974.             ;;
  2975.  
  2976.         *-*-openbsd*|*-*-bsdi*)
  2977.             AC_DEFINE(_REENTRANT)
  2978.             AC_DEFINE(_THREAD_SAFE)
  2979.             dnl -pthread links in -lc_r, so don't specify it explicitly.
  2980.             if test "$ac_cv_have_dash_pthread" = "yes"; then
  2981.                 _PTHREAD_LDFLAGS="-pthread"
  2982.             fi
  2983.             ;;
  2984.  
  2985.         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
  2986.             AC_DEFINE(_REENTRANT)
  2987.             ;;
  2988.  
  2989.         *-aix4.3*|*-aix5*)
  2990.             AC_DEFINE(_REENTRANT)
  2991.             ;;
  2992.  
  2993.         *-hpux11.*)
  2994.             AC_DEFINE(_REENTRANT)
  2995.             ;;
  2996.  
  2997.         *-*-solaris*)
  2998.             AC_DEFINE(_REENTRANT)
  2999.             if test "$SOLARIS_SUNPRO_CC"; then
  3000.                 CFLAGS="$CFLAGS -mt"
  3001.                 CXXFLAGS="$CXXFLAGS -mt"
  3002.             fi
  3003.             ;;
  3004.     esac
  3005.     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
  3006.     AC_SUBST(MOZ_USE_PTHREADS)
  3007. fi
  3008.  
  3009.  
  3010. dnl Checks for library functions.
  3011. dnl ========================================================
  3012. AC_PROG_GCC_TRADITIONAL
  3013. AC_FUNC_MEMCMP
  3014. AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
  3015.  
  3016. dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
  3017. AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
  3018.                ac_cv_clock_monotonic,
  3019.                [for libs in "" -lrt; do
  3020.                     _SAVE_LIBS="$LIBS"
  3021.                     LIBS="$LIBS $libs"
  3022.                     AC_TRY_LINK([#include <time.h>],
  3023.                                  [ struct timespec ts;
  3024.                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
  3025.                                  ac_cv_clock_monotonic=$libs
  3026.                                  LIBS="$_SAVE_LIBS"
  3027.                                  break,
  3028.                                  ac_cv_clock_monotonic=no)
  3029.                     LIBS="$_SAVE_LIBS"
  3030.                 done])
  3031. if test "$ac_cv_clock_monotonic" != "no"; then
  3032.     HAVE_CLOCK_MONOTONIC=1
  3033.     REALTIME_LIBS=$ac_cv_clock_monotonic
  3034.     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
  3035.     AC_SUBST(HAVE_CLOCK_MONOTONIC)
  3036.     AC_SUBST_LIST(REALTIME_LIBS)
  3037. fi
  3038.  
  3039. dnl check for wcrtomb/mbrtowc
  3040. dnl =======================================================================
  3041. if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
  3042. AC_LANG_SAVE
  3043. AC_LANG_CPLUSPLUS
  3044. AC_CACHE_CHECK(for wcrtomb,
  3045.     ac_cv_have_wcrtomb,
  3046.     [AC_TRY_LINK([#include <wchar.h>],
  3047.                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
  3048.                  ac_cv_have_wcrtomb="yes",
  3049.                  ac_cv_have_wcrtomb="no")])
  3050. if test "$ac_cv_have_wcrtomb" = "yes"; then
  3051.     AC_DEFINE(HAVE_WCRTOMB)
  3052. fi
  3053. AC_CACHE_CHECK(for mbrtowc,
  3054.     ac_cv_have_mbrtowc,
  3055.     [AC_TRY_LINK([#include <wchar.h>],
  3056.                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
  3057.                  ac_cv_have_mbrtowc="yes",
  3058.                  ac_cv_have_mbrtowc="no")])
  3059. if test "$ac_cv_have_mbrtowc" = "yes"; then
  3060.     AC_DEFINE(HAVE_MBRTOWC)
  3061. fi
  3062. AC_LANG_RESTORE
  3063. fi
  3064.  
  3065. AC_CACHE_CHECK(
  3066.     [for res_ninit()],
  3067.     ac_cv_func_res_ninit,
  3068.     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
  3069.         dnl no need for res_ninit() on NetBSD and OpenBSD
  3070.         ac_cv_func_res_ninit=no
  3071.      else
  3072.         AC_TRY_LINK([
  3073.             #ifdef linux
  3074.             #define _BSD_SOURCE 1
  3075.             #endif
  3076.             #include <sys/types.h>
  3077.             #include <netinet/in.h>
  3078.             #include <arpa/nameser.h>
  3079.             #include <resolv.h>
  3080.             ],
  3081.             [int foo = res_ninit(&_res);],
  3082.             [ac_cv_func_res_ninit=yes],
  3083.             [ac_cv_func_res_ninit=no])
  3084.      fi
  3085.     ])
  3086.  
  3087. if test "$ac_cv_func_res_ninit" = "yes"; then
  3088.     AC_DEFINE(HAVE_RES_NINIT)
  3089. dnl must add the link line we do something as foolish as this... dougt
  3090. dnl else
  3091. dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
  3092. dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
  3093. fi
  3094.  
  3095. AC_LANG_CPLUSPLUS
  3096.  
  3097. ICONV_LIBS=
  3098.  
  3099. case $target_os in
  3100.     darwin*|mingw*)
  3101.         ;;
  3102.     *)
  3103.  
  3104. AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
  3105.     AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
  3106.         AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
  3107. _SAVE_LIBS=$LIBS
  3108. LIBS="$LIBS $ICONV_LIBS"
  3109. AC_CACHE_CHECK(
  3110.     [for iconv()],
  3111.     ac_cv_func_iconv,
  3112.     [AC_TRY_LINK([
  3113.         #include <stdlib.h>
  3114.         #include <iconv.h>
  3115.         ],
  3116.         [
  3117.             iconv_t h = iconv_open("", "");
  3118.             iconv(h, NULL, NULL, NULL, NULL);
  3119.             iconv_close(h);
  3120.         ],
  3121.         [ac_cv_func_iconv=yes],
  3122.         [ac_cv_func_iconv=no]
  3123.         )]
  3124.     )
  3125. if test "$ac_cv_func_iconv" = "yes"; then
  3126.     AC_DEFINE(HAVE_ICONV)
  3127.     LIBICONV="$ICONV_LIBS"
  3128.     AC_CACHE_CHECK(
  3129.         [for iconv() with const input],
  3130.         ac_cv_func_const_iconv,
  3131.         [AC_TRY_COMPILE([
  3132.             #include <stdlib.h>
  3133.             #include <iconv.h>
  3134.             ],
  3135.             [
  3136.                 const char *input = "testing";
  3137.                 iconv_t h = iconv_open("", "");
  3138.                 iconv(h, &input, NULL, NULL, NULL);
  3139.                 iconv_close(h);
  3140.             ],
  3141.             [ac_cv_func_const_iconv=yes],
  3142.             [ac_cv_func_const_iconv=no]
  3143.             )]
  3144.         )
  3145.     if test "$ac_cv_func_const_iconv" = "yes"; then
  3146.         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
  3147.     fi
  3148. fi
  3149. LIBS=$_SAVE_LIBS
  3150.  
  3151.     ;;
  3152. esac
  3153.  
  3154. AC_SUBST_LIST(ICONV_LIBS)
  3155.  
  3156. AM_LANGINFO_CODESET
  3157.  
  3158. AC_LANG_C
  3159.  
  3160. dnl **********************
  3161. dnl *** va_copy checks ***
  3162. AC_CACHE_CHECK([for an implementation of va_copy()],
  3163.                ac_cv_va_copy,
  3164.     [AC_TRY_COMPILE([#include <stdarg.h>
  3165.                      #include <stdlib.h>
  3166.         void f (int i, ...) {
  3167.             va_list args1, args2;
  3168.             va_start (args1, i);
  3169.             va_copy (args2, args1);
  3170.             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  3171.                 exit (1);
  3172.             va_end (args1); va_end (args2);
  3173.         }],
  3174.         [f(0, 42); return 0],
  3175.         [ac_cv_va_copy=yes],
  3176.         [ac_cv_va_copy=no]
  3177.     )]
  3178. )
  3179. AC_CACHE_CHECK([whether va_list can be copied by value],
  3180.                ac_cv_va_val_copy,
  3181.     [AC_TRY_COMPILE([#include <stdarg.h>
  3182.                      #include <stdlib.h>
  3183.         void f (int i, ...) {
  3184.             va_list args1, args2;
  3185.             va_start (args1, i);
  3186.             args2 = args1;
  3187.             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  3188.                 exit (1);
  3189.             va_end (args1); va_end (args2);
  3190.         }],
  3191.         [f(0, 42); return 0],
  3192.         [ac_cv_va_val_copy=yes],
  3193.         [ac_cv_va_val_copy=no],
  3194.     )]
  3195. )
  3196. if test "x$ac_cv_va_copy" = "xyes"; then
  3197.     AC_DEFINE(VA_COPY, va_copy)
  3198.     AC_DEFINE(HAVE_VA_COPY)
  3199. fi
  3200.  
  3201. if test "x$ac_cv_va_val_copy" = "xno"; then
  3202.    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
  3203. fi
  3204.  
  3205. dnl ===================================================================
  3206. dnl ========================================================
  3207. dnl Put your C++ language/feature checks below
  3208. dnl ========================================================
  3209. AC_LANG_CPLUSPLUS
  3210.  
  3211. ARM_ABI_PREFIX=
  3212. if test "$GNU_CC"; then
  3213.   if test "$CPU_ARCH" = "arm" ; then
  3214.     AC_CACHE_CHECK(for ARM EABI,
  3215.         ac_cv_gcc_arm_eabi,
  3216.         [AC_TRY_COMPILE([],
  3217.                         [
  3218. #if defined(__ARM_EABI__)
  3219.   return 0;
  3220. #else
  3221. #error Not ARM EABI.
  3222. #endif
  3223.                         ],
  3224.                         ac_cv_gcc_arm_eabi="yes",
  3225.                         ac_cv_gcc_arm_eabi="no")])
  3226.     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
  3227.         HAVE_ARM_EABI=1
  3228.         ARM_ABI_PREFIX=eabi-
  3229.     else
  3230.         ARM_ABI_PREFIX=oabi-
  3231.     fi
  3232.   fi
  3233.  
  3234.   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
  3235. fi
  3236.  
  3237. dnl Check to see if we can resolve ambiguity with |using|.
  3238. AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
  3239.                ac_cv_cpp_ambiguity_resolving_using,
  3240.                [AC_TRY_COMPILE(class X {
  3241.                                  public: int go(const X&) {return 3;}
  3242.                                          int jo(const X&) {return 3;}
  3243.                                };
  3244.                                class Y : public X {
  3245.                                  public:  int go(int) {return 2;}
  3246.                                           int jo(int) {return 2;}
  3247.                                           using X::jo;
  3248.                                  private: using X::go;
  3249.                                };,
  3250.                                X x; Y y; y.jo(x);,
  3251.                                ac_cv_cpp_ambiguity_resolving_using=yes,
  3252.                                ac_cv_cpp_ambiguity_resolving_using=no)])
  3253. if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
  3254.    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
  3255. fi
  3256.  
  3257. dnl See if a dynamic_cast to void* gives the most derived object.
  3258. AC_CACHE_CHECK(for C++ dynamic_cast to void*,
  3259.                ac_cv_cpp_dynamic_cast_void_ptr,
  3260.                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
  3261.                             class Y { int j; public: virtual ~Y() { } };
  3262.                             class Z : public X, public Y { int k; };
  3263.  
  3264.                             int main() {
  3265.                                  Z mdo;
  3266.                                  X *subx = (X*)&mdo;
  3267.                                  Y *suby = (Y*)&mdo;
  3268.                                  return !((((void*)&mdo != (void*)subx) &&
  3269.                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
  3270.                                           (((void*)&mdo != (void*)suby) &&
  3271.                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
  3272.                             }],
  3273.                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
  3274.                            ac_cv_cpp_dynamic_cast_void_ptr=no,
  3275.                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
  3276. if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
  3277.    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
  3278. fi
  3279.  
  3280.  
  3281. # try harder, when checking for __thread support, see bug 521750 comment #33 and below
  3282. # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
  3283. # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
  3284. # linking XUL.
  3285. _SAVE_LDFLAGS=$LDFLAGS
  3286. LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
  3287. AC_CACHE_CHECK(for __thread keyword for TLS variables,
  3288.                ac_cv_thread_keyword,
  3289.                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
  3290.                             [return tlsIsMainThread;],
  3291.                             ac_cv_thread_keyword=yes,
  3292.                             ac_cv_thread_keyword=no)])
  3293. LDFLAGS=$_SAVE_LDFLAGS
  3294. # The custom dynamic linker doesn't support TLS variables
  3295. MOZ_TLS=
  3296. if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
  3297.   # mips builds fail with TLS variables because of a binutils bug.
  3298.   # See bug 528687
  3299.   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
  3300.   case "${target}" in
  3301.     mips*-*)
  3302.       :
  3303.       ;;
  3304.     *-android*|*-linuxandroid*)
  3305.       :
  3306.       ;;
  3307.     *-openbsd*)
  3308.       :
  3309.       ;;
  3310.     *)
  3311.       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
  3312.       MOZ_TLS=1
  3313.       ;;
  3314.   esac
  3315. fi
  3316.  
  3317. dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
  3318. if test -n "$MOZ_LINKER"; then
  3319.   if test "$CPU_ARCH" = arm; then
  3320.     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
  3321.     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
  3322.       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  3323.       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  3324.     fi
  3325.   fi
  3326.  
  3327. dnl gold emits wrong sysv-style elf hash tables when building both sysv and
  3328. dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
  3329. dnl Since the linker only understands the sysv ones, no need to build the
  3330. dnl gnu style tables anyways.
  3331.   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
  3332. fi
  3333.  
  3334. dnl The custom linker doesn't support text relocations, but NDK >= r6b
  3335. dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
  3336. dnl We however want to avoid these text relocations, and this can be done
  3337. dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
  3338. dnl doesn't contain anything at all, beside placeholders for some sections,
  3339. dnl and crtbegin only contains a finalizer function that calls
  3340. dnl __cxa_finalize. The custom linker actually takes care of calling
  3341. dnl __cxa_finalize when the library doesn't call it itself, which makes it
  3342. dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
  3343. dnl link crtbegin and crtend at all.
  3344. if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
  3345.   AC_CACHE_CHECK([whether the CRT objects have text relocations],
  3346.     ac_cv_crt_has_text_relocations,
  3347.     [echo 'int foo() { return 0; }' > conftest.cpp
  3348.      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
  3349.         test -s conftest${DLL_SUFFIX}; then
  3350.        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
  3351.          ac_cv_crt_has_text_relocations=yes
  3352.        else
  3353.          ac_cv_crt_has_text_relocations=no
  3354.        fi
  3355.      else
  3356.        AC_ERROR([couldn't compile a simple C file])
  3357.     fi
  3358.     rm -rf conftest*])
  3359.  if test "$ac_cv_crt_has_text_relocations" = yes; then
  3360.    dnl While we want libraries to skip the CRT files, we don't want
  3361.     dnl executables to be treated the same way. We thus set the flag
  3362.     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
  3363.     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
  3364.     dnl Using LDFLAGS in nspr is safe, since we only really build
  3365.     dnl libraries there.
  3366.     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
  3367.     NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
  3368.   fi
  3369. fi
  3370.  
  3371. dnl Check for the existence of various allocation headers/functions
  3372.  
  3373. MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
  3374. MALLOC_H=
  3375.  
  3376. for file in $MALLOC_HEADERS; do
  3377.   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
  3378.   if test "$MALLOC_H" != ""; then
  3379.     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
  3380.     break
  3381.   fi
  3382. done
  3383.  
  3384. MOZ_CHECK_HEADERS(alloca.h)
  3385.  
  3386. AC_CHECK_FUNCS(strndup posix_memalign memalign)
  3387.  
  3388. AC_CHECK_FUNCS(malloc_usable_size)
  3389. MALLOC_USABLE_SIZE_CONST_PTR=const
  3390. MOZ_CHECK_HEADERS([malloc.h], [
  3391.   AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
  3392.   AC_TRY_COMPILE([#include <malloc.h>
  3393.                   #include <stddef.h>
  3394.                   size_t malloc_usable_size(const void *ptr);],
  3395.                   [return malloc_usable_size(0);],
  3396.                   AC_MSG_RESULT([yes]),
  3397.                   AC_MSG_RESULT([no])
  3398.                   MALLOC_USABLE_SIZE_CONST_PTR=)
  3399. ])
  3400. AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
  3401.  
  3402.  
  3403. dnl In newer bionic headers, valloc is built but not defined,
  3404. dnl so we check more carefully here.
  3405. AC_MSG_CHECKING([for valloc in malloc.h])
  3406. AC_EGREP_HEADER(valloc, malloc.h,
  3407.                 AC_DEFINE(HAVE_VALLOC)
  3408.                 AC_MSG_RESULT([yes]),
  3409.                 AC_MSG_RESULT([no]))
  3410.  
  3411. AC_MSG_CHECKING([for valloc in unistd.h])
  3412. AC_EGREP_HEADER(valloc, unistd.h,
  3413.                 AC_DEFINE(HAVE_VALLOC)
  3414.                 AC_MSG_RESULT([yes]),
  3415.                 AC_MSG_RESULT([no]))
  3416.  
  3417. dnl See if compiler supports some gcc-style attributes
  3418.  
  3419. AC_CACHE_CHECK(for __attribute__((always_inline)),
  3420.                ac_cv_attribute_always_inline,
  3421.                [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
  3422.                                [],
  3423.                                ac_cv_attribute_always_inline=yes,
  3424.                                ac_cv_attribute_always_inline=no)])
  3425.  
  3426. AC_CACHE_CHECK(for __attribute__((malloc)),
  3427.                ac_cv_attribute_malloc,
  3428.                [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
  3429.                                [],
  3430.                                ac_cv_attribute_malloc=yes,
  3431.                                ac_cv_attribute_malloc=no)])
  3432.  
  3433. AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
  3434.                ac_cv_attribute_warn_unused,
  3435.                [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
  3436.                                [],
  3437.                                ac_cv_attribute_warn_unused=yes,
  3438.                                ac_cv_attribute_warn_unused=no)])
  3439.  
  3440. dnl End of C++ language/feature checks
  3441. AC_LANG_C
  3442.  
  3443. dnl ========================================================
  3444. dnl =  Internationalization checks
  3445. dnl ========================================================
  3446. dnl
  3447. dnl Internationalization and Locale support is different
  3448. dnl on various UNIX platforms.  Checks for specific i18n
  3449. dnl features go here.
  3450.  
  3451. dnl check for LC_MESSAGES
  3452. AC_CACHE_CHECK(for LC_MESSAGES,
  3453.                ac_cv_i18n_lc_messages,
  3454.                [AC_TRY_COMPILE([#include <locale.h>],
  3455.                                [int category = LC_MESSAGES;],
  3456.                                ac_cv_i18n_lc_messages=yes,
  3457.                                ac_cv_i18n_lc_messages=no)])
  3458. if test "$ac_cv_i18n_lc_messages" = yes; then
  3459.    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
  3460. fi
  3461.  
  3462. AC_HAVE_FUNCS(localeconv)
  3463. fi # ! SKIP_COMPILER_CHECKS
  3464.  
  3465. TARGET_XPCOM_ABI=
  3466. if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
  3467.     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
  3468.     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
  3469. fi
  3470.  
  3471. dnl Mozilla specific options
  3472. dnl ========================================================
  3473. dnl The macros used for command line options
  3474. dnl are defined in build/autoconf/altoptions.m4.
  3475.  
  3476. dnl If the compiler supports these attributes, define them as
  3477. dnl convenience macros.
  3478. if test "$ac_cv_attribute_malloc" = yes ; then
  3479.   AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
  3480. else
  3481.   AC_DEFINE(NS_ATTR_MALLOC,)
  3482. fi
  3483.  
  3484. if test "$ac_cv_attribute_warn_unused" = yes ; then
  3485.   AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
  3486. else
  3487.   AC_DEFINE(NS_WARN_UNUSED_RESULT,)
  3488. fi
  3489.  
  3490. dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
  3491. dnl features that Windows actually does support.
  3492.  
  3493. if test -n "$SKIP_COMPILER_CHECKS"; then
  3494.    dnl Windows has malloc.h
  3495.    AC_DEFINE(MALLOC_H, [<malloc.h>])
  3496.    AC_DEFINE(HAVE_FORCEINLINE)
  3497.    AC_DEFINE(HAVE_LOCALECONV)
  3498. fi # SKIP_COMPILER_CHECKS
  3499.  
  3500. dnl ========================================================
  3501. dnl =
  3502. dnl = Check for external package dependencies
  3503. dnl =
  3504. dnl ========================================================
  3505. MOZ_ARG_HEADER(External Packages)
  3506.  
  3507. MOZ_ARG_WITH_STRING(libxul-sdk,
  3508. [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
  3509.   AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
  3510.  
  3511. LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
  3512. AC_SUBST(LIBXUL_DIST)
  3513.  
  3514. MOZ_CONFIG_NSPR()
  3515.  
  3516. dnl set GRE_MILESTONE
  3517. dnl ========================================================
  3518. if test -n "$LIBXUL_SDK"; then
  3519.     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
  3520. else
  3521.     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
  3522. fi
  3523. AC_SUBST(GRE_MILESTONE)
  3524.  
  3525. # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
  3526. # The logic works like this:
  3527. # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
  3528. # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
  3529. # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
  3530. case "$GRE_MILESTONE" in
  3531.   *a1*)
  3532.       NIGHTLY_BUILD=1
  3533.       AC_DEFINE(NIGHTLY_BUILD)
  3534.       ;;
  3535.   *a*)
  3536.       ;;
  3537.   *)
  3538.       RELEASE_BUILD=1
  3539.       AC_DEFINE(RELEASE_BUILD)
  3540.       ;;
  3541. esac
  3542. AC_SUBST(NIGHTLY_BUILD)
  3543. AC_SUBST(RELEASE_BUILD)
  3544.  
  3545. dnl ========================================================
  3546. dnl Disable compiling sources in unified mode.
  3547. dnl ========================================================
  3548.  
  3549. MOZ_ARG_DISABLE_BOOL(unified-compilation,
  3550. [  --disable-unified-compilation
  3551.                           Disable unified compilation of some C/C++ sources],
  3552.     MOZ_DISABLE_UNIFIED_COMPILATION=1,
  3553.     MOZ_DISABLE_UNIFIED_COMPILATION=)
  3554. AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
  3555.  
  3556. dnl ========================================================
  3557. dnl Multiprocess Firefox Nightly Testing UI
  3558. dnl To be removed in Bug 1003313
  3559. dnl ========================================================
  3560. if test -n "$NIGHTLY_BUILD"; then
  3561.     E10S_TESTING_ONLY=1
  3562.     AC_DEFINE(E10S_TESTING_ONLY)
  3563. fi
  3564.  
  3565. AC_SUBST(E10S_TESTING_ONLY)
  3566.  
  3567. dnl ========================================================
  3568. dnl system libevent Support
  3569. dnl ========================================================
  3570. MOZ_ARG_WITH_STRING(system-libevent,
  3571. [  --with-system-libevent[=PFX]
  3572.                           Use system libevent [installed at prefix PFX]],
  3573.     LIBEVENT_DIR=$withval)
  3574.  
  3575. _SAVE_CFLAGS=$CFLAGS
  3576. _SAVE_LDFLAGS=$LDFLAGS
  3577. _SAVE_LIBS=$LIBS
  3578. if test "$LIBEVENT_DIR" = yes; then
  3579.     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
  3580.         MOZ_NATIVE_LIBEVENT=1,
  3581.         LIBEVENT_DIR=/usr)
  3582. fi
  3583. if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
  3584.     MOZ_NATIVE_LIBEVENT=
  3585. elif test -z "$MOZ_NATIVE_LIBEVENT"; then
  3586.     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
  3587.     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
  3588.     MOZ_CHECK_HEADER(event.h,
  3589.         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
  3590.              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
  3591.          fi],
  3592.         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
  3593.     AC_CHECK_LIB(event, event_init,
  3594.                  [MOZ_NATIVE_LIBEVENT=1
  3595.                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
  3596.                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
  3597.                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
  3598. fi
  3599. CFLAGS=$_SAVE_CFLAGS
  3600. LDFLAGS=$_SAVE_LDFLAGS
  3601. LIBS=$_SAVE_LIBS
  3602.  
  3603. AC_SUBST(MOZ_NATIVE_LIBEVENT)
  3604.  
  3605. dnl ========================================================
  3606. dnl = If NSS was not detected in the system,
  3607. dnl = use the one in the source tree (mozilla/security/nss)
  3608. dnl ========================================================
  3609.  
  3610. MOZ_ARG_WITH_BOOL(system-nss,
  3611. [  --with-system-nss       Use system installed NSS],
  3612.     _USE_SYSTEM_NSS=1 )
  3613.  
  3614. if test -n "$_USE_SYSTEM_NSS"; then
  3615.     AM_PATH_NSS(3.17.4, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
  3616. fi
  3617.  
  3618. if test -n "$MOZ_NATIVE_NSS"; then
  3619.   NSS_LIBS="$NSS_LIBS -lcrmf"
  3620. else
  3621.   NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
  3622.  
  3623.   if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
  3624.       NSS_LIBS="\
  3625.        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
  3626.        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
  3627.        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
  3628.        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
  3629.        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
  3630.   else
  3631.       NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
  3632.   fi
  3633. fi
  3634.  
  3635. dnl ======================
  3636. dnl Detect yasm
  3637. dnl ======================
  3638.  
  3639. AC_MSG_CHECKING([for YASM assembler])
  3640. AC_CHECK_PROGS(YASM, yasm, "")
  3641.  
  3642. if test -n "$YASM"; then
  3643.  dnl Pull out yasm's version string
  3644.   YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
  3645.   _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
  3646.   _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
  3647.   _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
  3648.   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
  3649. fi
  3650.  
  3651. if test -z "$SKIP_LIBRARY_CHECKS"; then
  3652. dnl system JPEG support
  3653. dnl ========================================================
  3654. MOZ_ARG_WITH_STRING(system-jpeg,
  3655. [  --with-system-jpeg[=PFX]
  3656.                           Use system libjpeg [installed at prefix PFX]],
  3657.     JPEG_DIR=$withval)
  3658.  
  3659. _SAVE_CFLAGS=$CFLAGS
  3660. _SAVE_LDFLAGS=$LDFLAGS
  3661. _SAVE_LIBS=$LIBS
  3662. if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
  3663.     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
  3664.     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
  3665. fi
  3666. if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
  3667.     MOZ_NATIVE_JPEG=
  3668. else
  3669.     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
  3670. fi
  3671.  
  3672. if test "$MOZ_NATIVE_JPEG" = 1; then
  3673.     AC_TRY_COMPILE([ #include <stdio.h>
  3674.                      #include <sys/types.h>
  3675.                      #include <jpeglib.h> ],
  3676.                    [ #if JPEG_LIB_VERSION < $MOZJPEG
  3677.                      #error "Insufficient JPEG library version ($MOZJPEG required)."
  3678.                      #endif
  3679.                      #ifndef JCS_EXTENSIONS
  3680.                      #error "libjpeg-turbo JCS_EXTENSIONS required"
  3681.                      #endif
  3682.                      ],
  3683.                    MOZ_NATIVE_JPEG=1,
  3684.                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
  3685. fi
  3686. CFLAGS=$_SAVE_CFLAGS
  3687. LDFLAGS=$_SAVE_LDFLAGS
  3688. LIBS=$_SAVE_LIBS
  3689.  
  3690. if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
  3691.     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
  3692.     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
  3693. fi
  3694. fi # SKIP_LIBRARY_CHECKS
  3695.  
  3696. dnl system ZLIB support
  3697. dnl ========================================================
  3698. MOZ_ZLIB_CHECK([1.2.3])
  3699.  
  3700. if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
  3701.     AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
  3702. fi
  3703.  
  3704. MOZ_PNG_ARM_NEON=
  3705.  
  3706. if test -z "$SKIP_LIBRARY_CHECKS"; then
  3707. dnl system BZIP2 Support
  3708. dnl ========================================================
  3709. MOZ_ARG_WITH_STRING(system-bz2,
  3710. [  --with-system-bz2[=PFX]
  3711.                           Use system libbz2 [installed at prefix PFX]],
  3712.     BZ2_DIR=$withval)
  3713.  
  3714. _SAVE_CFLAGS=$CFLAGS
  3715. _SAVE_LDFLAGS=$LDFLAGS
  3716. _SAVE_LIBS=$LIBS
  3717. if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
  3718.     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
  3719.     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
  3720. fi
  3721. if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
  3722.     MOZ_NATIVE_BZ2=
  3723. else
  3724.     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
  3725.     [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
  3726. fi
  3727. CFLAGS=$_SAVE_CFLAGS
  3728. LDFLAGS=$_SAVE_LDFLAGS
  3729. LIBS=$_SAVE_LIBS
  3730.  
  3731. if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
  3732.     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
  3733.     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
  3734. fi
  3735.  
  3736. dnl ========================================================
  3737. dnl system PNG Support
  3738. dnl ========================================================
  3739. MOZ_ARG_WITH_STRING(system-png,
  3740. [  --with-system-png[=PFX]
  3741.                           Use system libpng [installed at prefix PFX]],
  3742.     PNG_DIR=$withval)
  3743.  
  3744. _SAVE_CFLAGS=$CFLAGS
  3745. _SAVE_LDFLAGS=$LDFLAGS
  3746. _SAVE_LIBS=$LIBS
  3747. if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
  3748.     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
  3749.     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
  3750. fi
  3751. if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
  3752.     MOZ_NATIVE_PNG=
  3753. else
  3754.     AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
  3755.                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
  3756.     AC_CHECK_LIB(png, png_get_acTL, ,
  3757.                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
  3758. fi
  3759. if test "$MOZ_NATIVE_PNG" = 1; then
  3760.    AC_TRY_COMPILE([ #include <stdio.h>
  3761.                     #include <sys/types.h>
  3762.                     #include <png.h> ],
  3763.                   [ #if PNG_LIBPNG_VER < $MOZPNG
  3764.                     #error "Insufficient libpng version ($MOZPNG required)."
  3765.                     #endif
  3766.                     #ifndef PNG_UINT_31_MAX
  3767.                     #error "Insufficient libpng version."
  3768.                     #endif ],
  3769.                   MOZ_NATIVE_PNG=1,
  3770.                   AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
  3771. fi
  3772. CFLAGS=$_SAVE_CFLAGS
  3773. LDFLAGS=$_SAVE_LDFLAGS
  3774. LIBS=$_SAVE_LIBS
  3775.  
  3776. if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
  3777.    MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
  3778.    MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
  3779. fi
  3780.  
  3781. MOZ_PNG_ARM_NEON_CHECK=
  3782. if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
  3783.    MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
  3784.        [  --enable-png-arm-neon-support=TYPE
  3785.             Options include:
  3786.                 no
  3787.                 check (default)
  3788.                 nocheck (faster but unsafe)],
  3789.        [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
  3790.    case "$MOZ_PNG_ARM_NEON_SUPPORT" in
  3791.        no)
  3792.            # enable-png-arm-neon-support = no
  3793.            ;;
  3794.        nocheck)
  3795.            # enable-png-arm-neon-support = nocheck
  3796.            MOZ_PNG_ARM_NEON=1
  3797.            ;;
  3798.        *)
  3799.            MOZ_PNG_ARM_NEON=1
  3800.            MOZ_PNG_ARM_NEON_CHECK=1
  3801.            ;;
  3802.    esac
  3803. fi
  3804.  
  3805. AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
  3806.  
  3807. fi # SKIP_LIBRARY_CHECKS
  3808.  
  3809. AC_SUBST(MOZ_PNG_ARM_NEON)
  3810.  
  3811. dnl ========================================================
  3812. dnl system HunSpell Support
  3813. dnl ========================================================
  3814. MOZ_ARG_ENABLE_BOOL(system-hunspell,
  3815. [  --enable-system-hunspell
  3816.                          Use system hunspell (located with pkgconfig)],
  3817.    MOZ_NATIVE_HUNSPELL=1 )
  3818.  
  3819. if test -n "$MOZ_NATIVE_HUNSPELL"; then
  3820.    PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
  3821. fi
  3822.  
  3823. AC_SUBST(MOZ_NATIVE_HUNSPELL)
  3824.  
  3825. dnl ========================================================
  3826. dnl system libffi Support
  3827. dnl ========================================================
  3828. MOZ_CONFIG_FFI()
  3829.  
  3830. MOZ_ARG_ENABLE_BOOL(shared-js,
  3831. [  --enable-shared-js
  3832.                          Create a shared JavaScript library.],
  3833.    JS_SHARED_LIBRARY=1,
  3834.    JS_SHARED_LIBRARY=)
  3835.  
  3836. dnl ========================================================
  3837. dnl Java SDK support
  3838. dnl ========================================================
  3839.  
  3840. JAVA_BIN_PATH=
  3841. MOZ_ARG_WITH_STRING(java-bin-path,
  3842. [  --with-java-bin-path=dir
  3843.                          Location of Java binaries (java, javac, jar)],
  3844.    JAVA_BIN_PATH=$withval)
  3845.  
  3846. dnl ========================================================
  3847. dnl =
  3848. dnl = Application
  3849. dnl =
  3850. dnl ========================================================
  3851.  
  3852. MOZ_ARG_HEADER(Application)
  3853.  
  3854. ENABLE_TESTS=1
  3855. ENABLE_SYSTEM_EXTENSION_DIRS=1
  3856. MOZ_BRANDING_DIRECTORY=
  3857. MOZ_OFFICIAL_BRANDING=
  3858. MOZ_FEEDS=1
  3859. MOZ_WEBAPP_RUNTIME=
  3860. MOZ_AUTH_EXTENSION=1
  3861. MOZ_RAW=
  3862. MOZ_VORBIS=
  3863. MOZ_TREMOR=
  3864. MOZ_WAVE=1
  3865. MOZ_SAMPLE_TYPE_FLOAT32=
  3866. MOZ_SAMPLE_TYPE_S16=
  3867. MOZ_WEBM=1
  3868. MOZ_GSTREAMER=
  3869. MOZ_DIRECTSHOW=
  3870. MOZ_WMF=
  3871. if test -n "$MOZ_FMP4"; then
  3872.  MOZ_FMP4=1
  3873. else
  3874.  MOZ_FMP4=
  3875. fi
  3876. MOZ_FFMPEG=
  3877. MOZ_WEBRTC=1
  3878. MOZ_PEERCONNECTION=
  3879. MOZ_SRTP=
  3880. MOZ_WEBRTC_SIGNALING=
  3881. MOZ_WEBRTC_ASSERT_ALWAYS=1
  3882. MOZ_WEBRTC_HARDWARE_AEC_NS=
  3883. MOZ_SCTP=
  3884. MOZ_ANDROID_OMX=
  3885. MOZ_MEDIA_NAVIGATOR=
  3886. MOZ_OMX_PLUGIN=
  3887. MOZ_VPX=
  3888. MOZ_VPX_ERROR_CONCEALMENT=
  3889. MOZ_WEBSPEECH=1
  3890. VPX_AS=
  3891. VPX_ASFLAGS=
  3892. VPX_AS_DASH_C_FLAG=
  3893. VPX_AS_CONVERSION=
  3894. VPX_ASM_SUFFIX=
  3895. VPX_X86_ASM=
  3896. VPX_ARM_ASM=
  3897. LIBJPEG_TURBO_AS=
  3898. LIBJPEG_TURBO_ASFLAGS=
  3899. LIBJPEG_TURBO_X86_ASM=
  3900. LIBJPEG_TURBO_X64_ASM=
  3901. LIBJPEG_TURBO_ARM_ASM=
  3902. MOZ_PERMISSIONS=1
  3903. MOZ_PLACES=1
  3904. MOZ_SOCIAL=1
  3905. MOZ_PREF_EXTENSIONS=1
  3906. MOZ_PROFILELOCKING=1
  3907. MOZ_REFLOW_PERF=
  3908. MOZ_SAFE_BROWSING=
  3909. MOZ_HELP_VIEWER=
  3910. MOZ_SPELLCHECK=1
  3911. MOZ_ANDROID_APZ=
  3912. MOZ_TOOLKIT_SEARCH=1
  3913. MOZ_UI_LOCALE=en-US
  3914. MOZ_UNIVERSALCHARDET=1
  3915. MOZ_URL_CLASSIFIER=
  3916. MOZ_XUL=1
  3917. MOZ_ZIPWRITER=1
  3918. NS_PRINTING=1
  3919. MOZ_PDF_PRINTING=
  3920. MOZ_NO_SMART_CARDS=
  3921. NSS_DISABLE_DBM=
  3922. NECKO_COOKIES=1
  3923. NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
  3924. if test -n "$MOZ_RTSP"; then
  3925.  NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
  3926. fi
  3927. USE_ARM_KUSER=
  3928. BUILD_CTYPES=1
  3929. MOZ_USE_NATIVE_POPUP_WINDOWS=
  3930. MOZ_ANDROID_HISTORY=
  3931. MOZ_WEBSMS_BACKEND=
  3932. MOZ_ANDROID_BEAM=
  3933. MOZ_LOCALE_SWITCHER=
  3934. MOZ_ANDROID_SEARCH_ACTIVITY=
  3935. MOZ_ANDROID_DOWNLOADS_INTEGRATION=
  3936. MOZ_ANDROID_MLS_STUMBLER=
  3937. MOZ_ANDROID_SHARE_OVERLAY=
  3938. MOZ_ANDROID_NEW_TABLET_UI=
  3939. ACCESSIBILITY=1
  3940. MOZ_TIME_MANAGER=
  3941. MOZ_PAY=
  3942. MOZ_AUDIO_CHANNEL_MANAGER=
  3943. NSS_NO_LIBPKIX=
  3944. MOZ_CONTENT_SANDBOX=
  3945. MOZ_GMP_SANDBOX=
  3946. MOZ_SANDBOX=1
  3947.  
  3948. case "$target_os" in
  3949.    mingw*)
  3950.        NS_ENABLE_TSF=1
  3951.        AC_DEFINE(NS_ENABLE_TSF)
  3952.        ;;
  3953. esac
  3954.  
  3955. case "${target}" in
  3956.    *-android*|*-linuxandroid*)
  3957.        if test "$CPU_ARCH" = "arm" ; then
  3958.          USE_ARM_KUSER=1
  3959.        fi
  3960.  
  3961.        NSS_DISABLE_DBM=1
  3962.        MOZ_THEME_FASTSTRIPE=1
  3963.        MOZ_TREE_FREETYPE=1
  3964.        MOZ_MEMORY=1
  3965.        MOZ_RAW=1
  3966.        ;;
  3967.  
  3968. esac
  3969.  
  3970. MOZ_ARG_WITH_STRING(external-source-dir,
  3971. [  --with-external-source-dir=dir
  3972.                          External directory containing additional build files.],
  3973. [ EXTERNAL_SOURCE_DIR=$withval])
  3974. AC_SUBST(EXTERNAL_SOURCE_DIR)
  3975.  
  3976. MOZ_ARG_ENABLE_STRING(application,
  3977. [  --enable-application=APP
  3978.                          Options include:
  3979.                            browser (Firefox)
  3980.                            xulrunner
  3981.                            tools/update-packaging (AUS-related packaging tools)],
  3982. [ MOZ_BUILD_APP=$enableval ] )
  3983.  
  3984. MOZ_ARG_WITH_STRING(xulrunner-stub-name,
  3985. [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
  3986.  XULRUNNER_STUB_NAME=$withval)
  3987.  
  3988. if test -z "$XULRUNNER_STUB_NAME"; then
  3989.  XULRUNNER_STUB_NAME=xulrunner-stub
  3990. fi
  3991. AC_SUBST(XULRUNNER_STUB_NAME)
  3992.  
  3993. AC_MSG_CHECKING([for application to build])
  3994. if test -z "$MOZ_BUILD_APP"; then
  3995.  AC_MSG_RESULT([browser])
  3996.  MOZ_BUILD_APP=browser
  3997. else
  3998.  # "mobile" no longer exists.
  3999.  if test "$MOZ_BUILD_APP" = "mobile" ; then
  4000.    AC_MSG_RESULT([none])
  4001.    AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
  4002.  fi
  4003.  # Support comm-central.
  4004.  if test -n "$EXTERNAL_SOURCE_DIR" ; then
  4005.    MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
  4006.    MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
  4007.  fi
  4008.  # We have a valid application only if it has a build.mk file in its top
  4009.  # directory.
  4010.  if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
  4011.    AC_MSG_RESULT([none])
  4012.    AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
  4013.  else
  4014.    AC_MSG_RESULT([$MOZ_BUILD_APP])
  4015.  fi
  4016. fi
  4017.  
  4018. # The app update channel is 'default' when not supplied. The value is used in
  4019. # the application's confvars.sh so it must be set before confvars.sh is called.
  4020. MOZ_ARG_ENABLE_STRING([update-channel],
  4021. [  --enable-update-channel=CHANNEL
  4022.                           Select application update channel (default=default)],
  4023.     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
  4024.  
  4025. if test -z "$MOZ_UPDATE_CHANNEL"; then
  4026.     MOZ_UPDATE_CHANNEL=default
  4027. fi
  4028. AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
  4029. AC_SUBST(MOZ_UPDATE_CHANNEL)
  4030.  
  4031. # Allow to specify a Mozilla API key file that contains the secret key to be
  4032. # used for various Mozilla API requests.
  4033. MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
  4034. [  --with-mozilla-api-keyfile=file   Use the secret key contained in the given keyfile for Mozilla API requests],
  4035.   MOZ_MOZILLA_API_KEY=`cat $withval`)
  4036. if test -z "$MOZ_MOZILLA_API_KEY"; then
  4037.     MOZ_MOZILLA_API_KEY=no-mozilla-api-key
  4038. fi
  4039. AC_SUBST(MOZ_MOZILLA_API_KEY)
  4040.  
  4041. # Allow to specify a Google API key file that contains the secret key to be
  4042. # used for various Google API requests.
  4043. MOZ_ARG_WITH_STRING(google-api-keyfile,
  4044. [  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
  4045.   MOZ_GOOGLE_API_KEY=`cat $withval`)
  4046. if test -z "$MOZ_GOOGLE_API_KEY"; then
  4047.     MOZ_GOOGLE_API_KEY=no-google-api-key
  4048. fi
  4049. AC_SUBST(MOZ_GOOGLE_API_KEY)
  4050.  
  4051. # Allow to specify a Google OAuth API key file that contains the client ID and
  4052. # the secret key to be used for various Google OAuth API requests.
  4053. MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
  4054. [ --with-google-oauth-api-keyfile=file  Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
  4055.  [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
  4056.   MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
  4057. if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
  4058.     MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
  4059.     MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
  4060. fi
  4061. AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
  4062. AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
  4063.  
  4064. # Allow specifying a Bing API key file that contains the client ID and the
  4065. # secret key to be used for the Bing Translation API requests.
  4066. MOZ_ARG_WITH_STRING(bing-api-keyfile,
  4067. [  --with-bing-api-keyfile=file   Use the client id and secret key contained in the given keyfile for Bing API requests],
  4068.  [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
  4069.   MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
  4070. if test -z "$MOZ_BING_API_CLIENTID"; then
  4071.     MOZ_BING_API_CLIENTID=no-bing-api-clientid
  4072.     MOZ_BING_API_KEY=no-bing-api-key
  4073. fi
  4074. AC_SUBST(MOZ_BING_API_CLIENTID)
  4075. AC_SUBST(MOZ_BING_API_KEY)
  4076.  
  4077. # Whether to include optional-but-large font files in the final APK.
  4078. # We want this in mobile/android/confvars.sh, so it goes early.
  4079. MOZ_ARG_DISABLE_BOOL(android-include-fonts,
  4080. [  --disable-android-include-fonts
  4081.                           Disable the inclusion of fonts into the final APK],
  4082.     MOZ_ANDROID_EXCLUDE_FONTS=1)
  4083.  
  4084. if test -n "$MOZ_ANDROID_EXCLUDE_FONTS"; then
  4085.     AC_DEFINE(MOZ_ANDROID_EXCLUDE_FONTS)
  4086. fi
  4087. AC_SUBST(MOZ_ANDROID_EXCLUDE_FONTS)
  4088.  
  4089. # Whether this APK is destined for resource constrained devices.
  4090. # We want this in mobile/android/confvars.sh, so it goes early.
  4091. MOZ_ARG_ENABLE_BOOL(android-resource-constrained,
  4092. [  --enable-android-resource-constrained
  4093.                           Exclude hi-res images and similar from the final APK],
  4094.     MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
  4095.  
  4096. if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
  4097.     AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
  4098. fi
  4099. AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
  4100.  
  4101. # Allow the application to influence configure with a confvars.sh script.
  4102. AC_MSG_CHECKING([if app-specific confvars.sh exists])
  4103. if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
  4104.   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
  4105.   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
  4106. else
  4107.   AC_MSG_RESULT([no])
  4108. fi
  4109.  
  4110. # Allow influencing configure with a defines.sh script.
  4111. . "${srcdir}/build/defines.sh"
  4112.  
  4113. # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
  4114. # set in defines.sh
  4115. if test "$BUILDING_RELEASE"; then
  4116.   # Override value in defines.sh, if any
  4117.   EARLY_BETA_OR_EARLIER=
  4118. elif test "$EARLY_BETA_OR_EARLIER"; then
  4119.   AC_DEFINE(EARLY_BETA_OR_EARLIER)
  4120. fi
  4121. AC_SUBST(EARLY_BETA_OR_EARLIER)
  4122.  
  4123. # Allow the application to provide a subconfigure script
  4124. if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
  4125.   do_output_subdirs() {
  4126.     if test -n "$_subconfigure_subdirs"; then
  4127.       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
  4128.      fi
  4129.     _subconfigure_subdir="$1"
  4130.     _subconfigure_config_args="$ac_configure_args"
  4131.   }
  4132.   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
  4133.   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
  4134.      "${srcdir}/build/autoconf/altoptions.m4" \
  4135.      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
  4136.   . $tmpscript
  4137.   rm -f $tmpscript
  4138. fi
  4139.  
  4140. # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
  4141. MOZ_ARG_WITH_STRING(app-name,
  4142. [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
  4143. WITH_APP_NAME=$withval,
  4144. )
  4145.  
  4146. if test -n "$WITH_APP_NAME" ; then
  4147.     MOZ_APP_NAME="$WITH_APP_NAME"
  4148. fi
  4149.  
  4150. MOZ_ARG_WITH_STRING(app-basename,
  4151. [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
  4152. WITH_APP_BASENAME=$withval,
  4153. )
  4154.  
  4155. if test -n "$WITH_APP_BASENAME" ; then
  4156.     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
  4157. fi
  4158.  
  4159. # Now is a good time to test for logic errors, define mismatches, etc.
  4160. case "$MOZ_BUILD_APP" in
  4161. xulrunner)
  4162.   if test "$LIBXUL_SDK"; then
  4163.     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
  4164.  fi
  4165.  ;;
  4166. esac
  4167.  
  4168. # Special cases where we need to AC_DEFINE something. Also a holdover for apps
  4169. # that haven't made a confvars.sh yet. Don't add new stuff here, use
  4170. # MOZ_BUILD_APP.
  4171. case "$MOZ_BUILD_APP" in
  4172. browser)
  4173.  AC_DEFINE(MOZ_PHOENIX)
  4174.  ;;
  4175.  
  4176. xulrunner)
  4177.  AC_DEFINE(MOZ_XULRUNNER)
  4178.  ;;
  4179. b2g)
  4180.  AC_DEFINE(MOZ_B2G)
  4181.  ;;
  4182. b2g/dev)
  4183.  AC_DEFINE(MOZ_B2G)
  4184.  AC_DEFINE(MOZ_MULET)
  4185.  ;;
  4186. esac
  4187.  
  4188. AC_SUBST(MOZ_BUILD_APP)
  4189. AC_SUBST(MOZ_PHOENIX)
  4190. AC_SUBST(MOZ_XULRUNNER)
  4191. AC_SUBST(MOZ_B2G)
  4192. AC_SUBST(MOZ_MULET)
  4193. AC_SUBST(MOZ_B2G_VERSION)
  4194.  
  4195. AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
  4196.  
  4197. case "$OS_TARGET" in
  4198. WINNT|Darwin|Android)
  4199.  MOZ_FOLD_LIBS=1
  4200.  ;;
  4201. *)
  4202.  MOZ_FOLD_LIBS=
  4203.  ;;
  4204. esac
  4205.  
  4206. dnl ========================================================
  4207. dnl Check Android SDK version depending on mobile target.
  4208. dnl ========================================================
  4209.  
  4210. if test -z "$gonkdir" ; then
  4211.    # Minimum Android SDK API Level we require.
  4212.    case "$MOZ_BUILD_APP" in
  4213.    mobile/android)
  4214.        android_min_api_level=17
  4215.        case "$target" in
  4216.        *-android*|*-linuxandroid*)
  4217.            :
  4218.            ;;
  4219.        *)
  4220.            AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
  4221.            ;;
  4222.        esac
  4223.        ;;
  4224.    esac
  4225.  
  4226.    MOZ_ANDROID_SDK($android_min_api_level)
  4227. fi
  4228.  
  4229. dnl ========================================================
  4230. dnl =
  4231. dnl = Toolkit Options
  4232. dnl =
  4233. dnl ========================================================
  4234. MOZ_ARG_HEADER(Toolkit Options)
  4235.  
  4236.    dnl ========================================================
  4237.    dnl = Select the default toolkit
  4238.    dnl ========================================================
  4239.    MOZ_ARG_ENABLE_STRING(default-toolkit,
  4240.    [  --enable-default-toolkit=TK
  4241.                          Select default toolkit
  4242.                          Platform specific defaults:
  4243.                            Mac OS X - cairo-cocoa
  4244.                            Win32 - cairo-windows
  4245.                            * - cairo-gtk2
  4246.                            * - cairo-gtk3
  4247.                            * - cairo-qt],
  4248.    [ _DEFAULT_TOOLKIT=$enableval ],
  4249.    [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
  4250.  
  4251.    if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
  4252.        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
  4253.        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
  4254.        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
  4255.        -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
  4256.        -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
  4257.        -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
  4258.        -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
  4259.        -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
  4260.    then
  4261.        dnl nglayout only supports building with one toolkit,
  4262.        dnl so ignore everything after the first comma (",").
  4263.        MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
  4264.    else
  4265.        AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
  4266.    fi
  4267.  
  4268. MOZ_ARG_WITHOUT_BOOL(x,
  4269. [  --without-x              Build without X11],
  4270.    WITHOUT_X11=1)
  4271.  
  4272. dnl ========================================================
  4273. dnl = Enable the toolkit as needed                         =
  4274. dnl ========================================================
  4275.  
  4276. MOZ_WIDGET_GTK=
  4277.  
  4278. case "$MOZ_WIDGET_TOOLKIT" in
  4279.  
  4280. cairo-windows)
  4281.    MOZ_WIDGET_TOOLKIT=windows
  4282.    MOZ_PDF_PRINTING=1
  4283.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4284.    if test -n "$GNU_CC"; then
  4285.        MOZ_FOLD_LIBS=
  4286.    fi
  4287.    ;;
  4288.  
  4289. cairo-gtk3)
  4290.    MOZ_WIDGET_TOOLKIT=gtk3
  4291.    MOZ_ENABLE_GTK=1
  4292.    MOZ_ENABLE_GTK3=1
  4293.    MOZ_ENABLE_XREMOTE=1
  4294.    MOZ_GL_DEFAULT_PROVIDER=GLX
  4295.  
  4296.    AC_DEFINE(MOZ_X11)
  4297.    MOZ_X11=1
  4298.    USE_FC_FREETYPE=1
  4299.  
  4300.    TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
  4301.    MOZ_WIDGET_GTK=3
  4302.    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
  4303.    MOZ_PDF_PRINTING=1
  4304.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4305.    ;;
  4306.  
  4307. cairo-gtk2|cairo-gtk2-x11)
  4308.    MOZ_WIDGET_TOOLKIT=gtk2
  4309.    MOZ_ENABLE_GTK=1
  4310.    MOZ_ENABLE_GTK2=1
  4311.    MOZ_ENABLE_XREMOTE=1
  4312.    MOZ_GL_DEFAULT_PROVIDER=GLX
  4313.  
  4314.    AC_DEFINE(MOZ_X11)
  4315.    MOZ_X11=1
  4316.    USE_FC_FREETYPE=1
  4317.  
  4318.    TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
  4319.    TK_LIBS='$(MOZ_GTK2_LIBS)'
  4320.    AC_DEFINE(MOZ_WIDGET_GTK2)
  4321.    MOZ_WIDGET_GTK=2
  4322.    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
  4323.    MOZ_PDF_PRINTING=1
  4324.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4325.    ;;
  4326.  
  4327. cairo-qt)
  4328.    MOZ_WIDGET_TOOLKIT=qt
  4329.    MOZ_ENABLE_QT=1
  4330.    if test -z "$WITHOUT_X11"; then
  4331.      MOZ_ENABLE_XREMOTE=1
  4332.      MOZ_GL_DEFAULT_PROVIDER=GLX
  4333.      MOZ_X11=1
  4334.      AC_DEFINE(MOZ_X11)
  4335.      XT_LIBS=
  4336.    fi
  4337.  
  4338.    USE_FC_FREETYPE=1
  4339.    TK_CFLAGS='$(MOZ_QT_CFLAGS)'
  4340.    TK_LIBS='$(MOZ_QT_LIBS)'
  4341.    AC_DEFINE(MOZ_WIDGET_QT)
  4342.    MOZ_PDF_PRINTING=1
  4343.    AC_DEFINE(QT_NO_KEYWORDS)
  4344.    ;;
  4345.  
  4346. cairo-cocoa)
  4347.    MOZ_WIDGET_TOOLKIT=cocoa
  4348.    AC_DEFINE(MOZ_WIDGET_COCOA)
  4349.    LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
  4350.    # Use -Wl as a trick to avoid -framework and framework names from
  4351.    # being separated by AC_SUBST_LIST.
  4352.    TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL'
  4353.    TK_CFLAGS="-DNO_X11"
  4354.    CFLAGS="$CFLAGS $TK_CFLAGS"
  4355.    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  4356.    MOZ_USER_DIR="Mozilla"
  4357.    MOZ_FS_LAYOUT=bundle
  4358.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4359.    ;;
  4360.  
  4361. cairo-uikit)
  4362.    MOZ_WIDGET_TOOLKIT=uikit
  4363.    AC_DEFINE(MOZ_WIDGET_UIKIT)
  4364.    LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
  4365.    TK_CFLAGS="-DNO_X11"
  4366.    TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
  4367.    CFLAGS="$CFLAGS $TK_CFLAGS"
  4368.    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  4369.    MOZ_USER_DIR="Mozilla"
  4370.    MOZ_FS_LAYOUT=bundle
  4371.    ;;
  4372.  
  4373. cairo-android)
  4374.    AC_DEFINE(MOZ_WIDGET_ANDROID)
  4375.    MOZ_WIDGET_TOOLKIT=android
  4376.    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
  4377.    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
  4378.    MOZ_PDF_PRINTING=1
  4379.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4380.    ;;
  4381.  
  4382. cairo-gonk)
  4383.    AC_DEFINE(MOZ_WIDGET_GONK)
  4384.    AC_DEFINE(MOZ_TOUCH)
  4385.    MOZ_WIDGET_TOOLKIT=gonk
  4386.    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
  4387.    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
  4388.    MOZ_PDF_PRINTING=1
  4389.    MOZ_TOUCH=1
  4390.    MOZ_INSTRUMENT_EVENT_LOOP=1
  4391.    ;;
  4392.  
  4393. esac
  4394.  
  4395. AC_SUBST(MOZ_PDF_PRINTING)
  4396. if test "$MOZ_PDF_PRINTING"; then
  4397.   PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
  4398.   AC_DEFINE(MOZ_PDF_PRINTING)
  4399. fi
  4400.  
  4401. if test "$MOZ_ENABLE_XREMOTE"; then
  4402.    AC_DEFINE(MOZ_ENABLE_XREMOTE)
  4403. fi
  4404.  
  4405. if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
  4406.   AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
  4407. fi
  4408.  
  4409. if test "$COMPILE_ENVIRONMENT"; then
  4410.  if test "$MOZ_ENABLE_GTK3"; then
  4411.    PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 atk-bridge-2.0 $GDK_PACKAGES)
  4412.    MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
  4413.    dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
  4414.    dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
  4415.    dnl for GTK+3 builds.
  4416.    TK_LIBS=$MOZ_GTK3_LIBS
  4417.  fi
  4418.  if test "$MOZ_ENABLE_GTK"; then
  4419.    if test "$MOZ_X11"; then
  4420.      GDK_PACKAGES=gdk-x11-2.0
  4421.    fi
  4422.  
  4423.    PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
  4424.    MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
  4425.  fi
  4426.  
  4427. fi # COMPILE_ENVIRONMENT
  4428.  
  4429. AC_SUBST(MOZ_FS_LAYOUT)
  4430.  
  4431. dnl ========================================================
  4432. dnl Use ARM userspace kernel helpers; tell NSPR to enable
  4433. dnl their usage and use them in spidermonkey.
  4434. dnl ========================================================
  4435. MOZ_ARG_WITH_BOOL(arm-kuser,
  4436. [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
  4437.    USE_ARM_KUSER=1,)
  4438. if test -n "$USE_ARM_KUSER"; then
  4439.   AC_DEFINE(USE_ARM_KUSER)
  4440. fi
  4441.  
  4442. dnl ========================================================
  4443. dnl = startup-notification support module
  4444. dnl ========================================================
  4445.  
  4446. if test "$MOZ_ENABLE_GTK"
  4447. then
  4448.    MOZ_ENABLE_STARTUP_NOTIFICATION=
  4449.  
  4450.    MOZ_ARG_ENABLE_BOOL(startup-notification,
  4451.    [  --enable-startup-notification
  4452.                          Enable startup-notification support (default: disabled) ],
  4453.        MOZ_ENABLE_STARTUP_NOTIFICATION=force,
  4454.        MOZ_ENABLE_STARTUP_NOTIFICATION=)
  4455.    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
  4456.    then
  4457.        PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
  4458.                          libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
  4459.        [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
  4460.            if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
  4461.            then
  4462.                AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
  4463.            fi
  4464.            MOZ_ENABLE_STARTUP_NOTIFICATION=
  4465.        ])
  4466.    fi
  4467.  
  4468.    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
  4469.        AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
  4470.    fi
  4471.  
  4472.    TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
  4473. fi
  4474. AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
  4475.  
  4476. dnl ========================================================
  4477. dnl Disable printing
  4478. dnl ========================================================
  4479. MOZ_ARG_DISABLE_BOOL(printing,
  4480. [  --disable-printing      Disable printing support],
  4481.    NS_PRINTING=,
  4482.    NS_PRINTING=1)
  4483.  
  4484. if test "$NS_PRINTING"; then
  4485.    AC_DEFINE(NS_PRINTING)
  4486.    AC_DEFINE(NS_PRINT_PREVIEW)
  4487. fi
  4488.  
  4489. dnl ========================================================
  4490. dnl = QT support
  4491. dnl ========================================================
  4492. if test "$MOZ_ENABLE_QT"
  4493. then
  4494.    MOZ_ARG_WITH_STRING(qtdir,
  4495.    [  --with-qtdir=\$dir       Specify Qt directory ],
  4496.    [ QTDIR=$withval])
  4497.  
  4498.    if test -z "$QTDIR"; then
  4499.        AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
  4500.    else
  4501.        HOST_QMAKE="$QTDIR/bin/qmake"
  4502.    fi
  4503.    QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
  4504.  
  4505.    if test -z "$QTDIR"; then
  4506.        case $QT_VERSION in
  4507.        5.*)
  4508.            AC_MSG_RESULT("Using qt5: $QT_VERSION")
  4509.            PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
  4510.            [
  4511.              AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
  4512.            ])
  4513.            QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
  4514.            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
  4515.            if test "$NS_PRINTING"; then
  4516.                PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
  4517.                [
  4518.                  AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
  4519.                ])
  4520.                MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
  4521.                MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
  4522.            fi
  4523.            ;;
  4524.        *)
  4525.            AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
  4526.            ;;
  4527.        esac
  4528.  
  4529.        AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
  4530.        AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
  4531.    else
  4532.        MOZ_QT_CFLAGS="-DQT_SHARED"
  4533.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
  4534.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
  4535.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
  4536.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
  4537.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
  4538.        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
  4539.        case $QT_VERSION in
  4540.        5.*)
  4541.            AC_MSG_RESULT("Using qt5: $QT_VERSION")
  4542.            MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
  4543.            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
  4544.            if test "$NS_PRINTING"; then
  4545.                MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
  4546.                MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
  4547.            fi
  4548.            ;;
  4549.        *)
  4550.            AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
  4551.            ;;
  4552.        esac
  4553.  
  4554.        HOST_MOC="$QTDIR/bin/moc"
  4555.        HOST_RCC="$QTDIR/bin/rcc"
  4556.    fi
  4557.    if test -z "$HOST_MOC"; then
  4558.        AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
  4559.    fi
  4560.    if test -z "$HOST_RCC"; then
  4561.        AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
  4562.    fi
  4563.  
  4564.    MOC=$HOST_MOC
  4565.    RCC=$HOST_RCC
  4566.  
  4567.    MOZ_ENABLE_QMSYSTEM2=
  4568.    PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
  4569.                      MOZ_ENABLE_QMSYSTEM2=1,
  4570.                      MOZ_ENABLE_QMSYSTEM2=)
  4571.  
  4572.    if test "$MOZ_ENABLE_QMSYSTEM2"; then
  4573.      MOZ_ENABLE_QMSYSTEM2=1
  4574.      MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
  4575.      MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
  4576.      AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
  4577.    fi
  4578.  
  4579.    MOZ_ENABLE_QTNETWORK=
  4580.    PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
  4581.                      MOZ_ENABLE_QTNETWORK=1,
  4582.                      MOZ_ENABLE_QTNETWORK=)
  4583.  
  4584.    if test "$MOZ_ENABLE_QTNETWORK"; then
  4585.      MOZ_ENABLE_QTNETWORK=1
  4586.      AC_DEFINE(MOZ_ENABLE_QTNETWORK)
  4587.    fi
  4588.  
  4589.    MOZ_ENABLE_QTMOBILITY=
  4590.    PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
  4591.                      MOZ_ENABLE_QTMOBILITY=1,
  4592.                      MOZ_ENABLE_QTMOBILITY=)
  4593.    if test "$MOZ_ENABLE_QTMOBILITY"; then
  4594.       MOZ_ENABLE_QTMOBILITY=1
  4595.       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
  4596.       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
  4597.       AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
  4598.       AC_SUBST(MOZ_ENABLE_QTMOBILITY)
  4599.    else
  4600.       AC_CHECK_LIB(QtSensors, main, [
  4601.          MOZ_ENABLE_QTMOBILITY=1
  4602.          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
  4603.          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
  4604.          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
  4605.          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
  4606.          MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
  4607.       ])
  4608.    fi
  4609.  
  4610.    MOZ_ENABLE_QT5FEEDBACK=
  4611.    PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
  4612.                      MOZ_ENABLE_QT5FEEDBACK=1,
  4613.                      MOZ_ENABLE_QT5FEEDBACK=)
  4614.    if test "$MOZ_ENABLE_QT5FEEDBACK"; then
  4615.       MOZ_ENABLE_QT5FEEDBACK=1
  4616.       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
  4617.       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
  4618.       AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
  4619.       AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
  4620.    fi
  4621.  
  4622.    MOZ_ENABLE_QT5GEOPOSITION=
  4623.    PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
  4624.                      MOZ_ENABLE_QT5GEOPOSITION=1,
  4625.                      MOZ_ENABLE_QT5GEOPOSITION=)
  4626.    if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
  4627.       MOZ_ENABLE_QT5GEOPOSITION=1
  4628.       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
  4629.       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
  4630.       AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
  4631.       AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
  4632.    fi
  4633.  
  4634.    if test "$MOZ_ENABLE_CONTENTACTION"; then
  4635.      MOZ_ENABLE_CONTENTACTION=1
  4636.      AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
  4637.    fi
  4638.  
  4639.    MOZ_ENABLE_CONTENTACTION=
  4640.    PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
  4641.    if test "$MOZ_ENABLE_CONTENTACTION"; then
  4642.       MOZ_ENABLE_CONTENTACTION=1
  4643.       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
  4644.       MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
  4645.       AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
  4646.       AC_SUBST(MOZ_ENABLE_CONTENTACTION)
  4647.    fi
  4648. fi
  4649.  
  4650. AC_SUBST(GTK_CONFIG)
  4651. AC_SUBST_LIST(TK_CFLAGS)
  4652. AC_SUBST_LIST(TK_LIBS)
  4653.  
  4654. AC_SUBST(MOZ_ENABLE_GTK2)
  4655. AC_SUBST(MOZ_ENABLE_GTK3)
  4656. AC_SUBST(MOZ_ENABLE_GTK)
  4657. AC_SUBST(MOZ_ENABLE_QT)
  4658. AC_SUBST(MOZ_ENABLE_QTNETWORK)
  4659. AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
  4660. AC_SUBST(MOZ_ENABLE_QTMOBILITY)
  4661. AC_SUBST(MOZ_ENABLE_XREMOTE)
  4662. AC_SUBST(MOZ_WIDGET_GTK)
  4663. AC_SUBST_LIST(MOZ_QT_CFLAGS)
  4664. AC_SUBST_LIST(MOZ_QT_LIBS)
  4665.  
  4666. AC_SUBST(MOC)
  4667. AC_SUBST(RCC)
  4668.  
  4669. AC_SUBST(MOZ_X11)
  4670.  
  4671. dnl ========================================================
  4672. dnl =
  4673. dnl = Components & Features
  4674. dnl =
  4675. dnl ========================================================
  4676. MOZ_ARG_HEADER(Components and Features)
  4677.  
  4678. dnl ========================================================
  4679. dnl = Localization
  4680. dnl ========================================================
  4681. MOZ_ARG_ENABLE_STRING(ui-locale,
  4682. [  --enable-ui-locale=ab-CD
  4683.                          Select the user interface locale (default: en-US)],
  4684.    MOZ_UI_LOCALE=$enableval )
  4685. AC_SUBST(MOZ_UI_LOCALE)
  4686.  
  4687. dnl ========================================================
  4688. dnl = Trademarked Branding
  4689. dnl ========================================================
  4690. MOZ_ARG_ENABLE_BOOL(official-branding,
  4691. [  --enable-official-branding
  4692.                          Enable Official mozilla.org Branding
  4693.                          Do not distribute builds with
  4694.                          --enable-official-branding unless you have
  4695.                          permission to use trademarks per
  4696.                          http://www.mozilla.org/foundation/trademarks/ .],
  4697. [
  4698.  if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
  4699.    AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
  4700.  else
  4701.    MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
  4702.    MOZ_OFFICIAL_BRANDING=1
  4703.  fi
  4704. ], MOZ_OFFICIAL_BRANDING=)
  4705.  
  4706. AC_SUBST(MOZ_OFFICIAL_BRANDING)
  4707. if test -n "$MOZ_OFFICIAL_BRANDING"; then
  4708.  AC_DEFINE(MOZ_OFFICIAL_BRANDING)
  4709. fi
  4710.  
  4711. MOZ_ARG_WITH_STRING(branding,
  4712. [  --with-branding=dir     Use branding from the specified directory.],
  4713.    MOZ_BRANDING_DIRECTORY=$withval)
  4714.  
  4715. REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
  4716. if test -z "$REAL_BRANDING_DIRECTORY"; then
  4717.  REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
  4718. fi
  4719.  
  4720. if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  4721.  . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
  4722. elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  4723.  . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
  4724. fi
  4725.  
  4726. AC_SUBST(MOZ_BRANDING_DIRECTORY)
  4727.  
  4728. dnl ========================================================
  4729. dnl = Distribution ID
  4730. dnl ========================================================
  4731. MOZ_ARG_WITH_STRING(distribution-id,
  4732. [  --with-distribution-id=ID
  4733.                          Set distribution-specific id (default=org.mozilla)],
  4734. [ val=`echo $withval`
  4735.    MOZ_DISTRIBUTION_ID="$val"])
  4736.  
  4737. if test -z "$MOZ_DISTRIBUTION_ID"; then
  4738.   MOZ_DISTRIBUTION_ID="org.mozilla"
  4739. fi
  4740.  
  4741. AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
  4742. AC_SUBST(MOZ_DISTRIBUTION_ID)
  4743.  
  4744.  
  4745. dnl ========================================================
  4746. dnl Google Play Services, placed here so it can depend on
  4747. dnl values set by configure.sh above.
  4748. dnl ========================================================
  4749.  
  4750. MOZ_ANDROID_GOOGLE_PLAY_SERVICES
  4751.  
  4752.  
  4753. dnl ========================================================
  4754. dnl = Pango
  4755. dnl ========================================================
  4756. if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  4757. then
  4758.    PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
  4759.  
  4760.    PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
  4761. fi
  4762.  
  4763. dnl ========================================================
  4764. dnl = GnomeVFS, GIO and GConf support module
  4765. dnl ========================================================
  4766.  
  4767. if test "$MOZ_X11"
  4768. then
  4769.    dnl build the GIO extension by default only when the
  4770.    dnl GTK2 toolkit is in use.
  4771.    if test "$MOZ_ENABLE_GTK"
  4772.    then
  4773.        MOZ_ENABLE_GIO=1
  4774.        MOZ_ENABLE_GCONF=1
  4775.    fi
  4776.  
  4777.    dnl ========================================================
  4778.    dnl = GnomeVFS support module
  4779.    dnl ========================================================
  4780.    MOZ_ARG_ENABLE_BOOL(gnomevfs,
  4781.    [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
  4782.        MOZ_ENABLE_GNOMEVFS=force,
  4783.        MOZ_ENABLE_GNOMEVFS=)
  4784.  
  4785.    if test "$MOZ_ENABLE_GNOMEVFS"
  4786.    then
  4787.        PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
  4788.            MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
  4789.             MOZ_ENABLE_GNOMEVFS=1
  4790.             AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
  4791.         ],[
  4792.             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
  4793.             then
  4794.                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
  4795.             fi
  4796.             MOZ_ENABLE_GNOMEVFS=
  4797.         ])
  4798.     fi
  4799.  
  4800.     AC_SUBST(MOZ_ENABLE_GNOMEVFS)
  4801.  
  4802.     dnl ========================================================
  4803.     dnl = GIO support module
  4804.     dnl ========================================================
  4805.     MOZ_ARG_DISABLE_BOOL(gio,
  4806.     [  --disable-gio           Disable GIO support],
  4807.         MOZ_ENABLE_GIO=,
  4808.         MOZ_ENABLE_GIO=force)
  4809.  
  4810.     if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
  4811.     then
  4812.         if test "$MOZ_ENABLE_GTK2"
  4813.         then
  4814.             PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
  4815.                               [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
  4816.         fi
  4817.         PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
  4818.             MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
  4819.             MOZ_ENABLE_GIO=1
  4820.             AC_DEFINE(MOZ_ENABLE_GIO)
  4821.         ],[
  4822.             if test "$MOZ_ENABLE_GIO" = "force"
  4823.             then
  4824.                 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
  4825.             fi
  4826.             MOZ_ENABLE_GIO=
  4827.         ])
  4828.     fi
  4829.  
  4830.     AC_SUBST(MOZ_ENABLE_GIO)
  4831.  
  4832.     dnl ========================================================
  4833.     dnl = GConf support module
  4834.     dnl ========================================================
  4835.     MOZ_ARG_DISABLE_BOOL(gconf,
  4836.     [  --disable-gconf      Disable Gconf support ],
  4837.         MOZ_ENABLE_GCONF=,
  4838.         MOZ_ENABLE_GCONF=force)
  4839.  
  4840.     if test "$MOZ_ENABLE_GCONF"
  4841.     then
  4842.         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
  4843.             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
  4844.             MOZ_ENABLE_GCONF=1
  4845.         ],[
  4846.             if test "$MOZ_ENABLE_GCONF" = "force"
  4847.             then
  4848.                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
  4849.             fi
  4850.             MOZ_ENABLE_GCONF=
  4851.         ])
  4852.     fi
  4853.  
  4854.     if test "$MOZ_ENABLE_GCONF"; then
  4855.         AC_DEFINE(MOZ_ENABLE_GCONF)
  4856.     fi
  4857.  
  4858.     AC_SUBST(MOZ_ENABLE_GCONF)
  4859. fi
  4860.  
  4861. dnl ========================================================
  4862. dnl = libproxy support
  4863. dnl ========================================================
  4864.  
  4865. if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  4866. then
  4867.     MOZ_ENABLE_LIBPROXY=
  4868.  
  4869.     MOZ_ARG_ENABLE_BOOL(libproxy,
  4870.     [  --enable-libproxy         Enable libproxy support ],
  4871.     MOZ_ENABLE_LIBPROXY=1,
  4872.     MOZ_ENABLE_LIBPROXY=)
  4873.  
  4874.     if test "$MOZ_ENABLE_LIBPROXY"
  4875.     then
  4876.         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
  4877.         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
  4878.     fi
  4879. fi
  4880. AC_SUBST(MOZ_ENABLE_LIBPROXY)
  4881.  
  4882. dnl ========================================================
  4883. dnl = GNOME component (mozgnome)
  4884. dnl ========================================================
  4885.  
  4886. if test "$MOZ_ENABLE_GTK"
  4887. then
  4888.     MOZ_ENABLE_GNOME_COMPONENT=1
  4889. fi
  4890. AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
  4891.  
  4892. dnl ========================================================
  4893. dnl = libgnomeui support module
  4894. dnl ========================================================
  4895.  
  4896. if test "$MOZ_ENABLE_GTK"
  4897. then
  4898.     MOZ_ARG_ENABLE_BOOL(gnomeui,
  4899.     [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
  4900.         MOZ_ENABLE_GNOMEUI=force,
  4901.         MOZ_ENABLE_GNOMEUI=)
  4902.  
  4903.     if test "$MOZ_ENABLE_GNOMEUI"
  4904.     then
  4905.         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
  4906.         [
  4907.             MOZ_ENABLE_GNOMEUI=1
  4908.         ],[
  4909.             if test "$MOZ_ENABLE_GNOMEUI" = "force"
  4910.             then
  4911.                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
  4912.             fi
  4913.             MOZ_ENABLE_GNOMEUI=
  4914.         ])
  4915.     fi
  4916.  
  4917.     if test "$MOZ_ENABLE_GNOMEUI"; then
  4918.         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
  4919.     fi
  4920. fi
  4921.  
  4922. AC_SUBST(MOZ_ENABLE_GNOMEUI)
  4923.  
  4924. dnl ========================================================
  4925. dnl = dbus support
  4926. dnl ========================================================
  4927.  
  4928. if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  4929. then
  4930.     MOZ_ENABLE_DBUS=1
  4931.  
  4932.     MOZ_ARG_DISABLE_BOOL(dbus,
  4933.     [  --disable-dbus          Disable dbus support ],
  4934.         MOZ_ENABLE_DBUS=,
  4935.         MOZ_ENABLE_DBUS=1)
  4936.  
  4937.     if test "$MOZ_ENABLE_DBUS"
  4938.     then
  4939.         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
  4940.         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
  4941.         AC_DEFINE(MOZ_ENABLE_DBUS)
  4942.     fi
  4943. fi
  4944. AC_SUBST(MOZ_ENABLE_DBUS)
  4945.  
  4946. dnl ========================================================
  4947. dnl = Enable Android History instead of Places
  4948. dnl ========================================================
  4949. if test -n "$MOZ_ANDROID_HISTORY"; then
  4950.     if test -z "$MOZ_PLACES"; then
  4951.         AC_DEFINE(MOZ_ANDROID_HISTORY)
  4952.     else
  4953.         AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
  4954.     fi
  4955. fi
  4956.  
  4957. dnl ========================================================
  4958. dnl = Enable the C++ async pan/zoom code instead of the Java version
  4959. dnl ========================================================
  4960. MOZ_ARG_ENABLE_BOOL(android-apz,
  4961. [  --enable-android-apz      Switch to C++ pan/zoom code],
  4962.     MOZ_ANDROID_APZ=1,
  4963.     MOZ_ANDROID_APZ=)
  4964. if test -n "$MOZ_ANDROID_APZ"; then
  4965.      dnl Do this if defined in confvars.sh
  4966.      AC_DEFINE(MOZ_ANDROID_APZ)
  4967. fi
  4968.  
  4969. dnl ========================================================
  4970. dnl = Disable WebSMS backend
  4971. dnl ========================================================
  4972. MOZ_ARG_DISABLE_BOOL(websms-backend,
  4973. [  --disable-websms-backend
  4974.                            Disable WebSMS backend],
  4975.     MOZ_WEBSMS_BACKEND=,
  4976.     MOZ_WEBSMS_BACKEND=1)
  4977.  
  4978. if test -n "$MOZ_WEBSMS_BACKEND"; then
  4979.     AC_DEFINE(MOZ_WEBSMS_BACKEND)
  4980. fi
  4981.  
  4982. dnl ========================================================
  4983. dnl = Enable runtime locale switching on Android
  4984. dnl ========================================================
  4985. if test -n "$MOZ_LOCALE_SWITCHER"; then
  4986.     AC_DEFINE(MOZ_LOCALE_SWITCHER)
  4987. fi
  4988.  
  4989. dnl ========================================================
  4990. dnl = Enable system download manager on Android
  4991. dnl ========================================================
  4992. if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
  4993.     AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
  4994. fi
  4995.  
  4996. dnl ========================================================
  4997. dnl = Enable NFC permission on Android
  4998. dnl ========================================================
  4999. if test -n "$MOZ_ANDROID_BEAM"; then
  5000.     AC_DEFINE(MOZ_ANDROID_BEAM)
  5001. fi
  5002.  
  5003. dnl ========================================================
  5004. dnl = Include Search Activity on Android
  5005. dnl ========================================================
  5006. if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
  5007.     AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
  5008. fi
  5009.  
  5010. dnl ========================================================
  5011. dnl = Include Mozilla Location Service Stumbler on Android
  5012. dnl ========================================================
  5013. if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
  5014.     AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
  5015. fi
  5016.  
  5017. dnl ========================================================
  5018. dnl = Include share overlay on Android
  5019. dnl ========================================================
  5020. if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
  5021.     AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
  5022. fi
  5023.  
  5024. dnl ========================================================
  5025. dnl = Include New Tablet UI on Android
  5026. dnl = Temporary build flag to allow development in Nightly
  5027. dnl ========================================================
  5028. if test -n "$MOZ_ANDROID_NEW_TABLET_UI"; then
  5029.     AC_DEFINE(MOZ_ANDROID_NEW_TABLET_UI)
  5030. fi
  5031.  
  5032. dnl ========================================================
  5033. dnl = Enable IPDL's "expensive" unit tests
  5034. dnl ========================================================
  5035. MOZ_IPDL_TESTS=
  5036.  
  5037. MOZ_ARG_ENABLE_BOOL(ipdl-tests,
  5038. [  --enable-ipdl-tests     Enable expensive IPDL tests],
  5039.     MOZ_IPDL_TESTS=1,
  5040.     MOZ_IPDL_TESTS=)
  5041.  
  5042. if test -n "$MOZ_IPDL_TESTS"; then
  5043.     AC_DEFINE(MOZ_IPDL_TESTS)
  5044. fi
  5045.  
  5046. AC_SUBST(MOZ_IPDL_TESTS)
  5047.  
  5048. dnl ========================================================
  5049. dnl = Disable building dbm
  5050. dnl ========================================================
  5051. MOZ_ARG_DISABLE_BOOL(dbm,
  5052. [  --disable-dbm           Disable building dbm],
  5053.     NSS_DISABLE_DBM=1,
  5054.     NSS_DISABLE_DBM=)
  5055.  
  5056. dnl ========================================================
  5057. dnl accessibility support on by default on all platforms
  5058. dnl ========================================================
  5059. MOZ_ARG_DISABLE_BOOL(accessibility,
  5060. [  --disable-accessibility Disable accessibility support],
  5061.     ACCESSIBILITY=,
  5062.     ACCESSIBILITY=1 )
  5063. if test "$ACCESSIBILITY"; then
  5064.     case "$target" in
  5065.     *-mingw*)
  5066.         if test -z "$MIDL"; then
  5067.             if test "$GCC" != "yes"; then
  5068.                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
  5069.             else
  5070.                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
  5071.             fi
  5072.         fi
  5073.     esac
  5074.     AC_DEFINE(ACCESSIBILITY)
  5075. fi
  5076.  
  5077. dnl ========================================================
  5078. dnl Accessibility is required for the linuxgl widget
  5079. dnl backend
  5080. dnl ========================================================
  5081. if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
  5082.     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
  5083. fi
  5084.  
  5085. dnl Turn off webrtc for OS's we don't handle yet, but allow
  5086. dnl --enable-webrtc to override.  Can disable for everything in
  5087. dnl the master list above.
  5088. if test -n "$MOZ_WEBRTC"; then
  5089.     case "$target" in
  5090.     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
  5091.         dnl Leave enabled
  5092.         ;;
  5093.     *)
  5094.         dnl default to disabled for all others
  5095.         MOZ_WEBRTC=
  5096.         ;;
  5097.     esac
  5098. fi
  5099.  
  5100. dnl Temporary until webrtc works on gonk-L
  5101. if test -n "$gonkdir" -a "$ANDROID_VERSION" -ge 21; then
  5102.     MOZ_WEBRTC=
  5103. fi
  5104.  
  5105. AC_TRY_COMPILE([#include <linux/ethtool.h>],
  5106.                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
  5107.                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
  5108.  
  5109. AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
  5110.  
  5111. # target_arch is from {ia32|x64|arm|ppc}
  5112. case "$CPU_ARCH" in
  5113. x86_64 | arm | x86 | ppc* | ia64)
  5114.     :
  5115.     ;;
  5116. *)
  5117. # unsupported arch for webrtc
  5118.     MOZ_WEBRTC=
  5119.     ;;
  5120.  
  5121. esac
  5122.  
  5123. dnl ========================================================
  5124. dnl = Disable WebRTC code
  5125. dnl ========================================================
  5126. MOZ_ARG_DISABLE_BOOL(webrtc,
  5127. [  --disable-webrtc        Disable support for WebRTC],
  5128.     MOZ_WEBRTC=,
  5129.     MOZ_WEBRTC=1)
  5130.  
  5131. if test -n "$MOZ_WEBRTC"; then
  5132.     AC_DEFINE(MOZ_WEBRTC)
  5133.     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
  5134.     dnl opt/production builds (via MOZ_CRASH())
  5135.     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
  5136.     MOZ_RAW=1
  5137.     MOZ_VPX=1
  5138.     MOZ_VPX_ERROR_CONCEALMENT=1
  5139.  
  5140. dnl enable once Signaling lands
  5141.     MOZ_WEBRTC_SIGNALING=1
  5142.     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
  5143. dnl enable once PeerConnection lands
  5144.     MOZ_PEERCONNECTION=1
  5145.     AC_DEFINE(MOZ_PEERCONNECTION)
  5146.     MOZ_SCTP=1
  5147.     MOZ_SRTP=1
  5148.     AC_DEFINE(MOZ_SCTP)
  5149.     AC_DEFINE(MOZ_SRTP)
  5150.     if test -n "$MOZ_X11"; then
  5151.       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
  5152.     fi
  5153. else
  5154.     MOZ_SYNTH_PICO=
  5155. fi
  5156.  
  5157. dnl ========================================================
  5158. dnl = Force hardware AEC, disable webrtc.org AEC
  5159. dnl ========================================================
  5160. MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
  5161. [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
  5162.     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
  5163.     MOZ_WEBRTC_HARDWARE_AEC_NS=)
  5164.  
  5165. if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
  5166.     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
  5167. fi
  5168.  
  5169. AC_SUBST(MOZ_WEBRTC)
  5170. AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
  5171. AC_SUBST(MOZ_WEBRTC_SIGNALING)
  5172. AC_SUBST(MOZ_PEERCONNECTION)
  5173. AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
  5174. AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
  5175. AC_SUBST(MOZ_SCTP)
  5176. AC_SUBST(MOZ_SRTP)
  5177. AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
  5178.  
  5179. dnl Use integers over floats for audio on B2G and Android
  5180. dnl (regarless of the CPU architecture, because audio
  5181. dnl backends for those platforms don't support floats. We also
  5182. dnl use integers on ARM with other OS, because it's more efficient.
  5183. if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
  5184.     MOZ_SAMPLE_TYPE_S16=1
  5185.     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
  5186.     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
  5187. else
  5188.     MOZ_SAMPLE_TYPE_FLOAT32=1
  5189.     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
  5190.     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
  5191. fi
  5192.  
  5193. dnl ========================================================
  5194. dnl = Disable Speech API code
  5195. dnl ========================================================
  5196. MOZ_ARG_DISABLE_BOOL(webspeech,
  5197. [  --disable-webspeech        Disable support for HTML Speech API],
  5198.     MOZ_WEBSPEECH=,
  5199.     MOZ_WEBSPEECH=1)
  5200.  
  5201. if test -n "$MOZ_WEBSPEECH"; then
  5202.     AC_DEFINE(MOZ_WEBSPEECH)
  5203. fi
  5204.  
  5205. AC_SUBST(MOZ_WEBSPEECH)
  5206.  
  5207. dnl ========================================================
  5208. dnl = Enable Raw Codecs
  5209. dnl ========================================================
  5210. MOZ_ARG_ENABLE_BOOL(raw,
  5211. [  --enable-raw           Enable support for RAW media],
  5212.     MOZ_RAW=1,
  5213.     MOZ_RAW=)
  5214.  
  5215. if test -n "$MOZ_RAW"; then
  5216.     AC_DEFINE(MOZ_RAW)
  5217. fi
  5218.  
  5219. AC_SUBST(MOZ_RAW)
  5220.  
  5221. dnl Checks for __attribute__(aligned()) directive need by libogg
  5222. AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
  5223.     [ac_cv_c_attribute_aligned],
  5224.     [ac_cv_c_attribute_aligned=0
  5225.      CFLAGS_save="${CFLAGS}"
  5226.      CFLAGS="${CFLAGS} -Werror"
  5227.      for ac_cv_c_attr_align_try in 64 32 16 8; do
  5228.        echo "trying $ac_cv_c_attr_align_try"
  5229.        AC_TRY_COMPILE([],
  5230.                       [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
  5231.                       [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
  5232.        if test "$ac_cv_c_attribute_aligned" != 0; then
  5233.          break;
  5234.        fi
  5235.      done
  5236.        CFLAGS="${CFLAGS_save}"])
  5237. if test "${ac_cv_c_attribute_aligned}" != "0"; then
  5238.   AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
  5239.                      [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
  5240. fi
  5241.  
  5242. dnl ========================================================
  5243. dnl = Disable VP8 decoder support
  5244. dnl ========================================================
  5245. MOZ_ARG_DISABLE_BOOL(webm,
  5246. [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
  5247.     MOZ_WEBM=,
  5248.     MOZ_WEBM=1)
  5249.  
  5250. if test -n "$MOZ_WEBM"; then
  5251.     AC_DEFINE(MOZ_WEBM)
  5252.     MOZ_VPX=1
  5253. fi;
  5254.  
  5255. dnl ========================================================
  5256. dnl = Apple platform decoder support
  5257. dnl ========================================================
  5258. if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
  5259.   MOZ_APPLEMEDIA=1
  5260. fi
  5261.  
  5262. if test -n "$MOZ_APPLEMEDIA"; then
  5263.   AC_DEFINE(MOZ_APPLEMEDIA)
  5264.   # hack in frameworks for fmp4 - see bug 1029974
  5265.   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
  5266.   LDFLAGS="$LDFLAGS -framework AudioToolbox"
  5267.   dnl Verify CoreMedia is available.
  5268.   AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
  5269.     [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
  5270. fi
  5271.  
  5272. dnl ========================================================
  5273. dnl = DirectShow support
  5274. dnl ========================================================
  5275. if test "$OS_ARCH" = "WINNT"; then
  5276.     dnl Enable DirectShow support by default.
  5277.     MOZ_DIRECTSHOW=1
  5278. fi
  5279.  
  5280. MOZ_ARG_DISABLE_BOOL(directshow,
  5281. [  --disable-directshow  Disable support for DirectShow],
  5282.     MOZ_DIRECTSHOW=,
  5283.     MOZ_DIRECTSHOW=1)
  5284.  
  5285. if test -n "$MOZ_DIRECTSHOW"; then
  5286.     AC_DEFINE(MOZ_DIRECTSHOW)
  5287. fi;
  5288.  
  5289. dnl ========================================================
  5290. dnl = Windows Media Foundation support
  5291. dnl ========================================================
  5292. if test "$OS_ARCH" = "WINNT"; then
  5293.     dnl Enable Windows Media Foundation support by default.
  5294.     dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
  5295.     dnl guaranteed to have a recent-enough SDK to build WMF.
  5296.     MOZ_WMF=1
  5297. fi
  5298.  
  5299. MOZ_ARG_DISABLE_BOOL(wmf,
  5300. [  --disable-wmf  Disable support for Windows Media Foundation],
  5301.     MOZ_WMF=,
  5302.     MOZ_WMF=1)
  5303.  
  5304. if test -n "$MOZ_WMF"; then
  5305.     AC_DEFINE(MOZ_WMF)
  5306. fi;
  5307.  
  5308. dnl ========================================================
  5309. dnl FFmpeg H264/AAC Decoding Support
  5310. dnl ========================================================
  5311. case "$OS_TARGET" in
  5312. WINNT|Darwin|Android)
  5313.     ;;
  5314. *)
  5315.     MOZ_FFMPEG=1
  5316.     ;;
  5317. esac
  5318.  
  5319. MOZ_ARG_DISABLE_BOOL(ffmpeg,
  5320. [  --disable-ffmpeg         Disable FFmpeg for fragmented H264/AAC decoding],
  5321.     MOZ_FFMPEG=,
  5322.     MOZ_FFMPEG=1
  5323. )
  5324.  
  5325. if test -n "$MOZ_FFMPEG"; then
  5326.     AC_DEFINE(MOZ_FFMPEG)
  5327. fi;
  5328.  
  5329. dnl ========================================================
  5330. dnl = Built-in fragmented MP4 support.
  5331. dnl ========================================================
  5332.  
  5333. if test "$OS_TARGET" = Android -a -z "$gonkdir"; then
  5334.     MOZ_FMP4=1
  5335. fi
  5336.  
  5337. if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
  5338.     dnl Enable fragmented MP4 parser on Windows by default.
  5339.     dnl We will also need to enable it on other platforms as we implement
  5340.     dnl platform decoder support there too.
  5341.     MOZ_FMP4=1
  5342. fi
  5343.  
  5344. MOZ_ARG_DISABLE_BOOL(fmp4,
  5345. [  --disable-fmp4  Disable support for in built Fragmented MP4 parsing],
  5346.     MOZ_FMP4=,
  5347.     MOZ_FMP4=1)
  5348.  
  5349. if test -n "$MOZ_FMP4"; then
  5350.     AC_DEFINE(MOZ_FMP4)
  5351.     MOZ_EME=1
  5352. fi;
  5353.  
  5354. dnl ========================================================
  5355. dnl = EME support
  5356. dnl ========================================================
  5357.  
  5358. MOZ_ARG_DISABLE_BOOL(eme,
  5359. [  --disable-eme  Disable support for Encrypted Media Extensions],
  5360.     MOZ_EME=,
  5361.     MOZ_EME=1)
  5362.  
  5363. if test -n "$MOZ_EME"; then
  5364.     if test -z "$MOZ_FMP4"; then
  5365.         AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
  5366.     fi
  5367.     AC_DEFINE(MOZ_EME)
  5368. fi;
  5369.  
  5370. dnl ========================================================
  5371. dnl = Enable media plugin support
  5372. dnl ========================================================
  5373. if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  5374.   dnl Enable support on android by default
  5375.   MOZ_ANDROID_OMX=1
  5376. fi
  5377.  
  5378. MOZ_ARG_ENABLE_BOOL(android-omx,
  5379. [  --enable-android-omx  Enable support for Android OMX media backend],
  5380.     MOZ_ANDROID_OMX=1,
  5381.     MOZ_ANDROID_OMX=)
  5382.  
  5383. if test -n "$MOZ_ANDROID_OMX"; then
  5384.   AC_DEFINE(MOZ_ANDROID_OMX)
  5385. fi
  5386.  
  5387. dnl ========================================================
  5388. dnl = Enable getUserMedia support
  5389. dnl ========================================================
  5390. MOZ_ARG_ENABLE_BOOL(media-navigator,
  5391. [  --enable-media-navigator  Enable support for getUserMedia],
  5392.     MOZ_MEDIA_NAVIGATOR=1,
  5393.     MOZ_MEDIA_NAVIGATOR=)
  5394.  
  5395. if test -n "$MOZ_MEDIA_NAVIGATOR"; then
  5396.   AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
  5397. fi
  5398.  
  5399. dnl ========================================================
  5400. dnl = Enable building OMX media plugin (B2G or Android)
  5401. dnl ========================================================
  5402. if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  5403.   dnl Enable support on android by default
  5404.   MOZ_OMX_PLUGIN=1
  5405. fi
  5406.  
  5407. MOZ_ARG_ENABLE_BOOL(omx-plugin,
  5408. [  --enable-omx-plugin      Enable building OMX plugin (B2G)],
  5409.     MOZ_OMX_PLUGIN=1,
  5410.     MOZ_OMX_PLUGIN=)
  5411.  
  5412. if test -n "$MOZ_OMX_PLUGIN"; then
  5413.     if test "$OS_TARGET" = "Android"; then
  5414.         dnl Only allow building OMX plugin on Gonk (B2G) or Android
  5415.         AC_DEFINE(MOZ_OMX_PLUGIN)
  5416.     else
  5417.        dnl fail if we're not building on Gonk or Android
  5418.        AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
  5419.     fi
  5420. fi
  5421.  
  5422. dnl system libvpx Support
  5423. dnl ========================================================
  5424. MOZ_ARG_WITH_BOOL(system-libvpx,
  5425. [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
  5426.     MOZ_NATIVE_LIBVPX=1)
  5427.  
  5428. MOZ_LIBVPX_CFLAGS=
  5429. MOZ_LIBVPX_LIBS=
  5430.  
  5431. if test -n "$MOZ_VPX"; then
  5432.     AC_DEFINE(MOZ_VPX)
  5433.     if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
  5434.         AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
  5435.     fi
  5436.  
  5437.     _SAVE_CFLAGS=$CFLAGS
  5438.     _SAVE_LIBS=$LIBS
  5439.     if test -n "$MOZ_NATIVE_LIBVPX"; then
  5440.         dnl ============================
  5441.         dnl === libvpx Version check ===
  5442.         dnl ============================
  5443.         dnl Check to see if we have a system libvpx package.
  5444.         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
  5445.  
  5446.         CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
  5447.         LIBS="$LIBS $MOZ_LIBVPX_LIBS"
  5448.  
  5449.         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
  5450.          [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
  5451.  
  5452.        AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
  5453.         [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
  5454.  
  5455.        MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
  5456.         [AC_CHECK_FUNC(vpx_mem_set_functions)])
  5457.        if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
  5458.                "$ac_cv_func_vpx_mem_set_functions" = no; then
  5459.            AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
  5460.        fi
  5461.    fi
  5462.    CFLAGS=$_SAVE_CFLAGS
  5463.    LIBS=$_SAVE_LIBS
  5464. fi
  5465.  
  5466. AC_SUBST(MOZ_NATIVE_LIBVPX)
  5467. AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
  5468. AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
  5469.  
  5470. if test "$MOZ_WEBM"; then
  5471.    if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
  5472.        MOZ_VORBIS=1
  5473.    else
  5474.        MOZ_TREMOR=1
  5475.    fi
  5476. fi
  5477.  
  5478. if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
  5479.  
  5480.    dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
  5481.    dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
  5482.    dnl We currently require gcc on all arm platforms.
  5483.    VPX_AS=$YASM
  5484.    VPX_ASM_SUFFIX=asm
  5485.    VPX_NEED_OBJ_INT_EXTRACT=
  5486.  
  5487.    dnl See if we have assembly on this platform.
  5488.    case "$OS_ARCH:$CPU_ARCH" in
  5489.    Darwin:x86)
  5490.      VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
  5491.      VPX_X86_ASM=1
  5492.    ;;
  5493.    Darwin:x86_64)
  5494.      VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
  5495.      VPX_X86_ASM=1
  5496.    ;;
  5497.    WINNT:x86_64)
  5498.      VPX_ASFLAGS="-f x64 -rnasm -pnasm"
  5499.      VPX_X86_ASM=1
  5500.    ;;
  5501.    WINNT:x86)
  5502.      dnl Check for yasm 1.1 or greater.
  5503.      if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
  5504.        AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed.  Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  5505.      elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  5506.        AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  5507.      else
  5508.        VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
  5509.        VPX_X86_ASM=1
  5510.        dnl The encoder needs obj_int_extract to get asm offsets.
  5511.      fi
  5512.    ;;
  5513.    *:arm*)
  5514.      if test -n "$GNU_AS" ; then
  5515.        VPX_AS=$AS
  5516.        dnl These flags are a lie; they're just used to enable the requisite
  5517.         dnl opcodes; actual arch detection is done at runtime.
  5518.         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
  5519.         VPX_DASH_C_FLAG="-c"
  5520.         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
  5521.         VPX_ASM_SUFFIX="$ASM_SUFFIX"
  5522.         VPX_ARM_ASM=1
  5523.       fi
  5524.     ;;
  5525.     *:x86)
  5526.       if $CC -E -dM -</dev/null | grep -q __ELF__; then
  5527.         VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
  5528.         VPX_X86_ASM=1
  5529.       fi
  5530.     ;;
  5531.     *:x86_64)
  5532.       if $CC -E -dM -</dev/null | grep -q __ELF__; then
  5533.         VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
  5534.         VPX_X86_ASM=1
  5535.       fi
  5536.     ;;
  5537.     esac
  5538.  
  5539.     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
  5540.       AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  5541.     fi
  5542.  
  5543.     if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
  5544.       dnl We prefer to get asm offsets using inline assembler, which the above
  5545.       dnl compilers can do. When we're not using one of those, we have to fall
  5546.       dnl back to obj_int_extract, which reads them from a compiled object
  5547.       dnl file. Unfortunately, that only works if we're compiling on a system
  5548.       dnl with the header files for the appropriate object file format.
  5549.       VPX_NEED_OBJ_INT_EXTRACT=1
  5550.     fi
  5551.  
  5552.     if test -n "$VPX_X86_ASM"; then
  5553.       AC_DEFINE(VPX_X86_ASM)
  5554.     elif test -n "$VPX_ARM_ASM"; then
  5555.       AC_DEFINE(VPX_ARM_ASM)
  5556.     else
  5557.       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
  5558.     fi
  5559. fi
  5560.  
  5561. dnl ========================================================
  5562. dnl = Disable Wave decoder support
  5563. dnl ========================================================
  5564. MOZ_ARG_DISABLE_BOOL(wave,
  5565. [  --disable-wave          Disable Wave decoder support],
  5566.     MOZ_WAVE=,
  5567.     MOZ_WAVE=1)
  5568.  
  5569. if test -n "$MOZ_WAVE"; then
  5570.     AC_DEFINE(MOZ_WAVE)
  5571. fi
  5572.  
  5573. dnl ========================================================
  5574. dnl = Handle dependent MEDIA defines
  5575. dnl ========================================================
  5576.  
  5577. if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
  5578.     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
  5579. fi
  5580.  
  5581. if test -n "$MOZ_VORBIS"; then
  5582.     AC_DEFINE(MOZ_VORBIS)
  5583. fi
  5584.  
  5585. if test -n "$MOZ_TREMOR"; then
  5586.     AC_DEFINE(MOZ_TREMOR)
  5587.     # Tremor doesn't have an encoder.
  5588.     MOZ_WEBM_ENCODER=
  5589. fi
  5590.  
  5591. if test -n "$MOZ_WEBM_ENCODER"; then
  5592.     AC_DEFINE(MOZ_WEBM_ENCODER)
  5593. fi
  5594. AC_SUBST(MOZ_WEBM_ENCODER)
  5595.  
  5596. dnl ==================================
  5597. dnl = Check alsa availability on Linux
  5598. dnl ==================================
  5599.  
  5600. dnl If using Linux, ensure that the alsa library is available
  5601. if test "$OS_TARGET" = "Linux"; then
  5602.     MOZ_ALSA=1
  5603. fi
  5604.  
  5605. MOZ_ARG_ENABLE_BOOL(alsa,
  5606. [  --enable-alsa          Enable Alsa support (default on Linux)],
  5607.    MOZ_ALSA=1,
  5608.    MOZ_ALSA=)
  5609.  
  5610. if test -n "$MOZ_ALSA"; then
  5611.     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
  5612.          [echo "$MOZ_ALSA_PKG_ERRORS"
  5613.           AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
  5614. fi
  5615.  
  5616. AC_SUBST(MOZ_ALSA)
  5617.  
  5618. dnl ========================================================
  5619. dnl = Disable PulseAudio
  5620. dnl ========================================================
  5621.  
  5622. dnl If using Linux, ensure that the PA library is available
  5623. case "$OS_TARGET" in
  5624. WINNT|Darwin|Android|OpenBSD)
  5625.     ;;
  5626. *)
  5627.     if test -z "$MOZ_B2G"; then
  5628.         MOZ_PULSEAUDIO=1
  5629.     fi
  5630.     ;;
  5631. esac
  5632.  
  5633. MOZ_ARG_DISABLE_BOOL(pulseaudio,
  5634. [  --disable-pulseaudio          Disable PulseAudio support],
  5635.    MOZ_PULSEAUDIO=,
  5636.    MOZ_PULSEAUDIO=1)
  5637.  
  5638. if test -n "$MOZ_PULSEAUDIO"; then
  5639.     if test -z "$gonkdir"; then
  5640.         PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
  5641.              [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
  5642.               AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
  5643.     else
  5644.         MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
  5645.     fi
  5646. fi
  5647.  
  5648. AC_SUBST(MOZ_PULSEAUDIO)
  5649.  
  5650. dnl ========================================================
  5651. dnl = Enable GStreamer
  5652. dnl ========================================================
  5653. case "$OS_TARGET" in
  5654. WINNT|Darwin|Android)
  5655.     ;;
  5656. *)
  5657.     MOZ_GSTREAMER=1
  5658.     GST_API_VERSION=0.10
  5659.     ;;
  5660. esac
  5661.  
  5662. MOZ_ARG_ENABLE_STRING(gstreamer,
  5663. [  --enable-gstreamer[=0.10]           Enable GStreamer support],
  5664. [ MOZ_GSTREAMER=1
  5665.   # API version, eg 0.10, 1.0 etc
  5666.   if test -z "$enableval" -o "$enableval" = "yes"; then
  5667.     GST_API_VERSION=0.10
  5668.   elif test "$enableval" = "no"; then
  5669.     MOZ_GSTREAMER=
  5670.   else
  5671.     GST_API_VERSION=$enableval
  5672.   fi],
  5673. )
  5674.  
  5675. if test -n "$MOZ_GSTREAMER"; then
  5676.     # core/base release number
  5677.     if test "$GST_API_VERSION" = "1.0"; then
  5678.       GST_VERSION=1.0
  5679.     else
  5680.       GST_VERSION=0.10.25
  5681.     fi
  5682.  
  5683.     PKG_CHECK_MODULES(GSTREAMER,
  5684.                       gstreamer-$GST_API_VERSION >= $GST_VERSION
  5685.                       gstreamer-app-$GST_API_VERSION
  5686.                       gstreamer-plugins-base-$GST_API_VERSION,
  5687.                       [_HAVE_GSTREAMER=1],
  5688.                       [_HAVE_GSTREAMER=])
  5689.     if test -z "$_HAVE_GSTREAMER"; then
  5690.         AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
  5691.     fi
  5692.  
  5693.     _SAVE_LDFLAGS=$LDFLAGS
  5694.     LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
  5695.     AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
  5696.     if test -n "$_HAVE_LIBGSTVIDEO" ; then
  5697.         GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
  5698.     else
  5699.         AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
  5700.     fi
  5701.     LDFLAGS=$_SAVE_LDFLAGS
  5702. fi
  5703.  
  5704. AC_SUBST(MOZ_GSTREAMER)
  5705. AC_SUBST(GST_API_VERSION)
  5706.  
  5707. if test -n "$MOZ_GSTREAMER"; then
  5708.      AC_DEFINE(MOZ_GSTREAMER)
  5709.      AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
  5710. fi
  5711.  
  5712.  
  5713. dnl ========================================================
  5714. dnl Permissions System
  5715. dnl ========================================================
  5716. MOZ_ARG_DISABLE_BOOL(permissions,
  5717. [  --disable-permissions   Disable permissions (popup and cookie blocking)],
  5718.     MOZ_PERMISSIONS=,
  5719.     MOZ_PERMISSIONS=1
  5720. )
  5721.  
  5722. dnl ========================================================
  5723. dnl Child permissions, currently only used for b2g
  5724. dnl ========================================================
  5725. if test -n "$MOZ_B2G"; then
  5726.     if test -n "$MOZ_PERMISSIONS"; then
  5727.         MOZ_CHILD_PERMISSIONS=1
  5728.     else
  5729.         AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
  5730.     fi
  5731. fi
  5732. AC_SUBST(MOZ_CHILD_PERMISSIONS)
  5733.  
  5734. dnl ========================================================
  5735. dnl NegotiateAuth
  5736. dnl ========================================================
  5737. MOZ_ARG_DISABLE_BOOL(negotiateauth,
  5738. [  --disable-negotiateauth Disable GSS-API negotiation ],
  5739.     MOZ_AUTH_EXTENSION=,
  5740.     MOZ_AUTH_EXTENSION=1 )
  5741.  
  5742. dnl ========================================================
  5743. dnl Pref extensions (autoconfig)
  5744. dnl ========================================================
  5745. MOZ_ARG_DISABLE_BOOL(pref-extensions,
  5746. [  --disable-pref-extensions
  5747.                           Disable pref extensions such as autoconfig],
  5748.   MOZ_PREF_EXTENSIONS=,
  5749.   MOZ_PREF_EXTENSIONS=1 )
  5750.  
  5751. dnl ========================================================
  5752. dnl Searching of system directories for extensions.
  5753. dnl Note: this switch is meant to be used for test builds
  5754. dnl whose behavior should not depend on what happens to be
  5755. dnl installed on the local machine.
  5756. dnl ========================================================
  5757. MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
  5758. [  --disable-system-extension-dirs
  5759.                           Disable searching system- and account-global
  5760.                           directories for extensions of any kind; use
  5761.                           only profile-specific extension directories],
  5762.   ENABLE_SYSTEM_EXTENSION_DIRS=,
  5763.   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
  5764. if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
  5765.   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
  5766. fi
  5767.  
  5768. dnl ========================================================
  5769. dnl = Universalchardet
  5770. dnl ========================================================
  5771. MOZ_ARG_DISABLE_BOOL(universalchardet,
  5772. [  --disable-universalchardet
  5773.                           Disable universal encoding detection],
  5774.   MOZ_UNIVERSALCHARDET=,
  5775.   MOZ_UNIVERSALCHARDET=1 )
  5776.  
  5777. if test -n "${JAVA_BIN_PATH}"; then
  5778.   dnl Look for javac and jar in the specified path.
  5779.   JAVA_PATH="$JAVA_BIN_PATH"
  5780. else
  5781.   dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
  5782.   JAVA_PATH="$JAVA_HOME/bin:$PATH"
  5783. fi
  5784.  
  5785. MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
  5786. MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
  5787. MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
  5788. MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
  5789. MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
  5790. MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
  5791.  
  5792. if test -n "${JAVA_BIN_PATH}" -o \
  5793.   \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
  5794.   if test -z "$JAVA" -o "$JAVA" = ":"; then
  5795.     AC_MSG_ERROR([The program java was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5796.   fi
  5797.   if test -z "$JAVAC" -o "$JAVAC" = ":"; then
  5798.     AC_MSG_ERROR([The program javac was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5799.   fi
  5800.   if test -z "$JAVAH" -o "$JAVAH" = ":"; then
  5801.     AC_MSG_ERROR([The program javah was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5802.   fi
  5803.   if test -z "$JAR" -o "$JAR" = ":"; then
  5804.     AC_MSG_ERROR([The program jar was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5805.   fi
  5806.   if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
  5807.     AC_MSG_ERROR([The program jarsigner was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5808.   fi
  5809.   if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
  5810.     AC_MSG_ERROR([The program keytool was not found.  Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
  5811.   fi
  5812.  
  5813.   AC_MSG_CHECKING([for minimum required javac version >= 1.7])
  5814.  
  5815.   dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
  5816.   _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
  5817.  
  5818.   dnl Here, we extract the major (1) and minor (7) version numbers from the
  5819.   dnl acquired version string.
  5820.   _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
  5821.   _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
  5822.  
  5823.   AC_MSG_RESULT([$_javac_version])
  5824.  
  5825.   dnl Fail if we have a version other than 1.7.X
  5826.   if test "$_javac_major_version" -ne "1" -o \
  5827.        \( "$_javac_minor_version" -lt "7" \); then
  5828.       AC_MSG_ERROR([javac 1.7 or higher is required.])
  5829.   fi
  5830. fi
  5831.  
  5832. dnl ========================================================
  5833. dnl = ANGLE OpenGL->D3D translator for WebGL
  5834. dnl = * only applies to win32
  5835. dnl ========================================================
  5836.  
  5837. MOZ_ANGLE_RENDERER=
  5838. MOZ_D3D_CPU_SUFFIX=
  5839. MOZ_HAS_WINSDK_WITH_D3D=
  5840. MOZ_D3DCOMPILER_VISTA_DLL=
  5841. MOZ_D3DCOMPILER_VISTA_DLL_PATH=
  5842. MOZ_DIRECTX_SDK_PATH=
  5843. MOZ_D3DCOMPILER_XP_DLL=
  5844. MOZ_D3DCOMPILER_XP_CAB=
  5845.  
  5846. case "$target_os" in
  5847. *mingw*)
  5848.     MOZ_ANGLE_RENDERER=1
  5849.     ;;
  5850. esac
  5851.  
  5852. # The DirectX SDK libraries are split into x86 and x64 sub-directories
  5853. case "${target_cpu}" in
  5854. i*86)
  5855.   MOZ_D3D_CPU_SUFFIX=x86
  5856.   ;;
  5857. x86_64)
  5858.   MOZ_D3D_CPU_SUFFIX=x64
  5859.   ;;
  5860. esac
  5861.  
  5862. MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
  5863. [  --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
  5864.     MOZ_REQUIRE_ALL_D3DCS=1,
  5865.     MOZ_REQUIRE_ALL_D3DCS=)
  5866.  
  5867. # This is potentially set in external mozconfig files; if it's set,
  5868. # then the build exposes the "webgl" context name, which is reserved
  5869. # for conformant implementations.
  5870. if test -n "$MOZ_WEBGL_CONFORMANT"; then
  5871.   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
  5872. fi
  5873.  
  5874. dnl ========================================================
  5875. dnl D3D compiler DLL
  5876. dnl ========================================================
  5877. MOZ_FOUND_D3D_COMPILERS=
  5878.  
  5879. if test -n "$MOZ_ANGLE_RENDERER"; then
  5880.   if test -z "$MOZ_D3D_CPU_SUFFIX"; then
  5881.     AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
  5882.  fi
  5883.  
  5884.  ######################################
  5885.  # Find _46+ for use by Vista+.
  5886.  
  5887.  # Find a D3D compiler DLL in a Windows SDK.
  5888.  MOZ_D3DCOMPILER_VISTA_DLL=
  5889.  case "$MOZ_WINSDK_MAXVER" in
  5890.  0x0603*)
  5891.    MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
  5892.    AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
  5893.  ;;
  5894.  esac
  5895.  
  5896.  if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
  5897.    # We have a name, now track down the path.
  5898.    if test -n "$WINDOWSSDKDIR"; then
  5899.      MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
  5900.      if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
  5901.        AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
  5902.        MOZ_HAS_WINSDK_WITH_D3D=1
  5903.      else
  5904.        AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
  5905.         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
  5906.         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
  5907.       fi
  5908.     else
  5909.       AC_MSG_RESULT([Windows SDK not found.])
  5910.     fi
  5911.   fi
  5912.  
  5913.   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
  5914.     MOZ_D3DCOMPILER_VISTA_DLL=
  5915.   fi
  5916.  
  5917.   # On mingw, check if headers are provided by toolchain.
  5918.   if test -n "$GNU_CC"; then
  5919.     MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
  5920.   fi
  5921.  
  5922.   ######################################
  5923.   # Find _43 for use by XP.
  5924.  
  5925.   if test "$HAVE_64BIT_BUILD"; then
  5926.     AC_MSG_RESULT([We are building a 64-bit binary, skip checking d3dcompiler_43.])
  5927.   else
  5928.     # Get the SDK path from the registry.
  5929.     # First try to get the June 2010 SDK
  5930.     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
  5931.     if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
  5932.       # Otherwise just take whatever comes first
  5933.       MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
  5934.     fi
  5935.     MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
  5936.  
  5937.     if test -n "$MOZ_DIRECTX_SDK_PATH" &&
  5938.        test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
  5939.       AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
  5940.     else
  5941.       AC_MSG_RESULT([DirectX SDK not found.])
  5942.       MOZ_DIRECTX_SDK_PATH=
  5943.     fi
  5944.  
  5945.     # Check that our DirectX SDK is acceptable.
  5946.     if test -n "$MOZ_DIRECTX_SDK_PATH"; then
  5947.       if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
  5948.         AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
  5949.         MOZ_DIRECTX_SDK_PATH=
  5950.       fi
  5951.     fi
  5952.  
  5953.     if test -n "$MOZ_DIRECTX_SDK_PATH"; then
  5954.       # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
  5955.       # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
  5956.       MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
  5957.  
  5958.       if test -n "$MOZ_D3DX9_VERSION" ; then
  5959.         MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
  5960.  
  5961.         if test -n "$MOZ_D3DCOMPILER_XP_CAB"; then
  5962.           MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
  5963.         else
  5964.           AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
  5965.          AC_MSG_ERROR([DirectX SDK at "$MOZ_DIRECTX_SDK_PATH" appears broken.])
  5966.          MOZ_DIRECTX_SDK_PATH=
  5967.        fi
  5968.      else
  5969.        AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
  5970.         MOZ_DIRECTX_SDK_PATH=
  5971.       fi
  5972.     else
  5973.       AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
  5974.      AC_MSG_RESULT([  Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
  5975.    fi
  5976.  fi
  5977.  
  5978.  ######################################
  5979.  # Check that we found what we needed.
  5980.  MOZ_FOUND_A_D3D_COMPILER=
  5981.  MOZ_FOUND_BOTH_D3D_COMPILERS=1
  5982.  
  5983.  if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
  5984.    MOZ_FOUND_A_D3D_COMPILER=1
  5985.    AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
  5986.  else
  5987.    MOZ_FOUND_BOTH_D3D_COMPILERS=
  5988.  fi
  5989.  
  5990.  if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
  5991.    MOZ_FOUND_A_D3D_COMPILER=1
  5992.    AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
  5993.  else
  5994.    MOZ_FOUND_BOTH_D3D_COMPILERS=
  5995.  fi
  5996.  
  5997.  if test -z "$CROSS_COMPILE"; then
  5998.    if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
  5999.      AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
  6000.       AC_MSG_ERROR([  Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
  6001.     fi
  6002.  
  6003.     if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
  6004.       AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
  6005.       AC_MSG_ERROR([  Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
  6006.     fi
  6007.   fi
  6008. fi
  6009.  
  6010.  
  6011. dnl ========================================================
  6012. dnl Gamepad support
  6013. dnl ========================================================
  6014. MOZ_GAMEPAD=
  6015. MOZ_GAMEPAD_BACKEND=stub
  6016.  
  6017. # Gamepad DOM is built on supported platforms by default.
  6018. case "$OS_TARGET" in
  6019.      Darwin|WINNT|Linux)
  6020.        MOZ_GAMEPAD=1
  6021.        ;;
  6022.      Android)
  6023.        if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
  6024.          MOZ_GAMEPAD=1
  6025.        fi
  6026.        ;;
  6027.      *)
  6028.        ;;
  6029. esac
  6030.  
  6031. MOZ_ARG_DISABLE_BOOL(gamepad,
  6032. [  --disable-gamepad   Disable gamepad support],
  6033.     MOZ_GAMEPAD=,
  6034.     MOZ_GAMEPAD=1)
  6035.  
  6036. if test "$MOZ_GAMEPAD"; then
  6037.     case "$OS_TARGET" in
  6038.     Darwin)
  6039.         MOZ_GAMEPAD_BACKEND=cocoa
  6040.         ;;
  6041.     WINNT)
  6042.         MOZ_GAMEPAD_BACKEND=windows
  6043.         ;;
  6044.     Linux)
  6045.         MOZ_CHECK_HEADER([linux/joystick.h])
  6046.         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
  6047.           AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
  6048.        fi
  6049.        MOZ_GAMEPAD_BACKEND=linux
  6050.        ;;
  6051.    Android)
  6052.        MOZ_GAMEPAD_BACKEND=android
  6053.        ;;
  6054.    *)
  6055.        ;;
  6056.   esac
  6057.  
  6058.  AC_DEFINE(MOZ_GAMEPAD)
  6059. fi
  6060. AC_SUBST(MOZ_GAMEPAD)
  6061. AC_SUBST(MOZ_GAMEPAD_BACKEND)
  6062.  
  6063. dnl ========================================================
  6064. dnl = Breakpad crash reporting (on by default on supported platforms)
  6065. dnl ========================================================
  6066.  
  6067. case $target in
  6068. i?86-*-mingw*|x86_64-*-mingw*)
  6069.  MOZ_CRASHREPORTER=1
  6070.  ;;
  6071. i?86-apple-darwin*|x86_64-apple-darwin*)
  6072.  MOZ_CRASHREPORTER=1
  6073.  ;;
  6074. i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
  6075.  if test "$MOZ_ENABLE_GTK"; then
  6076.    MOZ_CRASHREPORTER=1
  6077.  fi
  6078.  ;;
  6079. *-android*|*-linuxandroid*)
  6080.  MOZ_CRASHREPORTER=1
  6081.  ;;
  6082. *solaris*)
  6083.  MOZ_CRASHREPORTER=1
  6084.  ;;
  6085. esac
  6086.  
  6087. MOZ_ARG_DISABLE_BOOL(crashreporter,
  6088. [  --disable-crashreporter Disable breakpad crash reporting],
  6089.    [MOZ_CRASHREPORTER=],
  6090.    [MOZ_CRASHREPORTER=F # Force enable breakpad])
  6091.  
  6092. if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
  6093.  if test "$MOZ_CRASHREPORTER" = F; then
  6094.    AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
  6095.  fi
  6096.  MOZ_CRASHREPORTER=
  6097. fi
  6098.  
  6099. if test -n "$MOZ_CRASHREPORTER"; then
  6100.   AC_DEFINE(MOZ_CRASHREPORTER)
  6101.  
  6102.  if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
  6103.    test -z "$SKIP_LIBRARY_CHECKS"; then
  6104.    PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
  6105.  fi
  6106.  
  6107.  if test "$OS_ARCH" = "WINNT"; then
  6108.    if test -z "$HAVE_64BIT_BUILD"; then
  6109.      MOZ_CRASHREPORTER_INJECTOR=1
  6110.      AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
  6111.    fi
  6112.  fi
  6113. fi
  6114.  
  6115. MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
  6116. [  --with-crashreporter-enable-percent=NN
  6117.                          Enable sending crash reports by default on NN% of users. (default=100)],
  6118. [ val=`echo $withval | sed 's/[^0-9]//g'`
  6119.     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
  6120.  
  6121. if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
  6122.    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
  6123. fi
  6124. AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
  6125.  
  6126. dnl ========================================================
  6127. dnl = libjpeg-turbo configuration
  6128. dnl ========================================================
  6129. MOZ_LIBJPEG_TURBO=
  6130. if test -z "$MOZ_NATIVE_JPEG"; then
  6131.     MOZ_LIBJPEG_TURBO=1
  6132. fi
  6133.  
  6134. MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
  6135. [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
  6136.     MOZ_LIBJPEG_TURBO=,
  6137.     MOZ_LIBJPEG_TURBO=1)
  6138.  
  6139. if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
  6140.     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
  6141. fi
  6142.  
  6143. dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
  6144. dnl files.
  6145.  
  6146. if test -n "$MOZ_LIBJPEG_TURBO"; then
  6147.  
  6148.   dnl Do we support libjpeg-turbo on this platform?
  6149.   case "$OS_ARCH:$OS_TEST" in
  6150.   Darwin:i?86)
  6151.     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
  6152.     LIBJPEG_TURBO_X86_ASM=1
  6153.   ;;
  6154.   Darwin:x86_64)
  6155.     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
  6156.     LIBJPEG_TURBO_X64_ASM=1
  6157.   ;;
  6158.   WINNT:x86|WINNT:i?86)
  6159.     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
  6160.     LIBJPEG_TURBO_X86_ASM=1
  6161.   ;;
  6162.   WINNT:x86_64)
  6163.     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
  6164.     LIBJPEG_TURBO_X64_ASM=1
  6165.   ;;
  6166.   *:arm*)
  6167.     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
  6168.     LIBJPEG_TURBO_ARM_ASM=1
  6169.   ;;
  6170.   *:x86|*:i?86)
  6171.     if $CC -E -dM -</dev/null | grep -q __ELF__; then
  6172.       LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
  6173.       LIBJPEG_TURBO_X86_ASM=1
  6174.     fi
  6175.   ;;
  6176.   *:x86_64)
  6177.     if $CC -E -dM -</dev/null | grep -q __ELF__; then
  6178.       LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
  6179.       LIBJPEG_TURBO_X64_ASM=1
  6180.     fi
  6181.   ;;
  6182.   esac
  6183.  
  6184. fi
  6185.  
  6186. dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
  6187. dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
  6188. dnl it doesn't exist or we have too old of a version.
  6189. if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
  6190.     LIBJPEG_TURBO_AS=$YASM
  6191.  
  6192.     if test -z "$LIBJPEG_TURBO_AS" ; then
  6193.         AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  6194.    fi
  6195.  
  6196.    dnl Check that we have the right yasm version.  We require 1.0.1 or newer
  6197.    dnl on Linux and 1.1 or newer everywhere else.
  6198.    if test "$OS_ARCH" = "Linux" ; then
  6199.        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
  6200.            AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  6201.         fi
  6202.     else
  6203.         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  6204.             AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  6205.        fi
  6206.    fi
  6207. fi
  6208.  
  6209. dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
  6210. dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
  6211. if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
  6212.     echo "Using $AS as the assembler for ARM code."
  6213.     LIBJPEG_TURBO_AS=$AS
  6214. fi
  6215.  
  6216. if test -n "$LIBJPEG_TURBO_X86_ASM"; then
  6217.     AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
  6218. elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
  6219.     AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
  6220. elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
  6221.     AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
  6222. elif test -n "$MOZ_LIBJPEG_TURBO"; then
  6223.     dnl Warn if we're not building the optimized routines, even though the user
  6224.     dnl didn't specify --disable-libjpeg-turbo.
  6225.     AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
  6226. fi
  6227.  
  6228. dnl ========================================================
  6229. dnl = Enable compilation of specific extension modules
  6230. dnl ========================================================
  6231.  
  6232. MOZ_ARG_ENABLE_STRING(extensions,
  6233. [  --enable-extensions     Enable extensions],
  6234. [ for option in `echo $enableval | sed 's/,/ /g'`; do
  6235.     if test "$option" = "yes" -o "$option" = "all"; then
  6236.         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
  6237.     elif test "$option" = "no" -o "$option" = "none"; then
  6238.         MOZ_EXTENSIONS=""
  6239.     elif test "$option" = "default"; then
  6240.         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
  6241.     elif test `echo "$option" | grep -c \^-` != 0; then
  6242.         option=`echo $option | sed 's/^-//'`
  6243.         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
  6244.     else
  6245.         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
  6246.     fi
  6247. done],
  6248.     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
  6249.  
  6250. if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
  6251.     # Suppress warning on non-X11 platforms
  6252.     if test -n "$MOZ_X11"; then
  6253.         AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
  6254.     fi
  6255.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
  6256. fi
  6257.  
  6258. dnl Do not build gnomevfs with libxul based apps
  6259. if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
  6260.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
  6261. fi
  6262.  
  6263. if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  6264.     # Suppress warning on non-X11 platforms
  6265.     if test -n "$MOZ_X11"; then
  6266.         AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
  6267.     fi
  6268.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  6269. fi
  6270.  
  6271. dnl Do not build gio with libxul based apps
  6272. if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  6273.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  6274. fi
  6275.  
  6276. if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  6277.     MOZ_GIO_COMPONENT=1
  6278.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  6279. fi
  6280. AC_SUBST(MOZ_GIO_COMPONENT)
  6281.  
  6282. dnl Remove dupes
  6283. MOZ_EXTENSIONS=`$PYTHON ${srcdir}/build/unix/uniq.py ${MOZ_EXTENSIONS}`
  6284.  
  6285. dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
  6286. dnl when trying to build a nonexistent extension.
  6287. for extension in $MOZ_EXTENSIONS; do
  6288.     if test ! -d "${srcdir}/extensions/${extension}"; then
  6289.         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
  6290.     fi
  6291. done
  6292.  
  6293. if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
  6294.   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
  6295. fi
  6296.  
  6297. dnl ========================================================
  6298. dnl Build Freetype in the tree
  6299. dnl ========================================================
  6300. MOZ_ARG_ENABLE_BOOL(tree-freetype,
  6301. [  --enable-tree-freetype  Enable Tree FreeType],
  6302.     MOZ_TREE_FREETYPE=1,
  6303.     MOZ_TREE_FREETYPE= )
  6304. if test -n "$MOZ_TREE_FREETYPE"; then
  6305.    if test -n "$_WIN32_MSVC"; then
  6306.       AC_ERROR("building with in-tree freetype is not supported on MSVC")
  6307.    fi
  6308.    AC_DEFINE(MOZ_TREE_FREETYPE)
  6309.    AC_SUBST(MOZ_TREE_FREETYPE)
  6310.    MOZ_ENABLE_CAIRO_FT=1
  6311.    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  6312.    FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
  6313.    CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
  6314.    CAIRO_FT_OSLIBS=''
  6315.    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
  6316.    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
  6317.    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
  6318.    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
  6319. fi
  6320.  
  6321. dnl ========================================================
  6322. dnl Installer
  6323. dnl ========================================================
  6324. dnl Abort Windows build if the required major version and
  6325. dnl minimum minor version of Unicode NSIS isn't in the path
  6326. dnl (unless in case of cross compiling, for which Unicode
  6327. dnl is not yet sufficient).
  6328. if test "$OS_ARCH" = "WINNT"; then
  6329.     MIN_NSIS_MAJOR_VER=2
  6330.     MIN_NSIS_MINOR_VER=46
  6331.     MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
  6332.     if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
  6333.       AC_MSG_RESULT([yes])
  6334.       MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
  6335.       changequote(,)
  6336.       MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
  6337.       changequote([,])
  6338.       if test "$MAKENSISU_PARSED_VER" = ""; then
  6339.           changequote(,)
  6340.           MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
  6341.           changequote([,])
  6342.       fi
  6343.       MAKENSISU_MAJOR_VER=0
  6344.       MAKENSISU_MINOR_VER=0
  6345.       if test ! "$MAKENSISU_PARSED_VER" = ""; then
  6346.           MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
  6347.           MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
  6348.       fi
  6349.       AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
  6350.       if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
  6351.               "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
  6352.          test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
  6353.           AC_MSG_RESULT([yes])
  6354.       else
  6355.           AC_MSG_RESULT([no])
  6356.           if test -z "$CROSS_COMPILE"; then
  6357.             AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
  6358.           else
  6359.             MAKENSISU=
  6360.           fi
  6361.       fi
  6362.     elif test -z "$CROSS_COMPILE"; then
  6363.       AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
  6364.     else
  6365.       MAKENSISU=
  6366.     fi
  6367. fi
  6368.  
  6369. dnl ========================================================
  6370. dnl Web App Runtime
  6371. dnl ========================================================
  6372. MOZ_ARG_DISABLE_BOOL(webapp-runtime,
  6373. [  --disable-webapp-runtime  Disable Web App Runtime],
  6374.     MOZ_WEBAPP_RUNTIME=,
  6375.     MOZ_WEBAPP_RUNTIME=1)
  6376. if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a -z "$MOZ_WIDGET_GTK" ; then
  6377.     MOZ_WEBAPP_RUNTIME=
  6378. fi
  6379. if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
  6380.     MOZ_WEBAPP_RUNTIME=
  6381. fi
  6382. AC_SUBST(MOZ_WEBAPP_RUNTIME)
  6383. if test "$MOZ_WEBAPP_RUNTIME"; then
  6384.     AC_DEFINE(MOZ_WEBAPP_RUNTIME)
  6385. fi
  6386.  
  6387. AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
  6388. if test -z "$TAR"; then
  6389.     AC_MSG_ERROR([no tar archiver found in \$PATH])
  6390. fi
  6391. AC_SUBST(TAR)
  6392.  
  6393. AC_CHECK_PROGS(WGET, wget, "")
  6394. AC_SUBST(WGET)
  6395.  
  6396. dnl ========================================================
  6397. dnl Signing
  6398. dnl ========================================================
  6399.  
  6400. if test -n "$MOZ_SIGN_CMD"; then
  6401.     AC_DEFINE(MOZ_SIGNING)
  6402. fi
  6403.  
  6404. dnl ========================================================
  6405. dnl Maintenance Service
  6406. dnl ========================================================
  6407.  
  6408. MOZ_ARG_ENABLE_BOOL(maintenance-service,
  6409. [  --enable-maintenance-service       Enable building of maintenanceservice],
  6410.     MOZ_MAINTENANCE_SERVICE=1,
  6411.     MOZ_MAINTENANCE_SERVICE= )
  6412.  
  6413. if test -n "$MOZ_MAINTENANCE_SERVICE"; then
  6414.   if test "$OS_ARCH" = "WINNT"; then
  6415.     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
  6416.   else
  6417.     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
  6418.   fi
  6419. fi
  6420.  
  6421. dnl ========================================================
  6422. dnl Bundled fonts on desktop platforms
  6423. dnl ========================================================
  6424.  
  6425. MOZ_ARG_ENABLE_BOOL(bundled-fonts,
  6426. [  --enable-bundled-fonts  Enable support for bundled fonts on desktop platforms],
  6427.     MOZ_BUNDLED_FONTS=1,
  6428.     MOZ_BUNDLED_FONTS=)
  6429.  
  6430. if test -n "$MOZ_BUNDLED_FONTS"; then
  6431.   AC_DEFINE(MOZ_BUNDLED_FONTS)
  6432. fi
  6433.  
  6434. dnl ========================================================
  6435. dnl Verify MAR signatures
  6436. dnl ========================================================
  6437.  
  6438. MOZ_ARG_ENABLE_BOOL(verify-mar,
  6439. [  --enable-verify-mar     Enable verifying MAR signatures],
  6440.     MOZ_VERIFY_MAR_SIGNATURE=1,
  6441.     MOZ_VERIFY_MAR_SIGNATURE= )
  6442.  
  6443. if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
  6444.   if test "$OS_ARCH" = "WINNT"; then
  6445.     AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
  6446.   else
  6447.     AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
  6448.   fi
  6449. fi
  6450.  
  6451. dnl ========================================================
  6452. dnl Enable building the signmar program.
  6453. dnl This option is much different than the --enable-verify-mar option.
  6454. dnl --enable-verify-mar is for enabling the verification check on MAR
  6455. dnl files in the updater.  The --enable-signmar option is for building
  6456. dnl the signmar program.
  6457. dnl ========================================================
  6458.  
  6459. MOZ_ARG_ENABLE_BOOL(signmar,
  6460. [  --enable-signmar     Enable building the signmar program],
  6461.     MOZ_ENABLE_SIGNMAR=1,
  6462.     MOZ_ENABLE_SIGNMAR= )
  6463.  
  6464. if test -n "$MOZ_ENABLE_SIGNMAR"; then
  6465.   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
  6466. fi
  6467.  
  6468. dnl ========================================================
  6469. dnl Updater
  6470. dnl ========================================================
  6471.  
  6472. MOZ_ARG_DISABLE_BOOL(updater,
  6473. [  --disable-updater       Disable building of updater],
  6474.     MOZ_UPDATER=,
  6475.     MOZ_UPDATER=1 )
  6476.  
  6477. if test -n "$MOZ_UPDATER"; then
  6478.     AC_DEFINE(MOZ_UPDATER)
  6479. fi
  6480.  
  6481. # tools/update-packaging is not checked out by default.
  6482. MOZ_ARG_ENABLE_BOOL(update-packaging,
  6483. [  --enable-update-packaging
  6484.                           Enable tools/update-packaging],
  6485.     MOZ_UPDATE_PACKAGING=1,
  6486.     MOZ_UPDATE_PACKAGING= )
  6487. AC_SUBST(MOZ_UPDATE_PACKAGING)
  6488.  
  6489. dnl ========================================================
  6490. dnl build the tests by default
  6491. dnl ========================================================
  6492. MOZ_ARG_DISABLE_BOOL(tests,
  6493. [  --disable-tests         Do not build test libraries & programs],
  6494.     ENABLE_TESTS=,
  6495.     ENABLE_TESTS=1 )
  6496.  
  6497. if test -n "$ENABLE_TESTS"; then
  6498.     GTEST_HAS_RTTI=0
  6499.     AC_DEFINE(ENABLE_TESTS)
  6500.     AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
  6501.     AC_SUBST(GTEST_HAS_RTTI)
  6502.     if test -n "$_WIN32_MSVC"; then
  6503.           AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
  6504.     fi
  6505.     if test "${OS_TARGET}" = "Android"; then
  6506.         AC_DEFINE(GTEST_OS_LINUX_ANDROID)
  6507.         AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
  6508.         AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
  6509.         AC_SUBST(GTEST_OS_LINUX_ANDROID)
  6510.         AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
  6511.         AC_SUBST(GTEST_HAS_CLONE)
  6512.     fi
  6513. fi
  6514.  
  6515. dnl ========================================================
  6516. dnl parental controls (for Windows Vista)
  6517. dnl ========================================================
  6518. MOZ_ARG_DISABLE_BOOL(parental-controls,
  6519. [  --disable-parental-controls
  6520.                           Do not build parental controls],
  6521.    MOZ_DISABLE_PARENTAL_CONTROLS=1,
  6522.    MOZ_DISABLE_PARENTAL_CONTROLS=)
  6523. if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
  6524.     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
  6525. fi
  6526.  
  6527. AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
  6528.  
  6529. dnl ========================================================
  6530. dnl = Disable smartcard support
  6531. dnl ========================================================
  6532. if test -n "$MOZ_NO_SMART_CARDS"; then
  6533.     AC_DEFINE(MOZ_NO_SMART_CARDS)
  6534. fi
  6535. AC_SUBST(MOZ_NO_SMART_CARDS)
  6536.  
  6537. dnl ========================================================
  6538. dnl = Disable EV certificate verification
  6539. dnl ========================================================
  6540. if test -n "$MOZ_NO_EV_CERTS"; then
  6541.     AC_DEFINE(MOZ_NO_EV_CERTS)
  6542. fi
  6543. AC_SUBST(MOZ_NO_EV_CERTS)
  6544.  
  6545. dnl ========================================================
  6546. dnl = Disable libpkix
  6547. dnl ========================================================
  6548. if test -n "$NSS_NO_LIBPKIX"; then
  6549.     AC_DEFINE(NSS_NO_LIBPKIX)
  6550. fi
  6551. AC_SUBST(NSS_NO_LIBPKIX)
  6552.  
  6553. dnl ========================================================
  6554. dnl = Sandboxing support
  6555. dnl ========================================================
  6556. MOZ_ARG_DISABLE_BOOL(sandbox,
  6557. [  --disable-sandbox        Disable sandboxing support],
  6558.     MOZ_SANDBOX=,
  6559.     MOZ_SANDBOX=1)
  6560.  
  6561. dnl ========================================================
  6562. dnl = Content process sandboxing
  6563. dnl ========================================================
  6564. if test -n "$gonkdir"; then
  6565.     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
  6566. fi
  6567.  
  6568. case "$OS_TARGET:$NIGHTLY_BUILD" in
  6569. WINNT:*)
  6570.     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
  6571.     ;;
  6572. Darwin:1)
  6573.     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
  6574.     ;;
  6575. esac
  6576.  
  6577. MOZ_ARG_ENABLE_BOOL(content-sandbox,
  6578. [  --enable-content-sandbox Enable sandboxing support for content-processes
  6579.   --disable-content-sandbox Disable sandboxing support for content-processes],
  6580.     MOZ_CONTENT_SANDBOX=1,
  6581.     MOZ_CONTENT_SANDBOX=)
  6582.  
  6583. if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
  6584.     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
  6585. fi
  6586.  
  6587. if test -n "$MOZ_CONTENT_SANDBOX"; then
  6588.     AC_DEFINE(MOZ_CONTENT_SANDBOX)
  6589. fi
  6590.  
  6591. AC_SUBST(MOZ_CONTENT_SANDBOX)
  6592.  
  6593. dnl ========================================================
  6594. dnl = Gecko Media Plugin sandboxing
  6595. dnl ========================================================
  6596. case $OS_TARGET in
  6597. WINNT)
  6598.     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
  6599.     ;;
  6600. Linux)
  6601.     case $CPU_ARCH in
  6602.     x86_64|x86)
  6603.         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
  6604.         ;;
  6605.     esac
  6606.     ;;
  6607. Darwin)
  6608.     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
  6609.     ;;
  6610. esac
  6611.  
  6612. if test -n "$MOZ_GMP_SANDBOX"; then
  6613.     AC_DEFINE(MOZ_GMP_SANDBOX)
  6614. fi
  6615.  
  6616. AC_SUBST(MOZ_GMP_SANDBOX)
  6617.  
  6618. if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
  6619.     MOZ_SANDBOX=
  6620. fi
  6621.  
  6622. if test -n "$MOZ_SANDBOX"; then
  6623.     AC_DEFINE(MOZ_SANDBOX)
  6624. fi
  6625.  
  6626. AC_SUBST(MOZ_SANDBOX)
  6627.  
  6628.  
  6629. dnl ========================================================
  6630. dnl =
  6631. dnl = Module specific options
  6632. dnl =
  6633. dnl ========================================================
  6634. MOZ_ARG_HEADER(Individual module options)
  6635.  
  6636. dnl ========================================================
  6637. dnl = Disable feed handling components
  6638. dnl ========================================================
  6639. MOZ_ARG_DISABLE_BOOL(feeds,
  6640. [  --disable-feeds         Disable feed handling and processing components],
  6641.     MOZ_FEEDS=,
  6642.     MOZ_FEEDS=1 )
  6643. if test -n "$MOZ_FEEDS"; then
  6644.     AC_DEFINE(MOZ_FEEDS)
  6645. else
  6646.     if test "$MOZ_BUILD_APP" = "browser"; then
  6647.         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
  6648.     fi
  6649. fi
  6650.  
  6651. dnl ========================================================
  6652. dnl Check for sqlite
  6653. dnl ========================================================
  6654.  
  6655. MOZ_NATIVE_SQLITE=
  6656. MOZ_ARG_ENABLE_BOOL(system-sqlite,
  6657. [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
  6658. MOZ_NATIVE_SQLITE=1,
  6659. MOZ_NATIVE_SQLITE= )
  6660.  
  6661. if test -n "$MOZ_NATIVE_SQLITE"
  6662. then
  6663.     dnl ============================
  6664.     dnl === SQLite Version check ===
  6665.     dnl ============================
  6666.     dnl Check to see if the system SQLite package is new enough.
  6667.     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
  6668.  
  6669.     dnl ==================================
  6670.     dnl === SQLITE_SECURE_DELETE check ===
  6671.     dnl ==================================
  6672.     dnl Check to see if the system SQLite package is compiled with
  6673.     dnl SQLITE_SECURE_DELETE enabled.
  6674.     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
  6675.     _SAVE_CFLAGS="$CFLAGS"
  6676.     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  6677.     _SAVE_LIBS="$LIBS"
  6678.     LIBS="$LIBS $SQLITE_LIBS"
  6679.     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
  6680.         AC_TRY_RUN([
  6681.             #include "sqlite3.h"
  6682.  
  6683.             int main(int argc, char **argv){
  6684.               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
  6685.             }],
  6686.             ac_cv_sqlite_secure_delete=yes,
  6687.             ac_cv_sqlite_secure_delete=no,
  6688.             ac_cv_sqlite_secure_delete=no
  6689.         )
  6690.     ])
  6691.     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
  6692.     CFLAGS="$_SAVE_CFLAGS"
  6693.     LIBS="$_SAVE_LIBS"
  6694.     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
  6695.         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
  6696.     fi
  6697.  
  6698.     dnl ===============================
  6699.     dnl === SQLITE_THREADSAFE check ===
  6700.     dnl ===============================
  6701.     dnl Check to see if the system SQLite package is compiled with
  6702.     dnl SQLITE_THREADSAFE enabled.
  6703.     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
  6704.     _SAVE_CFLAGS="$CFLAGS"
  6705.     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  6706.     _SAVE_LIBS="$LIBS"
  6707.     LIBS="$LIBS $SQLITE_LIBS"
  6708.     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
  6709.         AC_TRY_RUN([
  6710.             #include "sqlite3.h"
  6711.  
  6712.             int main(int argc, char **argv){
  6713.               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
  6714.             }],
  6715.             ac_cv_sqlite_threadsafe=yes,
  6716.             ac_cv_sqlite_threadsafe=no,
  6717.             ac_cv_sqlite_threadsafe=no
  6718.         )
  6719.     ])
  6720.     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
  6721.     CFLAGS="$_SAVE_CFLAGS"
  6722.     LIBS="$_SAVE_LIBS"
  6723.     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
  6724.         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
  6725.     fi
  6726.  
  6727.     dnl ================================
  6728.     dnl === SQLITE_ENABLE_FTS3 check ===
  6729.     dnl ================================
  6730.     dnl check to see if the system SQLite package is compiled with
  6731.     dnl SQLITE_ENABLE_FTS3 enabled.
  6732.     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
  6733.     _SAVE_CFLAGS="$CFLAGS"
  6734.     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  6735.     _SAVE_LIBS="$LIBS"
  6736.     LIBS="$LIBS $SQLITE_LIBS"
  6737.     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
  6738.         AC_TRY_RUN([
  6739.             #include "sqlite3.h"
  6740.  
  6741.             int main(int argc, char **argv){
  6742.               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
  6743.             }],
  6744.             ac_cv_sqlite_enable_fts3=yes,
  6745.             ac_cv_sqlite_enable_fts3=no,
  6746.             ac_cv_sqlite_enable_fts3=no
  6747.         )
  6748.     ])
  6749.     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
  6750.     CFLAGS="$_SAVE_CFLAGS"
  6751.     LIBS="$_SAVE_LIBS"
  6752.     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
  6753.         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
  6754.     fi
  6755.  
  6756.     dnl =========================================
  6757.     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
  6758.     dnl =========================================
  6759.     dnl check to see if the system SQLite package is compiled with
  6760.     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
  6761.     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
  6762.     _SAVE_CFLAGS="$CFLAGS"
  6763.     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  6764.     _SAVE_LIBS="$LIBS"
  6765.     LIBS="$LIBS $SQLITE_LIBS"
  6766.     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
  6767.         AC_TRY_RUN([
  6768.             #include "sqlite3.h"
  6769.  
  6770.             int main(int argc, char **argv){
  6771.               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
  6772.             }],
  6773.             ac_cv_sqlite_enable_unlock_notify=yes,
  6774.             ac_cv_sqlite_enable_unlock_notify=no,
  6775.             ac_cv_sqlite_enable_unlock_notify=no
  6776.         )
  6777.     ])
  6778.     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
  6779.     CFLAGS="$_SAVE_CFLAGS"
  6780.     LIBS="$_SAVE_LIBS"
  6781.     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
  6782.         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
  6783.     fi
  6784. fi
  6785.  
  6786. if test -n "$MOZ_NATIVE_SQLITE"; then
  6787.     AC_DEFINE(MOZ_NATIVE_SQLITE)
  6788. fi
  6789. AC_SUBST(MOZ_NATIVE_SQLITE)
  6790.  
  6791. dnl ========================================================
  6792. dnl = Enable help viewer (off by default)
  6793. dnl ========================================================
  6794. if test -n "$MOZ_HELP_VIEWER"; then
  6795.      dnl Do this if defined in confvars.sh
  6796.      AC_DEFINE(MOZ_HELP_VIEWER)
  6797. fi
  6798.  
  6799. dnl ========================================================
  6800. dnl = Enable safe browsing (anti-phishing)
  6801. dnl ========================================================
  6802. MOZ_ARG_ENABLE_BOOL(safe-browsing,
  6803. [  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
  6804.     MOZ_SAFE_BROWSING=1,
  6805.     MOZ_SAFE_BROWSING= )
  6806. if test -n "$MOZ_SAFE_BROWSING"; then
  6807.     AC_DEFINE(MOZ_SAFE_BROWSING)
  6808. fi
  6809. AC_SUBST(MOZ_SAFE_BROWSING)
  6810.  
  6811. dnl ========================================================
  6812. dnl = Enable url-classifier
  6813. dnl ========================================================
  6814. dnl Implicitly enabled by default if building with safe-browsing
  6815. if test -n "$MOZ_SAFE_BROWSING"; then
  6816.     MOZ_URL_CLASSIFIER=1
  6817. fi
  6818. MOZ_ARG_ENABLE_BOOL(url-classifier,
  6819. [  --enable-url-classifier Enable url classifier module],
  6820.     MOZ_URL_CLASSIFIER=1,
  6821.     MOZ_URL_CLASSIFIER= )
  6822. if test -n "$MOZ_URL_CLASSIFIER"; then
  6823.     AC_DEFINE(MOZ_URL_CLASSIFIER)
  6824. fi
  6825. AC_SUBST(MOZ_URL_CLASSIFIER)
  6826.  
  6827. dnl ========================================================
  6828. dnl = Disable zipwriter
  6829. dnl ========================================================
  6830. MOZ_ARG_DISABLE_BOOL(zipwriter,
  6831. [  --disable-zipwriter     Disable zipwriter component],
  6832.     MOZ_ZIPWRITER=,
  6833.     MOZ_ZIPWRITER=1 )
  6834. AC_SUBST(MOZ_ZIPWRITER)
  6835.  
  6836. dnl ========================================================
  6837. dnl GL provider
  6838. dnl ========================================================
  6839. MOZ_GL_PROVIDER=
  6840. MOZ_ARG_WITH_STRING(gl-provider,
  6841. [  --with-gl-provider=ID
  6842.                           Set GL provider backend type],
  6843. [ val=`echo $withval`
  6844.     MOZ_GL_PROVIDER="$val"])
  6845.  
  6846. if test -n "$MOZ_GL_PROVIDER"; then
  6847. MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
  6848. AC_SUBST(MOZ_GL_PROVIDER)
  6849. AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
  6850. fi
  6851. AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
  6852. AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
  6853.  
  6854. dnl ========================================================
  6855. dnl = faststripe theme
  6856. dnl ========================================================
  6857. MOZ_ARG_ENABLE_BOOL(faststripe,
  6858. [  --enable-faststripe     Use faststripe theme],
  6859.     MOZ_THEME_FASTSTRIPE=1,
  6860.     MOZ_THEME_FASTSTRIPE= )
  6861. AC_SUBST(MOZ_THEME_FASTSTRIPE)
  6862.  
  6863. dnl ========================================================
  6864. dnl =
  6865. dnl = Feature options that require extra sources to be pulled
  6866. dnl =
  6867. dnl ========================================================
  6868. dnl MOZ_ARG_HEADER(Features that require extra sources)
  6869.  
  6870. dnl ========================================================
  6871. dnl =
  6872. dnl = Runtime debugging and Optimization Options
  6873. dnl =
  6874. dnl ========================================================
  6875. MOZ_ARG_HEADER(Runtime debugging and Optimizations)
  6876.  
  6877. dnl ========================================================
  6878. dnl enable mobile optimizations
  6879. dnl ========================================================
  6880. MOZ_ARG_ENABLE_BOOL(mobile-optimize,
  6881. [  --enable-mobile-optimize
  6882.                           Enable mobile optimizations],
  6883.     MOZ_GFX_OPTIMIZE_MOBILE=1)
  6884.  
  6885. AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
  6886.  
  6887. if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
  6888.     # We ignore paint will resample on mobile for performance.
  6889.     # We may want to revisit this later.
  6890.     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
  6891.  
  6892.     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
  6893.     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
  6894. fi
  6895.  
  6896. dnl ========================================================
  6897. dnl = Enable code optimization. ON by default.
  6898. dnl ========================================================
  6899. if test -z "$MOZ_OPTIMIZE_FLAGS"; then
  6900.     MOZ_OPTIMIZE_FLAGS="-O"
  6901. fi
  6902.  
  6903. MOZ_ARG_ENABLE_STRING(optimize,
  6904. [  --disable-optimize      Disable compiler optimization
  6905.   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
  6906. [ if test "$enableval" != "no"; then
  6907.     MOZ_OPTIMIZE=1
  6908.     if test -n "$enableval" -a "$enableval" != "yes"; then
  6909.         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
  6910.         MOZ_OPTIMIZE=2
  6911.     fi
  6912. else
  6913.     MOZ_OPTIMIZE=
  6914. fi ], MOZ_OPTIMIZE=1)
  6915.  
  6916. MOZ_SET_FRAMEPTR_FLAGS
  6917.  
  6918. if test "$COMPILE_ENVIRONMENT"; then
  6919. if test -n "$MOZ_OPTIMIZE"; then
  6920.     AC_MSG_CHECKING([for valid optimization flags])
  6921.     _SAVE_CFLAGS=$CFLAGS
  6922.     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
  6923.     AC_TRY_COMPILE([#include <stdio.h>],
  6924.         [printf("Hello World\n");],
  6925.         _results=yes,
  6926.         _results=no)
  6927.     AC_MSG_RESULT([$_results])
  6928.     if test "$_results" = "no"; then
  6929.         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
  6930.     fi
  6931.     CFLAGS=$_SAVE_CFLAGS
  6932. fi
  6933. fi # COMPILE_ENVIRONMENT
  6934.  
  6935. AC_SUBST(MOZ_OPTIMIZE)
  6936. AC_SUBST(MOZ_FRAMEPTR_FLAGS)
  6937. AC_SUBST(MOZ_OPTIMIZE_FLAGS)
  6938. AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
  6939. AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
  6940. AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
  6941. AC_SUBST(MOZ_PGO)
  6942. AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
  6943.  
  6944. dnl ========================================================
  6945. dnl = Enable NS_StackWalk.
  6946. dnl ========================================================
  6947.  
  6948. # On Windows, NS_StackWalk will only work correctly if we have frame pointers
  6949. # available. That will only be true for non-optimized builds, debug builds or
  6950. # builds with --enable-profiling in the .mozconfig (which is turned on in
  6951. # Nightly by default.)
  6952. case "$OS_TARGET" in
  6953. WINNT)
  6954.     if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
  6955.         MOZ_STACKWALKING=1
  6956.     else
  6957.         MOZ_STACKWALKING=
  6958.     fi
  6959.     ;;
  6960. *)
  6961.     MOZ_STACKWALKING=1
  6962.     ;;
  6963. esac
  6964.  
  6965. if test -n "$MOZ_STACKWALKING"; then
  6966.     AC_DEFINE(MOZ_STACKWALKING)
  6967. fi
  6968.  
  6969. AC_SUBST(MOZ_STACKWALKING)
  6970.  
  6971. dnl ========================================================
  6972. dnl = Disable treating compiler warnings as errors
  6973. dnl ========================================================
  6974. if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  6975.    WARNINGS_AS_ERRORS=''
  6976. elif test "$GNU_CC"; then
  6977.     # Prevent the following GCC warnings from being treated as errors:
  6978.     # -Wuninitialized - too many false positives
  6979.     # -Wmaybe-uninitialized - too many false positives
  6980.     # -Wdeprecated-declarations - we don't want our builds held hostage when a
  6981.     #   platform-specific API becomes deprecated.
  6982.     MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
  6983.     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
  6984.     MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
  6985.     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
  6986.     MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
  6987.     MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
  6988.  
  6989.     if test -n "$MOZ_PGO"; then
  6990.         MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
  6991.         MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
  6992.     fi
  6993. fi
  6994.  
  6995. dnl ========================================================
  6996. dnl = Disable runtime logging checks
  6997. dnl ========================================================
  6998. MOZ_ARG_DISABLE_BOOL(logging,
  6999. [  --disable-logging       Disable logging facilities],
  7000.     NS_DISABLE_LOGGING=1,
  7001.     NS_DISABLE_LOGGING= )
  7002. if test "$NS_DISABLE_LOGGING"; then
  7003.     AC_DEFINE(NS_DISABLE_LOGGING)
  7004. else
  7005.     AC_DEFINE(MOZ_LOGGING)
  7006.     AC_DEFINE(FORCE_PR_LOG)
  7007. fi
  7008.  
  7009. dnl ========================================================
  7010. dnl = This will enable logging of addref, release, ctor, dtor.
  7011. dnl ========================================================
  7012. _ENABLE_LOGREFCNT=42
  7013. MOZ_ARG_ENABLE_BOOL(logrefcnt,
  7014. [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
  7015.     _ENABLE_LOGREFCNT=1,
  7016.     _ENABLE_LOGREFCNT= )
  7017. if test "$_ENABLE_LOGREFCNT" = "1"; then
  7018.     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
  7019. elif test -z "$_ENABLE_LOGREFCNT"; then
  7020.     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
  7021. fi
  7022.  
  7023. dnl ========================================================
  7024. dnl moz_aproximate_location
  7025. dnl ========================================================
  7026. MOZ_ARG_ENABLE_BOOL(approximate_location,
  7027. [ --enable-approximate-location    Enable approximate location ],
  7028.     MOZ_APPROX_LOCATION=1,
  7029.     MOZ_APPROX_LOCATION= )
  7030. if test -n "$MOZ_APPROX_LOCATION"; then
  7031.     AC_DEFINE(MOZ_APPROX_LOCATION)
  7032. fi
  7033.  
  7034. dnl ========================================================
  7035. dnl moz_gps_debug
  7036. dnl ========================================================
  7037. MOZ_ARG_ENABLE_BOOL(gps_debug,
  7038. [ --enable-gps-debug    Enable gps specific debug messages ],
  7039.     MOZ_GPS_DEBUG=1,
  7040.     MOZ_GPS_DEBUG= )
  7041. if test -n "$MOZ_GPS_DEBUG"; then
  7042.     AC_DEFINE(MOZ_GPS_DEBUG)
  7043. fi
  7044. if test -n "$MOZ_DEBUG"; then
  7045.     AC_DEFINE(MOZ_GPS_DEBUG)
  7046. fi
  7047.  
  7048. dnl ========================================================
  7049. dnl moz_dump_painting
  7050. dnl ========================================================
  7051. MOZ_ARG_ENABLE_BOOL(dump-painting,
  7052. [  --enable-dump-painting          Enable paint debugging.],
  7053.     MOZ_DUMP_PAINTING=1,
  7054.     MOZ_DUMP_PAINTING= )
  7055. if test -n "$MOZ_DUMP_PAINTING"; then
  7056.     AC_DEFINE(MOZ_DUMP_PAINTING)
  7057.     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
  7058. fi
  7059. if test -n "$MOZ_DEBUG"; then
  7060.     AC_DEFINE(MOZ_DUMP_PAINTING)
  7061. fi
  7062.  
  7063. dnl ========================================================
  7064. dnl = Enable DMD
  7065. dnl ========================================================
  7066.  
  7067. MOZ_ARG_ENABLE_BOOL(dmd,
  7068. [  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
  7069.     MOZ_DMD=1,
  7070.     MOZ_DMD= )
  7071.  
  7072. if test "$MOZ_DMD"; then
  7073.     AC_DEFINE(MOZ_DMD)
  7074.  
  7075.     if test "${CPU_ARCH}" = "arm"; then
  7076.         CFLAGS="$CFLAGS -funwind-tables"
  7077.         CXXFLAGS="$CXXFLAGS -funwind-tables"
  7078.     fi
  7079.  
  7080.     MOZ_MEMORY=1                        # DMD enables jemalloc
  7081.     MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
  7082. fi
  7083. AC_SUBST(MOZ_DMD)
  7084.  
  7085. dnl ========================================================
  7086. dnl = Enable jemalloc
  7087. dnl ========================================================
  7088. MOZ_ARG_ENABLE_BOOL(jemalloc,
  7089. [  --enable-jemalloc       Replace memory allocator with jemalloc],
  7090.     MOZ_MEMORY=1,
  7091.     MOZ_MEMORY=)
  7092.  
  7093. case "${OS_TARGET}" in
  7094. Android|WINNT|Darwin)
  7095.   MOZ_GLUE_IN_PROGRAM=
  7096.   ;;
  7097. *)
  7098.   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
  7099.   MOZ_GLUE_IN_PROGRAM=1
  7100.   ;;
  7101. esac
  7102.  
  7103. dnl ========================================================
  7104. dnl = Enable dynamic replacement of malloc implementation
  7105. dnl ========================================================
  7106. if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
  7107.   # Enable on central for the debugging opportunities it adds.
  7108.   MOZ_REPLACE_MALLOC=1
  7109. fi
  7110. MOZ_ARG_ENABLE_BOOL(replace-malloc,
  7111. [  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
  7112.     MOZ_REPLACE_MALLOC=1,
  7113.     MOZ_REPLACE_MALLOC= )
  7114.  
  7115. if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
  7116.     dnl We don't want to enable jemalloc unconditionally because it may be a
  7117.     dnl deliberate choice not to enable it (bug 702250, for instance)
  7118.     AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
  7119. elif test -n "$MOZ_REPLACE_MALLOC"; then
  7120.     AC_DEFINE(MOZ_REPLACE_MALLOC)
  7121.     MOZ_NATIVE_JEMALLOC=
  7122.  
  7123.     dnl Replace-malloc Mac linkage quirks
  7124.     if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
  7125.         AC_CACHE_CHECK([how to do weak dynamic linking],
  7126.             ac_cv_weak_dynamic_linking,
  7127.             [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
  7128.              if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
  7129.                 test -s conftest${DLL_SUFFIX}; then
  7130.                  dnl There are several ways the linker can put link edit rules in a binary:
  7131.                  dnl - classic info only (for OSX < 10.6)
  7132.                  dnl - dyld info only
  7133.                  dnl - both
  7134.                  if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
  7135.                      _CLASSIC_INFO=
  7136.                  else
  7137.                      _CLASSIC_INFO=1
  7138.                  fi
  7139.                  if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
  7140.                      _DYLD_INFO=1
  7141.                  else
  7142.                      _DYLD_INFO=
  7143.                  fi
  7144.                  dnl With classic info, we need to build with -flat_namespace.
  7145.                  dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
  7146.                  dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
  7147.                  dnl forgets to set the weak flag in the dyld info.
  7148.                  dnl See http://glandium.org/blog/?p=2764 for more details.
  7149.                  dnl
  7150.                  dnl Values for ac_cv_weak_dynamic_linking, and subsequently
  7151.                  dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
  7152.                  dnl - "flat namespace" when -flat_namespace alone is needed
  7153.                  dnl - "dummy library" when a dummy library and -flat_namespace are needed
  7154.                  dnl - "compiler support" when nothing is needed
  7155.                  if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
  7156.                      if test -n "$_CLASSIC_INFO"; then
  7157.                          ac_cv_weak_dynamic_linking="flat namespace"
  7158.                      else
  7159.                          ac_cv_weak_dynamic_linking="compiler support"
  7160.                      fi
  7161.                  else
  7162.                      if test -n "$_DYLD_INFO"; then
  7163.                          ac_cv_weak_dynamic_linking="dummy library"
  7164.                      else
  7165.                          ac_cv_weak_dynamic_linking="flat namespace"
  7166.                      fi
  7167.                  fi
  7168.              else
  7169.                  AC_ERROR([couldn't compile a simple C file])
  7170.             fi
  7171.             rm -rf conftest*])
  7172.        MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
  7173.    fi
  7174. fi
  7175. AC_SUBST(MOZ_REPLACE_MALLOC)
  7176. AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
  7177.  
  7178. dnl ========================================================
  7179. dnl = Jemalloc build setup
  7180. dnl ========================================================
  7181. if test -z "$MOZ_MEMORY"; then
  7182.  if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
  7183.    MOZ_NATIVE_JEMALLOC=1
  7184.    AC_CHECK_FUNCS(mallctl nallocx,,
  7185.      [MOZ_NATIVE_JEMALLOC=
  7186.       break])
  7187.    if test -n "$MOZ_NATIVE_JEMALLOC"; then
  7188.      MOZ_MEMORY=1
  7189.      AC_DEFINE(MOZ_MEMORY)
  7190.      AC_DEFINE(MOZ_JEMALLOC3)
  7191.      AC_DEFINE(MOZ_NATIVE_JEMALLOC)
  7192.    fi
  7193.  fi
  7194.  case "${target}" in
  7195.    *-mingw*)
  7196.      if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
  7197.        AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
  7198.      fi
  7199.      ;;
  7200.  esac
  7201. else
  7202.  AC_DEFINE(MOZ_MEMORY)
  7203.  if test -n "$MOZ_JEMALLOC3"; then
  7204.    AC_DEFINE(MOZ_JEMALLOC3)
  7205.  fi
  7206.  if test "x$MOZ_DEBUG" = "x1"; then
  7207.    AC_DEFINE(MOZ_MEMORY_DEBUG)
  7208.  fi
  7209.  dnl The generic feature tests that determine how to compute ncpus are long and
  7210.  dnl complicated.  Therefore, simply define special cpp variables for the
  7211.  dnl platforms we have special knowledge of.
  7212.  case "${target}" in
  7213.  *-darwin*)
  7214.    AC_DEFINE(MOZ_MEMORY_DARWIN)
  7215.    ;;
  7216.  *-*freebsd*)
  7217.    AC_DEFINE(MOZ_MEMORY_BSD)
  7218.    ;;
  7219.  *-android*|*-linuxandroid*)
  7220.    AC_DEFINE(MOZ_MEMORY_LINUX)
  7221.    AC_DEFINE(MOZ_MEMORY_ANDROID)
  7222.    if test -n "$gonkdir"; then
  7223.      AC_DEFINE(MOZ_MEMORY_GONK)
  7224.    fi
  7225.    ;;
  7226.  *-*linux*)
  7227.    AC_DEFINE(MOZ_MEMORY_LINUX)
  7228.    ;;
  7229.  *-netbsd*)
  7230.    AC_DEFINE(MOZ_MEMORY_BSD)
  7231.    ;;
  7232.  *-solaris*)
  7233.    AC_DEFINE(MOZ_MEMORY_SOLARIS)
  7234.    ;;
  7235.  *-mingw*)
  7236.    AC_DEFINE(MOZ_MEMORY_WINDOWS)
  7237.    export MOZ_NO_DEBUG_RTL=1
  7238.    WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
  7239.    dnl Look for a broken crtdll.obj
  7240.    WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
  7241.    lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
  7242.    if grep -q '__imp__\{0,1\}free' crtdll.obj; then
  7243.      MOZ_CRT=1
  7244.    fi
  7245.    rm crtdll.obj
  7246.    ;;
  7247.  *)
  7248.    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
  7249.    ;;
  7250.  esac
  7251. fi # MOZ_MEMORY
  7252. AC_SUBST(MOZ_MEMORY)
  7253. AC_SUBST(MOZ_JEMALLOC3)
  7254. AC_SUBST(MOZ_NATIVE_JEMALLOC)
  7255. AC_SUBST(MOZ_CRT)
  7256. export MOZ_CRT
  7257. AC_SUBST(MOZ_GLUE_IN_PROGRAM)
  7258. AC_SUBST_LIST(WIN32_CRT_LIBS)
  7259.  
  7260. dnl We need to wrap dlopen and related functions on Android because we use
  7261. dnl our own linker.
  7262. if test "$OS_TARGET" = Android; then
  7263.    MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
  7264.    if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
  7265.        MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
  7266.    fi
  7267.    if test "$MOZ_WIDGET_TOOLKIT" = android; then
  7268.        MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
  7269.    fi
  7270. fi
  7271.  
  7272. AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
  7273. export MOZ_GLUE_WRAP_LDFLAGS
  7274.  
  7275. dnl ========================================================
  7276. dnl JS opt-mode assertions and minidump instrumentation
  7277. dnl ========================================================
  7278. MOZ_ARG_ENABLE_BOOL(js-diagnostics,
  7279. [  --enable-js-diagnostics
  7280.                          Enable JS diagnostic assertions and breakpad data],
  7281.    JS_CRASH_DIAGNOSTICS=1,
  7282.    JS_CRASH_DIAGNOSTICS= )
  7283. if test -n "$JS_CRASH_DIAGNOSTICS"; then
  7284.    AC_DEFINE(JS_CRASH_DIAGNOSTICS)
  7285. fi
  7286.  
  7287. dnl ========================================================
  7288. dnl = Enable static checking using gcc-dehydra
  7289. dnl ========================================================
  7290.  
  7291. MOZ_ARG_WITH_STRING(static-checking,
  7292. [  --with-static-checking=path/to/gcc_dehydra.so
  7293.                          Enable static checking of code using GCC-dehydra],
  7294.    DEHYDRA_PATH=$withval,
  7295.    DEHYDRA_PATH= )
  7296.  
  7297. if test -n "$DEHYDRA_PATH"; then
  7298.    if test ! -f "$DEHYDRA_PATH"; then
  7299.        AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
  7300.    fi
  7301.    AC_DEFINE(NS_STATIC_CHECKING)
  7302. fi
  7303. AC_SUBST(DEHYDRA_PATH)
  7304.  
  7305. dnl ========================================================
  7306. dnl = Enable using the clang plugin to build
  7307. dnl ========================================================
  7308.  
  7309. MOZ_CONFIG_CLANG_PLUGIN
  7310.  
  7311. dnl ========================================================
  7312. dnl = Enable stripping of libs & executables
  7313. dnl ========================================================
  7314. MOZ_ARG_ENABLE_BOOL(strip,
  7315. [  --enable-strip          Enable stripping of libs & executables ],
  7316.    ENABLE_STRIP=1,
  7317.    ENABLE_STRIP= )
  7318.  
  7319. dnl ========================================================
  7320. dnl = Enable stripping of libs & executables when packaging
  7321. dnl ========================================================
  7322. MOZ_ARG_ENABLE_BOOL(install-strip,
  7323. [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
  7324.    PKG_SKIP_STRIP= ,
  7325.    PKG_SKIP_STRIP=1)
  7326.  
  7327. dnl ========================================================
  7328. dnl = --disable-elf-hack
  7329. dnl ========================================================
  7330.  
  7331. USE_ELF_HACK=1
  7332. MOZ_ARG_DISABLE_BOOL(elf-hack,
  7333. [  --disable-elf-hack      Disable elf hacks],
  7334.    [USE_ELF_HACK=],
  7335.    [USE_ELF_HACK=1])
  7336.  
  7337. # Only enable elfhack where supported
  7338. if test "$USE_ELF_HACK" = 1; then
  7339.    case "${HOST_OS_ARCH},${OS_ARCH}" in
  7340.    Linux,Linux)
  7341.        case "${CPU_ARCH}" in
  7342.        arm | x86 | x86_64)
  7343.            USE_ELF_HACK=1
  7344.            ;;
  7345.        *)
  7346.            USE_ELF_HACK=
  7347.            ;;
  7348.        esac
  7349.        ;;
  7350.    *)
  7351.        USE_ELF_HACK=
  7352.        ;;
  7353.    esac
  7354. fi
  7355.  
  7356. if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
  7357.    dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
  7358.    dnl memory addresses it maps to. The result is that by the time elfhack
  7359.    dnl kicks in, it is not possible to apply relocations because of that,
  7360.    dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
  7361.    dnl segment. It makes elfhack mostly useless, so considering the problems
  7362.    dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
  7363.    dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
  7364.     dnl the linker creates PT_GNU_RELRO segments. However, when we do want
  7365.     dnl elfhack enabled, disable PT_GNU_RELRO instead.
  7366.     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
  7367.         LINK_WITH_PT_GNU_RELRO,
  7368.         [echo "int main() {return 0;}" > conftest.${ac_ext}
  7369.          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
  7370.             test -s conftest${ac_exeext}; then
  7371.             if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
  7372.                 LINK_WITH_PT_GNU_RELRO=yes
  7373.             else
  7374.                 LINK_WITH_PT_GNU_RELRO=no
  7375.             fi
  7376.          else
  7377.              dnl We really don't expect to get here, but just in case
  7378.              AC_ERROR([couldn't compile a simple C file])
  7379.         fi
  7380.         rm -rf conftest*])
  7381.    if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
  7382.        if test "$USE_ELF_HACK" = F; then
  7383.            AC_MSG_CHECKING([for -z norelro option to ld])
  7384.            _SAVE_LDFLAGS=$LDFLAGS
  7385.            LDFLAGS="$LDFLAGS -Wl,-z,norelro"
  7386.            AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  7387.                        [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
  7388.                        AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
  7389.             USE_ELF_HACK=1
  7390.         else
  7391.             AC_MSG_WARN([Disabling elfhack])
  7392.             USE_ELF_HACK=
  7393.         fi
  7394.     fi
  7395. fi
  7396.  
  7397. dnl ========================================================
  7398. dnl = libstdc++ compatibility hacks
  7399. dnl ========================================================
  7400.  
  7401. STDCXX_COMPAT=
  7402. MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
  7403. [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
  7404.     STDCXX_COMPAT=1)
  7405.  
  7406. if test -n "$STDCXX_COMPAT"; then
  7407.    eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
  7408.    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
  7409.    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
  7410. fi
  7411.  
  7412. dnl ========================================================
  7413. dnl =
  7414. dnl = Profiling and Instrumenting
  7415. dnl =
  7416. dnl ========================================================
  7417. MOZ_ARG_HEADER(Profiling and Instrumenting)
  7418.  
  7419. dnl ========================================================
  7420. dnl = Enable runtime visual profiling logger
  7421. dnl ========================================================
  7422. MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
  7423. [  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
  7424.     MOZ_VISUAL_EVENT_TRACER=1,
  7425.     MOZ_VISUAL_EVENT_TRACER=)
  7426. if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
  7427.     AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
  7428. fi
  7429.  
  7430. dnl ========================================================
  7431. dnl = Enable TaskTracer
  7432. dnl ========================================================
  7433. MOZ_ARG_ENABLE_BOOL(tasktracer,
  7434. [  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
  7435.     MOZ_TASK_TRACER=1,
  7436.     MOZ_TASK_TRACER= )
  7437. if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
  7438.     AC_DEFINE(MOZ_TASK_TRACER)
  7439.     AC_SUBST(MOZ_TASK_TRACER)
  7440. fi
  7441.  
  7442. dnl ========================================================
  7443. dnl Turn on reflow counting
  7444. dnl ========================================================
  7445. MOZ_ARG_ENABLE_BOOL(reflow-perf,
  7446. [  --enable-reflow-perf    Enable reflow performance tracing],
  7447.     MOZ_REFLOW_PERF=1,
  7448.     MOZ_REFLOW_PERF= )
  7449. if test -n "$MOZ_REFLOW_PERF"; then
  7450.     AC_DEFINE(MOZ_REFLOW_PERF)
  7451. fi
  7452.  
  7453. dnl ========================================================
  7454. dnl = Offer a way to disable the startup cache
  7455. dnl ========================================================
  7456.  
  7457. MOZ_ARG_DISABLE_BOOL(startupcache,
  7458. [  --disable-startupcache          Disable startup cache ],
  7459.     MOZ_DISABLE_STARTUPCACHE=1,
  7460.     MOZ_DISABLE_STARTUPCACHE=)
  7461.  
  7462. dnl bug 988880: disable startup cache on b2g
  7463. if test -n "$MOZ_B2G"; then
  7464.   MOZ_DISABLE_STARTUPCACHE=1
  7465. fi
  7466. if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
  7467.   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
  7468. fi
  7469. AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
  7470.  
  7471. dnl ========================================================
  7472. dnl = Enable Radio Interface for B2G (Gonk usually)
  7473. dnl ========================================================
  7474. MOZ_ARG_ENABLE_BOOL(b2g-ril,
  7475. [  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
  7476.     MOZ_B2G_RIL=1,
  7477.     MOZ_B2G_RIL=,
  7478.     MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
  7479. if test -n "$MOZ_B2G_RIL"; then
  7480.     if test -n "$_PLATFORM_HAVE_RIL"; then
  7481.         AC_DEFINE(MOZ_B2G_RIL)
  7482.     else
  7483.         AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
  7484.    fi
  7485. fi
  7486. AC_SUBST(MOZ_B2G_RIL)
  7487.  
  7488. dnl ========================================================
  7489. dnl = Enable Radio FM for B2G (Gonk usually)
  7490. dnl ========================================================
  7491. if test -n "$MOZ_B2G_FM"; then
  7492.    AC_DEFINE(MOZ_B2G_FM)
  7493. fi
  7494. AC_SUBST(MOZ_B2G_FM)
  7495.  
  7496. dnl ========================================================
  7497. dnl = Enable Bluetooth Interface for B2G (Gonk usually)
  7498. dnl ========================================================
  7499. MOZ_ARG_ENABLE_BOOL(b2g-bt,
  7500. [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
  7501.    MOZ_B2G_BT=1,
  7502.    MOZ_B2G_BT= )
  7503. if test -n "$MOZ_B2G_BT"; then
  7504.    AC_DEFINE(MOZ_B2G_BT)
  7505. fi
  7506. AC_SUBST(MOZ_B2G_BT)
  7507. AC_SUBST(MOZ_B2G_BT_BLUEZ)
  7508. AC_SUBST(MOZ_B2G_BT_BLUEDROID)
  7509. AC_SUBST(MOZ_B2G_BT_DAEMON)
  7510.  
  7511. dnl ========================================================
  7512. dnl = Enable NFC Interface for B2G (Gonk usually)
  7513. dnl ========================================================
  7514. MOZ_ARG_ENABLE_BOOL(nfc,
  7515. [  --enable-nfc         Set compile flags necessary for compiling NFC API ],
  7516.    MOZ_NFC=1,
  7517.    MOZ_NFC= )
  7518. if test -n "$MOZ_NFC"; then
  7519.   AC_DEFINE(MOZ_NFC)
  7520. fi
  7521. AC_SUBST(MOZ_NFC)
  7522.  
  7523. dnl ========================================================
  7524. dnl = Enable Pico Speech Synthesis (Gonk usually)
  7525. dnl ========================================================
  7526. MOZ_ARG_ENABLE_BOOL(synth-pico,
  7527. [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
  7528.    MOZ_SYNTH_PICO=1,
  7529.    MOZ_SYNTH_PICO= )
  7530. if test -n "$MOZ_SYNTH_PICO"; then
  7531.    AC_DEFINE(MOZ_SYNTH_PICO)
  7532. fi
  7533. AC_SUBST(MOZ_SYNTH_PICO)
  7534.  
  7535. dnl ========================================================
  7536. dnl = Enable Support for Time Manager API
  7537. dnl ========================================================
  7538. if test -n "$MOZ_TIME_MANAGER"; then
  7539.    AC_DEFINE(MOZ_TIME_MANAGER)
  7540. fi
  7541. AC_SUBST(MOZ_TIME_MANAGER)
  7542.  
  7543. dnl ========================================================
  7544. dnl = Enable Camera Interface for B2G (Gonk usually)
  7545. dnl ========================================================
  7546. MOZ_ARG_ENABLE_BOOL(b2g-camera,
  7547. [  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
  7548.    MOZ_B2G_CAMERA=1,
  7549.    MOZ_B2G_CAMERA= )
  7550. if test -n "$MOZ_B2G_CAMERA"; then
  7551.   AC_DEFINE(MOZ_B2G_CAMERA)
  7552. fi
  7553. AC_SUBST(MOZ_B2G_CAMERA)
  7554.  
  7555. dnl ========================================================
  7556. dnl = Enable Support for Payment API
  7557. dnl ========================================================
  7558. if test -n "$MOZ_PAY"; then
  7559.    AC_DEFINE(MOZ_PAY)
  7560. fi
  7561. AC_SUBST(MOZ_PAY)
  7562.  
  7563. dnl ========================================================
  7564. dnl = Enable Browser Support for Activities
  7565. dnl ========================================================
  7566. if test -n "$MOZ_ACTIVITIES"; then
  7567.    AC_DEFINE(MOZ_ACTIVITIES)
  7568. fi
  7569. AC_SUBST(MOZ_ACTIVITIES)
  7570.  
  7571. dnl ========================================================
  7572. dnl = Enable Support for AudioChannelManager API
  7573. dnl ========================================================
  7574. if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
  7575.    AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
  7576. fi
  7577. AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
  7578.  
  7579. dnl ========================================================
  7580. dnl = Support for demangling undefined symbols
  7581. dnl ========================================================
  7582. if test -z "$SKIP_LIBRARY_CHECKS"; then
  7583.    AC_LANG_SAVE
  7584.    AC_LANG_CPLUSPLUS
  7585.    AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
  7586.    AC_LANG_RESTORE
  7587. fi
  7588.  
  7589. # Demangle only for debug or DMD builds
  7590. MOZ_DEMANGLE_SYMBOLS=
  7591. if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
  7592.    MOZ_DEMANGLE_SYMBOLS=1
  7593.    AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  7594. fi
  7595. AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
  7596.  
  7597. dnl ========================================================
  7598. dnl = Support for gcc stack unwinding (from gcc 3.3)
  7599. dnl ========================================================
  7600. if test -z "$SKIP_LIBRARY_CHECKS"; then
  7601.    AC_LANG_SAVE
  7602.    AC_LANG_CPLUSPLUS
  7603.    MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
  7604.    AC_LANG_RESTORE
  7605. fi
  7606.  
  7607. dnl ========================================================
  7608. dnl JIT observers
  7609. dnl ========================================================
  7610.  
  7611. MOZ_ARG_WITH_STRING(jitreport-granularity,
  7612. [  --jitreport-granularity=N
  7613.                           Default granularity at which to report JIT code
  7614.                           to external tools
  7615.                             0 - no info
  7616.                             1 - code ranges for whole functions only
  7617.                             2 - per-line information
  7618.                             3 - per-op information],
  7619.  JITREPORT_GRANULARITY=$withval,
  7620.  JITREPORT_GRANULARITY=3)
  7621.  
  7622. AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
  7623.  
  7624. dnl ========================================================
  7625. dnl =
  7626. dnl = Misc. Options
  7627. dnl =
  7628. dnl ========================================================
  7629. MOZ_ARG_HEADER(Misc. Options)
  7630.  
  7631. dnl ========================================================
  7632. dnl update xterm title
  7633. dnl ========================================================
  7634. MOZ_ARG_ENABLE_BOOL(xterm-updates,
  7635. [  --enable-xterm-updates  Update XTERM titles with current command.],
  7636.    MOZ_UPDATE_XTERM=1,
  7637.    MOZ_UPDATE_XTERM= )
  7638.  
  7639. dnl =========================================================
  7640. dnl = Chrome format
  7641. dnl =========================================================
  7642. MOZ_ARG_ENABLE_STRING([chrome-format],
  7643. [  --enable-chrome-format=jar|flat|omni
  7644.                          Select FORMAT of chrome files during packaging],
  7645.    MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
  7646.  
  7647. if test -z "$MOZ_CHROME_FILE_FORMAT"; then
  7648.    MOZ_CHROME_FILE_FORMAT=jar
  7649. fi
  7650.  
  7651. if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
  7652.    AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
  7653. fi
  7654.  
  7655. if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
  7656.    test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
  7657.    test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
  7658.    AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
  7659. fi
  7660.  
  7661. dnl =========================================================
  7662. dnl Enable support for revamped devtools Performance Tools
  7663. dnl =========================================================
  7664.  
  7665. MOZ_ARG_ENABLE_BOOL(devtools-perf,
  7666. [  --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
  7667. MOZ_DEVTOOLS_PERFTOOLS=1,
  7668. MOZ_DEVTOOLS_PERFTOOLS= )
  7669. if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
  7670.  AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
  7671. fi
  7672. AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
  7673.  
  7674. dnl =========================================================
  7675. dnl Omnijar packaging (bug 552121)
  7676. dnl =========================================================
  7677. dnl Omnijar packaging is compatible with flat packaging.
  7678. dnl In unpackaged builds, omnijar looks for files as if
  7679. dnl things were flat packaged. After packaging, all files
  7680. dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
  7681. dnl is set to flat since putting files into jars is only
  7682. dnl done during packaging with omnijar.
  7683. if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
  7684.    MOZ_OMNIJAR=1
  7685.    AC_DEFINE(MOZ_OMNIJAR)
  7686. fi
  7687. MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
  7688. if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
  7689.    MOZ_CHROME_FILE_FORMAT=flat
  7690. else
  7691.    MOZ_CHROME_FILE_FORMAT=symlink
  7692. fi
  7693.  
  7694. if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
  7695.    dnl Fennec's static resources live in the assets/ folder of the
  7696.     dnl APK.  Adding a path to the name here works because we only
  7697.     dnl have one omnijar file in the final package (which is not the
  7698.     dnl case on desktop), and necessitates some contortions during
  7699.     dnl packaging so that the resources in the omnijar are considered
  7700.     dnl as rooted at / and not as rooted at assets/ (which again is
  7701.     dnl not the case on desktop: there are omnijars rooted at webrtc/,
  7702.     dnl etc). packager.mk handles changing the rooting of the single
  7703.     dnl omnijar.
  7704.     OMNIJAR_NAME=assets/omni.ja
  7705. else
  7706.     OMNIJAR_NAME=omni.ja
  7707. fi
  7708.  
  7709. AC_SUBST(OMNIJAR_NAME)
  7710. AC_SUBST(MOZ_OMNIJAR)
  7711. AC_SUBST(MOZ_PACKAGER_FORMAT)
  7712.  
  7713. dnl ========================================================
  7714. dnl = Define default location for MOZILLA_FIVE_HOME
  7715. dnl ========================================================
  7716. MOZ_ARG_WITH_STRING(default-mozilla-five-home,
  7717. [  --with-default-mozilla-five-home
  7718.                           Set the default value for MOZILLA_FIVE_HOME],
  7719. [ val=`echo $withval`
  7720.   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
  7721.  
  7722. dnl ========================================================
  7723. dnl = Location of the mozilla user directory (default is ~/.mozilla).],
  7724. dnl ========================================================
  7725. MOZ_ARG_WITH_STRING(user-appdir,
  7726. [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
  7727. [ val=`echo $withval`
  7728. if echo "$val" | grep "\/" >/dev/null; then
  7729.     AC_MSG_ERROR("Homedir must be single relative path.")
  7730. else
  7731.     MOZ_USER_DIR="$val"
  7732. fi])
  7733.  
  7734. AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
  7735.  
  7736. dnl ========================================================
  7737. dnl = Doxygen configuration
  7738. dnl ========================================================
  7739. dnl Use commas to specify multiple dirs to this arg
  7740. MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
  7741. MOZ_ARG_WITH_STRING(doc-input-dirs,
  7742. [  --with-doc-input-dirs=DIRS
  7743.                           Header/idl dirs to create docs from],
  7744. [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  7745. AC_SUBST(MOZ_DOC_INPUT_DIRS)
  7746.  
  7747. dnl Use commas to specify multiple dirs to this arg
  7748. MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
  7749. MOZ_ARG_WITH_STRING(doc-include-dirs,
  7750. [  --with-doc-include-dirs=DIRS
  7751.                           Include dirs to preprocess doc headers],
  7752. [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  7753. AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
  7754.  
  7755. MOZ_DOC_OUTPUT_DIR='./dist/docs'
  7756. MOZ_ARG_WITH_STRING(doc-output-dir,
  7757. [  --with-doc-output-dir=DIR
  7758.                           Dir to generate docs into],
  7759. [ MOZ_DOC_OUTPUT_DIR=$withval ] )
  7760. AC_SUBST(MOZ_DOC_OUTPUT_DIR)
  7761.  
  7762. if test -z "$SKIP_COMPILER_CHECKS"; then
  7763. dnl ========================================================
  7764. dnl =
  7765. dnl = Compiler Options
  7766. dnl =
  7767. dnl ========================================================
  7768. MOZ_ARG_HEADER(Compiler Options)
  7769.  
  7770. dnl ========================================================
  7771. dnl Check for gcc -pipe support
  7772. dnl ========================================================
  7773. AC_MSG_CHECKING([for -pipe support])
  7774. if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
  7775.     dnl Any gcc that supports firefox supports -pipe.
  7776.     CFLAGS="$CFLAGS -pipe"
  7777.     CXXFLAGS="$CXXFLAGS -pipe"
  7778.     AC_MSG_RESULT([yes])
  7779. else
  7780.     AC_MSG_RESULT([no])
  7781. fi
  7782.  
  7783. dnl ========================================================
  7784. dnl Profile guided optimization (gcc checks)
  7785. dnl ========================================================
  7786. dnl Test for profiling options
  7787. dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
  7788.  
  7789. _SAVE_CFLAGS="$CFLAGS"
  7790. CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
  7791.  
  7792. AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
  7793. AC_TRY_COMPILE([], [return 0;],
  7794.                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
  7795.                  result="yes" ], result="no")
  7796. AC_MSG_RESULT([$result])
  7797.  
  7798. if test $result = "yes"; then
  7799.   PROFILE_GEN_LDFLAGS="-fprofile-generate"
  7800.   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
  7801.   PROFILE_USE_LDFLAGS="-fprofile-use"
  7802. fi
  7803.  
  7804. CFLAGS="$_SAVE_CFLAGS"
  7805.  
  7806. if test -n "$INTEL_CC"; then
  7807.   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
  7808.   PROFILE_GEN_LDFLAGS=
  7809.   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
  7810.   PROFILE_USE_LDFLAGS=
  7811. fi
  7812.  
  7813. dnl Sun Studio on Solaris
  7814. if test "$SOLARIS_SUNPRO_CC"; then
  7815.   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
  7816.   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
  7817.   PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
  7818.   PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
  7819. fi
  7820.  
  7821. AC_SUBST(PROFILE_GEN_CFLAGS)
  7822. AC_SUBST(PROFILE_GEN_LDFLAGS)
  7823. AC_SUBST(PROFILE_USE_CFLAGS)
  7824. AC_SUBST(PROFILE_USE_LDFLAGS)
  7825.  
  7826. dnl =============================================
  7827. dnl Support for -fno-integrated-as (recent clang)
  7828. dnl =============================================
  7829. dnl Under clang 3.4+, use -fno-integrated-as to
  7830. dnl build libvpx's vp8_asm_enc_offsets.c
  7831.  
  7832. _SAVE_CFLAGS="$CFLAGS"
  7833. CFLAGS="$CFLAGS -fno-integrated-as -S"
  7834.  
  7835. AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
  7836. AC_TRY_COMPILE([], [return 0;],
  7837.                [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
  7838.                  result="yes" ], result="no")
  7839. AC_MSG_RESULT([$result])
  7840.  
  7841. CFLAGS="$_SAVE_CFLAGS"
  7842.  
  7843. AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
  7844.  
  7845. fi # ! SKIP_COMPILER_CHECKS
  7846.  
  7847. AC_DEFINE(CPP_THROW_NEW, [throw()])
  7848. AC_LANG_C
  7849.  
  7850. if test "$COMPILE_ENVIRONMENT"; then
  7851. MOZ_EXPAND_LIBS
  7852. fi # COMPILE_ENVIRONMENT
  7853.  
  7854. dnl ========================================================
  7855. dnl =
  7856. dnl = Build depencency options
  7857. dnl =
  7858. dnl ========================================================
  7859. MOZ_ARG_HEADER(Build dependencies)
  7860.  
  7861. if test "$GNU_CC" -a "$GNU_CXX"; then
  7862.   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
  7863. dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
  7864. elif test "$SOLARIS_SUNPRO_CC"; then
  7865.   _DEPEND_CFLAGS=
  7866. else
  7867.   dnl Don't override this for MSVC
  7868.   if test -z "$_WIN32_MSVC"; then
  7869.     _USE_CPP_INCLUDE_FLAG=
  7870.     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  7871.     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  7872.   else
  7873.     echo '#include <stdio.h>' > dummy-hello.c
  7874.     changequote(,)
  7875.     dnl This output is localized, split at the first double space or colon and space.
  7876.     _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
  7877.     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
  7878.     _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
  7879.     changequote([,])
  7880.     if ! test -e "$_CL_STDIO_PATH"; then
  7881.         AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
  7882.    fi
  7883.    if test -z "$CL_INCLUDES_PREFIX"; then
  7884.        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
  7885.    fi
  7886.    AC_SUBST(CL_INCLUDES_PREFIX)
  7887.    rm -f dummy-hello.c
  7888.  
  7889.    dnl Make sure that the build system can handle non-ASCII characters
  7890.    dnl in environment variables to prevent it from breaking silently on
  7891.    dnl non-English systems.
  7892.    NONASCII=$'\241\241'
  7893.    AC_SUBST(NONASCII)
  7894.  fi
  7895. fi
  7896.  
  7897. dnl ========================================================
  7898. dnl =
  7899. dnl = Static Build Options
  7900. dnl =
  7901. dnl ========================================================
  7902. MOZ_ARG_HEADER(Static build options)
  7903.  
  7904. if test -n "$GKMEDIAS_SHARED_LIBRARY"; then
  7905.  AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
  7906. fi
  7907. AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
  7908.  
  7909. if test -z "$MOZ_NATIVE_ZLIB"; then
  7910. if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
  7911.  ZLIB_IN_MOZGLUE=1
  7912.  AC_DEFINE(ZLIB_IN_MOZGLUE)
  7913. fi
  7914. fi
  7915.  
  7916. AC_SUBST(ZLIB_IN_MOZGLUE)
  7917.  
  7918. dnl ========================================================
  7919. dnl =
  7920. dnl = Standalone module options
  7921. dnl =
  7922. dnl ========================================================
  7923. MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
  7924.  
  7925. dnl Check for GLib.
  7926. dnl ========================================================
  7927.  
  7928. if test -z "$SKIP_PATH_CHECKS"; then
  7929. if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
  7930.    if test "$MOZ_ENABLE_GTK" ; then
  7931.        PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
  7932.    fi
  7933. fi
  7934. fi
  7935.  
  7936. if test -z "${GLIB_GMODULE_LIBS}" \
  7937.   -a -n "${GLIB_CONFIG}"\
  7938.    -a "${GLIB_CONFIG}" != no\
  7939. ; then
  7940.    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
  7941. fi
  7942.  
  7943. AC_SUBST_LIST(GLIB_GMODULE_LIBS)
  7944.  
  7945. dnl ========================================================
  7946. dnl Graphics checks.
  7947. dnl ========================================================
  7948.  
  7949. if test "${OS_TARGET}" = "WINNT" -o \
  7950.        "${OS_ARCH}" = "Darwin" -o \
  7951.        "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
  7952.        "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
  7953.        "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
  7954.        "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
  7955.    case "${target_cpu}" in
  7956.    i*86*|x86_64|arm)
  7957.        MOZ_ENABLE_SKIA=1
  7958.        ;;
  7959.    *)
  7960.        MOZ_ENABLE_SKIA=
  7961.        ;;
  7962.    esac
  7963. else
  7964. MOZ_ENABLE_SKIA=
  7965. fi
  7966.  
  7967. MOZ_ARG_ENABLE_BOOL(skia,
  7968. [  --enable-skia   Enable use of Skia],
  7969. MOZ_ENABLE_SKIA=1,
  7970. MOZ_ENABLE_SKIA=)
  7971.  
  7972. MOZ_ARG_DISABLE_BOOL(skia-gpu,
  7973. [  --disable-skia-gpu  Disable use of Skia-GPU],
  7974. MOZ_DISABLE_SKIA_GPU=1,
  7975. MOZ_DISABLE_SKIA_GPU=)
  7976.  
  7977. if test "$USE_FC_FREETYPE"; then
  7978.    if test "$COMPILE_ENVIRONMENT"; then
  7979.        dnl ========================================================
  7980.        dnl = Check for freetype2 and its functionality
  7981.        dnl ========================================================
  7982.        PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
  7983.  
  7984.        if test "$_HAVE_FREETYPE2"; then
  7985.            _SAVE_LIBS="$LIBS"
  7986.            _SAVE_CFLAGS="$CFLAGS"
  7987.            LIBS="$LIBS $FT2_LIBS"
  7988.            CFLAGS="$CFLAGS $FT2_CFLAGS"
  7989.  
  7990.            AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
  7991.                ac_cv_member_FT_Bitmap_Size_y_ppem,
  7992.                [AC_TRY_COMPILE([#include <ft2build.h>
  7993.                                 #include FT_FREETYPE_H],
  7994.                                [FT_Bitmap_Size s;
  7995.                                 if (sizeof s.y_ppem) return 0;
  7996.                                 return 1],
  7997.                                ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
  7998.                                ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
  7999.            if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
  8000.                HAVE_FT_BITMAP_SIZE_Y_PPEM=1
  8001.            else
  8002.                HAVE_FT_BITMAP_SIZE_Y_PPEM=0
  8003.            fi
  8004.            AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
  8005.                               $HAVE_FT_BITMAP_SIZE_Y_PPEM,
  8006.                               [FT_Bitmap_Size structure includes y_ppem field])
  8007.  
  8008.            AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
  8009.  
  8010.            LIBS="$_SAVE_LIBS"
  8011.            CFLAGS="$_SAVE_CFLAGS"
  8012.        fi
  8013.  
  8014.        _SAVE_CPPFLAGS="$CPPFLAGS"
  8015.        CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
  8016.        MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
  8017.            [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
  8018.         CPPFLAGS="$_SAVE_CPPFLAGS"
  8019.     else
  8020.         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
  8021.     fi
  8022.  
  8023.     PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
  8024.     [
  8025.         if test "$MOZ_PANGO"; then
  8026.             MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
  8027.             MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
  8028.         else
  8029.             FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
  8030.             FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
  8031.         fi
  8032.     ])
  8033. fi
  8034.  
  8035. dnl ========================================================
  8036. dnl Check for pixman and cairo
  8037. dnl ========================================================
  8038.  
  8039. if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
  8040.   # cairo-gtk3 can be build with system-cairo only
  8041.   MOZ_TREE_CAIRO=
  8042. else
  8043.   MOZ_TREE_CAIRO=1
  8044. fi
  8045.  
  8046. MOZ_ARG_ENABLE_BOOL(system-cairo,
  8047. [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
  8048. MOZ_TREE_CAIRO=,
  8049. MOZ_TREE_CAIRO=1 )
  8050.  
  8051. MOZ_TREE_PIXMAN=1
  8052. MOZ_ARG_ENABLE_BOOL(system-pixman,
  8053. [ --enable-system-pixman Use system pixman (located with pkgconfig)],
  8054. MOZ_TREE_PIXMAN=,
  8055. MOZ_TREE_PIXMAN=force,
  8056. MOZ_TREE_PIXMAN=1 )
  8057.  
  8058. # System cairo depends on system pixman
  8059. if test "$MOZ_TREE_PIXMAN" = "force"; then
  8060.     if test -z "$MOZ_TREE_CAIRO"; then
  8061.         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
  8062.     else
  8063.         MOZ_TREE_PIXMAN=1
  8064.     fi
  8065. elif test -z "$MOZ_TREE_CAIRO"; then
  8066.     MOZ_TREE_PIXMAN=
  8067. fi
  8068.  
  8069. if test "$MOZ_TREE_PIXMAN"; then
  8070.     AC_DEFINE(MOZ_TREE_PIXMAN)
  8071. else
  8072.     PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
  8073.     MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
  8074.     MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
  8075. fi
  8076. AC_SUBST(MOZ_PIXMAN_CFLAGS)
  8077. AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
  8078.  
  8079. # Check for headers defining standard int types.
  8080. if test -n "$COMPILE_ENVIRONMENT"; then
  8081.     MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
  8082.  
  8083.     if test "${ac_cv_header_inttypes_h}" = "yes"; then
  8084.         HAVE_INTTYPES_H=1
  8085.     fi
  8086. fi
  8087.  
  8088. AC_SUBST(HAVE_INTTYPES_H)
  8089.  
  8090. if test "$MOZ_TREE_CAIRO"; then
  8091.     MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
  8092.     AC_DEFINE(MOZ_TREE_CAIRO)
  8093.  
  8094.     if test "$OS_ARCH" = "WINNT"; then
  8095.         # For now we assume that we will have a uint64_t available through
  8096.         # one of the above headers or mozstdint.h.
  8097.         AC_DEFINE(HAVE_UINT64_T)
  8098.     fi
  8099.  
  8100.     # Define macros for cairo-features.h
  8101.     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
  8102.     if test "$MOZ_X11"; then
  8103.         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
  8104.         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
  8105.         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
  8106.     fi
  8107.     if test "$_HAVE_FREETYPE2"; then
  8108.         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  8109.         MOZ_ENABLE_CAIRO_FT=1
  8110.         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
  8111.     fi
  8112.  
  8113.     case "$MOZ_WIDGET_TOOLKIT" in
  8114.       qt)
  8115.         QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
  8116.         ;;
  8117.       cocoa | uikit)
  8118.         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
  8119.         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
  8120.         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
  8121.         ;;
  8122.       windows)
  8123.         WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
  8124.         WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
  8125.         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
  8126.         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
  8127.         MOZ_ENABLE_D2D_SURFACE=1
  8128.         MOZ_ENABLE_DWRITE_FONT=1
  8129.  
  8130.         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
  8131.  
  8132.         dnl D3D10 Layers depend on D2D Surfaces.
  8133.         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
  8134.           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
  8135.         fi
  8136.         ;;
  8137.       gtk3)
  8138.         AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
  8139.         ;;
  8140.     esac
  8141.     if test "$USE_FC_FREETYPE"; then
  8142.         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
  8143.     fi
  8144.     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
  8145.     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
  8146.     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
  8147.     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
  8148.     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
  8149.  
  8150.     AC_SUBST(PS_SURFACE_FEATURE)
  8151.     AC_SUBST(PDF_SURFACE_FEATURE)
  8152.     AC_SUBST(SVG_SURFACE_FEATURE)
  8153.     AC_SUBST(XLIB_SURFACE_FEATURE)
  8154.     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
  8155.     AC_SUBST(QUARTZ_SURFACE_FEATURE)
  8156.     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
  8157.     AC_SUBST(WIN32_SURFACE_FEATURE)
  8158.     AC_SUBST(OS2_SURFACE_FEATURE)
  8159.     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
  8160.     AC_SUBST(FT_FONT_FEATURE)
  8161.     AC_SUBST(FC_FONT_FEATURE)
  8162.     AC_SUBST(WIN32_FONT_FEATURE)
  8163.     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
  8164.     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
  8165.     AC_SUBST(QUARTZ_FONT_FEATURE)
  8166.     AC_SUBST(PNG_FUNCTIONS_FEATURE)
  8167.     AC_SUBST(QT_SURFACE_FEATURE)
  8168.     AC_SUBST(TEE_SURFACE_FEATURE)
  8169.  
  8170.     MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
  8171.  
  8172.     if test "$MOZ_X11"; then
  8173.         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
  8174.     fi
  8175.  
  8176.     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
  8177. else
  8178.     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
  8179.     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
  8180.     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
  8181.     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
  8182.     if test "$MOZ_X11"; then
  8183.         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
  8184.         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
  8185.         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
  8186.         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
  8187.     fi
  8188. fi
  8189.  
  8190. AC_SUBST(MOZ_TREE_CAIRO)
  8191. AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
  8192. AC_SUBST_LIST(MOZ_CAIRO_LIBS)
  8193. AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
  8194. AC_SUBST(MOZ_TREE_PIXMAN)
  8195.  
  8196. dnl ========================================================
  8197. dnl Skia
  8198. dnl ========================================================
  8199. if test "$MOZ_ENABLE_SKIA"; then
  8200.   AC_DEFINE(MOZ_ENABLE_SKIA)
  8201.   AC_DEFINE(USE_SKIA)
  8202.   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
  8203.     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
  8204.   fi
  8205.  
  8206.   if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
  8207.     MOZ_ENABLE_SKIA_GPU=1
  8208.     AC_DEFINE(USE_SKIA_GPU)
  8209.     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
  8210.   fi
  8211. fi
  8212. AC_SUBST(MOZ_ENABLE_SKIA)
  8213.  
  8214. dnl ========================================================
  8215. dnl disable xul
  8216. dnl ========================================================
  8217. MOZ_ARG_DISABLE_BOOL(xul,
  8218. [  --disable-xul           Disable XUL],
  8219.     MOZ_XUL= )
  8220. if test "$MOZ_XUL"; then
  8221.   AC_DEFINE(MOZ_XUL)
  8222. else
  8223.   dnl remove extensions that require XUL
  8224.   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
  8225. fi
  8226.  
  8227. AC_SUBST(MOZ_XUL)
  8228.  
  8229. dnl ========================================================
  8230. dnl disable profile locking
  8231. dnl   do no use this in applications that can have more than
  8232. dnl   one process accessing the profile directory.
  8233. dnl ========================================================
  8234. MOZ_ARG_DISABLE_BOOL(profilelocking,
  8235. [  --disable-profilelocking
  8236.                           Disable profile locking],
  8237.     MOZ_PROFILELOCKING=,
  8238.     MOZ_PROFILELOCKING=1 )
  8239. if test "$MOZ_PROFILELOCKING"; then
  8240.   AC_DEFINE(MOZ_PROFILELOCKING)
  8241. fi
  8242.  
  8243. dnl ========================================================
  8244. dnl necko configuration options
  8245. dnl ========================================================
  8246.  
  8247. dnl
  8248. dnl option to disable various necko protocols
  8249. dnl
  8250. MOZ_ARG_ENABLE_STRING(necko-protocols,
  8251. [  --enable-necko-protocols[={http,ftp,default,all,none}]
  8252.                           Enable/disable specific protocol handlers],
  8253. [ for option in `echo $enableval | sed 's/,/ /g'`; do
  8254.     if test "$option" = "yes" -o "$option" = "all"; then
  8255.         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
  8256.     elif test "$option" = "no" -o "$option" = "none"; then
  8257.         NECKO_PROTOCOLS=""
  8258.     elif test "$option" = "default"; then
  8259.         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
  8260.     elif test `echo "$option" | grep -c \^-` != 0; then
  8261.         option=`echo $option | sed 's/^-//'`
  8262.         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
  8263.     else
  8264.         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
  8265.     fi
  8266. done],
  8267.     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
  8268. dnl Remove dupes
  8269. NECKO_PROTOCOLS=`$PYTHON ${srcdir}/build/unix/uniq.py ${NECKO_PROTOCOLS}`
  8270. AC_SUBST_SET(NECKO_PROTOCOLS)
  8271. for p in $NECKO_PROTOCOLS; do
  8272.     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
  8273.     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
  8274. done
  8275.  
  8276. dnl
  8277. dnl option to disable necko's wifi scanner
  8278. dnl
  8279.  
  8280. case "$OS_TARGET" in
  8281.   Android)
  8282.     if test -n "$gonkdir"; then
  8283.       NECKO_WIFI=1
  8284.     fi
  8285.     ;;
  8286.   Darwin|DragonFly|FreeBSD|SunOS|WINNT)
  8287.     NECKO_WIFI=1
  8288.     ;;
  8289.   Linux)
  8290.     NECKO_WIFI=1
  8291.     NECKO_WIFI_DBUS=1
  8292.     ;;
  8293. esac
  8294.  
  8295. MOZ_ARG_DISABLE_BOOL(necko-wifi,
  8296. [  --disable-necko-wifi    Disable necko wifi scanner],
  8297.     NECKO_WIFI=,
  8298.     NECKO_WIFI=1)
  8299.  
  8300. if test "$NECKO_WIFI"; then
  8301.   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
  8302.     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
  8303.   fi
  8304.   AC_DEFINE(NECKO_WIFI)
  8305.   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
  8306. fi
  8307. AC_SUBST(NECKO_WIFI)
  8308. AC_SUBST(NECKO_WIFI_DBUS)
  8309.  
  8310. dnl
  8311. dnl option to disable cookies
  8312. dnl
  8313. MOZ_ARG_DISABLE_BOOL(cookies,
  8314. [  --disable-cookies       Disable cookie support],
  8315.     NECKO_COOKIES=,
  8316.     NECKO_COOKIES=1)
  8317. AC_SUBST(NECKO_COOKIES)
  8318. if test "$NECKO_COOKIES"; then
  8319.     AC_DEFINE(NECKO_COOKIES)
  8320.     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
  8321. fi
  8322.  
  8323. dnl
  8324. dnl Always build Marionette if not Android or B2G
  8325. dnl
  8326. if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  8327.     AC_DEFINE(ENABLE_MARIONETTE)
  8328. fi
  8329. AC_SUBST(ENABLE_MARIONETTE)
  8330. if test "$ENABLE_MARIONETTE"; then
  8331.     AC_DEFINE(ENABLE_MARIONETTE)
  8332. fi
  8333.  
  8334. dnl
  8335. dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
  8336. dnl
  8337. MOZ_ARG_DISABLE_BOOL(ctypes,
  8338. [  --disable-ctypes        Disable js-ctypes],
  8339.     BUILD_CTYPES=,
  8340.     BUILD_CTYPES=1)
  8341. AC_SUBST(BUILD_CTYPES)
  8342. if test "$BUILD_CTYPES"; then
  8343.     AC_DEFINE(BUILD_CTYPES)
  8344. fi
  8345.  
  8346. dnl Build Places if required
  8347. if test "$MOZ_PLACES"; then
  8348.   AC_DEFINE(MOZ_PLACES)
  8349. fi
  8350.  
  8351. dnl Build SocialAPI if required
  8352. if test "$MOZ_SOCIAL"; then
  8353.   AC_DEFINE(MOZ_SOCIAL)
  8354. fi
  8355.  
  8356. dnl Build Common JS modules provided by services.
  8357. AC_SUBST(MOZ_SERVICES_COMMON)
  8358. if test -n "$MOZ_SERVICES_COMMON"; then
  8359.   AC_DEFINE(MOZ_SERVICES_COMMON)
  8360. fi
  8361.  
  8362. dnl Build Services crypto component (used by Sync)
  8363. AC_SUBST(MOZ_SERVICES_CRYPTO)
  8364. if test -n "$MOZ_SERVICES_CRYPTO"; then
  8365.   AC_DEFINE(MOZ_SERVICES_CRYPTO)
  8366. fi
  8367.  
  8368. dnl Build Firefox Health Reporter Service
  8369. AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
  8370. if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
  8371.   AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
  8372. fi
  8373.  
  8374. dnl Build Services metrics component
  8375. AC_SUBST(MOZ_SERVICES_METRICS)
  8376. if test -n "$MOZ_SERVICES_METRICS"; then
  8377.   AC_DEFINE(MOZ_SERVICES_METRICS)
  8378. fi
  8379.  
  8380. dnl Build Notifications if required
  8381. AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
  8382. if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
  8383.   AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
  8384. fi
  8385.  
  8386. dnl Build Sync Services if required
  8387. AC_SUBST(MOZ_SERVICES_SYNC)
  8388. if test -n "$MOZ_SERVICES_SYNC"; then
  8389.   AC_DEFINE(MOZ_SERVICES_SYNC)
  8390. fi
  8391.  
  8392. dnl Build Services/CloudSync if required
  8393. AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
  8394. if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
  8395.   AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
  8396. fi
  8397.  
  8398. dnl Build Captive Portal Detector if required
  8399. AC_SUBST(MOZ_CAPTIVEDETECT)
  8400. if test -n "$MOZ_CAPTIVEDETECT"; then
  8401.   AC_DEFINE(MOZ_CAPTIVEDETECT)
  8402. fi
  8403.  
  8404. dnl Build second screen and casting features for external devices if required
  8405. AC_SUBST(MOZ_DEVICES)
  8406. if test -n "$MOZ_DEVICES"; then
  8407.   AC_DEFINE(MOZ_DEVICES)
  8408. fi
  8409.  
  8410. dnl ========================================================
  8411. if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
  8412.     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  8413. fi
  8414.  
  8415. dnl ========================================================
  8416. dnl =
  8417. dnl = Maintainer debug option (no --enable equivalent)
  8418. dnl =
  8419. dnl ========================================================
  8420.  
  8421. AC_SUBST(AR)
  8422. AC_SUBST(AR_FLAGS)
  8423. AC_SUBST(AR_LIST)
  8424. AC_SUBST(AR_EXTRACT)
  8425. AC_SUBST(AR_DELETE)
  8426. AC_SUBST(AS)
  8427. AC_SUBST(ASFLAGS)
  8428. AC_SUBST(AS_DASH_C_FLAG)
  8429. AC_SUBST(LD)
  8430. AC_SUBST(RC)
  8431. AC_SUBST(RCFLAGS)
  8432. AC_SUBST(MC)
  8433. AC_SUBST(WINDRES)
  8434. AC_SUBST(IMPLIB)
  8435. AC_SUBST(FILTER)
  8436. AC_SUBST(BIN_FLAGS)
  8437. AC_SUBST(MOZ_WIDGET_TOOLKIT)
  8438. AC_SUBST(MOZ_UPDATE_XTERM)
  8439. AC_SUBST(MOZ_AUTH_EXTENSION)
  8440. AC_SUBST(MOZ_PERMISSIONS)
  8441. AC_SUBST(MOZ_PREF_EXTENSIONS)
  8442. AC_SUBST(MOZ_DEBUG)
  8443. AC_SUBST(MOZ_DEBUG_SYMBOLS)
  8444. AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
  8445. AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
  8446. AC_SUBST(MOZ_DEBUG_LDFLAGS)
  8447. AC_SUBST(WARNINGS_AS_ERRORS)
  8448. AC_SUBST(MOZ_EXTENSIONS)
  8449. AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
  8450. AC_SUBST(MOZ_JPROF)
  8451. AC_SUBST(MOZ_SHARK)
  8452. AC_SUBST(MOZ_INSTRUMENTS)
  8453. AC_SUBST(MOZ_CALLGRIND)
  8454. AC_SUBST(MOZ_VTUNE)
  8455. AC_SUBST(MOZ_PROFILING)
  8456. AC_SUBST(LIBICONV)
  8457. AC_SUBST(MOZ_PLACES)
  8458. AC_SUBST(MOZ_SOCIAL)
  8459. AC_SUBST(MOZ_TOOLKIT_SEARCH)
  8460. AC_SUBST(MOZ_FEEDS)
  8461. AC_SUBST(NS_PRINTING)
  8462. AC_SUBST(MOZ_HELP_VIEWER)
  8463. AC_SUBST(TOOLCHAIN_PREFIX)
  8464.  
  8465. AC_SUBST(JAVA)
  8466. AC_SUBST(JAVAC)
  8467. AC_SUBST(JAVAH)
  8468. AC_SUBST(JAR)
  8469. AC_SUBST(JARSIGNER)
  8470. AC_SUBST(KEYTOOL)
  8471.  
  8472. AC_SUBST(MOZ_PROFILELOCKING)
  8473.  
  8474. AC_SUBST(ENABLE_TESTS)
  8475. AC_SUBST(MOZ_UNIVERSALCHARDET)
  8476. AC_SUBST(ACCESSIBILITY)
  8477. AC_SUBST(MOZ_SPELLCHECK)
  8478. AC_SUBST(MOZ_ANDROID_APZ)
  8479. AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
  8480. AC_SUBST(MOZ_CRASHREPORTER)
  8481. AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
  8482. AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
  8483. AC_SUBST(MOZ_MAINTENANCE_SERVICE)
  8484. AC_SUBST(MOZ_STUB_INSTALLER)
  8485. AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
  8486. AC_SUBST(MOZ_ENABLE_SIGNMAR)
  8487. AC_SUBST(MOZ_UPDATER)
  8488.  
  8489. AC_SUBST(MOZ_ANGLE_RENDERER)
  8490. AC_SUBST(MOZ_D3D_CPU_SUFFIX)
  8491. AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
  8492. AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
  8493. AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
  8494. AC_SUBST(MOZ_DIRECTX_SDK_PATH)
  8495. AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
  8496. AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
  8497.  
  8498. AC_SUBST(MOZ_METRO)
  8499.  
  8500. AC_SUBST(MOZ_ANDROID_HISTORY)
  8501. AC_SUBST(MOZ_WEBSMS_BACKEND)
  8502. AC_SUBST(MOZ_ANDROID_BEAM)
  8503. AC_SUBST(MOZ_LOCALE_SWITCHER)
  8504. AC_SUBST(MOZ_DISABLE_GECKOVIEW)
  8505. AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
  8506. AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
  8507. AC_SUBST(MOZ_ANDROID_NEW_TABLET_UI)
  8508. AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
  8509. AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
  8510. AC_SUBST(ENABLE_STRIP)
  8511. AC_SUBST(PKG_SKIP_STRIP)
  8512. AC_SUBST(STRIP_FLAGS)
  8513. AC_SUBST(USE_ELF_HACK)
  8514. AC_SUBST(INCREMENTAL_LINKER)
  8515. AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
  8516. AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
  8517.  
  8518. AC_SUBST(MOZ_FIX_LINK_PATHS)
  8519.  
  8520. AC_SUBST(USE_DEPENDENT_LIBS)
  8521.  
  8522. AC_SUBST(MOZ_BUILD_ROOT)
  8523.  
  8524. AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
  8525. AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  8526. AC_SUBST(MOZ_LINKER_EXTRACT)
  8527.  
  8528. AC_SUBST(MOZ_JSDOWNLOADS)
  8529. if test -n "$MOZ_JSDOWNLOADS"; then
  8530.   AC_DEFINE(MOZ_JSDOWNLOADS)
  8531. fi
  8532.  
  8533. dnl ========================================================
  8534. dnl = Mac bundle name prefix
  8535. dnl ========================================================
  8536. MOZ_ARG_WITH_STRING(macbundlename-prefix,
  8537. [  --with-macbundlename-prefix=prefix
  8538.                           Prefix for MOZ_MACBUNDLE_NAME],
  8539. [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
  8540.  
  8541. MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
  8542. if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
  8543.   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
  8544. fi
  8545.  
  8546. if test "$MOZ_DEBUG"; then
  8547.   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
  8548. else
  8549.   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
  8550. fi
  8551. AC_SUBST(MOZ_MACBUNDLE_NAME)
  8552.  
  8553. dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
  8554. MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
  8555. MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
  8556. if test "$MOZ_DEBUG"; then
  8557.   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
  8558. fi
  8559.  
  8560. AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
  8561. AC_SUBST(MOZ_MACBUNDLE_ID)
  8562.  
  8563. dnl ========================================================
  8564. dnl = Child Process Name for IPC
  8565. dnl ========================================================
  8566. if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
  8567.   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
  8568. else
  8569.   # We want to let Android unpack the file at install time, but it only does
  8570.   # so if the file is named libsomething.so. The lib/ path is also required
  8571.   # because the unpacked file will be under the lib/ subdirectory and will
  8572.   # need to be executed from that path.
  8573.   MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
  8574. fi
  8575. MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
  8576.  
  8577. AC_SUBST(MOZ_CHILD_PROCESS_NAME)
  8578. AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
  8579.  
  8580. # The following variables are available to branding and application
  8581. # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
  8582. # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
  8583. # impacts profile location and user-visible fields.
  8584. # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
  8585. # versions of a given application (e.g. Aurora and Firefox both use
  8586. # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
  8587. # for application.ini's "Name" field, which controls profile location in
  8588. # the absence of a "Profile" field (see below), and various system
  8589. # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
  8590. # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
  8591. # Mac Bundle name, Updater, Installer), it is typically used for nightly
  8592. # builds (e.g. Aurora for Firefox).
  8593. # - MOZ_APP_VERSION: Defines the application version number.
  8594. # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
  8595. # defaults to a lowercase form of MOZ_APP_BASENAME.
  8596. # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
  8597. # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
  8598. # - MOZ_APP_PROFILE: When set, used for application.ini's
  8599. # "Profile" field, which controls profile location.
  8600. # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
  8601. # crash reporter server url.
  8602. # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
  8603.  
  8604. if test -z "$MOZ_APP_NAME"; then
  8605.    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
  8606. fi
  8607.  
  8608. if test -z "$MOZ_APP_REMOTINGNAME"; then
  8609.    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
  8610. fi
  8611.  
  8612. # For extensions and langpacks, we require a max version that is compatible
  8613. # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
  8614. # 24.0a1 and 24.0a2 aren't affected
  8615. # 24.0 becomes 24.*
  8616. # 24.1.1 becomes 24.*
  8617. IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
  8618. if test -z "$IS_ALPHA"; then
  8619.   changequote(,)
  8620.   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
  8621.   changequote([,])
  8622. else
  8623.   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
  8624. fi
  8625.  
  8626. MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
  8627. AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
  8628. AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
  8629.  
  8630. AC_SUBST(MOZ_APP_NAME)
  8631. AC_SUBST(MOZ_APP_REMOTINGNAME)
  8632. AC_SUBST(MOZ_APP_DISPLAYNAME)
  8633. AC_SUBST(MOZ_APP_BASENAME)
  8634. AC_SUBST(MOZ_APP_VENDOR)
  8635. AC_SUBST(MOZ_APP_PROFILE)
  8636. AC_SUBST(MOZ_APP_ID)
  8637. AC_SUBST(MAR_CHANNEL_ID)
  8638. AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
  8639. AC_SUBST(MOZ_PROFILE_MIGRATOR)
  8640. AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
  8641. AC_SUBST(MOZ_APP_UA_NAME)
  8642. AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
  8643. AC_SUBST(MOZ_APP_VERSION)
  8644. AC_SUBST(MOZ_APP_MAXVERSION)
  8645. AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
  8646. AC_SUBST(FIREFOX_VERSION)
  8647. AC_SUBST(MOZ_UA_OS_AGNOSTIC)
  8648. if test -n "$MOZ_UA_OS_AGNOSTIC"; then
  8649.   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
  8650. fi
  8651.  
  8652. AC_SUBST(MOZ_APP_STATIC_INI)
  8653.  
  8654. AC_SUBST(MOZ_PKG_SPECIAL)
  8655.  
  8656. AC_SUBST(MOZILLA_OFFICIAL)
  8657.  
  8658. AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
  8659. AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
  8660.  
  8661. if test "$MOZ_TELEMETRY_REPORTING"; then
  8662.     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
  8663.  
  8664.     # Enable Telemetry by default for nightly and aurora channels
  8665.     if test -z "$RELEASE_BUILD"; then
  8666.       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
  8667.     fi
  8668. fi
  8669.  
  8670. dnl If we have any service that uploads data (and requires data submission
  8671. dnl policy alert), set MOZ_DATA_REPORTING.
  8672. dnl We need SUBST for build system and DEFINE for xul preprocessor.
  8673. if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
  8674.   MOZ_DATA_REPORTING=1
  8675.   AC_DEFINE(MOZ_DATA_REPORTING)
  8676.   AC_SUBST(MOZ_DATA_REPORTING)
  8677. fi
  8678.  
  8679. dnl win32 options
  8680. AC_SUBST(MOZ_BROWSE_INFO)
  8681. AC_SUBST(MOZ_TOOLS_DIR)
  8682. AC_SUBST(WIN32_REDIST_DIR)
  8683. AC_SUBST(MAKENSISU)
  8684.  
  8685. dnl Echo the CFLAGS to remove extra whitespace.
  8686. CFLAGS=`echo \
  8687.     $_WARNINGS_CFLAGS \
  8688.     $CFLAGS`
  8689.  
  8690. CXXFLAGS=`echo \
  8691.     $_WARNINGS_CXXFLAGS \
  8692.     $CXXFLAGS`
  8693.  
  8694. COMPILE_CFLAGS=`echo \
  8695.     $_DEFINES_CFLAGS \
  8696.     $_DEPEND_CFLAGS \
  8697.     $COMPILE_CFLAGS`
  8698.  
  8699. COMPILE_CXXFLAGS=`echo \
  8700.     $_DEFINES_CXXFLAGS \
  8701.     $_DEPEND_CFLAGS \
  8702.     $COMPILE_CXXFLAGS`
  8703.  
  8704. HOST_CFLAGS=`echo \
  8705.     $HOST_CFLAGS \
  8706.     $_DEPEND_CFLAGS`
  8707.  
  8708. HOST_CXXFLAGS=`echo \
  8709.     $HOST_CXXFLAGS \
  8710.     $_DEPEND_CFLAGS`
  8711.  
  8712. AC_SUBST(MOZ_NATIVE_JPEG)
  8713. AC_SUBST(MOZ_NATIVE_PNG)
  8714. AC_SUBST(MOZ_NATIVE_BZ2)
  8715.  
  8716. AC_SUBST(MOZ_JPEG_CFLAGS)
  8717. AC_SUBST_LIST(MOZ_JPEG_LIBS)
  8718. AC_SUBST(MOZ_BZ2_CFLAGS)
  8719. AC_SUBST_LIST(MOZ_BZ2_LIBS)
  8720. AC_SUBST(MOZ_PNG_CFLAGS)
  8721. AC_SUBST_LIST(MOZ_PNG_LIBS)
  8722.  
  8723. if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
  8724.     export MOZ_NUWA_PROCESS
  8725.     AC_DEFINE(MOZ_NUWA_PROCESS)
  8726. fi
  8727. AC_SUBST(MOZ_NUWA_PROCESS)
  8728. if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
  8729.     if test -z "$MOZ_NUWA_PROCESS"; then
  8730.        AC_MSG_ERROR([B2G loader works with Nuwa]);
  8731.     fi
  8732.     export MOZ_B2G_LOADER
  8733.     AC_DEFINE(MOZ_B2G_LOADER)
  8734. fi
  8735. AC_SUBST(MOZ_B2G_LOADER)
  8736.  
  8737. AC_SUBST(NSPR_CFLAGS)
  8738. AC_SUBST(MOZ_NATIVE_NSPR)
  8739.  
  8740. AC_SUBST(NSS_CFLAGS)
  8741. AC_SUBST(MOZ_NATIVE_NSS)
  8742. AC_SUBST(NSS_DISABLE_DBM)
  8743.  
  8744. OS_CFLAGS="$CFLAGS"
  8745. OS_CXXFLAGS="$CXXFLAGS"
  8746. OS_CPPFLAGS="$CPPFLAGS"
  8747. OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
  8748. OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
  8749. OS_LDFLAGS="$LDFLAGS"
  8750. OS_LIBS="$LIBS"
  8751. AC_SUBST(OS_CFLAGS)
  8752. AC_SUBST(OS_CXXFLAGS)
  8753. AC_SUBST(OS_CPPFLAGS)
  8754. AC_SUBST(OS_COMPILE_CFLAGS)
  8755. AC_SUBST(OS_COMPILE_CXXFLAGS)
  8756. AC_SUBST(OS_LDFLAGS)
  8757. AC_SUBST(OS_LIBS)
  8758. AC_SUBST(CROSS_COMPILE)
  8759. AC_SUBST(WCHAR_CFLAGS)
  8760.  
  8761. AC_SUBST(HOST_CC)
  8762. AC_SUBST(HOST_CXX)
  8763. AC_SUBST(HOST_CFLAGS)
  8764. AC_SUBST(HOST_CXXFLAGS)
  8765. AC_SUBST(HOST_LDFLAGS)
  8766. AC_SUBST(HOST_OPTIMIZE_FLAGS)
  8767. AC_SUBST(HOST_AR)
  8768. AC_SUBST(HOST_AR_FLAGS)
  8769. AC_SUBST(HOST_LD)
  8770. AC_SUBST(HOST_RANLIB)
  8771. AC_SUBST(HOST_NSPR_MDCPUCFG)
  8772. AC_SUBST(HOST_BIN_SUFFIX)
  8773. AC_SUBST(HOST_OS_ARCH)
  8774.  
  8775. AC_SUBST(TARGET_CPU)
  8776. AC_SUBST(TARGET_VENDOR)
  8777. AC_SUBST(TARGET_OS)
  8778. AC_SUBST(TARGET_NSPR_MDCPUCFG)
  8779. AC_SUBST(TARGET_MD_ARCH)
  8780. AC_SUBST(TARGET_XPCOM_ABI)
  8781. AC_SUBST(OS_TARGET)
  8782. AC_SUBST(OS_ARCH)
  8783. AC_SUBST(OS_RELEASE)
  8784. AC_SUBST(OS_TEST)
  8785. AC_SUBST(CPU_ARCH)
  8786. AC_SUBST(INTEL_ARCHITECTURE)
  8787. AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
  8788. AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
  8789. AC_SUBST(HAVE_X86_AVX2)
  8790. AC_SUBST(GCC_USE_GNU_LD)
  8791.  
  8792. AC_SUBST(MOZ_CHROME_FILE_FORMAT)
  8793.  
  8794. AC_SUBST(WRAP_LDFLAGS)
  8795. AC_SUBST(MKSHLIB)
  8796. AC_SUBST(MKCSHLIB)
  8797. AC_SUBST(MKSHLIB_FORCE_ALL)
  8798. AC_SUBST(MKSHLIB_UNFORCE_ALL)
  8799. AC_SUBST(DSO_CFLAGS)
  8800. AC_SUBST(DSO_PIC_CFLAGS)
  8801. AC_SUBST(DSO_LDOPTS)
  8802. AC_SUBST(LIB_PREFIX)
  8803. AC_SUBST(DLL_PREFIX)
  8804. AC_SUBST(DLL_SUFFIX)
  8805. AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
  8806. AC_SUBST(LIB_SUFFIX)
  8807. AC_SUBST(OBJ_SUFFIX)
  8808. AC_SUBST(BIN_SUFFIX)
  8809. AC_SUBST(ASM_SUFFIX)
  8810. AC_SUBST(IMPORT_LIB_SUFFIX)
  8811. AC_SUBST(USE_N32)
  8812. AC_SUBST(CC_VERSION)
  8813. AC_SUBST(CXX_VERSION)
  8814. AC_SUBST(MSMANIFEST_TOOL)
  8815. AC_SUBST(NS_ENABLE_TSF)
  8816. AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
  8817. AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
  8818.  
  8819. AC_SUBST(MOZ_WAVE)
  8820. AC_SUBST(MOZ_VORBIS)
  8821. AC_SUBST(MOZ_TREMOR)
  8822. AC_SUBST(MOZ_WEBM)
  8823. AC_SUBST(MOZ_WMF)
  8824. AC_SUBST(MOZ_FFMPEG)
  8825. AC_SUBST(MOZ_FMP4)
  8826. AC_SUBST(MOZ_EME)
  8827. AC_SUBST(MOZ_DIRECTSHOW)
  8828. AC_SUBST(MOZ_ANDROID_OMX)
  8829. AC_SUBST(MOZ_APPLEMEDIA)
  8830. AC_SUBST(MOZ_OMX_PLUGIN)
  8831. AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
  8832. AC_SUBST(MOZ_VPX)
  8833. AC_SUBST(VPX_AS)
  8834. AC_SUBST(VPX_ASFLAGS)
  8835. AC_SUBST(VPX_DASH_C_FLAG)
  8836. AC_SUBST(VPX_AS_CONVERSION)
  8837. AC_SUBST(VPX_ASM_SUFFIX)
  8838. AC_SUBST(VPX_X86_ASM)
  8839. AC_SUBST(VPX_ARM_ASM)
  8840. AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
  8841. AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
  8842. AC_SUBST(MOZ_CODE_COVERAGE)
  8843. AC_SUBST(LIBJPEG_TURBO_AS)
  8844. AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
  8845. AC_SUBST(LIBJPEG_TURBO_X86_ASM)
  8846. AC_SUBST(LIBJPEG_TURBO_X64_ASM)
  8847. AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
  8848.  
  8849. AC_SUBST(MOZ_PACKAGE_JSSHELL)
  8850. AC_SUBST(MOZ_FOLD_LIBS)
  8851.  
  8852. AC_SUBST(MOZ_ENABLE_SZIP)
  8853. AC_SUBST(MOZ_SZIP_FLAGS)
  8854.  
  8855. dnl Host JavaScript runtime, if any, to use during cross compiles.
  8856. AC_SUBST(JS_BINARY)
  8857.  
  8858. if test "$MOZ_DEBUG"; then
  8859.     MOZ_EM_DEBUG=1
  8860. fi
  8861. AC_SUBST(MOZ_EM_DEBUG)
  8862.  
  8863. AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
  8864.  
  8865. if test -n "$COMPILE_ENVIRONMENT"; then
  8866. AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
  8867.  
  8868. dnl Check for missing components
  8869. if test "$MOZ_X11"; then
  8870.     if test "$WITHOUT_X11"; then
  8871.         AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
  8872.     fi
  8873.     dnl ====================================================
  8874.     dnl = Check if X headers exist
  8875.     dnl ====================================================
  8876.     _SAVE_CFLAGS=$CFLAGS
  8877.     CFLAGS="$CFLAGS $XCFLAGS"
  8878.     AC_TRY_COMPILE([
  8879.         #include <stdio.h>
  8880.         #include <stdlib.h>
  8881.         #include <X11/Xlib.h>
  8882.         #include <X11/Intrinsic.h>
  8883.         #include <X11/extensions/XShm.h>
  8884.     ],
  8885.     [
  8886.         Display *dpy = 0;
  8887.         if ((dpy = XOpenDisplay(NULL)) == NULL) {
  8888.             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
  8889.             exit(1);
  8890.         }
  8891.     ], [],
  8892.     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
  8893.    CFLAGS="$_SAVE_CFLAGS"
  8894.  
  8895.    if test -n "$MISSING_X"; then
  8896.        AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
  8897.    fi
  8898.  
  8899. fi # MOZ_X11
  8900.  
  8901. fi # COMPILE_ENVIRONMENT
  8902.  
  8903. dnl Set various defines and substitutions
  8904. dnl ========================================================
  8905.  
  8906. if test "$OS_ARCH" != "WINNT"; then
  8907.  AC_DEFINE(XP_UNIX)
  8908. fi
  8909.  
  8910. if test "$MOZ_DEBUG"; then
  8911.    AC_DEFINE(MOZ_REFLOW_PERF)
  8912.    AC_DEFINE(MOZ_REFLOW_PERF_DSP)
  8913. fi
  8914.  
  8915. if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
  8916.    AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
  8917.    ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
  8918.    ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  8919.    ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
  8920.    ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
  8921.    AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
  8922.    AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
  8923.    AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
  8924. fi
  8925.  
  8926. if test -n "$MOZ_DEV_EDITION"; then
  8927.    AC_DEFINE(MOZ_DEV_EDITION)
  8928. fi
  8929.  
  8930. if test "$MOZ_DEBUG"; then
  8931.    A11Y_LOG=1
  8932. fi
  8933. case "$MOZ_UPDATE_CHANNEL" in
  8934. aurora|beta|release|esr)
  8935.    ;;
  8936. *)
  8937.    A11Y_LOG=1
  8938.    ;;
  8939. esac
  8940. AC_SUBST(A11Y_LOG)
  8941. if test -n "$A11Y_LOG"; then
  8942.    AC_DEFINE(A11Y_LOG)
  8943. fi
  8944.  
  8945. AC_SUBST(MOZILLA_VERSION)
  8946.  
  8947. AC_SUBST(ac_configure_args)
  8948.  
  8949. dnl Spit out some output
  8950. dnl ========================================================
  8951.  
  8952. dnl The following defines are used by xpcom
  8953. _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
  8954. CPP_THROW_NEW
  8955. HAVE_CPP_AMBIGUITY_RESOLVING_USING
  8956. HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
  8957. HAVE_CPP_PARTIAL_SPECIALIZATION
  8958. HAVE_GETPAGESIZE
  8959. HAVE_ICONV
  8960. HAVE_ICONV_WITH_CONST_INPUT
  8961. HAVE_MBRTOWC
  8962. HAVE_WCRTOMB
  8963. HAVE_STATVFS64
  8964. HAVE_STATVFS
  8965. HAVE_STATFS64
  8966. HAVE_STATFS
  8967. HAVE_SYS_STATVFS_H
  8968. HAVE_SYS_STATFS_H
  8969. HAVE_SYS_VFS_H
  8970. HAVE_SYS_MOUNT_H
  8971. "
  8972.  
  8973. dnl ========================================================
  8974. dnl ICU Support
  8975. dnl ========================================================
  8976.  
  8977. # Internationalization isn't built or exposed by default in non-desktop
  8978. # builds.  Bugs to enable:
  8979. #
  8980. #   Android:  bug 864843
  8981. #   B2G:      bug 866301
  8982.  
  8983. if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
  8984.    test "$MOZ_BUILD_APP" = "b2g" ||
  8985.    test "$MOZ_BUILD_APP" = "b2g/dev"; then
  8986.     _INTL_API=no
  8987. else
  8988.     _INTL_API=yes
  8989. fi
  8990.  
  8991. if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
  8992.     USE_ICU=1
  8993. fi
  8994.  
  8995. if test "$OS_TARGET" = WINNT; then
  8996.     MOZ_SHARED_ICU=1
  8997. fi
  8998.  
  8999. MOZ_CONFIG_ICU()
  9000.  
  9001. if test -z "$JS_SHARED_LIBRARY"; then
  9002.   AC_DEFINE(MOZ_STATIC_JS)
  9003. fi
  9004. AC_SUBST(JS_SHARED_LIBRARY)
  9005.  
  9006. MOZ_CREATE_CONFIG_STATUS()
  9007.  
  9008. # No need to run subconfigures when building with LIBXUL_SDK_DIR
  9009. if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
  9010.   MOZ_SUBCONFIGURE_ICU()
  9011.   MOZ_SUBCONFIGURE_FFI()
  9012. fi
  9013.  
  9014. # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
  9015. # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
  9016. # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
  9017. # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
  9018. # (apparently) only need this hack when egrep's "pattern" is particularly long
  9019. # (as in the following code) and the first egrep on our $PATH is Apple's.  See
  9020. # bug 655339.
  9021. case "$host" in
  9022. *-apple-darwin11*)
  9023.     FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
  9024.     ;;
  9025. *)
  9026.     FIXED_EGREP="egrep"
  9027.     ;;
  9028. esac
  9029.  
  9030. # Run jemalloc configure script
  9031.  
  9032. if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
  9033.   ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
  9034.   if test -n "$MOZ_REPLACE_MALLOC"; then
  9035.     # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
  9036.     ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
  9037.     ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
  9038.   fi
  9039.   if test -n "$MOZ_JEMALLOC3"; then
  9040.     case "${OS_ARCH}" in
  9041.       WINNT|Darwin)
  9042.         # We want jemalloc functions to be kept hidden on both Mac and Windows
  9043.         # See memory/build/mozmemory_wrap.h for details.
  9044.         ac_configure_args="$ac_configure_args --without-export"
  9045.         ;;
  9046.     esac
  9047.   elif test "${OS_ARCH}" = Darwin; then
  9048.     # When building as a replace-malloc lib, disabling the zone allocator
  9049.     # forces to use pthread_atfork.
  9050.     ac_configure_args="$ac_configure_args --disable-zone-allocator"
  9051.   fi
  9052.   _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
  9053.   JEMALLOC_WRAPPER=
  9054.   if test -z "$MOZ_REPLACE_MALLOC"; then
  9055.     case "$OS_ARCH" in
  9056.       Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
  9057.         MANGLE=$_MANGLE
  9058.         ;;
  9059.     esac
  9060.   elif test -z "$MOZ_JEMALLOC3"; then
  9061.     MANGLE=$_MANGLE
  9062.     JEMALLOC_WRAPPER=replace_
  9063.   fi
  9064.   if test -n "$MANGLE"; then
  9065.     MANGLED=
  9066.     for mangle in ${MANGLE}; do
  9067.       if test -n "$MANGLED"; then
  9068.         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
  9069.       else
  9070.         MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
  9071.       fi
  9072.     done
  9073.     ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
  9074.   fi
  9075.   unset CONFIG_FILES
  9076.   if test -z "$MOZ_TLS"; then
  9077.     ac_configure_args="$ac_configure_args --disable-tls"
  9078.   fi
  9079.   EXTRA_CFLAGS="$CFLAGS"
  9080.   for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
  9081.     ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
  9082.   done
  9083.   if test "$CROSS_COMPILE"; then
  9084.     ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
  9085.   fi
  9086.  
  9087.   if ! test -e memory/jemalloc; then
  9088.     mkdir -p memory/jemalloc
  9089.   fi
  9090.  
  9091.   AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
  9092.   ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  9093. fi
  9094.  
  9095. # Run freetype configure script
  9096.  
  9097. if test "$MOZ_TREE_FREETYPE"; then
  9098.    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
  9099.    export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
  9100.    export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
  9101.    export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
  9102.    # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
  9103.    # to force freetype to use our settings rather than autodetecting
  9104.    if test -n "$MOZ_NATIVE_PNG"; then
  9105.      export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
  9106.    else
  9107.      export LIBPNG_CFLAGS="-I$_objdir/dist/include"
  9108.    fi
  9109.    export LIBPNG_LIBS="$MOZ_PNG_LIBS "
  9110.    export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
  9111.    export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
  9112.    export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
  9113.    ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
  9114.  
  9115.    if ! test -e modules; then
  9116.      mkdir modules
  9117.    fi
  9118.    # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
  9119.    # that further down the road.
  9120.    (export CC CXX RANLIB;
  9121.     AC_OUTPUT_SUBDIRS(modules/freetype2)
  9122.    ) || exit 1
  9123. fi
  9124.  
  9125. if test -z "$direct_nspr_config"; then
  9126.     dnl ========================================================
  9127.     dnl = Setup a nice relatively clean build environment for
  9128.     dnl = sub-configures.
  9129.     dnl ========================================================
  9130.     CC="$_SUBDIR_CC"
  9131.     CXX="$_SUBDIR_CXX"
  9132.     CFLAGS="$_SUBDIR_CFLAGS"
  9133.     CPPFLAGS="$_SUBDIR_CPPFLAGS"
  9134.     CXXFLAGS="$_SUBDIR_CXXFLAGS"
  9135.     LDFLAGS="$_SUBDIR_LDFLAGS"
  9136.     HOST_CC="$_SUBDIR_HOST_CC"
  9137.     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  9138.     HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
  9139.     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  9140.     RC=
  9141. fi
  9142.  
  9143. unset MAKEFILES
  9144. unset CONFIG_FILES
  9145.  
  9146. # Run all configure scripts specified by a subconfigure
  9147. if test -n "$_subconfigure_subdir"; then
  9148.   _save_srcdir="$srcdir"
  9149.   srcdir="$srcdir/.."
  9150.   _save_ac_configure_args="$ac_configure_args"
  9151.   ac_configure_args="$_subconfigure_config_args"
  9152.   AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
  9153.   ac_configure_args="$_save_ac_configure_args"
  9154.   srcdir="$_save_srcdir"
  9155. fi
  9156.  
  9157. # No need to run subconfigures when building with LIBXUL_SDK_DIR
  9158. if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
  9159.  
  9160. export WRAP_LDFLAGS
  9161.  
  9162. MOZ_SUBCONFIGURE_NSPR()
  9163.  
  9164. dnl ========================================================
  9165. dnl = Setup a nice relatively clean build environment for
  9166. dnl = sub-configures.
  9167. dnl ========================================================
  9168. CC="$_SUBDIR_CC"
  9169. CXX="$_SUBDIR_CXX"
  9170. CFLAGS="$_SUBDIR_CFLAGS"
  9171. CPPFLAGS="$_SUBDIR_CPPFLAGS"
  9172. CXXFLAGS="$_SUBDIR_CXXFLAGS"
  9173. LDFLAGS="$_SUBDIR_LDFLAGS"
  9174. HOST_CC="$_SUBDIR_HOST_CC"
  9175. HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  9176. HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
  9177. HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  9178. RC=
  9179.  
  9180. # Run the SpiderMonkey 'configure' script.
  9181. dist=$MOZ_BUILD_ROOT/dist
  9182. ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  9183.  
  9184. # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
  9185. # and $NSPR_LIBS.
  9186. ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
  9187.  
  9188. ac_configure_args="$ac_configure_args --enable-threadsafe"
  9189.  
  9190. if test "$_INTL_API" = no; then
  9191.     ac_configure_args="$ac_configure_args --without-intl-api"
  9192. fi
  9193.  
  9194. if test "$BUILD_CTYPES"; then
  9195.     # Build js-ctypes on the platforms we can.
  9196.     ac_configure_args="$ac_configure_args --enable-ctypes"
  9197. fi
  9198. if test -z "$JS_SHARED_LIBRARY" ; then
  9199.     ac_configure_args="$ac_configure_args --disable-shared-js"
  9200.     if test -n "$MOZ_DISABLE_EXPORT_JS"; then
  9201.         ac_configure_args="$ac_configure_args --disable-export-js"
  9202.     fi
  9203. fi
  9204. if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
  9205.     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
  9206.     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
  9207. fi
  9208. ac_configure_args="$ac_configure_args --prefix=$dist"
  9209. if test "$MOZ_MEMORY"; then
  9210.    ac_configure_args="$ac_configure_args --enable-jemalloc"
  9211. fi
  9212. if test -n "$MOZ_GLUE_IN_PROGRAM"; then
  9213.    export MOZ_GLUE_IN_PROGRAM
  9214. fi
  9215. if test -n "$ZLIB_IN_MOZGLUE"; then
  9216.    MOZ_ZLIB_LIBS=
  9217. fi
  9218. export MOZ_NATIVE_ZLIB
  9219. export MOZ_ZLIB_CFLAGS
  9220. export MOZ_ZLIB_LIBS
  9221. export MOZ_APP_NAME
  9222. export MOZ_APP_REMOTINGNAME
  9223. export DONT_POPULATE_VIRTUALENV=1
  9224. export PYTHON
  9225. export MOZILLA_CENTRAL_PATH=$_topsrcdir
  9226. export STLPORT_CPPFLAGS
  9227. export STLPORT_LIBS
  9228. export JS_STANDALONE=no
  9229. export MOZ_LINKER
  9230. export ZLIB_IN_MOZGLUE
  9231.  
  9232. if ! test -e js; then
  9233.     mkdir js
  9234. fi
  9235.  
  9236. AC_OUTPUT_SUBDIRS(js/src,$cache_file)
  9237. ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  9238.  
  9239. fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
  9240.  
  9241. export WRITE_MOZINFO=1
  9242. dnl we need to run config.status after js/src subconfigure because we're
  9243. dnl traversing its moz.build and we need its config.status for that.
  9244. dnl However, writing our own config.status needs to happen before
  9245. dnl subconfigures because the setup surrounding subconfigures alters
  9246. dnl many AC_SUBSTed variables.
  9247. MOZ_RUN_CONFIG_STATUS()
  9248. unset WRITE_MOZINFO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement