Bug 910990 - prevent from build failure with older version of ethtool in linux. r=abr,ekr,khuey

This commit is contained in:
Patrick Wang 2013-09-05 00:28:46 +08:00
parent 4859168964
commit 1b1bdeee92
3 changed files with 20 additions and 0 deletions

View File

@ -5228,6 +5228,10 @@ if test -n "$MOZ_WEBRTC"; then
esac
fi
AC_TRY_COMPILE([#include <linux/ethtool.h>],
[ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
# target_arch is from {ia32|x64|arm|ppc}
case "$CPU_ARCH" in
x86_64)
@ -8978,6 +8982,12 @@ dnl so that regeneration via dependencies works correctly
WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=0"
fi
if test -n "$MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI"; then
WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=1"
else
WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_ethtool_cmd_speed_hi=0"
fi
GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \

View File

@ -8,6 +8,7 @@
{
'variables' : {
'build_with_gonk%': 0,
'have_ethtool_cmd_speed_hi%': 1
},
'targets' : [
{
@ -235,6 +236,11 @@
'defines': [
"USE_PLATFORM_NR_STUN_GET_ADDRS",
]
}],
['have_ethtool_cmd_speed_hi==0', {
'defines': [
"DONT_HAVE_ETHTOOL_SPEED_HI",
]
}]
],
}]

View File

@ -653,7 +653,11 @@ stun_get_siocgifconf_addrs(nr_local_addr addrs[], int maxaddrs, int *count)
/* For wireless network, we won't get ethtool, it's a wired
connection */
addrs[n].interface.type = NR_INTERFACE_TYPE_WIRED;
#ifdef DONT_HAVE_ETHTOOL_SPEED_HI
addrs[n].interface.estimated_speed = ecmd.speed;
#else
addrs[n].interface.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000;
#endif
}
strncpy(wrq.ifr_name, ifr->ifr_name, sizeof(wrq.ifr_name));