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_TARGET 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 21#AC_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 DBUS_CFLAGS+=-DCRAS_DBUS 31 AC_SUBST(DBUS_CFLAGS) 32else 33 DBUS_CFLAGS= 34 AC_SUBST(DBUS_CFLAGS) 35 DBUS_LIBS= 36 AC_SUBST(DBUS_LIBS) 37fi 38 39PKG_CHECK_MODULES([SBC], [ sbc >= 1.0 ]) 40AC_CHECK_LIB(asound, snd_pcm_ioplug_create,, 41 AC_ERROR([*** libasound has no external plugin SDK]), -ldl) 42 43AC_ARG_ENABLE([alsa-plugin], AS_HELP_STRING([--disable-alsa-plugin], 44 [Disable building of ALSA plugin])) 45 46# Determine ALSA plugin directory. 47test "x$prefix" = xNONE && prefix=$ac_default_prefix 48test "x$exec_prefix" = xNONE && exec_prefix=$prefix 49 50AC_ARG_WITH(plugindir, 51 AS_HELP_STRING([--with-plugindir=dir], 52 [path where ALSA plugin files are stored]), 53 plugindir="$withval", plugindir="") 54if test -z "$plugindir"; then 55 eval dir="$libdir" 56 case "$dir" in 57 /*) ;; 58 *) dir="$dir" 59 esac 60 plugindir="$dir/alsa-lib" 61fi 62AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir", 63 [directory containing ALSA add-on modules]) 64ALSA_PLUGIN_DIR="$plugindir" 65AC_SUBST(ALSA_PLUGIN_DIR) 66 67# Determine CRAS configuration directory. 68eval cras_config_file_dir="$sysconfdir/cras" 69AC_DEFINE_UNQUOTED(CRAS_CONFIG_FILE_DIR, "$cras_config_file_dir", 70 [directory containing CRAS configuration]) 71 72# CRAS socket dir 73AC_ARG_WITH(socketdir, 74 AS_HELP_STRING([--with-socketdir=dir], 75 [path where CRAS stores its sockets]), 76 socketdir="$withval", 77 socketdir="/run/cras") 78AC_DEFINE_UNQUOTED(CRAS_SOCKET_FILE_DIR, "$socketdir", 79 [directory containing CRAS socket files]) 80 81# Get iniparser library and include locations 82AC_ARG_WITH([iniparser-include-path], 83 [AS_HELP_STRING([--with-iniparser-include-path], 84 [location of the iniparser headers, defaults to /usr/include/])], 85 [INIPARSER_CFLAGS="-I$withval"], 86 [INIPARSER_CFLAGS='-I/usr/include']) 87AC_SUBST([INIPARSER_CFLAGS]) 88 89AC_ARG_WITH([iniparser-lib-path], 90 [AS_HELP_STRING([--with-iniparser-lib-path], 91 [location of the iniparser libraries])], 92 [INIPARSER_LIBS="-L$withval -liniparser"], 93 [INIPARSER_LIBS='-liniparser']) 94AC_SUBST([INIPARSER_LIBS]) 95 96# SSE4_2 support 97AC_ARG_ENABLE(sse42, [AS_HELP_STRING([--enable-sse42],[enable SSE42 optimizations])], have_sse42=$enableval, have_sse42=yes) 98if test "x$target_cpu" != xx86_64; then 99 have_sse42=no 100fi 101if test "$have_sse42" = "yes"; then 102 AC_DEFINE(HAVE_SSE42,1,[Define to enable SSE42 optimizations.]) 103 SSE42_CFLAGS="-DOPS_SSE42 -msse4.2 -ffast-math" 104fi 105AM_CONDITIONAL(HAVE_SSE42, test "$have_sse42" = "yes") 106AC_SUBST(SSE42_CFLAGS) 107 108# AVX support 109AC_ARG_ENABLE(avx, [AS_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=yes) 110if test "x$target_cpu" != xx86_64; then 111 have_avx=no 112fi 113if test "$have_avx" = "yes"; then 114 AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.]) 115 AVX_CFLAGS="-DOPS_AVX -mavx -ffast-math" 116fi 117AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes") 118AC_SUBST(AVX_CFLAGS) 119 120# AVX2 support 121AC_ARG_ENABLE(avx2, [AS_HELP_STRING([--enable-avx2],[enable AVX2 optimizations])], have_avx2=$enableval, have_avx2=yes) 122if test "x$target_cpu" != xx86_64; then 123 have_avx2=no 124fi 125if test "$have_avx2" = "yes"; then 126 AC_DEFINE(HAVE_AVX2,1,[Define to enable AVX2 optimizations.]) 127 AVX2_CFLAGS="-DOPS_AVX2 -mavx2 -ffast-math" 128fi 129AM_CONDITIONAL(HAVE_AVX2, test "$have_avx2" = "yes") 130AC_SUBST(AVX2_CFLAGS) 131 132# FMA support 133AC_ARG_ENABLE(fma, [AS_HELP_STRING([--enable-fma],[enable FMA optimizations])], have_fma=$enableval, have_fma=yes) 134if test "x$target_cpu" != xx86_64; then 135 have_fma=no 136fi 137if test "$have_fma" = "yes"; then 138 AC_DEFINE(HAVE_FMA,1,[Define to enable FMA optimizations.]) 139 FMA_CFLAGS="-DOPS_FMA -mavx2 -mfma -ffast-math" 140fi 141AM_CONDITIONAL(HAVE_FMA, test "$have_fma" = "yes") 142AC_SUBST(FMA_CFLAGS) 143 144AC_OUTPUT([ 145 Makefile 146 src/Makefile 147 libcras.pc 148]) 149 150AS_IF([test "$have_sse42" = "yes"], ENABLE_SSE42=yes, ENABLE_SSE42=no) 151AS_IF([test "$have_avx" = "yes"], ENABLE_AVX=yes, ENABLE_AVX=no) 152AS_IF([test "$have_avx2" = "yes"], ENABLE_AVX2=yes, ENABLE_AVX2=no) 153AS_IF([test "$have_fma" = "yes"], ENABLE_FMA=yes, ENABLE_FMA=no) 154 155echo " 156Enable SSE42: ${ENABLE_SSE42} 157Enable AVX: ${ENABLE_AVX} 158Enable AVX2: ${ENABLE_AVX2} 159Enable FMA: ${ENABLE_FMA} 160" 161