Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/aclocal/alsa.m4 @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 dnl Configure Paths for Alsa | |
2 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org> | |
3 dnl Christopher Lansdown <lansdoct@cs.alfred.edu> | |
4 dnl Jaroslav Kysela <perex@perex.cz> | |
5 dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $ | |
6 dnl | |
7 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
8 dnl Test for libasound, and define ALSA_CFLAGS, ALSA_LIBS and | |
9 dnl ALSA_TOPOLOGY_LIBS as appropriate. | |
10 dnl | |
11 dnl enables arguments --with-alsa-prefix= | |
12 dnl --with-alsa-inc-prefix= | |
13 dnl --disable-alsatest | |
14 dnl | |
15 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, | |
16 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result. | |
17 dnl | |
18 | |
19 AC_DEFUN([AM_PATH_ALSA], | |
20 [dnl Save the original CFLAGS, LDFLAGS, and LIBS | |
21 alsa_save_CFLAGS="$CFLAGS" | |
22 alsa_save_LDFLAGS="$LDFLAGS" | |
23 alsa_save_LIBS="$LIBS" | |
24 alsa_found=yes | |
25 alsa_topology_found=no | |
26 | |
27 dnl | |
28 dnl Get the cflags and libraries for alsa | |
29 dnl | |
30 AC_ARG_WITH(alsa-prefix, | |
31 AS_HELP_STRING([--with-alsa-prefix=PFX], [Prefix where Alsa library is installed(optional)]), | |
32 [alsa_prefix="$withval"], [alsa_prefix=""]) | |
33 | |
34 AC_ARG_WITH(alsa-inc-prefix, | |
35 AS_HELP_STRING([--with-alsa-inc-prefix=PFX], [Prefix where include libraries are (optional)]), | |
36 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) | |
37 | |
38 AC_ARG_ENABLE(alsa-topology, | |
39 AS_HELP_STRING([--enable-alsatopology], [Force to use the Alsa topology library]), | |
40 [enable_atopology="$enableval"], | |
41 [enable_atopology=no]) | |
42 | |
43 AC_ARG_ENABLE(alsatest, | |
44 AS_HELP_STRING([--disable-alsatest], [Do not try to compile and run a test Alsa program]), | |
45 [enable_alsatest="$enableval"], | |
46 [enable_alsatest=yes]) | |
47 | |
48 dnl Add any special include directories | |
49 AC_MSG_CHECKING(for ALSA CFLAGS) | |
50 if test "$alsa_inc_prefix" != "" ; then | |
51 ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" | |
52 CFLAGS="$CFLAGS -I$alsa_inc_prefix" | |
53 fi | |
54 AC_MSG_RESULT($ALSA_CFLAGS) | |
55 | |
56 AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) | |
57 | |
58 dnl add any special lib dirs | |
59 AC_MSG_CHECKING(for ALSA LDFLAGS) | |
60 if test "$alsa_prefix" != "" ; then | |
61 ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" | |
62 LDFLAGS="$LDFLAGS $ALSA_LIBS" | |
63 fi | |
64 | |
65 dnl add the alsa library | |
66 ALSA_LIBS="$ALSA_LIBS -lasound -lm $LIBDL -lpthread" | |
67 LIBS="$ALSA_LIBS $LIBS" | |
68 AC_MSG_RESULT($ALSA_LIBS) | |
69 | |
70 dnl Check for a working version of libasound that is of the right version. | |
71 if test "x$enable_alsatest" = "xyes"; then | |
72 | |
73 AC_MSG_CHECKING([required libasound headers version]) | |
74 min_alsa_version=ifelse([$1], , 0.1.1, $1) | |
75 no_alsa="" | |
76 alsa_min_major_version=`echo $min_alsa_version | \ | |
77 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
78 alsa_min_minor_version=`echo $min_alsa_version | \ | |
79 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
80 alsa_min_micro_version=`echo $min_alsa_version | \ | |
81 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
82 AC_MSG_RESULT($alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version) | |
83 | |
84 AC_LANG_SAVE | |
85 AC_LANG_C | |
86 AC_MSG_CHECKING([for libasound headers version >= $alsa_min_major_version.$alsa_min_minor_version.$alsa_min_micro_version ($min_alsa_version)]) | |
87 AC_TRY_COMPILE([ | |
88 #include <alsa/asoundlib.h> | |
89 ], [ | |
90 /* ensure backward compatibility */ | |
91 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) | |
92 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR | |
93 #endif | |
94 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) | |
95 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR | |
96 #endif | |
97 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) | |
98 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR | |
99 #endif | |
100 | |
101 # if(SND_LIB_MAJOR > $alsa_min_major_version) | |
102 exit(0); | |
103 # else | |
104 # if(SND_LIB_MAJOR < $alsa_min_major_version) | |
105 # error not present | |
106 # endif | |
107 | |
108 # if(SND_LIB_MINOR > $alsa_min_minor_version) | |
109 exit(0); | |
110 # else | |
111 # if(SND_LIB_MINOR < $alsa_min_minor_version) | |
112 # error not present | |
113 # endif | |
114 | |
115 # if(SND_LIB_SUBMINOR < $alsa_min_micro_version) | |
116 # error not present | |
117 # endif | |
118 # endif | |
119 # endif | |
120 exit(0); | |
121 ], | |
122 [AC_MSG_RESULT(found.)], | |
123 [AC_MSG_RESULT(not present.) | |
124 ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)]) | |
125 alsa_found=no] | |
126 ) | |
127 AC_LANG_RESTORE | |
128 | |
129 AC_LANG_SAVE | |
130 AC_LANG_C | |
131 AC_MSG_CHECKING([for libatopology (sound headers version > 1.1.9)]) | |
132 AC_TRY_COMPILE([ | |
133 #include <alsa/asoundlib.h> | |
134 #include <alsa/topology.h> | |
135 ], [ | |
136 /* ensure backward compatibility */ | |
137 #if !defined(SND_LIB_VERSION) | |
138 #define SND_LIB_VERSION 0 | |
139 #endif | |
140 #if SND_LIB_VERSION > 0x00010109 | |
141 exit(0); | |
142 #else | |
143 # error not present | |
144 #endif | |
145 exit(0); | |
146 ], | |
147 [AC_MSG_RESULT(yes) | |
148 enable_atopology="yes"], | |
149 [AC_MSG_RESULT(no)] | |
150 ) | |
151 AC_LANG_RESTORE | |
152 | |
153 fi | |
154 | |
155 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. | |
156 if test "x$enable_alsatest" = "xyes"; then | |
157 AC_CHECK_LIB([asound], [snd_ctl_open],, | |
158 [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)]) | |
159 alsa_found=no] | |
160 ) | |
161 if test "x$enable_atopology" = "xyes"; then | |
162 alsa_topology_found=yes | |
163 alsa_save_LIBS2="$LIBS" | |
164 AC_CHECK_LIB([atopology], [snd_tplg_new],, | |
165 [ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)]) | |
166 alsa_topology_found=no, | |
167 ] | |
168 ) | |
169 LIBS="$alsa_save_LIBS2" | |
170 fi | |
171 else | |
172 if test "x$enable_atopology" = "xyes"; then | |
173 alsa_topology_found=yes | |
174 fi | |
175 fi | |
176 | |
177 if test "x$alsa_found" = "xyes" ; then | |
178 ifelse([$2], , :, [$2]) | |
179 LIBS=`echo $LIBS | sed 's/-lasound//g'` | |
180 LIBS=`echo $LIBS | sed 's/ //'` | |
181 LIBS="-lasound $LIBS" | |
182 fi | |
183 if test "x$alsa_found" = "xno" ; then | |
184 ifelse([$3], , :, [$3]) | |
185 CFLAGS="$alsa_save_CFLAGS" | |
186 LDFLAGS="$alsa_save_LDFLAGS" | |
187 LIBS="$alsa_save_LIBS" | |
188 ALSA_CFLAGS="" | |
189 ALSA_LIBS="" | |
190 ALSA_TOPOLOGY_LIBS="" | |
191 fi | |
192 | |
193 dnl add the alsa topology library; must be at the end | |
194 AC_MSG_CHECKING(for ALSA topology LDFLAGS) | |
195 if test "x$alsa_topology_found" = "xyes"; then | |
196 ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology" | |
197 fi | |
198 AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS) | |
199 | |
200 dnl That should be it. Now just export out symbols: | |
201 AC_SUBST(ALSA_CFLAGS) | |
202 AC_SUBST(ALSA_LIBS) | |
203 AC_SUBST(ALSA_TOPOLOGY_LIBS) | |
204 ]) |