OSDN Git Service

Enable gcc option -mms-bitfield for Mingw32 and cygwin gcc.
[timidity41/timidity41.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.9 -*- 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.9])])
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 interface_$3.\$(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 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1175 #   Free Software Foundation, Inc.
1176
1177 # This program is free software; you can redistribute it and/or modify
1178 # it under the terms of the GNU General Public License as published by
1179 # the Free Software Foundation; either version 2, or (at your option)
1180 # any later version.
1181
1182 # This program is distributed in the hope that it will be useful,
1183 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1184 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1185 # GNU General Public License for more details.
1186
1187 # You should have received a copy of the GNU General Public License
1188 # along with this program; if not, write to the Free Software
1189 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1190 # 02111-1307, USA.
1191
1192 # serial 7
1193
1194 # AM_PATH_LISPDIR
1195 # ---------------
1196 AC_DEFUN([AM_PATH_LISPDIR],
1197 [AC_ARG_WITH(lispdir,
1198  [  --with-lispdir          Override the default lisp directory ],
1199  [ lispdir="$withval"
1200    AC_MSG_CHECKING([where .elc files should go])
1201    AC_MSG_RESULT([$lispdir])],
1202  [
1203  # If set to t, that means we are running in a shell under Emacs.
1204  # If you have an Emacs named "t", then use the full path.
1205  test x"$EMACS" = xt && EMACS=
1206  AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1207  if test $EMACS != "no"; then
1208    if test x${lispdir+set} != xset; then
1209      AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir],
1210        [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
1211   # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
1212   #  which is non-obvious for non-emacs users.
1213   # Redirecting /dev/null should help a bit; pity we can't detect "broken"
1214   #  emacsen earlier and avoid running this altogether.
1215   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])
1216         am_cv_lispdir=`sed -n \
1217        -e 's,/$,,' \
1218        -e '/.*\/lib\/x\?emacs\/site-lisp$/{s,.*/lib/\(x\?emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
1219        -e '/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}' \
1220        conftest.out`
1221        rm conftest.out
1222        if test -z "$am_cv_lispdir"; then
1223          am_cv_lispdir='${datadir}/emacs/site-lisp'
1224        fi
1225      ])
1226      lispdir="$am_cv_lispdir"
1227    fi
1228  fi
1229 ])
1230 AC_SUBST(lispdir)
1231 ])# AM_PATH_LISPDIR
1232
1233 AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])
1234
1235 dnl Configure Paths for Alsa
1236 dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
1237 dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
1238 dnl Jaroslav Kysela <perex@suse.cz>
1239 dnl Modified for TiMidity++ by URABE, Shyouhei <root@mput.dip.jp>
1240 dnl Original    : alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp
1241 dnl This version: alsa.m4,       2002/10/08 22:30:18 JST
1242 dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1243 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
1244 dnl enables arguments --with-alsa-prefix=
1245 dnl                   --with-alsa-enc-prefix=
1246 dnl                   --disable-alsatest  (this has no effect, as yet)
1247 dnl
1248 dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
1249 dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
1250 dnl
1251 AC_DEFUN(AM_PATH_ALSA,
1252 [dnl Save the original CFLAGS, LDFLAGS, and LIBS
1253 alsa_save_CFLAGS="$CFLAGS"
1254 alsa_save_LDFLAGS="$LDFLAGS"
1255 alsa_save_LIBS="$LIBS"
1256 alsa_found=yes
1257
1258 dnl
1259 dnl Get the cflags and libraries for alsa
1260 dnl
1261 AC_ARG_WITH(alsa-prefix,
1262 [  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
1263 [alsa_prefix="$withval"], [alsa_prefix=""])
1264
1265 AC_ARG_WITH(alsa-inc-prefix,
1266 [  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
1267 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
1268
1269 dnl FIXME: this is not yet implemented
1270 AC_ARG_ENABLE(alsatest,
1271 [  --disable-alsatest      Do not try to compile and run a test Alsa program],
1272 [enable_alsatest=no],
1273 [enable_alsatest=yes])
1274
1275 dnl Add any special include directories
1276 AC_MSG_CHECKING(for ALSA CFLAGS)
1277 if test "$alsa_inc_prefix" != "" ; then
1278         ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
1279         CFLAGS="$CFLAGS -I$alsa_inc_prefix"
1280 fi
1281 AC_MSG_RESULT($ALSA_CFLAGS)
1282
1283 dnl add any special lib dirs
1284 AC_MSG_CHECKING(for ALSA LDFLAGS)
1285 if test "$alsa_prefix" != "" ; then
1286         ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
1287         LDFLAGS="$LDFLAGS $ALSA_LIBS"
1288 fi
1289
1290 dnl add the alsa library
1291 ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
1292 LIBS=`echo $LIBS | sed 's/-lm//'`
1293 LIBS=`echo $LIBS | sed 's/-ldl//'`
1294 LIBS=`echo $LIBS | sed 's/-lpthread//'`
1295 LIBS=`echo $LIBS | sed 's/  //'`
1296 LIBS="$ALSA_LIBS $LIBS"
1297 AC_MSG_RESULT($ALSA_LIBS)
1298
1299 dnl Check for a working version of libasound that is of the right version.
1300 min_alsa_version=ifelse([$1], ,0.1.1,$1)
1301 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
1302 no_alsa=""
1303     alsa_min_major_version=`echo $min_alsa_version | \
1304            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1305     alsa_min_minor_version=`echo $min_alsa_version | \
1306            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1307     alsa_min_micro_version=`echo $min_alsa_version | \
1308            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1309
1310 dnl This is the test program.
1311 AC_DEFUN([MPUT_ALSA_TRY],[
1312 /* ensure backward compatibility */
1313 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
1314 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
1315 #endif
1316 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
1317 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
1318 #endif
1319 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
1320 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
1321 #endif
1322
1323 #  if(SND_LIB_MAJOR > $alsa_min_major_version)
1324   exit(0);
1325 #  else
1326 #    if(SND_LIB_MAJOR < $alsa_min_major_version)
1327 #       error not present
1328 #    endif
1329
1330 #   if(SND_LIB_MINOR > $alsa_min_minor_version)
1331   exit(0);
1332 #   else
1333 #     if(SND_LIB_MINOR < $alsa_min_minor_version)
1334 #          error not present
1335 #      endif
1336
1337 #      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
1338 #        error not present
1339 #      endif
1340 #    endif
1341 #  endif
1342 exit(0);
1343 ])dnl macro MPUT_ALSA_TRY
1344
1345 AC_LANG_SAVE
1346 AC_LANG_C
1347 AC_TRY_COMPILE([
1348 #include <alsa/asoundlib.h>
1349 ],
1350   MPUT_ALSA_TRY(),
1351   [AC_MSG_RESULT(found.)],
1352   [AC_TRY_COMPILE([
1353 #include <sys/asoundlib.h>
1354 ], 
1355   MPUT_ALSA_TRY(),
1356   [AC_MSG_RESULT(found.)],
1357   [AC_MSG_RESULT(not present.)
1358    ifelse([$3], ,[AC_MSG_RESULT(libasound was not found anywhere.)])
1359    alsa_found=no])
1360    ifelse([$3], ,[AC_MSG_RESULT(Sufficiently new version of libasound not found.)])
1361 ])
1362 AC_LANG_RESTORE
1363
1364 dnl Now that we know we have the right version, why not see if we
1365 dnl have the library and not just the headers.
1366 AC_CHECK_LIB([asound],[snd_ctl_open], ,
1367   [ifelse([$3], ,[AC_MSG_RESULT(No linkable libasound was found.)])
1368    alsa_found=no
1369 ])
1370
1371 if test "x$alsa_found" = "xyes" ; then
1372    ifelse([$2], , :, [$2])
1373    LIBS=`echo $LIBS | sed 's/-lasound//g'`
1374    LIBS=`echo $LIBS | sed 's/  //'`
1375    LIBS="-lasound $LIBS"
1376 else
1377    ifelse([$3], , :, [$3])
1378    CFLAGS="$alsa_save_CFLAGS"
1379    LDFLAGS="$alsa_save_LDFLAGS"
1380    LIBS="$alsa_save_LIBS"
1381    ALSA_CFLAGS=""
1382    ALSA_LIBS=""
1383 fi
1384
1385 dnl That should be it.  Now just export out symbols:
1386 AC_SUBST(ALSA_CFLAGS)
1387 AC_SUBST(ALSA_LIBS)
1388 ])
1389 dnl This should be pulled in from arts.m4
1390 dnl
1391 dnl Oh my word, I've never hacked automake before - let me know if this is a
1392 dnl complete rubbish!
1393 dnl Peter L Jones 2002-05-12
1394 dnl Snarfed from the ESD code below - but the faults are all mine!
1395
1396
1397 dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1398 dnl Test for aRts, and define ARTS_CFLAGS and ARTS_LIBS
1399 dnl
1400 AC_DEFUN(AM_PATH_ARTS,
1401         [dnl 
1402 dnl Get the cflags and libraries from the arts-config script
1403 dnl
1404 AC_ARG_WITH(arts-prefix,[  --with-arts-prefix=PFX   Prefix where ARTS is installed (optional)],
1405         arts_prefix="$withval", arts_prefix="")
1406 AC_ARG_ENABLE(artstest, [  --disable-artstest       Do not try to compile and run a test ARTS program],
1407         , enable_artstest=yes)
1408
1409   if test x$arts_prefix != x ; then
1410      arts_args="$arts_args --prefix=$arts_prefix"
1411      if test x${ARTS_CONFIG+set} != xset ; then
1412         ARTS_CONFIG=$arts_prefix/bin/artsc-config
1413      fi
1414   fi
1415
1416   AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1417   min_arts_version=ifelse([$1], ,0.9.5,$1)
1418   AC_MSG_CHECKING(for ARTS - version >= $min_arts_version)
1419   no_arts=""
1420   if test "$ARTS_CONFIG" = "no" ; then
1421     no_arts=yes
1422   else
1423     ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags`
1424     ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs`
1425
1426     arts_major_version=`$ARTS_CONFIG $arts_args --version | \
1427            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1428     arts_minor_version=`$ARTS_CONFIG $arts_args --version | \
1429            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1430     arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \
1431            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1432     if test "x$enable_artstest" = "xyes" ; then
1433       ac_save_CFLAGS="$CFLAGS"
1434       ac_save_LIBS="$LIBS"
1435       CFLAGS="$CFLAGS $ARTS_CFLAGS"
1436       LIBS="$LIBS $ARTS_LIBS"
1437 dnl
1438 dnl Now check if the installed ARTS is sufficiently new. (Also sanity
1439 dnl checks the results of arts-config to some extent
1440 dnl
1441       rm -f conf.artstest
1442       AC_TRY_RUN([
1443 #include <stdio.h>
1444 #include <stdlib.h>
1445 #include <string.h>
1446 #include <artsc.h>
1447
1448 char*
1449 my_strdup (char *str)
1450 {
1451   char *new_str;
1452   
1453   if (str)
1454     {
1455       new_str = malloc ((strlen (str) + 1) * sizeof(char));
1456       strcpy (new_str, str);
1457     }
1458   else
1459     new_str = NULL;
1460   
1461   return new_str;
1462 }
1463
1464 int main ()
1465 {
1466   int major, minor, micro;
1467   char *tmp_version;
1468
1469   system ("touch conf.artstest");
1470
1471   /* HP/UX 9 (%@#!) writes to sscanf strings */
1472   tmp_version = my_strdup("$min_arts_version");
1473   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1474      printf("%s, bad version string\n", "$min_arts_version");
1475      exit(1);
1476    }
1477
1478    if (($arts_major_version > major) ||
1479       (($arts_major_version == major) && ($arts_minor_version > minor)) ||
1480       (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro)))
1481     {
1482       return 0;
1483     }
1484   else
1485     {
1486       printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version);
1487       printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro);
1488       printf("*** best to upgrade to the required version.\n");
1489       printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n");
1490       printf("*** to point to the correct copy of artsc-config, and remove the file\n");
1491       printf("*** config.cache before re-running configure\n");
1492       return 1;
1493     }
1494 }
1495
1496 ],, no_arts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1497        CFLAGS="$ac_save_CFLAGS"
1498        LIBS="$ac_save_LIBS"
1499      fi
1500   fi
1501   if test "x$no_arts" = x ; then
1502      AC_MSG_RESULT(yes)
1503      ifelse([$2], , :, [$2])     
1504   else
1505      AC_MSG_RESULT(no)
1506      if test "$ARTS_CONFIG" = "no" ; then
1507        echo "*** The artsc-config script installed by ARTS could not be found"
1508        echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in"
1509        echo "*** your path, or set the ARTS_CONFIG environment variable to the"
1510        echo "*** full path to artsc-config."
1511      else
1512        if test -f conf.artstest ; then
1513         :
1514        else
1515           echo "*** Could not run ARTS test program, checking why..."
1516           CFLAGS="$CFLAGS $ARTS_CFLAGS"
1517           LIBS="$LIBS $ARTS_LIBS"
1518           AC_TRY_LINK([
1519 #include <stdio.h>
1520 #include <artsc.h>
1521 ],      [ return 0; ],
1522         [ echo "*** The test program compiled, but did not run. This usually means"
1523           echo "*** that the run-time linker is not finding ARTS or finding the wrong"
1524           echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your"
1525           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1526           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1527           echo "*** is required on your system"
1528           echo "***"
1529           echo "*** If you have an old version installed, it is best to remove it, although"
1530           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1531         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1532           echo "*** exact error that occured. This usually means ARTS was incorrectly installed"
1533           echo "*** or that you have moved ARTS since it was installed. In the latter case, you"
1534           echo "*** may want to edit the arts-config script: $ARTS_CONFIG" ])
1535           CFLAGS="$ac_save_CFLAGS"
1536           LIBS="$ac_save_LIBS"
1537        fi
1538      fi
1539      ARTS_CFLAGS=""
1540      ARTS_LIBS=""
1541      ifelse([$3], , :, [$3])
1542   fi
1543   AC_SUBST(ARTS_CFLAGS)
1544   AC_SUBST(ARTS_LIBS)
1545   rm -f conf.artstest
1546 ])
1547 dnl End of aRts
1548 # Configure paths for ESD
1549 # Manish Singh    98-9-30
1550 # stolen back from Frank Belew
1551 # stolen from Manish Singh
1552 # Shamelessly stolen from Owen Taylor
1553
1554 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1555 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
1556 dnl
1557 AC_DEFUN(AM_PATH_ESD,
1558 [dnl 
1559 dnl Get the cflags and libraries from the esd-config script
1560 dnl
1561 AC_ARG_WITH(esd-prefix,[  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)],
1562             esd_prefix="$withval", esd_prefix="")
1563 AC_ARG_WITH(esd-exec-prefix,[  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
1564             esd_exec_prefix="$withval", esd_exec_prefix="")
1565 AC_ARG_ENABLE(esdtest, [  --disable-esdtest       Do not try to compile and run a test ESD program],
1566                     , enable_esdtest=yes)
1567
1568   if test x$esd_exec_prefix != x ; then
1569      esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
1570      if test x${ESD_CONFIG+set} != xset ; then
1571         ESD_CONFIG=$esd_exec_prefix/bin/esd-config
1572      fi
1573   fi
1574   if test x$esd_prefix != x ; then
1575      esd_args="$esd_args --prefix=$esd_prefix"
1576      if test x${ESD_CONFIG+set} != xset ; then
1577         ESD_CONFIG=$esd_prefix/bin/esd-config
1578      fi
1579   fi
1580
1581   AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1582   min_esd_version=ifelse([$1], ,0.2.7,$1)
1583   AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
1584   no_esd=""
1585   if test "$ESD_CONFIG" = "no" ; then
1586     no_esd=yes
1587   else
1588     AC_LANG_SAVE
1589     AC_LANG_C
1590     ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
1591     ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
1592
1593     esd_major_version=`$ESD_CONFIG $esd_args --version | \
1594            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1595     esd_minor_version=`$ESD_CONFIG $esd_args --version | \
1596            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1597     esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
1598            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1599     if test "x$enable_esdtest" = "xyes" ; then
1600       ac_save_CFLAGS="$CFLAGS"
1601       ac_save_LIBS="$LIBS"
1602       CFLAGS="$CFLAGS $ESD_CFLAGS"
1603       LIBS="$LIBS $ESD_LIBS"
1604 dnl
1605 dnl Now check if the installed ESD is sufficiently new. (Also sanity
1606 dnl checks the results of esd-config to some extent
1607 dnl
1608       rm -f conf.esdtest
1609       AC_TRY_RUN([
1610 #include <stdio.h>
1611 #include <stdlib.h>
1612 #include <string.h>
1613 #include <esd.h>
1614
1615 char*
1616 my_strdup (char *str)
1617 {
1618   char *new_str;
1619   
1620   if (str)
1621     {
1622       new_str = malloc ((strlen (str) + 1) * sizeof(char));
1623       strcpy (new_str, str);
1624     }
1625   else
1626     new_str = NULL;
1627   
1628   return new_str;
1629 }
1630
1631 int main ()
1632 {
1633   int major, minor, micro;
1634   char *tmp_version;
1635
1636   system ("touch conf.esdtest");
1637
1638   /* HP/UX 9 (%@#!) writes to sscanf strings */
1639   tmp_version = my_strdup("$min_esd_version");
1640   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1641      printf("%s, bad version string\n", "$min_esd_version");
1642      exit(1);
1643    }
1644
1645    if (($esd_major_version > major) ||
1646       (($esd_major_version == major) && ($esd_minor_version > minor)) ||
1647       (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
1648     {
1649       return 0;
1650     }
1651   else
1652     {
1653       printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
1654       printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
1655       printf("*** best to upgrade to the required version.\n");
1656       printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
1657       printf("*** to point to the correct copy of esd-config, and remove the file\n");
1658       printf("*** config.cache before re-running configure\n");
1659       return 1;
1660     }
1661 }
1662
1663 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1664        CFLAGS="$ac_save_CFLAGS"
1665        LIBS="$ac_save_LIBS"
1666        AC_LANG_RESTORE
1667      fi
1668   fi
1669   if test "x$no_esd" = x ; then
1670      AC_MSG_RESULT(yes)
1671      ifelse([$2], , :, [$2])     
1672   else
1673      AC_MSG_RESULT(no)
1674      if test "$ESD_CONFIG" = "no" ; then
1675        echo "*** The esd-config script installed by ESD could not be found"
1676        echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
1677        echo "*** your path, or set the ESD_CONFIG environment variable to the"
1678        echo "*** full path to esd-config."
1679      else
1680        if test -f conf.esdtest ; then
1681         :
1682        else
1683           echo "*** Could not run ESD test program, checking why..."
1684           CFLAGS="$CFLAGS $ESD_CFLAGS"
1685           LIBS="$LIBS $ESD_LIBS"
1686           AC_LANG_SAVE
1687           AC_LANG_C
1688           AC_TRY_LINK([
1689 #include <stdio.h>
1690 #include <esd.h>
1691 ],      [ return 0; ],
1692         [ echo "*** The test program compiled, but did not run. This usually means"
1693           echo "*** that the run-time linker is not finding ESD or finding the wrong"
1694           echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
1695           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1696           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1697           echo "*** is required on your system"
1698           echo "***"
1699           echo "*** If you have an old version installed, it is best to remove it, although"
1700           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1701         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1702           echo "*** exact error that occured. This usually means ESD was incorrectly installed"
1703           echo "*** or that you have moved ESD since it was installed. In the latter case, you"
1704           echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
1705           CFLAGS="$ac_save_CFLAGS"
1706           LIBS="$ac_save_LIBS"
1707           AC_LANG_RESTORE
1708        fi
1709      fi
1710      ESD_CFLAGS=""
1711      ESD_LIBS=""
1712      ifelse([$3], , :, [$3])
1713   fi
1714   AC_SUBST(ESD_CFLAGS)
1715   AC_SUBST(ESD_LIBS)
1716   rm -f conf.esdtest
1717 ])
1718
1719 dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
1720 dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
1721 dnl
1722 AC_DEFUN(AM_ESD_SUPPORTS_MULTIPLE_RECORD,
1723 [dnl
1724   AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
1725   ac_save_ESD_CFLAGS="$ESD_CFLAGS"
1726   ac_save_ESD_LIBS="$ESD_LIBS"
1727   AM_PATH_ESD(0.2.21,
1728     ifelse([$1], , [
1729       AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
1730       AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
1731         [Define if you have esound with support of multiple recording clients.])],
1732     [$1]),
1733     ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
1734     if test "x$ac_save_ESD_CFLAGS" != x ; then
1735        ESD_CFLAGS="$ac_save_ESD_CFLAGS"
1736     fi
1737     if test "x$ac_save_ESD_LIBS" != x ; then
1738        ESD_LIBS="$ac_save_ESD_LIBS"
1739     fi
1740   )
1741 ])
1742
1743 # ao.m4
1744 # Configure paths for libao
1745 # Jack Moffitt <jack@icecast.org> 10-21-2000
1746 # Shamelessly stolen from Owen Taylor and Manish Singh
1747
1748 dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1749 dnl Test for libao, and define AO_CFLAGS and AO_LIBS
1750 dnl
1751 AC_DEFUN(XIPH_PATH_AO,
1752 [dnl 
1753 dnl Get the cflags and libraries
1754 dnl
1755 AC_ARG_WITH(ao,[  --with-ao=PFX   Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="")
1756 AC_ARG_WITH(ao-libraries,[  --with-ao-libraries=DIR   Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="")
1757 AC_ARG_WITH(ao-includes,[  --with-ao-includes=DIR   Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="")
1758 AC_ARG_ENABLE(aotest, [  --disable-aotest       Do not try to compile and run a test ao program],, enable_aotest=yes)
1759
1760
1761   if test "x$ao_libraries" != "x" ; then
1762     AO_LIBS="-L$ao_libraries"
1763   elif test "x$ao_prefix" != "x"; then
1764     AO_LIBS="-L$ao_prefix/lib"
1765   elif test "x$prefix" != "xNONE"; then
1766     AO_LIBS="-L$prefix/lib"
1767   fi
1768
1769   if test "x$ao_includes" != "x" ; then
1770     AO_CFLAGS="-I$ao_includes"
1771   elif test "x$ao_prefix" != "x"; then
1772     AO_CFLAGS="-I$ao_prefix/include"
1773   elif test "x$prefix" != "xNONE"; then
1774     AO_CFLAGS="-I$prefix/include"
1775   fi
1776
1777   # see where dl* and friends live
1778   AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
1779     AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
1780       AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
1781       your system may not be supported.])
1782     ])
1783   ])
1784
1785   AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
1786
1787   AC_MSG_CHECKING(for ao)
1788   no_ao=""
1789
1790
1791   if test "x$enable_aotest" = "xyes" ; then
1792     ac_save_CFLAGS="$CFLAGS"
1793     ac_save_LIBS="$LIBS"
1794     CFLAGS="$CFLAGS $AO_CFLAGS"
1795     LIBS="$LIBS $AO_LIBS"
1796 dnl
1797 dnl Now check if the installed ao is sufficiently new.
1798 dnl
1799       rm -f conf.aotest
1800       AC_TRY_RUN([
1801 #include <stdio.h>
1802 #include <stdlib.h>
1803 #include <string.h>
1804 #include <ao/ao.h>
1805
1806 int main ()
1807 {
1808   system("touch conf.aotest");
1809   return 0;
1810 }
1811
1812 ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1813        CFLAGS="$ac_save_CFLAGS"
1814        LIBS="$ac_save_LIBS"
1815   fi
1816
1817   if test "x$no_ao" = "x" ; then
1818      AC_MSG_RESULT(yes)
1819      ifelse([$1], , :, [$1])     
1820   else
1821      AC_MSG_RESULT(no)
1822      if test -f conf.aotest ; then
1823        :
1824      else
1825        echo "*** Could not run ao test program, checking why..."
1826        CFLAGS="$CFLAGS $AO_CFLAGS"
1827        LIBS="$LIBS $AO_LIBS"
1828        AC_TRY_LINK([
1829 #include <stdio.h>
1830 #include <ao/ao.h>
1831 ],     [ return 0; ],
1832        [ echo "*** The test program compiled, but did not run. This usually means"
1833        echo "*** that the run-time linker is not finding ao or finding the wrong"
1834        echo "*** version of ao. If it is not finding ao, you'll need to set your"
1835        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1836        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1837        echo "*** is required on your system"
1838        echo "***"
1839        echo "*** If you have an old version installed, it is best to remove it, although"
1840        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1841        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1842        echo "*** exact error that occured. This usually means ao was incorrectly installed"
1843        echo "*** or that you have moved ao since it was installed." ])
1844        CFLAGS="$ac_save_CFLAGS"
1845        LIBS="$ac_save_LIBS"
1846      fi
1847      AO_CFLAGS=""
1848      AO_LIBS=""
1849      ifelse([$2], , :, [$2])
1850   fi
1851   AC_SUBST(AO_CFLAGS)
1852   AC_SUBST(AO_LIBS)
1853   rm -f conf.aotest
1854 ])
1855
1856 # Configure paths for libogg
1857 # Jack Moffitt <jack@icecast.org> 10-21-2000
1858 # Shamelessly stolen from Owen Taylor and Manish Singh
1859
1860 dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1861 dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
1862 dnl
1863 AC_DEFUN(AM_PATH_OGG,
1864 [dnl 
1865 dnl Get the cflags and libraries
1866 dnl
1867 AC_ARG_WITH(ogg,[  --with-ogg=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
1868 AC_ARG_WITH(ogg-libraries,[  --with-ogg-libraries=DIR   Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
1869 AC_ARG_WITH(ogg-includes,[  --with-ogg-includes=DIR   Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
1870 AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
1871
1872   if test "x$ogg_libraries" != "x" ; then
1873     OGG_LIBS="-L$ogg_libraries"
1874   elif test "x$ogg_prefix" != "x" ; then
1875     OGG_LIBS="-L$ogg_prefix/lib"
1876   elif test "x$prefix" != "xNONE" ; then
1877     OGG_LIBS="-L$prefix/lib"
1878   fi
1879
1880   OGG_LIBS="$OGG_LIBS -logg"
1881
1882   if test "x$ogg_includes" != "x" ; then
1883     OGG_CFLAGS="-I$ogg_includes"
1884   elif test "x$ogg_prefix" != "x" ; then
1885     OGG_CFLAGS="-I$ogg_prefix/include"
1886   elif test "x$prefix" != "xNONE"; then
1887     OGG_CFLAGS="-I$prefix/include"
1888   fi
1889
1890   AC_MSG_CHECKING(for Ogg)
1891   no_ogg=""
1892
1893
1894   if test "x$enable_oggtest" = "xyes" ; then
1895     ac_save_CFLAGS="$CFLAGS"
1896     ac_save_LIBS="$LIBS"
1897     CFLAGS="$CFLAGS $OGG_CFLAGS"
1898     LIBS="$LIBS $OGG_LIBS"
1899 dnl
1900 dnl Now check if the installed Ogg is sufficiently new.
1901 dnl
1902       rm -f conf.oggtest
1903       AC_TRY_RUN([
1904 #include <stdio.h>
1905 #include <stdlib.h>
1906 #include <string.h>
1907 #include <ogg/ogg.h>
1908
1909 int main ()
1910 {
1911   system("touch conf.oggtest");
1912   return 0;
1913 }
1914
1915 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1916        CFLAGS="$ac_save_CFLAGS"
1917        LIBS="$ac_save_LIBS"
1918   fi
1919
1920   if test "x$no_ogg" = "x" ; then
1921      AC_MSG_RESULT(yes)
1922      ifelse([$1], , :, [$1])     
1923   else
1924      AC_MSG_RESULT(no)
1925      if test -f conf.oggtest ; then
1926        :
1927      else
1928        echo "*** Could not run Ogg test program, checking why..."
1929        CFLAGS="$CFLAGS $OGG_CFLAGS"
1930        LIBS="$LIBS $OGG_LIBS"
1931        AC_TRY_LINK([
1932 #include <stdio.h>
1933 #include <ogg/ogg.h>
1934 ],     [ return 0; ],
1935        [ echo "*** The test program compiled, but did not run. This usually means"
1936        echo "*** that the run-time linker is not finding Ogg or finding the wrong"
1937        echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
1938        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1939        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1940        echo "*** is required on your system"
1941        echo "***"
1942        echo "*** If you have an old version installed, it is best to remove it, although"
1943        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1944        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1945        echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
1946        echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
1947        echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
1948        CFLAGS="$ac_save_CFLAGS"
1949        LIBS="$ac_save_LIBS"
1950      fi
1951      OGG_CFLAGS=""
1952      OGG_LIBS=""
1953      ifelse([$2], , :, [$2])
1954   fi
1955   AC_SUBST(OGG_CFLAGS)
1956   AC_SUBST(OGG_LIBS)
1957   rm -f conf.oggtest
1958 ])
1959
1960 # Configure paths for libvorbis
1961 # Jack Moffitt <jack@icecast.org> 10-21-2000
1962 # Shamelessly stolen from Owen Taylor and Manish Singh
1963
1964 dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1965 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
1966 dnl
1967 AC_DEFUN(AM_PATH_VORBIS,
1968 [dnl 
1969 dnl Get the cflags and libraries
1970 dnl
1971 AC_ARG_WITH(vorbis,[  --with-vorbis=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
1972 AC_ARG_WITH(vorbis-libraries,[  --with-vorbis-libraries=DIR   Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
1973 AC_ARG_WITH(vorbis-includes,[  --with-vorbis-includes=DIR   Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
1974 AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
1975
1976   if test "x$vorbis_libraries" != "x" ; then
1977     VORBIS_LIBS="-L$vorbis_libraries"
1978   elif test "x$vorbis_prefix" != "x" ; then
1979     VORBIS_LIBS="-L$vorbis_prefix/lib"
1980   elif test "x$prefix" != "xNONE"; then
1981     VORBIS_LIBS="-L$prefix/lib"
1982   fi
1983
1984   VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
1985   VORBISFILE_LIBS="-lvorbisfile"
1986   VORBISENC_LIBS="-lvorbisenc"
1987
1988   if test "x$vorbis_includes" != "x" ; then
1989     VORBIS_CFLAGS="-I$vorbis_includes"
1990   elif test "x$vorbis_prefix" != "x" ; then
1991     VORBIS_CFLAGS="-I$vorbis_prefix/include"
1992   elif test "x$prefix" != "xNONE"; then
1993     VORBIS_CFLAGS="-I$prefix/include"
1994   fi
1995
1996
1997   AC_MSG_CHECKING(for Vorbis)
1998   no_vorbis=""
1999
2000
2001   if test "x$enable_vorbistest" = "xyes" ; then
2002     ac_save_CFLAGS="$CFLAGS"
2003     ac_save_LIBS="$LIBS"
2004     CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
2005     LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
2006 dnl
2007 dnl Now check if the installed Vorbis is sufficiently new.
2008 dnl
2009       rm -f conf.vorbistest
2010       AC_TRY_RUN([
2011 #include <stdio.h>
2012 #include <stdlib.h>
2013 #include <string.h>
2014 #include <vorbis/codec.h>
2015
2016 int main ()
2017 {
2018   system("touch conf.vorbistest");
2019   return 0;
2020 }
2021
2022 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2023        CFLAGS="$ac_save_CFLAGS"
2024        LIBS="$ac_save_LIBS"
2025   fi
2026
2027   if test "x$no_vorbis" = "x" ; then
2028      AC_MSG_RESULT(yes)
2029      ifelse([$1], , :, [$1])     
2030   else
2031      AC_MSG_RESULT(no)
2032      if test -f conf.vorbistest ; then
2033        :
2034      else
2035        echo "*** Could not run Vorbis test program, checking why..."
2036        CFLAGS="$CFLAGS $VORBIS_CFLAGS"
2037        LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
2038        AC_TRY_LINK([
2039 #include <stdio.h>
2040 #include <vorbis/codec.h>
2041 ],     [ return 0; ],
2042        [ echo "*** The test program compiled, but did not run. This usually means"
2043        echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
2044        echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
2045        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2046        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2047        echo "*** is required on your system"
2048        echo "***"
2049        echo "*** If you have an old version installed, it is best to remove it, although"
2050        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2051        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2052        echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
2053        echo "*** or that you have moved Vorbis since it was installed." ])
2054        CFLAGS="$ac_save_CFLAGS"
2055        LIBS="$ac_save_LIBS"
2056      fi
2057      VORBIS_CFLAGS=""
2058      VORBIS_LIBS=""
2059      VORBISFILE_LIBS=""
2060      VORBISENC_LIBS=""
2061      ifelse([$2], , :, [$2])
2062   fi
2063   AC_SUBST(VORBIS_CFLAGS)
2064   AC_SUBST(VORBIS_LIBS)
2065   AC_SUBST(VORBISFILE_LIBS)
2066   AC_SUBST(VORBISENC_LIBS)
2067   rm -f conf.vorbistest
2068 ])
2069
2070 # Configure paths for libFLAC
2071 # "Inspired" by ogg.m4
2072
2073 dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2074 dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS
2075 dnl
2076 AC_DEFUN(AM_PATH_LIBFLAC,
2077 [dnl 
2078 dnl Get the cflags and libraries
2079 dnl
2080 AC_ARG_WITH(libFLAC,[  --with-libFLAC=PFX   Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="")
2081 AC_ARG_WITH(libFLAC-libraries,[  --with-libFLAC-libraries=DIR   Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="")
2082 AC_ARG_WITH(libFLAC-includes,[  --with-libFLAC-includes=DIR   Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="")
2083 AC_ARG_ENABLE(libFLACtest, [  --disable-libFLACtest       Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes)
2084
2085   if test "x$libFLAC_libraries" != "x" ; then
2086     LIBFLAC_LIBS="-L$libFLAC_libraries"
2087   elif test "x$libFLAC_prefix" != "x" ; then
2088     LIBFLAC_LIBS="-L$libFLAC_prefix/lib"
2089   elif test "x$prefix" != "xNONE" ; then
2090     LIBFLAC_LIBS="-L$prefix/lib"
2091   fi
2092
2093   LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm"
2094
2095   if test "x$libFLAC_includes" != "x" ; then
2096     LIBFLAC_CFLAGS="-I$libFLAC_includes"
2097   elif test "x$libFLAC_prefix" != "x" ; then
2098     LIBFLAC_CFLAGS="-I$libFLAC_prefix/include"
2099   elif test "$prefix" != "xNONE"; then
2100     LIBFLAC_CFLAGS="-I$prefix/include"
2101   fi
2102
2103   AC_MSG_CHECKING(for libFLAC)
2104   no_libFLAC=""
2105
2106
2107   if test "x$enable_libFLACtest" = "xyes" ; then
2108     ac_save_CFLAGS="$CFLAGS"
2109     ac_save_CXXFLAGS="$CXXFLAGS"
2110     ac_save_LIBS="$LIBS"
2111     CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
2112     CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
2113     LIBS="$LIBS $LIBFLAC_LIBS"
2114 dnl
2115 dnl Now check if the installed libFLAC is sufficiently new.
2116 dnl
2117       rm -f conf.libFLACtest
2118       AC_TRY_RUN([
2119 #include <stdio.h>
2120 #include <stdlib.h>
2121 #include <string.h>
2122 #include <FLAC/format.h>
2123
2124 int main ()
2125 {
2126   system("touch conf.libFLACtest");
2127   return 0;
2128 }
2129
2130 ],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2131        CFLAGS="$ac_save_CFLAGS"
2132        LIBS="$ac_save_LIBS"
2133   fi
2134
2135   if test "x$no_libFLAC" = "x" ; then
2136      AC_MSG_RESULT(yes)
2137      ifelse([$1], , :, [$1])     
2138   else
2139      AC_MSG_RESULT(no)
2140      if test -f conf.libFLACtest ; then
2141        :
2142      else
2143        echo "*** Could not run libFLAC test program, checking why..."
2144        CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
2145        LIBS="$LIBS $LIBFLAC_LIBS"
2146        AC_TRY_LINK([
2147 #include <stdio.h>
2148 #include <FLAC/format.h>
2149 ],     [ return 0; ],
2150        [ echo "*** The test program compiled, but did not run. This usually means"
2151        echo "*** that the run-time linker is not finding libFLAC or finding the wrong"
2152        echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your"
2153        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2154        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2155        echo "*** is required on your system"
2156        echo "***"
2157        echo "*** If you have an old version installed, it is best to remove it, although"
2158        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2159        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2160        echo "*** exact error that occured. This usually means libFLAC was incorrectly installed"
2161        echo "*** or that you have moved libFLAC since it was installed. In the latter case, you"
2162        echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ])
2163        CFLAGS="$ac_save_CFLAGS"
2164        LIBS="$ac_save_LIBS"
2165      fi
2166      LIBFLAC_CFLAGS=""
2167      LIBFLAC_LIBS=""
2168      ifelse([$2], , :, [$2])
2169   fi
2170   AC_SUBST(LIBFLAC_CFLAGS)
2171   AC_SUBST(LIBFLAC_LIBS)
2172   rm -f conf.libFLACtest
2173 ])
2174
2175 # Configure paths for libOggFLAC
2176 # "Inspired" by ogg.m4
2177
2178 dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2179 dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS
2180 dnl
2181 AC_DEFUN(AM_PATH_LIBOGGFLAC,
2182 [dnl 
2183 dnl Get the cflags and libraries
2184 dnl
2185 AC_ARG_WITH(libOggFLAC,[  --with-libOggFLAC=PFX   Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="")
2186 AC_ARG_WITH(libOggFLAC-libraries,[  --with-libOggFLAC-libraries=DIR   Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="")
2187 AC_ARG_WITH(libOggFLAC-includes,[  --with-libOggFLAC-includes=DIR   Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="")
2188 AC_ARG_ENABLE(libOggFLACtest, [  --disable-libOggFLACtest       Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes)
2189
2190   if test "x$libOggFLAC_libraries" != "x" ; then
2191     LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries"
2192   elif test "x$libOggFLAC_prefix" != "x" ; then
2193     LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib"
2194   elif test "x$prefix" != "xNONE" ; then
2195     LIBOGGFLAC_LIBS="-L$prefix/lib"
2196   fi
2197
2198   LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm"
2199
2200   if test "x$libOggFLAC_includes" != "x" ; then
2201     LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes"
2202   elif test "x$libOggFLAC_prefix" != "x" ; then
2203     LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include"
2204   elif test "$prefix" != "xNONE"; then
2205     LIBOGGFLAC_CFLAGS="-I$prefix/include"
2206   fi
2207
2208   AC_MSG_CHECKING(for libOggFLAC)
2209   no_libOggFLAC=""
2210
2211
2212   if test "x$enable_libOggFLACtest" = "xyes" ; then
2213     ac_save_CFLAGS="$CFLAGS"
2214     ac_save_CXXFLAGS="$CXXFLAGS"
2215     ac_save_LIBS="$LIBS"
2216     CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2217     CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS"
2218     LIBS="$LIBS $LIBOGGFLAC_LIBS"
2219 dnl
2220 dnl Now check if the installed libOggFLAC is sufficiently new.
2221 dnl
2222       rm -f conf.libOggFLACtest
2223       AC_TRY_RUN([
2224 #include <stdio.h>
2225 #include <stdlib.h>
2226 #include <string.h>
2227 #include <OggFLAC/stream_decoder.h>
2228
2229 int main ()
2230 {
2231   system("touch conf.libOggFLACtest");
2232   return 0;
2233 }
2234
2235 ],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2236        CFLAGS="$ac_save_CFLAGS"
2237        LIBS="$ac_save_LIBS"
2238   fi
2239
2240   if test "x$no_libOggFLAC" = "x" ; then
2241      AC_MSG_RESULT(yes)
2242      ifelse([$1], , :, [$1])     
2243   else
2244      AC_MSG_RESULT(no)
2245      if test -f conf.libOggFLACtest ; then
2246        :
2247      else
2248        echo "*** Could not run libOggFLAC test program, checking why..."
2249        CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2250        LIBS="$LIBS $LIBOGGFLAC_LIBS"
2251        AC_TRY_LINK([
2252 #include <stdio.h>
2253 #include <OggFLAC/stream_decoder.h>
2254 ],     [ return 0; ],
2255        [ echo "*** The test program compiled, but did not run. This usually means"
2256        echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong"
2257        echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your"
2258        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2259        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2260        echo "*** is required on your system"
2261        echo "***"
2262        echo "*** If you have an old version installed, it is best to remove it, although"
2263        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2264        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2265        echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed"
2266        echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you"
2267        echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ])
2268        CFLAGS="$ac_save_CFLAGS"
2269        LIBS="$ac_save_LIBS"
2270      fi
2271      LIBOGGFLAC_CFLAGS=""
2272      LIBOGGFLAC_LIBS=""
2273      ifelse([$2], , :, [$2])
2274   fi
2275   AC_SUBST(LIBOGGFLAC_CFLAGS)
2276   AC_SUBST(LIBOGGFLAC_LIBS)
2277   rm -f conf.libOggFLACtest
2278 ])
2279
2280 # Configure paths for GTK+
2281 # Owen Taylor     97-11-3
2282
2283 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2284 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2285 dnl
2286 AC_DEFUN(AM_PATH_GTK,
2287 [dnl 
2288 dnl Get the cflags and libraries from the gtk-config script
2289 dnl
2290 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
2291             gtk_config_prefix="$withval", gtk_config_prefix="")
2292 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
2293             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
2294 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
2295                     , enable_gtktest=yes)
2296
2297   for module in . $4
2298   do
2299       case "$module" in
2300          gthread) 
2301              gtk_config_args="$gtk_config_args gthread"
2302          ;;
2303       esac
2304   done
2305
2306   if test x$gtk_config_exec_prefix != x ; then
2307      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2308      if test x${GTK_CONFIG+set} != xset ; then
2309         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2310      fi
2311   fi
2312   if test x$gtk_config_prefix != x ; then
2313      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2314      if test x${GTK_CONFIG+set} != xset ; then
2315         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2316      fi
2317   fi
2318
2319   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2320   min_gtk_version=ifelse([$1], ,0.99.7,$1)
2321   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2322   no_gtk=""
2323   if test "$GTK_CONFIG" = "no" ; then
2324     no_gtk=yes
2325   else
2326     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2327     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2328     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2329            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2330     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2331            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2332     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2333            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2334     if test "x$enable_gtktest" = "xyes" ; then
2335       ac_save_CFLAGS="$CFLAGS"
2336       ac_save_LIBS="$LIBS"
2337       CFLAGS="$CFLAGS $GTK_CFLAGS"
2338       LIBS="$GTK_LIBS $LIBS"
2339 dnl
2340 dnl Now check if the installed GTK is sufficiently new. (Also sanity
2341 dnl checks the results of gtk-config to some extent
2342 dnl
2343       rm -f conf.gtktest
2344       AC_TRY_RUN([
2345 #include <gtk/gtk.h>
2346 #include <stdio.h>
2347 #include <stdlib.h>
2348
2349 int 
2350 main ()
2351 {
2352   int major, minor, micro;
2353   char *tmp_version;
2354
2355   system ("touch conf.gtktest");
2356
2357   /* HP/UX 9 (%@#!) writes to sscanf strings */
2358   tmp_version = g_strdup("$min_gtk_version");
2359   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2360      printf("%s, bad version string\n", "$min_gtk_version");
2361      exit(1);
2362    }
2363
2364   if ((gtk_major_version != $gtk_config_major_version) ||
2365       (gtk_minor_version != $gtk_config_minor_version) ||
2366       (gtk_micro_version != $gtk_config_micro_version))
2367     {
2368       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
2369              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2370              gtk_major_version, gtk_minor_version, gtk_micro_version);
2371       printf ("*** was found! If gtk-config was correct, then it is best\n");
2372       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2373       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2374       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2375       printf("*** required on your system.\n");
2376       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2377       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2378       printf("*** before re-running configure\n");
2379     } 
2380 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2381   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2382            (gtk_minor_version != GTK_MINOR_VERSION) ||
2383            (gtk_micro_version != GTK_MICRO_VERSION))
2384     {
2385       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2386              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2387       printf("*** library (version %d.%d.%d)\n",
2388              gtk_major_version, gtk_minor_version, gtk_micro_version);
2389     }
2390 #endif /* defined (GTK_MAJOR_VERSION) ... */
2391   else
2392     {
2393       if ((gtk_major_version > major) ||
2394         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2395         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2396       {
2397         return 0;
2398        }
2399      else
2400       {
2401         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2402                gtk_major_version, gtk_minor_version, gtk_micro_version);
2403         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2404                major, minor, micro);
2405         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2406         printf("***\n");
2407         printf("*** If you have already installed a sufficiently new version, this error\n");
2408         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2409         printf("*** being found. The easiest way to fix this is to remove the old version\n");
2410         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2411         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2412         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2413         printf("*** so that the correct libraries are found at run-time))\n");
2414       }
2415     }
2416   return 1;
2417 }
2418 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2419        CFLAGS="$ac_save_CFLAGS"
2420        LIBS="$ac_save_LIBS"
2421      fi
2422   fi
2423   if test "x$no_gtk" = x ; then
2424      AC_MSG_RESULT(yes)
2425      ifelse([$2], , :, [$2])     
2426   else
2427      AC_MSG_RESULT(no)
2428      if test "$GTK_CONFIG" = "no" ; then
2429        echo "*** The gtk-config script installed by GTK could not be found"
2430        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2431        echo "*** your path, or set the GTK_CONFIG environment variable to the"
2432        echo "*** full path to gtk-config."
2433      else
2434        if test -f conf.gtktest ; then
2435         :
2436        else
2437           echo "*** Could not run GTK test program, checking why..."
2438           CFLAGS="$CFLAGS $GTK_CFLAGS"
2439           LIBS="$LIBS $GTK_LIBS"
2440           AC_TRY_LINK([
2441 #include <gtk/gtk.h>
2442 #include <stdio.h>
2443 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2444         [ echo "*** The test program compiled, but did not run. This usually means"
2445           echo "*** that the run-time linker is not finding GTK or finding the wrong"
2446           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2447           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2448           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2449           echo "*** is required on your system"
2450           echo "***"
2451           echo "*** If you have an old version installed, it is best to remove it, although"
2452           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2453           echo "***"
2454           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2455           echo "*** came with the system with the command"
2456           echo "***"
2457           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
2458         [ echo "*** The test program failed to compile or link. See the file config.log for the"
2459           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2460           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2461           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2462           CFLAGS="$ac_save_CFLAGS"
2463           LIBS="$ac_save_LIBS"
2464        fi
2465      fi
2466      GTK_CFLAGS=""
2467      GTK_LIBS=""
2468      ifelse([$3], , :, [$3])
2469   fi
2470   AC_SUBST(GTK_CFLAGS)
2471   AC_SUBST(GTK_LIBS)
2472   rm -f conf.gtktest
2473 ])
2474