Bug 1401654 - Move MOZ_WEBRTC and some related defines to moz.configure. draft
authorChris Manchester <cmanchester@mozilla.com>
Wed, 20 Sep 2017 16:29:39 -0700
changeset 667963 669418102c3bd193ad1db3b1ed90e9256596ee5d
parent 664064 e5f80a639bfe68b68693a5be610f9d36b6c5ad00
child 732561 9c80bcc0422a20ef1e41220edfaaaad11e9e2f82
push id80899
push usercmanchester@mozilla.com
push dateWed, 20 Sep 2017 23:30:10 +0000
bugs1401654
milestone57.0a1
Bug 1401654 - Move MOZ_WEBRTC and some related defines to moz.configure. MozReview-Commit-ID: Kp7lCLqJ6FH
build/moz.configure/old.configure
old-configure.in
toolkit/moz.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -222,17 +222,16 @@ def old_configure_options(*options):
     '--enable-thread-sanitizer',
     '--enable-trace-logging',
     '--enable-ubsan-int-overflow',
     '--enable-ui-locale',
     '--enable-universalchardet',
     '--enable-updater',
     '--enable-valgrind',
     '--enable-verify-mar',
-    '--enable-webrtc',
     '--enable-xul',
     '--enable-zipwriter',
     '--includedir',
     '--libdir',
     '--no-create',
     '--prefix',
     '--with-android-cxx-stl',
     '--with-android-distribution-directory',
--- a/old-configure.in
+++ b/old-configure.in
@@ -2062,21 +2062,17 @@ MOZ_AUTH_EXTENSION=1
 if test "$MOZ_IOS"; then
    MOZ_AUTH_EXTENSION=
 fi
 MOZ_RAW=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
-MOZ_WEBRTC=1
-MOZ_PEERCONNECTION=
 MOZ_SRTP=
-MOZ_WEBRTC_SIGNALING=
-MOZ_WEBRTC_ASSERT_ALWAYS=1
 MOZ_WEBRTC_HARDWARE_AEC_NS=
 MOZ_SCTP=
 VPX_USE_YASM=
 VPX_ASFLAGS=
 VPX_AS_CONVERSION=
 VPX_X86_ASM=
 VPX_ARM_ASM=
 LIBJPEG_TURBO_AS=
@@ -2530,70 +2526,24 @@ fi
 dnl ========================================================
 dnl Accessibility is required for the linuxgl widget
 dnl backend
 dnl ========================================================
 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
 fi
 
-dnl Turn off webrtc for OS's we don't handle yet, but allow
-dnl --enable-webrtc to override.  Can disable for everything in
-dnl the master list above.
-if test -n "$MOZ_WEBRTC"; then
-    case "$target" in
-    *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
-        dnl Leave enabled
-        ;;
-    *)
-        dnl default to disabled for all others
-        MOZ_WEBRTC=
-        ;;
-    esac
-fi
-
 AC_TRY_COMPILE([#include <linux/ethtool.h>],
                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
 
 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
 
-# target_arch is from {ia32|x64|arm|ppc}
-case "$CPU_ARCH" in
-x86_64 | arm | aarch64 | x86 | ppc* | ia64)
-    :
-    ;;
-*)
-# unsupported arch for webrtc
-    MOZ_WEBRTC=
-    ;;
-
-esac
-
-dnl ========================================================
-dnl = Disable WebRTC code
-dnl ========================================================
-MOZ_ARG_DISABLE_BOOL(webrtc,
-[  --disable-webrtc        Disable support for WebRTC],
-    MOZ_WEBRTC=,
-    MOZ_WEBRTC=1)
-
 if test -n "$MOZ_WEBRTC"; then
-    AC_DEFINE(MOZ_WEBRTC)
-    dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
-    dnl opt/production builds (via MOZ_CRASH())
-    AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
     MOZ_RAW=1
-
-dnl enable once Signaling lands
-    MOZ_WEBRTC_SIGNALING=1
-    AC_DEFINE(MOZ_WEBRTC_SIGNALING)
-dnl enable once PeerConnection lands
-    MOZ_PEERCONNECTION=1
-    AC_DEFINE(MOZ_PEERCONNECTION)
     MOZ_SCTP=1
     MOZ_SRTP=1
     AC_DEFINE(MOZ_SCTP)
     AC_DEFINE(MOZ_SRTP)
     if test -n "$MOZ_X11"; then
       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
     fi
 else
@@ -2607,20 +2557,16 @@ MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
     MOZ_WEBRTC_HARDWARE_AEC_NS=)
 
 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
 fi
 
-AC_SUBST(MOZ_WEBRTC)
-AC_SUBST(MOZ_WEBRTC_SIGNALING)
-AC_SUBST(MOZ_PEERCONNECTION)
-AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
 AC_SUBST(MOZ_SCTP)
 AC_SUBST(MOZ_SRTP)
 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
 
 dnl Use integers over floats for audio on B2G and Android
 dnl (regarless of the CPU architecture, because audio
 dnl backends for those platforms don't support floats. We also
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1167,16 +1167,58 @@ option('--enable-cubeb-remoting', env='M
 @depends('--enable-cubeb-remoting')
 def cubeb_remoting(value):
     if value:
         return True
 
 set_config('MOZ_CUBEB_REMOTING', cubeb_remoting)
 set_define('MOZ_CUBEB_REMOTING', cubeb_remoting)
 
+# WebRTC
+# ========================================================
+@depends(target)
+def webrtc_default(target):
+    # Turn off webrtc for OS's we don't handle yet, but allow
+    # --enable-webrtc to override.
+    os_match = False
+    for os_fragment in ('linux', 'mingw', 'android', 'linuxandroid',
+                        'dragonfly', 'freebsd', 'netbsd', 'openbsd',
+                        'darwin'):
+        if target.raw_os.startswith(os_fragment):
+            os_match = True
+
+    cpu_match = False
+    if (target.cpu in ('x86_64', 'arm', 'aarch64', 'x86', 'ia64') or
+        target.cpu.startswith('ppc')):
+        cpu_match = True
+
+    if os_match and cpu_match:
+        return True
+    return False
+
+option('--disable-webrtc', default=webrtc_default,
+       help='Disable support for WebRTC')
+
+@depends('--disable-webrtc')
+def webrtc(enabled):
+    if enabled:
+        return True
+
+set_config('MOZ_WEBRTC', webrtc)
+set_define('MOZ_WEBRTC', webrtc)
+add_old_configure_assignment('MOZ_WEBRTC', webrtc)
+set_config('MOZ_WEBRTC_SIGNALING', webrtc)
+set_define('MOZ_WEBRTC_SIGNALING', webrtc)
+set_config('MOZ_PEERCONNECTION', webrtc)
+set_define('MOZ_PEERCONNECTION', webrtc)
+# MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
+# opt/production builds (via MOZ_CRASH())
+set_config('MOZ_WEBRTC_ASSERT_ALWAYS', webrtc)
+set_define('MOZ_WEBRTC_ASSERT_ALWAYS', webrtc)
+
 # ASan Reporter Addon
 # ==============================================================
 option('--enable-address-sanitizer-reporter',
        help='Enable Address Sanitizer Reporter Extension')
 
 @depends('--enable-address-sanitizer-reporter')
 def enable_asan_reporter(value):
     if value: