1# generated automatically by aclocal 1.7.6 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14# Do all the work for Automake.                            -*- Autoconf -*-
15
16# This macro actually does too much some checks are only needed if
17# your package does certain things.  But this isn't really a big deal.
18
19# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
20# Free Software Foundation, Inc.
21
22# This program is free software; you can redistribute it and/or modify
23# it under the terms of the GNU General Public License as published by
24# the Free Software Foundation; either version 2, or (at your option)
25# any later version.
26
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30# GNU General Public License for more details.
31
32# You should have received a copy of the GNU General Public License
33# along with this program; if not, write to the Free Software
34# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35# 02111-1307, USA.
36
37# serial 10
38
39AC_PREREQ([2.54])
40
41# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
42# the ones we care about.
43m4_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.
56AC_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
60if 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])
63fi
64
65# test whether we have cygpath
66if 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
72fi
73AC_SUBST([CYGPATH_W])
74
75# Define the identity of the package.
76dnl Distinguish between old-style and new-style calls.
77m4_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.
90AC_REQUIRE([AM_SANITY_CHECK])dnl
91AC_REQUIRE([AC_ARG_PROGRAM])dnl
92AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
93AM_MISSING_PROG(AUTOCONF, autoconf)
94AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
95AM_MISSING_PROG(AUTOHEADER, autoheader)
96AM_MISSING_PROG(MAKEINFO, makeinfo)
97AM_MISSING_PROG(AMTAR, tar)
98AM_PROG_INSTALL_SH
99AM_PROG_INSTALL_STRIP
100# We need awk for the "check" target.  The system "awk" is bad on
101# some platforms.
102AC_REQUIRE([AC_PROG_AWK])dnl
103AC_REQUIRE([AC_PROG_MAKE_SET])dnl
104AC_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
111AC_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.
126AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
127[# Compute $1's index in $config_headers.
128_am_stamp_count=1
129for _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
136done
137echo "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.
159AC_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.
165AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
166	 [AM_AUTOMAKE_VERSION([1.7.6])])
167
168# Helper functions for option handling.                    -*- Autoconf -*-
169
170# Copyright 2001, 2002  Free Software Foundation, Inc.
171
172# This program is free software; you can redistribute it and/or modify
173# it under the terms of the GNU General Public License as published by
174# the Free Software Foundation; either version 2, or (at your option)
175# any later version.
176
177# This program is distributed in the hope that it will be useful,
178# but WITHOUT ANY WARRANTY; without even the implied warranty of
179# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
180# GNU General Public License for more details.
181
182# You should have received a copy of the GNU General Public License
183# along with this program; if not, write to the Free Software
184# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
185# 02111-1307, USA.
186
187# serial 2
188
189# _AM_MANGLE_OPTION(NAME)
190# -----------------------
191AC_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.
197AC_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.
203AC_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.
209AC_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# ---------------
237AC_DEFUN([AM_SANITY_CHECK],
238[AC_MSG_CHECKING([whether build environment is sane])
239# Just in case
240sleep 1
241echo 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).
247if (
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
262alias in your environment])
263   fi
264
265   test "$[2]" = conftest.file
266   )
267then
268   # Ok.
269   :
270else
271   AC_MSG_ERROR([newly created file is older than distributed files!
272Check your system clock])
273fi
274AC_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# ------------------------------
300AC_DEFUN([AM_MISSING_PROG],
301[AC_REQUIRE([AM_MISSING_HAS_RUN])
302$1=${$1-"${am_missing_run}$2"}
303AC_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.
310AC_DEFUN([AM_MISSING_HAS_RUN],
311[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
312test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
313# Use eval to expand $SHELL
314if eval "$MISSING --run true"; then
315  am_missing_run="$MISSING --run "
316else
317  am_missing_run=
318  AC_MSG_WARN([`missing' script is too old or missing])
319fi
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.
380AC_PREREQ([2.50])
381
382AC_DEFUN([AM_AUX_DIR_EXPAND], [
383# expand $ac_aux_dir to an absolute path
384am_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
408AC_DEFUN([AM_PROG_INSTALL_SH],
409[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
410install_sh=${install_sh-"$am_aux_dir/install-sh"}
411AC_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).
439AC_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.
445dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
446if test "$cross_compiling" != no; then
447  AC_CHECK_TOOL([STRIP], [strip], :)
448fi
449INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
450AC_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.
474AC_DEFUN([AM_SET_LEADING_DOT],
475[rm -rf .tst 2>/dev/null
476mkdir .tst 2>/dev/null
477if test -d .tst; then
478  am__leading_dot=.
479else
480  am__leading_dot=_
481fi
482rmdir .tst 2>/dev/null
483AC_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.
523AC_DEFUN([_AM_DEPENDENCIES],
524[AC_REQUIRE([AM_SET_DEPDIR])dnl
525AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
526AC_REQUIRE([AM_MAKE_INCLUDE])dnl
527AC_REQUIRE([AM_DEP_TRACK])dnl
528
529ifelse([$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
535AC_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
610else
611  am_cv_$1_dependencies_compiler_type=none
612fi
613])
614AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
615AM_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
625AC_DEFUN([AM_SET_DEPDIR],
626[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
627AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
628])
629
630
631# AM_DEP_TRACK
632# ------------
633AC_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])
637if test "x$enable_dependency_tracking" != xno; then
638  am_depcomp="$ac_aux_dir/depcomp"
639  AMDEPBACKSLASH='\'
640fi
641AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
642AC_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# ------------------------------
668AC_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
712done
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.
723AC_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.
753AC_DEFUN([AM_MAKE_INCLUDE],
754[am_make=${MAKE-make}
755cat > confinc << 'END'
756am__doit:
757	@echo done
758.PHONY: am__doit
759END
760# If we don't find an include directive, just comment out the code.
761AC_MSG_CHECKING([for style of include used by $am_make])
762am__include="#"
763am__quote=
764_am_result=none
765# First try GNU make style include.
766echo "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'.
772if 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
776fi
777# Now try BSD make style include.
778if 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
785fi
786AC_SUBST([am__include])
787AC_SUBST([am__quote])
788AC_MSG_RESULT([$_am_result])
789rm -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
813AC_PREREQ(2.52)
814
815# AM_CONDITIONAL(NAME, SHELL-CONDITION)
816# -------------------------------------
817# Define a conditional.
818AC_DEFUN([AM_CONDITIONAL],
819[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
820        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
821AC_SUBST([$1_TRUE])
822AC_SUBST([$1_FALSE])
823if $2; then
824  $1_TRUE=
825  $1_FALSE='#'
826else
827  $1_TRUE='#'
828  $1_FALSE=
829fi
830AC_CONFIG_COMMANDS_PRE(
831[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
832  AC_MSG_ERROR([conditional "$1" was never defined.
833Usually this means the macro was only invoked conditionally.])
834fi])])
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
858AC_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
873AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
874
875dnl TiMidity++ -- MIDI to WAVE converter and player
876dnl Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
877dnl Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
878dnl
879dnl This program is free software; you can redistribute it and/or modify
880dnl it under the terms of the GNU General Public License as published by
881dnl the Free Software Foundation; either version 2 of the License, or
882dnl (at your option) any later version.
883dnl
884dnl This program is distributed in the hope that it will be useful,
885dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
886dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
887dnl GNU General Public License for more details.
888dnl
889dnl You should have received a copy of the GNU General Public License
890dnl along with this program; if not, write to the Free Software
891dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
892
893dnl MY_DEFINE(VARIABLE)
894AC_DEFUN([MY_DEFINE],
895[cat >> confdefs.h <<EOF
896[#define] $1 1
897EOF
898])
899
900dnl CONFIG_INTERFACE(package,macro_name,interface_id,help
901dnl                  $1      $2         $3           $4
902dnl                  action-if-yes-or-dynamic,
903dnl		     $5
904dnl		     action-if-yes,action-if-dynamic,action-if-no)
905dnl		     $6            $7                $8
906AC_DEFUN([CONFIG_INTERFACE],
907[AC_ARG_ENABLE($1,[$4],
908[case "x$enable_$1" in xyes|xdynamic) $5 ;; esac])
909case "x$enable_$1" in
910xyes)
911  MY_DEFINE(IA_$2)
912  AM_CONDITIONAL(ENABLE_$2, true)
913  $6
914  ;;
915xdynamic)
916  dynamic_targets="$dynamic_targets if_$1.\$(so)"
917  $7
918  ;;
919*)
920  $8
921  ;;
922esac
923AC_SUBST($3_so_libs)
924])
925
926dnl CHECK_DLSYM_UNDERSCORE([ACTION-IF-NEED [, ACTION IF-NOT-NEED]])
927dnl variable input:
928dnl   CC CFLAGS CPPFLAGS LDFLAGS LIBS SHCFLAGS SHLD SHLDFLAGS
929dnl   ac_cv_header_dlfcn_h lib_dl_opt so
930AC_DEFUN([CHECK_DLSYM_UNDERSCORE],
931[dnl Check if dlsym need a leading underscore
932AC_MSG_CHECKING([whether your dlsym() needs a leading underscore])
933AC_CACHE_VAL(timidity_cv_func_dlsym_underscore,
934[case "$ac_cv_header_dlfcn_h" in
935yes) i_dlfcn=define;;
936*)   i_dlfcn=undef;;
937esac
938cat > dyna.c <<EOM
939fred () { }
940EOM
941
942cat > 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
953extern int fred() ;
954
955main()
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}
986EOM
987: Call the object file tmp-dyna.o in case dlext=o.
988if ${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
1003else
1004	AC_MSG_WARN(I can't compile and run the test program.)
1005fi
1006rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred
1007])
1008case "x$timidity_cv_func_dlsym_underscore" in
1009xyes)	[$1]
1010	AC_MSG_RESULT(yes)
1011	;;
1012xno)	[$2]
1013	AC_MSG_RESULT(no)
1014	;;
1015esac
1016])
1017
1018
1019dnl contains program from perl5
1020dnl CONTAINS_INIT()
1021AC_DEFUN([CONTAINS_INIT],
1022[dnl Some greps do not return status, grrr.
1023AC_MSG_CHECKING([whether grep returns status])
1024echo "grimblepritz" >grimble
1025if grep blurfldyick grimble >/dev/null 2>&1 ; then
1026	contains="./contains"
1027elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1028	contains=grep
1029else
1030	contains="./contains"
1031fi
1032rm -f grimble
1033dnl the following should work in any shell
1034case "$contains" in
1035grep)	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'
1040grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp
1041EOSS
1042	chmod +x "./contains"
1043	;;
1044esac
1045])
1046
1047dnl CONTAINS(word,filename,action-if-found,action-if-not-found)
1048AC_DEFUN([CONTAINS],
1049[if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then
1050  [$3]
1051else
1052  [$4]
1053fi
1054])
1055
1056dnl SET_UNIQ_WORDS(shell-variable,words...)
1057AC_DEFUN([SET_UNIQ_WORDS],
1058[rm -f wordtmp >/dev/null 2>&1
1059val=''
1060for f in $2; do
1061  CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"])
1062done
1063$1="$val"
1064rm -f wordtmp >/dev/null 2>&1
1065])
1066
1067
1068dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY,
1069		    [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]])
1070AC_DEFUN([WAPI_CHECK_FUNC],
1071[AC_MSG_CHECKING(for $1)
1072AC_CACHE_VAL(wapi_cv_func_$1,
1073[AC_TRY_LINK([#include <windows.h>
1074$2
1075], [$3],
1076wapi_cv_func_$1=yes, wapi_cv_func_$1=no)])
1077if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then
1078  AC_MSG_RESULT(yes)
1079  ifelse([$4], , :, [$4])
1080else
1081  AC_MSG_RESULT(no)
1082ifelse([$5], , , [$5
1083])dnl
1084fi
1085])
1086
1087dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION,
1088dnl		INCLUDES, TEST-BODY
1089dnl		[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
1090dnl		[, OTHER-LIBRARIES]]])
1091AC_DEFUN([WAPI_CHECK_LIB],
1092[AC_MSG_CHECKING([for $2 in -l$1])
1093ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
1094AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var,
1095[ac_save_LIBS="$LIBS"
1096LIBS="-l$1 $7 $LIBS"
1097AC_TRY_LINK([#include <windows.h>
1098$3
1099], [$4],
1100eval "wapi_cv_lib_$ac_lib_var=yes",
1101eval "wapi_cv_lib_$ac_lib_var=no")
1102LIBS="$ac_save_LIBS"
1103])dnl
1104if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then
1105  AC_MSG_RESULT(yes)
1106  ifelse([$5], ,LIBS="-l$1 $LIBS", [$5])
1107else
1108  AC_MSG_RESULT(no)
1109ifelse([$6], , , [$6
1110])dnl
1111fi
1112])
1113
1114dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS)
1115AC_DEFUN([EXTRACT_CPPFLAGS],
1116[for f in $3; do
1117    case ".$f" in
1118	.-I?*|.-D?*)	$1="[$]$1 $f" ;;
1119	*)		$2="[$]$2 $f" ;;
1120    esac
1121done
1122])
1123
1124
1125dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCEED [, ACTION-IF-FAILED]])
1126AC_DEFUN([CHECK_COMPILER_OPTION],
1127[AC_MSG_CHECKING([whether -$1 option is recognized])
1128ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'`
1129AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption,
1130[cat > conftest.$ac_ext <<EOF
1131int main() {return 0;}
1132EOF
1133if ${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
1139else
1140    eval "timidity_cv_ccoption_$ac_ccoption=no"
1141fi
1142])
1143if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then
1144  AC_MSG_RESULT(yes)
1145  ifelse([$2], , , [$2
1146])
1147else
1148  AC_MSG_RESULT(no)
1149ifelse([$3], , , [$3
1150])
1151fi
1152])
1153
1154
1155dnl MY_SEARCH_LIBS(FUNCTION, LIBRARIES [, ACTION-IF-FOUND
1156dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1157dnl Search for a library defining FUNC, if it's not already available.
1158
1159AC_DEFUN([MY_SEARCH_LIBS],
1160[AC_CACHE_CHECK([for library containing $1], [timidity_cv_search_$1],
1161[ac_func_search_save_LIBS="$LIBS"
1162timidity_cv_search_$1="no"
1163for 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])
1166done
1167LIBS="$ac_func_search_save_LIBS"])
1168if test "$timidity_cv_search_$1" != "no"; then
1169  $3
1170else :
1171  $4
1172fi])
1173
1174
1175# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1176#   Free Software Foundation, Inc.
1177
1178# This program is free software; you can redistribute it and/or modify
1179# it under the terms of the GNU General Public License as published by
1180# the Free Software Foundation; either version 2, or (at your option)
1181# any later version.
1182
1183# This program is distributed in the hope that it will be useful,
1184# but WITHOUT ANY WARRANTY; without even the implied warranty of
1185# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1186# GNU General Public License for more details.
1187
1188# You should have received a copy of the GNU General Public License
1189# along with this program; if not, write to the Free Software
1190# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1191# 02111-1307, USA.
1192
1193# serial 7
1194
1195# AM_PATH_LISPDIR
1196# ---------------
1197AC_DEFUN([AM_PATH_LISPDIR],
1198[AC_ARG_WITH(lispdir,
1199 [  --with-lispdir          Override the default lisp directory ],
1200 [ lispdir="$withval"
1201   AC_MSG_CHECKING([where .elc files should go])
1202   AC_MSG_RESULT([$lispdir])],
1203 [
1204 # If set to t, that means we are running in a shell under Emacs.
1205 # If you have an Emacs named "t", then use the full path.
1206 test x"$EMACS" = xt && EMACS=
1207 AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1208 if test $EMACS != "no"; then
1209   if test x${lispdir+set} != xset; then
1210     AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir],
1211       [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly
1212  # Some emacsen will start up in interactive mode, requiring C-x C-c to exit,
1213  #  which is non-obvious for non-emacs users.
1214  # Redirecting /dev/null should help a bit; pity we can't detect "broken"
1215  #  emacsen earlier and avoid running this altogether.
1216  AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' </dev/null >conftest.out])
1217        am_cv_lispdir=`sed -n \
1218       -e 's,/$,,' \
1219       -e '/.*\/lib\/x\?emacs\/site-lisp$/{s,.*/lib/\(x\?emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
1220       -e '/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}' \
1221       conftest.out`
1222       rm conftest.out
1223       if test -z "$am_cv_lispdir"; then
1224         am_cv_lispdir='${datadir}/emacs/site-lisp'
1225       fi
1226     ])
1227     lispdir="$am_cv_lispdir"
1228   fi
1229 fi
1230])
1231AC_SUBST(lispdir)
1232])# AM_PATH_LISPDIR
1233
1234AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR])
1235
1236dnl Configure Paths for Alsa
1237dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
1238dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
1239dnl Jaroslav Kysela <perex@suse.cz>
1240dnl Modified for TiMidity++ by URABE, Shyouhei <root@mput.dip.jp>
1241dnl Original    : alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp
1242dnl This version: alsa.m4,       2002/10/08 22:30:18 JST
1243dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1244dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
1245dnl enables arguments --with-alsa-prefix=
1246dnl                   --with-alsa-enc-prefix=
1247dnl                   --disable-alsatest  (this has no effect, as yet)
1248dnl
1249dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
1250dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
1251dnl
1252AC_DEFUN([AM_PATH_ALSA],
1253[dnl Save the original CFLAGS, LDFLAGS, and LIBS
1254alsa_save_CFLAGS="$CFLAGS"
1255alsa_save_LDFLAGS="$LDFLAGS"
1256alsa_save_LIBS="$LIBS"
1257alsa_found=yes
1258
1259dnl
1260dnl Get the cflags and libraries for alsa
1261dnl
1262AC_ARG_WITH(alsa-prefix,
1263	    AS_HELP_STRING([--with-alsa-prefix=PFX],
1264	    		   [Prefix where Alsa library is installed(optional)]),
1265	    [alsa_prefix="$withval"], [alsa_prefix=""])
1266
1267AC_ARG_WITH(alsa-inc-prefix,
1268	    AS_HELP_STRING([--with-alsa-inc-prefix=PFX],
1269	    		   [Prefix where include libraries are (optional)]),
1270	    [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
1271
1272dnl FIXME: this is not yet implemented
1273AC_ARG_ENABLE(alsatest,
1274	      AS_HELP_STRING([--disable-alsatest],
1275	      		     [Do not try to compile and run a test Alsa program]),
1276	      [enable_alsatest=no], [enable_alsatest=yes])
1277
1278dnl Add any special include directories
1279AC_MSG_CHECKING(for ALSA CFLAGS)
1280if test "$alsa_inc_prefix" != "" ; then
1281	ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
1282	CFLAGS="$CFLAGS -I$alsa_inc_prefix"
1283fi
1284AC_MSG_RESULT($ALSA_CFLAGS)
1285
1286dnl add any special lib dirs
1287AC_MSG_CHECKING(for ALSA LDFLAGS)
1288if test "$alsa_prefix" != "" ; then
1289	ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
1290	LDFLAGS="$LDFLAGS $ALSA_LIBS"
1291fi
1292
1293dnl add the alsa library
1294ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
1295LIBS=`echo $LIBS | sed 's/-lm//'`
1296LIBS=`echo $LIBS | sed 's/-ldl//'`
1297LIBS=`echo $LIBS | sed 's/-lpthread//'`
1298LIBS=`echo $LIBS | sed 's/  //'`
1299LIBS="$ALSA_LIBS $LIBS"
1300AC_MSG_RESULT($ALSA_LIBS)
1301
1302dnl Check for a working version of libasound that is of the right version.
1303min_alsa_version=ifelse([$1], ,0.1.1,$1)
1304AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
1305no_alsa=""
1306    alsa_min_major_version=`echo $min_alsa_version | \
1307           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1308    alsa_min_minor_version=`echo $min_alsa_version | \
1309           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1310    alsa_min_micro_version=`echo $min_alsa_version | \
1311           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1312
1313dnl This is the test program.
1314AC_DEFUN([MPUT_ALSA_TRY],[
1315/* ensure backward compatibility */
1316#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
1317#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
1318#endif
1319#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
1320#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
1321#endif
1322#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
1323#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
1324#endif
1325
1326#  if(SND_LIB_MAJOR > $alsa_min_major_version)
1327  exit(0);
1328#  else
1329#    if(SND_LIB_MAJOR < $alsa_min_major_version)
1330#       error not present
1331#    endif
1332
1333#   if(SND_LIB_MINOR > $alsa_min_minor_version)
1334  exit(0);
1335#   else
1336#     if(SND_LIB_MINOR < $alsa_min_minor_version)
1337#          error not present
1338#      endif
1339
1340#      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
1341#        error not present
1342#      endif
1343#    endif
1344#  endif
1345exit(0);
1346])dnl macro MPUT_ALSA_TRY
1347
1348AC_LANG_SAVE
1349AC_LANG_C
1350AC_TRY_COMPILE([
1351#include <alsa/asoundlib.h>
1352],
1353  MPUT_ALSA_TRY(),
1354  [AC_MSG_RESULT(found.)],
1355  [AC_TRY_COMPILE([
1356#include <sys/asoundlib.h>
1357],
1358  MPUT_ALSA_TRY(),
1359  [AC_MSG_RESULT(found.)],
1360  [AC_MSG_RESULT(not present.)
1361   ifelse([$3], ,[AC_MSG_RESULT(libasound was not found anywhere.)])
1362   alsa_found=no])
1363   ifelse([$3], ,[AC_MSG_RESULT(Sufficiently new version of libasound not found.)])
1364])
1365AC_LANG_RESTORE
1366
1367dnl Now that we know we have the right version, why not see if we
1368dnl have the library and not just the headers.
1369AC_CHECK_LIB([asound],[snd_ctl_open], ,
1370  [ifelse([$3], ,[AC_MSG_RESULT(No linkable libasound was found.)])
1371   alsa_found=no
1372])
1373
1374if test "x$alsa_found" = "xyes" ; then
1375   ifelse([$2], , :, [$2])
1376   LIBS=`echo $LIBS | sed 's/-lasound//g'`
1377   LIBS=`echo $LIBS | sed 's/  //'`
1378   LIBS="-lasound $LIBS"
1379else
1380   ifelse([$3], , :, [$3])
1381   CFLAGS="$alsa_save_CFLAGS"
1382   LDFLAGS="$alsa_save_LDFLAGS"
1383   LIBS="$alsa_save_LIBS"
1384   ALSA_CFLAGS=""
1385   ALSA_LIBS=""
1386fi
1387
1388dnl That should be it.  Now just export out symbols:
1389AC_SUBST(ALSA_CFLAGS)
1390AC_SUBST(ALSA_LIBS)
1391])
1392
1393# Configure paths for ESD
1394# Manish Singh    98-9-30
1395# stolen back from Frank Belew
1396# stolen from Manish Singh
1397# Shamelessly stolen from Owen Taylor
1398
1399dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1400dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
1401dnl
1402AC_DEFUN([AM_PATH_ESD],
1403[dnl
1404dnl Get the cflags and libraries from the esd-config script
1405dnl
1406AC_ARG_WITH(esd-prefix,
1407	    AS_HELP_STRING([--with-esd-prefix=PFX],
1408	    		   [Prefix where ESD is installed (optional)]),
1409            [esd_prefix="$withval"], [esd_prefix=""])
1410AC_ARG_WITH(esd-exec-prefix,
1411	    AS_HELP_STRING([--with-esd-exec-prefix=PFX],
1412	    		   [Exec prefix where ESD is installed (optional)]),
1413            [esd_exec_prefix="$withval"], [esd_exec_prefix=""])
1414AC_ARG_ENABLE(esdtest,
1415	      AS_HELP_STRING([--disable-esdtest],
1416	      		     [Do not try to compile and run a test ESD program]),
1417		    , [enable_esdtest=yes])
1418
1419  if test x$esd_exec_prefix != x ; then
1420     esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
1421     if test x${ESD_CONFIG+set} != xset ; then
1422        ESD_CONFIG=$esd_exec_prefix/bin/esd-config
1423     fi
1424  fi
1425  if test x$esd_prefix != x ; then
1426     esd_args="$esd_args --prefix=$esd_prefix"
1427     if test x${ESD_CONFIG+set} != xset ; then
1428        ESD_CONFIG=$esd_prefix/bin/esd-config
1429     fi
1430  fi
1431
1432  AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1433  min_esd_version=ifelse([$1], ,0.2.7,$1)
1434  AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
1435  no_esd=""
1436  if test "$ESD_CONFIG" = "no" ; then
1437    no_esd=yes
1438  else
1439    AC_LANG_SAVE
1440    AC_LANG_C
1441    ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
1442    ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
1443
1444    esd_major_version=`$ESD_CONFIG $esd_args --version | \
1445           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1446    esd_minor_version=`$ESD_CONFIG $esd_args --version | \
1447           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1448    esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
1449           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1450    if test "x$enable_esdtest" = "xyes" ; then
1451      ac_save_CFLAGS="$CFLAGS"
1452      ac_save_LIBS="$LIBS"
1453      CFLAGS="$CFLAGS $ESD_CFLAGS"
1454      LIBS="$LIBS $ESD_LIBS"
1455dnl
1456dnl Now check if the installed ESD is sufficiently new. (Also sanity
1457dnl checks the results of esd-config to some extent
1458dnl
1459      rm -f conf.esdtest
1460      AC_TRY_RUN([
1461#include <stdio.h>
1462#include <stdlib.h>
1463#include <string.h>
1464#include <esd.h>
1465
1466char*
1467my_strdup (char *str)
1468{
1469  char *new_str;
1470
1471  if (str)
1472    {
1473      new_str = malloc ((strlen (str) + 1) * sizeof(char));
1474      strcpy (new_str, str);
1475    }
1476  else
1477    new_str = NULL;
1478
1479  return new_str;
1480}
1481
1482int main ()
1483{
1484  int major, minor, micro;
1485  char *tmp_version;
1486
1487  system ("touch conf.esdtest");
1488
1489  /* HP/UX 9 (%@#!) writes to sscanf strings */
1490  tmp_version = my_strdup("$min_esd_version");
1491  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1492     printf("%s, bad version string\n", "$min_esd_version");
1493     exit(1);
1494   }
1495
1496   if (($esd_major_version > major) ||
1497      (($esd_major_version == major) && ($esd_minor_version > minor)) ||
1498      (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
1499    {
1500      return 0;
1501    }
1502  else
1503    {
1504      printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
1505      printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
1506      printf("*** best to upgrade to the required version.\n");
1507      printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
1508      printf("*** to point to the correct copy of esd-config, and remove the file\n");
1509      printf("*** config.cache before re-running configure\n");
1510      return 1;
1511    }
1512}
1513
1514],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1515       CFLAGS="$ac_save_CFLAGS"
1516       LIBS="$ac_save_LIBS"
1517       AC_LANG_RESTORE
1518     fi
1519  fi
1520  if test "x$no_esd" = x ; then
1521     AC_MSG_RESULT(yes)
1522     ifelse([$2], , :, [$2])
1523  else
1524     AC_MSG_RESULT(no)
1525     if test "$ESD_CONFIG" = "no" ; then
1526       echo "*** The esd-config script installed by ESD could not be found"
1527       echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
1528       echo "*** your path, or set the ESD_CONFIG environment variable to the"
1529       echo "*** full path to esd-config."
1530     else
1531       if test -f conf.esdtest ; then
1532        :
1533       else
1534          echo "*** Could not run ESD test program, checking why..."
1535          CFLAGS="$CFLAGS $ESD_CFLAGS"
1536          LIBS="$LIBS $ESD_LIBS"
1537          AC_LANG_SAVE
1538          AC_LANG_C
1539          AC_TRY_LINK([
1540#include <stdio.h>
1541#include <esd.h>
1542],      [ return 0; ],
1543        [ echo "*** The test program compiled, but did not run. This usually means"
1544          echo "*** that the run-time linker is not finding ESD or finding the wrong"
1545          echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
1546          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1547          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1548          echo "*** is required on your system"
1549	  echo "***"
1550          echo "*** If you have an old version installed, it is best to remove it, although"
1551          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1552        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1553          echo "*** exact error that occured. This usually means ESD was incorrectly installed"
1554          echo "*** or that you have moved ESD since it was installed. In the latter case, you"
1555          echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
1556          CFLAGS="$ac_save_CFLAGS"
1557          LIBS="$ac_save_LIBS"
1558          AC_LANG_RESTORE
1559       fi
1560     fi
1561     ESD_CFLAGS=""
1562     ESD_LIBS=""
1563     ifelse([$3], , :, [$3])
1564  fi
1565  AC_SUBST(ESD_CFLAGS)
1566  AC_SUBST(ESD_LIBS)
1567  rm -f conf.esdtest
1568])
1569
1570dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]])
1571dnl Test, whether esd supports multiple recording clients (version >=0.2.21)
1572dnl
1573AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD],
1574[dnl
1575  AC_MSG_NOTICE([whether installed esd version supports multiple recording clients])
1576  ac_save_ESD_CFLAGS="$ESD_CFLAGS"
1577  ac_save_ESD_LIBS="$ESD_LIBS"
1578  AM_PATH_ESD(0.2.21,
1579    ifelse([$1], , [
1580      AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true)
1581      AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1,
1582	[Define if you have esound with support of multiple recording clients.])],
1583    [$1]),
1584    ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2])
1585    if test "x$ac_save_ESD_CFLAGS" != x ; then
1586       ESD_CFLAGS="$ac_save_ESD_CFLAGS"
1587    fi
1588    if test "x$ac_save_ESD_LIBS" != x ; then
1589       ESD_LIBS="$ac_save_ESD_LIBS"
1590    fi
1591  )
1592])
1593
1594# ao.m4
1595# Configure paths for libao
1596# Jack Moffitt <jack@icecast.org> 10-21-2000
1597# Shamelessly stolen from Owen Taylor and Manish Singh
1598
1599dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1600dnl Test for libao, and define AO_CFLAGS and AO_LIBS
1601dnl
1602AC_DEFUN([XIPH_PATH_AO],
1603[dnl
1604dnl Get the cflags and libraries
1605dnl
1606AC_ARG_WITH(ao,
1607	    AS_HELP_STRING([--with-ao=PFX], [Prefix where libao is installed (optional)]),
1608	    		   [ao_prefix="$withval"], [ao_prefix=""])
1609AC_ARG_WITH(ao-libraries,
1610	    AS_HELP_STRING([--with-ao-libraries=DIR],
1611	    		   [Directory where libao library is installed (optional)]),
1612	    [ao_libraries="$withval"], [ao_libraries=""])
1613AC_ARG_WITH(ao-includes,
1614	    AS_HELP_STRING([--with-ao-includes=DIR],
1615	    		   [Directory where libao header files are installed (optional)]),
1616	    [ao_includes="$withval"], [ao_includes=""])
1617AC_ARG_ENABLE(aotest,
1618	      AS_HELP_STRING([--disable-aotest],
1619	      		     [Do not try to compile and run a test ao program]),,
1620	      [enable_aotest=yes])
1621
1622
1623  if test "x$ao_libraries" != "x" ; then
1624    AO_LIBS="-L$ao_libraries"
1625  elif test "x$ao_prefix" != "x"; then
1626    AO_LIBS="-L$ao_prefix/lib"
1627  elif test "x$prefix" != "xNONE"; then
1628    AO_LIBS="-L$prefix/lib"
1629  fi
1630
1631  if test "x$ao_includes" != "x" ; then
1632    AO_CFLAGS="-I$ao_includes"
1633  elif test "x$ao_prefix" != "x"; then
1634    AO_CFLAGS="-I$ao_prefix/include"
1635  elif test "x$prefix" != "xNONE"; then
1636    AO_CFLAGS="-I$prefix/include"
1637  fi
1638
1639  # see where dl* and friends live
1640  AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
1641    AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
1642      AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
1643      your system may not be supported.])
1644    ])
1645  ])
1646
1647  AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
1648
1649  AC_MSG_CHECKING(for ao)
1650  no_ao=""
1651
1652
1653  if test "x$enable_aotest" = "xyes" ; then
1654    ac_save_CFLAGS="$CFLAGS"
1655    ac_save_LIBS="$LIBS"
1656    CFLAGS="$CFLAGS $AO_CFLAGS"
1657    LIBS="$LIBS $AO_LIBS"
1658dnl
1659dnl Now check if the installed ao is sufficiently new.
1660dnl
1661      rm -f conf.aotest
1662      AC_TRY_RUN([
1663#include <stdio.h>
1664#include <stdlib.h>
1665#include <string.h>
1666#include <ao/ao.h>
1667
1668int main ()
1669{
1670  system("touch conf.aotest");
1671  return 0;
1672}
1673
1674],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1675       CFLAGS="$ac_save_CFLAGS"
1676       LIBS="$ac_save_LIBS"
1677  fi
1678
1679  if test "x$no_ao" = "x" ; then
1680     AC_MSG_RESULT(yes)
1681     ifelse([$1], , :, [$1])
1682  else
1683     AC_MSG_RESULT(no)
1684     if test -f conf.aotest ; then
1685       :
1686     else
1687       echo "*** Could not run ao test program, checking why..."
1688       CFLAGS="$CFLAGS $AO_CFLAGS"
1689       LIBS="$LIBS $AO_LIBS"
1690       AC_TRY_LINK([
1691#include <stdio.h>
1692#include <ao/ao.h>
1693],     [ return 0; ],
1694       [ echo "*** The test program compiled, but did not run. This usually means"
1695       echo "*** that the run-time linker is not finding ao or finding the wrong"
1696       echo "*** version of ao. If it is not finding ao, you'll need to set your"
1697       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1698       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1699       echo "*** is required on your system"
1700       echo "***"
1701       echo "*** If you have an old version installed, it is best to remove it, although"
1702       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1703       [ echo "*** The test program failed to compile or link. See the file config.log for the"
1704       echo "*** exact error that occured. This usually means ao was incorrectly installed"
1705       echo "*** or that you have moved ao since it was installed." ])
1706       CFLAGS="$ac_save_CFLAGS"
1707       LIBS="$ac_save_LIBS"
1708     fi
1709     AO_CFLAGS=""
1710     AO_LIBS=""
1711     ifelse([$2], , :, [$2])
1712  fi
1713  AC_SUBST(AO_CFLAGS)
1714  AC_SUBST(AO_LIBS)
1715  rm -f conf.aotest
1716])
1717
1718# Configure paths for libogg
1719# Jack Moffitt <jack@icecast.org> 10-21-2000
1720# Shamelessly stolen from Owen Taylor and Manish Singh
1721
1722dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1723dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
1724dnl
1725AC_DEFUN([XIPH_PATH_OGG],
1726[dnl
1727dnl Get the cflags and libraries
1728dnl
1729AC_ARG_WITH(ogg,
1730	    AS_HELP_STRING([--with-ogg=PFX],
1731	    		   [Prefix where libogg is installed (optional)]),
1732	    [ogg_prefix="$withval"], [ogg_prefix=""])
1733AC_ARG_WITH(ogg-libraries,
1734	    AS_HELP_STRING([--with-ogg-libraries=DIR],
1735	    		   [Directory where libogg library is installed (optional)]),
1736	    [ogg_libraries="$withval"], [ogg_libraries=""])
1737AC_ARG_WITH(ogg-includes,
1738	    AS_HELP_STRING([--with-ogg-includes=DIR],
1739	    		   [Directory where libogg header files are installed (optional)]),
1740	    [ogg_includes="$withval"], [ogg_includes=""])
1741AC_ARG_ENABLE(oggtest,
1742	      AS_HELP_STRING([--disable-oggtest],
1743	      		     [Do not try to compile and run a test Ogg program]),,
1744	      [enable_oggtest=yes])
1745
1746  if test "x$ogg_libraries" != "x" ; then
1747    OGG_LIBS="-L$ogg_libraries"
1748  elif test "x$ogg_prefix" != "x" ; then
1749    OGG_LIBS="-L$ogg_prefix/lib"
1750  elif test "x$prefix" != "xNONE" ; then
1751    OGG_LIBS="-L$prefix/lib"
1752  fi
1753
1754  OGG_LIBS="$OGG_LIBS -logg"
1755
1756  if test "x$ogg_includes" != "x" ; then
1757    OGG_CFLAGS="-I$ogg_includes"
1758  elif test "x$ogg_prefix" != "x" ; then
1759    OGG_CFLAGS="-I$ogg_prefix/include"
1760  elif test "x$prefix" != "xNONE"; then
1761    OGG_CFLAGS="-I$prefix/include"
1762  fi
1763
1764  AC_MSG_CHECKING(for Ogg)
1765  no_ogg=""
1766
1767
1768  if test "x$enable_oggtest" = "xyes" ; then
1769    ac_save_CFLAGS="$CFLAGS"
1770    ac_save_LIBS="$LIBS"
1771    CFLAGS="$CFLAGS $OGG_CFLAGS"
1772    LIBS="$LIBS $OGG_LIBS"
1773dnl
1774dnl Now check if the installed Ogg is sufficiently new.
1775dnl
1776      rm -f conf.oggtest
1777      AC_TRY_RUN([
1778#include <stdio.h>
1779#include <stdlib.h>
1780#include <string.h>
1781#include <ogg/ogg.h>
1782
1783int main ()
1784{
1785  system("touch conf.oggtest");
1786  return 0;
1787}
1788
1789],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1790       CFLAGS="$ac_save_CFLAGS"
1791       LIBS="$ac_save_LIBS"
1792  fi
1793
1794  if test "x$no_ogg" = "x" ; then
1795     AC_MSG_RESULT(yes)
1796     ifelse([$1], , :, [$1])
1797  else
1798     AC_MSG_RESULT(no)
1799     if test -f conf.oggtest ; then
1800       :
1801     else
1802       echo "*** Could not run Ogg test program, checking why..."
1803       CFLAGS="$CFLAGS $OGG_CFLAGS"
1804       LIBS="$LIBS $OGG_LIBS"
1805       AC_TRY_LINK([
1806#include <stdio.h>
1807#include <ogg/ogg.h>
1808],     [ return 0; ],
1809       [ echo "*** The test program compiled, but did not run. This usually means"
1810       echo "*** that the run-time linker is not finding Ogg or finding the wrong"
1811       echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
1812       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1813       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1814       echo "*** is required on your system"
1815       echo "***"
1816       echo "*** If you have an old version installed, it is best to remove it, although"
1817       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1818       [ echo "*** The test program failed to compile or link. See the file config.log for the"
1819       echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
1820       echo "*** or that you have moved Ogg since it was installed." ])
1821       CFLAGS="$ac_save_CFLAGS"
1822       LIBS="$ac_save_LIBS"
1823     fi
1824     OGG_CFLAGS=""
1825     OGG_LIBS=""
1826     ifelse([$2], , :, [$2])
1827  fi
1828  AC_SUBST(OGG_CFLAGS)
1829  AC_SUBST(OGG_LIBS)
1830  rm -f conf.oggtest
1831])
1832
1833# Configure paths for libvorbis
1834# Jack Moffitt <jack@icecast.org> 10-21-2000
1835# Shamelessly stolen from Owen Taylor and Manish Singh
1836# thomasvs added check for vorbis_bitrate_addblock which is new in rc3
1837
1838dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1839dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
1840dnl
1841AC_DEFUN([XIPH_PATH_VORBIS],
1842[dnl
1843dnl Get the cflags and libraries
1844dnl
1845AC_ARG_WITH(vorbis,
1846	    AS_HELP_STRING([--with-vorbis=PFX],
1847	    		   [Prefix where libvorbis is installed (optional)]),
1848	    [vorbis_prefix="$withval"], [vorbis_prefix=""])
1849AC_ARG_WITH(vorbis-libraries,
1850	    AS_HELP_STRING([--with-vorbis-libraries=DIR],
1851			   [Directory where libvorbis library is installed (optional)]),
1852	    [vorbis_libraries="$withval"], [vorbis_libraries=""])
1853AC_ARG_WITH(vorbis-includes,
1854	    AS_HELP_STRING([--with-vorbis-includes=DIR],
1855	    		   [Directory where libvorbis header files are installed (optional)]),
1856	    [vorbis_includes="$withval"], [vorbis_includes=""])
1857AC_ARG_ENABLE(vorbistest,
1858	      AS_HELP_STRING([--disable-vorbistest],
1859			     [Do not try to compile and run a test Vorbis program]),
1860	      , [enable_vorbistest=yes])
1861
1862  if test "x$vorbis_libraries" != "x" ; then
1863    VORBIS_LIBS="-L$vorbis_libraries"
1864  elif test "x$vorbis_prefix" != "x" ; then
1865    VORBIS_LIBS="-L$vorbis_prefix/lib"
1866  elif test "x$prefix" != "xNONE"; then
1867    VORBIS_LIBS="-L$prefix/lib"
1868  fi
1869
1870  VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
1871  VORBISFILE_LIBS="-lvorbisfile"
1872  VORBISENC_LIBS="-lvorbisenc"
1873
1874  if test "x$vorbis_includes" != "x" ; then
1875    VORBIS_CFLAGS="-I$vorbis_includes"
1876  elif test "x$vorbis_prefix" != "x" ; then
1877    VORBIS_CFLAGS="-I$vorbis_prefix/include"
1878  elif test "x$prefix" != "xNONE"; then
1879    VORBIS_CFLAGS="-I$prefix/include"
1880  fi
1881
1882
1883  AC_MSG_CHECKING(for Vorbis)
1884  no_vorbis=""
1885
1886
1887  if test "x$enable_vorbistest" = "xyes" ; then
1888    ac_save_CFLAGS="$CFLAGS"
1889    ac_save_LIBS="$LIBS"
1890    CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
1891    LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
1892dnl
1893dnl Now check if the installed Vorbis is sufficiently new.
1894dnl
1895      rm -f conf.vorbistest
1896      AC_TRY_RUN([
1897#include <stdio.h>
1898#include <stdlib.h>
1899#include <string.h>
1900#include <vorbis/codec.h>
1901#include <vorbis/vorbisenc.h>
1902
1903int main ()
1904{
1905    vorbis_block 	vb;
1906    vorbis_dsp_state	vd;
1907    vorbis_info		vi;
1908
1909    vorbis_info_init (&vi);
1910    vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
1911    vorbis_analysis_init (&vd, &vi);
1912    vorbis_block_init (&vd, &vb);
1913    /* this function was added in 1.0rc3, so this is what we're testing for */
1914    vorbis_bitrate_addblock (&vb);
1915
1916    system("touch conf.vorbistest");
1917    return 0;
1918}
1919
1920],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1921       CFLAGS="$ac_save_CFLAGS"
1922       LIBS="$ac_save_LIBS"
1923  fi
1924
1925  if test "x$no_vorbis" = "x" ; then
1926     AC_MSG_RESULT(yes)
1927     ifelse([$1], , :, [$1])
1928  else
1929     AC_MSG_RESULT(no)
1930     if test -f conf.vorbistest ; then
1931       :
1932     else
1933       echo "*** Could not run Vorbis test program, checking why..."
1934       CFLAGS="$CFLAGS $VORBIS_CFLAGS"
1935       LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
1936       AC_TRY_LINK([
1937#include <stdio.h>
1938#include <vorbis/codec.h>
1939],     [ return 0; ],
1940       [ echo "*** The test program compiled, but did not run. This usually means"
1941       echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
1942       echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
1943       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1944       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1945       echo "*** is required on your system"
1946       echo "***"
1947       echo "*** If you have an old version installed, it is best to remove it, although"
1948       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1949       [ echo "*** The test program failed to compile or link. See the file config.log for the"
1950       echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
1951       echo "*** or that you have moved Vorbis since it was installed." ])
1952       CFLAGS="$ac_save_CFLAGS"
1953       LIBS="$ac_save_LIBS"
1954     fi
1955     VORBIS_CFLAGS=""
1956     VORBIS_LIBS=""
1957     VORBISFILE_LIBS=""
1958     VORBISENC_LIBS=""
1959     ifelse([$2], , :, [$2])
1960  fi
1961  AC_SUBST(VORBIS_CFLAGS)
1962  AC_SUBST(VORBIS_LIBS)
1963  AC_SUBST(VORBISFILE_LIBS)
1964  AC_SUBST(VORBISENC_LIBS)
1965  rm -f conf.vorbistest
1966])
1967
1968# Configure paths for libFLAC
1969# "Inspired" by ogg.m4
1970
1971dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1972dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS
1973dnl
1974AC_DEFUN([AM_PATH_LIBFLAC],
1975[dnl
1976dnl Get the cflags and libraries
1977dnl
1978AC_ARG_WITH(libFLAC,
1979	    AS_HELP_STRING([--with-libFLAC=PFX],
1980	    		   [Prefix where libFLAC is installed (optional)]),
1981	    [libFLAC_prefix="$withval"], [libFLAC_prefix=""])
1982AC_ARG_WITH(libFLAC-libraries,
1983	    AS_HELP_STRING([--with-libFLAC-libraries=DIR],
1984	    		   [Directory where libFLAC library is installed (optional)]),
1985	    		   [libFLAC_libraries="$withval"], [libFLAC_libraries=""])
1986AC_ARG_WITH(libFLAC-includes,
1987	    AS_HELP_STRING([--with-libFLAC-includes=DIR],
1988	    		   [Directory where libFLAC header files are installed (optional)]),
1989	    		   [libFLAC_includes="$withval"], [libFLAC_includes=""])
1990AC_ARG_ENABLE(libFLACtest,
1991	      AS_HELP_STRING([--disable-libFLACtest],
1992	      		     [Do not try to compile and run a test libFLAC program]),,
1993	      		     [enable_libFLACtest=yes])
1994
1995  if test "x$libFLAC_libraries" != "x" ; then
1996    LIBFLAC_LIBS="-L$libFLAC_libraries"
1997  elif test "x$libFLAC_prefix" != "x" ; then
1998    LIBFLAC_LIBS="-L$libFLAC_prefix/lib"
1999  elif test "x$prefix" != "xNONE" ; then
2000    LIBFLAC_LIBS="-L$prefix/lib"
2001  fi
2002
2003  LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm"
2004
2005  if test "x$libFLAC_includes" != "x" ; then
2006    LIBFLAC_CFLAGS="-I$libFLAC_includes"
2007  elif test "x$libFLAC_prefix" != "x" ; then
2008    LIBFLAC_CFLAGS="-I$libFLAC_prefix/include"
2009  elif test "$prefix" != "xNONE"; then
2010    LIBFLAC_CFLAGS="-I$prefix/include"
2011  fi
2012
2013  AC_MSG_CHECKING(for libFLAC)
2014  no_libFLAC=""
2015
2016
2017  if test "x$enable_libFLACtest" = "xyes" ; then
2018    ac_save_CFLAGS="$CFLAGS"
2019    ac_save_CXXFLAGS="$CXXFLAGS"
2020    ac_save_LIBS="$LIBS"
2021    CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
2022    CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
2023    LIBS="$LIBS $LIBFLAC_LIBS"
2024dnl
2025dnl Now check if the installed libFLAC is sufficiently new.
2026dnl
2027      rm -f conf.libFLACtest
2028      AC_TRY_RUN([
2029#include <stdio.h>
2030#include <stdlib.h>
2031#include <string.h>
2032#include <FLAC/format.h>
2033
2034int main ()
2035{
2036  system("touch conf.libFLACtest");
2037  return 0;
2038}
2039
2040],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2041       CFLAGS="$ac_save_CFLAGS"
2042       LIBS="$ac_save_LIBS"
2043  fi
2044
2045  if test "x$no_libFLAC" = "x" ; then
2046     AC_MSG_RESULT(yes)
2047     ifelse([$1], , :, [$1])
2048  else
2049     AC_MSG_RESULT(no)
2050     if test -f conf.libFLACtest ; then
2051       :
2052     else
2053       echo "*** Could not run libFLAC test program, checking why..."
2054       CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
2055       LIBS="$LIBS $LIBFLAC_LIBS"
2056       AC_TRY_LINK([
2057#include <stdio.h>
2058#include <FLAC/format.h>
2059],     [ return 0; ],
2060       [ echo "*** The test program compiled, but did not run. This usually means"
2061       echo "*** that the run-time linker is not finding libFLAC or finding the wrong"
2062       echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your"
2063       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2064       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2065       echo "*** is required on your system"
2066       echo "***"
2067       echo "*** If you have an old version installed, it is best to remove it, although"
2068       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2069       [ echo "*** The test program failed to compile or link. See the file config.log for the"
2070       echo "*** exact error that occured. This usually means libFLAC was incorrectly installed"
2071       echo "*** or that you have moved libFLAC since it was installed. In the latter case, you"
2072       echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ])
2073       CFLAGS="$ac_save_CFLAGS"
2074       LIBS="$ac_save_LIBS"
2075     fi
2076     LIBFLAC_CFLAGS=""
2077     LIBFLAC_LIBS=""
2078     ifelse([$2], , :, [$2])
2079  fi
2080  AC_SUBST(LIBFLAC_CFLAGS)
2081  AC_SUBST(LIBFLAC_LIBS)
2082  rm -f conf.libFLACtest
2083])
2084
2085# Configure paths for libOggFLAC
2086# "Inspired" by ogg.m4
2087
2088dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2089dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS
2090dnl
2091AC_DEFUN([AM_PATH_LIBOGGFLAC],
2092[dnl
2093dnl Get the cflags and libraries
2094dnl
2095AC_ARG_WITH(libOggFLAC,
2096	    AS_HELP_STRING([--with-libOggFLAC=PFX],
2097	    		   [Prefix where libOggFLAC is installed (optional)]),
2098	    [libOggFLAC_prefix="$withval"], [libOggFLAC_prefix=""])
2099AC_ARG_WITH(libOggFLAC-libraries,
2100	    AS_HELP_STRING([--with-libOggFLAC-libraries=DIR],
2101	    		   [Directory where libOggFLAC library is installed (optional)]),
2102	    [libOggFLAC_libraries="$withval"], [libOggFLAC_libraries=""])
2103AC_ARG_WITH(libOggFLAC-includes,
2104	    AS_HELP_STRING([--with-libOggFLAC-includes=DIR],
2105	    		   [Directory where libOggFLAC header files are installed (optional)]),
2106	    [libOggFLAC_includes="$withval"], [libOggFLAC_includes=""])
2107AC_ARG_ENABLE(libOggFLACtest,
2108	      AS_HELP_STRING([--disable-libOggFLACtest],
2109	      		     [Do not try to compile and run a test libOggFLAC program]),,
2110	      [enable_libOggFLACtest=yes])
2111
2112  if test "x$libOggFLAC_libraries" != "x" ; then
2113    LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries"
2114  elif test "x$libOggFLAC_prefix" != "x" ; then
2115    LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib"
2116  elif test "x$prefix" != "xNONE" ; then
2117    LIBOGGFLAC_LIBS="-L$prefix/lib"
2118  fi
2119
2120  LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm"
2121
2122  if test "x$libOggFLAC_includes" != "x" ; then
2123    LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes"
2124  elif test "x$libOggFLAC_prefix" != "x" ; then
2125    LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include"
2126  elif test "$prefix" != "xNONE"; then
2127    LIBOGGFLAC_CFLAGS="-I$prefix/include"
2128  fi
2129
2130  AC_MSG_CHECKING(for libOggFLAC)
2131  no_libOggFLAC=""
2132
2133
2134  if test "x$enable_libOggFLACtest" = "xyes" ; then
2135    ac_save_CFLAGS="$CFLAGS"
2136    ac_save_CXXFLAGS="$CXXFLAGS"
2137    ac_save_LIBS="$LIBS"
2138    CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2139    CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS"
2140    LIBS="$LIBS $LIBOGGFLAC_LIBS"
2141dnl
2142dnl Now check if the installed libOggFLAC is sufficiently new.
2143dnl
2144      rm -f conf.libOggFLACtest
2145      AC_TRY_RUN([
2146#include <stdio.h>
2147#include <stdlib.h>
2148#include <string.h>
2149#include <OggFLAC/stream_decoder.h>
2150
2151int main ()
2152{
2153  system("touch conf.libOggFLACtest");
2154  return 0;
2155}
2156
2157],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2158       CFLAGS="$ac_save_CFLAGS"
2159       LIBS="$ac_save_LIBS"
2160  fi
2161
2162  if test "x$no_libOggFLAC" = "x" ; then
2163     AC_MSG_RESULT(yes)
2164     ifelse([$1], , :, [$1])
2165  else
2166     AC_MSG_RESULT(no)
2167     if test -f conf.libOggFLACtest ; then
2168       :
2169     else
2170       echo "*** Could not run libOggFLAC test program, checking why..."
2171       CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
2172       LIBS="$LIBS $LIBOGGFLAC_LIBS"
2173       AC_TRY_LINK([
2174#include <stdio.h>
2175#include <OggFLAC/stream_decoder.h>
2176],     [ return 0; ],
2177       [ echo "*** The test program compiled, but did not run. This usually means"
2178       echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong"
2179       echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your"
2180       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2181       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2182       echo "*** is required on your system"
2183       echo "***"
2184       echo "*** If you have an old version installed, it is best to remove it, although"
2185       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
2186       [ echo "*** The test program failed to compile or link. See the file config.log for the"
2187       echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed"
2188       echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you"
2189       echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ])
2190       CFLAGS="$ac_save_CFLAGS"
2191       LIBS="$ac_save_LIBS"
2192     fi
2193     LIBOGGFLAC_CFLAGS=""
2194     LIBOGGFLAC_LIBS=""
2195     ifelse([$2], , :, [$2])
2196  fi
2197  AC_SUBST(LIBOGGFLAC_CFLAGS)
2198  AC_SUBST(LIBOGGFLAC_LIBS)
2199  rm -f conf.libOggFLACtest
2200])
2201
2202# Configure paths for GTK+
2203# Owen Taylor     1997-2001
2204
2205dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2206dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
2207dnl pass to pkg-config
2208dnl
2209AC_DEFUN([AM_PATH_GTK_2_0],
2210[dnl
2211dnl Get the cflags and libraries from pkg-config
2212dnl
2213AC_ARG_ENABLE(gtktest,
2214	      AS_HELP_STRING([--disable-gtktest],
2215	      		     [do not try to compile and run a test GTK+ program]),
2216	      , [enable_gtktest=yes])
2217
2218  pkg_config_args=gtk+-2.0
2219  for module in . $4
2220  do
2221      case "$module" in
2222         gthread)
2223             pkg_config_args="$pkg_config_args gthread-2.0"
2224         ;;
2225      esac
2226  done
2227
2228  no_gtk=""
2229
2230  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2231
2232  if test x$PKG_CONFIG != xno ; then
2233    if pkg-config --atleast-pkgconfig-version 0.7 ; then
2234      :
2235    else
2236      echo *** pkg-config too old; version 0.7 or better required.
2237      no_gtk=yes
2238      PKG_CONFIG=no
2239    fi
2240  else
2241    no_gtk=yes
2242  fi
2243
2244  min_gtk_version=ifelse([$1], ,2.0.0,$1)
2245  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
2246
2247  if test x$PKG_CONFIG != xno ; then
2248    ## don't try to run the test against uninstalled libtool libs
2249    if $PKG_CONFIG --uninstalled $pkg_config_args; then
2250	  echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
2251	  enable_gtktest=no
2252    fi
2253
2254    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
2255	  :
2256    else
2257	  no_gtk=yes
2258    fi
2259  fi
2260
2261  if test x"$no_gtk" = x ; then
2262    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
2263    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
2264    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2265           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2266    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2267           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2268    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2269           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2270    if test "x$enable_gtktest" = "xyes" ; then
2271      ac_save_CFLAGS="$CFLAGS"
2272      ac_save_LIBS="$LIBS"
2273      CFLAGS="$CFLAGS $GTK_CFLAGS"
2274      LIBS="$GTK_LIBS $LIBS"
2275dnl
2276dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
2277dnl checks the results of pkg-config to some extent)
2278dnl
2279      rm -f conf.gtktest
2280      AC_TRY_RUN([
2281#include <gtk/gtk.h>
2282#include <stdio.h>
2283#include <stdlib.h>
2284
2285int
2286main ()
2287{
2288  int major, minor, micro;
2289  char *tmp_version;
2290
2291  system ("touch conf.gtktest");
2292
2293  /* HP/UX 9 (%@#!) writes to sscanf strings */
2294  tmp_version = g_strdup("$min_gtk_version");
2295  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2296     printf("%s, bad version string\n", "$min_gtk_version");
2297     exit(1);
2298   }
2299
2300  if ((gtk_major_version != $gtk_config_major_version) ||
2301      (gtk_minor_version != $gtk_config_minor_version) ||
2302      (gtk_micro_version != $gtk_config_micro_version))
2303    {
2304      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2305             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2306             gtk_major_version, gtk_minor_version, gtk_micro_version);
2307      printf ("*** was found! If pkg-config was correct, then it is best\n");
2308      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2309      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2310      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2311      printf("*** required on your system.\n");
2312      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
2313      printf("*** to point to the correct configuration files\n");
2314    }
2315  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2316	   (gtk_minor_version != GTK_MINOR_VERSION) ||
2317           (gtk_micro_version != GTK_MICRO_VERSION))
2318    {
2319      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2320	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2321      printf("*** library (version %d.%d.%d)\n",
2322	     gtk_major_version, gtk_minor_version, gtk_micro_version);
2323    }
2324  else
2325    {
2326      if ((gtk_major_version > major) ||
2327        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2328        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2329      {
2330        return 0;
2331       }
2332     else
2333      {
2334        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2335               gtk_major_version, gtk_minor_version, gtk_micro_version);
2336        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2337	       major, minor, micro);
2338        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2339        printf("***\n");
2340        printf("*** If you have already installed a sufficiently new version, this error\n");
2341        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
2342        printf("*** being found. The easiest way to fix this is to remove the old version\n");
2343        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
2344        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
2345        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2346        printf("*** so that the correct libraries are found at run-time))\n");
2347      }
2348    }
2349  return 1;
2350}
2351],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2352       CFLAGS="$ac_save_CFLAGS"
2353       LIBS="$ac_save_LIBS"
2354     fi
2355  fi
2356  if test "x$no_gtk" = x ; then
2357     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
2358     ifelse([$2], , :, [$2])
2359  else
2360     AC_MSG_RESULT(no)
2361     if test "$PKG_CONFIG" = "no" ; then
2362       echo "*** A new enough version of pkg-config was not found."
2363       echo "*** See http://pkgconfig.sourceforge.net"
2364     else
2365       if test -f conf.gtktest ; then
2366        :
2367       else
2368          echo "*** Could not run GTK+ test program, checking why..."
2369	  ac_save_CFLAGS="$CFLAGS"
2370	  ac_save_LIBS="$LIBS"
2371          CFLAGS="$CFLAGS $GTK_CFLAGS"
2372          LIBS="$LIBS $GTK_LIBS"
2373          AC_TRY_LINK([
2374#include <gtk/gtk.h>
2375#include <stdio.h>
2376],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2377        [ echo "*** The test program compiled, but did not run. This usually means"
2378          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
2379          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
2380          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2381          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2382          echo "*** is required on your system"
2383	  echo "***"
2384          echo "*** If you have an old version installed, it is best to remove it, although"
2385          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
2386        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2387          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
2388          CFLAGS="$ac_save_CFLAGS"
2389          LIBS="$ac_save_LIBS"
2390       fi
2391     fi
2392     GTK_CFLAGS=""
2393     GTK_LIBS=""
2394     ifelse([$3], , :, [$3])
2395  fi
2396  AC_SUBST(GTK_CFLAGS)
2397  AC_SUBST(GTK_LIBS)
2398  rm -f conf.gtktest
2399])
2400
2401# Configure paths for GTK+
2402# Owen Taylor     97-11-3
2403
2404dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
2405dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
2406dnl
2407AC_DEFUN([AM_PATH_GTK],
2408[dnl
2409dnl Get the cflags and libraries from the gtk-config script
2410dnl
2411AC_ARG_WITH(gtk-prefix,
2412	    AS_HELP_STRING([--with-gtk-prefix=PFX],
2413	    		   [Prefix where GTK is installed (optional)]),
2414            [gtk_config_prefix="$withval"], [gtk_config_prefix=""])
2415AC_ARG_WITH(gtk-exec-prefix,
2416	    AS_HELP_STRING([--with-gtk-exec-prefix=PFX],
2417	    		   [Exec prefix where GTK is installed (optional)]),
2418	    [gtk_config_exec_prefix="$withval"], [gtk_config_exec_prefix=""])
2419AC_ARG_ENABLE(gtktest,
2420	      AS_HELP_STRING([--disable-gtktest],
2421	      		     [Do not try to compile and run a test GTK program]),
2422	      , [enable_gtktest=yes])
2423
2424  for module in . $4
2425  do
2426      case "$module" in
2427         gthread)
2428             gtk_config_args="$gtk_config_args gthread"
2429         ;;
2430      esac
2431  done
2432
2433  if test x$gtk_config_exec_prefix != x ; then
2434     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
2435     if test x${GTK_CONFIG+set} != xset ; then
2436        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
2437     fi
2438  fi
2439  if test x$gtk_config_prefix != x ; then
2440     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
2441     if test x${GTK_CONFIG+set} != xset ; then
2442        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
2443     fi
2444  fi
2445
2446  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
2447  min_gtk_version=ifelse([$1], ,0.99.7,$1)
2448  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2449  no_gtk=""
2450  if test "$GTK_CONFIG" = "no" ; then
2451    no_gtk=yes
2452  else
2453    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
2454    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
2455    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
2456           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
2457    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
2458           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
2459    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
2460           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
2461    if test "x$enable_gtktest" = "xyes" ; then
2462      ac_save_CFLAGS="$CFLAGS"
2463      ac_save_LIBS="$LIBS"
2464      CFLAGS="$CFLAGS $GTK_CFLAGS"
2465      LIBS="$GTK_LIBS $LIBS"
2466dnl
2467dnl Now check if the installed GTK is sufficiently new. (Also sanity
2468dnl checks the results of gtk-config to some extent
2469dnl
2470      rm -f conf.gtktest
2471      AC_TRY_RUN([
2472#include <gtk/gtk.h>
2473#include <stdio.h>
2474#include <stdlib.h>
2475
2476int
2477main ()
2478{
2479  int major, minor, micro;
2480  char *tmp_version;
2481
2482  system ("touch conf.gtktest");
2483
2484  /* HP/UX 9 (%@#!) writes to sscanf strings */
2485  tmp_version = g_strdup("$min_gtk_version");
2486  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2487     printf("%s, bad version string\n", "$min_gtk_version");
2488     exit(1);
2489   }
2490
2491  if ((gtk_major_version != $gtk_config_major_version) ||
2492      (gtk_minor_version != $gtk_config_minor_version) ||
2493      (gtk_micro_version != $gtk_config_micro_version))
2494    {
2495      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
2496             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
2497             gtk_major_version, gtk_minor_version, gtk_micro_version);
2498      printf ("*** was found! If gtk-config was correct, then it is best\n");
2499      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
2500      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
2501      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
2502      printf("*** required on your system.\n");
2503      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
2504      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
2505      printf("*** before re-running configure\n");
2506    }
2507#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
2508  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
2509	   (gtk_minor_version != GTK_MINOR_VERSION) ||
2510           (gtk_micro_version != GTK_MICRO_VERSION))
2511    {
2512      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
2513	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2514      printf("*** library (version %d.%d.%d)\n",
2515	     gtk_major_version, gtk_minor_version, gtk_micro_version);
2516    }
2517#endif /* defined (GTK_MAJOR_VERSION) ... */
2518  else
2519    {
2520      if ((gtk_major_version > major) ||
2521        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2522        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
2523      {
2524        return 0;
2525       }
2526     else
2527      {
2528        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
2529               gtk_major_version, gtk_minor_version, gtk_micro_version);
2530        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
2531	       major, minor, micro);
2532        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
2533        printf("***\n");
2534        printf("*** If you have already installed a sufficiently new version, this error\n");
2535        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
2536        printf("*** being found. The easiest way to fix this is to remove the old version\n");
2537        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
2538        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
2539        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
2540        printf("*** so that the correct libraries are found at run-time))\n");
2541      }
2542    }
2543  return 1;
2544}
2545],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2546       CFLAGS="$ac_save_CFLAGS"
2547       LIBS="$ac_save_LIBS"
2548     fi
2549  fi
2550  if test "x$no_gtk" = x ; then
2551     AC_MSG_RESULT(yes)
2552     ifelse([$2], , :, [$2])
2553  else
2554     AC_MSG_RESULT(no)
2555     if test "$GTK_CONFIG" = "no" ; then
2556       echo "*** The gtk-config script installed by GTK could not be found"
2557       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
2558       echo "*** your path, or set the GTK_CONFIG environment variable to the"
2559       echo "*** full path to gtk-config."
2560     else
2561       if test -f conf.gtktest ; then
2562        :
2563       else
2564          echo "*** Could not run GTK test program, checking why..."
2565          CFLAGS="$CFLAGS $GTK_CFLAGS"
2566          LIBS="$LIBS $GTK_LIBS"
2567          AC_TRY_LINK([
2568#include <gtk/gtk.h>
2569#include <stdio.h>
2570],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
2571        [ echo "*** The test program compiled, but did not run. This usually means"
2572          echo "*** that the run-time linker is not finding GTK or finding the wrong"
2573          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
2574          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2575          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
2576          echo "*** is required on your system"
2577	  echo "***"
2578          echo "*** If you have an old version installed, it is best to remove it, although"
2579          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
2580          echo "***"
2581          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
2582          echo "*** came with the system with the command"
2583          echo "***"
2584          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
2585        [ echo "*** The test program failed to compile or link. See the file config.log for the"
2586          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
2587          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
2588          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
2589          CFLAGS="$ac_save_CFLAGS"
2590          LIBS="$ac_save_LIBS"
2591       fi
2592     fi
2593     GTK_CFLAGS=""
2594     GTK_LIBS=""
2595     ifelse([$3], , :, [$3])
2596  fi
2597  AC_SUBST(GTK_CFLAGS)
2598  AC_SUBST(GTK_LIBS)
2599  rm -f conf.gtktest
2600])
2601
2602