aclocal.m4 revision e9554658
1e9554658Smrg# generated automatically by aclocal 1.10 -*- Autoconf -*-
2e9554658Smrg
3e9554658Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4e9554658Smrg# 2005, 2006  Free Software Foundation, Inc.
5e9554658Smrg# This file is free software; the Free Software Foundation
6e9554658Smrg# gives unlimited permission to copy and/or distribute it,
7e9554658Smrg# with or without modifications, as long as this notice is preserved.
8e9554658Smrg
9e9554658Smrg# This program is distributed in the hope that it will be useful,
10e9554658Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e9554658Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e9554658Smrg# PARTICULAR PURPOSE.
13e9554658Smrg
14e9554658Smrgm4_if(m4_PACKAGE_VERSION, [2.61],,
15e9554658Smrg[m4_fatal([this file was generated for autoconf 2.61.
16e9554658SmrgYou have another version of autoconf.  If you want to use that,
17e9554658Smrgyou should regenerate the build system entirely.], [63])])
18e9554658Smrg
19e9554658Smrg# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
20e9554658Smrg#
21e9554658Smrg# This file is free software; the Free Software Foundation
22e9554658Smrg# gives unlimited permission to copy and/or distribute it,
23e9554658Smrg# with or without modifications, as long as this notice is preserved.
24e9554658Smrg
25e9554658Smrg# AM_AUTOMAKE_VERSION(VERSION)
26e9554658Smrg# ----------------------------
27e9554658Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
28e9554658Smrg# generated from the m4 files accompanying Automake X.Y.
29e9554658Smrg# (This private macro should not be called outside this file.)
30e9554658SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
31e9554658Smrg[am__api_version='1.10'
32e9554658Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
33e9554658Smrgdnl require some minimum version.  Point them to the right macro.
34e9554658Smrgm4_if([$1], [1.10], [],
35e9554658Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
36e9554658Smrg])
37e9554658Smrg
38e9554658Smrg# _AM_AUTOCONF_VERSION(VERSION)
39e9554658Smrg# -----------------------------
40e9554658Smrg# aclocal traces this macro to find the Autoconf version.
41e9554658Smrg# This is a private macro too.  Using m4_define simplifies
42e9554658Smrg# the logic in aclocal, which can simply ignore this definition.
43e9554658Smrgm4_define([_AM_AUTOCONF_VERSION], [])
44e9554658Smrg
45e9554658Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
46e9554658Smrg# -------------------------------
47e9554658Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
48e9554658Smrg# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
49e9554658SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
50e9554658Smrg[AM_AUTOMAKE_VERSION([1.10])dnl
51e9554658Smrg_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
52e9554658Smrg
53e9554658Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
54e9554658Smrg
55e9554658Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
56e9554658Smrg#
57e9554658Smrg# This file is free software; the Free Software Foundation
58e9554658Smrg# gives unlimited permission to copy and/or distribute it,
59e9554658Smrg# with or without modifications, as long as this notice is preserved.
60e9554658Smrg
61e9554658Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
62e9554658Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
63e9554658Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
64e9554658Smrg#
65e9554658Smrg# Of course, Automake must honor this variable whenever it calls a
66e9554658Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
67e9554658Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
68e9554658Smrg# depending on how configure is run.  This is pretty annoying, since
69e9554658Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
70e9554658Smrg# source directory, any form will work fine, but in subdirectories a
71e9554658Smrg# relative path needs to be adjusted first.
72e9554658Smrg#
73e9554658Smrg# $ac_aux_dir/missing
74e9554658Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
75e9554658Smrg# $top_srcdir/$ac_aux_dir/missing
76e9554658Smrg#    fails if $ac_aux_dir is absolute,
77e9554658Smrg#    fails when called from a subdirectory in a VPATH build with
78e9554658Smrg#          a relative $ac_aux_dir
79e9554658Smrg#
80e9554658Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
81e9554658Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
82e9554658Smrg# harmless because $srcdir is `.', but things will broke when you
83e9554658Smrg# start a VPATH build or use an absolute $srcdir.
84e9554658Smrg#
85e9554658Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
86e9554658Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
87e9554658Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
88e9554658Smrg# and then we would define $MISSING as
89e9554658Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
90e9554658Smrg# This will work as long as MISSING is not called from configure, because
91e9554658Smrg# unfortunately $(top_srcdir) has no meaning in configure.
92e9554658Smrg# However there are other variables, like CC, which are often used in
93e9554658Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
94e9554658Smrg#
95e9554658Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
96e9554658Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
97e9554658Smrg# configured tree to be moved without reconfiguration.
98e9554658Smrg
99e9554658SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
100e9554658Smrg[dnl Rely on autoconf to set up CDPATH properly.
101e9554658SmrgAC_PREREQ([2.50])dnl
102e9554658Smrg# expand $ac_aux_dir to an absolute path
103e9554658Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
104e9554658Smrg])
105e9554658Smrg
106e9554658Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
107e9554658Smrg
108e9554658Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
109e9554658Smrg# Free Software Foundation, Inc.
110e9554658Smrg#
111e9554658Smrg# This file is free software; the Free Software Foundation
112e9554658Smrg# gives unlimited permission to copy and/or distribute it,
113e9554658Smrg# with or without modifications, as long as this notice is preserved.
114e9554658Smrg
115e9554658Smrg# serial 8
116e9554658Smrg
117e9554658Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
118e9554658Smrg# -------------------------------------
119e9554658Smrg# Define a conditional.
120e9554658SmrgAC_DEFUN([AM_CONDITIONAL],
121e9554658Smrg[AC_PREREQ(2.52)dnl
122e9554658Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
123e9554658Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
124e9554658SmrgAC_SUBST([$1_TRUE])dnl
125e9554658SmrgAC_SUBST([$1_FALSE])dnl
126e9554658Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
127e9554658Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
128e9554658Smrgif $2; then
129e9554658Smrg  $1_TRUE=
130e9554658Smrg  $1_FALSE='#'
131e9554658Smrgelse
132e9554658Smrg  $1_TRUE='#'
133e9554658Smrg  $1_FALSE=
134e9554658Smrgfi
135e9554658SmrgAC_CONFIG_COMMANDS_PRE(
136e9554658Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
137e9554658Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
138e9554658SmrgUsually this means the macro was only invoked conditionally.]])
139e9554658Smrgfi])])
140e9554658Smrg
141e9554658Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
142e9554658Smrg# Free Software Foundation, Inc.
143e9554658Smrg#
144e9554658Smrg# This file is free software; the Free Software Foundation
145e9554658Smrg# gives unlimited permission to copy and/or distribute it,
146e9554658Smrg# with or without modifications, as long as this notice is preserved.
147e9554658Smrg
148e9554658Smrg# serial 9
149e9554658Smrg
150e9554658Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
151e9554658Smrg# written in clear, in which case automake, when reading aclocal.m4,
152e9554658Smrg# will think it sees a *use*, and therefore will trigger all it's
153e9554658Smrg# C support machinery.  Also note that it means that autoscan, seeing
154e9554658Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
155e9554658Smrg
156e9554658Smrg
157e9554658Smrg# _AM_DEPENDENCIES(NAME)
158e9554658Smrg# ----------------------
159e9554658Smrg# See how the compiler implements dependency checking.
160e9554658Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
161e9554658Smrg# We try a few techniques and use that to set a single cache variable.
162e9554658Smrg#
163e9554658Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
164e9554658Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
165e9554658Smrg# dependency, and given that the user is not expected to run this macro,
166e9554658Smrg# just rely on AC_PROG_CC.
167e9554658SmrgAC_DEFUN([_AM_DEPENDENCIES],
168e9554658Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
169e9554658SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
170e9554658SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
171e9554658SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
172e9554658Smrg
173e9554658Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
174e9554658Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
175e9554658Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
176e9554658Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
177e9554658Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
178e9554658Smrg                   [depcc="$$1"   am_compiler_list=])
179e9554658Smrg
180e9554658SmrgAC_CACHE_CHECK([dependency style of $depcc],
181e9554658Smrg               [am_cv_$1_dependencies_compiler_type],
182e9554658Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
183e9554658Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
184e9554658Smrg  # making bogus files that we don't know about and never remove.  For
185e9554658Smrg  # instance it was reported that on HP-UX the gcc test will end up
186e9554658Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
187e9554658Smrg  # in D'.
188e9554658Smrg  mkdir conftest.dir
189e9554658Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
190e9554658Smrg  # using a relative directory.
191e9554658Smrg  cp "$am_depcomp" conftest.dir
192e9554658Smrg  cd conftest.dir
193e9554658Smrg  # We will build objects and dependencies in a subdirectory because
194e9554658Smrg  # it helps to detect inapplicable dependency modes.  For instance
195e9554658Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
196e9554658Smrg  # side effect of compilation, but ICC will put the dependencies in
197e9554658Smrg  # the current directory while Tru64 will put them in the object
198e9554658Smrg  # directory.
199e9554658Smrg  mkdir sub
200e9554658Smrg
201e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
202e9554658Smrg  if test "$am_compiler_list" = ""; then
203e9554658Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
204e9554658Smrg  fi
205e9554658Smrg  for depmode in $am_compiler_list; do
206e9554658Smrg    # Setup a source with many dependencies, because some compilers
207e9554658Smrg    # like to wrap large dependency lists on column 80 (with \), and
208e9554658Smrg    # we should not choose a depcomp mode which is confused by this.
209e9554658Smrg    #
210e9554658Smrg    # We need to recreate these files for each test, as the compiler may
211e9554658Smrg    # overwrite some of them when testing with obscure command lines.
212e9554658Smrg    # This happens at least with the AIX C compiler.
213e9554658Smrg    : > sub/conftest.c
214e9554658Smrg    for i in 1 2 3 4 5 6; do
215e9554658Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
216e9554658Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
217e9554658Smrg      # Solaris 8's {/usr,}/bin/sh.
218e9554658Smrg      touch sub/conftst$i.h
219e9554658Smrg    done
220e9554658Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
221e9554658Smrg
222e9554658Smrg    case $depmode in
223e9554658Smrg    nosideeffect)
224e9554658Smrg      # after this tag, mechanisms are not by side-effect, so they'll
225e9554658Smrg      # only be used when explicitly requested
226e9554658Smrg      if test "x$enable_dependency_tracking" = xyes; then
227e9554658Smrg	continue
228e9554658Smrg      else
229e9554658Smrg	break
230e9554658Smrg      fi
231e9554658Smrg      ;;
232e9554658Smrg    none) break ;;
233e9554658Smrg    esac
234e9554658Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
235e9554658Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
236e9554658Smrg    # handle `-M -o', and we need to detect this.
237e9554658Smrg    if depmode=$depmode \
238e9554658Smrg       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
239e9554658Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
240e9554658Smrg       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
241e9554658Smrg         >/dev/null 2>conftest.err &&
242e9554658Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
243e9554658Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
244e9554658Smrg       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
245e9554658Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
246e9554658Smrg      # icc doesn't choke on unknown options, it will just issue warnings
247e9554658Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
248e9554658Smrg      # that says an option was ignored or not supported.
249e9554658Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
250e9554658Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
251e9554658Smrg      # The diagnosis changed in icc 8.0:
252e9554658Smrg      #   icc: Command line remark: option '-MP' not supported
253e9554658Smrg      if (grep 'ignoring option' conftest.err ||
254e9554658Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
255e9554658Smrg        am_cv_$1_dependencies_compiler_type=$depmode
256e9554658Smrg        break
257e9554658Smrg      fi
258e9554658Smrg    fi
259e9554658Smrg  done
260e9554658Smrg
261e9554658Smrg  cd ..
262e9554658Smrg  rm -rf conftest.dir
263e9554658Smrgelse
264e9554658Smrg  am_cv_$1_dependencies_compiler_type=none
265e9554658Smrgfi
266e9554658Smrg])
267e9554658SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
268e9554658SmrgAM_CONDITIONAL([am__fastdep$1], [
269e9554658Smrg  test "x$enable_dependency_tracking" != xno \
270e9554658Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
271e9554658Smrg])
272e9554658Smrg
273e9554658Smrg
274e9554658Smrg# AM_SET_DEPDIR
275e9554658Smrg# -------------
276e9554658Smrg# Choose a directory name for dependency files.
277e9554658Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
278e9554658SmrgAC_DEFUN([AM_SET_DEPDIR],
279e9554658Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
280e9554658SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
281e9554658Smrg])
282e9554658Smrg
283e9554658Smrg
284e9554658Smrg# AM_DEP_TRACK
285e9554658Smrg# ------------
286e9554658SmrgAC_DEFUN([AM_DEP_TRACK],
287e9554658Smrg[AC_ARG_ENABLE(dependency-tracking,
288e9554658Smrg[  --disable-dependency-tracking  speeds up one-time build
289e9554658Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
290e9554658Smrgif test "x$enable_dependency_tracking" != xno; then
291e9554658Smrg  am_depcomp="$ac_aux_dir/depcomp"
292e9554658Smrg  AMDEPBACKSLASH='\'
293e9554658Smrgfi
294e9554658SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
295e9554658SmrgAC_SUBST([AMDEPBACKSLASH])dnl
296e9554658Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
297e9554658Smrg])
298e9554658Smrg
299e9554658Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
300e9554658Smrg
301e9554658Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
302e9554658Smrg# Free Software Foundation, Inc.
303e9554658Smrg#
304e9554658Smrg# This file is free software; the Free Software Foundation
305e9554658Smrg# gives unlimited permission to copy and/or distribute it,
306e9554658Smrg# with or without modifications, as long as this notice is preserved.
307e9554658Smrg
308e9554658Smrg#serial 3
309e9554658Smrg
310e9554658Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
311e9554658Smrg# ------------------------------
312e9554658SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
313e9554658Smrg[for mf in $CONFIG_FILES; do
314e9554658Smrg  # Strip MF so we end up with the name of the file.
315e9554658Smrg  mf=`echo "$mf" | sed -e 's/:.*$//'`
316e9554658Smrg  # Check whether this is an Automake generated Makefile or not.
317e9554658Smrg  # We used to match only the files named `Makefile.in', but
318e9554658Smrg  # some people rename them; so instead we look at the file content.
319e9554658Smrg  # Grep'ing the first line is not enough: some people post-process
320e9554658Smrg  # each Makefile.in and add a new line on top of each file to say so.
321e9554658Smrg  # Grep'ing the whole file is not good either: AIX grep has a line
322e9554658Smrg  # limit of 2048, but all sed's we know have understand at least 4000.
323e9554658Smrg  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
324e9554658Smrg    dirpart=`AS_DIRNAME("$mf")`
325e9554658Smrg  else
326e9554658Smrg    continue
327e9554658Smrg  fi
328e9554658Smrg  # Extract the definition of DEPDIR, am__include, and am__quote
329e9554658Smrg  # from the Makefile without running `make'.
330e9554658Smrg  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
331e9554658Smrg  test -z "$DEPDIR" && continue
332e9554658Smrg  am__include=`sed -n 's/^am__include = //p' < "$mf"`
333e9554658Smrg  test -z "am__include" && continue
334e9554658Smrg  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
335e9554658Smrg  # When using ansi2knr, U may be empty or an underscore; expand it
336e9554658Smrg  U=`sed -n 's/^U = //p' < "$mf"`
337e9554658Smrg  # Find all dependency output files, they are included files with
338e9554658Smrg  # $(DEPDIR) in their names.  We invoke sed twice because it is the
339e9554658Smrg  # simplest approach to changing $(DEPDIR) to its actual value in the
340e9554658Smrg  # expansion.
341e9554658Smrg  for file in `sed -n "
342e9554658Smrg    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
343e9554658Smrg       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
344e9554658Smrg    # Make sure the directory exists.
345e9554658Smrg    test -f "$dirpart/$file" && continue
346e9554658Smrg    fdir=`AS_DIRNAME(["$file"])`
347e9554658Smrg    AS_MKDIR_P([$dirpart/$fdir])
348e9554658Smrg    # echo "creating $dirpart/$file"
349e9554658Smrg    echo '# dummy' > "$dirpart/$file"
350e9554658Smrg  done
351e9554658Smrgdone
352e9554658Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
353e9554658Smrg
354e9554658Smrg
355e9554658Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
356e9554658Smrg# -----------------------------
357e9554658Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
358e9554658Smrg#
359e9554658Smrg# This code is only required when automatic dependency tracking
360e9554658Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
361e9554658Smrg# need in order to bootstrap the dependency handling code.
362e9554658SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
363e9554658Smrg[AC_CONFIG_COMMANDS([depfiles],
364e9554658Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
365e9554658Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
366e9554658Smrg])
367e9554658Smrg
368e9554658Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
369e9554658Smrg# Free Software Foundation, Inc.
370e9554658Smrg#
371e9554658Smrg# This file is free software; the Free Software Foundation
372e9554658Smrg# gives unlimited permission to copy and/or distribute it,
373e9554658Smrg# with or without modifications, as long as this notice is preserved.
374e9554658Smrg
375e9554658Smrg# serial 8
376e9554658Smrg
377e9554658Smrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
378e9554658SmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
379e9554658Smrg
380e9554658Smrg# Do all the work for Automake.                             -*- Autoconf -*-
381e9554658Smrg
382e9554658Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
383e9554658Smrg# 2005, 2006 Free Software Foundation, Inc.
384e9554658Smrg#
385e9554658Smrg# This file is free software; the Free Software Foundation
386e9554658Smrg# gives unlimited permission to copy and/or distribute it,
387e9554658Smrg# with or without modifications, as long as this notice is preserved.
388e9554658Smrg
389e9554658Smrg# serial 12
390e9554658Smrg
391e9554658Smrg# This macro actually does too much.  Some checks are only needed if
392e9554658Smrg# your package does certain things.  But this isn't really a big deal.
393e9554658Smrg
394e9554658Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
395e9554658Smrg# AM_INIT_AUTOMAKE([OPTIONS])
396e9554658Smrg# -----------------------------------------------
397e9554658Smrg# The call with PACKAGE and VERSION arguments is the old style
398e9554658Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
399e9554658Smrg# and VERSION should now be passed to AC_INIT and removed from
400e9554658Smrg# the call to AM_INIT_AUTOMAKE.
401e9554658Smrg# We support both call styles for the transition.  After
402e9554658Smrg# the next Automake release, Autoconf can make the AC_INIT
403e9554658Smrg# arguments mandatory, and then we can depend on a new Autoconf
404e9554658Smrg# release and drop the old call support.
405e9554658SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
406e9554658Smrg[AC_PREREQ([2.60])dnl
407e9554658Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
408e9554658Smrgdnl the ones we care about.
409e9554658Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
410e9554658SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
411e9554658SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
412e9554658Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
413e9554658Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
414e9554658Smrg  # is not polluted with repeated "-I."
415e9554658Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
416e9554658Smrg  # test to see if srcdir already configured
417e9554658Smrg  if test -f $srcdir/config.status; then
418e9554658Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
419e9554658Smrg  fi
420e9554658Smrgfi
421e9554658Smrg
422e9554658Smrg# test whether we have cygpath
423e9554658Smrgif test -z "$CYGPATH_W"; then
424e9554658Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
425e9554658Smrg    CYGPATH_W='cygpath -w'
426e9554658Smrg  else
427e9554658Smrg    CYGPATH_W=echo
428e9554658Smrg  fi
429e9554658Smrgfi
430e9554658SmrgAC_SUBST([CYGPATH_W])
431e9554658Smrg
432e9554658Smrg# Define the identity of the package.
433e9554658Smrgdnl Distinguish between old-style and new-style calls.
434e9554658Smrgm4_ifval([$2],
435e9554658Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
436e9554658Smrg AC_SUBST([PACKAGE], [$1])dnl
437e9554658Smrg AC_SUBST([VERSION], [$2])],
438e9554658Smrg[_AM_SET_OPTIONS([$1])dnl
439e9554658Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
440e9554658Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
441e9554658Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
442e9554658Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
443e9554658Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
444e9554658Smrg
445e9554658Smrg_AM_IF_OPTION([no-define],,
446e9554658Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
447e9554658Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
448e9554658Smrg
449e9554658Smrg# Some tools Automake needs.
450e9554658SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
451e9554658SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
452e9554658SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
453e9554658SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
454e9554658SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
455e9554658SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
456e9554658SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
457e9554658SmrgAM_PROG_INSTALL_SH
458e9554658SmrgAM_PROG_INSTALL_STRIP
459e9554658SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
460e9554658Smrg# We need awk for the "check" target.  The system "awk" is bad on
461e9554658Smrg# some platforms.
462e9554658SmrgAC_REQUIRE([AC_PROG_AWK])dnl
463e9554658SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
464e9554658SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
465e9554658Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
466e9554658Smrg              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
467e9554658Smrg	      		     [_AM_PROG_TAR([v7])])])
468e9554658Smrg_AM_IF_OPTION([no-dependencies],,
469e9554658Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
470e9554658Smrg                  [_AM_DEPENDENCIES(CC)],
471e9554658Smrg                  [define([AC_PROG_CC],
472e9554658Smrg                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
473e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
474e9554658Smrg                  [_AM_DEPENDENCIES(CXX)],
475e9554658Smrg                  [define([AC_PROG_CXX],
476e9554658Smrg                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
477e9554658SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
478e9554658Smrg                  [_AM_DEPENDENCIES(OBJC)],
479e9554658Smrg                  [define([AC_PROG_OBJC],
480e9554658Smrg                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
481e9554658Smrg])
482e9554658Smrg])
483e9554658Smrg
484e9554658Smrg
485e9554658Smrg# When config.status generates a header, we must update the stamp-h file.
486e9554658Smrg# This file resides in the same directory as the config header
487e9554658Smrg# that is generated.  The stamp files are numbered to have different names.
488e9554658Smrg
489e9554658Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
490e9554658Smrg# loop where config.status creates the headers, so we can generate
491e9554658Smrg# our stamp files there.
492e9554658SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
493e9554658Smrg[# Compute $1's index in $config_headers.
494e9554658Smrg_am_stamp_count=1
495e9554658Smrgfor _am_header in $config_headers :; do
496e9554658Smrg  case $_am_header in
497e9554658Smrg    $1 | $1:* )
498e9554658Smrg      break ;;
499e9554658Smrg    * )
500e9554658Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
501e9554658Smrg  esac
502e9554658Smrgdone
503e9554658Smrgecho "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
504e9554658Smrg
505e9554658Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
506e9554658Smrg#
507e9554658Smrg# This file is free software; the Free Software Foundation
508e9554658Smrg# gives unlimited permission to copy and/or distribute it,
509e9554658Smrg# with or without modifications, as long as this notice is preserved.
510e9554658Smrg
511e9554658Smrg# AM_PROG_INSTALL_SH
512e9554658Smrg# ------------------
513e9554658Smrg# Define $install_sh.
514e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
515e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
516e9554658Smrginstall_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
517e9554658SmrgAC_SUBST(install_sh)])
518e9554658Smrg
519e9554658Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
520e9554658Smrg#
521e9554658Smrg# This file is free software; the Free Software Foundation
522e9554658Smrg# gives unlimited permission to copy and/or distribute it,
523e9554658Smrg# with or without modifications, as long as this notice is preserved.
524e9554658Smrg
525e9554658Smrg# serial 2
526e9554658Smrg
527e9554658Smrg# Check whether the underlying file-system supports filenames
528e9554658Smrg# with a leading dot.  For instance MS-DOS doesn't.
529e9554658SmrgAC_DEFUN([AM_SET_LEADING_DOT],
530e9554658Smrg[rm -rf .tst 2>/dev/null
531e9554658Smrgmkdir .tst 2>/dev/null
532e9554658Smrgif test -d .tst; then
533e9554658Smrg  am__leading_dot=.
534e9554658Smrgelse
535e9554658Smrg  am__leading_dot=_
536e9554658Smrgfi
537e9554658Smrgrmdir .tst 2>/dev/null
538e9554658SmrgAC_SUBST([am__leading_dot])])
539e9554658Smrg
540e9554658Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
541e9554658Smrg# From Jim Meyering
542e9554658Smrg
543e9554658Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
544e9554658Smrg# Free Software Foundation, Inc.
545e9554658Smrg#
546e9554658Smrg# This file is free software; the Free Software Foundation
547e9554658Smrg# gives unlimited permission to copy and/or distribute it,
548e9554658Smrg# with or without modifications, as long as this notice is preserved.
549e9554658Smrg
550e9554658Smrg# serial 4
551e9554658Smrg
552e9554658SmrgAC_DEFUN([AM_MAINTAINER_MODE],
553e9554658Smrg[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
554e9554658Smrg  dnl maintainer-mode is disabled by default
555e9554658Smrg  AC_ARG_ENABLE(maintainer-mode,
556e9554658Smrg[  --enable-maintainer-mode  enable make rules and dependencies not useful
557e9554658Smrg			  (and sometimes confusing) to the casual installer],
558e9554658Smrg      USE_MAINTAINER_MODE=$enableval,
559e9554658Smrg      USE_MAINTAINER_MODE=no)
560e9554658Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
561e9554658Smrg  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
562e9554658Smrg  MAINT=$MAINTAINER_MODE_TRUE
563e9554658Smrg  AC_SUBST(MAINT)dnl
564e9554658Smrg]
565e9554658Smrg)
566e9554658Smrg
567e9554658SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
568e9554658Smrg
569e9554658Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
570e9554658Smrg
571e9554658Smrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
572e9554658Smrg#
573e9554658Smrg# This file is free software; the Free Software Foundation
574e9554658Smrg# gives unlimited permission to copy and/or distribute it,
575e9554658Smrg# with or without modifications, as long as this notice is preserved.
576e9554658Smrg
577e9554658Smrg# serial 3
578e9554658Smrg
579e9554658Smrg# AM_MAKE_INCLUDE()
580e9554658Smrg# -----------------
581e9554658Smrg# Check to see how make treats includes.
582e9554658SmrgAC_DEFUN([AM_MAKE_INCLUDE],
583e9554658Smrg[am_make=${MAKE-make}
584e9554658Smrgcat > confinc << 'END'
585e9554658Smrgam__doit:
586e9554658Smrg	@echo done
587e9554658Smrg.PHONY: am__doit
588e9554658SmrgEND
589e9554658Smrg# If we don't find an include directive, just comment out the code.
590e9554658SmrgAC_MSG_CHECKING([for style of include used by $am_make])
591e9554658Smrgam__include="#"
592e9554658Smrgam__quote=
593e9554658Smrg_am_result=none
594e9554658Smrg# First try GNU make style include.
595e9554658Smrgecho "include confinc" > confmf
596e9554658Smrg# We grep out `Entering directory' and `Leaving directory'
597e9554658Smrg# messages which can occur if `w' ends up in MAKEFLAGS.
598e9554658Smrg# In particular we don't look at `^make:' because GNU make might
599e9554658Smrg# be invoked under some other name (usually "gmake"), in which
600e9554658Smrg# case it prints its new name instead of `make'.
601e9554658Smrgif test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
602e9554658Smrg   am__include=include
603e9554658Smrg   am__quote=
604e9554658Smrg   _am_result=GNU
605e9554658Smrgfi
606e9554658Smrg# Now try BSD make style include.
607e9554658Smrgif test "$am__include" = "#"; then
608e9554658Smrg   echo '.include "confinc"' > confmf
609e9554658Smrg   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
610e9554658Smrg      am__include=.include
611e9554658Smrg      am__quote="\""
612e9554658Smrg      _am_result=BSD
613e9554658Smrg   fi
614e9554658Smrgfi
615e9554658SmrgAC_SUBST([am__include])
616e9554658SmrgAC_SUBST([am__quote])
617e9554658SmrgAC_MSG_RESULT([$_am_result])
618e9554658Smrgrm -f confinc confmf
619e9554658Smrg])
620e9554658Smrg
621e9554658Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
622e9554658Smrg
623e9554658Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
624e9554658Smrg# Free Software Foundation, Inc.
625e9554658Smrg#
626e9554658Smrg# This file is free software; the Free Software Foundation
627e9554658Smrg# gives unlimited permission to copy and/or distribute it,
628e9554658Smrg# with or without modifications, as long as this notice is preserved.
629e9554658Smrg
630e9554658Smrg# serial 5
631e9554658Smrg
632e9554658Smrg# AM_MISSING_PROG(NAME, PROGRAM)
633e9554658Smrg# ------------------------------
634e9554658SmrgAC_DEFUN([AM_MISSING_PROG],
635e9554658Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
636e9554658Smrg$1=${$1-"${am_missing_run}$2"}
637e9554658SmrgAC_SUBST($1)])
638e9554658Smrg
639e9554658Smrg
640e9554658Smrg# AM_MISSING_HAS_RUN
641e9554658Smrg# ------------------
642e9554658Smrg# Define MISSING if not defined so far and test if it supports --run.
643e9554658Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
644e9554658SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
645e9554658Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
646e9554658SmrgAC_REQUIRE_AUX_FILE([missing])dnl
647e9554658Smrgtest x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
648e9554658Smrg# Use eval to expand $SHELL
649e9554658Smrgif eval "$MISSING --run true"; then
650e9554658Smrg  am_missing_run="$MISSING --run "
651e9554658Smrgelse
652e9554658Smrg  am_missing_run=
653e9554658Smrg  AC_MSG_WARN([`missing' script is too old or missing])
654e9554658Smrgfi
655e9554658Smrg])
656e9554658Smrg
657e9554658Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
658e9554658Smrg#
659e9554658Smrg# This file is free software; the Free Software Foundation
660e9554658Smrg# gives unlimited permission to copy and/or distribute it,
661e9554658Smrg# with or without modifications, as long as this notice is preserved.
662e9554658Smrg
663e9554658Smrg# AM_PROG_MKDIR_P
664e9554658Smrg# ---------------
665e9554658Smrg# Check for `mkdir -p'.
666e9554658SmrgAC_DEFUN([AM_PROG_MKDIR_P],
667e9554658Smrg[AC_PREREQ([2.60])dnl
668e9554658SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
669e9554658Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
670e9554658Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
671e9554658Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
672e9554658Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
673e9554658Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
674e9554658Smrgdnl adjustment using top_builddir (which is defined more often than
675e9554658Smrgdnl MKDIR_P).
676e9554658SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
677e9554658Smrgcase $mkdir_p in
678e9554658Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
679e9554658Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
680e9554658Smrgesac
681e9554658Smrg])
682e9554658Smrg
683e9554658Smrg# Helper functions for option handling.                     -*- Autoconf -*-
684e9554658Smrg
685e9554658Smrg# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
686e9554658Smrg#
687e9554658Smrg# This file is free software; the Free Software Foundation
688e9554658Smrg# gives unlimited permission to copy and/or distribute it,
689e9554658Smrg# with or without modifications, as long as this notice is preserved.
690e9554658Smrg
691e9554658Smrg# serial 3
692e9554658Smrg
693e9554658Smrg# _AM_MANGLE_OPTION(NAME)
694e9554658Smrg# -----------------------
695e9554658SmrgAC_DEFUN([_AM_MANGLE_OPTION],
696e9554658Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
697e9554658Smrg
698e9554658Smrg# _AM_SET_OPTION(NAME)
699e9554658Smrg# ------------------------------
700e9554658Smrg# Set option NAME.  Presently that only means defining a flag for this option.
701e9554658SmrgAC_DEFUN([_AM_SET_OPTION],
702e9554658Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
703e9554658Smrg
704e9554658Smrg# _AM_SET_OPTIONS(OPTIONS)
705e9554658Smrg# ----------------------------------
706e9554658Smrg# OPTIONS is a space-separated list of Automake options.
707e9554658SmrgAC_DEFUN([_AM_SET_OPTIONS],
708e9554658Smrg[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
709e9554658Smrg
710e9554658Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
711e9554658Smrg# -------------------------------------------
712e9554658Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
713e9554658SmrgAC_DEFUN([_AM_IF_OPTION],
714e9554658Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
715e9554658Smrg
716e9554658Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
717e9554658Smrg
718e9554658Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
719e9554658Smrg# Free Software Foundation, Inc.
720e9554658Smrg#
721e9554658Smrg# This file is free software; the Free Software Foundation
722e9554658Smrg# gives unlimited permission to copy and/or distribute it,
723e9554658Smrg# with or without modifications, as long as this notice is preserved.
724e9554658Smrg
725e9554658Smrg# serial 4
726e9554658Smrg
727e9554658Smrg# AM_SANITY_CHECK
728e9554658Smrg# ---------------
729e9554658SmrgAC_DEFUN([AM_SANITY_CHECK],
730e9554658Smrg[AC_MSG_CHECKING([whether build environment is sane])
731e9554658Smrg# Just in case
732e9554658Smrgsleep 1
733e9554658Smrgecho timestamp > conftest.file
734e9554658Smrg# Do `set' in a subshell so we don't clobber the current shell's
735e9554658Smrg# arguments.  Must try -L first in case configure is actually a
736e9554658Smrg# symlink; some systems play weird games with the mod time of symlinks
737e9554658Smrg# (eg FreeBSD returns the mod time of the symlink's containing
738e9554658Smrg# directory).
739e9554658Smrgif (
740e9554658Smrg   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
741e9554658Smrg   if test "$[*]" = "X"; then
742e9554658Smrg      # -L didn't work.
743e9554658Smrg      set X `ls -t $srcdir/configure conftest.file`
744e9554658Smrg   fi
745e9554658Smrg   rm -f conftest.file
746e9554658Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
747e9554658Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
748e9554658Smrg
749e9554658Smrg      # If neither matched, then we have a broken ls.  This can happen
750e9554658Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
751e9554658Smrg      # broken ls alias from the environment.  This has actually
752e9554658Smrg      # happened.  Such a system could not be considered "sane".
753e9554658Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
754e9554658Smrgalias in your environment])
755e9554658Smrg   fi
756e9554658Smrg
757e9554658Smrg   test "$[2]" = conftest.file
758e9554658Smrg   )
759e9554658Smrgthen
760e9554658Smrg   # Ok.
761e9554658Smrg   :
762e9554658Smrgelse
763e9554658Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
764e9554658SmrgCheck your system clock])
765e9554658Smrgfi
766e9554658SmrgAC_MSG_RESULT(yes)])
767e9554658Smrg
768e9554658Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
769e9554658Smrg#
770e9554658Smrg# This file is free software; the Free Software Foundation
771e9554658Smrg# gives unlimited permission to copy and/or distribute it,
772e9554658Smrg# with or without modifications, as long as this notice is preserved.
773e9554658Smrg
774e9554658Smrg# AM_PROG_INSTALL_STRIP
775e9554658Smrg# ---------------------
776e9554658Smrg# One issue with vendor `install' (even GNU) is that you can't
777e9554658Smrg# specify the program used to strip binaries.  This is especially
778e9554658Smrg# annoying in cross-compiling environments, where the build's strip
779e9554658Smrg# is unlikely to handle the host's binaries.
780e9554658Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
781e9554658Smrg# always use install-sh in `make install-strip', and initialize
782e9554658Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
783e9554658SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
784e9554658Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
785e9554658Smrg# Installed binaries are usually stripped using `strip' when the user
786e9554658Smrg# run `make install-strip'.  However `strip' might not be the right
787e9554658Smrg# tool to use in cross-compilation environments, therefore Automake
788e9554658Smrg# will honor the `STRIP' environment variable to overrule this program.
789e9554658Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
790e9554658Smrgif test "$cross_compiling" != no; then
791e9554658Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
792e9554658Smrgfi
793e9554658SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
794e9554658SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
795e9554658Smrg
796e9554658Smrg# Copyright (C) 2006  Free Software Foundation, Inc.
797e9554658Smrg#
798e9554658Smrg# This file is free software; the Free Software Foundation
799e9554658Smrg# gives unlimited permission to copy and/or distribute it,
800e9554658Smrg# with or without modifications, as long as this notice is preserved.
801e9554658Smrg
802e9554658Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
803e9554658Smrg# ---------------------------
804e9554658Smrg# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
805e9554658Smrg# This macro is traced by Automake.
806e9554658SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
807e9554658Smrg
808e9554658Smrg# Check how to create a tarball.                            -*- Autoconf -*-
809e9554658Smrg
810e9554658Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
811e9554658Smrg#
812e9554658Smrg# This file is free software; the Free Software Foundation
813e9554658Smrg# gives unlimited permission to copy and/or distribute it,
814e9554658Smrg# with or without modifications, as long as this notice is preserved.
815e9554658Smrg
816e9554658Smrg# serial 2
817e9554658Smrg
818e9554658Smrg# _AM_PROG_TAR(FORMAT)
819e9554658Smrg# --------------------
820e9554658Smrg# Check how to create a tarball in format FORMAT.
821e9554658Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
822e9554658Smrg#
823e9554658Smrg# Substitute a variable $(am__tar) that is a command
824e9554658Smrg# writing to stdout a FORMAT-tarball containing the directory
825e9554658Smrg# $tardir.
826e9554658Smrg#     tardir=directory && $(am__tar) > result.tar
827e9554658Smrg#
828e9554658Smrg# Substitute a variable $(am__untar) that extract such
829e9554658Smrg# a tarball read from stdin.
830e9554658Smrg#     $(am__untar) < result.tar
831e9554658SmrgAC_DEFUN([_AM_PROG_TAR],
832e9554658Smrg[# Always define AMTAR for backward compatibility.
833e9554658SmrgAM_MISSING_PROG([AMTAR], [tar])
834e9554658Smrgm4_if([$1], [v7],
835e9554658Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
836e9554658Smrg     [m4_case([$1], [ustar],, [pax],,
837e9554658Smrg              [m4_fatal([Unknown tar format])])
838e9554658SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
839e9554658Smrg# Loop over all known methods to create a tar archive until one works.
840e9554658Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
841e9554658Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
842e9554658Smrg# Do not fold the above two line into one, because Tru64 sh and
843e9554658Smrg# Solaris sh will not grok spaces in the rhs of `-'.
844e9554658Smrgfor _am_tool in $_am_tools
845e9554658Smrgdo
846e9554658Smrg  case $_am_tool in
847e9554658Smrg  gnutar)
848e9554658Smrg    for _am_tar in tar gnutar gtar;
849e9554658Smrg    do
850e9554658Smrg      AM_RUN_LOG([$_am_tar --version]) && break
851e9554658Smrg    done
852e9554658Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
853e9554658Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
854e9554658Smrg    am__untar="$_am_tar -xf -"
855e9554658Smrg    ;;
856e9554658Smrg  plaintar)
857e9554658Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
858e9554658Smrg    # ustar tarball either.
859e9554658Smrg    (tar --version) >/dev/null 2>&1 && continue
860e9554658Smrg    am__tar='tar chf - "$$tardir"'
861e9554658Smrg    am__tar_='tar chf - "$tardir"'
862e9554658Smrg    am__untar='tar xf -'
863e9554658Smrg    ;;
864e9554658Smrg  pax)
865e9554658Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
866e9554658Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
867e9554658Smrg    am__untar='pax -r'
868e9554658Smrg    ;;
869e9554658Smrg  cpio)
870e9554658Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
871e9554658Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
872e9554658Smrg    am__untar='cpio -i -H $1 -d'
873e9554658Smrg    ;;
874e9554658Smrg  none)
875e9554658Smrg    am__tar=false
876e9554658Smrg    am__tar_=false
877e9554658Smrg    am__untar=false
878e9554658Smrg    ;;
879e9554658Smrg  esac
880e9554658Smrg
881e9554658Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
882e9554658Smrg  # and am__untar set.
883e9554658Smrg  test -n "${am_cv_prog_tar_$1}" && break
884e9554658Smrg
885e9554658Smrg  # tar/untar a dummy directory, and stop if the command works
886e9554658Smrg  rm -rf conftest.dir
887e9554658Smrg  mkdir conftest.dir
888e9554658Smrg  echo GrepMe > conftest.dir/file
889e9554658Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
890e9554658Smrg  rm -rf conftest.dir
891e9554658Smrg  if test -s conftest.tar; then
892e9554658Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
893e9554658Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
894e9554658Smrg  fi
895e9554658Smrgdone
896e9554658Smrgrm -rf conftest.dir
897e9554658Smrg
898e9554658SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
899e9554658SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
900e9554658SmrgAC_SUBST([am__tar])
901e9554658SmrgAC_SUBST([am__untar])
902e9554658Smrg]) # _AM_PROG_TAR
903e9554658Smrg
904e9554658Smrgdnl Copyright 2005 Red Hat, Inc
905e9554658Smrgdnl 
906e9554658Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
907e9554658Smrgdnl documentation for any purpose is hereby granted without fee, provided that
908e9554658Smrgdnl the above copyright notice appear in all copies and that both that
909e9554658Smrgdnl copyright notice and this permission notice appear in supporting
910e9554658Smrgdnl documentation.
911e9554658Smrgdnl 
912e9554658Smrgdnl The above copyright notice and this permission notice shall be included
913e9554658Smrgdnl in all copies or substantial portions of the Software.
914e9554658Smrgdnl 
915e9554658Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
916e9554658Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
917e9554658Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
918e9554658Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
919e9554658Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
920e9554658Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
921e9554658Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
922e9554658Smrgdnl 
923e9554658Smrgdnl Except as contained in this notice, the name of the copyright holders shall
924e9554658Smrgdnl not be used in advertising or otherwise to promote the sale, use or
925e9554658Smrgdnl other dealings in this Software without prior written authorization
926e9554658Smrgdnl from the copyright holders.
927e9554658Smrgdnl 
928e9554658Smrg
929e9554658Smrg# XAW_CHECK_XPRINT_SUPPORT()
930e9554658Smrg# --------------------------
931e9554658Smrg# Adds --enable/disable-xprint and selects the appropriate version of the Xaw 
932e9554658Smrg# library. If neither --enable-xprint nor --disable-xprint are given, 
933e9554658Smrg# the presence of an Xaw with Xprint support will be auto detected
934e9554658Smrg
935e9554658SmrgAC_DEFUN([XAW_CHECK_XPRINT_SUPPORT],[
936e9554658Smrg	AC_ARG_ENABLE(xprint, AC_HELP_STRING([--enable-xprint], [Enable XPrint support]),
937e9554658Smrg			[use_xprint=$enableval],[use_xprint=auto])
938e9554658Smrg	if test "x$use_xprint" = "xyes"; then
939e9554658Smrg		TMP_CHECK1=xaw8
940e9554658Smrg		TMP_CHECK2=
941e9554658Smrg		xaw_use_xprint=yes
942e9554658Smrg	elif test "x$use_xprint" = "xno"; then
943e9554658Smrg		TMP_CHECK1=xaw7
944e9554658Smrg		TMP_CHECK2=
945e9554658Smrg		xaw_use_xprint=no
946e9554658Smrg	else
947e9554658Smrg		TMP_CHECK1=xaw8
948e9554658Smrg		TMP_CHECK2=xaw7
949e9554658Smrg		xaw_use_xprint=yes
950e9554658Smrg	fi
951e9554658Smrg
952e9554658Smrg	PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK1, success=yes, success=no)
953e9554658Smrg	if [[ ! -z $TMP_CHECK2 ]] ; then
954e9554658Smrg		if test $success = no ; then
955e9554658Smrg			PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK2, success=yes, success=no)
956e9554658Smrg			xaw_use_xprint=no
957e9554658Smrg		fi
958e9554658Smrg	fi
959e9554658Smrg
960e9554658Smrg	if test "x$success" = "xyes"; then
961e9554658Smrg		$1_CFLAGS=$TMP_XAW_CFLAGS
962e9554658Smrg		$1_LIBS=$TMP_XAW_LIBS
963e9554658Smrg
964e9554658Smrg		AM_CONDITIONAL([XAW_USE_XPRINT], [test "x$xaw_use_xprint" = "xyes"])
965e9554658Smrg	else
966e9554658Smrg		AC_MSG_ERROR([No suitable version of Xaw found])
967e9554658Smrg	fi
968e9554658Smrg])
969e9554658Smrg
970e9554658Smrgdnl
971e9554658Smrgdnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
972e9554658Smrgdnl 
973e9554658Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
974e9554658Smrgdnl copy of this software and associated documentation files (the
975e9554658Smrgdnl "Software"), to deal in the Software without restriction, including
976e9554658Smrgdnl without limitation the rights to use, copy, modify, merge, publish,
977e9554658Smrgdnl distribute, and/or sell copies of the Software, and to permit persons
978e9554658Smrgdnl to whom the Software is furnished to do so, provided that the above
979e9554658Smrgdnl copyright notice(s) and this permission notice appear in all copies of
980e9554658Smrgdnl the Software and that both the above copyright notice(s) and this
981e9554658Smrgdnl permission notice appear in supporting documentation.
982e9554658Smrgdnl
983e9554658Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
984e9554658Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
985e9554658Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
986e9554658Smrgdnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
987e9554658Smrgdnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
988e9554658Smrgdnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
989e9554658Smrgdnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
990e9554658Smrgdnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
991e9554658Smrgdnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
992e9554658Smrgdnl
993e9554658Smrgdnl Except as contained in this notice, the name of a copyright holder
994e9554658Smrgdnl shall not be used in advertising or otherwise to promote the sale, use
995e9554658Smrgdnl or other dealings in this Software without prior written authorization
996e9554658Smrgdnl of the copyright holder.
997e9554658Smrg
998e9554658Smrg# XORG_MACROS_VERSION(required-version)
999e9554658Smrg# -------------------------------------
1000e9554658Smrg# Minimum version: 1.1.0
1001e9554658Smrg#
1002e9554658Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1003e9554658Smrg# your configure.ac with the minimum required version, such as:
1004e9554658Smrg# XORG_MACROS_VERSION(1.1)
1005e9554658Smrg#
1006e9554658Smrg# To force at least a version with this macro defined, also add:
1007e9554658Smrg# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1008e9554658Smrg#
1009e9554658Smrg#
1010e9554658Smrg# See the "minimum version" comment for each macro you use to see what 
1011e9554658Smrg# version you require.
1012e9554658SmrgAC_DEFUN([XORG_MACROS_VERSION],[
1013e9554658Smrg	[XORG_MACROS_needed_version=$1
1014e9554658Smrg	XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
1015e9554658Smrg	XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
1016e9554658Smrg	AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
1017e9554658Smrg	[XORG_MACROS_version=1.1.5
1018e9554658Smrg	XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
1019e9554658Smrg	XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
1020e9554658Smrg	if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
1021e9554658Smrg		AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
1022e9554658Smrg	fi
1023e9554658Smrg	if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
1024e9554658Smrg		AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
1025e9554658Smrg	fi
1026e9554658Smrg	AC_MSG_RESULT([yes, $XORG_MACROS_version])
1027e9554658Smrg]) # XORG_MACROS_VERSION
1028e9554658Smrg
1029e9554658Smrg# XORG_PROG_RAWCPP()
1030e9554658Smrg# ------------------
1031e9554658Smrg# Minimum version: 1.0.0
1032e9554658Smrg#
1033e9554658Smrg# Find cpp program and necessary flags for use in pre-processing text files
1034e9554658Smrg# such as man pages and config files
1035e9554658SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1036e9554658SmrgAC_REQUIRE([AC_PROG_CPP])
1037e9554658SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1038e9554658Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1039e9554658Smrg
1040e9554658Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1041e9554658Smrg# which is not the best choice for supporting other OS'es, but covers most
1042e9554658Smrg# of the ones we need for now.
1043e9554658SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1044e9554658SmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1045e9554658Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1046e9554658Smrg	AC_MSG_RESULT([no])
1047e9554658Smrgelse
1048e9554658Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1049e9554658Smrg		RAWCPPFLAGS=-undef
1050e9554658Smrg		AC_MSG_RESULT([yes])
1051e9554658Smrg	else
1052e9554658Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1053e9554658Smrg	fi
1054e9554658Smrgfi
1055e9554658Smrgrm -f conftest.$ac_ext
1056e9554658Smrg
1057e9554658SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1058e9554658SmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1059e9554658Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1060e9554658Smrg	AC_MSG_RESULT([no])
1061e9554658Smrgelse
1062e9554658Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1063e9554658Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1064e9554658Smrg		AC_MSG_RESULT([yes])
1065e9554658Smrg	else
1066e9554658Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1067e9554658Smrg	fi
1068e9554658Smrgfi
1069e9554658Smrgrm -f conftest.$ac_ext
1070e9554658SmrgAC_SUBST(RAWCPPFLAGS)
1071e9554658Smrg]) # XORG_PROG_RAWCPP
1072e9554658Smrg
1073e9554658Smrg# XORG_MANPAGE_SECTIONS()
1074e9554658Smrg# -----------------------
1075e9554658Smrg# Minimum version: 1.0.0
1076e9554658Smrg#
1077e9554658Smrg# Determine which sections man pages go in for the different man page types
1078e9554658Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1079e9554658Smrg# Not sure if there's any better way than just hardcoding by OS name.
1080e9554658Smrg# Override default settings by setting environment variables
1081e9554658Smrg
1082e9554658SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1083e9554658SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1084e9554658Smrg
1085e9554658Smrgif test x$APP_MAN_SUFFIX = x    ; then
1086e9554658Smrg    APP_MAN_SUFFIX=1
1087e9554658Smrgfi
1088e9554658Smrgif test x$APP_MAN_DIR = x    ; then
1089e9554658Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1090e9554658Smrgfi
1091e9554658Smrg
1092e9554658Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1093e9554658Smrg    LIB_MAN_SUFFIX=3
1094e9554658Smrgfi
1095e9554658Smrgif test x$LIB_MAN_DIR = x    ; then
1096e9554658Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1097e9554658Smrgfi
1098e9554658Smrg
1099e9554658Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1100e9554658Smrg    case $host_os in
1101e9554658Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1102e9554658Smrg	*)		FILE_MAN_SUFFIX=5  ;;
1103e9554658Smrg    esac
1104e9554658Smrgfi
1105e9554658Smrgif test x$FILE_MAN_DIR = x    ; then
1106e9554658Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1107e9554658Smrgfi
1108e9554658Smrg
1109e9554658Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1110e9554658Smrg    case $host_os in
1111e9554658Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1112e9554658Smrg	*)		MISC_MAN_SUFFIX=7  ;;
1113e9554658Smrg    esac
1114e9554658Smrgfi
1115e9554658Smrgif test x$MISC_MAN_DIR = x    ; then
1116e9554658Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1117e9554658Smrgfi
1118e9554658Smrg
1119e9554658Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1120e9554658Smrg    case $host_os in
1121e9554658Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1122e9554658Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1123e9554658Smrg    esac
1124e9554658Smrgfi
1125e9554658Smrgif test x$DRIVER_MAN_DIR = x    ; then
1126e9554658Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1127e9554658Smrgfi
1128e9554658Smrg
1129e9554658Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1130e9554658Smrg    case $host_os in
1131e9554658Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1132e9554658Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1133e9554658Smrg    esac
1134e9554658Smrgfi
1135e9554658Smrgif test x$ADMIN_MAN_DIR = x    ; then
1136e9554658Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1137e9554658Smrgfi
1138e9554658Smrg
1139e9554658Smrg
1140e9554658SmrgAC_SUBST([APP_MAN_SUFFIX])
1141e9554658SmrgAC_SUBST([LIB_MAN_SUFFIX])
1142e9554658SmrgAC_SUBST([FILE_MAN_SUFFIX])
1143e9554658SmrgAC_SUBST([MISC_MAN_SUFFIX])
1144e9554658SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1145e9554658SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1146e9554658SmrgAC_SUBST([APP_MAN_DIR])
1147e9554658SmrgAC_SUBST([LIB_MAN_DIR])
1148e9554658SmrgAC_SUBST([FILE_MAN_DIR])
1149e9554658SmrgAC_SUBST([MISC_MAN_DIR])
1150e9554658SmrgAC_SUBST([DRIVER_MAN_DIR])
1151e9554658SmrgAC_SUBST([ADMIN_MAN_DIR])
1152e9554658Smrg]) # XORG_MANPAGE_SECTIONS
1153e9554658Smrg
1154e9554658Smrg# XORG_CHECK_LINUXDOC
1155e9554658Smrg# -------------------
1156e9554658Smrg# Minimum version: 1.0.0
1157e9554658Smrg#
1158e9554658Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1159e9554658Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1160e9554658Smrg# Whether or not the necessary tools and files are found can be checked
1161e9554658Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1162e9554658SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1163e9554658SmrgXORG_SGML_PATH=$prefix/share/sgml
1164e9554658SmrgHAVE_DEFS_ENT=
1165e9554658Smrg
1166e9554658SmrgAC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1167e9554658Smrg
1168e9554658SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1169e9554658SmrgAC_PATH_PROG(PS2PDF, ps2pdf)
1170e9554658Smrg
1171e9554658SmrgAC_MSG_CHECKING([Whether to build documentation])
1172e9554658Smrg
1173e9554658Smrgif test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
1174e9554658Smrg   BUILDDOC=yes
1175e9554658Smrgelse
1176e9554658Smrg   BUILDDOC=no
1177e9554658Smrgfi
1178e9554658Smrg
1179e9554658SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1180e9554658Smrg
1181e9554658SmrgAC_MSG_RESULT([$BUILDDOC])
1182e9554658Smrg
1183e9554658SmrgAC_MSG_CHECKING([Whether to build pdf documentation])
1184e9554658Smrg
1185e9554658Smrgif test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
1186e9554658Smrg   BUILDPDFDOC=yes
1187e9554658Smrgelse
1188e9554658Smrg   BUILDPDFDOC=no
1189e9554658Smrgfi
1190e9554658Smrg
1191e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1192e9554658Smrg
1193e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1194e9554658Smrg
1195e9554658SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
1196e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1197e9554658SmrgMAKE_PDF="$PS2PDF"
1198e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1199e9554658Smrg
1200e9554658SmrgAC_SUBST(MAKE_TEXT)
1201e9554658SmrgAC_SUBST(MAKE_PS)
1202e9554658SmrgAC_SUBST(MAKE_PDF)
1203e9554658SmrgAC_SUBST(MAKE_HTML)
1204e9554658Smrg]) # XORG_CHECK_LINUXDOC
1205e9554658Smrg
1206e9554658Smrg# XORG_CHECK_DOCBOOK
1207e9554658Smrg# -------------------
1208e9554658Smrg# Minimum version: 1.0.0
1209e9554658Smrg#
1210e9554658Smrg# Checks for the ability to build output formats from SGML DocBook source.
1211e9554658Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1212e9554658Smrg# indicates whether the necessary tools and files are found and, if set,
1213e9554658Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1214e9554658SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1215e9554658SmrgXORG_SGML_PATH=$prefix/share/sgml
1216e9554658SmrgHAVE_DEFS_ENT=
1217e9554658SmrgBUILDTXTDOC=no
1218e9554658SmrgBUILDPDFDOC=no
1219e9554658SmrgBUILDPSDOC=no
1220e9554658SmrgBUILDHTMLDOC=no
1221e9554658Smrg
1222e9554658SmrgAC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
1223e9554658Smrg
1224e9554658SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1225e9554658SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1226e9554658SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1227e9554658SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1228e9554658Smrg
1229e9554658SmrgAC_MSG_CHECKING([Whether to build text documentation])
1230e9554658Smrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
1231e9554658Smrg   test x$BUILD_TXTDOC != xno; then
1232e9554658Smrg	BUILDTXTDOC=yes
1233e9554658Smrgfi
1234e9554658SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1235e9554658SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1236e9554658Smrg
1237e9554658SmrgAC_MSG_CHECKING([Whether to build PDF documentation])
1238e9554658Smrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
1239e9554658Smrg   test x$BUILD_PDFDOC != xno; then
1240e9554658Smrg	BUILDPDFDOC=yes
1241e9554658Smrgfi
1242e9554658SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1243e9554658SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1244e9554658Smrg
1245e9554658SmrgAC_MSG_CHECKING([Whether to build PostScript documentation])
1246e9554658Smrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
1247e9554658Smrg   test x$BUILD_PSDOC != xno; then
1248e9554658Smrg	BUILDPSDOC=yes
1249e9554658Smrgfi
1250e9554658SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1251e9554658SmrgAC_MSG_RESULT([$BUILDPSDOC])
1252e9554658Smrg
1253e9554658SmrgAC_MSG_CHECKING([Whether to build HTML documentation])
1254e9554658Smrgif test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
1255e9554658Smrg   test x$BUILD_HTMLDOC != xno; then
1256e9554658Smrg	BUILDHTMLDOC=yes
1257e9554658Smrgfi
1258e9554658SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1259e9554658SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1260e9554658Smrg
1261e9554658SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1262e9554658SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1263e9554658SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1264e9554658SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1265e9554658Smrg
1266e9554658SmrgAC_SUBST(MAKE_TEXT)
1267e9554658SmrgAC_SUBST(MAKE_PS)
1268e9554658SmrgAC_SUBST(MAKE_PDF)
1269e9554658SmrgAC_SUBST(MAKE_HTML)
1270e9554658Smrg]) # XORG_CHECK_DOCBOOK
1271e9554658Smrg
1272e9554658Smrg# XORG_CHECK_MALLOC_ZERO
1273e9554658Smrg# ----------------------
1274e9554658Smrg# Minimum version: 1.0.0
1275e9554658Smrg#
1276e9554658Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1277e9554658Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1278e9554658Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1279e9554658SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1280e9554658SmrgAC_ARG_ENABLE(malloc0returnsnull,
1281e9554658Smrg	AC_HELP_STRING([--enable-malloc0returnsnull],
1282e9554658Smrg		       [malloc(0) returns NULL (default: auto)]),
1283e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1284e9554658Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1285e9554658Smrg
1286e9554658SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1287e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1288e9554658Smrg	AC_RUN_IFELSE([
1289e9554658Smrgchar *malloc();
1290e9554658Smrgchar *realloc();
1291e9554658Smrgchar *calloc();
1292e9554658Smrgmain() {
1293e9554658Smrg    char *m0, *r0, *c0, *p;
1294e9554658Smrg    m0 = malloc(0);
1295e9554658Smrg    p = malloc(10);
1296e9554658Smrg    r0 = realloc(p,0);
1297e9554658Smrg    c0 = calloc(0);
1298e9554658Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1299e9554658Smrg}],
1300e9554658Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1301e9554658Smrg		[MALLOC_ZERO_RETURNS_NULL=no])
1302e9554658Smrgfi
1303e9554658SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1304e9554658Smrg
1305e9554658Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1306e9554658Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1307e9554658Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1308e9554658Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1309e9554658Smrgelse
1310e9554658Smrg	MALLOC_ZERO_CFLAGS=""
1311e9554658Smrg	XMALLOC_ZERO_CFLAGS=""
1312e9554658Smrg	XTMALLOC_ZERO_CFLAGS=""
1313e9554658Smrgfi
1314e9554658Smrg
1315e9554658SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1316e9554658SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1317e9554658SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1318e9554658Smrg]) # XORG_CHECK_MALLOC_ZERO
1319e9554658Smrg
1320e9554658Smrg# XORG_WITH_LINT()
1321e9554658Smrg# ----------------
1322e9554658Smrg# Minimum version: 1.1.0
1323e9554658Smrg#
1324e9554658Smrg# Sets up flags for source checkers such as lint and sparse if --with-lint
1325e9554658Smrg# is specified.   (Use --with-lint=sparse for sparse.)
1326e9554658Smrg# Sets $LINT to name of source checker passed with --with-lint (default: lint)
1327e9554658Smrg# Sets $LINT_FLAGS to flags to pass to source checker
1328e9554658Smrg# Sets LINT automake conditional if enabled (default: disabled)
1329e9554658Smrg#
1330e9554658SmrgAC_DEFUN([XORG_WITH_LINT],[
1331e9554658Smrg
1332e9554658Smrg# Allow checking code with lint, sparse, etc.
1333e9554658SmrgAC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
1334e9554658Smrg		[Use a lint-style source code checker (default: disabled)])],
1335e9554658Smrg		[use_lint=$withval], [use_lint=no])
1336e9554658Smrgif test "x$use_lint" = "xyes" ; then
1337e9554658Smrg	LINT="lint"
1338e9554658Smrgelse
1339e9554658Smrg	LINT="$use_lint"
1340e9554658Smrgfi
1341e9554658Smrgif test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
1342e9554658Smrg    case $LINT in
1343e9554658Smrg	lint|*/lint)
1344e9554658Smrg	    case $host_os in
1345e9554658Smrg		solaris*)
1346e9554658Smrg			LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1347e9554658Smrg			;;
1348e9554658Smrg	    esac
1349e9554658Smrg	    ;;
1350e9554658Smrg    esac
1351e9554658Smrgfi
1352e9554658Smrg
1353e9554658SmrgAC_SUBST(LINT)
1354e9554658SmrgAC_SUBST(LINT_FLAGS)
1355e9554658SmrgAM_CONDITIONAL(LINT, [test x$LINT != xno])
1356e9554658Smrg
1357e9554658Smrg]) # XORG_WITH_LINT
1358e9554658Smrg
1359e9554658Smrg# XORG_LINT_LIBRARY(LIBNAME)
1360e9554658Smrg# --------------------------
1361e9554658Smrg# Minimum version: 1.1.0
1362e9554658Smrg#
1363e9554658Smrg# Sets up flags for building lint libraries for checking programs that call
1364e9554658Smrg# functions in the library.
1365e9554658Smrg# Disabled by default, enable with --enable-lint-library
1366e9554658Smrg# Sets: 
1367e9554658Smrg#	@LINTLIB@		- name of lint library file to make
1368e9554658Smrg#	MAKE_LINT_LIB		- automake conditional
1369e9554658Smrg#
1370e9554658Smrg
1371e9554658SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1372e9554658SmrgAC_REQUIRE([XORG_WITH_LINT])
1373e9554658Smrg# Build lint "library" for more indepth checks of programs calling this library
1374e9554658SmrgAC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
1375e9554658Smrg	[Create lint library (default: disabled)])],
1376e9554658Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1377e9554658Smrgif test "x$make_lint_lib" != "xno" ; then
1378e9554658Smrg	if test "x$LINT" = "xno" ; then
1379e9554658Smrg		AC_MSG_ERROR([Cannot make lint library without --with-lint])
1380e9554658Smrg	fi
1381e9554658Smrg	if test "x$make_lint_lib" = "xyes" ; then
1382e9554658Smrg		LINTLIB=llib-l$1.ln
1383e9554658Smrg	else
1384e9554658Smrg		LINTLIB=$make_lint_lib
1385e9554658Smrg	fi
1386e9554658Smrgfi
1387e9554658SmrgAC_SUBST(LINTLIB)
1388e9554658SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1389e9554658Smrg
1390e9554658Smrg]) # XORG_LINT_LIBRARY
1391e9554658Smrg
1392e9554658Smrgdnl Copyright 2005 Red Hat, Inc
1393e9554658Smrgdnl
1394e9554658Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1395e9554658Smrgdnl documentation for any purpose is hereby granted without fee, provided that
1396e9554658Smrgdnl the above copyright notice appear in all copies and that both that
1397e9554658Smrgdnl copyright notice and this permission notice appear in supporting
1398e9554658Smrgdnl documentation.
1399e9554658Smrgdnl
1400e9554658Smrgdnl The above copyright notice and this permission notice shall be included
1401e9554658Smrgdnl in all copies or substantial portions of the Software.
1402e9554658Smrgdnl
1403e9554658Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1404e9554658Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1405e9554658Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1406e9554658Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1407e9554658Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1408e9554658Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1409e9554658Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
1410e9554658Smrgdnl
1411e9554658Smrgdnl Except as contained in this notice, the name of the copyright holders shall
1412e9554658Smrgdnl not be used in advertising or otherwise to promote the sale, use or
1413e9554658Smrgdnl other dealings in this Software without prior written authorization
1414e9554658Smrgdnl from the copyright holders.
1415e9554658Smrgdnl
1416e9554658Smrg
1417e9554658Smrg# XORG_RELEASE_VERSION
1418e9554658Smrg# --------------------
1419e9554658Smrg# Adds --with/without-release-string and changes the PACKAGE and
1420e9554658Smrg# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION".  If
1421e9554658Smrg# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged.  Also
1422e9554658Smrg# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
1423e9554658Smrg 
1424e9554658SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
1425e9554658Smrg	AC_ARG_WITH(release-version,
1426e9554658Smrg			AC_HELP_STRING([--with-release-version=STRING],
1427e9554658Smrg				[Use release version string in package name]),
1428e9554658Smrg			[RELEASE_VERSION="$withval"],
1429e9554658Smrg			[RELEASE_VERSION=""])
1430e9554658Smrg	if test "x$RELEASE_VERSION" != "x"; then
1431e9554658Smrg		PACKAGE="$PACKAGE-$RELEASE_VERSION"
1432e9554658Smrg		PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
1433e9554658Smrg		AC_MSG_NOTICE([Building with package name set to $PACKAGE])
1434e9554658Smrg	fi
1435e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
1436e9554658Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
1437e9554658Smrg		[Major version of this package])
1438e9554658Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2`
1439e9554658Smrg	if test "x$PVM" = "x"; then
1440e9554658Smrg		PVM="0"
1441e9554658Smrg	fi
1442e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
1443e9554658Smrg		[$PVM],
1444e9554658Smrg		[Minor version of this package])
1445e9554658Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3`
1446e9554658Smrg	if test "x$PVP" = "x"; then
1447e9554658Smrg		PVP="0"
1448e9554658Smrg	fi
1449e9554658Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
1450e9554658Smrg		[$PVP],
1451e9554658Smrg		[Patch version of this package])
1452e9554658Smrg])
1453e9554658Smrg
1454e9554658Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1455e9554658Smrg# 
1456e9554658Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1457e9554658Smrg#
1458e9554658Smrg# This program is free software; you can redistribute it and/or modify
1459e9554658Smrg# it under the terms of the GNU General Public License as published by
1460e9554658Smrg# the Free Software Foundation; either version 2 of the License, or
1461e9554658Smrg# (at your option) any later version.
1462e9554658Smrg#
1463e9554658Smrg# This program is distributed in the hope that it will be useful, but
1464e9554658Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1465e9554658Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1466e9554658Smrg# General Public License for more details.
1467e9554658Smrg#
1468e9554658Smrg# You should have received a copy of the GNU General Public License
1469e9554658Smrg# along with this program; if not, write to the Free Software
1470e9554658Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1471e9554658Smrg#
1472e9554658Smrg# As a special exception to the GNU General Public License, if you
1473e9554658Smrg# distribute this file as part of a program that contains a
1474e9554658Smrg# configuration script generated by Autoconf, you may include it under
1475e9554658Smrg# the same distribution terms that you use for the rest of that program.
1476e9554658Smrg
1477e9554658Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1478e9554658Smrg# ----------------------------------
1479e9554658SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1480e9554658Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1481e9554658Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1482e9554658SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1483e9554658Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1484e9554658Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1485e9554658Smrgfi
1486e9554658Smrgif test -n "$PKG_CONFIG"; then
1487e9554658Smrg	_pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
1488e9554658Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1489e9554658Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1490e9554658Smrg		AC_MSG_RESULT([yes])
1491e9554658Smrg	else
1492e9554658Smrg		AC_MSG_RESULT([no])
1493e9554658Smrg		PKG_CONFIG=""
1494e9554658Smrg	fi
1495e9554658Smrg		
1496e9554658Smrgfi[]dnl
1497e9554658Smrg])# PKG_PROG_PKG_CONFIG
1498e9554658Smrg
1499e9554658Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1500e9554658Smrg#
1501e9554658Smrg# Check to see whether a particular set of modules exists.  Similar
1502e9554658Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1503e9554658Smrg#
1504e9554658Smrg#
1505e9554658Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1506e9554658Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1507e9554658Smrg# PKG_CHECK_EXISTS manually
1508e9554658Smrg# --------------------------------------------------------------
1509e9554658SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1510e9554658Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1511e9554658Smrgif test -n "$PKG_CONFIG" && \
1512e9554658Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1513e9554658Smrg  m4_ifval([$2], [$2], [:])
1514e9554658Smrgm4_ifvaln([$3], [else
1515e9554658Smrg  $3])dnl
1516e9554658Smrgfi])
1517e9554658Smrg
1518e9554658Smrg
1519e9554658Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1520e9554658Smrg# ---------------------------------------------
1521e9554658Smrgm4_define([_PKG_CONFIG],
1522e9554658Smrg[if test -n "$PKG_CONFIG"; then
1523e9554658Smrg        PKG_CHECK_EXISTS([$3],
1524e9554658Smrg                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1525e9554658Smrg			 [pkg_failed=yes])
1526e9554658Smrgelse
1527e9554658Smrg	pkg_failed=untried
1528e9554658Smrgfi[]dnl
1529e9554658Smrg])# _PKG_CONFIG
1530e9554658Smrg
1531e9554658Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1532e9554658Smrg# [ACTION-IF-NOT-FOUND])
1533e9554658Smrg#
1534e9554658Smrg#
1535e9554658Smrg# Note that if there is a possibility the first call to
1536e9554658Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1537e9554658Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1538e9554658Smrg#
1539e9554658Smrg#
1540e9554658Smrg# --------------------------------------------------------------
1541e9554658SmrgAC_DEFUN([PKG_CHECK_MODULES],
1542e9554658Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1543e9554658SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1544e9554658SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1545e9554658Smrg
1546e9554658Smrgpkg_failed=no
1547e9554658SmrgAC_MSG_CHECKING([for $1])
1548e9554658Smrg
1549e9554658Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1550e9554658Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1551e9554658Smrg
1552e9554658Smrgif test $pkg_failed = yes; then
1553e9554658Smrg	$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1554e9554658Smrg	# Put the nasty error message in config.log where it belongs
1555e9554658Smrg	echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
1556e9554658Smrg
1557e9554658Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1558e9554658Smrg[Package requirements ($2) were not met.
1559e9554658SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1560e9554658Smrginstalled software in a non-standard prefix.
1561e9554658Smrg
1562e9554658SmrgAlternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1563e9554658Smrgto avoid the need to call pkg-config.  See the pkg-config man page for
1564e9554658Smrgmore details.])],
1565e9554658Smrg		[$4])
1566e9554658Smrgelif test $pkg_failed = untried; then
1567e9554658Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1568e9554658Smrg[The pkg-config script could not be found or is too old.  Make sure it
1569e9554658Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1570e9554658Smrgpath to pkg-config.
1571e9554658Smrg
1572e9554658SmrgAlternatively you may set the $1_CFLAGS and $1_LIBS environment variables
1573e9554658Smrgto avoid the need to call pkg-config.  See the pkg-config man page for
1574e9554658Smrgmore details.
1575e9554658Smrg
1576e9554658SmrgTo get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
1577e9554658Smrg		[$4])
1578e9554658Smrgelse
1579e9554658Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1580e9554658Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1581e9554658Smrg        AC_MSG_RESULT([yes])
1582e9554658Smrg	ifelse([$3], , :, [$3])
1583e9554658Smrgfi[]dnl
1584e9554658Smrg])# PKG_CHECK_MODULES
1585e9554658Smrg
1586