OSDN Git Service

Autoreconf
[timidity41/timidity41.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.6 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # Do all the work for Automake.                            -*- Autoconf -*-
15
16 # This macro actually does too much some checks are only needed if
17 # your package does certain things.  But this isn't really a big deal.
18
19 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
20 # Free Software Foundation, Inc.
21
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 2, or (at your option)
25 # any later version.
26
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 # GNU General Public License for more details.
31
32 # You should have received a copy of the GNU General Public License
33 # along with this program; if not, write to the Free Software
34 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 # 02111-1307, USA.
36
37 # serial 10
38
39 AC_PREREQ([2.54])
40
41 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
42 # the ones we care about.
43 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44
45 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
46 # AM_INIT_AUTOMAKE([OPTIONS])
47 # -----------------------------------------------
48 # The call with PACKAGE and VERSION arguments is the old style
49 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
50 # and VERSION should now be passed to AC_INIT and removed from
51 # the call to AM_INIT_AUTOMAKE.
52 # We support both call styles for the transition.  After
53 # the next Automake release, Autoconf can make the AC_INIT
54 # arguments mandatory, and then we can depend on a new Autoconf
55 # release and drop the old call support.
56 AC_DEFUN([AM_INIT_AUTOMAKE],
57 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
58  AC_REQUIRE([AC_PROG_INSTALL])dnl
59 # test to see if srcdir already configured
60 if test "`cd $srcdir && pwd`" != "`pwd`" &&
61    test -f $srcdir/config.status; then
62   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
63 fi
64
65 # test whether we have cygpath
66 if test -z "$CYGPATH_W"; then
67   if (cygpath --version) >/dev/null 2>/dev/null; then
68     CYGPATH_W='cygpath -w'
69   else
70     CYGPATH_W=echo
71   fi
72 fi
73 AC_SUBST([CYGPATH_W])
74
75 # Define the identity of the package.
76 dnl Distinguish between old-style and new-style calls.
77 m4_ifval([$2],
78 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
79  AC_SUBST([PACKAGE], [$1])dnl
80  AC_SUBST([VERSION], [$2])],
81 [_AM_SET_OPTIONS([$1])dnl
82  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
83  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
84
85 _AM_IF_OPTION([no-define],,
86 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
87  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
88
89 # Some tools Automake needs.
90 AC_REQUIRE([AM_SANITY_CHECK])dnl
91 AC_REQUIRE([AC_ARG_PROGRAM])dnl
92 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
93 AM_MISSING_PROG(AUTOCONF, autoconf)
94 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
95 AM_MISSING_PROG(AUTOHEADER, autoheader)
96 AM_MISSING_PROG(MAKEINFO, makeinfo)
97 AM_MISSING_PROG(AMTAR, tar)
98 AM_PROG_INSTALL_SH
99 AM_PROG_INSTALL_STRIP
100 # We need awk for the "check" target.  The system "awk" is bad on
101 # some platforms.
102 AC_REQUIRE([AC_PROG_AWK])dnl
103 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
104 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
105
106 _AM_IF_OPTION([no-dependencies],,
107 [AC_PROVIDE_IFELSE([AC_PROG_CC],
108                   [_AM_DEPENDENCIES(CC)],
109                   [define([AC_PROG_CC],
110                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
111 AC_PROVIDE_IFELSE([AC_PROG_CXX],
112                   [_AM_DEPENDENCIES(CXX)],
113                   [define([AC_PROG_CXX],
114                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
115 ])
116 ])
117
118
119 # When config.status generates a header, we must update the stamp-h file.
120 # This file resides in the same directory as the config header
121 # that is generated.  The stamp files are numbered to have different names.
122
123 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
124 # loop where config.status creates the headers, so we can generate
125 # our stamp files there.
126 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
127 [# Compute $1's index in $config_headers.
128 _am_stamp_count=1
129 for _am_header in $config_headers :; do
130   case $_am_header in
131     $1 | $1:* )
132       break ;;
133     * )
134       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
135   esac
136 done
137 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
138
139 # Copyright 2002  Free Software Foundation, Inc.
140
141 # This program is free software; you can redistribute it and/or modify
142 # it under the terms of the GNU General Public License as published by
143 # the Free Software Foundation; either version 2, or (at your option)
144 # any later version.
145
146 # This program is distributed in the hope that it will be useful,
147 # but WITHOUT ANY WARRANTY; without even the implied warranty of
148 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
149 # GNU General Public License for more details.
150
151 # You should have received a copy of the GNU General Public License
152 # along with this program; if not, write to the Free Software
153 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
154
155 # AM_AUTOMAKE_VERSION(VERSION)
156 # ----------------------------
157 # Automake X.Y traces this macro to ensure aclocal.m4 has been
158 # generated from the m4 files accompanying Automake X.Y.
159 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
160
161 # AM_SET_CURRENT_AUTOMAKE_VERSION
162 # -------------------------------
163 # Call AM_AUTOMAKE_VERSION so it can be traced.
164 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
165 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
166          [AM_AUTOMAKE_VERSION([1.7.6])])
167
168 # Helper functions for option handling.                    -*- Autoconf -*-
169
170 # Copyright 2001, 2002  Free Software Foundation, Inc.
171
172 # This program is free software; you can redistribute it and/or modify
173 # it under the terms of the GNU General Public License as published by
174 # the Free Software Foundation; either version 2, or (at your option)
175 # any later version.
176
177 # This program is distributed in the hope that it will be useful,
178 # but WITHOUT ANY WARRANTY; without even the implied warranty of
179 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
180 # GNU General Public License for more details.
181
182 # You should have received a copy of the GNU General Public License
183 # along with this program; if not, write to the Free Software
184 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
185 # 02111-1307, USA.
186
187 # serial 2
188
189 # _AM_MANGLE_OPTION(NAME)
190 # -----------------------
191 AC_DEFUN([_AM_MANGLE_OPTION],
192 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
193
194 # _AM_SET_OPTION(NAME)
195 # ------------------------------
196 # Set option NAME.  Presently that only means defining a flag for this option.
197 AC_DEFUN([_AM_SET_OPTION],
198 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
199
200 # _AM_SET_OPTIONS(OPTIONS)
201 # ----------------------------------
202 # OPTIONS is a space-separated list of Automake options.
203 AC_DEFUN([_AM_SET_OPTIONS],
204 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
205
206 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
207 # -------------------------------------------
208 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
209 AC_DEFUN([_AM_IF_OPTION],
210 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
211
212 #
213 # Check to make sure that the build environment is sane.
214 #
215
216 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
217
218 # This program is free software; you can redistribute it and/or modify
219 # it under the terms of the GNU General Public License as published by
220 # the Free Software Foundation; either version 2, or (at your option)
221 # any later version.
222
223 # This program is distributed in the hope that it will be useful,
224 # but WITHOUT ANY WARRANTY; without even the implied warranty of
225 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
226 # GNU General Public License for more details.
227
228 # You should have received a copy of the GNU General Public License
229 # along with this program; if not, write to the Free Software
230 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
231 # 02111-1307, USA.
232
233 # serial 3
234
235 # AM_SANITY_CHECK
236 # ---------------
237 AC_DEFUN([AM_SANITY_CHECK],
238 [AC_MSG_CHECKING([whether build environment is sane])
239 # Just in case
240 sleep 1
241 echo timestamp > conftest.file
242 # Do `set' in a subshell so we don't clobber the current shell's
243 # arguments.  Must try -L first in case configure is actually a
244 # symlink; some systems play weird games with the mod time of symlinks
245 # (eg FreeBSD returns the mod time of the symlink's containing
246 # directory).
247 if (
248    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
249    if test "$[*]" = "X"; then
250       # -L didn't work.
251       set X `ls -t $srcdir/configure conftest.file`
252    fi
253    rm -f conftest.file
254    if test "$[*]" != "X $srcdir/configure conftest.file" \
255       && test "$[*]" != "X conftest.file $srcdir/configure"; then
256
257       # If neither matched, then we have a broken ls.  This can happen
258       # if, for instance, CONFIG_SHELL is bash and it inherits a
259       # broken ls alias from the environment.  This has actually
260       # happened.  Such a system could not be considered "sane".
261       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
262 alias in your environment])
263    fi
264
265    test "$[2]" = conftest.file
266    )
267 then
268    # Ok.
269    :
270 else
271    AC_MSG_ERROR([newly created file is older than distributed files!
272 Check your system clock])
273 fi
274 AC_MSG_RESULT(yes)])
275
276 #  -*- Autoconf -*-
277
278
279 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
280
281 # This program is free software; you can redistribute it and/or modify
282 # it under the terms of the GNU General Public License as published by
283 # the Free Software Foundation; either version 2, or (at your option)
284 # any later version.
285
286 # This program is distributed in the hope that it will be useful,
287 # but WITHOUT ANY WARRANTY; without even the implied warranty of
288 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
289 # GNU General Public License for more details.
290
291 # You should have received a copy of the GNU General Public License
292 # along with this program; if not, write to the Free Software
293 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
294 # 02111-1307, USA.
295
296 # serial 3
297
298 # AM_MISSING_PROG(NAME, PROGRAM)
299 # ------------------------------
300 AC_DEFUN([AM_MISSING_PROG],
301 [AC_REQUIRE([AM_MISSING_HAS_RUN])
302 $1=${$1-"${am_missing_run}$2"}
303 AC_SUBST($1)])
304
305
306 # AM_MISSING_HAS_RUN
307 # ------------------
308 # Define MISSING if not defined so far and test if it supports --run.
309 # If it does, set am_missing_run to use it, otherwise, to nothing.
310 AC_DEFUN([AM_MISSING_HAS_RUN],
311 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
312 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
313 # Use eval to expand $SHELL
314 if eval "$MISSING --run true"; then
315   am_missing_run="$MISSING --run "
316 else
317   am_missing_run=
318   AC_MSG_WARN([`missing' script is too old or missing])
319 fi
320 ])
321
322 # AM_AUX_DIR_EXPAND
323
324 # Copyright 2001 Free Software Foundation, Inc.
325
326 # This program is free software; you can redistribute it and/or modify
327 # it under the terms of the GNU General Public License as published by
328 # the Free Software Foundation; either version 2, or (at your option)
329 # any later version.
330
331 # This program is distributed in the hope that it will be useful,
332 # but WITHOUT ANY WARRANTY; without even the implied warranty of
333 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
334 # GNU General Public License for more details.
335
336 # You should have received a copy of the GNU General Public License
337 # along with this program; if not, write to the Free Software
338 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
339 # 02111-1307, USA.
340
341 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
342 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
343 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
344 #
345 # Of course, Automake must honor this variable whenever it calls a
346 # tool from the auxiliary directory.  The problem is that $srcdir (and
347 # therefore $ac_aux_dir as well) can be either absolute or relative,
348 # depending on how configure is run.  This is pretty annoying, since
349 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
350 # source directory, any form will work fine, but in subdirectories a
351 # relative path needs to be adjusted first.
352 #
353 # $ac_aux_dir/missing
354 #    fails when called from a subdirectory if $ac_aux_dir is relative
355 # $top_srcdir/$ac_aux_dir/missing
356 #    fails if $ac_aux_dir is absolute,
357 #    fails when called from a subdirectory in a VPATH build with
358 #          a relative $ac_aux_dir
359 #
360 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
361 # are both prefixed by $srcdir.  In an in-source build this is usually
362 # harmless because $srcdir is `.', but things will broke when you
363 # start a VPATH build or use an absolute $srcdir.
364 #
365 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
366 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
367 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
368 # and then we would define $MISSING as
369 #   MISSING="\${SHELL} $am_aux_dir/missing"
370 # This will work as long as MISSING is not called from configure, because
371 # unfortunately $(top_srcdir) has no meaning in configure.
372 # However there are other variables, like CC, which are often used in
373 # configure, and could therefore not use this "fixed" $ac_aux_dir.
374 #
375 # Another solution, used here, is to always expand $ac_aux_dir to an
376 # absolute PATH.  The drawback is that using absolute paths prevent a
377 # configured tree to be moved without reconfiguration.
378
379 # Rely on autoconf to set up CDPATH properly.
380 AC_PREREQ([2.50])
381
382 AC_DEFUN([AM_AUX_DIR_EXPAND], [
383 # expand $ac_aux_dir to an absolute path
384 am_aux_dir=`cd $ac_aux_dir && pwd`
385 ])
386
387 # AM_PROG_INSTALL_SH
388 # ------------------
389 # Define $install_sh.
390
391 # Copyright 2001 Free Software Foundation, Inc.
392
393 # This program is free software; you can redistribute it and/or modify
394 # it under the terms of the GNU General Public License as published by
395 # the Free Software Foundation; either version 2, or (at your option)
396 # any later version.
397
398 # This program is distributed in the hope that it will be useful,
399 # but WITHOUT ANY WARRANTY; without even the implied warranty of
400 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
401 # GNU General Public License for more details.
402
403 # You should have received a copy of the GNU General Public License
404 # along with this program; if not, write to the Free Software
405 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
406 # 02111-1307, USA.
407
408 AC_DEFUN([AM_PROG_INSTALL_SH],
409 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
410 install_sh=${install_sh-"$am_aux_dir/install-sh"}
411 AC_SUBST(install_sh)])
412
413 # AM_PROG_INSTALL_STRIP
414
415 # Copyright 2001 Free Software Foundation, Inc.
416
417 # This program is free software; you can redistribute it and/or modify
418 # it under the terms of the GNU General Public License as published by
419 # the Free Software Foundation; either version 2, or (at your option)
420 # any later version.
421
422 # This program is distributed in the hope that it will be useful,
423 # but WITHOUT ANY WARRANTY; without even the implied warranty of
424 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
425 # GNU General Public License for more details.
426
427 # You should have received a copy of the GNU General Public License
428 # along with this program; if not, write to the Free Software
429 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
430 # 02111-1307, USA.
431
432 # One issue with vendor `install' (even GNU) is that you can't
433 # specify the program used to strip binaries.  This is especially
434 # annoying in cross-compiling environments, where the build's strip
435 # is unlikely to handle the host's binaries.
436 # Fortunately install-sh will honor a STRIPPROG variable, so we
437 # always use install-sh in `make install-strip', and initialize
438 # STRIPPROG with the value of the STRIP variable (set by the user).
439 AC_DEFUN([AM_PROG_INSTALL_STRIP],
440 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
441 # Installed binaries are usually stripped using `strip' when the user
442 # run `make install-strip'.  However `strip' might not be the right
443 # tool to use in cross-compilation environments, therefore Automake
444 # will honor the `STRIP' environment variable to overrule this program.
445 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
446 if test "$cross_compiling" != no; then
447   AC_CHECK_TOOL([STRIP], [strip], :)
448 fi
449 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
450 AC_SUBST([INSTALL_STRIP_PROGRAM])])
451
452 #                                                          -*- Autoconf -*-
453 # Copyright (C) 2003  Free Software Foundation, Inc.
454
455 # This program is free software; you can redistribute it and/or modify
456 # it under the terms of the GNU General Public License as published by
457 # the Free Software Foundation; either version 2, or (at your option)
458 # any later version.
459
460 # This program is distributed in the hope that it will be useful,
461 # but WITHOUT ANY WARRANTY; without even the implied warranty of
462 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
463 # GNU General Public License for more details.
464
465 # You should have received a copy of the GNU General Public License
466 # along with this program; if not, write to the Free Software
467 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
468 # 02111-1307, USA.
469
470 # serial 1
471
472 # Check whether the underlying file-system supports filenames
473 # with a leading dot.  For instance MS-DOS doesn't.
474 AC_DEFUN([AM_SET_LEADING_DOT],
475 [rm -rf .tst 2>/dev/null
476 mkdir .tst 2>/dev/null
477 if test -d .tst; then
478   am__leading_dot=.
479 else
480   am__leading_dot=_
481 fi
482 rmdir .tst 2>/dev/null
483 AC_SUBST([am__leading_dot])])
484
485 # serial 5                                              -*- Autoconf -*-
486
487 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
488
489 # This program is free software; you can redistribute it and/or modify
490 # it under the terms of the GNU General Public License as published by
491 # the Free Software Foundation; either version 2, or (at your option)
492 # any later version.
493
494 # This program is distributed in the hope that it will be useful,
495 # but WITHOUT ANY WARRANTY; without even the implied warranty of
496 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
497 # GNU General Public License for more details.
498
499 # You should have received a copy of the GNU General Public License
500 # along with this program; if not, write to the Free Software
501 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
502 # 02111-1307, USA.
503
504
505 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
506 # written in clear, in which case automake, when reading aclocal.m4,
507 # will think it sees a *use*, and therefore will trigger all it's
508 # C support machinery.  Also note that it means that autoscan, seeing
509 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
510
511
512
513 # _AM_DEPENDENCIES(NAME)
514 # ----------------------
515 # See how the compiler implements dependency checking.
516 # NAME is "CC", "CXX", "GCJ", or "OBJC".
517 # We try a few techniques and use that to set a single cache variable.
518 #
519 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
520 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
521 # dependency, and given that the user is not expected to run this macro,
522 # just rely on AC_PROG_CC.
523 AC_DEFUN([_AM_DEPENDENCIES],
524 [AC_REQUIRE([AM_SET_DEPDIR])dnl
525 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
526 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
527 AC_REQUIRE([AM_DEP_TRACK])dnl
528
529 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
530        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
531        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
532        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
533                    [depcc="$$1"   am_compiler_list=])
534
535 AC_CACHE_CHECK([dependency style of $depcc],
536                [am_cv_$1_dependencies_compiler_type],
537 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
538   # We make a subdir and do the tests there.  Otherwise we can end up
539   # making bogus files that we don't know about and never remove.  For
540   # instance it was reported that on HP-UX the gcc test will end up
541   # making a dummy file named `D' -- because `-MD' means `put the output
542   # in D'.
543   mkdir conftest.dir
544   # Copy depcomp to subdir because otherwise we won't find it if we're
545   # using a relative directory.
546   cp "$am_depcomp" conftest.dir
547   cd conftest.dir
548   # We will build objects and dependencies in a subdirectory because
549   # it helps to detect inapplicable dependency modes.  For instance
550   # both Tru64's cc and ICC support -MD to output dependencies as a
551   # side effect of compilation, but ICC will put the dependencies in
552   # the current directory while Tru64 will put them in the object
553   # directory.
554   mkdir sub
555
556   am_cv_$1_dependencies_compiler_type=none
557   if test "$am_compiler_list" = ""; then
558      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
559   fi
560   for depmode in $am_compiler_list; do
561     # Setup a source with many dependencies, because some compilers
562     # like to wrap large dependency lists on column 80 (with \), and
563     # we should not choose a depcomp mode which is confused by this.
564     #
565     # We need to recreate these files for each test, as the compiler may
566     # overwrite some of them when testing with obscure command lines.
567     # This happens at least with the AIX C compiler.
568     : > sub/conftest.c
569     for i in 1 2 3 4 5 6; do
570       echo '#include "conftst'$i'.h"' >> sub/conftest.c
571       : > sub/conftst$i.h
572     done
573     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
574
575     case $depmode in
576     nosideeffect)
577       # after this tag, mechanisms are not by side-effect, so they'll
578       # only be used when explicitly requested
579       if test "x$enable_dependency_tracking" = xyes; then
580         continue
581       else
582         break
583       fi
584       ;;
585     none) break ;;
586     esac
587     # We check with `-c' and `-o' for the sake of the "dashmstdout"
588     # mode.  It turns out that the SunPro C++ compiler does not properly
589     # handle `-M -o', and we need to detect this.
590     if depmode=$depmode \
591        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
592        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
593        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
594          >/dev/null 2>conftest.err &&
595        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
596        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
597        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
598       # icc doesn't choke on unknown options, it will just issue warnings
599       # (even with -Werror).  So we grep stderr for any message
600       # that says an option was ignored.
601       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
602         am_cv_$1_dependencies_compiler_type=$depmode
603         break
604       fi
605     fi
606   done
607
608   cd ..
609   rm -rf conftest.dir
610 else
611   am_cv_$1_dependencies_compiler_type=none
612 fi
613 ])
614 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
615 AM_CONDITIONAL([am__fastdep$1], [
616   test "x$enable_dependency_tracking" != xno \
617   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
618 ])
619
620
621 # AM_SET_DEPDIR
622 # -------------
623 # Choose a directory name for dependency files.
624 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
625 AC_DEFUN([AM_SET_DEPDIR],
626 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
627 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
628 ])
629
630
631 # AM_DEP_TRACK
632 # ------------
633 AC_DEFUN([AM_DEP_TRACK],
634 [AC_ARG_ENABLE(dependency-tracking,
635 [  --disable-dependency-tracking Speeds up one-time builds
636   --enable-dependency-tracking  Do not reject slow dependency extractors])
637 if test "x$enable_dependency_tracking" != xno; then
638   am_depcomp="$ac_aux_dir/depcomp"
639   AMDEPBACKSLASH='\'
640 fi
641 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
642 AC_SUBST([AMDEPBACKSLASH])
643 ])
644
645 # Generate code to set up dependency tracking.   -*- Autoconf -*-
646
647 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
648
649 # This program is free software; you can redistribute it and/or modify
650 # it under the terms of the GNU General Public License as published by
651 # the Free Software Foundation; either version 2, or (at your option)
652 # any later version.
653
654 # This program is distributed in the hope that it will be useful,
655 # but WITHOUT ANY WARRANTY; without even the implied warranty of
656 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
657 # GNU General Public License for more details.
658
659 # You should have received a copy of the GNU General Public License
660 # along with this program; if not, write to the Free Software
661 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
662 # 02111-1307, USA.
663
664 #serial 2
665
666 # _AM_OUTPUT_DEPENDENCY_COMMANDS
667 # ------------------------------
668 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
669 [for mf in $CONFIG_FILES; do
670   # Strip MF so we end up with the name of the file.
671   mf=`echo "$mf" | sed -e 's/:.*$//'`
672   # Check whether this is an Automake generated Makefile or not.
673   # We used to match only the files named `Makefile.in', but
674   # some people rename them; so instead we look at the file content.
675   # Grep'ing the first line is not enough: some people post-process
676   # each Makefile.in and add a new line on top of each file to say so.
677   # So let's grep whole file.
678   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
679     dirpart=`AS_DIRNAME("$mf")`
680   else
681     continue
682   fi
683   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
684   # Extract the definition of DEP_FILES from the Makefile without
685   # running `make'.
686   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
687   test -z "$DEPDIR" && continue
688   # When using ansi2knr, U may be empty or an underscore; expand it
689   U=`sed -n -e '/^U = / s///p' < "$mf"`
690   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
691   # We invoke sed twice because it is the simplest approach to
692   # changing $(DEPDIR) to its actual value in the expansion.
693   for file in `sed -n -e '
694     /^DEP_FILES = .*\\\\$/ {
695       s/^DEP_FILES = //
696       :loop
697         s/\\\\$//
698         p
699         n
700         /\\\\$/ b loop
701       p
702     }
703     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
704        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
705     # Make sure the directory exists.
706     test -f "$dirpart/$file" && continue
707     fdir=`AS_DIRNAME(["$file"])`
708     AS_MKDIR_P([$dirpart/$fdir])
709     # echo "creating $dirpart/$file"
710     echo '# dummy' > "$dirpart/$file"
711   done
712 done
713 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
714
715
716 # AM_OUTPUT_DEPENDENCY_COMMANDS
717 # -----------------------------
718 # This macro should only be invoked once -- use via AC_REQUIRE.
719 #
720 # This code is only required when automatic dependency tracking
721 # is enabled.  FIXME.  This creates each `.P' file that we will
722 # need in order to bootstrap the dependency handling code.
723 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
724 [AC_CONFIG_COMMANDS([depfiles],
725      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
726      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
727 ])
728
729 # Check to see how 'make' treats includes.      -*- Autoconf -*-
730
731 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
732
733 # This program is free software; you can redistribute it and/or modify
734 # it under the terms of the GNU General Public License as published by
735 # the Free Software Foundation; either version 2, or (at your option)
736 # any later version.
737
738 # This program is distributed in the hope that it will be useful,
739 # but WITHOUT ANY WARRANTY; without even the implied warranty of
740 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
741 # GNU General Public License for more details.
742
743 # You should have received a copy of the GNU General Public License
744 # along with this program; if not, write to the Free Software
745 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
746 # 02111-1307, USA.
747
748 # serial 2
749
750 # AM_MAKE_INCLUDE()
751 # -----------------
752 # Check to see how make treats includes.
753 AC_DEFUN([AM_MAKE_INCLUDE],
754 [am_make=${MAKE-make}
755 cat > confinc << 'END'
756 am__doit:
757         @echo done
758 .PHONY: am__doit
759 END
760 # If we don't find an include directive, just comment out the code.
761 AC_MSG_CHECKING([for style of include used by $am_make])
762 am__include="#"
763 am__quote=
764 _am_result=none
765 # First try GNU make style include.
766 echo "include confinc" > confmf
767 # We grep out `Entering directory' and `Leaving directory'
768 # messages which can occur if `w' ends up in MAKEFLAGS.
769 # In particular we don't look at `^make:' because GNU make might
770 # be invoked under some other name (usually "gmake"), in which
771 # case it prints its new name instead of `make'.
772 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
773    am__include=include
774    am__quote=
775    _am_result=GNU
776 fi
777 # Now try BSD make style include.
778 if test "$am__include" = "#"; then
779    echo '.include "confinc"' > confmf
780    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
781       am__include=.include
782       am__quote="\""
783       _am_result=BSD
784    fi
785 fi
786 AC_SUBST([am__include])
787 AC_SUBST([am__quote])
788 AC_MSG_RESULT([$_am_result])
789 rm -f confinc confmf
790 ])
791
792 # AM_CONDITIONAL                                              -*- Autoconf -*-
793
794 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
795
796 # This program is free software; you can redistribute it and/or modify
797 # it under the terms of the GNU General Public License as published by
798 # the Free Software Foundation; either version 2, or (at your option)
799 # any later version.
800
801 # This program is distributed in the hope that it will be useful,
802 # but WITHOUT ANY WARRANTY; without even the implied warranty of
803 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
804 # GNU General Public License for more details.
805
806 # You should have received a copy of the GNU General Public License
807 # along with this program; if not, write to the Free Software
808 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
809 # 02111-1307, USA.
810
811 # serial 5
812
813 AC_PREREQ(2.52)
814
815 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
816 # -------------------------------------
817 # Define a conditional.
818 AC_DEFUN([AM_CONDITIONAL],
819 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
820         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
821 AC_SUBST([$1_TRUE])
822 AC_SUBST([$1_FALSE])
823 if $2; then
824   $1_TRUE=
825   $1_FALSE='#'
826 else
827   $1_TRUE='#'
828   $1_FALSE=
829 fi
830 AC_CONFIG_COMMANDS_PRE(
831 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
832   AC_MSG_ERROR([conditional "$1" was never defined.
833 Usually this means the macro was only invoked conditionally.])
834 fi])])
835
836 # Add --enable-maintainer-mode option to configure.
837 # From Jim Meyering
838
839 # Copyright 1996, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
840
841 # This program is free software; you can redistribute it and/or modify
842 # it under the terms of the GNU General Public License as published by
843 # the Free Software Foundation; either version 2, or (at your option)
844 # any later version.
845
846 # This program is distributed in the hope that it will be useful,
847 # but WITHOUT ANY WARRANTY; without even the implied warranty of
848 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
849 # GNU General Public License for more details.
850
851 # You should have received a copy of the GNU General Public License
852 # along with this program; if not, write to the Free Software
853 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
854 # 02111-1307, USA.
855
856 # serial 2
857
858 AC_DEFUN([AM_MAINTAINER_MODE],
859 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
860   dnl maintainer-mode is disabled by default
861   AC_ARG_ENABLE(maintainer-mode,
862 [  --enable-maintainer-mode enable make rules and dependencies not useful
863                           (and sometimes confusing) to the casual installer],
864       USE_MAINTAINER_MODE=$enableval,
865       USE_MAINTAINER_MODE=no)
866   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
867   AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
868   MAINT=$MAINTAINER_MODE_TRUE
869   AC_SUBST(MAINT)dnl
870 ]
871 )
872
873 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
874
875 dnl TiMidity++ -- MIDI to WAVE converter and player
876 dnl Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
877 dnl Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
878 dnl 
879 dnl This program is free software; you can redistribute it and/or modify
880 dnl it under the terms of the GNU General Public License as published by
881 dnl the Free Software Foundation; either version 2 of the License, or
882 dnl (at your option) any later version.
883 dnl 
884 dnl This program is distributed in the hope that it will be useful,
885 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
886 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
887 dnl GNU General Public License for more details.
888 dnl 
889 dnl You should have received a copy of the GNU General Public License
890 dnl along with this program; if not, write to the Free Software
891 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
892
893 dnl MY_DEFINE(VARIABLE)
894 AC_DEFUN([MY_DEFINE],
895 [cat >> confdefs.h <<EOF
896 [#define] $1 1
897 EOF
898 ])
899
900 dnl CONFIG_INTERFACE(package,macro_name,interface_id,help
901 dnl                  $1      $2         $3           $4
902 dnl                  action-if-yes-or-dynamic,
903 dnl                  $5
904 dnl                  action-if-yes,action-if-dynamic,action-if-no)
905 dnl                  $6            $7                $8
906 AC_DEFUN([CONFIG_INTERFACE],
907 [AC_ARG_ENABLE($1,[$4],
908 [case "x$enable_$1" in xyes|xdynamic) $5 ;; esac])
909 case "x$enable_$1" in
910 xyes)
911   MY_DEFINE(IA_$2)
912   AM_CONDITIONAL(ENABLE_$2, true)
913   $6
914   ;;
915 xdynamic)
916   dynamic_targets="$dynamic_targets if_$1.\$(so)"
917   $7
918   ;;
919 *)
920   $8
921   ;;
922 esac
923 AC_SUBST($3_so_libs)
924 ])
925
926 dnl CHECK_DLSYM_UNDERSCORE([ACTION-IF-NEED [, ACTION IF-NOT-NEED]])
927 dnl variable input:
928 dnl   CC CFLAGS CPPFLAGS LDFLAGS LIBS SHCFLAGS SHLD SHLDFLAGS
929 dnl   ac_cv_header_dlfcn_h lib_dl_opt so
930 AC_DEFUN([CHECK_DLSYM_UNDERSCORE],
931 [dnl Check if dlsym need a leading underscore
932 AC_MSG_CHECKING(whether your dlsym() needs a leading underscore)
933 AC_CACHE_VAL(timidity_cv_func_dlsym_underscore,
934 [case "$ac_cv_header_dlfcn_h" in
935 yes) i_dlfcn=define;;
936 *)   i_dlfcn=undef;;
937 esac
938 cat > dyna.c <<EOM
939 fred () { }
940 EOM
941
942 cat > fred.c <<EOM
943 #include <stdio.h>
944 #$i_dlfcn I_DLFCN
945 #ifdef I_DLFCN
946 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
947 #else
948 #include <sys/types.h>
949 #include <nlist.h>
950 #include <link.h>
951 #endif
952
953 extern int fred() ;
954
955 main()
956 {
957     void * handle ;
958     void * symbol ;
959 #ifndef RTLD_LAZY
960     int mode = 1 ;
961 #else
962     int mode = RTLD_LAZY ;
963 #endif
964     handle = dlopen("./dyna.$so", mode) ;
965     if (handle == NULL) {
966         printf ("1\n") ;
967         fflush (stdout) ;
968         exit(0);
969     }
970     symbol = dlsym(handle, "fred") ;
971     if (symbol == NULL) {
972         /* try putting a leading underscore */
973         symbol = dlsym(handle, "_fred") ;
974         if (symbol == NULL) {
975             printf ("2\n") ;
976             fflush (stdout) ;
977             exit(0);
978         }
979         printf ("3\n") ;
980     }
981     else
982         printf ("4\n") ;
983     fflush (stdout) ;
984     exit(0);
985 }
986 EOM
987 : Call the object file tmp-dyna.o in case dlext=o.
988 if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 &&
989         mv dyna.o tmp-dyna.o > /dev/null 2>&1 &&
990         $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 &&
991         ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then
992         xxx=`./fred`
993         case $xxx in
994         1)      AC_MSG_WARN(Test program failed using dlopen.  Perhaps you should not use dynamic loading.)
995                 ;;
996         2)      AC_MSG_WARN(Test program failed using dlsym.  Perhaps you should not use dynamic loading.)
997                 ;;
998         3)      timidity_cv_func_dlsym_underscore=yes
999                 ;;
1000         4)      timidity_cv_func_dlsym_underscore=no
1001                 ;;
1002         esac
1003 else
1004         AC_MSG_WARN(I can't compile and run the test program.)
1005 fi
1006 rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred
1007 ])
1008 case "x$timidity_cv_func_dlsym_underscore" in
1009 xyes)   [$1]
1010         AC_MSG_RESULT(yes)
1011         ;;
1012 xno)    [$2]
1013         AC_MSG_RESULT(no)
1014         ;;
1015 esac
1016 ])
1017
1018
1019 dnl contains program from perl5
1020 dnl CONTAINS_INIT()
1021 AC_DEFUN([CONTAINS_INIT],
1022 [dnl Some greps do not return status, grrr.
1023 AC_MSG_CHECKING(whether grep returns status)
1024 echo "grimblepritz" >grimble
1025 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1026         contains="./contains"
1027 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1028         contains=grep
1029 else
1030         contains="./contains"
1031 fi
1032 rm -f grimble
1033 dnl the following should work in any shell
1034 case "$contains" in
1035 grep)   AC_MSG_RESULT(yes)
1036         ;;
1037 ./contains)
1038         AC_MSG_RESULT(AGH!  Grep doesn't return a status.  Attempting remedial action.)
1039         cat >./contains <<'EOSS'
1040 grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp
1041 EOSS
1042         chmod +x "./contains"
1043         ;;
1044 esac
1045 ])
1046
1047 dnl CONTAINS(word,filename,action-if-found,action-if-not-found)
1048 AC_DEFUN([CONTAINS],
1049 [if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then
1050   [$3]
1051 else
1052   [$4]
1053 fi
1054 ])
1055
1056 dnl SET_UNIQ_WORDS(shell-variable,words...)
1057 AC_DEFUN([SET_UNIQ_WORDS],
1058 [rm -f wordtmp >/dev/null 2>&1
1059 val=''
1060 for f in $2; do
1061   CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"])
1062 done
1063 $1="$val"
1064 rm -f wordtmp >/dev/null 2>&1
1065 ])
1066
1067
1068 dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY,
1069                     [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]])
1070 AC_DEFUN([WAPI_CHECK_FUNC],
1071 [AC_MSG_CHECKING(for $1)
1072 AC_CACHE_VAL(wapi_cv_func_$1,
1073 [AC_TRY_LINK([#include <windows.h>
1074 $2
1075 ], [$3],
1076 wapi_cv_func_$1=yes, wapi_cv_func_$1=no)])
1077 if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then
1078   AC_MSG_RESULT(yes)
1079   ifelse([$4], , :, [$4])
1080 else
1081   AC_MSG_RESULT(no)
1082 ifelse([$5], , , [$5
1083 ])dnl
1084 fi
1085 ])
1086
1087 dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION,
1088 dnl             INCLUDES, TEST-BODY
1089 dnl             [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
1090 dnl             [, OTHER-LIBRARIES]]])
1091 AC_DEFUN([WAPI_CHECK_LIB],
1092 [AC_MSG_CHECKING([for $2 in -l$1])
1093 ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
1094 AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var,
1095 [ac_save_LIBS="$LIBS"
1096 LIBS="-l$1 $7 $LIBS"
1097 AC_TRY_LINK([#include <windows.h>
1098 $3
1099 ], [$4],
1100 eval "wapi_cv_lib_$ac_lib_var=yes",
1101 eval "wapi_cv_lib_$ac_lib_var=no")
1102 LIBS="$ac_save_LIBS"
1103 ])dnl
1104 if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then
1105   AC_MSG_RESULT(yes)
1106   ifelse([$5], ,LIBS="-l$1 $LIBS", [$5])
1107 else
1108   AC_MSG_RESULT(no)
1109 ifelse([$6], , , [$6
1110 ])dnl
1111 fi
1112 ])
1113
1114 dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS)
1115 AC_DEFUN([EXTRACT_CPPFLAGS],
1116 [for f in $3; do
1117     case ".$f" in
1118         .-I?*|.-D?*)    $1="[$]$1 $f" ;;
1119         *)              $2="[$]$1 $f" ;;
1120     esac
1121 done
1122 ])
1123
1124
1125 dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCEED [, ACTION-IF-FAILED]])
1126 AC_DEFUN([CHECK_COMPILER_OPTION],
1127 [AC_MSG_CHECKING([whether -$1 option is recognized])
1128 ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'`
1129 AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption,
1130 [cat > conftest.$ac_ext <<EOF
1131 int main() {return 0;}
1132 EOF
1133 if ${CC-cc} $LDFLAGS $CFLAGS -o conftest${ac_exeext} -$1 conftest.$ac_ext > conftest.out 2>&1; then
1134     if test -s conftest.out; then
1135         eval "timidity_cv_ccoption_$ac_ccoption=no"
1136     else
1137         eval "timidity_cv_ccoption_$ac_ccoption=yes"
1138     fi
1139 else
1140     eval "timidity_cv_ccoption_$ac_ccoption=no"
1141 fi
1142 ])
1143 if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then
1144   AC_MSG_RESULT(yes)
1145   ifelse([$2], , , [$2
1146 ])
1147 else
1148   AC_MSG_RESULT(no)
1149 ifelse([$3], , , [$3
1150 ])
1151 fi
1152 ])
1153
1154
1155 dnl MY_SEARCH_LIBS(FUNCTION, LIBRARIES [, ACTION-IF-FOUND
1156 dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1157 dnl Search for a library defining FUNC, if it's not already available.
1158
1159 AC_DEFUN([MY_SEARCH_LIBS],
1160 [AC_CACHE_CHECK([for library containing $1], [timidity_cv_search_$1],
1161 [ac_func_search_save_LIBS="$LIBS"
1162 timidity_cv_search_$1="no"
1163 for i in $2; do
1164   LIBS="$i $5 $ac_func_search_save_LIBS"
1165   AC_TRY_LINK_FUNC([$1], [timidity_cv_search_$1="$i"; break])
1166 done
1167 LIBS="$ac_func_search_save_LIBS"])
1168 if test "$timidity_cv_search_$1" != "no"; then
1169   $3
1170 else :
1171   $4
1172 fi])
1173
1174
1175 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1176 #   Free Software Foundation, Inc.
1177
1178 # This program is free software; you can redistribute it and/or modify
1179 # it under the terms of the GNU General Public License as published by
1180 # the Free Software Foundation; either version 2, or (at your option)
1181 # any later version.
1182
1183 # This program is distributed in the hope that it will be useful,
1184 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1185 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1186 # GNU General Public License for more details.
1187
1188 # You should have received a copy of the GNU General Public License
1189 # along with this program; if not, write to the Free Software
1190 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1191 # 02111-1307, USA.
1192
1193 # serial 7
1194
1195 # AM_PATH_LISPDIR
1196 # ---------------
1197 AC_DEFUN([AM_PATH_LISPDIR],
1198 [AC_ARG_WITH(lispdir,
1199  [  --with-lispdir          Override the default lisp directory ],
1200  [ lispdir="$withval"
1201    AC_MSG_CHECKING([where .elc files should go])
1202    AC_MSG_RESULT([$lispdir])],
1203  [
1204  # If set to t, that means we are running in a shell under Emacs.
1205  # If you have an Emacs named "t", then use the full path.
1206  test x"$EMACS" = xt && EMACS=
1207  AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1208  if test $EMACS != "no"; then
1209    if test x${lispdir+set} != xset; then
1210      AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir],
1211        [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
1212   # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
1213   #  which is non-obvious for non-emacs users.
1214   # Redirecting /dev/null should help a bit; pity we can't detect "broken"
1215   #  emacsen earlier and avoid running this altogether.
1216   AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' </dev/null >conftest.out])
1217         am_cv_lispdir=`sed -n \
1218        -e 's,/$,,' \
1219        -e '/.*\/lib\/x\?emacs\/site-lisp$/{s,.*/lib/\(x\?emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
1220        -e '/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}' \
1221        conftest.out`
1222        rm conftest.out
1223        if test -z "$am_cv_lispdir"; then
1224          am_cv_lispdir='${datadir}/emacs/site-lisp'
1225        fi
1226      ])
1227      lispdir="$am_cv_lispdir"
1228    fi
1229  fi
1230 ])
1231 AC_SUBST(lispdir)
1232 ])# AM_PATH_LISPDIR
1233
1234 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])
1235
1236 dnl Configure Paths for Alsa
1237 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
1238 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
1239 dnl Jaroslav Kysela <perex@suse.cz>
1240 dnl Modified for TiMidity++ by URABE, Shyouhei <root@mput.dip.jp>
1241 dnl Original    : alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp
1242 dnl This version: alsa.m4,       2002/10/08 22:30:18 JST
1243 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1244 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
1245 dnl enables arguments --with-alsa-prefix=
1246 dnl                   --with-alsa-enc-prefix=
1247 dnl                   --disable-alsatest  (this has no effect, as yet)
1248 dnl
1249 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
1250 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
1251 dnl
1252 AC_DEFUN([AM_PATH_ALSA],
1253 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
1254 alsa_save_CFLAGS="$CFLAGS"
1255 alsa_save_LDFLAGS="$LDFLAGS"
1256 alsa_save_LIBS="$LIBS"
1257 alsa_found=yes
1258
1259 dnl
1260 dnl Get the cflags and libraries for alsa
1261 dnl
1262 AC_ARG_WITH(alsa-prefix,
1263 [  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
1264 [alsa_prefix="$withval"], [alsa_prefix=""])
1265
1266 AC_ARG_WITH(alsa-inc-prefix,
1267 [  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
1268 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
1269
1270 dnl FIXME: this is not yet implemented
1271 AC_ARG_ENABLE(alsatest,
1272 [  --disable-alsatest      Do not try to compile and run a test Alsa program],
1273 [enable_alsatest=no],
1274 [enable_alsatest=yes])
1275
1276 dnl Add any special include directories
1277 AC_MSG_CHECKING(for ALSA CFLAGS)
1278 if test "$alsa_inc_prefix" != "" ; then
1279         ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
1280         CFLAGS="$CFLAGS -I$alsa_inc_prefix"
1281 fi
1282 AC_MSG_RESULT($ALSA_CFLAGS)
1283
1284 dnl add any special lib dirs
1285 AC_MSG_CHECKING(for ALSA LDFLAGS)
1286 if test "$alsa_prefix" != "" ; then
1287         ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
1288         LDFLAGS="$LDFLAGS $ALSA_LIBS"
1289 fi
1290
1291 dnl add the alsa library
1292 ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
1293 LIBS=`echo $LIBS | sed 's/-lm//'`
1294 LIBS=`echo $LIBS | sed 's/-ldl//'`
1295 LIBS=`echo $LIBS | sed 's/-lpthread//'`
1296 LIBS=`echo $LIBS | sed 's/  //'`
1297 LIBS="$ALSA_LIBS $LIBS"
1298 AC_MSG_RESULT($ALSA_LIBS)
1299
1300 dnl Check for a working version of libasound that is of the right version.
1301 min_alsa_version=ifelse([$1], ,0.1.1,$1)
1302 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
1303 no_alsa=""
1304     alsa_min_major_version=`echo $min_alsa_version | \
1305            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1306     alsa_min_minor_version=`echo $min_alsa_version | \
1307            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1308     alsa_min_micro_version=`echo $min_alsa_version | \
1309            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1310
1311 dnl This is the test program.
1312 AC_DEFUN([MPUT_ALSA_TRY],[
1313 /* ensure backward compatibility */
1314 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
1315 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
1316 #endif
1317 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
1318 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
1319 #endif
1320 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
1321 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
1322 #endif
1323
1324 #  if(SND_LIB_MAJOR > $alsa_min_major_version)
1325   exit(0);
1326 #  else
1327 #    if(SND_LIB_MAJOR < $alsa_min_major_version)
1328 #       error not present
1329 #    endif
1330
1331 #   if(SND_LIB_MINOR > $alsa_min_minor_version)
1332   exit(0);
1333 #   else
1334 #     if(SND_LIB_MINOR < $alsa_min_minor_version)
1335 #          error not present
1336 #      endif
1337
1338 #      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
1339 #        error not present
1340 #      endif
1341 #    endif
1342 #  endif
1343 exit(0);
1344 ])dnl macro MPUT_ALSA_TRY
1345
1346 AC_LANG_SAVE
1347 AC_LANG_C
1348 AC_TRY_COMPILE([
1349 #include <alsa/asoundlib.h>
1350 ],
1351   MPUT_ALSA_TRY(),
1352   [AC_MSG_RESULT(found.)],
1353   [AC_TRY_COMPILE([
1354 #include <sys/asoundlib.h>
1355 ], 
1356   MPUT_ALSA_TRY(),
1357   [AC_MSG_RESULT(found.)],
1358   [AC_MSG_RESULT(not present.)
1359    ifelse([$3], ,[AC_MSG_RESULT(libasound was not found anywhere.)])
1360    alsa_found=no])
1361    ifelse([$3], ,[AC_MSG_RESULT(Sufficiently new version of libasound not found.)])
1362 ])
1363 AC_LANG_RESTORE
1364
1365 dnl Now that we know we have the right version, why not see if we
1366 dnl have the library and not just the headers.
1367 AC_CHECK_LIB([asound],[snd_ctl_open], ,
1368   [ifelse([$3], ,[AC_MSG_RESULT(No linkable libasound was found.)])
1369    alsa_found=no
1370 ])
1371
1372 if test "x$alsa_found" = "xyes" ; then
1373    ifelse([$2], , :, [$2])
1374    LIBS=`echo $LIBS | sed 's/-lasound//g'`
1375    LIBS=`echo $LIBS | sed 's/  //'`
1376    LIBS="-lasound $LIBS"
1377 else
1378    ifelse([$3], , :, [$3])
1379    CFLAGS="$alsa_save_CFLAGS"
1380    LDFLAGS="$alsa_save_LDFLAGS"
1381    LIBS="$alsa_save_LIBS"
1382    ALSA_CFLAGS=""
1383    ALSA_LIBS=""
1384 fi
1385
1386 dnl That should be it.  Now just export out symbols:
1387 AC_SUBST(ALSA_CFLAGS)
1388 AC_SUBST(ALSA_LIBS)
1389 ])
1390
1391 # Configure paths for ESD
1392 # Manish Singh    98-9-30
1393 # stolen back from Frank Belew
1394 # stolen from Manish Singh
1395 # Shamelessly stolen from Owen Taylor
1396
1397 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1398 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
1399 dnl
1400 AC_DEFUN([AM_PATH_ESD],
1401 [dnl 
1402 dnl Get the cflags and libraries from the esd-config script
1403 dnl
1404 AC_ARG_WITH(esd-prefix,[  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)],
1405             esd_prefix="$withval", esd_prefix="")
1406 AC_ARG_WITH(esd-exec-prefix,[  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
1407             esd_exec_prefix="$withval", esd_exec_prefix="")
1408 AC_ARG_ENABLE(esdtest, [  --disable-esdtest       Do not try to compile and run a test ESD program],
1409                     , enable_esdtest=yes)
1410
1411   if test x$esd_exec_prefix != x ; then
1412      esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
1413      if test x${ESD_CONFIG+set} != xset ; then
1414         ESD_CONFIG=$esd_exec_prefix/bin/esd-config
1415      fi
1416   fi
1417   if test x$esd_prefix != x ; then
1418      esd_args="$esd_args --prefix=$esd_prefix"
1419      if test x${ESD_CONFIG+set} != xset ; then
1420         ESD_CONFIG=$esd_prefix/bin/esd-config
1421      fi
1422   fi
1423
1424   AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1425   min_esd_version=ifelse([$1], ,0.2.7,$1)
1426   AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
1427   no_esd=""
1428   if test "$ESD_CONFIG" = "no" ; then
1429     no_esd=yes
1430   else
1431     AC_LANG_SAVE
1432     AC_LANG_C
1433     ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
1434     ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
1435
1436     esd_major_version=`$ESD_CONFIG $esd_args --version | \
1437            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1438     esd_minor_version=`$ESD_CONFIG $esd_args --version | \
1439            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1440     esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
1441            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1442     if test "x$enable_esdtest" = "xyes" ; then
1443       ac_save_CFLAGS="$CFLAGS"
1444       ac_save_LIBS="$LIBS"
1445       CFLAGS="$CFLAGS $ESD_CFLAGS"
1446       LIBS="$LIBS $ESD_LIBS"
1447 dnl
1448 dnl Now check if the installed ESD is sufficiently new. (Also sanity
1449 dnl checks the results of esd-config to some extent
1450 dnl
1451       rm -f conf.esdtest
1452       AC_TRY_RUN([
1453 #include <stdio.h>
1454 #include <stdlib.h>
1455 #include <string.h>
1456 #include <esd.h>
1457
1458 char*
1459 my_strdup (char *str)
1460 {
1461   char *new_str;
1462   
1463   if (str)
1464     {
1465       new_str = malloc ((strlen (str) + 1) * sizeof(char));
1466       strcpy (new_str, str);
1467     }
1468   else
1469     new_str = NULL;
1470   
1471   return new_str;
1472 }
1473
1474 int main ()
1475 {
1476   int major, minor, micro;
1477   char *tmp_version;
1478
1479   system ("touch conf.esdtest");
1480
1481   /* HP/UX 9 (%@#!) writes to sscanf strings */
1482   tmp_version = my_strdup("$min_esd_version");
1483   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1484      printf("%s, bad version string\n", "$min_esd_version");
1485      exit(1);
1486    }
1487
1488    if (($esd_major_version > major) ||
1489       (($esd_major_version == major) && ($esd_minor_version > minor)) ||
1490       (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
1491     {
1492       return 0;
1493     }
1494   else
1495     {
1496       printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
1497       printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
1498       printf("*** best to upgrade to the required version.\n");
1499       printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
1500       printf("*** to point to the correct copy of esd-config, and remove the file\n");
1501       printf("*** config.cache before re-running configure\n");
1502       return 1;
1503     }
1504 }
1505
1506 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1507        CFLAGS="$ac_save_CFLAGS"
1508        LIBS="$ac_save_LIBS"
1509        AC_LANG_RESTORE
1510      fi
1511   fi
1512   if test "x$no_esd" = x ; then
1513      AC_MSG_RESULT(yes)
1514      ifelse([$2], , :, [$2])     
1515   else
1516      AC_MSG_RESULT(no)
1517      if test "$ESD_CONFIG" = "no" ; then
1518        echo "*** The esd-config script installed by ESD could not be found"
1519        echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
1520        echo "*** your path, or set the ESD_CONFIG environment variable to the"
1521        echo "*** full path to esd-config."
1522      else
1523        if test -f conf.esdtest ; then
1524         :
1525        else
1526           echo "*** Could not run ESD test program, checking why..."
1527           CFLAGS="$CFLAGS $ESD_CFLAGS"
1528           LIBS="$LIBS $ESD_LIBS"
1529           AC_LANG_SAVE
1530           AC_LANG_C
1531           AC_TRY_LINK([
1532 #include <stdio.h>
1533 #include <esd.h>
1534 ],      [ return 0; ],
1535         [ echo "*** The test program compiled, but did not run. This usually means"
1536           echo "*** that the run-time linker is not finding ESD or finding the wrong"
1537           echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
1538           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1539           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1540           echo "*** is required on your system"
1541           echo "***"
1542           echo "*** If you have an old version installed, it is best to remove it, although"
1543           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1544         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1545           echo "*** exact error that occured. This usually means ESD was incorrectly installed"
1546           echo "*** or that you have moved ESD since it was installed. In the latter case, you"
1547           echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
1548           CFLAGS="$ac_save_CFLAGS"
1549           LIBS="$ac_save_LIBS"
1550           AC_LANG_RESTORE
1551        fi
1552      fi
1553      ESD_CFLAGS=""
1554      ESD_LIBS=""
1555      ifelse([$3], , :, [$3])
1556   fi
1557   AC_SUBST(ESD_CFLAGS)
1558   AC_SUBST(ESD_LIBS)
1559   rm -f conf.esdtest
1560 ])
1561
1562 dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
1563 dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
1564 dnl
1565 AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
1566 [dnl
1567   AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
1568   ac_save_ESD_CFLAGS="$ESD_CFLAGS"
1569   ac_save_ESD_LIBS="$ESD_LIBS"
1570   AM_PATH_ESD(0.2.21,
1571     ifelse([$1], , [
1572       AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
1573       AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
1574         [Define if you have esound with support of multiple recording clients.])],
1575     [$1]),
1576     ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
1577     if test "x$ac_save_ESD_CFLAGS" != x ; then
1578        ESD_CFLAGS="$ac_save_ESD_CFLAGS"
1579     fi
1580     if test "x$ac_save_ESD_LIBS" != x ; then
1581        ESD_LIBS="$ac_save_ESD_LIBS"
1582     fi
1583   )
1584 ])
1585
1586 # ao.m4
1587 # Configure paths for libao
1588 # Jack Moffitt <jack@icecast.org> 10-21-2000
1589 # Shamelessly stolen from Owen Taylor and Manish Singh
1590
1591 dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1592 dnl Test for libao, and define AO_CFLAGS and AO_LIBS
1593 dnl
1594 AC_DEFUN([XIPH_PATH_AO],
1595 [dnl 
1596 dnl Get the cflags and libraries
1597 dnl
1598 AC_ARG_WITH(ao,[  --with-ao=PFX   Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="")
1599 AC_ARG_WITH(ao-libraries,[  --with-ao-libraries=DIR   Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="")
1600 AC_ARG_WITH(ao-includes,[  --with-ao-includes=DIR   Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="")
1601 AC_ARG_ENABLE(aotest, [  --disable-aotest       Do not try to compile and run a test ao program],, enable_aotest=yes)
1602
1603
1604   if test "x$ao_libraries" != "x" ; then
1605     AO_LIBS="-L$ao_libraries"
1606   elif test "x$ao_prefix" != "x"; then
1607     AO_LIBS="-L$ao_prefix/lib"
1608   elif test "x$prefix" != "xNONE"; then
1609     AO_LIBS="-L$prefix/lib"
1610   fi
1611
1612   if test "x$ao_includes" != "x" ; then
1613     AO_CFLAGS="-I$ao_includes"
1614   elif test "x$ao_prefix" != "x"; then
1615     AO_CFLAGS="-I$ao_prefix/include"
1616   elif test "x$prefix" != "xNONE"; then
1617     AO_CFLAGS="-I$prefix/include"
1618   fi
1619
1620   # see where dl* and friends live
1621   AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
1622     AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
1623       AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
1624       your system may not be supported.])
1625     ])
1626   ])
1627
1628   AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
1629
1630   AC_MSG_CHECKING(for ao)
1631   no_ao=""
1632
1633
1634   if test "x$enable_aotest" = "xyes" ; then
1635     ac_save_CFLAGS="$CFLAGS"
1636     ac_save_LIBS="$LIBS"
1637     CFLAGS="$CFLAGS $AO_CFLAGS"
1638     LIBS="$LIBS $AO_LIBS"
1639 dnl
1640 dnl Now check if the installed ao is sufficiently new.
1641 dnl
1642       rm -f conf.aotest
1643       AC_TRY_RUN([
1644 #include <stdio.h>
1645 #include <stdlib.h>
1646 #include <string.h>
1647 #include <ao/ao.h>
1648
1649 int main ()
1650 {
1651   system("touch conf.aotest");
1652   return 0;
1653 }
1654
1655 ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1656        CFLAGS="$ac_save_CFLAGS"
1657        LIBS="$ac_save_LIBS"
1658   fi
1659
1660   if test "x$no_ao" = "x" ; then
1661      AC_MSG_RESULT(yes)
1662      ifelse([$1], , :, [$1])     
1663   else
1664      AC_MSG_RESULT(no)
1665      if test -f conf.aotest ; then
1666        :
1667      else
1668        echo "*** Could not run ao test program, checking why..."
1669        CFLAGS="$CFLAGS $AO_CFLAGS"
1670        LIBS="$LIBS $AO_LIBS"
1671        AC_TRY_LINK([
1672 #include <stdio.h>
1673 #include <ao/ao.h>
1674 ],     [ return 0; ],
1675        [ echo "*** The test program compiled, but did not run. This usually means"
1676        echo "*** that the run-time linker is not finding ao or finding the wrong"
1677        echo "*** version of ao. If it is not finding ao, you'll need to set your"
1678        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1679        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1680        echo "*** is required on your system"
1681        echo "***"
1682        echo "*** If you have an old version installed, it is best to remove it, although"
1683        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1684        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1685        echo "*** exact error that occured. This usually means ao was incorrectly installed"
1686        echo "*** or that you have moved ao since it was installed." ])
1687        CFLAGS="$ac_save_CFLAGS"
1688        LIBS="$ac_save_LIBS"
1689      fi
1690      AO_CFLAGS=""
1691      AO_LIBS=""
1692      ifelse([$2], , :, [$2])
1693   fi
1694   AC_SUBST(AO_CFLAGS)
1695   AC_SUBST(AO_LIBS)
1696   rm -f conf.aotest
1697 ])
1698
1699 # Configure paths for libogg
1700 # Jack Moffitt <jack@icecast.org> 10-21-2000
1701 # Shamelessly stolen from Owen Taylor and Manish Singh
1702
1703 dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1704 dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
1705 dnl
1706 AC_DEFUN([XIPH_PATH_OGG],
1707 [dnl 
1708 dnl Get the cflags and libraries
1709 dnl
1710 AC_ARG_WITH(ogg,[  --with-ogg=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
1711 AC_ARG_WITH(ogg-libraries,[  --with-ogg-libraries=DIR   Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
1712 AC_ARG_WITH(ogg-includes,[  --with-ogg-includes=DIR   Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
1713 AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
1714
1715   if test "x$ogg_libraries" != "x" ; then
1716     OGG_LIBS="-L$ogg_libraries"
1717   elif test "x$ogg_prefix" != "x" ; then
1718     OGG_LIBS="-L$ogg_prefix/lib"
1719   elif test "x$prefix" != "xNONE" ; then
1720     OGG_LIBS="-L$prefix/lib"
1721   fi
1722
1723   OGG_LIBS="$OGG_LIBS -logg"
1724
1725   if test "x$ogg_includes" != "x" ; then
1726     OGG_CFLAGS="-I$ogg_includes"
1727   elif test "x$ogg_prefix" != "x" ; then
1728     OGG_CFLAGS="-I$ogg_prefix/include"
1729   elif test "x$prefix" != "xNONE"; then
1730     OGG_CFLAGS="-I$prefix/include"
1731   fi
1732
1733   AC_MSG_CHECKING(for Ogg)
1734   no_ogg=""
1735
1736
1737   if test "x$enable_oggtest" = "xyes" ; then
1738     ac_save_CFLAGS="$CFLAGS"
1739     ac_save_LIBS="$LIBS"
1740     CFLAGS="$CFLAGS $OGG_CFLAGS"
1741     LIBS="$LIBS $OGG_LIBS"
1742 dnl
1743 dnl Now check if the installed Ogg is sufficiently new.
1744 dnl
1745       rm -f conf.oggtest
1746       AC_TRY_RUN([
1747 #include <stdio.h>
1748 #include <stdlib.h>
1749 #include <string.h>
1750 #include <ogg/ogg.h>
1751
1752 int main ()
1753 {
1754   system("touch conf.oggtest");
1755   return 0;
1756 }
1757
1758 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1759        CFLAGS="$ac_save_CFLAGS"
1760        LIBS="$ac_save_LIBS"
1761   fi
1762
1763   if test "x$no_ogg" = "x" ; then
1764      AC_MSG_RESULT(yes)
1765      ifelse([$1], , :, [$1])     
1766   else
1767      AC_MSG_RESULT(no)
1768      if test -f conf.oggtest ; then
1769        :
1770      else
1771        echo "*** Could not run Ogg test program, checking why..."
1772        CFLAGS="$CFLAGS $OGG_CFLAGS"
1773        LIBS="$LIBS $OGG_LIBS"
1774        AC_TRY_LINK([
1775 #include <stdio.h>
1776 #include <ogg/ogg.h>
1777 ],     [ return 0; ],
1778        [ echo "*** The test program compiled, but did not run. This usually means"
1779        echo "*** that the run-time linker is not finding Ogg or finding the wrong"
1780        echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
1781        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1782        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1783        echo "*** is required on your system"
1784        echo "***"
1785        echo "*** If you have an old version installed, it is best to remove it, although"
1786        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1787        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1788        echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
1789        echo "*** or that you have moved Ogg since it was installed." ])
1790        CFLAGS="$ac_save_CFLAGS"
1791        LIBS="$ac_save_LIBS"
1792      fi
1793      OGG_CFLAGS=""
1794      OGG_LIBS=""
1795      ifelse([$2], , :, [$2])
1796   fi
1797   AC_SUBST(OGG_CFLAGS)
1798   AC_SUBST(OGG_LIBS)
1799   rm -f conf.oggtest
1800 ])
1801
1802 # Configure paths for libvorbis
1803 # Jack Moffitt <jack@icecast.org> 10-21-2000
1804 # Shamelessly stolen from Owen Taylor and Manish Singh
1805 # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
1806
1807 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1808 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
1809 dnl
1810 AC_DEFUN([XIPH_PATH_VORBIS],
1811 [dnl 
1812 dnl Get the cflags and libraries
1813 dnl
1814 AC_ARG_WITH(vorbis,[  --with-vorbis=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
1815 AC_ARG_WITH(vorbis-libraries,[  --with-vorbis-libraries=DIR   Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
1816 AC_ARG_WITH(vorbis-includes,[  --with-vorbis-includes=DIR   Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
1817 AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
1818
1819   if test "x$vorbis_libraries" != "x" ; then
1820     VORBIS_LIBS="-L$vorbis_libraries"
1821   elif test "x$vorbis_prefix" != "x" ; then
1822     VORBIS_LIBS="-L$vorbis_prefix/lib"
1823   elif test "x$prefix" != "xNONE"; then
1824     VORBIS_LIBS="-L$prefix/lib"
1825   fi
1826
1827   VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
1828   VORBISFILE_LIBS="-lvorbisfile"
1829   VORBISENC_LIBS="-lvorbisenc"
1830
1831   if test "x$vorbis_includes" != "x" ; then
1832     VORBIS_CFLAGS="-I$vorbis_includes"
1833   elif test "x$vorbis_prefix" != "x" ; then
1834     VORBIS_CFLAGS="-I$vorbis_prefix/include"
1835   elif test "x$prefix" != "xNONE"; then
1836     VORBIS_CFLAGS="-I$prefix/include"
1837   fi
1838
1839
1840   AC_MSG_CHECKING(for Vorbis)
1841   no_vorbis=""
1842
1843
1844   if test "x$enable_vorbistest" = "xyes" ; then
1845     ac_save_CFLAGS="$CFLAGS"
1846     ac_save_LIBS="$LIBS"
1847     CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
1848     LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
1849 dnl
1850 dnl Now check if the installed Vorbis is sufficiently new.
1851 dnl
1852       rm -f conf.vorbistest
1853       AC_TRY_RUN([
1854 #include <stdio.h>
1855 #include <stdlib.h>
1856 #include <string.h>
1857 #include <vorbis/codec.h>
1858 #include <vorbis/vorbisenc.h>
1859
1860 int main ()
1861 {
1862     vorbis_block        vb;
1863     vorbis_dsp_state    vd;
1864     vorbis_info         vi;
1865
1866     vorbis_info_init (&vi);
1867     vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
1868     vorbis_analysis_init (&vd, &vi);
1869     vorbis_block_init (&vd, &vb);
1870     /* this function was added in 1.0rc3, so this is what we're testing for */
1871     vorbis_bitrate_addblock (&vb);
1872
1873     system("touch conf.vorbistest");
1874     return 0;
1875 }
1876
1877 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1878        CFLAGS="$ac_save_CFLAGS"
1879        LIBS="$ac_save_LIBS"
1880   fi
1881
1882   if test "x$no_vorbis" = "x" ; then
1883      AC_MSG_RESULT(yes)
1884      ifelse([$1], , :, [$1])     
1885   else
1886      AC_MSG_RESULT(no)
1887      if test -f conf.vorbistest ; then
1888        :
1889      else
1890        echo "*** Could not run Vorbis test program, checking why..."
1891        CFLAGS="$CFLAGS $VORBIS_CFLAGS"
1892        LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
1893        AC_TRY_LINK([
1894 #include <stdio.h>
1895 #include <vorbis/codec.h>
1896 ],     [ return 0; ],
1897        [ echo "*** The test program compiled, but did not run. This usually means"
1898        echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
1899        echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
1900        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1901        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1902        echo "*** is required on your system"
1903        echo "***"
1904        echo "*** If you have an old version installed, it is best to remove it, although"
1905        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1906        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1907        echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
1908        echo "*** or that you have moved Vorbis since it was installed." ])
1909        CFLAGS="$ac_save_CFLAGS"
1910        LIBS="$ac_save_LIBS"
1911      fi
1912      VORBIS_CFLAGS=""
1913      VORBIS_LIBS=""
1914      VORBISFILE_LIBS=""
1915      VORBISENC_LIBS=""
1916      ifelse([$2], , :, [$2])
1917   fi
1918   AC_SUBST(VORBIS_CFLAGS)
1919   AC_SUBST(VORBIS_LIBS)
1920   AC_SUBST(VORBISFILE_LIBS)
1921   AC_SUBST(VORBISENC_LIBS)
1922   rm -f conf.vorbistest
1923 ])
1924
1925 # Configure paths for libFLAC
1926 # "Inspired" by ogg.m4
1927
1928 dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1929 dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS
1930 dnl
1931 AC_DEFUN([AM_PATH_LIBFLAC],
1932 [dnl 
1933 dnl Get the cflags and libraries
1934 dnl
1935 AC_ARG_WITH(libFLAC,[  --with-libFLAC=PFX   Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="")
1936 AC_ARG_WITH(libFLAC-libraries,[  --with-libFLAC-libraries=DIR   Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="")
1937 AC_ARG_WITH(libFLAC-includes,[  --with-libFLAC-includes=DIR   Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="")
1938 AC_ARG_ENABLE(libFLACtest, [  --disable-libFLACtest       Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes)
1939
1940   if test "x$libFLAC_libraries" != "x" ; then
1941     LIBFLAC_LIBS="-L$libFLAC_libraries"
1942   elif test "x$libFLAC_prefix" != "x" ; then
1943     LIBFLAC_LIBS="-L$libFLAC_prefix/lib"
1944   elif test "x$prefix" != "xNONE" ; then
1945     LIBFLAC_LIBS="-L$prefix/lib"
1946   fi
1947
1948   LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm"
1949
1950   if test "x$libFLAC_includes" != "x" ; then
1951     LIBFLAC_CFLAGS="-I$libFLAC_includes"
1952   elif test "x$libFLAC_prefix" != "x" ; then
1953     LIBFLAC_CFLAGS="-I$libFLAC_prefix/include"
1954   elif test "$prefix" != "xNONE"; then
1955     LIBFLAC_CFLAGS="-I$prefix/include"
1956   fi
1957
1958   AC_MSG_CHECKING(for libFLAC)
1959   no_libFLAC=""
1960
1961
1962   if test "x$enable_libFLACtest" = "xyes" ; then
1963     ac_save_CFLAGS="$CFLAGS"
1964     ac_save_CXXFLAGS="$CXXFLAGS"
1965     ac_save_LIBS="$LIBS"
1966     CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
1967     CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
1968     LIBS="$LIBS $LIBFLAC_LIBS"
1969 dnl
1970 dnl Now check if the installed libFLAC is sufficiently new.
1971 dnl
1972       rm -f conf.libFLACtest
1973       AC_TRY_RUN([
1974 #include <stdio.h>
1975 #include <stdlib.h>
1976 #include <string.h>
1977 #include <FLAC/format.h>
1978
1979 int main ()
1980 {
1981   system("touch conf.libFLACtest");
1982   return 0;
1983 }
1984
1985 ],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1986        CFLAGS="$ac_save_CFLAGS"
1987        LIBS="$ac_save_LIBS"
1988   fi
1989
1990   if test "x$no_libFLAC" = "x" ; then
1991      AC_MSG_RESULT(yes)
1992      ifelse([$1], , :, [$1])     
1993   else
1994      AC_MSG_RESULT(no)
1995      if test -f conf.libFLACtest ; then
1996        :
1997      else
1998        echo "*** Could not run libFLAC test program, checking why..."
1999        CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
2000        LIBS="$LIBS $LIBFLAC_LIBS"
2001        AC_TRY_LINK([
2002 #include <stdio.h>
2003 #include <FLAC/format.h>
2004 ],     [ return 0; ],
2005        [ echo "*** The test program compiled, but did not run. This usually means"
2006        echo "*** that the run-time linker is not finding libFLAC or finding the wrong"
2007        echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your"
2008        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2009        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2010        echo "*** is required on your system"
2011        echo "***"
2012        echo "*** If you have an old version installed, it is best to remove it, although"
2013        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2014        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2015        echo "*** exact error that occured. This usually means libFLAC was incorrectly installed"
2016        echo "*** or that you have moved libFLAC since it was installed. In the latter case, you"
2017        echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ])
2018        CFLAGS="$ac_save_CFLAGS"
2019        LIBS="$ac_save_LIBS"
2020      fi
2021      LIBFLAC_CFLAGS=""
2022      LIBFLAC_LIBS=""
2023      ifelse([$2], , :, [$2])
2024   fi
2025   AC_SUBST(LIBFLAC_CFLAGS)
2026   AC_SUBST(LIBFLAC_LIBS)
2027   rm -f conf.libFLACtest
2028 ])
2029
2030 # Configure paths for libOggFLAC
2031 # "Inspired" by ogg.m4
2032
2033 dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2034 dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS
2035 dnl
2036 AC_DEFUN([AM_PATH_LIBOGGFLAC],
2037 [dnl 
2038 dnl Get the cflags and libraries
2039 dnl
2040 AC_ARG_WITH(libOggFLAC,[  --with-libOggFLAC=PFX   Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="")
2041 AC_ARG_WITH(libOggFLAC-libraries,[  --with-libOggFLAC-libraries=DIR   Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="")
2042 AC_ARG_WITH(libOggFLAC-includes,[  --with-libOggFLAC-includes=DIR   Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="")
2043 AC_ARG_ENABLE(libOggFLACtest, [  --disable-libOggFLACtest       Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes)
2044
2045   if test "x$libOggFLAC_libraries" != "x" ; then
2046     LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries"
2047   elif test "x$libOggFLAC_prefix" != "x" ; then
2048     LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib"
2049   elif test "x$prefix" != "xNONE" ; then
2050     LIBOGGFLAC_LIBS="-L$prefix/lib"
2051   fi
2052
2053   LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm"
2054
2055   if test "x$libOggFLAC_includes" != "x" ; then
2056     LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes"
2057   elif test "x$libOggFLAC_prefix" != "x" ; then
2058     LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include"
2059   elif test "$prefix" != "xNONE"; then
2060     LIBOGGFLAC_CFLAGS="-I$prefix/include"
2061   fi
2062
2063   AC_MSG_CHECKING(for libOggFLAC)
2064   no_libOggFLAC=""
2065
2066
2067   if test "x$enable_libOggFLACtest" = "xyes" ; then
2068     ac_save_CFLAGS="$CFLAGS"
2069     ac_save_CXXFLAGS="$CXXFLAGS"
2070     ac_save_LIBS="$LIBS"
2071     CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2072     CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS"
2073     LIBS="$LIBS $LIBOGGFLAC_LIBS"
2074 dnl
2075 dnl Now check if the installed libOggFLAC is sufficiently new.
2076 dnl
2077       rm -f conf.libOggFLACtest
2078       AC_TRY_RUN([
2079 #include <stdio.h>
2080 #include <stdlib.h>
2081 #include <string.h>
2082 #include <OggFLAC/stream_decoder.h>
2083
2084 int main ()
2085 {
2086   system("touch conf.libOggFLACtest");
2087   return 0;
2088 }
2089
2090 ],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2091        CFLAGS="$ac_save_CFLAGS"
2092        LIBS="$ac_save_LIBS"
2093   fi
2094
2095   if test "x$no_libOggFLAC" = "x" ; then
2096      AC_MSG_RESULT(yes)
2097      ifelse([$1], , :, [$1])     
2098   else
2099      AC_MSG_RESULT(no)
2100      if test -f conf.libOggFLACtest ; then
2101        :
2102      else
2103        echo "*** Could not run libOggFLAC test program, checking why..."
2104        CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2105        LIBS="$LIBS $LIBOGGFLAC_LIBS"
2106        AC_TRY_LINK([
2107 #include <stdio.h>
2108 #include <OggFLAC/stream_decoder.h>
2109 ],     [ return 0; ],
2110        [ echo "*** The test program compiled, but did not run. This usually means"
2111        echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong"
2112        echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your"
2113        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2114        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2115        echo "*** is required on your system"
2116        echo "***"
2117        echo "*** If you have an old version installed, it is best to remove it, although"
2118        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2119        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2120        echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed"
2121        echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you"
2122        echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ])
2123        CFLAGS="$ac_save_CFLAGS"
2124        LIBS="$ac_save_LIBS"
2125      fi
2126      LIBOGGFLAC_CFLAGS=""
2127      LIBOGGFLAC_LIBS=""
2128      ifelse([$2], , :, [$2])
2129   fi
2130   AC_SUBST(LIBOGGFLAC_CFLAGS)
2131   AC_SUBST(LIBOGGFLAC_LIBS)
2132   rm -f conf.libOggFLACtest
2133 ])
2134
2135 # Configure paths for GTK+
2136 # Owen Taylor     1997-2001
2137
2138 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2139 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, 
2140 dnl pass to pkg-config
2141 dnl
2142 AC_DEFUN([AM_PATH_GTK_2_0],
2143 [dnl 
2144 dnl Get the cflags and libraries from pkg-config
2145 dnl
2146 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
2147                     , enable_gtktest=yes)
2148
2149   pkg_config_args=gtk+-2.0
2150   for module in . $4
2151   do
2152       case "$module" in
2153          gthread) 
2154              pkg_config_args="$pkg_config_args gthread-2.0"
2155          ;;
2156       esac
2157   done
2158
2159   no_gtk=""
2160
2161   AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2162
2163   if test x$PKG_CONFIG != xno ; then
2164     if pkg-config --atleast-pkgconfig-version 0.7 ; then
2165       :
2166     else
2167       echo *** pkg-config too old; version 0.7 or better required.
2168       no_gtk=yes
2169       PKG_CONFIG=no
2170     fi
2171   else
2172     no_gtk=yes
2173   fi
2174
2175   min_gtk_version=ifelse([$1], ,2.0.0,$1)
2176   AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2177
2178   if test x$PKG_CONFIG != xno ; then
2179     ## don't try to run the test against uninstalled libtool libs
2180     if $PKG_CONFIG --uninstalled $pkg_config_args; then
2181           echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2182           enable_gtktest=no
2183     fi
2184
2185     if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2186           :
2187     else
2188           no_gtk=yes
2189     fi
2190   fi
2191
2192   if test x"$no_gtk" = x ; then
2193     GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2194     GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2195     gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2196            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2197     gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2198            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2199     gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2200            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2201     if test "x$enable_gtktest" = "xyes" ; then
2202       ac_save_CFLAGS="$CFLAGS"
2203       ac_save_LIBS="$LIBS"
2204       CFLAGS="$CFLAGS $GTK_CFLAGS"
2205       LIBS="$GTK_LIBS $LIBS"
2206 dnl
2207 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2208 dnl checks the results of pkg-config to some extent)
2209 dnl
2210       rm -f conf.gtktest
2211       AC_TRY_RUN([
2212 #include <gtk/gtk.h>
2213 #include <stdio.h>
2214 #include <stdlib.h>
2215
2216 int 
2217 main ()
2218 {
2219   int major, minor, micro;
2220   char *tmp_version;
2221
2222   system ("touch conf.gtktest");
2223
2224   /* HP/UX 9 (%@#!) writes to sscanf strings */
2225   tmp_version = g_strdup("$min_gtk_version");
2226   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2227      printf("%s, bad version string\n", "$min_gtk_version");
2228      exit(1);
2229    }
2230
2231   if ((gtk_major_version != $gtk_config_major_version) ||
2232       (gtk_minor_version != $gtk_config_minor_version) ||
2233       (gtk_micro_version != $gtk_config_micro_version))
2234     {
2235       printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
2236              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2237              gtk_major_version, gtk_minor_version, gtk_micro_version);
2238       printf ("*** was found! If pkg-config was correct, then it is best\n");
2239       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2240       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2241       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2242       printf("*** required on your system.\n");
2243       printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2244       printf("*** to point to the correct configuration files\n");
2245     } 
2246   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2247            (gtk_minor_version != GTK_MINOR_VERSION) ||
2248            (gtk_micro_version != GTK_MICRO_VERSION))
2249     {
2250       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2251              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2252       printf("*** library (version %d.%d.%d)\n",
2253              gtk_major_version, gtk_minor_version, gtk_micro_version);
2254     }
2255   else
2256     {
2257       if ((gtk_major_version > major) ||
2258         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2259         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2260       {
2261         return 0;
2262        }
2263      else
2264       {
2265         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2266                gtk_major_version, gtk_minor_version, gtk_micro_version);
2267         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2268                major, minor, micro);
2269         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2270         printf("***\n");
2271         printf("*** If you have already installed a sufficiently new version, this error\n");
2272         printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2273         printf("*** being found. The easiest way to fix this is to remove the old version\n");
2274         printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2275         printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2276         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2277         printf("*** so that the correct libraries are found at run-time))\n");
2278       }
2279     }
2280   return 1;
2281 }
2282 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2283        CFLAGS="$ac_save_CFLAGS"
2284        LIBS="$ac_save_LIBS"
2285      fi
2286   fi
2287   if test "x$no_gtk" = x ; then
2288      AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2289      ifelse([$2], , :, [$2])     
2290   else
2291      AC_MSG_RESULT(no)
2292      if test "$PKG_CONFIG" = "no" ; then
2293        echo "*** A new enough version of pkg-config was not found."
2294        echo "*** See http://pkgconfig.sourceforge.net"
2295      else
2296        if test -f conf.gtktest ; then
2297         :
2298        else
2299           echo "*** Could not run GTK+ test program, checking why..."
2300           ac_save_CFLAGS="$CFLAGS"
2301           ac_save_LIBS="$LIBS"
2302           CFLAGS="$CFLAGS $GTK_CFLAGS"
2303           LIBS="$LIBS $GTK_LIBS"
2304           AC_TRY_LINK([
2305 #include <gtk/gtk.h>
2306 #include <stdio.h>
2307 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2308         [ echo "*** The test program compiled, but did not run. This usually means"
2309           echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2310           echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2311           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2312           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2313           echo "*** is required on your system"
2314           echo "***"
2315           echo "*** If you have an old version installed, it is best to remove it, although"
2316           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2317         [ echo "*** The test program failed to compile or link. See the file config.log for the"
2318           echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2319           CFLAGS="$ac_save_CFLAGS"
2320           LIBS="$ac_save_LIBS"
2321        fi
2322      fi
2323      GTK_CFLAGS=""
2324      GTK_LIBS=""
2325      ifelse([$3], , :, [$3])
2326   fi
2327   AC_SUBST(GTK_CFLAGS)
2328   AC_SUBST(GTK_LIBS)
2329   rm -f conf.gtktest
2330 ])
2331
2332 # Configure paths for GTK+
2333 # Owen Taylor     97-11-3
2334
2335 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2336 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2337 dnl
2338 AC_DEFUN([AM_PATH_GTK],
2339 [dnl 
2340 dnl Get the cflags and libraries from the gtk-config script
2341 dnl
2342 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
2343             gtk_config_prefix="$withval", gtk_config_prefix="")
2344 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2345             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2346 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
2347                     , enable_gtktest=yes)
2348
2349   for module in . $4
2350   do
2351       case "$module" in
2352          gthread) 
2353              gtk_config_args="$gtk_config_args gthread"
2354          ;;
2355       esac
2356   done
2357
2358   if test x$gtk_config_exec_prefix != x ; then
2359      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2360      if test x${GTK_CONFIG+set} != xset ; then
2361         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2362      fi
2363   fi
2364   if test x$gtk_config_prefix != x ; then
2365      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2366      if test x${GTK_CONFIG+set} != xset ; then
2367         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2368      fi
2369   fi
2370
2371   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2372   min_gtk_version=ifelse([$1], ,0.99.7,$1)
2373   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2374   no_gtk=""
2375   if test "$GTK_CONFIG" = "no" ; then
2376     no_gtk=yes
2377   else
2378     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2379     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2380     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2381            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2382     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2383            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2384     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2385            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2386     if test "x$enable_gtktest" = "xyes" ; then
2387       ac_save_CFLAGS="$CFLAGS"
2388       ac_save_LIBS="$LIBS"
2389       CFLAGS="$CFLAGS $GTK_CFLAGS"
2390       LIBS="$GTK_LIBS $LIBS"
2391 dnl
2392 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2393 dnl checks the results of gtk-config to some extent
2394 dnl
2395       rm -f conf.gtktest
2396       AC_TRY_RUN([
2397 #include <gtk/gtk.h>
2398 #include <stdio.h>
2399 #include <stdlib.h>
2400
2401 int 
2402 main ()
2403 {
2404   int major, minor, micro;
2405   char *tmp_version;
2406
2407   system ("touch conf.gtktest");
2408
2409   /* HP/UX 9 (%@#!) writes to sscanf strings */
2410   tmp_version = g_strdup("$min_gtk_version");
2411   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2412      printf("%s, bad version string\n", "$min_gtk_version");
2413      exit(1);
2414    }
2415
2416   if ((gtk_major_version != $gtk_config_major_version) ||
2417       (gtk_minor_version != $gtk_config_minor_version) ||
2418       (gtk_micro_version != $gtk_config_micro_version))
2419     {
2420       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
2421              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2422              gtk_major_version, gtk_minor_version, gtk_micro_version);
2423       printf ("*** was found! If gtk-config was correct, then it is best\n");
2424       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2425       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2426       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2427       printf("*** required on your system.\n");
2428       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2429       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2430       printf("*** before re-running configure\n");
2431     } 
2432 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2433   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2434            (gtk_minor_version != GTK_MINOR_VERSION) ||
2435            (gtk_micro_version != GTK_MICRO_VERSION))
2436     {
2437       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2438              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2439       printf("*** library (version %d.%d.%d)\n",
2440              gtk_major_version, gtk_minor_version, gtk_micro_version);
2441     }
2442 #endif /* defined (GTK_MAJOR_VERSION) ... */
2443   else
2444     {
2445       if ((gtk_major_version > major) ||
2446         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2447         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2448       {
2449         return 0;
2450        }
2451      else
2452       {
2453         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2454                gtk_major_version, gtk_minor_version, gtk_micro_version);
2455         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2456                major, minor, micro);
2457         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2458         printf("***\n");
2459         printf("*** If you have already installed a sufficiently new version, this error\n");
2460         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2461         printf("*** being found. The easiest way to fix this is to remove the old version\n");
2462         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2463         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2464         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2465         printf("*** so that the correct libraries are found at run-time))\n");
2466       }
2467     }
2468   return 1;
2469 }
2470 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2471        CFLAGS="$ac_save_CFLAGS"
2472        LIBS="$ac_save_LIBS"
2473      fi
2474   fi
2475   if test "x$no_gtk" = x ; then
2476      AC_MSG_RESULT(yes)
2477      ifelse([$2], , :, [$2])     
2478   else
2479      AC_MSG_RESULT(no)
2480      if test "$GTK_CONFIG" = "no" ; then
2481        echo "*** The gtk-config script installed by GTK could not be found"
2482        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2483        echo "*** your path, or set the GTK_CONFIG environment variable to the"
2484        echo "*** full path to gtk-config."
2485      else
2486        if test -f conf.gtktest ; then
2487         :
2488        else
2489           echo "*** Could not run GTK test program, checking why..."
2490           CFLAGS="$CFLAGS $GTK_CFLAGS"
2491           LIBS="$LIBS $GTK_LIBS"
2492           AC_TRY_LINK([
2493 #include <gtk/gtk.h>
2494 #include <stdio.h>
2495 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2496         [ echo "*** The test program compiled, but did not run. This usually means"
2497           echo "*** that the run-time linker is not finding GTK or finding the wrong"
2498           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2499           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2500           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2501           echo "*** is required on your system"
2502           echo "***"
2503           echo "*** If you have an old version installed, it is best to remove it, although"
2504           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2505           echo "***"
2506           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2507           echo "*** came with the system with the command"
2508           echo "***"
2509           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
2510         [ echo "*** The test program failed to compile or link. See the file config.log for the"
2511           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2512           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2513           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2514           CFLAGS="$ac_save_CFLAGS"
2515           LIBS="$ac_save_LIBS"
2516        fi
2517      fi
2518      GTK_CFLAGS=""
2519      GTK_LIBS=""
2520      ifelse([$3], , :, [$3])
2521   fi
2522   AC_SUBST(GTK_CFLAGS)
2523   AC_SUBST(GTK_LIBS)
2524   rm -f conf.gtktest
2525 ])
2526