• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4AC_INIT([cras], [0.1], [dgreid@chromium.org],
5             [cras], [http://www.chromium.org/])
6AC_PREREQ([2.59])
7
8AC_CANONICAL_HOST
9
10AM_INIT_AUTOMAKE([1.10 -Wall no-define])
11#AC_CONFIG_HEADERS([config.h])
12
13m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
14AC_PROG_LIBTOOL
15AC_PROG_CC
16# c++ unit test (gtest).
17AC_PROG_CXX
18AC_LANG_C
19AM_PROG_CC_C_O
20PKG_PROG_PKG_CONFIG
21AC_CONFIG_FILES([Makefile src/Makefile libcras.pc])
22
23PKG_CHECK_MODULES([LIBSPEEX], [ speexdsp >= 1.2 ])
24PKG_CHECK_MODULES([ASOUNDLIB], [ alsa >= 1.1.0 ])
25
26AC_ARG_ENABLE([dbus], AS_HELP_STRING([--disable-dbus], [Disable all DBUS uses]), have_dbus=$enableval, have_dbus=yes)
27AM_CONDITIONAL(HAVE_DBUS, test "$have_dbus" = "yes")
28if test "$have_dbus" = "yes"; then
29    PKG_CHECK_MODULES([DBUS], [ dbus-1 >= 1.4.12 ])
30    AS_VAR_APPEND([DBUS_CFLAGS], [" -DCRAS_DBUS"])
31else
32    DBUS_CFLAGS=
33    DBUS_LIBS=
34fi
35AC_SUBST(DBUS_LIBS)
36AC_SUBST(DBUS_CFLAGS)
37
38AC_ARG_ENABLE([selinux], AS_HELP_STRING([--enable-selinux], [Enable SELinux calls]), have_selinux=$enableval, have_selinux=no)
39AM_CONDITIONAL(HAVE_SELINUX, test "$have_selinux" = "yes")
40if test "$have_selinux" = "yes"; then
41    PKG_CHECK_MODULES([SELINUX], [ libselinux ])
42    AS_VAR_APPEND([SELINUX_CFLAGS], [" -DCRAS_SELINUX"])
43else
44    SELINUX_CFLAGS=
45    SELINUX_LIBS=
46fi
47AC_SUBST(SELINUX_CFLAGS)
48AC_SUBST(SELINUX_LIBS)
49
50# WEBRTC APM support
51AC_ARG_ENABLE([webrtc-apm], AS_HELP_STRING([--disable-webrtc-apm], [Disable webrtc-apm uses]), have_webrtc_apm=$enableval, have_webrtc_apm=yes)
52AM_CONDITIONAL(HAVE_WEBRTC_APM, test "$have_webrtc_apm" = "yes")
53if test "$have_webrtc_apm" = "yes"; then
54    PKG_CHECK_MODULES([WEBRTC_APM], [ libwebrtc_apm ])
55    AC_DEFINE(HAVE_WEBRTC_APM, 1, [Define to use webrtc-apm.])
56else
57    WEBRTC_APM_LIBS=
58fi
59AC_SUBST(WEBRTC_APM_LIBS)
60
61PKG_CHECK_MODULES([SBC], [ sbc >= 1.0 ])
62AC_CHECK_LIB(asound, snd_pcm_ioplug_create,,
63	     AC_ERROR([*** libasound has no external plugin SDK]), -ldl)
64
65AC_ARG_ENABLE([alsa-plugin], AS_HELP_STRING([--disable-alsa-plugin],
66                                            [Disable building of ALSA plugin]))
67
68AC_ARG_ENABLE([metrics], AS_HELP_STRING([--enable-metrics], [Enable metrics uses]), have_metrics=$enableval, have_metrics=no)
69if test "$have_metrics" = "yes"; then
70    AC_DEFINE(HAVE_LIB_METRICS, 1, [Define to use libmetrics])
71    METRICS_LIBS=-lmetrics-${BASE_VER}
72else
73    METRICS_LIBS=
74fi
75AC_SUBST(METRICS_LIBS)
76
77# Determine ALSA plugin directory.
78test "x$prefix" = xNONE && prefix=$ac_default_prefix
79test "x$exec_prefix" = xNONE && exec_prefix=$prefix
80
81AC_ARG_WITH(plugindir,
82    AS_HELP_STRING([--with-plugindir=dir],
83	[path where ALSA plugin files are stored]),
84    plugindir="$withval", plugindir="")
85if test -z "$plugindir"; then
86    eval dir="$libdir"
87    case "$dir" in
88    /*) ;;
89    *) dir="$dir"
90    esac
91    plugindir="$dir/alsa-lib"
92fi
93AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir",
94                   [directory containing ALSA add-on modules])
95ALSA_PLUGIN_DIR="$plugindir"
96AC_SUBST(ALSA_PLUGIN_DIR)
97
98# Determine CRAS configuration directory.
99eval cras_config_file_dir="$sysconfdir/cras"
100AC_DEFINE_UNQUOTED(CRAS_CONFIG_FILE_DIR, "$cras_config_file_dir",
101                   [directory containing CRAS configuration])
102
103# CRAS socket dir
104AC_ARG_WITH(socketdir,
105    AS_HELP_STRING([--with-socketdir=dir],
106        [path where CRAS stores its sockets]),
107    socketdir="$withval",
108    socketdir="/run/cras")
109AC_DEFINE_UNQUOTED(CRAS_SOCKET_FILE_DIR, "$socketdir",
110                   [directory containing CRAS socket files])
111
112# SSE4_2 support
113AC_ARG_ENABLE(sse42, [AS_HELP_STRING([--enable-sse42],[enable SSE42 optimizations])], have_sse42=$enableval, have_sse42=yes)
114if  test "x$host_cpu" != xx86_64; then
115	have_sse42=no
116fi
117if test "$have_sse42" = "yes"; then
118        AC_DEFINE(HAVE_SSE42,1,[Define to enable SSE42 optimizations.])
119	SSE42_CFLAGS="-DOPS_SSE42 -msse4.2 -ffast-math"
120fi
121AM_CONDITIONAL(HAVE_SSE42, test "$have_sse42" = "yes")
122AC_SUBST(SSE42_CFLAGS)
123
124# AVX support
125AC_ARG_ENABLE(avx, [AS_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=yes)
126if  test "x$host_cpu" != xx86_64; then
127	have_avx=no
128fi
129if test "$have_avx" = "yes"; then
130        AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.])
131	AVX_CFLAGS="-DOPS_AVX -mavx -ffast-math"
132fi
133AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes")
134AC_SUBST(AVX_CFLAGS)
135
136# AVX2 support
137AC_ARG_ENABLE(avx2, [AS_HELP_STRING([--enable-avx2],[enable AVX2 optimizations])], have_avx2=$enableval, have_avx2=yes)
138if  test "x$host_cpu" != xx86_64; then
139	have_avx2=no
140fi
141if test "$have_avx2" = "yes"; then
142        AC_DEFINE(HAVE_AVX2,1,[Define to enable AVX2 optimizations.])
143	AVX2_CFLAGS="-DOPS_AVX2 -mavx2 -ffast-math"
144fi
145AM_CONDITIONAL(HAVE_AVX2, test "$have_avx2" = "yes")
146AC_SUBST(AVX2_CFLAGS)
147
148# FMA support
149AC_ARG_ENABLE(fma, [AS_HELP_STRING([--enable-fma],[enable FMA optimizations])], have_fma=$enableval, have_fma=yes)
150if  test "x$host_cpu" != xx86_64; then
151	have_fma=no
152fi
153if test "$have_fma" = "yes"; then
154        AC_DEFINE(HAVE_FMA,1,[Define to enable FMA optimizations.])
155	FMA_CFLAGS="-DOPS_FMA -mavx2 -mfma -ffast-math"
156fi
157AM_CONDITIONAL(HAVE_FMA, test "$have_fma" = "yes")
158AC_SUBST(FMA_CFLAGS)
159
160AC_OUTPUT
161
162AC_MSG_NOTICE([
163
164Enable SSE42:                  ${have_sse42}
165Enable AVX:                    ${have_avx}
166Enable AVX2:                   ${have_avx2}
167Enable FMA:                    ${have_fma}
168])
169