comparison linux.m4 @ 0:223b71206888

Initial import
author thib
date Fri, 01 Aug 2008 16:32:45 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:223b71206888
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl Configure Paths for Alsa
14 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
15 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
16 dnl Jaroslav Kysela <perex@suse.cz>
17 dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $
18 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
19 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
20 dnl enables arguments --with-alsa-prefix=
21 dnl --with-alsa-enc-prefix=
22 dnl --disable-alsatest
23 dnl
24 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
25 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
26 dnl
27 AC_DEFUN([AM_PATH_ALSA],
28 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
29 alsa_save_CFLAGS="$CFLAGS"
30 alsa_save_LDFLAGS="$LDFLAGS"
31 alsa_save_LIBS="$LIBS"
32 alsa_found=yes
33
34 dnl
35 dnl Get the cflags and libraries for alsa
36 dnl
37 AC_ARG_WITH(alsa-prefix,
38 [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
39 [alsa_prefix="$withval"], [alsa_prefix=""])
40
41 AC_ARG_WITH(alsa-inc-prefix,
42 [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
43 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
44
45 dnl FIXME: this is not yet implemented
46 AC_ARG_ENABLE(alsatest,
47 [ --disable-alsatest Do not try to compile and run a test Alsa program],
48 [enable_alsatest="$enableval"],
49 [enable_alsatest=yes])
50
51 dnl Add any special include directories
52 AC_MSG_CHECKING(for ALSA CFLAGS)
53 if test "$alsa_inc_prefix" != "" ; then
54 ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
55 CFLAGS="$CFLAGS -I$alsa_inc_prefix"
56 fi
57 AC_MSG_RESULT($ALSA_CFLAGS)
58 CFLAGS="$alsa_save_CFLAGS"
59
60 dnl add any special lib dirs
61 AC_MSG_CHECKING(for ALSA LDFLAGS)
62 if test "$alsa_prefix" != "" ; then
63 ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
64 LDFLAGS="$LDFLAGS $ALSA_LIBS"
65 fi
66
67 dnl add the alsa library
68 ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
69 LIBS="$ALSA_LIBS $LIBS"
70 AC_MSG_RESULT($ALSA_LIBS)
71
72 dnl Check for a working version of libasound that is of the right version.
73 min_alsa_version=ifelse([$1], ,0.1.1,$1)
74 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
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
83 AC_LANG_SAVE
84 AC_LANG_C
85 AC_TRY_COMPILE([
86 #include <alsa/asoundlib.h>
87 ], [
88 /* ensure backward compatibility */
89 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
90 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
91 #endif
92 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
93 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
94 #endif
95 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
96 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
97 #endif
98
99 # if(SND_LIB_MAJOR > $alsa_min_major_version)
100 exit(0);
101 # else
102 # if(SND_LIB_MAJOR < $alsa_min_major_version)
103 # error not present
104 # endif
105
106 # if(SND_LIB_MINOR > $alsa_min_minor_version)
107 exit(0);
108 # else
109 # if(SND_LIB_MINOR < $alsa_min_minor_version)
110 # error not present
111 # endif
112
113 # if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
114 # error not present
115 # endif
116 # endif
117 # endif
118 exit(0);
119 ],
120 [AC_MSG_RESULT(found.)],
121 [AC_MSG_RESULT(not present.)
122 ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
123 alsa_found=no]
124 )
125 AC_LANG_RESTORE
126
127 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
128 if test "x$enable_alsatest" = "xyes"; then
129 AC_CHECK_LIB([asound], [snd_ctl_open],,
130 [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
131 alsa_found=no]
132 )
133 fi
134
135 LDFLAGS="$alsa_save_LDFLAGS"
136 LIBS="$alsa_save_LIBS"
137
138 if test "x$alsa_found" = "xyes" ; then
139 ifelse([$2], , :, [$2])
140 else
141 ALSA_CFLAGS=""
142 ALSA_LIBS=""
143 ifelse([$3], , :, [$3])
144 fi
145
146 dnl That should be it. Now just export out symbols:
147 AC_SUBST(ALSA_CFLAGS)
148 AC_SUBST(ALSA_LIBS)
149 ])
150
151 # Configure paths for ESD
152 # Manish Singh 98-9-30
153 # stolen back from Frank Belew
154 # stolen from Manish Singh
155 # Shamelessly stolen from Owen Taylor
156
157 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
158 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
159 dnl
160 AC_DEFUN([AM_PATH_ESD],
161 [dnl
162 dnl Get the cflags and libraries from the esd-config script
163 dnl
164 AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
165 esd_prefix="$withval", esd_prefix="")
166 AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
167 esd_exec_prefix="$withval", esd_exec_prefix="")
168 AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program],
169 , enable_esdtest=yes)
170
171 if test x$esd_exec_prefix != x ; then
172 esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
173 if test x${ESD_CONFIG+set} != xset ; then
174 ESD_CONFIG=$esd_exec_prefix/bin/esd-config
175 fi
176 fi
177 if test x$esd_prefix != x ; then
178 esd_args="$esd_args --prefix=$esd_prefix"
179 if test x${ESD_CONFIG+set} != xset ; then
180 ESD_CONFIG=$esd_prefix/bin/esd-config
181 fi
182 fi
183
184 AC_PATH_PROG(ESD_CONFIG, esd-config, no)
185 min_esd_version=ifelse([$1], ,0.2.7,$1)
186 AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
187 no_esd=""
188 if test "$ESD_CONFIG" = "no" ; then
189 no_esd=yes
190 else
191 AC_LANG_SAVE
192 AC_LANG_C
193 ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
194 ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
195
196 esd_major_version=`$ESD_CONFIG $esd_args --version | \
197 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
198 esd_minor_version=`$ESD_CONFIG $esd_args --version | \
199 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
200 esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
201 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
202 if test "x$enable_esdtest" = "xyes" ; then
203 ac_save_CFLAGS="$CFLAGS"
204 ac_save_LIBS="$LIBS"
205 CFLAGS="$CFLAGS $ESD_CFLAGS"
206 LIBS="$LIBS $ESD_LIBS"
207 dnl
208 dnl Now check if the installed ESD is sufficiently new. (Also sanity
209 dnl checks the results of esd-config to some extent
210 dnl
211 rm -f conf.esdtest
212 AC_TRY_RUN([
213 #include <stdio.h>
214 #include <stdlib.h>
215 #include <string.h>
216 #include <esd.h>
217
218 char*
219 my_strdup (char *str)
220 {
221 char *new_str;
222
223 if (str)
224 {
225 new_str = malloc ((strlen (str) + 1) * sizeof(char));
226 strcpy (new_str, str);
227 }
228 else
229 new_str = NULL;
230
231 return new_str;
232 }
233
234 int main ()
235 {
236 int major, minor, micro;
237 char *tmp_version;
238
239 system ("touch conf.esdtest");
240
241 /* HP/UX 9 (%@#!) writes to sscanf strings */
242 tmp_version = my_strdup("$min_esd_version");
243 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
244 printf("%s, bad version string\n", "$min_esd_version");
245 exit(1);
246 }
247
248 if (($esd_major_version > major) ||
249 (($esd_major_version == major) && ($esd_minor_version > minor)) ||
250 (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
251 {
252 return 0;
253 }
254 else
255 {
256 printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
257 printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
258 printf("*** best to upgrade to the required version.\n");
259 printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
260 printf("*** to point to the correct copy of esd-config, and remove the file\n");
261 printf("*** config.cache before re-running configure\n");
262 return 1;
263 }
264 }
265
266 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
267 CFLAGS="$ac_save_CFLAGS"
268 LIBS="$ac_save_LIBS"
269 AC_LANG_RESTORE
270 fi
271 fi
272 if test "x$no_esd" = x ; then
273 AC_MSG_RESULT(yes)
274 ifelse([$2], , :, [$2])
275 else
276 AC_MSG_RESULT(no)
277 if test "$ESD_CONFIG" = "no" ; then
278 echo "*** The esd-config script installed by ESD could not be found"
279 echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
280 echo "*** your path, or set the ESD_CONFIG environment variable to the"
281 echo "*** full path to esd-config."
282 else
283 if test -f conf.esdtest ; then
284 :
285 else
286 echo "*** Could not run ESD test program, checking why..."
287 CFLAGS="$CFLAGS $ESD_CFLAGS"
288 LIBS="$LIBS $ESD_LIBS"
289 AC_LANG_SAVE
290 AC_LANG_C
291 AC_TRY_LINK([
292 #include <stdio.h>
293 #include <esd.h>
294 ], [ return 0; ],
295 [ echo "*** The test program compiled, but did not run. This usually means"
296 echo "*** that the run-time linker is not finding ESD or finding the wrong"
297 echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
298 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
299 echo "*** to the installed location Also, make sure you have run ldconfig if that"
300 echo "*** is required on your system"
301 echo "***"
302 echo "*** If you have an old version installed, it is best to remove it, although"
303 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
304 [ echo "*** The test program failed to compile or link. See the file config.log for the"
305 echo "*** exact error that occured. This usually means ESD was incorrectly installed"
306 echo "*** or that you have moved ESD since it was installed. In the latter case, you"
307 echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
308 CFLAGS="$ac_save_CFLAGS"
309 LIBS="$ac_save_LIBS"
310 AC_LANG_RESTORE
311 fi
312 fi
313 ESD_CFLAGS=""
314 ESD_LIBS=""
315 ifelse([$3], , :, [$3])
316 fi
317 AC_SUBST(ESD_CFLAGS)
318 AC_SUBST(ESD_LIBS)
319 rm -f conf.esdtest
320 ])
321
322 dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
323 dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
324 dnl
325 AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
326 [dnl
327 AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
328 ac_save_ESD_CFLAGS="$ESD_CFLAGS"
329 ac_save_ESD_LIBS="$ESD_LIBS"
330 AM_PATH_ESD(0.2.21,
331 ifelse([$1], , [
332 AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
333 AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
334 [Define if you have esound with support of multiple recording clients.])],
335 [$1]),
336 ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
337 if test "x$ac_save_ESD_CFLAGS" != x ; then
338 ESD_CFLAGS="$ac_save_ESD_CFLAGS"
339 fi
340 if test "x$ac_save_ESD_LIBS" != x ; then
341 ESD_LIBS="$ac_save_ESD_LIBS"
342 fi
343 )
344 ])