summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2015-10-15 11:37:05 +0530
committerArun Raghavan <git@arunraghavan.net>2015-10-15 16:18:47 +0530
commitf6941fbf6a8d395645fdc0bbfc51b6431189f490 (patch)
treef1f43a811f508d1b71671a95757bf0d87ec387fc
parent12e9e1eafd6a905682c5ea3f70c51eda77fd90bd (diff)
downloadwebrtc-audio-processing-f6941fbf6a8d395645fdc0bbfc51b6431189f490.tar.gz
build: Stop hard-coding OS/platform CFLAGS
-rw-r--r--configure.ac34
-rw-r--r--webrtc-audio-processing.pc.in3
2 files changed, 32 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 8c4916e..6e2fdc2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,9 +24,37 @@ AS_CASE(["x${with_ns_mode}"],
[NS_FIXED=0])
AM_CONDITIONAL(NS_FIXED, [test "x${NS_FIXED}" = "x1"])
-# FIXME: POSIX and LINUX should not be hard-coded
-COMMON_CFLAGS="-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DNDEBUG -I\$(top_srcdir)"
-COMMON_CXXFLAGS="-std=c++11 -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DNDEBUG -I\$(top_srcdir)"
+
+# Borrowed from gst-plugins-bad
+AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
+
+# Based on gst-plugins-bad configure.ac and defines in
+# <chromium source>/build/config/BUILDCONFIG.gn and
+# webrtc/BUILD.gn
+AS_CASE(["${host}"],
+ [*android*],
+ [
+ OS_CFLAGS="-DWEBRTC_ANDROID -DWEBRTC_LINUX"
+ PLATFORM_CFLAGS="-DWEBRTC_POSIX"
+ ],
+ [*-*linux*],
+ [
+ OS_CFLAGS="-DWEBRTC_LINUX"
+ PLATFORM_CFLAGS="-DWEBRTC_POSIX"
+ ],
+ [*-*darwin*],
+ [
+ AS_IF([test "$HAVE_IOS" = "yes"],
+ [OS_FLAGS="-DWEBRTC_MAC -DWEBRTC_IOS"],
+ [OS_FLAGS="-DWEBRTC_MAC"])
+ PLATFORM_CFLAGS="-DWEBRTC_POSIX"
+ ]
+ # FIXME: Add Windows support
+)
+AC_SUBST(PLATFORM_CFLAGS)
+
+COMMON_CFLAGS="-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
+COMMON_CXXFLAGS="-std=c++11 -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
AC_SUBST([COMMON_CFLAGS])
AC_SUBST([COMMON_CXXFLAGS])
diff --git a/webrtc-audio-processing.pc.in b/webrtc-audio-processing.pc.in
index 8fac70c..662c514 100644
--- a/webrtc-audio-processing.pc.in
+++ b/webrtc-audio-processing.pc.in
@@ -7,5 +7,4 @@ Name: webrtc-audio-processing
Description: WebRTC Audio Processing library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lwebrtc_audio_processing
-# FIXME - defines should not be hardcoded
-Cflags: -I${includedir}/webrtc_audio_processing -DWEBRTC_POSIX
+Cflags: -I${includedir}/webrtc_audio_processing @PLATFORM_CFLAGS@