Home | History | Annotate | Download | only in cras
      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.
      4 AC_INIT([cras], [0.1], [dgreid (a] chromium.org],
      5              [cras], [http://www.chromium.org/])
      6 AC_PREREQ([2.59])
      7 
      8 AC_CANONICAL_TARGET
      9 
     10 AM_INIT_AUTOMAKE([1.10 -Wall no-define])
     11 #AC_CONFIG_HEADERS([config.h])
     12 
     13 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
     14 AC_PROG_LIBTOOL
     15 AC_PROG_CC
     16 # c++ unit test (gtest).
     17 AC_PROG_CXX
     18 AC_LANG_C
     19 AM_PROG_CC_C_O
     20 PKG_PROG_PKG_CONFIG
     21 #AC_CONFIG_FILES([Makefile src/Makefile libcras.pc])
     22 
     23 PKG_CHECK_MODULES([LIBSPEEX], [ speexdsp >= 1.2 ])
     24 PKG_CHECK_MODULES([ASOUNDLIB], [ alsa >= 1.1.0 ])
     25 
     26 AC_ARG_ENABLE([DBUS], AS_HELP_STRING([--disable-DBUS], [Disable all DBUS uses]), have_dbus=$enableval, have_dbus=yes)
     27 AM_CONDITIONAL(HAVE_DBUS, test "$have_dbus" = "yes")
     28 if 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)
     32 else
     33     DBUS_CFLAGS=
     34     AC_SUBST(DBUS_CFLAGS)
     35     DBUS_LIBS=
     36     AC_SUBST(DBUS_LIBS)
     37 fi
     38 
     39 PKG_CHECK_MODULES([SBC], [ sbc >= 1.0 ])
     40 AC_CHECK_LIB(asound, snd_pcm_ioplug_create,,
     41 	     AC_ERROR([*** libasound has no external plugin SDK]), -ldl)
     42 
     43 AC_ARG_ENABLE([alsa-plugin], AS_HELP_STRING([--disable-alsa-plugin],
     44                                             [Disable building of ALSA plugin]))
     45 
     46 # Determine ALSA plugin directory.
     47 test "x$prefix" = xNONE && prefix=$ac_default_prefix
     48 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
     49 
     50 AC_ARG_WITH(plugindir,
     51     AS_HELP_STRING([--with-plugindir=dir],
     52 	[path where ALSA plugin files are stored]),
     53     plugindir="$withval", plugindir="")
     54 if test -z "$plugindir"; then
     55     eval dir="$libdir"
     56     case "$dir" in
     57     /*) ;;
     58     *) dir="$dir"
     59     esac
     60     plugindir="$dir/alsa-lib"
     61 fi
     62 AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir",
     63                    [directory containing ALSA add-on modules])
     64 ALSA_PLUGIN_DIR="$plugindir"
     65 AC_SUBST(ALSA_PLUGIN_DIR)
     66 
     67 # Determine CRAS configuration directory.
     68 eval cras_config_file_dir="$sysconfdir/cras"
     69 AC_DEFINE_UNQUOTED(CRAS_CONFIG_FILE_DIR, "$cras_config_file_dir",
     70                    [directory containing CRAS configuration])
     71 
     72 # CRAS socket dir
     73 AC_ARG_WITH(socketdir,
     74     AS_HELP_STRING([--with-socketdir=dir],
     75         [path where CRAS stores its sockets]),
     76     socketdir="$withval",
     77     socketdir="/run/cras")
     78 AC_DEFINE_UNQUOTED(CRAS_SOCKET_FILE_DIR, "$socketdir",
     79                    [directory containing CRAS socket files])
     80 
     81 # Get iniparser library and include locations
     82 AC_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'])
     87 AC_SUBST([INIPARSER_CFLAGS])
     88 
     89 AC_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'])
     94 AC_SUBST([INIPARSER_LIBS])
     95 
     96 # SSE4_2 support
     97 AC_ARG_ENABLE(sse42, [AS_HELP_STRING([--enable-sse42],[enable SSE42 optimizations])], have_sse42=$enableval, have_sse42=yes)
     98 if  test "x$target_cpu" != xx86_64; then
     99 	have_sse42=no
    100 fi
    101 if 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"
    104 fi
    105 AM_CONDITIONAL(HAVE_SSE42, test "$have_sse42" = "yes")
    106 AC_SUBST(SSE42_CFLAGS)
    107 
    108 # AVX support
    109 AC_ARG_ENABLE(avx, [AS_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=yes)
    110 if  test "x$target_cpu" != xx86_64; then
    111 	have_avx=no
    112 fi
    113 if test "$have_avx" = "yes"; then
    114         AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.])
    115 	AVX_CFLAGS="-DOPS_AVX -mavx -ffast-math"
    116 fi
    117 AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes")
    118 AC_SUBST(AVX_CFLAGS)
    119 
    120 # AVX2 support
    121 AC_ARG_ENABLE(avx2, [AS_HELP_STRING([--enable-avx2],[enable AVX2 optimizations])], have_avx2=$enableval, have_avx2=yes)
    122 if  test "x$target_cpu" != xx86_64; then
    123 	have_avx2=no
    124 fi
    125 if test "$have_avx2" = "yes"; then
    126         AC_DEFINE(HAVE_AVX2,1,[Define to enable AVX2 optimizations.])
    127 	AVX2_CFLAGS="-DOPS_AVX2 -mavx2 -ffast-math"
    128 fi
    129 AM_CONDITIONAL(HAVE_AVX2, test "$have_avx2" = "yes")
    130 AC_SUBST(AVX2_CFLAGS)
    131 
    132 # FMA support
    133 AC_ARG_ENABLE(fma, [AS_HELP_STRING([--enable-fma],[enable FMA optimizations])], have_fma=$enableval, have_fma=yes)
    134 if  test "x$target_cpu" != xx86_64; then
    135 	have_fma=no
    136 fi
    137 if 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"
    140 fi
    141 AM_CONDITIONAL(HAVE_FMA, test "$have_fma" = "yes")
    142 AC_SUBST(FMA_CFLAGS)
    143 
    144 AC_OUTPUT([
    145 	Makefile
    146 	src/Makefile
    147 	libcras.pc
    148 ])
    149 
    150 AS_IF([test "$have_sse42" = "yes"], ENABLE_SSE42=yes, ENABLE_SSE42=no)
    151 AS_IF([test "$have_avx" = "yes"], ENABLE_AVX=yes, ENABLE_AVX=no)
    152 AS_IF([test "$have_avx2" = "yes"], ENABLE_AVX2=yes, ENABLE_AVX2=no)
    153 AS_IF([test "$have_fma" = "yes"], ENABLE_FMA=yes, ENABLE_FMA=no)
    154 
    155 echo "
    156 Enable SSE42:                  ${ENABLE_SSE42}
    157 Enable AVX:                    ${ENABLE_AVX}
    158 Enable AVX2:                   ${ENABLE_AVX2}
    159 Enable FMA:                    ${ENABLE_FMA}
    160 "
    161