configure.ac 4.39 KB
Newer Older
Arun Raghavan's avatar
Arun Raghavan committed
1
AC_INIT([webrtc-audio-processing], [0.3])
Arun Raghavan's avatar
Arun Raghavan committed
2
AM_INIT_AUTOMAKE([dist-xz subdir-objects tar-ustar])
Arun Raghavan's avatar
Arun Raghavan committed
3

4
AC_SUBST(LIBWEBRTC_AUDIO_PROCESSING_VERSION_INFO, [1:0:0])
Arun Raghavan's avatar
Arun Raghavan committed
5
6
7

AM_SILENT_RULES([yes])

8
9
10
# Set up the host_* variables
AC_CANONICAL_HOST

Arun Raghavan's avatar
Arun Raghavan committed
11
12
13
14
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INSTALL
15
AM_PROG_AS
Arun Raghavan's avatar
Arun Raghavan committed
16
17
18
19
20
21
22
23
24
25
26
27
28

AC_LANG_C
AC_LANG_CPLUSPLUS

AC_ARG_WITH([ns-mode],
	    AS_HELP_STRING([--with-ns-mode=float|fixed], [Noise suppresion mode to use. Default is float]))

AS_CASE(["x${with_ns_mode}"],
	["fixed"], [NS_FIXED=1],
	["float"], [NS_FIXED=0],
	[NS_FIXED=0])
AM_CONDITIONAL(NS_FIXED, [test "x${NS_FIXED}" = "x1"])

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
AC_ARG_WITH(
  gnustl,
  AC_HELP_STRING(
    [--with-gnustl],
    [use gnustl @<:@default=no@:>@]),
  [AS_CASE(
    [$withval], [no], [], [yes], [],
    [AC_MSG_ERROR([bad value "$withval" for --with-gnustl])])],
  [with_gnustl=no])
if test "x$with_gnustl" != "xno"; then
  PKG_CHECK_MODULES(GNUSTL, gnustl)
fi
AC_SUBST(GNUSTL_LIBS)
AC_SUBST(GNUSTL_CFLAGS)

44
45
46
47
48
49
50
51
52
53

# 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*],
        [
54
55
         OS_CFLAGS="-DWEBRTC_ANDROID -DWEBRTC_LINUX -DWEBRTC_THREAD_RR -DWEBRTC_CLOCK_TYPE_REALTIME"
         OS_LDFLAGS="-llog"
56
         PLATFORM_CFLAGS="-DWEBRTC_POSIX"
57
         HAVE_POSIX=1
58
59
60
        ],
    [*-*linux*],
        [
61
         OS_CFLAGS="-DWEBRTC_LINUX -DWEBRTC_THREAD_RR"
62
         PLATFORM_CFLAGS="-DWEBRTC_POSIX"
63
         OS_LDFLAGS="-lrt -lpthread"
64
         HAVE_POSIX=1
65
66
67
        ],
    [*-*darwin*],
        [
68
         OS_CFLAGS="-DWEBRTC_MAC -DWEBRTC_THREAD_RR -DWEBRTC_CLOCK_TYPE_REALTIME"
69
         AS_IF([test "$HAVE_IOS" = "yes"],
70
             [OS_CFLAGS+=" -DWEBRTC_IOS"])
71
         PLATFORM_CFLAGS="-DWEBRTC_POSIX"
72
         HAVE_POSIX=1
73
74
75
        ],
    [*-mingw32*],
        [
76
         OS_LDFLAGS="-lwinmm"
77
         PLATFORM_CFLAGS="-DWEBRTC_WIN -D_WIN32 -U__STRICT_ANSI__"
78
         HAVE_WIN=1
79
80
        ],
    [AC_MSG_ERROR([Unsupported host $host])]
81
82
)
AC_SUBST(PLATFORM_CFLAGS)
83
84
AM_CONDITIONAL(HAVE_POSIX, [test "x${HAVE_POSIX}" = "x1"])
AM_CONDITIONAL(HAVE_WIN, [test "x${HAVE_WIN}" = "x1"])
85

