common/autoconf/lib-alsa.m4
changeset 32921 8e0250dfa145
parent 31327 8c2512d63fac
child 33393 0f584e7d6ab6
equal deleted inserted replaced
32920:5bea8a04f0a5 32921:8e0250dfa145
       
     1 #
       
     2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
       
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4 #
       
     5 # This code is free software; you can redistribute it and/or modify it
       
     6 # under the terms of the GNU General Public License version 2 only, as
       
     7 # published by the Free Software Foundation.  Oracle designates this
       
     8 # particular file as subject to the "Classpath" exception as provided
       
     9 # by Oracle in the LICENSE file that accompanied this code.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22 # or visit www.oracle.com if you need additional information or have any
       
    23 # questions.
       
    24 #
       
    25 
       
    26 ################################################################################
       
    27 # Setup alsa (Advanced Linux Sound Architecture)
       
    28 ################################################################################
       
    29 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
       
    30 [
       
    31   AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
       
    32       [specify prefix directory for the alsa package
       
    33       (expecting the libraries under PATH/lib and the headers under PATH/include)])])
       
    34   AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
       
    35       [specify directory for the alsa include files])])
       
    36   AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
       
    37       [specify directory for the alsa library])])
       
    38 
       
    39   if test "x$NEEDS_LIB_ALSA" = xfalse; then
       
    40     if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
       
    41       AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
       
    42     fi
       
    43     ALSA_CFLAGS=
       
    44     ALSA_LIBS=
       
    45   else
       
    46     ALSA_FOUND=no
       
    47 
       
    48     if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
       
    49       AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
       
    50     fi
       
    51 
       
    52     if test "x${with_alsa}" != x; then
       
    53       ALSA_LIBS="-L${with_alsa}/lib -lasound"
       
    54       ALSA_CFLAGS="-I${with_alsa}/include"
       
    55       ALSA_FOUND=yes
       
    56     fi
       
    57     if test "x${with_alsa_include}" != x; then
       
    58       ALSA_CFLAGS="-I${with_alsa_include}"
       
    59       ALSA_FOUND=yes
       
    60     fi
       
    61     if test "x${with_alsa_lib}" != x; then
       
    62       ALSA_LIBS="-L${with_alsa_lib} -lasound"
       
    63       ALSA_FOUND=yes
       
    64     fi
       
    65     # Do not try pkg-config if we have a sysroot set.
       
    66     if test "x$SYSROOT" = x; then
       
    67       if test "x$ALSA_FOUND" = xno; then
       
    68         PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
       
    69       fi
       
    70     fi
       
    71     if test "x$ALSA_FOUND" = xno; then
       
    72       AC_CHECK_HEADERS([alsa/asoundlib.h],
       
    73           [
       
    74             ALSA_FOUND=yes
       
    75             ALSA_CFLAGS=-Iignoreme
       
    76             ALSA_LIBS=-lasound
       
    77             DEFAULT_ALSA=yes
       
    78           ],
       
    79           [ALSA_FOUND=no]
       
    80       )
       
    81     fi
       
    82     if test "x$ALSA_FOUND" = xno; then
       
    83       HELP_MSG_MISSING_DEPENDENCY([alsa])
       
    84       AC_MSG_ERROR([Could not find alsa! $HELP_MSG])
       
    85     fi
       
    86   fi
       
    87 
       
    88   AC_SUBST(ALSA_CFLAGS)
       
    89   AC_SUBST(ALSA_LIBS)
       
    90 ])