f0e74d58179bac8734e843e1619410383b95426d
[openwrt/svn-archive/archive.git] / libs / flac / patches / 003-missing-macros.patch
1 --- /dev/null
2 +++ b/acinclude.m4
3 @@ -0,0 +1,376 @@
4 +# CFLAGS and library paths for XMMS
5 +# written 15 December 1999 by Ben Gertzfield <che@debian.org>
6 +
7 +dnl Usage:
8 +dnl AM_PATH_XMMS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9 +dnl
10 +dnl Example:
11 +dnl AM_PATH_XMMS(0.9.5.1, , AC_MSG_ERROR([*** XMMS >= 0.9.5.1 not installed - please install first ***]))
12 +dnl
13 +dnl Defines XMMS_CFLAGS, XMMS_LIBS, XMMS_DATA_DIR, XMMS_PLUGIN_DIR,
14 +dnl XMMS_VISUALIZATION_PLUGIN_DIR, XMMS_INPUT_PLUGIN_DIR,
15 +dnl XMMS_OUTPUT_PLUGIN_DIR, XMMS_GENERAL_PLUGIN_DIR, XMMS_EFFECT_PLUGIN_DIR,
16 +dnl and XMMS_VERSION for your plugin pleasure.
17 +dnl
18 +
19 +dnl XMMS_TEST_VERSION(AVAILABLE-VERSION, NEEDED-VERSION [, ACTION-IF-OKAY [, ACTION-IF-NOT-OKAY]])
20 +AC_DEFUN([XMMS_TEST_VERSION], [
21 +
22 +# Determine which version number is greater. Prints 2 to stdout if
23 +# the second number is greater, 1 if the first number is greater,
24 +# 0 if the numbers are equal.
25 +
26 +# Written 15 December 1999 by Ben Gertzfield <che@debian.org>
27 +# Revised 15 December 1999 by Jim Monty <monty@primenet.com>
28 +
29 + AC_PROG_AWK
30 + xmms_got_version=[` $AWK ' \
31 +BEGIN { \
32 + print vercmp(ARGV[1], ARGV[2]); \
33 +} \
34 + \
35 +function vercmp(ver1, ver2, ver1arr, ver2arr, \
36 + ver1len, ver2len, \
37 + ver1int, ver2int, len, i, p) { \
38 + \
39 + ver1len = split(ver1, ver1arr, /\./); \
40 + ver2len = split(ver2, ver2arr, /\./); \
41 + \
42 + len = ver1len > ver2len ? ver1len : ver2len; \
43 + \
44 + for (i = 1; i <= len; i++) { \
45 + p = 1000 ^ (len - i); \
46 + ver1int += ver1arr[i] * p; \
47 + ver2int += ver2arr[i] * p; \
48 + } \
49 + \
50 + if (ver1int < ver2int) \
51 + return 2; \
52 + else if (ver1int > ver2int) \
53 + return 1; \
54 + else \
55 + return 0; \
56 +}' $1 $2`]
57 +
58 + if test $xmms_got_version -eq 2; then # failure
59 + ifelse([$4], , :, $4)
60 + else # success!
61 + ifelse([$3], , :, $3)
62 + fi
63 +])
64 +
65 +AC_DEFUN([AM_PATH_XMMS],
66 +[
67 +AC_ARG_WITH(xmms-prefix,[ --with-xmms-prefix=PFX Prefix where XMMS is installed (optional)],
68 + xmms_config_prefix="$withval", xmms_config_prefix="")
69 +AC_ARG_WITH(xmms-exec-prefix,[ --with-xmms-exec-prefix=PFX Exec prefix where XMMS is installed (optional)],
70 + xmms_config_exec_prefix="$withval", xmms_config_exec_prefix="")
71 +
72 +if test x$xmms_config_exec_prefix != x; then
73 + xmms_config_args="$xmms_config_args --exec-prefix=$xmms_config_exec_prefix"
74 + if test x${XMMS_CONFIG+set} != xset; then
75 + XMMS_CONFIG=$xmms_config_exec_prefix/bin/xmms-config
76 + fi
77 +fi
78 +
79 +if test x$xmms_config_prefix != x; then
80 + xmms_config_args="$xmms_config_args --prefix=$xmms_config_prefix"
81 + if test x${XMMS_CONFIG+set} != xset; then
82 + XMMS_CONFIG=$xmms_config_prefix/bin/xmms-config
83 + fi
84 +fi
85 +
86 +AC_PATH_PROG(XMMS_CONFIG, xmms-config, no)
87 +min_xmms_version=ifelse([$1], ,0.9.5.1, $1)
88 +
89 +if test "$XMMS_CONFIG" = "no"; then
90 + no_xmms=yes
91 +else
92 + XMMS_CFLAGS=`$XMMS_CONFIG $xmms_config_args --cflags`
93 + XMMS_LIBS=`$XMMS_CONFIG $xmms_config_args --libs`
94 + XMMS_VERSION=`$XMMS_CONFIG $xmms_config_args --version`
95 + XMMS_DATA_DIR=`$XMMS_CONFIG $xmms_config_args --data-dir`
96 + XMMS_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --plugin-dir`
97 + XMMS_VISUALIZATION_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args \
98 + --visualization-plugin-dir`
99 + XMMS_INPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --input-plugin-dir`
100 + XMMS_OUTPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --output-plugin-dir`
101 + XMMS_EFFECT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --effect-plugin-dir`
102 + XMMS_GENERAL_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --general-plugin-dir`
103 +
104 + XMMS_TEST_VERSION($XMMS_VERSION, $min_xmms_version, ,no_xmms=version)
105 +fi
106 +
107 +AC_MSG_CHECKING(for XMMS - version >= $min_xmms_version)
108 +
109 +if test "x$no_xmms" = x; then
110 + AC_MSG_RESULT(yes)
111 + ifelse([$2], , :, [$2])
112 +else
113 + AC_MSG_RESULT(no)
114 +
115 + if test "$XMMS_CONFIG" = "no" ; then
116 + echo "*** The xmms-config script installed by XMMS could not be found."
117 + echo "*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in"
118 + echo "*** your path, or set the XMMS_CONFIG environment variable to the"
119 + echo "*** full path to xmms-config."
120 + else
121 + if test "$no_xmms" = "version"; then
122 + echo "*** An old version of XMMS, $XMMS_VERSION, was found."
123 + echo "*** You need a version of XMMS newer than $min_xmms_version."
124 + echo "*** The latest version of XMMS is always available from"
125 + echo "*** http://www.xmms.org/"
126 + echo "***"
127 +
128 + echo "*** If you have already installed a sufficiently new version, this error"
129 + echo "*** probably means that the wrong copy of the xmms-config shell script is"
130 + echo "*** being found. The easiest way to fix this is to remove the old version"
131 + echo "*** of XMMS, but you can also set the XMMS_CONFIG environment to point to the"
132 + echo "*** correct copy of xmms-config. (In this case, you will have to"
133 + echo "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf"
134 + echo "*** so that the correct libraries are found at run-time)"
135 + fi
136 + fi
137 + XMMS_CFLAGS=""
138 + XMMS_LIBS=""
139 + ifelse([$3], , :, [$3])
140 +fi
141 +AC_SUBST(XMMS_CFLAGS)
142 +AC_SUBST(XMMS_LIBS)
143 +AC_SUBST(XMMS_VERSION)
144 +AC_SUBST(XMMS_DATA_DIR)
145 +AC_SUBST(XMMS_PLUGIN_DIR)
146 +AC_SUBST(XMMS_VISUALIZATION_PLUGIN_DIR)
147 +AC_SUBST(XMMS_INPUT_PLUGIN_DIR)
148 +AC_SUBST(XMMS_OUTPUT_PLUGIN_DIR)
149 +AC_SUBST(XMMS_GENERAL_PLUGIN_DIR)
150 +AC_SUBST(XMMS_EFFECT_PLUGIN_DIR)
151 +])
152 +
153 +# Configure paths for libogg
154 +# Jack Moffitt <jack@icecast.org> 10-21-2000
155 +# Shamelessly stolen from Owen Taylor and Manish Singh
156 +
157 +dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
158 +dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
159 +dnl
160 +AC_DEFUN([XIPH_PATH_OGG],
161 +[dnl
162 +dnl Get the cflags and libraries
163 +dnl
164 +AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
165 +AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
166 +AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
167 +AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
168 +
169 + if test "x$ogg_libraries" != "x" ; then
170 + OGG_LIBS="-L$ogg_libraries"
171 + elif test "x$ogg_prefix" != "x" ; then
172 + OGG_LIBS="-L$ogg_prefix/lib"
173 + elif test "x$prefix" != "xNONE" ; then
174 + OGG_LIBS="-L$prefix/lib"
175 + fi
176 +
177 + OGG_LIBS="$OGG_LIBS -logg"
178 +
179 + if test "x$ogg_includes" != "x" ; then
180 + OGG_CFLAGS="-I$ogg_includes"
181 + elif test "x$ogg_prefix" != "x" ; then
182 + OGG_CFLAGS="-I$ogg_prefix/include"
183 + elif test "x$prefix" != "xNONE"; then
184 + OGG_CFLAGS="-I$prefix/include"
185 + fi
186 +
187 + AC_MSG_CHECKING(for Ogg)
188 + no_ogg=""
189 +
190 +
191 + if test "x$enable_oggtest" = "xyes" ; then
192 + ac_save_CFLAGS="$CFLAGS"
193 + ac_save_LIBS="$LIBS"
194 + CFLAGS="$CFLAGS $OGG_CFLAGS"
195 + LIBS="$LIBS $OGG_LIBS"
196 +dnl
197 +dnl Now check if the installed Ogg is sufficiently new.
198 +dnl
199 + rm -f conf.oggtest
200 + AC_TRY_RUN([
201 +#include <stdio.h>
202 +#include <stdlib.h>
203 +#include <string.h>
204 +#include <ogg/ogg.h>
205 +
206 +int main ()
207 +{
208 + system("touch conf.oggtest");
209 + return 0;
210 +}
211 +
212 +],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
213 + CFLAGS="$ac_save_CFLAGS"
214 + LIBS="$ac_save_LIBS"
215 + fi
216 +
217 + if test "x$no_ogg" = "x" ; then
218 + AC_MSG_RESULT(yes)
219 + ifelse([$1], , :, [$1])
220 + else
221 + AC_MSG_RESULT(no)
222 + if test -f conf.oggtest ; then
223 + :
224 + else
225 + echo "*** Could not run Ogg test program, checking why..."
226 + CFLAGS="$CFLAGS $OGG_CFLAGS"
227 + LIBS="$LIBS $OGG_LIBS"
228 + AC_TRY_LINK([
229 +#include <stdio.h>
230 +#include <ogg/ogg.h>
231 +], [ return 0; ],
232 + [ echo "*** The test program compiled, but did not run. This usually means"
233 + echo "*** that the run-time linker is not finding Ogg or finding the wrong"
234 + echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
235 + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
236 + echo "*** to the installed location Also, make sure you have run ldconfig if that"
237 + echo "*** is required on your system"
238 + echo "***"
239 + echo "*** If you have an old version installed, it is best to remove it, although"
240 + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
241 + [ echo "*** The test program failed to compile or link. See the file config.log for the"
242 + echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
243 + echo "*** or that you have moved Ogg since it was installed." ])
244 + CFLAGS="$ac_save_CFLAGS"
245 + LIBS="$ac_save_LIBS"
246 + fi
247 + OGG_CFLAGS=""
248 + OGG_LIBS=""
249 + ifelse([$2], , :, [$2])
250 + fi
251 + AC_SUBST(OGG_CFLAGS)
252 + AC_SUBST(OGG_LIBS)
253 + rm -f conf.oggtest
254 +])
255 +
256 +# iconv.m4 serial AM4 (gettext-0.11.3)
257 +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
258 +dnl This file is free software; the Free Software Foundation
259 +dnl gives unlimited permission to copy and/or distribute it,
260 +dnl with or without modifications, as long as this notice is preserved.
261 +
262 +dnl From Bruno Haible.
263 +
264 +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
265 +[
266 + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
267 + AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
268 + AC_REQUIRE([AC_LIB_RPATH])
269 +
270 + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
271 + dnl accordingly.
272 + AC_LIB_LINKFLAGS_BODY([iconv])
273 +])
274 +
275 +AC_DEFUN([AM_ICONV_LINK],
276 +[
277 + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
278 + dnl those with the standalone portable GNU libiconv installed).
279 +
280 + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
281 + dnl accordingly.
282 + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
283 +
284 + dnl Add $INCICONV to CPPFLAGS before performing the following checks,
285 + dnl because if the user has installed libiconv and not disabled its use
286 + dnl via --without-libiconv-prefix, he wants to use it. The first
287 + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
288 + am_save_CPPFLAGS="$CPPFLAGS"
289 + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
290 +
291 + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
292 + am_cv_func_iconv="no, consider installing GNU libiconv"
293 + am_cv_lib_iconv=no
294 + AC_TRY_LINK([#include <stdlib.h>
295 +#include <iconv.h>],
296 + [iconv_t cd = iconv_open("","");
297 + iconv(cd,NULL,NULL,NULL,NULL);
298 + iconv_close(cd);],
299 + am_cv_func_iconv=yes)
300 + if test "$am_cv_func_iconv" != yes; then
301 + am_save_LIBS="$LIBS"
302 + LIBS="$LIBS $LIBICONV"
303 + AC_TRY_LINK([#include <stdlib.h>
304 +#include <iconv.h>],
305 + [iconv_t cd = iconv_open("","");
306 + iconv(cd,NULL,NULL,NULL,NULL);
307 + iconv_close(cd);],
308 + am_cv_lib_iconv=yes
309 + am_cv_func_iconv=yes)
310 + LIBS="$am_save_LIBS"
311 + fi
312 + ])
313 + if test "$am_cv_func_iconv" = yes; then
314 + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
315 + fi
316 + if test "$am_cv_lib_iconv" = yes; then
317 + AC_MSG_CHECKING([how to link with libiconv])
318 + AC_MSG_RESULT([$LIBICONV])
319 + else
320 + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
321 + dnl either.
322 + CPPFLAGS="$am_save_CPPFLAGS"
323 + LIBICONV=
324 + LTLIBICONV=
325 + fi
326 + AC_SUBST(LIBICONV)
327 + AC_SUBST(LTLIBICONV)
328 +])
329 +
330 +AC_DEFUN([AM_ICONV],
331 +[
332 + AM_ICONV_LINK
333 + if test "$am_cv_func_iconv" = yes; then
334 + AC_MSG_CHECKING([for iconv declaration])
335 + AC_CACHE_VAL(am_cv_proto_iconv, [
336 + AC_TRY_COMPILE([
337 +#include <stdlib.h>
338 +#include <iconv.h>
339 +extern
340 +#ifdef __cplusplus
341 +"C"
342 +#endif
343 +#if defined(__STDC__) || defined(__cplusplus)
344 +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
345 +#else
346 +size_t iconv();
347 +#endif
348 +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
349 + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
350 + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
351 + AC_MSG_RESULT([$]{ac_t:-
352 + }[$]am_cv_proto_iconv)
353 + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
354 + [Define as const if the declaration of iconv() needs const.])
355 + fi
356 +])
357 +
358 +# codeset.m4 serial AM1 (gettext-0.10.40)
359 +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
360 +dnl This file is free software; the Free Software Foundation
361 +dnl gives unlimited permission to copy and/or distribute it,
362 +dnl with or without modifications, as long as this notice is preserved.
363 +
364 +dnl From Bruno Haible.
365 +
366 +AC_DEFUN([AM_LANGINFO_CODESET],
367 +[
368 + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
369 + [AC_TRY_LINK([#include <langinfo.h>],
370 + [char* cs = nl_langinfo(CODESET);],
371 + am_cv_langinfo_codeset=yes,
372 + am_cv_langinfo_codeset=no)
373 + ])
374 + if test $am_cv_langinfo_codeset = yes; then
375 + AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
376 + [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
377 + fi
378 +])
379 +