aclocal.m4 revision 48e69166
148e69166Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2fd0c672fSmrg
3fd0c672fSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
448e69166Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5fd0c672fSmrg# This file is free software; the Free Software Foundation
6fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
7fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
8fd0c672fSmrg
9fd0c672fSmrg# This program is distributed in the hope that it will be useful,
10fd0c672fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fd0c672fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fd0c672fSmrg# PARTICULAR PURPOSE.
13fd0c672fSmrg
1448e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1548e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1648e69166Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1748e69166Smrg[m4_warning([this file was generated for autoconf 2.68.
1848e69166SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
1948e69166SmrgIf you have problems, you may need to regenerate the build system entirely.
2048e69166SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2148e69166Smrg
2248e69166Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23fd0c672fSmrg#
24fd0c672fSmrg# This file is free software; the Free Software Foundation
25fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
26fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
27fd0c672fSmrg
28fd0c672fSmrg# AM_AUTOMAKE_VERSION(VERSION)
29fd0c672fSmrg# ----------------------------
30fd0c672fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31fd0c672fSmrg# generated from the m4 files accompanying Automake X.Y.
3248e69166Smrg# (This private macro should not be called outside this file.)
3348e69166SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3448e69166Smrg[am__api_version='1.11'
3548e69166Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3648e69166Smrgdnl require some minimum version.  Point them to the right macro.
3748e69166Smrgm4_if([$1], [1.11.1], [],
3848e69166Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3948e69166Smrg])
4048e69166Smrg
4148e69166Smrg# _AM_AUTOCONF_VERSION(VERSION)
4248e69166Smrg# -----------------------------
4348e69166Smrg# aclocal traces this macro to find the Autoconf version.
4448e69166Smrg# This is a private macro too.  Using m4_define simplifies
4548e69166Smrg# the logic in aclocal, which can simply ignore this definition.
4648e69166Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47fd0c672fSmrg
48fd0c672fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49fd0c672fSmrg# -------------------------------
5048e69166Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5148e69166Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52fd0c672fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5348e69166Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
5448e69166Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5548e69166Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5648e69166Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57fd0c672fSmrg
58fd0c672fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59fd0c672fSmrg
60fd0c672fSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61fd0c672fSmrg#
62fd0c672fSmrg# This file is free software; the Free Software Foundation
63fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
64fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
65fd0c672fSmrg
66fd0c672fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67fd0c672fSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68fd0c672fSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69fd0c672fSmrg#
70fd0c672fSmrg# Of course, Automake must honor this variable whenever it calls a
71fd0c672fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72fd0c672fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73fd0c672fSmrg# depending on how configure is run.  This is pretty annoying, since
74fd0c672fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75fd0c672fSmrg# source directory, any form will work fine, but in subdirectories a
76fd0c672fSmrg# relative path needs to be adjusted first.
77fd0c672fSmrg#
78fd0c672fSmrg# $ac_aux_dir/missing
79fd0c672fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80fd0c672fSmrg# $top_srcdir/$ac_aux_dir/missing
81fd0c672fSmrg#    fails if $ac_aux_dir is absolute,
82fd0c672fSmrg#    fails when called from a subdirectory in a VPATH build with
83fd0c672fSmrg#          a relative $ac_aux_dir
84fd0c672fSmrg#
85fd0c672fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86fd0c672fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
87fd0c672fSmrg# harmless because $srcdir is `.', but things will broke when you
88fd0c672fSmrg# start a VPATH build or use an absolute $srcdir.
89fd0c672fSmrg#
90fd0c672fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91fd0c672fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92fd0c672fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93fd0c672fSmrg# and then we would define $MISSING as
94fd0c672fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95fd0c672fSmrg# This will work as long as MISSING is not called from configure, because
96fd0c672fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
97fd0c672fSmrg# However there are other variables, like CC, which are often used in
98fd0c672fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99fd0c672fSmrg#
100fd0c672fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
101fd0c672fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
102fd0c672fSmrg# configured tree to be moved without reconfiguration.
103fd0c672fSmrg
104fd0c672fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
105fd0c672fSmrg[dnl Rely on autoconf to set up CDPATH properly.
106fd0c672fSmrgAC_PREREQ([2.50])dnl
107fd0c672fSmrg# expand $ac_aux_dir to an absolute path
108fd0c672fSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
109fd0c672fSmrg])
110fd0c672fSmrg
111fd0c672fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112fd0c672fSmrg
11348e69166Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
114fd0c672fSmrg# Free Software Foundation, Inc.
115fd0c672fSmrg#
116fd0c672fSmrg# This file is free software; the Free Software Foundation
117fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
118fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
119fd0c672fSmrg
12048e69166Smrg# serial 9
121fd0c672fSmrg
122fd0c672fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
123fd0c672fSmrg# -------------------------------------
124fd0c672fSmrg# Define a conditional.
125fd0c672fSmrgAC_DEFUN([AM_CONDITIONAL],
126fd0c672fSmrg[AC_PREREQ(2.52)dnl
127fd0c672fSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
128fd0c672fSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12948e69166SmrgAC_SUBST([$1_TRUE])dnl
13048e69166SmrgAC_SUBST([$1_FALSE])dnl
13148e69166Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13248e69166Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13348e69166Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
134fd0c672fSmrgif $2; then
135fd0c672fSmrg  $1_TRUE=
136fd0c672fSmrg  $1_FALSE='#'
137fd0c672fSmrgelse
138fd0c672fSmrg  $1_TRUE='#'
139fd0c672fSmrg  $1_FALSE=
140fd0c672fSmrgfi
141fd0c672fSmrgAC_CONFIG_COMMANDS_PRE(
142fd0c672fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
143fd0c672fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
144fd0c672fSmrgUsually this means the macro was only invoked conditionally.]])
145fd0c672fSmrgfi])])
146fd0c672fSmrg
14748e69166Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
148fd0c672fSmrg# Free Software Foundation, Inc.
149fd0c672fSmrg#
150fd0c672fSmrg# This file is free software; the Free Software Foundation
151fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
152fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
153fd0c672fSmrg
15448e69166Smrg# serial 10
155fd0c672fSmrg
156fd0c672fSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157fd0c672fSmrg# written in clear, in which case automake, when reading aclocal.m4,
158fd0c672fSmrg# will think it sees a *use*, and therefore will trigger all it's
159fd0c672fSmrg# C support machinery.  Also note that it means that autoscan, seeing
160fd0c672fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161fd0c672fSmrg
162fd0c672fSmrg
163fd0c672fSmrg# _AM_DEPENDENCIES(NAME)
164fd0c672fSmrg# ----------------------
165fd0c672fSmrg# See how the compiler implements dependency checking.
166fd0c672fSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167fd0c672fSmrg# We try a few techniques and use that to set a single cache variable.
168fd0c672fSmrg#
169fd0c672fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170fd0c672fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171fd0c672fSmrg# dependency, and given that the user is not expected to run this macro,
172fd0c672fSmrg# just rely on AC_PROG_CC.
173fd0c672fSmrgAC_DEFUN([_AM_DEPENDENCIES],
174fd0c672fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175fd0c672fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176fd0c672fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177fd0c672fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178fd0c672fSmrg
179fd0c672fSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180fd0c672fSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181fd0c672fSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18248e69166Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183fd0c672fSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184fd0c672fSmrg                   [depcc="$$1"   am_compiler_list=])
185fd0c672fSmrg
186fd0c672fSmrgAC_CACHE_CHECK([dependency style of $depcc],
187fd0c672fSmrg               [am_cv_$1_dependencies_compiler_type],
188fd0c672fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189fd0c672fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
190fd0c672fSmrg  # making bogus files that we don't know about and never remove.  For
191fd0c672fSmrg  # instance it was reported that on HP-UX the gcc test will end up
192fd0c672fSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
193fd0c672fSmrg  # in D'.
194fd0c672fSmrg  mkdir conftest.dir
195fd0c672fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196fd0c672fSmrg  # using a relative directory.
197fd0c672fSmrg  cp "$am_depcomp" conftest.dir
198fd0c672fSmrg  cd conftest.dir
199fd0c672fSmrg  # We will build objects and dependencies in a subdirectory because
200fd0c672fSmrg  # it helps to detect inapplicable dependency modes.  For instance
201fd0c672fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202fd0c672fSmrg  # side effect of compilation, but ICC will put the dependencies in
203fd0c672fSmrg  # the current directory while Tru64 will put them in the object
204fd0c672fSmrg  # directory.
205fd0c672fSmrg  mkdir sub
206fd0c672fSmrg
207fd0c672fSmrg  am_cv_$1_dependencies_compiler_type=none
208fd0c672fSmrg  if test "$am_compiler_list" = ""; then
209fd0c672fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210fd0c672fSmrg  fi
21148e69166Smrg  am__universal=false
21248e69166Smrg  m4_case([$1], [CC],
21348e69166Smrg    [case " $depcc " in #(
21448e69166Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21548e69166Smrg     esac],
21648e69166Smrg    [CXX],
21748e69166Smrg    [case " $depcc " in #(
21848e69166Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21948e69166Smrg     esac])
22048e69166Smrg
221fd0c672fSmrg  for depmode in $am_compiler_list; do
222fd0c672fSmrg    # Setup a source with many dependencies, because some compilers
223fd0c672fSmrg    # like to wrap large dependency lists on column 80 (with \), and
224fd0c672fSmrg    # we should not choose a depcomp mode which is confused by this.
225fd0c672fSmrg    #
226fd0c672fSmrg    # We need to recreate these files for each test, as the compiler may
227fd0c672fSmrg    # overwrite some of them when testing with obscure command lines.
228fd0c672fSmrg    # This happens at least with the AIX C compiler.
229fd0c672fSmrg    : > sub/conftest.c
230fd0c672fSmrg    for i in 1 2 3 4 5 6; do
231fd0c672fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
232fd0c672fSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
233fd0c672fSmrg      # Solaris 8's {/usr,}/bin/sh.
234fd0c672fSmrg      touch sub/conftst$i.h
235fd0c672fSmrg    done
236fd0c672fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237fd0c672fSmrg
23848e69166Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
23948e69166Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24048e69166Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24148e69166Smrg    # versions had trouble with output in subdirs
24248e69166Smrg    am__obj=sub/conftest.${OBJEXT-o}
24348e69166Smrg    am__minus_obj="-o $am__obj"
244fd0c672fSmrg    case $depmode in
24548e69166Smrg    gcc)
24648e69166Smrg      # This depmode causes a compiler race in universal mode.
24748e69166Smrg      test "$am__universal" = false || continue
24848e69166Smrg      ;;
249fd0c672fSmrg    nosideeffect)
250fd0c672fSmrg      # after this tag, mechanisms are not by side-effect, so they'll
251fd0c672fSmrg      # only be used when explicitly requested
252fd0c672fSmrg      if test "x$enable_dependency_tracking" = xyes; then
253fd0c672fSmrg	continue
254fd0c672fSmrg      else
255fd0c672fSmrg	break
256fd0c672fSmrg      fi
257fd0c672fSmrg      ;;
25848e69166Smrg    msvisualcpp | msvcmsys)
25948e69166Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26048e69166Smrg      # not run yet.  These depmodes are late enough in the game, and
26148e69166Smrg      # so weak that their functioning should not be impacted.
26248e69166Smrg      am__obj=conftest.${OBJEXT-o}
26348e69166Smrg      am__minus_obj=
26448e69166Smrg      ;;
265fd0c672fSmrg    none) break ;;
266fd0c672fSmrg    esac
267fd0c672fSmrg    if depmode=$depmode \
26848e69166Smrg       source=sub/conftest.c object=$am__obj \
269fd0c672fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27048e69166Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271fd0c672fSmrg         >/dev/null 2>conftest.err &&
27248e69166Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273fd0c672fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27448e69166Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275fd0c672fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276fd0c672fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
277fd0c672fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
278fd0c672fSmrg      # that says an option was ignored or not supported.
279fd0c672fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
280fd0c672fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
281fd0c672fSmrg      # The diagnosis changed in icc 8.0:
282fd0c672fSmrg      #   icc: Command line remark: option '-MP' not supported
283fd0c672fSmrg      if (grep 'ignoring option' conftest.err ||
284fd0c672fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285fd0c672fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
286fd0c672fSmrg        break
287fd0c672fSmrg      fi
288fd0c672fSmrg    fi
289fd0c672fSmrg  done
290fd0c672fSmrg
291fd0c672fSmrg  cd ..
292fd0c672fSmrg  rm -rf conftest.dir
293fd0c672fSmrgelse
294fd0c672fSmrg  am_cv_$1_dependencies_compiler_type=none
295fd0c672fSmrgfi
296fd0c672fSmrg])
297fd0c672fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298fd0c672fSmrgAM_CONDITIONAL([am__fastdep$1], [
299fd0c672fSmrg  test "x$enable_dependency_tracking" != xno \
300fd0c672fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301fd0c672fSmrg])
302fd0c672fSmrg
303fd0c672fSmrg
304fd0c672fSmrg# AM_SET_DEPDIR
305fd0c672fSmrg# -------------
306fd0c672fSmrg# Choose a directory name for dependency files.
307fd0c672fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308fd0c672fSmrgAC_DEFUN([AM_SET_DEPDIR],
309fd0c672fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310fd0c672fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311fd0c672fSmrg])
312fd0c672fSmrg
313fd0c672fSmrg
314fd0c672fSmrg# AM_DEP_TRACK
315fd0c672fSmrg# ------------
316fd0c672fSmrgAC_DEFUN([AM_DEP_TRACK],
317fd0c672fSmrg[AC_ARG_ENABLE(dependency-tracking,
318fd0c672fSmrg[  --disable-dependency-tracking  speeds up one-time build
319fd0c672fSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320fd0c672fSmrgif test "x$enable_dependency_tracking" != xno; then
321fd0c672fSmrg  am_depcomp="$ac_aux_dir/depcomp"
322fd0c672fSmrg  AMDEPBACKSLASH='\'
323fd0c672fSmrgfi
324fd0c672fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32548e69166SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32648e69166Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327fd0c672fSmrg])
328fd0c672fSmrg
329fd0c672fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330fd0c672fSmrg
33148e69166Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
332fd0c672fSmrg# Free Software Foundation, Inc.
333fd0c672fSmrg#
334fd0c672fSmrg# This file is free software; the Free Software Foundation
335fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
336fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
337fd0c672fSmrg
33848e69166Smrg#serial 5
339fd0c672fSmrg
340fd0c672fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341fd0c672fSmrg# ------------------------------
342fd0c672fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34348e69166Smrg[{
34448e69166Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
34548e69166Smrg  # are listed without --file.  Let's play safe and only enable the eval
34648e69166Smrg  # if we detect the quoting.
34748e69166Smrg  case $CONFIG_FILES in
34848e69166Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
34948e69166Smrg  *)   set x $CONFIG_FILES ;;
35048e69166Smrg  esac
35148e69166Smrg  shift
35248e69166Smrg  for mf
35348e69166Smrg  do
35448e69166Smrg    # Strip MF so we end up with the name of the file.
35548e69166Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35648e69166Smrg    # Check whether this is an Automake generated Makefile or not.
35748e69166Smrg    # We used to match only the files named `Makefile.in', but
35848e69166Smrg    # some people rename them; so instead we look at the file content.
35948e69166Smrg    # Grep'ing the first line is not enough: some people post-process
36048e69166Smrg    # each Makefile.in and add a new line on top of each file to say so.
36148e69166Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36248e69166Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36348e69166Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36448e69166Smrg      dirpart=`AS_DIRNAME("$mf")`
36548e69166Smrg    else
36648e69166Smrg      continue
36748e69166Smrg    fi
36848e69166Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
36948e69166Smrg    # from the Makefile without running `make'.
37048e69166Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37148e69166Smrg    test -z "$DEPDIR" && continue
37248e69166Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37348e69166Smrg    test -z "am__include" && continue
37448e69166Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37548e69166Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
37648e69166Smrg    U=`sed -n 's/^U = //p' < "$mf"`
37748e69166Smrg    # Find all dependency output files, they are included files with
37848e69166Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37948e69166Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38048e69166Smrg    # expansion.
38148e69166Smrg    for file in `sed -n "
38248e69166Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38348e69166Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
38448e69166Smrg      # Make sure the directory exists.
38548e69166Smrg      test -f "$dirpart/$file" && continue
38648e69166Smrg      fdir=`AS_DIRNAME(["$file"])`
38748e69166Smrg      AS_MKDIR_P([$dirpart/$fdir])
38848e69166Smrg      # echo "creating $dirpart/$file"
38948e69166Smrg      echo '# dummy' > "$dirpart/$file"
39048e69166Smrg    done
391fd0c672fSmrg  done
39248e69166Smrg}
393fd0c672fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394fd0c672fSmrg
395fd0c672fSmrg
396fd0c672fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397fd0c672fSmrg# -----------------------------
398fd0c672fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
399fd0c672fSmrg#
400fd0c672fSmrg# This code is only required when automatic dependency tracking
401fd0c672fSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
402fd0c672fSmrg# need in order to bootstrap the dependency handling code.
403fd0c672fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404fd0c672fSmrg[AC_CONFIG_COMMANDS([depfiles],
405fd0c672fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406fd0c672fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407fd0c672fSmrg])
408fd0c672fSmrg
409fd0c672fSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
410fd0c672fSmrg# Free Software Foundation, Inc.
411fd0c672fSmrg#
412fd0c672fSmrg# This file is free software; the Free Software Foundation
413fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
414fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
415fd0c672fSmrg
416fd0c672fSmrg# serial 8
417fd0c672fSmrg
418fd0c672fSmrg# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
419fd0c672fSmrgAU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
420fd0c672fSmrg
421fd0c672fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
422fd0c672fSmrg
42348e69166Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42448e69166Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
425fd0c672fSmrg#
426fd0c672fSmrg# This file is free software; the Free Software Foundation
427fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
428fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
429fd0c672fSmrg
43048e69166Smrg# serial 16
431fd0c672fSmrg
432fd0c672fSmrg# This macro actually does too much.  Some checks are only needed if
433fd0c672fSmrg# your package does certain things.  But this isn't really a big deal.
434fd0c672fSmrg
435fd0c672fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
436fd0c672fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
437fd0c672fSmrg# -----------------------------------------------
438fd0c672fSmrg# The call with PACKAGE and VERSION arguments is the old style
439fd0c672fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
440fd0c672fSmrg# and VERSION should now be passed to AC_INIT and removed from
441fd0c672fSmrg# the call to AM_INIT_AUTOMAKE.
442fd0c672fSmrg# We support both call styles for the transition.  After
443fd0c672fSmrg# the next Automake release, Autoconf can make the AC_INIT
444fd0c672fSmrg# arguments mandatory, and then we can depend on a new Autoconf
445fd0c672fSmrg# release and drop the old call support.
446fd0c672fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44748e69166Smrg[AC_PREREQ([2.62])dnl
448fd0c672fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
449fd0c672fSmrgdnl the ones we care about.
450fd0c672fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
451fd0c672fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
452fd0c672fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
45348e69166Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
45448e69166Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
45548e69166Smrg  # is not polluted with repeated "-I."
45648e69166Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
45748e69166Smrg  # test to see if srcdir already configured
45848e69166Smrg  if test -f $srcdir/config.status; then
45948e69166Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
46048e69166Smrg  fi
461fd0c672fSmrgfi
462fd0c672fSmrg
463fd0c672fSmrg# test whether we have cygpath
464fd0c672fSmrgif test -z "$CYGPATH_W"; then
465fd0c672fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
466fd0c672fSmrg    CYGPATH_W='cygpath -w'
467fd0c672fSmrg  else
468fd0c672fSmrg    CYGPATH_W=echo
469fd0c672fSmrg  fi
470fd0c672fSmrgfi
471fd0c672fSmrgAC_SUBST([CYGPATH_W])
472fd0c672fSmrg
473fd0c672fSmrg# Define the identity of the package.
474fd0c672fSmrgdnl Distinguish between old-style and new-style calls.
475fd0c672fSmrgm4_ifval([$2],
476fd0c672fSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
477fd0c672fSmrg AC_SUBST([PACKAGE], [$1])dnl
478fd0c672fSmrg AC_SUBST([VERSION], [$2])],
479fd0c672fSmrg[_AM_SET_OPTIONS([$1])dnl
48048e69166Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
48148e69166Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
48248e69166Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
483fd0c672fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
484fd0c672fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
485fd0c672fSmrg
486fd0c672fSmrg_AM_IF_OPTION([no-define],,
487fd0c672fSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
488fd0c672fSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
489fd0c672fSmrg
490fd0c672fSmrg# Some tools Automake needs.
491fd0c672fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
492fd0c672fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
493fd0c672fSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
494fd0c672fSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
495fd0c672fSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
496fd0c672fSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
497fd0c672fSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49848e69166SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49948e69166SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
500fd0c672fSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
501fd0c672fSmrg# We need awk for the "check" target.  The system "awk" is bad on
502fd0c672fSmrg# some platforms.
503fd0c672fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
504fd0c672fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
505fd0c672fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
506fd0c672fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50748e69166Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50848e69166Smrg			     [_AM_PROG_TAR([v7])])])
509fd0c672fSmrg_AM_IF_OPTION([no-dependencies],,
510fd0c672fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51148e69166Smrg		  [_AM_DEPENDENCIES(CC)],
51248e69166Smrg		  [define([AC_PROG_CC],
51348e69166Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
514fd0c672fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51548e69166Smrg		  [_AM_DEPENDENCIES(CXX)],
51648e69166Smrg		  [define([AC_PROG_CXX],
51748e69166Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
51848e69166SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51948e69166Smrg		  [_AM_DEPENDENCIES(OBJC)],
52048e69166Smrg		  [define([AC_PROG_OBJC],
52148e69166Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
522fd0c672fSmrg])
52348e69166Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52448e69166Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52548e69166Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52648e69166Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52748e69166SmrgAC_CONFIG_COMMANDS_PRE(dnl
52848e69166Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52948e69166Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
530fd0c672fSmrg])
531fd0c672fSmrg
53248e69166Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53348e69166Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53448e69166Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53548e69166Smrgm4_define([_AC_COMPILER_EXEEXT],
53648e69166Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
53748e69166Smrg
538fd0c672fSmrg
539fd0c672fSmrg# When config.status generates a header, we must update the stamp-h file.
540fd0c672fSmrg# This file resides in the same directory as the config header
541fd0c672fSmrg# that is generated.  The stamp files are numbered to have different names.
542fd0c672fSmrg
543fd0c672fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
544fd0c672fSmrg# loop where config.status creates the headers, so we can generate
545fd0c672fSmrg# our stamp files there.
546fd0c672fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
547fd0c672fSmrg[# Compute $1's index in $config_headers.
54848e69166Smrg_am_arg=$1
549fd0c672fSmrg_am_stamp_count=1
550fd0c672fSmrgfor _am_header in $config_headers :; do
551fd0c672fSmrg  case $_am_header in
55248e69166Smrg    $_am_arg | $_am_arg:* )
553fd0c672fSmrg      break ;;
554fd0c672fSmrg    * )
555fd0c672fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
556fd0c672fSmrg  esac
557fd0c672fSmrgdone
55848e69166Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
559fd0c672fSmrg
56048e69166Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
561fd0c672fSmrg#
562fd0c672fSmrg# This file is free software; the Free Software Foundation
563fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
564fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
565fd0c672fSmrg
566fd0c672fSmrg# AM_PROG_INSTALL_SH
567fd0c672fSmrg# ------------------
568fd0c672fSmrg# Define $install_sh.
569fd0c672fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
570fd0c672fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57148e69166Smrgif test x"${install_sh}" != xset; then
57248e69166Smrg  case $am_aux_dir in
57348e69166Smrg  *\ * | *\	*)
57448e69166Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57548e69166Smrg  *)
57648e69166Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57748e69166Smrg  esac
57848e69166Smrgfi
579fd0c672fSmrgAC_SUBST(install_sh)])
580fd0c672fSmrg
581fd0c672fSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
582fd0c672fSmrg#
583fd0c672fSmrg# This file is free software; the Free Software Foundation
584fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
585fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
586fd0c672fSmrg
587fd0c672fSmrg# serial 2
588fd0c672fSmrg
589fd0c672fSmrg# Check whether the underlying file-system supports filenames
590fd0c672fSmrg# with a leading dot.  For instance MS-DOS doesn't.
591fd0c672fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
592fd0c672fSmrg[rm -rf .tst 2>/dev/null
593fd0c672fSmrgmkdir .tst 2>/dev/null
594fd0c672fSmrgif test -d .tst; then
595fd0c672fSmrg  am__leading_dot=.
596fd0c672fSmrgelse
597fd0c672fSmrg  am__leading_dot=_
598fd0c672fSmrgfi
599fd0c672fSmrgrmdir .tst 2>/dev/null
600fd0c672fSmrgAC_SUBST([am__leading_dot])])
601fd0c672fSmrg
602fd0c672fSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
603fd0c672fSmrg# From Jim Meyering
604fd0c672fSmrg
60548e69166Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
606fd0c672fSmrg# Free Software Foundation, Inc.
607fd0c672fSmrg#
608fd0c672fSmrg# This file is free software; the Free Software Foundation
609fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
610fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
611fd0c672fSmrg
61248e69166Smrg# serial 5
613fd0c672fSmrg
61448e69166Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61548e69166Smrg# ----------------------------------
61648e69166Smrg# Control maintainer-specific portions of Makefiles.
61748e69166Smrg# Default is to disable them, unless `enable' is passed literally.
61848e69166Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
61948e69166Smrg# can override the default with the --enable/--disable switch.
620fd0c672fSmrgAC_DEFUN([AM_MAINTAINER_MODE],
62148e69166Smrg[m4_case(m4_default([$1], [disable]),
62248e69166Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
62348e69166Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
62448e69166Smrg       [m4_define([am_maintainer_other], [enable])
62548e69166Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62648e69166SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
62748e69166Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62848e69166Smrg  AC_ARG_ENABLE([maintainer-mode],
62948e69166Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
630fd0c672fSmrg			  (and sometimes confusing) to the casual installer],
63148e69166Smrg      [USE_MAINTAINER_MODE=$enableval],
63248e69166Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
633fd0c672fSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63448e69166Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
635fd0c672fSmrg  MAINT=$MAINTAINER_MODE_TRUE
63648e69166Smrg  AC_SUBST([MAINT])dnl
637fd0c672fSmrg]
638fd0c672fSmrg)
639fd0c672fSmrg
640fd0c672fSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
641fd0c672fSmrg
642fd0c672fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
643fd0c672fSmrg
64448e69166Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
645fd0c672fSmrg#
646fd0c672fSmrg# This file is free software; the Free Software Foundation
647fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
648fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
649fd0c672fSmrg
65048e69166Smrg# serial 4
651fd0c672fSmrg
652fd0c672fSmrg# AM_MAKE_INCLUDE()
653fd0c672fSmrg# -----------------
654fd0c672fSmrg# Check to see how make treats includes.
655fd0c672fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
656fd0c672fSmrg[am_make=${MAKE-make}
657fd0c672fSmrgcat > confinc << 'END'
658fd0c672fSmrgam__doit:
65948e69166Smrg	@echo this is the am__doit target
660fd0c672fSmrg.PHONY: am__doit
661fd0c672fSmrgEND
662fd0c672fSmrg# If we don't find an include directive, just comment out the code.
663fd0c672fSmrgAC_MSG_CHECKING([for style of include used by $am_make])
664fd0c672fSmrgam__include="#"
665fd0c672fSmrgam__quote=
666fd0c672fSmrg_am_result=none
667fd0c672fSmrg# First try GNU make style include.
668fd0c672fSmrgecho "include confinc" > confmf
66948e69166Smrg# Ignore all kinds of additional output from `make'.
67048e69166Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67148e69166Smrg*the\ am__doit\ target*)
67248e69166Smrg  am__include=include
67348e69166Smrg  am__quote=
67448e69166Smrg  _am_result=GNU
67548e69166Smrg  ;;
67648e69166Smrgesac
677fd0c672fSmrg# Now try BSD make style include.
678fd0c672fSmrgif test "$am__include" = "#"; then
679fd0c672fSmrg   echo '.include "confinc"' > confmf
68048e69166Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68148e69166Smrg   *the\ am__doit\ target*)
68248e69166Smrg     am__include=.include
68348e69166Smrg     am__quote="\""
68448e69166Smrg     _am_result=BSD
68548e69166Smrg     ;;
68648e69166Smrg   esac
687fd0c672fSmrgfi
688fd0c672fSmrgAC_SUBST([am__include])
689fd0c672fSmrgAC_SUBST([am__quote])
690fd0c672fSmrgAC_MSG_RESULT([$_am_result])
691fd0c672fSmrgrm -f confinc confmf
692fd0c672fSmrg])
693fd0c672fSmrg
694fd0c672fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
695fd0c672fSmrg
69648e69166Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
697fd0c672fSmrg# Free Software Foundation, Inc.
698fd0c672fSmrg#
699fd0c672fSmrg# This file is free software; the Free Software Foundation
700fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
701fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
702fd0c672fSmrg
70348e69166Smrg# serial 6
704fd0c672fSmrg
705fd0c672fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
706fd0c672fSmrg# ------------------------------
707fd0c672fSmrgAC_DEFUN([AM_MISSING_PROG],
708fd0c672fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
709fd0c672fSmrg$1=${$1-"${am_missing_run}$2"}
710fd0c672fSmrgAC_SUBST($1)])
711fd0c672fSmrg
712fd0c672fSmrg
713fd0c672fSmrg# AM_MISSING_HAS_RUN
714fd0c672fSmrg# ------------------
715fd0c672fSmrg# Define MISSING if not defined so far and test if it supports --run.
716fd0c672fSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
717fd0c672fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
718fd0c672fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71948e69166SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72048e69166Smrgif test x"${MISSING+set}" != xset; then
72148e69166Smrg  case $am_aux_dir in
72248e69166Smrg  *\ * | *\	*)
72348e69166Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72448e69166Smrg  *)
72548e69166Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72648e69166Smrg  esac
72748e69166Smrgfi
728fd0c672fSmrg# Use eval to expand $SHELL
729fd0c672fSmrgif eval "$MISSING --run true"; then
730fd0c672fSmrg  am_missing_run="$MISSING --run "
731fd0c672fSmrgelse
732fd0c672fSmrg  am_missing_run=
733fd0c672fSmrg  AC_MSG_WARN([`missing' script is too old or missing])
734fd0c672fSmrgfi
735fd0c672fSmrg])
736fd0c672fSmrg
73748e69166Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
738fd0c672fSmrg#
739fd0c672fSmrg# This file is free software; the Free Software Foundation
740fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
741fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
742fd0c672fSmrg
743fd0c672fSmrg# AM_PROG_MKDIR_P
744fd0c672fSmrg# ---------------
74548e69166Smrg# Check for `mkdir -p'.
746fd0c672fSmrgAC_DEFUN([AM_PROG_MKDIR_P],
74748e69166Smrg[AC_PREREQ([2.60])dnl
74848e69166SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
74948e69166Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
75048e69166Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
75148e69166Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
75248e69166Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
75348e69166Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
75448e69166Smrgdnl adjustment using top_builddir (which is defined more often than
75548e69166Smrgdnl MKDIR_P).
75648e69166SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
75748e69166Smrgcase $mkdir_p in
75848e69166Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
75948e69166Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
76048e69166Smrgesac
76148e69166Smrg])
762fd0c672fSmrg
763fd0c672fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
764fd0c672fSmrg
76548e69166Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
766fd0c672fSmrg#
767fd0c672fSmrg# This file is free software; the Free Software Foundation
768fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
769fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
770fd0c672fSmrg
77148e69166Smrg# serial 4
772fd0c672fSmrg
773fd0c672fSmrg# _AM_MANGLE_OPTION(NAME)
774fd0c672fSmrg# -----------------------
775fd0c672fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
776fd0c672fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
777fd0c672fSmrg
778fd0c672fSmrg# _AM_SET_OPTION(NAME)
779fd0c672fSmrg# ------------------------------
780fd0c672fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
781fd0c672fSmrgAC_DEFUN([_AM_SET_OPTION],
782fd0c672fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
783fd0c672fSmrg
784fd0c672fSmrg# _AM_SET_OPTIONS(OPTIONS)
785fd0c672fSmrg# ----------------------------------
786fd0c672fSmrg# OPTIONS is a space-separated list of Automake options.
787fd0c672fSmrgAC_DEFUN([_AM_SET_OPTIONS],
78848e69166Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
789fd0c672fSmrg
790fd0c672fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
791fd0c672fSmrg# -------------------------------------------
792fd0c672fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
793fd0c672fSmrgAC_DEFUN([_AM_IF_OPTION],
794fd0c672fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
795fd0c672fSmrg
796fd0c672fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
797fd0c672fSmrg
79848e69166Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
799fd0c672fSmrg# Free Software Foundation, Inc.
800fd0c672fSmrg#
801fd0c672fSmrg# This file is free software; the Free Software Foundation
802fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
803fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
804fd0c672fSmrg
80548e69166Smrg# serial 5
806fd0c672fSmrg
807fd0c672fSmrg# AM_SANITY_CHECK
808fd0c672fSmrg# ---------------
809fd0c672fSmrgAC_DEFUN([AM_SANITY_CHECK],
810fd0c672fSmrg[AC_MSG_CHECKING([whether build environment is sane])
811fd0c672fSmrg# Just in case
812fd0c672fSmrgsleep 1
813fd0c672fSmrgecho timestamp > conftest.file
81448e69166Smrg# Reject unsafe characters in $srcdir or the absolute working directory
81548e69166Smrg# name.  Accept space and tab only in the latter.
81648e69166Smrgam_lf='
81748e69166Smrg'
81848e69166Smrgcase `pwd` in
81948e69166Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82048e69166Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82148e69166Smrgesac
82248e69166Smrgcase $srcdir in
82348e69166Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82448e69166Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
82548e69166Smrgesac
82648e69166Smrg
827fd0c672fSmrg# Do `set' in a subshell so we don't clobber the current shell's
828fd0c672fSmrg# arguments.  Must try -L first in case configure is actually a
829fd0c672fSmrg# symlink; some systems play weird games with the mod time of symlinks
830fd0c672fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
831fd0c672fSmrg# directory).
832fd0c672fSmrgif (
83348e69166Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
834fd0c672fSmrg   if test "$[*]" = "X"; then
835fd0c672fSmrg      # -L didn't work.
83648e69166Smrg      set X `ls -t "$srcdir/configure" conftest.file`
837fd0c672fSmrg   fi
838fd0c672fSmrg   rm -f conftest.file
839fd0c672fSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
840fd0c672fSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
841fd0c672fSmrg
842fd0c672fSmrg      # If neither matched, then we have a broken ls.  This can happen
843fd0c672fSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
844fd0c672fSmrg      # broken ls alias from the environment.  This has actually
845fd0c672fSmrg      # happened.  Such a system could not be considered "sane".
846fd0c672fSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
847fd0c672fSmrgalias in your environment])
848fd0c672fSmrg   fi
849fd0c672fSmrg
850fd0c672fSmrg   test "$[2]" = conftest.file
851fd0c672fSmrg   )
852fd0c672fSmrgthen
853fd0c672fSmrg   # Ok.
854fd0c672fSmrg   :
855fd0c672fSmrgelse
856fd0c672fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
857fd0c672fSmrgCheck your system clock])
858fd0c672fSmrgfi
859fd0c672fSmrgAC_MSG_RESULT(yes)])
860fd0c672fSmrg
86148e69166Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
86248e69166Smrg#
86348e69166Smrg# This file is free software; the Free Software Foundation
86448e69166Smrg# gives unlimited permission to copy and/or distribute it,
86548e69166Smrg# with or without modifications, as long as this notice is preserved.
86648e69166Smrg
86748e69166Smrg# serial 1
86848e69166Smrg
86948e69166Smrg# AM_SILENT_RULES([DEFAULT])
87048e69166Smrg# --------------------------
87148e69166Smrg# Enable less verbose build rules; with the default set to DEFAULT
87248e69166Smrg# (`yes' being less verbose, `no' or empty being verbose).
87348e69166SmrgAC_DEFUN([AM_SILENT_RULES],
87448e69166Smrg[AC_ARG_ENABLE([silent-rules],
87548e69166Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
87648e69166Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
87748e69166Smrgcase $enable_silent_rules in
87848e69166Smrgyes) AM_DEFAULT_VERBOSITY=0;;
87948e69166Smrgno)  AM_DEFAULT_VERBOSITY=1;;
88048e69166Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88148e69166Smrgesac
88248e69166SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88348e69166SmrgAM_BACKSLASH='\'
88448e69166SmrgAC_SUBST([AM_BACKSLASH])dnl
88548e69166Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
88648e69166Smrg])
88748e69166Smrg
888fd0c672fSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
889fd0c672fSmrg#
890fd0c672fSmrg# This file is free software; the Free Software Foundation
891fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
892fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
893fd0c672fSmrg
894fd0c672fSmrg# AM_PROG_INSTALL_STRIP
895fd0c672fSmrg# ---------------------
896fd0c672fSmrg# One issue with vendor `install' (even GNU) is that you can't
897fd0c672fSmrg# specify the program used to strip binaries.  This is especially
898fd0c672fSmrg# annoying in cross-compiling environments, where the build's strip
899fd0c672fSmrg# is unlikely to handle the host's binaries.
900fd0c672fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
901fd0c672fSmrg# always use install-sh in `make install-strip', and initialize
902fd0c672fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
903fd0c672fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
904fd0c672fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
905fd0c672fSmrg# Installed binaries are usually stripped using `strip' when the user
906fd0c672fSmrg# run `make install-strip'.  However `strip' might not be the right
907fd0c672fSmrg# tool to use in cross-compilation environments, therefore Automake
908fd0c672fSmrg# will honor the `STRIP' environment variable to overrule this program.
909fd0c672fSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
910fd0c672fSmrgif test "$cross_compiling" != no; then
911fd0c672fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
912fd0c672fSmrgfi
91348e69166SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
914fd0c672fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
915fd0c672fSmrg
91648e69166Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
91748e69166Smrg#
91848e69166Smrg# This file is free software; the Free Software Foundation
91948e69166Smrg# gives unlimited permission to copy and/or distribute it,
92048e69166Smrg# with or without modifications, as long as this notice is preserved.
92148e69166Smrg
92248e69166Smrg# serial 2
92348e69166Smrg
92448e69166Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
92548e69166Smrg# ---------------------------
92648e69166Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
92748e69166Smrg# This macro is traced by Automake.
92848e69166SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
92948e69166Smrg
93048e69166Smrg# AM_SUBST_NOTMAKE(VARIABLE)
93148e69166Smrg# ---------------------------
93248e69166Smrg# Public sister of _AM_SUBST_NOTMAKE.
93348e69166SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
93448e69166Smrg
935fd0c672fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
936fd0c672fSmrg
937fd0c672fSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
938fd0c672fSmrg#
939fd0c672fSmrg# This file is free software; the Free Software Foundation
940fd0c672fSmrg# gives unlimited permission to copy and/or distribute it,
941fd0c672fSmrg# with or without modifications, as long as this notice is preserved.
942fd0c672fSmrg
943fd0c672fSmrg# serial 2
944fd0c672fSmrg
945fd0c672fSmrg# _AM_PROG_TAR(FORMAT)
946fd0c672fSmrg# --------------------
947fd0c672fSmrg# Check how to create a tarball in format FORMAT.
948fd0c672fSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
949fd0c672fSmrg#
950fd0c672fSmrg# Substitute a variable $(am__tar) that is a command
951fd0c672fSmrg# writing to stdout a FORMAT-tarball containing the directory
952fd0c672fSmrg# $tardir.
953fd0c672fSmrg#     tardir=directory && $(am__tar) > result.tar
954fd0c672fSmrg#
955fd0c672fSmrg# Substitute a variable $(am__untar) that extract such
956fd0c672fSmrg# a tarball read from stdin.
957fd0c672fSmrg#     $(am__untar) < result.tar
958fd0c672fSmrgAC_DEFUN([_AM_PROG_TAR],
959fd0c672fSmrg[# Always define AMTAR for backward compatibility.
960fd0c672fSmrgAM_MISSING_PROG([AMTAR], [tar])
961fd0c672fSmrgm4_if([$1], [v7],
962fd0c672fSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
963fd0c672fSmrg     [m4_case([$1], [ustar],, [pax],,
964fd0c672fSmrg              [m4_fatal([Unknown tar format])])
965fd0c672fSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
966fd0c672fSmrg# Loop over all known methods to create a tar archive until one works.
967fd0c672fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
968fd0c672fSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
969fd0c672fSmrg# Do not fold the above two line into one, because Tru64 sh and
970fd0c672fSmrg# Solaris sh will not grok spaces in the rhs of `-'.
971fd0c672fSmrgfor _am_tool in $_am_tools
972fd0c672fSmrgdo
973fd0c672fSmrg  case $_am_tool in
974fd0c672fSmrg  gnutar)
975fd0c672fSmrg    for _am_tar in tar gnutar gtar;
976fd0c672fSmrg    do
977fd0c672fSmrg      AM_RUN_LOG([$_am_tar --version]) && break
978fd0c672fSmrg    done
979fd0c672fSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
980fd0c672fSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
981fd0c672fSmrg    am__untar="$_am_tar -xf -"
982fd0c672fSmrg    ;;
983fd0c672fSmrg  plaintar)
984fd0c672fSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
985fd0c672fSmrg    # ustar tarball either.
986fd0c672fSmrg    (tar --version) >/dev/null 2>&1 && continue
987fd0c672fSmrg    am__tar='tar chf - "$$tardir"'
988fd0c672fSmrg    am__tar_='tar chf - "$tardir"'
989fd0c672fSmrg    am__untar='tar xf -'
990fd0c672fSmrg    ;;
991fd0c672fSmrg  pax)
992fd0c672fSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
993fd0c672fSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
994fd0c672fSmrg    am__untar='pax -r'
995fd0c672fSmrg    ;;
996fd0c672fSmrg  cpio)
997fd0c672fSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
998fd0c672fSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
999fd0c672fSmrg    am__untar='cpio -i -H $1 -d'
1000fd0c672fSmrg    ;;
1001fd0c672fSmrg  none)
1002fd0c672fSmrg    am__tar=false
1003fd0c672fSmrg    am__tar_=false
1004fd0c672fSmrg    am__untar=false
1005fd0c672fSmrg    ;;
1006fd0c672fSmrg  esac
1007fd0c672fSmrg
1008fd0c672fSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
1009fd0c672fSmrg  # and am__untar set.
1010fd0c672fSmrg  test -n "${am_cv_prog_tar_$1}" && break
1011fd0c672fSmrg
1012fd0c672fSmrg  # tar/untar a dummy directory, and stop if the command works
1013fd0c672fSmrg  rm -rf conftest.dir
1014fd0c672fSmrg  mkdir conftest.dir
1015fd0c672fSmrg  echo GrepMe > conftest.dir/file
1016fd0c672fSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1017fd0c672fSmrg  rm -rf conftest.dir
1018fd0c672fSmrg  if test -s conftest.tar; then
1019fd0c672fSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
1020fd0c672fSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1021fd0c672fSmrg  fi
1022fd0c672fSmrgdone
1023fd0c672fSmrgrm -rf conftest.dir
1024fd0c672fSmrg
1025fd0c672fSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1026fd0c672fSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
1027fd0c672fSmrgAC_SUBST([am__tar])
1028fd0c672fSmrgAC_SUBST([am__untar])
1029fd0c672fSmrg]) # _AM_PROG_TAR
1030fd0c672fSmrg
103148e69166Smrgm4_include([m4/ax_define_dir.m4])
103248e69166Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1033fd0c672fSmrgdnl
103448e69166Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1035fd0c672fSmrgdnl 
1036fd0c672fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
103748e69166Smrgdnl copy of this software and associated documentation files (the "Software"),
103848e69166Smrgdnl to deal in the Software without restriction, including without limitation
103948e69166Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
104048e69166Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
104148e69166Smrgdnl Software is furnished to do so, subject to the following conditions:
1042fd0c672fSmrgdnl
104348e69166Smrgdnl The above copyright notice and this permission notice (including the next
104448e69166Smrgdnl paragraph) shall be included in all copies or substantial portions of the
104548e69166Smrgdnl Software.
1046fd0c672fSmrgdnl
104748e69166Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104848e69166Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104948e69166Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
105048e69166Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105148e69166Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105248e69166Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
105348e69166Smrgdnl DEALINGS IN THE SOFTWARE.
1054fd0c672fSmrg
1055fd0c672fSmrg# XORG_MACROS_VERSION(required-version)
1056fd0c672fSmrg# -------------------------------------
1057fd0c672fSmrg# Minimum version: 1.1.0
1058fd0c672fSmrg#
1059fd0c672fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1060fd0c672fSmrg# your configure.ac with the minimum required version, such as:
1061fd0c672fSmrg# XORG_MACROS_VERSION(1.1)
1062fd0c672fSmrg#
106348e69166Smrg# To ensure that this macro is defined, also add:
106448e69166Smrg# m4_ifndef([XORG_MACROS_VERSION],
106548e69166Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1066fd0c672fSmrg#
1067fd0c672fSmrg#
1068fd0c672fSmrg# See the "minimum version" comment for each macro you use to see what 
1069fd0c672fSmrg# version you require.
107048e69166Smrgm4_defun([XORG_MACROS_VERSION],[
107148e69166Smrgm4_define([vers_have], [1.10.1])
107248e69166Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
107348e69166Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
107448e69166Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
107548e69166Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
107648e69166Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
107748e69166Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
107848e69166Smrgm4_undefine([vers_have])
107948e69166Smrgm4_undefine([maj_have])
108048e69166Smrgm4_undefine([maj_needed])
1081fd0c672fSmrg]) # XORG_MACROS_VERSION
1082fd0c672fSmrg
1083fd0c672fSmrg# XORG_PROG_RAWCPP()
1084fd0c672fSmrg# ------------------
1085fd0c672fSmrg# Minimum version: 1.0.0
1086fd0c672fSmrg#
1087fd0c672fSmrg# Find cpp program and necessary flags for use in pre-processing text files
1088fd0c672fSmrg# such as man pages and config files
1089fd0c672fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1090fd0c672fSmrgAC_REQUIRE([AC_PROG_CPP])
1091fd0c672fSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1092fd0c672fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1093fd0c672fSmrg
1094fd0c672fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1095fd0c672fSmrg# which is not the best choice for supporting other OS'es, but covers most
1096fd0c672fSmrg# of the ones we need for now.
1097fd0c672fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1098fd0c672fSmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1099fd0c672fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1100fd0c672fSmrg	AC_MSG_RESULT([no])
1101fd0c672fSmrgelse
1102fd0c672fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1103fd0c672fSmrg		RAWCPPFLAGS=-undef
1104fd0c672fSmrg		AC_MSG_RESULT([yes])
110548e69166Smrg	# under Cygwin unix is still defined even with -undef
110648e69166Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
110748e69166Smrg		RAWCPPFLAGS="-undef -ansi"
110848e69166Smrg		AC_MSG_RESULT([yes, with -ansi])
1109fd0c672fSmrg	else
1110fd0c672fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1111fd0c672fSmrg	fi
1112fd0c672fSmrgfi
1113fd0c672fSmrgrm -f conftest.$ac_ext
1114fd0c672fSmrg
1115fd0c672fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1116fd0c672fSmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1117fd0c672fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1118fd0c672fSmrg	AC_MSG_RESULT([no])
1119fd0c672fSmrgelse
1120fd0c672fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1121fd0c672fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1122fd0c672fSmrg		AC_MSG_RESULT([yes])
1123fd0c672fSmrg	else
1124fd0c672fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1125fd0c672fSmrg	fi
1126fd0c672fSmrgfi
1127fd0c672fSmrgrm -f conftest.$ac_ext
1128fd0c672fSmrgAC_SUBST(RAWCPPFLAGS)
1129fd0c672fSmrg]) # XORG_PROG_RAWCPP
1130fd0c672fSmrg
1131fd0c672fSmrg# XORG_MANPAGE_SECTIONS()
1132fd0c672fSmrg# -----------------------
1133fd0c672fSmrg# Minimum version: 1.0.0
1134fd0c672fSmrg#
1135fd0c672fSmrg# Determine which sections man pages go in for the different man page types
1136fd0c672fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1137fd0c672fSmrg# Not sure if there's any better way than just hardcoding by OS name.
1138fd0c672fSmrg# Override default settings by setting environment variables
113948e69166Smrg# Added MAN_SUBSTS in version 1.8
114048e69166Smrg# Added AC_PROG_SED in version 1.8
1141fd0c672fSmrg
1142fd0c672fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1143fd0c672fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
114448e69166SmrgAC_REQUIRE([AC_PROG_SED])
1145fd0c672fSmrg
1146fd0c672fSmrgif test x$APP_MAN_SUFFIX = x    ; then
1147fd0c672fSmrg    APP_MAN_SUFFIX=1
1148fd0c672fSmrgfi
1149fd0c672fSmrgif test x$APP_MAN_DIR = x    ; then
1150fd0c672fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1151fd0c672fSmrgfi
1152fd0c672fSmrg
1153fd0c672fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1154fd0c672fSmrg    LIB_MAN_SUFFIX=3
1155fd0c672fSmrgfi
1156fd0c672fSmrgif test x$LIB_MAN_DIR = x    ; then
1157fd0c672fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1158fd0c672fSmrgfi
1159fd0c672fSmrg
1160fd0c672fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1161fd0c672fSmrg    case $host_os in
1162fd0c672fSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1163fd0c672fSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1164fd0c672fSmrg    esac
1165fd0c672fSmrgfi
1166fd0c672fSmrgif test x$FILE_MAN_DIR = x    ; then
1167fd0c672fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1168fd0c672fSmrgfi
1169fd0c672fSmrg
1170fd0c672fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1171fd0c672fSmrg    case $host_os in
1172fd0c672fSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1173fd0c672fSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1174fd0c672fSmrg    esac
1175fd0c672fSmrgfi
1176fd0c672fSmrgif test x$MISC_MAN_DIR = x    ; then
1177fd0c672fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1178fd0c672fSmrgfi
1179fd0c672fSmrg
1180fd0c672fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1181fd0c672fSmrg    case $host_os in
1182fd0c672fSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1183fd0c672fSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1184fd0c672fSmrg    esac
1185fd0c672fSmrgfi
1186fd0c672fSmrgif test x$DRIVER_MAN_DIR = x    ; then
1187fd0c672fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1188fd0c672fSmrgfi
1189fd0c672fSmrg
1190fd0c672fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1191fd0c672fSmrg    case $host_os in
1192fd0c672fSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1193fd0c672fSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1194fd0c672fSmrg    esac
1195fd0c672fSmrgfi
1196fd0c672fSmrgif test x$ADMIN_MAN_DIR = x    ; then
1197fd0c672fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1198fd0c672fSmrgfi
1199fd0c672fSmrg
1200fd0c672fSmrg
1201fd0c672fSmrgAC_SUBST([APP_MAN_SUFFIX])
1202fd0c672fSmrgAC_SUBST([LIB_MAN_SUFFIX])
1203fd0c672fSmrgAC_SUBST([FILE_MAN_SUFFIX])
1204fd0c672fSmrgAC_SUBST([MISC_MAN_SUFFIX])
1205fd0c672fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1206fd0c672fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1207fd0c672fSmrgAC_SUBST([APP_MAN_DIR])
1208fd0c672fSmrgAC_SUBST([LIB_MAN_DIR])
1209fd0c672fSmrgAC_SUBST([FILE_MAN_DIR])
1210fd0c672fSmrgAC_SUBST([MISC_MAN_DIR])
1211fd0c672fSmrgAC_SUBST([DRIVER_MAN_DIR])
1212fd0c672fSmrgAC_SUBST([ADMIN_MAN_DIR])
121348e69166Smrg
121448e69166SmrgXORG_MAN_PAGE="X Version 11"
121548e69166SmrgAC_SUBST([XORG_MAN_PAGE])
121648e69166SmrgMAN_SUBSTS="\
121748e69166Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121848e69166Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
121948e69166Smrg	-e 's|__xservername__|Xorg|g' \
122048e69166Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
122148e69166Smrg	-e 's|__projectroot__|\$(prefix)|g' \
122248e69166Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
122348e69166Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
122448e69166Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
122548e69166Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
122648e69166Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
122748e69166Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
122848e69166Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
122948e69166SmrgAC_SUBST([MAN_SUBSTS])
123048e69166Smrg
1231fd0c672fSmrg]) # XORG_MANPAGE_SECTIONS
1232fd0c672fSmrg
123348e69166Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
123448e69166Smrg# ------------------------
123548e69166Smrg# Minimum version: 1.7.0
123648e69166Smrg#
123748e69166Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
123848e69166Smrg# provided by xorg-sgml-doctools, if installed.
123948e69166SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
124048e69166SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
124148e69166SmrgXORG_SGML_PATH=
124248e69166SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
124348e69166Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
124448e69166Smrg    [m4_ifval([$1],[:],
124548e69166Smrg        [if test x"$cross_compiling" != x"yes" ; then
124648e69166Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
124748e69166Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
124848e69166Smrg         fi])
124948e69166Smrg    ])
125048e69166Smrg
125148e69166Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
125248e69166Smrg# the path and the name of the doc stylesheet
125348e69166Smrgif test "x$XORG_SGML_PATH" != "x" ; then
125448e69166Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
125548e69166Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
125648e69166Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
125748e69166Smrgelse
125848e69166Smrg   AC_MSG_RESULT([no])
125948e69166Smrgfi
126048e69166Smrg
126148e69166SmrgAC_SUBST(XORG_SGML_PATH)
126248e69166SmrgAC_SUBST(STYLESHEET_SRCDIR)
126348e69166SmrgAC_SUBST(XSL_STYLESHEET)
126448e69166SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
126548e69166Smrg]) # XORG_CHECK_SGML_DOCTOOLS
126648e69166Smrg
1267fd0c672fSmrg# XORG_CHECK_LINUXDOC
1268fd0c672fSmrg# -------------------
1269fd0c672fSmrg# Minimum version: 1.0.0
1270fd0c672fSmrg#
1271fd0c672fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1272fd0c672fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1273fd0c672fSmrg# Whether or not the necessary tools and files are found can be checked
1274fd0c672fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1275fd0c672fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
127648e69166SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
127748e69166SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1278fd0c672fSmrg
1279fd0c672fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1280fd0c672fSmrg
128148e69166SmrgAC_MSG_CHECKING([whether to build documentation])
1282fd0c672fSmrg
128348e69166Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1284fd0c672fSmrg   BUILDDOC=yes
1285fd0c672fSmrgelse
1286fd0c672fSmrg   BUILDDOC=no
1287fd0c672fSmrgfi
1288fd0c672fSmrg
1289fd0c672fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1290fd0c672fSmrg
1291fd0c672fSmrgAC_MSG_RESULT([$BUILDDOC])
1292fd0c672fSmrg
129348e69166SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1294fd0c672fSmrg
129548e69166Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1296fd0c672fSmrg   BUILDPDFDOC=yes
1297fd0c672fSmrgelse
1298fd0c672fSmrg   BUILDPDFDOC=no
1299fd0c672fSmrgfi
1300fd0c672fSmrg
1301fd0c672fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1302fd0c672fSmrg
1303fd0c672fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1304fd0c672fSmrg
130548e69166SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1306fd0c672fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1307fd0c672fSmrgMAKE_PDF="$PS2PDF"
1308fd0c672fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1309fd0c672fSmrg
1310fd0c672fSmrgAC_SUBST(MAKE_TEXT)
1311fd0c672fSmrgAC_SUBST(MAKE_PS)
1312fd0c672fSmrgAC_SUBST(MAKE_PDF)
1313fd0c672fSmrgAC_SUBST(MAKE_HTML)
1314fd0c672fSmrg]) # XORG_CHECK_LINUXDOC
1315fd0c672fSmrg
1316fd0c672fSmrg# XORG_CHECK_DOCBOOK
1317fd0c672fSmrg# -------------------
1318fd0c672fSmrg# Minimum version: 1.0.0
1319fd0c672fSmrg#
1320fd0c672fSmrg# Checks for the ability to build output formats from SGML DocBook source.
1321fd0c672fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1322fd0c672fSmrg# indicates whether the necessary tools and files are found and, if set,
1323fd0c672fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1324fd0c672fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
132548e69166SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
132648e69166Smrg
1327fd0c672fSmrgBUILDTXTDOC=no
1328fd0c672fSmrgBUILDPDFDOC=no
1329fd0c672fSmrgBUILDPSDOC=no
1330fd0c672fSmrgBUILDHTMLDOC=no
1331fd0c672fSmrg
1332fd0c672fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1333fd0c672fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1334fd0c672fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1335fd0c672fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1336fd0c672fSmrg
133748e69166SmrgAC_MSG_CHECKING([whether to build text documentation])
133848e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1339fd0c672fSmrg   test x$BUILD_TXTDOC != xno; then
1340fd0c672fSmrg	BUILDTXTDOC=yes
1341fd0c672fSmrgfi
1342fd0c672fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1343fd0c672fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1344fd0c672fSmrg
134548e69166SmrgAC_MSG_CHECKING([whether to build PDF documentation])
134648e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1347fd0c672fSmrg   test x$BUILD_PDFDOC != xno; then
1348fd0c672fSmrg	BUILDPDFDOC=yes
1349fd0c672fSmrgfi
1350fd0c672fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1351fd0c672fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1352fd0c672fSmrg
135348e69166SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
135448e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1355fd0c672fSmrg   test x$BUILD_PSDOC != xno; then
1356fd0c672fSmrg	BUILDPSDOC=yes
1357fd0c672fSmrgfi
1358fd0c672fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1359fd0c672fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1360fd0c672fSmrg
136148e69166SmrgAC_MSG_CHECKING([whether to build HTML documentation])
136248e69166Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1363fd0c672fSmrg   test x$BUILD_HTMLDOC != xno; then
1364fd0c672fSmrg	BUILDHTMLDOC=yes
1365fd0c672fSmrgfi
1366fd0c672fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1367fd0c672fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1368fd0c672fSmrg
1369fd0c672fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1370fd0c672fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1371fd0c672fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1372fd0c672fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1373fd0c672fSmrg
1374fd0c672fSmrgAC_SUBST(MAKE_TEXT)
1375fd0c672fSmrgAC_SUBST(MAKE_PS)
1376fd0c672fSmrgAC_SUBST(MAKE_PDF)
1377fd0c672fSmrgAC_SUBST(MAKE_HTML)
1378fd0c672fSmrg]) # XORG_CHECK_DOCBOOK
1379fd0c672fSmrg
138048e69166Smrg# XORG_WITH_XMLTO([MIN-VERSION])
138148e69166Smrg# ----------------
138248e69166Smrg# Minimum version: 1.5.0
138348e69166Smrg#
138448e69166Smrg# Documentation tools are not always available on all platforms and sometimes
138548e69166Smrg# not at the appropriate level. This macro enables a module to test for the
138648e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
138748e69166Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
138848e69166Smrg# as whether or not to use the xmlto package.
138948e69166Smrg#
139048e69166Smrg# Interface to module:
139148e69166Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
139248e69166Smrg# XMLTO:	returns the path of the xmlto program found
139348e69166Smrg#		returns the path set by the user in the environment
139448e69166Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
139548e69166Smrg#		'no' user instructs the module not to use xmlto
139648e69166Smrg#
139748e69166Smrg# Added in version 1.10.0
139848e69166Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
139948e69166Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
140048e69166Smrg#
140148e69166Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
140248e69166Smrg#
140348e69166SmrgAC_DEFUN([XORG_WITH_XMLTO],[
140448e69166SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
140548e69166SmrgAC_ARG_WITH(xmlto,
140648e69166Smrg	AS_HELP_STRING([--with-xmlto],
140748e69166Smrg	   [Use xmlto to regenerate documentation (default: yes, if installed)]),
140848e69166Smrg	   [use_xmlto=$withval], [use_xmlto=auto])
140948e69166Smrg
141048e69166Smrgif test "x$use_xmlto" = x"auto"; then
141148e69166Smrg   AC_PATH_PROG([XMLTO], [xmlto])
141248e69166Smrg   if test "x$XMLTO" = "x"; then
141348e69166Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
141448e69166Smrg	have_xmlto=no
141548e69166Smrg   else
141648e69166Smrg        have_xmlto=yes
141748e69166Smrg   fi
141848e69166Smrgelif test "x$use_xmlto" = x"yes" ; then
141948e69166Smrg   AC_PATH_PROG([XMLTO], [xmlto])
142048e69166Smrg   if test "x$XMLTO" = "x"; then
142148e69166Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
142248e69166Smrg   fi
142348e69166Smrg   have_xmlto=yes
142448e69166Smrgelif test "x$use_xmlto" = x"no" ; then
142548e69166Smrg   if test "x$XMLTO" != "x"; then
142648e69166Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
142748e69166Smrg   fi
142848e69166Smrg   have_xmlto=no
142948e69166Smrgelse
143048e69166Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
143148e69166Smrgfi
143248e69166Smrg
143348e69166Smrg# Test for a minimum version of xmlto, if provided.
143448e69166Smrgm4_ifval([$1],
143548e69166Smrg[if test "$have_xmlto" = yes; then
143648e69166Smrg    # scrape the xmlto version
143748e69166Smrg    AC_MSG_CHECKING([the xmlto version])
143848e69166Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
143948e69166Smrg    AC_MSG_RESULT([$xmlto_version])
144048e69166Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
144148e69166Smrg        [if test "x$use_xmlto" = xauto; then
144248e69166Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
144348e69166Smrg            have_xmlto=no
144448e69166Smrg        else
144548e69166Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
144648e69166Smrg        fi])
144748e69166Smrgfi])
144848e69166Smrg
144948e69166Smrg# Test for the ability of xmlto to generate a text target
145048e69166Smrghave_xmlto_text=no
145148e69166Smrgcat > conftest.xml << "EOF"
145248e69166SmrgEOF
145348e69166SmrgAS_IF([test "$have_xmlto" = yes],
145448e69166Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
145548e69166Smrg             [have_xmlto_text=yes],
145648e69166Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
145748e69166Smrgrm -f conftest.xml
145848e69166SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
145948e69166SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
146048e69166Smrg]) # XORG_WITH_XMLTO
146148e69166Smrg
146248e69166Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION])
146348e69166Smrg# ----------------
146448e69166Smrg# Minimum version: 1.5.0
146548e69166Smrg#
146648e69166Smrg# Documentation tools are not always available on all platforms and sometimes
146748e69166Smrg# not at the appropriate level. This macro enables a module to test for the
146848e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
146948e69166Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
147048e69166Smrg# as whether or not to use the asciidoc package.
147148e69166Smrg#
147248e69166Smrg# Interface to module:
147348e69166Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
147448e69166Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
147548e69166Smrg#		 returns the path set by the user in the environment
147648e69166Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
147748e69166Smrg#		  'no' user instructs the module not to use asciidoc
147848e69166Smrg#
147948e69166Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
148048e69166Smrg#
148148e69166SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
148248e69166SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
148348e69166SmrgAC_ARG_WITH(asciidoc,
148448e69166Smrg	AS_HELP_STRING([--with-asciidoc],
148548e69166Smrg	   [Use asciidoc to regenerate documentation (default: yes, if installed)]),
148648e69166Smrg	   [use_asciidoc=$withval], [use_asciidoc=auto])
148748e69166Smrg
148848e69166Smrgif test "x$use_asciidoc" = x"auto"; then
148948e69166Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
149048e69166Smrg   if test "x$ASCIIDOC" = "x"; then
149148e69166Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
149248e69166Smrg	have_asciidoc=no
149348e69166Smrg   else
149448e69166Smrg        have_asciidoc=yes
149548e69166Smrg   fi
149648e69166Smrgelif test "x$use_asciidoc" = x"yes" ; then
149748e69166Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
149848e69166Smrg   if test "x$ASCIIDOC" = "x"; then
149948e69166Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
150048e69166Smrg   fi
150148e69166Smrg   have_asciidoc=yes
150248e69166Smrgelif test "x$use_asciidoc" = x"no" ; then
150348e69166Smrg   if test "x$ASCIIDOC" != "x"; then
150448e69166Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
150548e69166Smrg   fi
150648e69166Smrg   have_asciidoc=no
150748e69166Smrgelse
150848e69166Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
150948e69166Smrgfi
151048e69166Smrgm4_ifval([$1],
151148e69166Smrg[if test "$have_asciidoc" = yes; then
151248e69166Smrg    # scrape the asciidoc version
151348e69166Smrg    AC_MSG_CHECKING([the asciidoc version])
151448e69166Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
151548e69166Smrg    AC_MSG_RESULT([$asciidoc_version])
151648e69166Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
151748e69166Smrg        [if test "x$use_asciidoc" = xauto; then
151848e69166Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
151948e69166Smrg            have_asciidoc=no
152048e69166Smrg        else
152148e69166Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
152248e69166Smrg        fi])
152348e69166Smrgfi])
152448e69166SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
152548e69166Smrg]) # XORG_WITH_ASCIIDOC
152648e69166Smrg
152748e69166Smrg# XORG_WITH_DOXYGEN([MIN-VERSION])
152848e69166Smrg# --------------------------------
152948e69166Smrg# Minimum version: 1.5.0
153048e69166Smrg#
153148e69166Smrg# Documentation tools are not always available on all platforms and sometimes
153248e69166Smrg# not at the appropriate level. This macro enables a module to test for the
153348e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153448e69166Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
153548e69166Smrg# as whether or not to use the doxygen package.
153648e69166Smrg#
153748e69166Smrg# Interface to module:
153848e69166Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
153948e69166Smrg# DOXYGEN:	 returns the path of the doxygen program found
154048e69166Smrg#		 returns the path set by the user in the environment
154148e69166Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
154248e69166Smrg#		  'no' user instructs the module not to use doxygen
154348e69166Smrg#
154448e69166Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
154548e69166Smrg#
154648e69166SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
154748e69166SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
154848e69166SmrgAC_ARG_WITH(doxygen,
154948e69166Smrg	AS_HELP_STRING([--with-doxygen],
155048e69166Smrg	   [Use doxygen to regenerate documentation (default: yes, if installed)]),
155148e69166Smrg	   [use_doxygen=$withval], [use_doxygen=auto])
155248e69166Smrg
155348e69166Smrgif test "x$use_doxygen" = x"auto"; then
155448e69166Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
155548e69166Smrg   if test "x$DOXYGEN" = "x"; then
155648e69166Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
155748e69166Smrg	have_doxygen=no
155848e69166Smrg   else
155948e69166Smrg        have_doxygen=yes
156048e69166Smrg   fi
156148e69166Smrgelif test "x$use_doxygen" = x"yes" ; then
156248e69166Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
156348e69166Smrg   if test "x$DOXYGEN" = "x"; then
156448e69166Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
156548e69166Smrg   fi
156648e69166Smrg   have_doxygen=yes
156748e69166Smrgelif test "x$use_doxygen" = x"no" ; then
156848e69166Smrg   if test "x$DOXYGEN" != "x"; then
156948e69166Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
157048e69166Smrg   fi
157148e69166Smrg   have_doxygen=no
157248e69166Smrgelse
157348e69166Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
157448e69166Smrgfi
157548e69166Smrgm4_ifval([$1],
157648e69166Smrg[if test "$have_doxygen" = yes; then
157748e69166Smrg    # scrape the doxygen version
157848e69166Smrg    AC_MSG_CHECKING([the doxygen version])
157948e69166Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
158048e69166Smrg    AC_MSG_RESULT([$doxygen_version])
158148e69166Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
158248e69166Smrg        [if test "x$use_doxygen" = xauto; then
158348e69166Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
158448e69166Smrg            have_doxygen=no
158548e69166Smrg        else
158648e69166Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
158748e69166Smrg        fi])
158848e69166Smrgfi])
158948e69166SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
159048e69166Smrg]) # XORG_WITH_DOXYGEN
159148e69166Smrg
159248e69166Smrg# XORG_WITH_GROFF
159348e69166Smrg# ----------------
159448e69166Smrg# Minimum version: 1.6.0
159548e69166Smrg#
159648e69166Smrg# Documentation tools are not always available on all platforms and sometimes
159748e69166Smrg# not at the appropriate level. This macro enables a module to test for the
159848e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
159948e69166Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
160048e69166Smrg# as whether or not to use the groff package.
160148e69166Smrg#
160248e69166Smrg# Interface to module:
160348e69166Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
160448e69166Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
160548e69166Smrg# HAVE_GROFF_MS: the -ms macros package
160648e69166Smrg# GROFF:	 returns the path of the groff program found
160748e69166Smrg#		 returns the path set by the user in the environment
160848e69166Smrg# --with-groff:	 'yes' user instructs the module to use groff
160948e69166Smrg#		 'no' user instructs the module not to use groff
161048e69166Smrg#
161148e69166Smrg# Added in version 1.9.0:
161248e69166Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
161348e69166Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
161448e69166Smrg#		   psselect from the psutils package.
161548e69166Smrg#		   the ghostcript package. Refer to the grohtml man pages
161648e69166Smrg#
161748e69166Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
161848e69166Smrg#
161948e69166Smrg# OS and distros often splits groff in a basic and full package, the former
162048e69166Smrg# having the groff program and the later having devices, fonts and macros
162148e69166Smrg# Checking for the groff executable is not enough.
162248e69166Smrg#
162348e69166Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
162448e69166Smrg# unset HAVE_GROFF or GROFF env variables.
162548e69166Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
162648e69166Smrg#
162748e69166SmrgAC_DEFUN([XORG_WITH_GROFF],[
162848e69166SmrgAC_ARG_VAR([GROFF], [Path to groff command])
162948e69166SmrgAC_ARG_WITH(groff,
163048e69166Smrg	AS_HELP_STRING([--with-groff],
163148e69166Smrg	   [Use groff to regenerate documentation (default: yes, if installed)]),
163248e69166Smrg	   [use_groff=$withval], [use_groff=auto])
163348e69166Smrg
163448e69166Smrgif test "x$use_groff" = x"auto"; then
163548e69166Smrg   AC_PATH_PROG([GROFF], [groff])
163648e69166Smrg   if test "x$GROFF" = "x"; then
163748e69166Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
163848e69166Smrg	have_groff=no
163948e69166Smrg   else
164048e69166Smrg        have_groff=yes
164148e69166Smrg   fi
164248e69166Smrgelif test "x$use_groff" = x"yes" ; then
164348e69166Smrg   AC_PATH_PROG([GROFF], [groff])
164448e69166Smrg   if test "x$GROFF" = "x"; then
164548e69166Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
164648e69166Smrg   fi
164748e69166Smrg   have_groff=yes
164848e69166Smrgelif test "x$use_groff" = x"no" ; then
164948e69166Smrg   if test "x$GROFF" != "x"; then
165048e69166Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
165148e69166Smrg   fi
165248e69166Smrg   have_groff=no
165348e69166Smrgelse
165448e69166Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
165548e69166Smrgfi
165648e69166Smrg
165748e69166Smrg# We have groff, test for the presence of the macro packages
165848e69166Smrgif test "x$have_groff" = x"yes"; then
165948e69166Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
166048e69166Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
166148e69166Smrg        groff_ms_works=yes
166248e69166Smrg    else
166348e69166Smrg        groff_ms_works=no
166448e69166Smrg    fi
166548e69166Smrg    AC_MSG_RESULT([$groff_ms_works])
166648e69166Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
166748e69166Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
166848e69166Smrg        groff_mm_works=yes
166948e69166Smrg    else
167048e69166Smrg        groff_mm_works=no
167148e69166Smrg    fi
167248e69166Smrg    AC_MSG_RESULT([$groff_mm_works])
167348e69166Smrgfi
167448e69166Smrg
167548e69166Smrg# We have groff, test for HTML dependencies, one command per package
167648e69166Smrgif test "x$have_groff" = x"yes"; then
167748e69166Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
167848e69166Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
167948e69166Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
168048e69166Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
168148e69166Smrg      have_groff_html=yes
168248e69166Smrg   else
168348e69166Smrg      have_groff_html=no
168448e69166Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
168548e69166Smrg   fi
168648e69166Smrgfi
168748e69166Smrg
168848e69166Smrg# Set Automake conditionals for Makefiles
168948e69166SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
169048e69166SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
169148e69166SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
169248e69166SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
169348e69166Smrg]) # XORG_WITH_GROFF
169448e69166Smrg
169548e69166Smrg# XORG_WITH_FOP
169648e69166Smrg# ----------------
169748e69166Smrg# Minimum version: 1.6.0
169848e69166Smrg#
169948e69166Smrg# Documentation tools are not always available on all platforms and sometimes
170048e69166Smrg# not at the appropriate level. This macro enables a module to test for the
170148e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
170248e69166Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
170348e69166Smrg# as whether or not to use the fop package.
170448e69166Smrg#
170548e69166Smrg# Interface to module:
170648e69166Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
170748e69166Smrg# FOP:	 	returns the path of the fop program found
170848e69166Smrg#		returns the path set by the user in the environment
170948e69166Smrg# --with-fop: 	'yes' user instructs the module to use fop
171048e69166Smrg#		'no' user instructs the module not to use fop
171148e69166Smrg#
171248e69166Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
171348e69166Smrg#
171448e69166SmrgAC_DEFUN([XORG_WITH_FOP],[
171548e69166SmrgAC_ARG_VAR([FOP], [Path to fop command])
171648e69166SmrgAC_ARG_WITH(fop,
171748e69166Smrg	AS_HELP_STRING([--with-fop],
171848e69166Smrg	   [Use fop to regenerate documentation (default: yes, if installed)]),
171948e69166Smrg	   [use_fop=$withval], [use_fop=auto])
172048e69166Smrg
172148e69166Smrgif test "x$use_fop" = x"auto"; then
172248e69166Smrg   AC_PATH_PROG([FOP], [fop])
172348e69166Smrg   if test "x$FOP" = "x"; then
172448e69166Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
172548e69166Smrg	have_fop=no
172648e69166Smrg   else
172748e69166Smrg        have_fop=yes
172848e69166Smrg   fi
172948e69166Smrgelif test "x$use_fop" = x"yes" ; then
173048e69166Smrg   AC_PATH_PROG([FOP], [fop])
173148e69166Smrg   if test "x$FOP" = "x"; then
173248e69166Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
173348e69166Smrg   fi
173448e69166Smrg   have_fop=yes
173548e69166Smrgelif test "x$use_fop" = x"no" ; then
173648e69166Smrg   if test "x$FOP" != "x"; then
173748e69166Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
173848e69166Smrg   fi
173948e69166Smrg   have_fop=no
174048e69166Smrgelse
174148e69166Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
174248e69166Smrgfi
174348e69166SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
174448e69166Smrg]) # XORG_WITH_FOP
174548e69166Smrg
174648e69166Smrg# XORG_WITH_PS2PDF
174748e69166Smrg# ----------------
174848e69166Smrg# Minimum version: 1.6.0
174948e69166Smrg#
175048e69166Smrg# Documentation tools are not always available on all platforms and sometimes
175148e69166Smrg# not at the appropriate level. This macro enables a module to test for the
175248e69166Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
175348e69166Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
175448e69166Smrg# as whether or not to use the ps2pdf package.
175548e69166Smrg#
175648e69166Smrg# Interface to module:
175748e69166Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
175848e69166Smrg# PS2PDF:	returns the path of the ps2pdf program found
175948e69166Smrg#		returns the path set by the user in the environment
176048e69166Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
176148e69166Smrg#		 'no' user instructs the module not to use ps2pdf
176248e69166Smrg#
176348e69166Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
176448e69166Smrg#
176548e69166SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
176648e69166SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
176748e69166SmrgAC_ARG_WITH(ps2pdf,
176848e69166Smrg	AS_HELP_STRING([--with-ps2pdf],
176948e69166Smrg	   [Use ps2pdf to regenerate documentation (default: yes, if installed)]),
177048e69166Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=auto])
177148e69166Smrg
177248e69166Smrgif test "x$use_ps2pdf" = x"auto"; then
177348e69166Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
177448e69166Smrg   if test "x$PS2PDF" = "x"; then
177548e69166Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
177648e69166Smrg	have_ps2pdf=no
177748e69166Smrg   else
177848e69166Smrg        have_ps2pdf=yes
177948e69166Smrg   fi
178048e69166Smrgelif test "x$use_ps2pdf" = x"yes" ; then
178148e69166Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
178248e69166Smrg   if test "x$PS2PDF" = "x"; then
178348e69166Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
178448e69166Smrg   fi
178548e69166Smrg   have_ps2pdf=yes
178648e69166Smrgelif test "x$use_ps2pdf" = x"no" ; then
178748e69166Smrg   if test "x$PS2PDF" != "x"; then
178848e69166Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
178948e69166Smrg   fi
179048e69166Smrg   have_ps2pdf=no
179148e69166Smrgelse
179248e69166Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
179348e69166Smrgfi
179448e69166SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
179548e69166Smrg]) # XORG_WITH_PS2PDF
179648e69166Smrg
179748e69166Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
179848e69166Smrg# ----------------
179948e69166Smrg# Minimum version: 1.6.0
180048e69166Smrg#
180148e69166Smrg# Documentation tools are not always available on all platforms and sometimes
180248e69166Smrg# not at the appropriate level. This macro enables a builder to skip all
180348e69166Smrg# documentation targets except traditional man pages.
180448e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
180548e69166Smrg# maximum flexibilty in controlling documentation building.
180648e69166Smrg# Refer to:
180748e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
180848e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
180948e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
181048e69166Smrg# XORG_WITH_FOP           --with-fop
181148e69166Smrg# XORG_WITH_GROFF         --with-groff
181248e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
181348e69166Smrg#
181448e69166Smrg# Interface to module:
181548e69166Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
181648e69166Smrg# --enable-docs: 'yes' user instructs the module to generate docs
181748e69166Smrg#		 'no' user instructs the module not to generate docs
181848e69166Smrg# parm1:	specify the default value, yes or no.
181948e69166Smrg#
182048e69166SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
182148e69166Smrgdefault=$1
182248e69166Smrgif test "x$default" = x ; then
182348e69166Smrg  default="yes"
182448e69166Smrgfi
182548e69166SmrgAC_ARG_ENABLE(docs,
182648e69166Smrg	AS_HELP_STRING([--enable-docs],
182748e69166Smrg	   [Enable building the documentation (default: yes)]),
182848e69166Smrg	   [build_docs=$enableval], [build_docs=$default])
182948e69166SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
183048e69166SmrgAC_MSG_CHECKING([whether to build documentation])
183148e69166SmrgAC_MSG_RESULT([$build_docs])
183248e69166Smrg]) # XORG_ENABLE_DOCS
183348e69166Smrg
183448e69166Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
183548e69166Smrg# ----------------
183648e69166Smrg# Minimum version: 1.6.0
183748e69166Smrg#
183848e69166Smrg# This macro enables a builder to skip all developer documentation.
183948e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
184048e69166Smrg# maximum flexibilty in controlling documentation building.
184148e69166Smrg# Refer to:
184248e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
184348e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
184448e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
184548e69166Smrg# XORG_WITH_FOP           --with-fop
184648e69166Smrg# XORG_WITH_GROFF         --with-groff
184748e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
184848e69166Smrg#
184948e69166Smrg# Interface to module:
185048e69166Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
185148e69166Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
185248e69166Smrg#			'no' user instructs the module not to generate developer docs
185348e69166Smrg# parm1:		specify the default value, yes or no.
185448e69166Smrg#
185548e69166SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
185648e69166Smrgdevel_default=$1
185748e69166Smrgif test "x$devel_default" = x ; then
185848e69166Smrg  devel_default="yes"
185948e69166Smrgfi
186048e69166SmrgAC_ARG_ENABLE(devel-docs,
186148e69166Smrg	AS_HELP_STRING([--enable-devel-docs],
186248e69166Smrg	   [Enable building the developer documentation (default: yes)]),
186348e69166Smrg	   [build_devel_docs=$enableval], [build_devel_docs=$devel_default])
186448e69166SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
186548e69166SmrgAC_MSG_CHECKING([whether to build developer documentation])
186648e69166SmrgAC_MSG_RESULT([$build_devel_docs])
186748e69166Smrg]) # XORG_ENABLE_DEVEL_DOCS
186848e69166Smrg
186948e69166Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
187048e69166Smrg# ----------------
187148e69166Smrg# Minimum version: 1.6.0
187248e69166Smrg#
187348e69166Smrg# This macro enables a builder to skip all functional specification targets.
187448e69166Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
187548e69166Smrg# maximum flexibilty in controlling documentation building.
187648e69166Smrg# Refer to:
187748e69166Smrg# XORG_WITH_XMLTO         --with-xmlto
187848e69166Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
187948e69166Smrg# XORG_WITH_DOXYGEN       --with-doxygen
188048e69166Smrg# XORG_WITH_FOP           --with-fop
188148e69166Smrg# XORG_WITH_GROFF         --with-groff
188248e69166Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
188348e69166Smrg#
188448e69166Smrg# Interface to module:
188548e69166Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
188648e69166Smrg# --enable-specs:	'yes' user instructs the module to generate specs
188748e69166Smrg#			'no' user instructs the module not to generate specs
188848e69166Smrg# parm1:		specify the default value, yes or no.
188948e69166Smrg#
189048e69166SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
189148e69166Smrgspec_default=$1
189248e69166Smrgif test "x$spec_default" = x ; then
189348e69166Smrg  spec_default="yes"
189448e69166Smrgfi
189548e69166SmrgAC_ARG_ENABLE(specs,
189648e69166Smrg	AS_HELP_STRING([--enable-specs],
189748e69166Smrg	   [Enable building the specs (default: yes)]),
189848e69166Smrg	   [build_specs=$enableval], [build_specs=$spec_default])
189948e69166SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
190048e69166SmrgAC_MSG_CHECKING([whether to build functional specifications])
190148e69166SmrgAC_MSG_RESULT([$build_specs])
190248e69166Smrg]) # XORG_ENABLE_SPECS
190348e69166Smrg
1904fd0c672fSmrg# XORG_CHECK_MALLOC_ZERO
1905fd0c672fSmrg# ----------------------
1906fd0c672fSmrg# Minimum version: 1.0.0
1907fd0c672fSmrg#
1908fd0c672fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1909fd0c672fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1910fd0c672fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1911fd0c672fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1912fd0c672fSmrgAC_ARG_ENABLE(malloc0returnsnull,
191348e69166Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1914fd0c672fSmrg		       [malloc(0) returns NULL (default: auto)]),
1915fd0c672fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1916fd0c672fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1917fd0c672fSmrg
1918fd0c672fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1919fd0c672fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
1920fd0c672fSmrg	AC_RUN_IFELSE([
1921fd0c672fSmrgchar *malloc();
1922fd0c672fSmrgchar *realloc();
1923fd0c672fSmrgchar *calloc();
1924fd0c672fSmrgmain() {
1925fd0c672fSmrg    char *m0, *r0, *c0, *p;
1926fd0c672fSmrg    m0 = malloc(0);
1927fd0c672fSmrg    p = malloc(10);
1928fd0c672fSmrg    r0 = realloc(p,0);
1929fd0c672fSmrg    c0 = calloc(0);
1930fd0c672fSmrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
1931fd0c672fSmrg}],
1932fd0c672fSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
193348e69166Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
193448e69166Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1935fd0c672fSmrgfi
1936fd0c672fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1937fd0c672fSmrg
1938fd0c672fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1939fd0c672fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1940fd0c672fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1941fd0c672fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1942fd0c672fSmrgelse
1943fd0c672fSmrg	MALLOC_ZERO_CFLAGS=""
1944fd0c672fSmrg	XMALLOC_ZERO_CFLAGS=""
1945fd0c672fSmrg	XTMALLOC_ZERO_CFLAGS=""
1946fd0c672fSmrgfi
1947fd0c672fSmrg
1948fd0c672fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1949fd0c672fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1950fd0c672fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1951fd0c672fSmrg]) # XORG_CHECK_MALLOC_ZERO
1952fd0c672fSmrg
1953fd0c672fSmrg# XORG_WITH_LINT()
1954fd0c672fSmrg# ----------------
1955fd0c672fSmrg# Minimum version: 1.1.0
1956fd0c672fSmrg#
195748e69166Smrg# This macro enables the use of a tool that flags some suspicious and
195848e69166Smrg# non-portable constructs (likely to be bugs) in C language source code.
195948e69166Smrg# It will attempt to locate the tool and use appropriate options.
196048e69166Smrg# There are various lint type tools on different platforms.
196148e69166Smrg#
196248e69166Smrg# Interface to module:
196348e69166Smrg# LINT:		returns the path to the tool found on the platform
196448e69166Smrg#		or the value set to LINT on the configure cmd line
196548e69166Smrg#		also an Automake conditional
196648e69166Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
196748e69166Smrg#
196848e69166Smrg# --with-lint:	'yes' user instructs the module to use lint
196948e69166Smrg#		'no' user instructs the module not to use lint (default)
197048e69166Smrg#
197148e69166Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
197248e69166Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1973fd0c672fSmrg#
1974fd0c672fSmrgAC_DEFUN([XORG_WITH_LINT],[
1975fd0c672fSmrg
197648e69166SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
197748e69166SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
197848e69166SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1979fd0c672fSmrg		[Use a lint-style source code checker (default: disabled)])],
1980fd0c672fSmrg		[use_lint=$withval], [use_lint=no])
198148e69166Smrg
198248e69166Smrg# Obtain platform specific info like program name and options
198348e69166Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
198448e69166Smrgcase $host_os in
198548e69166Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
198648e69166Smrg	lint_name=splint
198748e69166Smrg	lint_options="-badflag"
198848e69166Smrg	;;
198948e69166Smrg  *freebsd* | *netbsd*)
199048e69166Smrg	lint_name=lint
199148e69166Smrg	lint_options="-u -b"
199248e69166Smrg	;;
199348e69166Smrg  *solaris*)
199448e69166Smrg	lint_name=lint
199548e69166Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
199648e69166Smrg	;;
199748e69166Smrgesac
199848e69166Smrg
199948e69166Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
200048e69166Smrgif test "x$use_lint" = x"yes" ; then
200148e69166Smrg   AC_PATH_PROG([LINT], [$lint_name])
200248e69166Smrg   if test "x$LINT" = "x"; then
200348e69166Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
200448e69166Smrg   fi
200548e69166Smrgelif test "x$use_lint" = x"no" ; then
200648e69166Smrg   if test "x$LINT" != "x"; then
200748e69166Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
200848e69166Smrg   fi
2009fd0c672fSmrgelse
201048e69166Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2011fd0c672fSmrgfi
201248e69166Smrg
201348e69166Smrg# User supplied flags override default flags
201448e69166Smrgif test "x$LINT_FLAGS" != "x"; then
201548e69166Smrg   lint_options=$LINT_FLAGS
2016fd0c672fSmrgfi
2017fd0c672fSmrg
201848e69166SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
201948e69166SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2020fd0c672fSmrg
2021fd0c672fSmrg]) # XORG_WITH_LINT
2022fd0c672fSmrg
2023fd0c672fSmrg# XORG_LINT_LIBRARY(LIBNAME)
2024fd0c672fSmrg# --------------------------
2025fd0c672fSmrg# Minimum version: 1.1.0
2026fd0c672fSmrg#
2027fd0c672fSmrg# Sets up flags for building lint libraries for checking programs that call
2028fd0c672fSmrg# functions in the library.
2029fd0c672fSmrg#
203048e69166Smrg# Interface to module:
203148e69166Smrg# LINTLIB		- Automake variable with the name of lint library file to make
203248e69166Smrg# MAKE_LINT_LIB		- Automake conditional
203348e69166Smrg#
203448e69166Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
203548e69166Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2036fd0c672fSmrg
2037fd0c672fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2038fd0c672fSmrgAC_REQUIRE([XORG_WITH_LINT])
203948e69166SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2040fd0c672fSmrg	[Create lint library (default: disabled)])],
2041fd0c672fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
204248e69166Smrg
204348e69166Smrgif test "x$make_lint_lib" = x"yes" ; then
204448e69166Smrg   LINTLIB=llib-l$1.ln
204548e69166Smrg   if test "x$LINT" = "x"; then
204648e69166Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
204748e69166Smrg   fi
204848e69166Smrgelif test "x$make_lint_lib" != x"no" ; then
204948e69166Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2050fd0c672fSmrgfi
205148e69166Smrg
2052fd0c672fSmrgAC_SUBST(LINTLIB)
2053fd0c672fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2054fd0c672fSmrg
2055fd0c672fSmrg]) # XORG_LINT_LIBRARY
2056fd0c672fSmrg
205748e69166Smrg# XORG_CWARNFLAGS
205848e69166Smrg# ---------------
205948e69166Smrg# Minimum version: 1.2.0
206048e69166Smrg#
206148e69166Smrg# Defines CWARNFLAGS to enable C compiler warnings.
206248e69166Smrg#
206348e69166SmrgAC_DEFUN([XORG_CWARNFLAGS], [
206448e69166SmrgAC_REQUIRE([AC_PROG_CC_C99])
206548e69166Smrgif  test "x$GCC" = xyes ; then
206648e69166Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
206748e69166Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
206848e69166Smrg-Wbad-function-cast -Wformat=2"
206948e69166Smrg    case `$CC -dumpversion` in
207048e69166Smrg    3.4.* | 4.*)
207148e69166Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
207248e69166Smrg	;;
207348e69166Smrg    esac
207448e69166Smrgelse
207548e69166Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
207648e69166Smrg    if test "x$SUNCC" = "xyes"; then
207748e69166Smrg	CWARNFLAGS="-v"
207848e69166Smrg    fi
207948e69166Smrgfi
208048e69166SmrgAC_SUBST(CWARNFLAGS)
208148e69166Smrg]) # XORG_CWARNFLAGS
208248e69166Smrg
208348e69166Smrg# XORG_STRICT_OPTION
208448e69166Smrg# -----------------------
208548e69166Smrg# Minimum version: 1.3.0
208648e69166Smrg#
208748e69166Smrg# Add configure option to enable strict compilation
208848e69166SmrgAC_DEFUN([XORG_STRICT_OPTION], [
208948e69166Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
209048e69166SmrgAC_REQUIRE([AC_PROG_CC_C99])
209148e69166SmrgAC_REQUIRE([XORG_CWARNFLAGS])
209248e69166Smrg
209348e69166SmrgAC_ARG_ENABLE(strict-compilation,
209448e69166Smrg			  AS_HELP_STRING([--enable-strict-compilation],
209548e69166Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
209648e69166Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
209748e69166Smrgif test "x$STRICT_COMPILE" = "xyes"; then
209848e69166Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
209948e69166Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
210048e69166Smrg	if test "x$GCC" = xyes ; then
210148e69166Smrg		STRICT_CFLAGS="-pedantic -Werror"
210248e69166Smrg	elif test "x$SUNCC" = "xyes"; then
210348e69166Smrg		STRICT_CFLAGS="-errwarn"
210448e69166Smrg    elif test "x$INTELCC" = "xyes"; then
210548e69166Smrg		STRICT_CFLAGS="-Werror"
210648e69166Smrg	fi
210748e69166Smrgfi
210848e69166SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
210948e69166SmrgAC_SUBST([CWARNFLAGS])
211048e69166Smrg]) # XORG_STRICT_OPTION
211148e69166Smrg
211248e69166Smrg# XORG_DEFAULT_OPTIONS
211348e69166Smrg# --------------------
211448e69166Smrg# Minimum version: 1.3.0
211548e69166Smrg#
211648e69166Smrg# Defines default options for X.Org modules.
211748e69166Smrg#
211848e69166SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
211948e69166SmrgAC_REQUIRE([AC_PROG_INSTALL])
212048e69166SmrgXORG_CWARNFLAGS
212148e69166SmrgXORG_STRICT_OPTION
212248e69166SmrgXORG_RELEASE_VERSION
212348e69166SmrgXORG_CHANGELOG
212448e69166SmrgXORG_INSTALL
212548e69166SmrgXORG_MANPAGE_SECTIONS
212648e69166Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
212748e69166Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
212848e69166Smrg]) # XORG_DEFAULT_OPTIONS
212948e69166Smrg
213048e69166Smrg# XORG_INSTALL()
213148e69166Smrg# ----------------
213248e69166Smrg# Minimum version: 1.4.0
213348e69166Smrg#
213448e69166Smrg# Defines the variable INSTALL_CMD as the command to copy
213548e69166Smrg# INSTALL from $prefix/share/util-macros.
213648e69166Smrg#
213748e69166SmrgAC_DEFUN([XORG_INSTALL], [
213848e69166SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
213948e69166Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
214048e69166SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
214148e69166Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
214248e69166Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
214348e69166Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
214448e69166SmrgAC_SUBST([INSTALL_CMD])
214548e69166Smrg]) # XORG_INSTALL
2146fd0c672fSmrgdnl Copyright 2005 Red Hat, Inc
2147fd0c672fSmrgdnl
2148fd0c672fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2149fd0c672fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2150fd0c672fSmrgdnl the above copyright notice appear in all copies and that both that
2151fd0c672fSmrgdnl copyright notice and this permission notice appear in supporting
2152fd0c672fSmrgdnl documentation.
2153fd0c672fSmrgdnl
2154fd0c672fSmrgdnl The above copyright notice and this permission notice shall be included
2155fd0c672fSmrgdnl in all copies or substantial portions of the Software.
2156fd0c672fSmrgdnl
2157fd0c672fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2158fd0c672fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2159fd0c672fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2160fd0c672fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2161fd0c672fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2162fd0c672fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2163fd0c672fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2164fd0c672fSmrgdnl
2165fd0c672fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2166fd0c672fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2167fd0c672fSmrgdnl other dealings in this Software without prior written authorization
2168fd0c672fSmrgdnl from the copyright holders.
2169fd0c672fSmrgdnl
2170fd0c672fSmrg
2171fd0c672fSmrg# XORG_RELEASE_VERSION
2172fd0c672fSmrg# --------------------
217348e69166Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2174fd0c672fSmrg 
2175fd0c672fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
2176fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
2177fd0c672fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
2178fd0c672fSmrg		[Major version of this package])
217948e69166Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
2180fd0c672fSmrg	if test "x$PVM" = "x"; then
2181fd0c672fSmrg		PVM="0"
2182fd0c672fSmrg	fi
2183fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
2184fd0c672fSmrg		[$PVM],
2185fd0c672fSmrg		[Minor version of this package])
218648e69166Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
2187fd0c672fSmrg	if test "x$PVP" = "x"; then
2188fd0c672fSmrg		PVP="0"
2189fd0c672fSmrg	fi
2190fd0c672fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
2191fd0c672fSmrg		[$PVP],
2192fd0c672fSmrg		[Patch version of this package])
2193fd0c672fSmrg])
2194fd0c672fSmrg
219548e69166Smrg# XORG_CHANGELOG()
219648e69166Smrg# ----------------
219748e69166Smrg# Minimum version: 1.2.0
219848e69166Smrg#
219948e69166Smrg# Defines the variable CHANGELOG_CMD as the command to generate
220048e69166Smrg# ChangeLog from git.
220148e69166Smrg#
220248e69166Smrg#
220348e69166SmrgAC_DEFUN([XORG_CHANGELOG], [
220448e69166SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
220548e69166Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
220648e69166Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
220748e69166Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
220848e69166SmrgAC_SUBST([CHANGELOG_CMD])
220948e69166Smrg]) # XORG_CHANGELOG
221048e69166Smrg
221148e69166Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
221248e69166Smrg# 
221348e69166Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
221448e69166Smrg#
221548e69166Smrg# This program is free software; you can redistribute it and/or modify
221648e69166Smrg# it under the terms of the GNU General Public License as published by
221748e69166Smrg# the Free Software Foundation; either version 2 of the License, or
221848e69166Smrg# (at your option) any later version.
221948e69166Smrg#
222048e69166Smrg# This program is distributed in the hope that it will be useful, but
222148e69166Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
222248e69166Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
222348e69166Smrg# General Public License for more details.
222448e69166Smrg#
222548e69166Smrg# You should have received a copy of the GNU General Public License
222648e69166Smrg# along with this program; if not, write to the Free Software
222748e69166Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
222848e69166Smrg#
222948e69166Smrg# As a special exception to the GNU General Public License, if you
223048e69166Smrg# distribute this file as part of a program that contains a
223148e69166Smrg# configuration script generated by Autoconf, you may include it under
223248e69166Smrg# the same distribution terms that you use for the rest of that program.
223348e69166Smrg
223448e69166Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
223548e69166Smrg# ----------------------------------
223648e69166SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
223748e69166Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
223848e69166Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
223948e69166SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
224048e69166Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
224148e69166Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
224248e69166Smrgfi
224348e69166Smrgif test -n "$PKG_CONFIG"; then
224448e69166Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
224548e69166Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
224648e69166Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
224748e69166Smrg		AC_MSG_RESULT([yes])
224848e69166Smrg	else
224948e69166Smrg		AC_MSG_RESULT([no])
225048e69166Smrg		PKG_CONFIG=""
225148e69166Smrg	fi
225248e69166Smrg		
225348e69166Smrgfi[]dnl
225448e69166Smrg])# PKG_PROG_PKG_CONFIG
225548e69166Smrg
225648e69166Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
225748e69166Smrg#
225848e69166Smrg# Check to see whether a particular set of modules exists.  Similar
225948e69166Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
226048e69166Smrg#
226148e69166Smrg#
226248e69166Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
226348e69166Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
226448e69166Smrg# PKG_CHECK_EXISTS manually
226548e69166Smrg# --------------------------------------------------------------
226648e69166SmrgAC_DEFUN([PKG_CHECK_EXISTS],
226748e69166Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
226848e69166Smrgif test -n "$PKG_CONFIG" && \
226948e69166Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
227048e69166Smrg  m4_ifval([$2], [$2], [:])
227148e69166Smrgm4_ifvaln([$3], [else
227248e69166Smrg  $3])dnl
227348e69166Smrgfi])
227448e69166Smrg
227548e69166Smrg
227648e69166Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
227748e69166Smrg# ---------------------------------------------
227848e69166Smrgm4_define([_PKG_CONFIG],
227948e69166Smrg[if test -n "$$1"; then
228048e69166Smrg    pkg_cv_[]$1="$$1"
228148e69166Smrg elif test -n "$PKG_CONFIG"; then
228248e69166Smrg    PKG_CHECK_EXISTS([$3],
228348e69166Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
228448e69166Smrg		     [pkg_failed=yes])
228548e69166Smrg else
228648e69166Smrg    pkg_failed=untried
228748e69166Smrgfi[]dnl
228848e69166Smrg])# _PKG_CONFIG
228948e69166Smrg
229048e69166Smrg# _PKG_SHORT_ERRORS_SUPPORTED
229148e69166Smrg# -----------------------------
229248e69166SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
229348e69166Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
229448e69166Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
229548e69166Smrg        _pkg_short_errors_supported=yes
229648e69166Smrgelse
229748e69166Smrg        _pkg_short_errors_supported=no
229848e69166Smrgfi[]dnl
229948e69166Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
230048e69166Smrg
230148e69166Smrg
230248e69166Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
230348e69166Smrg# [ACTION-IF-NOT-FOUND])
230448e69166Smrg#
230548e69166Smrg#
230648e69166Smrg# Note that if there is a possibility the first call to
230748e69166Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
230848e69166Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
230948e69166Smrg#
231048e69166Smrg#
231148e69166Smrg# --------------------------------------------------------------
231248e69166SmrgAC_DEFUN([PKG_CHECK_MODULES],
231348e69166Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
231448e69166SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
231548e69166SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
231648e69166Smrg
231748e69166Smrgpkg_failed=no
231848e69166SmrgAC_MSG_CHECKING([for $1])
231948e69166Smrg
232048e69166Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
232148e69166Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
232248e69166Smrg
232348e69166Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
232448e69166Smrgand $1[]_LIBS to avoid the need to call pkg-config.
232548e69166SmrgSee the pkg-config man page for more details.])
232648e69166Smrg
232748e69166Smrgif test $pkg_failed = yes; then
232848e69166Smrg        _PKG_SHORT_ERRORS_SUPPORTED
232948e69166Smrg        if test $_pkg_short_errors_supported = yes; then
233048e69166Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
233148e69166Smrg        else 
233248e69166Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
233348e69166Smrg        fi
233448e69166Smrg	# Put the nasty error message in config.log where it belongs
233548e69166Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
233648e69166Smrg
233748e69166Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
233848e69166Smrg[Package requirements ($2) were not met:
233948e69166Smrg
234048e69166Smrg$$1_PKG_ERRORS
234148e69166Smrg
234248e69166SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
234348e69166Smrginstalled software in a non-standard prefix.
234448e69166Smrg
234548e69166Smrg_PKG_TEXT
234648e69166Smrg])],
234748e69166Smrg		[AC_MSG_RESULT([no])
234848e69166Smrg                $4])
234948e69166Smrgelif test $pkg_failed = untried; then
235048e69166Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
235148e69166Smrg[The pkg-config script could not be found or is too old.  Make sure it
235248e69166Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
235348e69166Smrgpath to pkg-config.
235448e69166Smrg
235548e69166Smrg_PKG_TEXT
235648e69166Smrg
235748e69166SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
235848e69166Smrg		[$4])
235948e69166Smrgelse
236048e69166Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
236148e69166Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
236248e69166Smrg        AC_MSG_RESULT([yes])
236348e69166Smrg	ifelse([$3], , :, [$3])
236448e69166Smrgfi[]dnl
236548e69166Smrg])# PKG_CHECK_MODULES
236648e69166Smrg
2367