86
87
88
89
90
91
92
93
94
AS_CASE(["${host_cpu}"],
    [i?86|x86_64],
        [
         HAVE_X86=1
        ],
    [armv7*|armv8*],
        [
         HAVE_ARM=1
         HAVE_ARMV7=1
95
         ARCH_CFLAGS="-DWEBRTC_ARCH_ARM -DWEBRTC_ARCH_ARM_V7"
96
97
98
99
        ],
    [arm*],
        [
         HAVE_ARM=1
100
         ARCH_CFLAGS="-DWEBRTC_ARCH_ARM"
101
        ],
102
103
104
105
106
    [aarch64*],
        [
         HAVE_NEON=1
         ARCH_CFLAGS="-DWEBRTC_HAS_NEON -DWEBRTC_ARCH_ARM64"
        ],
107
    # FIXME: Add MIPS support, see webrtc/BUILD.gn for defines
108
    [AC_MSG_ERROR([Unsupported CPU type $host_cpu])]
109
110
111
112
113
114
115
116
117
118
119
120
)
AM_CONDITIONAL(HAVE_X86, [test "x${HAVE_X86}" = "x1"])
AM_CONDITIONAL(HAVE_ARM, [test "x${HAVE_ARM}" = "x1"])
AM_CONDITIONAL(HAVE_ARMV7, [test "x${HAVE_ARMV7}" = "x1"])

# Borrowed from pulseaudio's configure.ac
AC_ARG_ENABLE([neon],
    AS_HELP_STRING([--enable-neon], [Enable NEON optimisations on ARM CPUs that support it (yes|no|auto|runtime)]))

AS_IF([test "x$enable_neon" != "xno"],
    AS_IF([test "x$enable_neon" != "xruntime"],
        [
121
         save_CXXFLAGS="$CXXFLAGS"; CXXFLAGS="-mfpu=neon $CXXFLAGS"
122
         AC_COMPILE_IFELSE(
123
124
125
126
            [AC_LANG_PROGRAM(
                [
                 #include <arm_neon.h>
                ], [])],
127
128
            [
             HAVE_NEON=1
129
             ARCH_CFLAGS="$ARCH_CFLAGS -DWEBRTC_HAS_NEON -mfpu=neon"
130
            ])
131
         CXXFLAGS="$save_CXXFLAGS"
132
133
134
        ],
        [
         HAVE_NEON=1
135
         ARCH_CFLAGS="$ARCH_CFLAGS -DWEBRTC_DETECT_NEON -mfpu=neon"
136
137
138
139
140
        ])
)
AM_CONDITIONAL([HAVE_NEON], [test "x$HAVE_NEON" = "x1"])

COMMON_CFLAGS="-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} ${ARCH_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
141
COMMON_CXXFLAGS="-std=c++11 -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} ${ARCH_CFLAGS} ${GNUSTL_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
142
COMMON_LDFLAGS="${OS_LDFLAGS}"
Arun Raghavan's avatar
Arun Raghavan committed
143
144
AC_SUBST([COMMON_CFLAGS])
AC_SUBST([COMMON_CXXFLAGS])
145
AC_SUBST([COMMON_LDFLAGS])
Arun Raghavan's avatar
Arun Raghavan committed
146
147

AC_CONFIG_FILES([
148
webrtc-audio-processing.pc
Arun Raghavan's avatar
Arun Raghavan committed
149
Makefile
Arun Raghavan's avatar
Arun Raghavan committed
150
webrtc/Makefile
Arun Raghavan's avatar
Arun Raghavan committed
151
webrtc/base/Makefile
Arun Raghavan's avatar
Arun Raghavan committed
152
153
154
webrtc/common_audio/Makefile
webrtc/system_wrappers/Makefile
webrtc/modules/Makefile
Arun Raghavan's avatar
Arun Raghavan committed
155
webrtc/modules/audio_coding/Makefile
Arun Raghavan's avatar
Arun Raghavan committed
156
webrtc/modules/audio_processing/Makefile
Arun Raghavan's avatar
Arun Raghavan committed
157
158
159
])

AC_OUTPUT