aclocal.m4 revision 8e46b049
17dff02feSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2a850946eSmrg
370f7c90cSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
470f7c90cSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5a850946eSmrg# This file is free software; the Free Software Foundation
6a850946eSmrg# gives unlimited permission to copy and/or distribute it,
7a850946eSmrg# with or without modifications, as long as this notice is preserved.
8a850946eSmrg
9a850946eSmrg# This program is distributed in the hope that it will be useful,
10a850946eSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a850946eSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a850946eSmrg# PARTICULAR PURPOSE.
13a850946eSmrg
1470f7c90cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1570f7c90cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1669a1fe56Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1769a1fe56Smrg[m4_warning([this file was generated for autoconf 2.68.
1870f7c90cSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
1970f7c90cSmrgIf you have problems, you may need to regenerate the build system entirely.
2070f7c90cSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21a850946eSmrg
2270f7c90cSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2370f7c90cSmrg#
2470f7c90cSmrg# This file is free software; the Free Software Foundation
2570f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
2670f7c90cSmrg# with or without modifications, as long as this notice is preserved.
27a850946eSmrg
28a850946eSmrg# AM_AUTOMAKE_VERSION(VERSION)
29a850946eSmrg# ----------------------------
30a850946eSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
31a850946eSmrg# generated from the m4 files accompanying Automake X.Y.
3270f7c90cSmrg# (This private macro should not be called outside this file.)
3370f7c90cSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3470f7c90cSmrg[am__api_version='1.11'
3570f7c90cSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3670f7c90cSmrgdnl require some minimum version.  Point them to the right macro.
377dff02feSmrgm4_if([$1], [1.11.1], [],
3870f7c90cSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3970f7c90cSmrg])
4070f7c90cSmrg
4170f7c90cSmrg# _AM_AUTOCONF_VERSION(VERSION)
4270f7c90cSmrg# -----------------------------
4370f7c90cSmrg# aclocal traces this macro to find the Autoconf version.
4470f7c90cSmrg# This is a private macro too.  Using m4_define simplifies
4570f7c90cSmrg# the logic in aclocal, which can simply ignore this definition.
4670f7c90cSmrgm4_define([_AM_AUTOCONF_VERSION], [])
47a850946eSmrg
48a850946eSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
49a850946eSmrg# -------------------------------
5070f7c90cSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5170f7c90cSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52a850946eSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
537dff02feSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
5470f7c90cSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5570f7c90cSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5670f7c90cSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57a850946eSmrg
5870f7c90cSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59a850946eSmrg
6070f7c90cSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
61a850946eSmrg#
6270f7c90cSmrg# This file is free software; the Free Software Foundation
6370f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
6470f7c90cSmrg# with or without modifications, as long as this notice is preserved.
65a850946eSmrg
66a850946eSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
67a850946eSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
68a850946eSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
69a850946eSmrg#
70a850946eSmrg# Of course, Automake must honor this variable whenever it calls a
71a850946eSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
72a850946eSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
73a850946eSmrg# depending on how configure is run.  This is pretty annoying, since
74a850946eSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
75a850946eSmrg# source directory, any form will work fine, but in subdirectories a
76a850946eSmrg# relative path needs to be adjusted first.
77a850946eSmrg#
78a850946eSmrg# $ac_aux_dir/missing
79a850946eSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
80a850946eSmrg# $top_srcdir/$ac_aux_dir/missing
81a850946eSmrg#    fails if $ac_aux_dir is absolute,
82a850946eSmrg#    fails when called from a subdirectory in a VPATH build with
83a850946eSmrg#          a relative $ac_aux_dir
84a850946eSmrg#
85a850946eSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
86a850946eSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
87a850946eSmrg# harmless because $srcdir is `.', but things will broke when you
88a850946eSmrg# start a VPATH build or use an absolute $srcdir.
89a850946eSmrg#
90a850946eSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
91a850946eSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
92a850946eSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
93a850946eSmrg# and then we would define $MISSING as
94a850946eSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
95a850946eSmrg# This will work as long as MISSING is not called from configure, because
96a850946eSmrg# unfortunately $(top_srcdir) has no meaning in configure.
97a850946eSmrg# However there are other variables, like CC, which are often used in
98a850946eSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99a850946eSmrg#
100a850946eSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
101a850946eSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
102a850946eSmrg# configured tree to be moved without reconfiguration.
103a850946eSmrg
10470f7c90cSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10570f7c90cSmrg[dnl Rely on autoconf to set up CDPATH properly.
10670f7c90cSmrgAC_PREREQ([2.50])dnl
107a850946eSmrg# expand $ac_aux_dir to an absolute path
108a850946eSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
109a850946eSmrg])
110a850946eSmrg
11170f7c90cSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a850946eSmrg
11370f7c90cSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11470f7c90cSmrg# Free Software Foundation, Inc.
11570f7c90cSmrg#
11670f7c90cSmrg# This file is free software; the Free Software Foundation
11770f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
11870f7c90cSmrg# with or without modifications, as long as this notice is preserved.
119a850946eSmrg
12070f7c90cSmrg# serial 9
121a850946eSmrg
12270f7c90cSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12370f7c90cSmrg# -------------------------------------
12470f7c90cSmrg# Define a conditional.
12570f7c90cSmrgAC_DEFUN([AM_CONDITIONAL],
12670f7c90cSmrg[AC_PREREQ(2.52)dnl
12770f7c90cSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12870f7c90cSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12970f7c90cSmrgAC_SUBST([$1_TRUE])dnl
13070f7c90cSmrgAC_SUBST([$1_FALSE])dnl
13170f7c90cSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13270f7c90cSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13370f7c90cSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13470f7c90cSmrgif $2; then
13570f7c90cSmrg  $1_TRUE=
13670f7c90cSmrg  $1_FALSE='#'
137a850946eSmrgelse
13870f7c90cSmrg  $1_TRUE='#'
13970f7c90cSmrg  $1_FALSE=
140a850946eSmrgfi
14170f7c90cSmrgAC_CONFIG_COMMANDS_PRE(
14270f7c90cSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14370f7c90cSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14470f7c90cSmrgUsually this means the macro was only invoked conditionally.]])
14570f7c90cSmrgfi])])
146a850946eSmrg
14770f7c90cSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14870f7c90cSmrg# Free Software Foundation, Inc.
14970f7c90cSmrg#
15070f7c90cSmrg# This file is free software; the Free Software Foundation
15170f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
15270f7c90cSmrg# with or without modifications, as long as this notice is preserved.
153a850946eSmrg
15470f7c90cSmrg# serial 10
155a850946eSmrg
156a850946eSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
157a850946eSmrg# written in clear, in which case automake, when reading aclocal.m4,
158a850946eSmrg# will think it sees a *use*, and therefore will trigger all it's
159a850946eSmrg# C support machinery.  Also note that it means that autoscan, seeing
160a850946eSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161a850946eSmrg
162a850946eSmrg
163a850946eSmrg# _AM_DEPENDENCIES(NAME)
164a850946eSmrg# ----------------------
165a850946eSmrg# See how the compiler implements dependency checking.
166a850946eSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
167a850946eSmrg# We try a few techniques and use that to set a single cache variable.
168a850946eSmrg#
169a850946eSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
170a850946eSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
171a850946eSmrg# dependency, and given that the user is not expected to run this macro,
172a850946eSmrg# just rely on AC_PROG_CC.
173a850946eSmrgAC_DEFUN([_AM_DEPENDENCIES],
174a850946eSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
175a850946eSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
176a850946eSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
177a850946eSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178a850946eSmrg
179a850946eSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
180a850946eSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
181a850946eSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18270f7c90cSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
183a850946eSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
184a850946eSmrg                   [depcc="$$1"   am_compiler_list=])
185a850946eSmrg
186a850946eSmrgAC_CACHE_CHECK([dependency style of $depcc],
187a850946eSmrg               [am_cv_$1_dependencies_compiler_type],
188a850946eSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
189a850946eSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
190a850946eSmrg  # making bogus files that we don't know about and never remove.  For
191a850946eSmrg  # instance it was reported that on HP-UX the gcc test will end up
192a850946eSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
193a850946eSmrg  # in D'.
194a850946eSmrg  mkdir conftest.dir
195a850946eSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
196a850946eSmrg  # using a relative directory.
197a850946eSmrg  cp "$am_depcomp" conftest.dir
198a850946eSmrg  cd conftest.dir
199a850946eSmrg  # We will build objects and dependencies in a subdirectory because
200a850946eSmrg  # it helps to detect inapplicable dependency modes.  For instance
201a850946eSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
202a850946eSmrg  # side effect of compilation, but ICC will put the dependencies in
203a850946eSmrg  # the current directory while Tru64 will put them in the object
204a850946eSmrg  # directory.
205a850946eSmrg  mkdir sub
206a850946eSmrg
207a850946eSmrg  am_cv_$1_dependencies_compiler_type=none
208a850946eSmrg  if test "$am_compiler_list" = ""; then
209a850946eSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
210a850946eSmrg  fi
21170f7c90cSmrg  am__universal=false
21270f7c90cSmrg  m4_case([$1], [CC],
21370f7c90cSmrg    [case " $depcc " in #(
21470f7c90cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21570f7c90cSmrg     esac],
21670f7c90cSmrg    [CXX],
21770f7c90cSmrg    [case " $depcc " in #(
21870f7c90cSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21970f7c90cSmrg     esac])
22070f7c90cSmrg
221a850946eSmrg  for depmode in $am_compiler_list; do
222a850946eSmrg    # Setup a source with many dependencies, because some compilers
223a850946eSmrg    # like to wrap large dependency lists on column 80 (with \), and
224a850946eSmrg    # we should not choose a depcomp mode which is confused by this.
225a850946eSmrg    #
226a850946eSmrg    # We need to recreate these files for each test, as the compiler may
227a850946eSmrg    # overwrite some of them when testing with obscure command lines.
228a850946eSmrg    # This happens at least with the AIX C compiler.
229a850946eSmrg    : > sub/conftest.c
230a850946eSmrg    for i in 1 2 3 4 5 6; do
231a850946eSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23270f7c90cSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23370f7c90cSmrg      # Solaris 8's {/usr,}/bin/sh.
23470f7c90cSmrg      touch sub/conftst$i.h
235a850946eSmrg    done
236a850946eSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
237a850946eSmrg
23870f7c90cSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
23970f7c90cSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24070f7c90cSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24170f7c90cSmrg    # versions had trouble with output in subdirs
24270f7c90cSmrg    am__obj=sub/conftest.${OBJEXT-o}
24370f7c90cSmrg    am__minus_obj="-o $am__obj"
244a850946eSmrg    case $depmode in
24570f7c90cSmrg    gcc)
24670f7c90cSmrg      # This depmode causes a compiler race in universal mode.
24770f7c90cSmrg      test "$am__universal" = false || continue
24870f7c90cSmrg      ;;
249a850946eSmrg    nosideeffect)
250a850946eSmrg      # after this tag, mechanisms are not by side-effect, so they'll
251a850946eSmrg      # only be used when explicitly requested
252a850946eSmrg      if test "x$enable_dependency_tracking" = xyes; then
253a850946eSmrg	continue
254a850946eSmrg      else
255a850946eSmrg	break
256a850946eSmrg      fi
257a850946eSmrg      ;;
25870f7c90cSmrg    msvisualcpp | msvcmsys)
25970f7c90cSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
26070f7c90cSmrg      # not run yet.  These depmodes are late enough in the game, and
26170f7c90cSmrg      # so weak that their functioning should not be impacted.
26270f7c90cSmrg      am__obj=conftest.${OBJEXT-o}
26370f7c90cSmrg      am__minus_obj=
26470f7c90cSmrg      ;;
265a850946eSmrg    none) break ;;
266a850946eSmrg    esac
267a850946eSmrg    if depmode=$depmode \
26870f7c90cSmrg       source=sub/conftest.c object=$am__obj \
269a850946eSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27070f7c90cSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
271a850946eSmrg         >/dev/null 2>conftest.err &&
27270f7c90cSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
273a850946eSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27470f7c90cSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
275a850946eSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
276a850946eSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27770f7c90cSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27870f7c90cSmrg      # that says an option was ignored or not supported.
27970f7c90cSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28070f7c90cSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28170f7c90cSmrg      # The diagnosis changed in icc 8.0:
28270f7c90cSmrg      #   icc: Command line remark: option '-MP' not supported
28370f7c90cSmrg      if (grep 'ignoring option' conftest.err ||
28470f7c90cSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
285a850946eSmrg        am_cv_$1_dependencies_compiler_type=$depmode
286a850946eSmrg        break
287a850946eSmrg      fi
288a850946eSmrg    fi
289a850946eSmrg  done
290a850946eSmrg
291a850946eSmrg  cd ..
292a850946eSmrg  rm -rf conftest.dir
293a850946eSmrgelse
294a850946eSmrg  am_cv_$1_dependencies_compiler_type=none
295a850946eSmrgfi
296a850946eSmrg])
297a850946eSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
298a850946eSmrgAM_CONDITIONAL([am__fastdep$1], [
299a850946eSmrg  test "x$enable_dependency_tracking" != xno \
300a850946eSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
301a850946eSmrg])
302a850946eSmrg
303a850946eSmrg
304a850946eSmrg# AM_SET_DEPDIR
305a850946eSmrg# -------------
306a850946eSmrg# Choose a directory name for dependency files.
307a850946eSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
308a850946eSmrgAC_DEFUN([AM_SET_DEPDIR],
309a850946eSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
310a850946eSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
311a850946eSmrg])
312a850946eSmrg
313a850946eSmrg
314a850946eSmrg# AM_DEP_TRACK
315a850946eSmrg# ------------
316a850946eSmrgAC_DEFUN([AM_DEP_TRACK],
317a850946eSmrg[AC_ARG_ENABLE(dependency-tracking,
31870f7c90cSmrg[  --disable-dependency-tracking  speeds up one-time build
31970f7c90cSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
320a850946eSmrgif test "x$enable_dependency_tracking" != xno; then
321a850946eSmrg  am_depcomp="$ac_aux_dir/depcomp"
322a850946eSmrg  AMDEPBACKSLASH='\'
323a850946eSmrgfi
324a850946eSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32570f7c90cSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32670f7c90cSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
327a850946eSmrg])
328a850946eSmrg
32970f7c90cSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
330a850946eSmrg
33170f7c90cSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33270f7c90cSmrg# Free Software Foundation, Inc.
33370f7c90cSmrg#
33470f7c90cSmrg# This file is free software; the Free Software Foundation
33570f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
33670f7c90cSmrg# with or without modifications, as long as this notice is preserved.
337a850946eSmrg
33870f7c90cSmrg#serial 5
339a850946eSmrg
340a850946eSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
341a850946eSmrg# ------------------------------
342a850946eSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34370f7c90cSmrg[{
34470f7c90cSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
34570f7c90cSmrg  # are listed without --file.  Let's play safe and only enable the eval
34670f7c90cSmrg  # if we detect the quoting.
34770f7c90cSmrg  case $CONFIG_FILES in
34870f7c90cSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
34970f7c90cSmrg  *)   set x $CONFIG_FILES ;;
35070f7c90cSmrg  esac
35170f7c90cSmrg  shift
35270f7c90cSmrg  for mf
35370f7c90cSmrg  do
35470f7c90cSmrg    # Strip MF so we end up with the name of the file.
35570f7c90cSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35670f7c90cSmrg    # Check whether this is an Automake generated Makefile or not.
35770f7c90cSmrg    # We used to match only the files named `Makefile.in', but
35870f7c90cSmrg    # some people rename them; so instead we look at the file content.
35970f7c90cSmrg    # Grep'ing the first line is not enough: some people post-process
36070f7c90cSmrg    # each Makefile.in and add a new line on top of each file to say so.
36170f7c90cSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
36270f7c90cSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
36370f7c90cSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36470f7c90cSmrg      dirpart=`AS_DIRNAME("$mf")`
36570f7c90cSmrg    else
36670f7c90cSmrg      continue
36770f7c90cSmrg    fi
36870f7c90cSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
36970f7c90cSmrg    # from the Makefile without running `make'.
37070f7c90cSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37170f7c90cSmrg    test -z "$DEPDIR" && continue
37270f7c90cSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37370f7c90cSmrg    test -z "am__include" && continue
37470f7c90cSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37570f7c90cSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
37670f7c90cSmrg    U=`sed -n 's/^U = //p' < "$mf"`
37770f7c90cSmrg    # Find all dependency output files, they are included files with
37870f7c90cSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37970f7c90cSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38070f7c90cSmrg    # expansion.
38170f7c90cSmrg    for file in `sed -n "
38270f7c90cSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38370f7c90cSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
38470f7c90cSmrg      # Make sure the directory exists.
38570f7c90cSmrg      test -f "$dirpart/$file" && continue
38670f7c90cSmrg      fdir=`AS_DIRNAME(["$file"])`
38770f7c90cSmrg      AS_MKDIR_P([$dirpart/$fdir])
38870f7c90cSmrg      # echo "creating $dirpart/$file"
38970f7c90cSmrg      echo '# dummy' > "$dirpart/$file"
39070f7c90cSmrg    done
391a850946eSmrg  done
39270f7c90cSmrg}
393a850946eSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394a850946eSmrg
395a850946eSmrg
396a850946eSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
397a850946eSmrg# -----------------------------
398a850946eSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
399a850946eSmrg#
400a850946eSmrg# This code is only required when automatic dependency tracking
401a850946eSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
402a850946eSmrg# need in order to bootstrap the dependency handling code.
403a850946eSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
404a850946eSmrg[AC_CONFIG_COMMANDS([depfiles],
405a850946eSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
406a850946eSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
407a850946eSmrg])
408a850946eSmrg
40970f7c90cSmrg# Do all the work for Automake.                             -*- Autoconf -*-
410a850946eSmrg
41170f7c90cSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
41270f7c90cSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
41370f7c90cSmrg#
41470f7c90cSmrg# This file is free software; the Free Software Foundation
41570f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
41670f7c90cSmrg# with or without modifications, as long as this notice is preserved.
417a850946eSmrg
41870f7c90cSmrg# serial 16
419a850946eSmrg
42070f7c90cSmrg# This macro actually does too much.  Some checks are only needed if
42170f7c90cSmrg# your package does certain things.  But this isn't really a big deal.
42270f7c90cSmrg
42370f7c90cSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42470f7c90cSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42570f7c90cSmrg# -----------------------------------------------
42670f7c90cSmrg# The call with PACKAGE and VERSION arguments is the old style
42770f7c90cSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42870f7c90cSmrg# and VERSION should now be passed to AC_INIT and removed from
42970f7c90cSmrg# the call to AM_INIT_AUTOMAKE.
43070f7c90cSmrg# We support both call styles for the transition.  After
43170f7c90cSmrg# the next Automake release, Autoconf can make the AC_INIT
43270f7c90cSmrg# arguments mandatory, and then we can depend on a new Autoconf
43370f7c90cSmrg# release and drop the old call support.
43470f7c90cSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43570f7c90cSmrg[AC_PREREQ([2.62])dnl
43670f7c90cSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43770f7c90cSmrgdnl the ones we care about.
43870f7c90cSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43970f7c90cSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44070f7c90cSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44170f7c90cSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44270f7c90cSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44370f7c90cSmrg  # is not polluted with repeated "-I."
44470f7c90cSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44570f7c90cSmrg  # test to see if srcdir already configured
44670f7c90cSmrg  if test -f $srcdir/config.status; then
44770f7c90cSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44870f7c90cSmrg  fi
449a850946eSmrgfi
45070f7c90cSmrg
45170f7c90cSmrg# test whether we have cygpath
45270f7c90cSmrgif test -z "$CYGPATH_W"; then
45370f7c90cSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45470f7c90cSmrg    CYGPATH_W='cygpath -w'
45570f7c90cSmrg  else
45670f7c90cSmrg    CYGPATH_W=echo
45770f7c90cSmrg  fi
458a850946eSmrgfi
45970f7c90cSmrgAC_SUBST([CYGPATH_W])
460a850946eSmrg
46170f7c90cSmrg# Define the identity of the package.
46270f7c90cSmrgdnl Distinguish between old-style and new-style calls.
46370f7c90cSmrgm4_ifval([$2],
46470f7c90cSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46570f7c90cSmrg AC_SUBST([PACKAGE], [$1])dnl
46670f7c90cSmrg AC_SUBST([VERSION], [$2])],
46770f7c90cSmrg[_AM_SET_OPTIONS([$1])dnl
46870f7c90cSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46970f7c90cSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47070f7c90cSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47170f7c90cSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47270f7c90cSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473a850946eSmrg
47470f7c90cSmrg_AM_IF_OPTION([no-define],,
47570f7c90cSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47670f7c90cSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
477a850946eSmrg
47870f7c90cSmrg# Some tools Automake needs.
47970f7c90cSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48070f7c90cSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48170f7c90cSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48270f7c90cSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48370f7c90cSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48470f7c90cSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48570f7c90cSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
48670f7c90cSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
48770f7c90cSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48870f7c90cSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48970f7c90cSmrg# We need awk for the "check" target.  The system "awk" is bad on
49070f7c90cSmrg# some platforms.
49170f7c90cSmrgAC_REQUIRE([AC_PROG_AWK])dnl
49270f7c90cSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49370f7c90cSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49470f7c90cSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
49570f7c90cSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
49670f7c90cSmrg			     [_AM_PROG_TAR([v7])])])
49770f7c90cSmrg_AM_IF_OPTION([no-dependencies],,
49870f7c90cSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
49970f7c90cSmrg		  [_AM_DEPENDENCIES(CC)],
50070f7c90cSmrg		  [define([AC_PROG_CC],
50170f7c90cSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50270f7c90cSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
50370f7c90cSmrg		  [_AM_DEPENDENCIES(CXX)],
50470f7c90cSmrg		  [define([AC_PROG_CXX],
50570f7c90cSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50670f7c90cSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
50770f7c90cSmrg		  [_AM_DEPENDENCIES(OBJC)],
50870f7c90cSmrg		  [define([AC_PROG_OBJC],
50970f7c90cSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51070f7c90cSmrg])
51170f7c90cSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
51270f7c90cSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
51370f7c90cSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
51470f7c90cSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
51570f7c90cSmrgAC_CONFIG_COMMANDS_PRE(dnl
51670f7c90cSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
51770f7c90cSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51870f7c90cSmrg])
519a850946eSmrg
52070f7c90cSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
52170f7c90cSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
52270f7c90cSmrgdnl mangled by Autoconf and run in a shell conditional statement.
52370f7c90cSmrgm4_define([_AC_COMPILER_EXEEXT],
52470f7c90cSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525a850946eSmrg
526a850946eSmrg
52770f7c90cSmrg# When config.status generates a header, we must update the stamp-h file.
52870f7c90cSmrg# This file resides in the same directory as the config header
52970f7c90cSmrg# that is generated.  The stamp files are numbered to have different names.
53070f7c90cSmrg
53170f7c90cSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53270f7c90cSmrg# loop where config.status creates the headers, so we can generate
53370f7c90cSmrg# our stamp files there.
53470f7c90cSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53570f7c90cSmrg[# Compute $1's index in $config_headers.
53670f7c90cSmrg_am_arg=$1
53770f7c90cSmrg_am_stamp_count=1
53870f7c90cSmrgfor _am_header in $config_headers :; do
53970f7c90cSmrg  case $_am_header in
54070f7c90cSmrg    $_am_arg | $_am_arg:* )
54170f7c90cSmrg      break ;;
54270f7c90cSmrg    * )
54370f7c90cSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54470f7c90cSmrg  esac
54570f7c90cSmrgdone
54670f7c90cSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547a850946eSmrg
54870f7c90cSmrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54970f7c90cSmrg#
55070f7c90cSmrg# This file is free software; the Free Software Foundation
55170f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
55270f7c90cSmrg# with or without modifications, as long as this notice is preserved.
553a850946eSmrg
55470f7c90cSmrg# AM_PROG_INSTALL_SH
55570f7c90cSmrg# ------------------
55670f7c90cSmrg# Define $install_sh.
55770f7c90cSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55870f7c90cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
55970f7c90cSmrgif test x"${install_sh}" != xset; then
56070f7c90cSmrg  case $am_aux_dir in
56170f7c90cSmrg  *\ * | *\	*)
56270f7c90cSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
56370f7c90cSmrg  *)
56470f7c90cSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
56570f7c90cSmrg  esac
566a850946eSmrgfi
56770f7c90cSmrgAC_SUBST(install_sh)])
568a850946eSmrg
56970f7c90cSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57070f7c90cSmrg#
57170f7c90cSmrg# This file is free software; the Free Software Foundation
57270f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
57370f7c90cSmrg# with or without modifications, as long as this notice is preserved.
574a850946eSmrg
57570f7c90cSmrg# serial 2
576a850946eSmrg
57770f7c90cSmrg# Check whether the underlying file-system supports filenames
57870f7c90cSmrg# with a leading dot.  For instance MS-DOS doesn't.
57970f7c90cSmrgAC_DEFUN([AM_SET_LEADING_DOT],
58070f7c90cSmrg[rm -rf .tst 2>/dev/null
58170f7c90cSmrgmkdir .tst 2>/dev/null
58270f7c90cSmrgif test -d .tst; then
58370f7c90cSmrg  am__leading_dot=.
58470f7c90cSmrgelse
58570f7c90cSmrg  am__leading_dot=_
58670f7c90cSmrgfi
58770f7c90cSmrgrmdir .tst 2>/dev/null
58870f7c90cSmrgAC_SUBST([am__leading_dot])])
589a850946eSmrg
59070f7c90cSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
59170f7c90cSmrg# From Jim Meyering
592a850946eSmrg
59370f7c90cSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
59470f7c90cSmrg# Free Software Foundation, Inc.
59570f7c90cSmrg#
59670f7c90cSmrg# This file is free software; the Free Software Foundation
59770f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
59870f7c90cSmrg# with or without modifications, as long as this notice is preserved.
599a850946eSmrg
60070f7c90cSmrg# serial 5
601a850946eSmrg
60270f7c90cSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
60370f7c90cSmrg# ----------------------------------
60470f7c90cSmrg# Control maintainer-specific portions of Makefiles.
60570f7c90cSmrg# Default is to disable them, unless `enable' is passed literally.
60670f7c90cSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
60770f7c90cSmrg# can override the default with the --enable/--disable switch.
608a850946eSmrgAC_DEFUN([AM_MAINTAINER_MODE],
60970f7c90cSmrg[m4_case(m4_default([$1], [disable]),
61070f7c90cSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
61170f7c90cSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
61270f7c90cSmrg       [m4_define([am_maintainer_other], [enable])
61370f7c90cSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
61470f7c90cSmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
61570f7c90cSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
61670f7c90cSmrg  AC_ARG_ENABLE([maintainer-mode],
61770f7c90cSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
61870f7c90cSmrg			  (and sometimes confusing) to the casual installer],
61970f7c90cSmrg      [USE_MAINTAINER_MODE=$enableval],
62070f7c90cSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
621a850946eSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
62270f7c90cSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
623a850946eSmrg  MAINT=$MAINTAINER_MODE_TRUE
62470f7c90cSmrg  AC_SUBST([MAINT])dnl
625a850946eSmrg]
626a850946eSmrg)
627a850946eSmrg
628a850946eSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629a850946eSmrg
63070f7c90cSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631a850946eSmrg
63270f7c90cSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
63370f7c90cSmrg#
63470f7c90cSmrg# This file is free software; the Free Software Foundation
63570f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
63670f7c90cSmrg# with or without modifications, as long as this notice is preserved.
637a850946eSmrg
63870f7c90cSmrg# serial 4
639a850946eSmrg
64070f7c90cSmrg# AM_MAKE_INCLUDE()
64170f7c90cSmrg# -----------------
64270f7c90cSmrg# Check to see how make treats includes.
64370f7c90cSmrgAC_DEFUN([AM_MAKE_INCLUDE],
64470f7c90cSmrg[am_make=${MAKE-make}
64570f7c90cSmrgcat > confinc << 'END'
64670f7c90cSmrgam__doit:
64770f7c90cSmrg	@echo this is the am__doit target
64870f7c90cSmrg.PHONY: am__doit
64970f7c90cSmrgEND
65070f7c90cSmrg# If we don't find an include directive, just comment out the code.
65170f7c90cSmrgAC_MSG_CHECKING([for style of include used by $am_make])
65270f7c90cSmrgam__include="#"
65370f7c90cSmrgam__quote=
65470f7c90cSmrg_am_result=none
65570f7c90cSmrg# First try GNU make style include.
65670f7c90cSmrgecho "include confinc" > confmf
65770f7c90cSmrg# Ignore all kinds of additional output from `make'.
65870f7c90cSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
65970f7c90cSmrg*the\ am__doit\ target*)
66070f7c90cSmrg  am__include=include
66170f7c90cSmrg  am__quote=
66270f7c90cSmrg  _am_result=GNU
66370f7c90cSmrg  ;;
66470f7c90cSmrgesac
66570f7c90cSmrg# Now try BSD make style include.
66670f7c90cSmrgif test "$am__include" = "#"; then
66770f7c90cSmrg   echo '.include "confinc"' > confmf
66870f7c90cSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
66970f7c90cSmrg   *the\ am__doit\ target*)
67070f7c90cSmrg     am__include=.include
67170f7c90cSmrg     am__quote="\""
67270f7c90cSmrg     _am_result=BSD
67370f7c90cSmrg     ;;
67470f7c90cSmrg   esac
67570f7c90cSmrgfi
67670f7c90cSmrgAC_SUBST([am__include])
67770f7c90cSmrgAC_SUBST([am__quote])
67870f7c90cSmrgAC_MSG_RESULT([$_am_result])
67970f7c90cSmrgrm -f confinc confmf
68070f7c90cSmrg])
681a850946eSmrg
68270f7c90cSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
683a850946eSmrg
68470f7c90cSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68570f7c90cSmrg# Free Software Foundation, Inc.
68670f7c90cSmrg#
68770f7c90cSmrg# This file is free software; the Free Software Foundation
68870f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
68970f7c90cSmrg# with or without modifications, as long as this notice is preserved.
690a850946eSmrg
691a850946eSmrg# serial 6
692a850946eSmrg
69370f7c90cSmrg# AM_MISSING_PROG(NAME, PROGRAM)
69470f7c90cSmrg# ------------------------------
69570f7c90cSmrgAC_DEFUN([AM_MISSING_PROG],
69670f7c90cSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69770f7c90cSmrg$1=${$1-"${am_missing_run}$2"}
69870f7c90cSmrgAC_SUBST($1)])
699a850946eSmrg
700a850946eSmrg
70170f7c90cSmrg# AM_MISSING_HAS_RUN
70270f7c90cSmrg# ------------------
70370f7c90cSmrg# Define MISSING if not defined so far and test if it supports --run.
70470f7c90cSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70570f7c90cSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70670f7c90cSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70770f7c90cSmrgAC_REQUIRE_AUX_FILE([missing])dnl
70870f7c90cSmrgif test x"${MISSING+set}" != xset; then
70970f7c90cSmrg  case $am_aux_dir in
71070f7c90cSmrg  *\ * | *\	*)
71170f7c90cSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
71270f7c90cSmrg  *)
71370f7c90cSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
71470f7c90cSmrg  esac
715a850946eSmrgfi
71670f7c90cSmrg# Use eval to expand $SHELL
71770f7c90cSmrgif eval "$MISSING --run true"; then
71870f7c90cSmrg  am_missing_run="$MISSING --run "
71970f7c90cSmrgelse
72070f7c90cSmrg  am_missing_run=
72170f7c90cSmrg  AC_MSG_WARN([`missing' script is too old or missing])
72270f7c90cSmrgfi
72370f7c90cSmrg])
724a850946eSmrg
72570f7c90cSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726a850946eSmrg#
72770f7c90cSmrg# This file is free software; the Free Software Foundation
72870f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
72970f7c90cSmrg# with or without modifications, as long as this notice is preserved.
73070f7c90cSmrg
73170f7c90cSmrg# AM_PROG_MKDIR_P
73270f7c90cSmrg# ---------------
73370f7c90cSmrg# Check for `mkdir -p'.
73470f7c90cSmrgAC_DEFUN([AM_PROG_MKDIR_P],
73570f7c90cSmrg[AC_PREREQ([2.60])dnl
73670f7c90cSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73770f7c90cSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73870f7c90cSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
73970f7c90cSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74070f7c90cSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74170f7c90cSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74270f7c90cSmrgdnl adjustment using top_builddir (which is defined more often than
74370f7c90cSmrgdnl MKDIR_P).
74470f7c90cSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74570f7c90cSmrgcase $mkdir_p in
74670f7c90cSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74770f7c90cSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74870f7c90cSmrgesac
74970f7c90cSmrg])
75070f7c90cSmrg
75170f7c90cSmrg# Helper functions for option handling.                     -*- Autoconf -*-
75270f7c90cSmrg
75370f7c90cSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754a850946eSmrg#
75570f7c90cSmrg# This file is free software; the Free Software Foundation
75670f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
75770f7c90cSmrg# with or without modifications, as long as this notice is preserved.
758a850946eSmrg
75970f7c90cSmrg# serial 4
760a850946eSmrg
76170f7c90cSmrg# _AM_MANGLE_OPTION(NAME)
76270f7c90cSmrg# -----------------------
76370f7c90cSmrgAC_DEFUN([_AM_MANGLE_OPTION],
76470f7c90cSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
765a850946eSmrg
76670f7c90cSmrg# _AM_SET_OPTION(NAME)
76770f7c90cSmrg# ------------------------------
76870f7c90cSmrg# Set option NAME.  Presently that only means defining a flag for this option.
76970f7c90cSmrgAC_DEFUN([_AM_SET_OPTION],
77070f7c90cSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771a850946eSmrg
77270f7c90cSmrg# _AM_SET_OPTIONS(OPTIONS)
77370f7c90cSmrg# ----------------------------------
77470f7c90cSmrg# OPTIONS is a space-separated list of Automake options.
77570f7c90cSmrgAC_DEFUN([_AM_SET_OPTIONS],
77670f7c90cSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
777a850946eSmrg
77870f7c90cSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77970f7c90cSmrg# -------------------------------------------
78070f7c90cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78170f7c90cSmrgAC_DEFUN([_AM_IF_OPTION],
78270f7c90cSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78370f7c90cSmrg
78470f7c90cSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78570f7c90cSmrg
78670f7c90cSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78770f7c90cSmrg# Free Software Foundation, Inc.
788a850946eSmrg#
78970f7c90cSmrg# This file is free software; the Free Software Foundation
79070f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
79170f7c90cSmrg# with or without modifications, as long as this notice is preserved.
79270f7c90cSmrg
79370f7c90cSmrg# serial 5
79470f7c90cSmrg
79570f7c90cSmrg# AM_SANITY_CHECK
79670f7c90cSmrg# ---------------
79770f7c90cSmrgAC_DEFUN([AM_SANITY_CHECK],
79870f7c90cSmrg[AC_MSG_CHECKING([whether build environment is sane])
79970f7c90cSmrg# Just in case
80070f7c90cSmrgsleep 1
80170f7c90cSmrgecho timestamp > conftest.file
80270f7c90cSmrg# Reject unsafe characters in $srcdir or the absolute working directory
80370f7c90cSmrg# name.  Accept space and tab only in the latter.
80470f7c90cSmrgam_lf='
80570f7c90cSmrg'
80670f7c90cSmrgcase `pwd` in
80770f7c90cSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
80870f7c90cSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
80970f7c90cSmrgesac
81070f7c90cSmrgcase $srcdir in
81170f7c90cSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
81270f7c90cSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
81370f7c90cSmrgesac
81470f7c90cSmrg
81570f7c90cSmrg# Do `set' in a subshell so we don't clobber the current shell's
81670f7c90cSmrg# arguments.  Must try -L first in case configure is actually a
81770f7c90cSmrg# symlink; some systems play weird games with the mod time of symlinks
81870f7c90cSmrg# (eg FreeBSD returns the mod time of the symlink's containing
81970f7c90cSmrg# directory).
82070f7c90cSmrgif (
82170f7c90cSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82270f7c90cSmrg   if test "$[*]" = "X"; then
82370f7c90cSmrg      # -L didn't work.
82470f7c90cSmrg      set X `ls -t "$srcdir/configure" conftest.file`
82570f7c90cSmrg   fi
82670f7c90cSmrg   rm -f conftest.file
82770f7c90cSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82870f7c90cSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82970f7c90cSmrg
83070f7c90cSmrg      # If neither matched, then we have a broken ls.  This can happen
83170f7c90cSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83270f7c90cSmrg      # broken ls alias from the environment.  This has actually
83370f7c90cSmrg      # happened.  Such a system could not be considered "sane".
83470f7c90cSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83570f7c90cSmrgalias in your environment])
83670f7c90cSmrg   fi
83770f7c90cSmrg
83870f7c90cSmrg   test "$[2]" = conftest.file
83970f7c90cSmrg   )
84070f7c90cSmrgthen
84170f7c90cSmrg   # Ok.
84270f7c90cSmrg   :
84370f7c90cSmrgelse
84470f7c90cSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
84570f7c90cSmrgCheck your system clock])
84670f7c90cSmrgfi
84770f7c90cSmrgAC_MSG_RESULT(yes)])
84870f7c90cSmrg
84970f7c90cSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
850a850946eSmrg#
85170f7c90cSmrg# This file is free software; the Free Software Foundation
85270f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
85370f7c90cSmrg# with or without modifications, as long as this notice is preserved.
85470f7c90cSmrg
85570f7c90cSmrg# serial 1
85670f7c90cSmrg
85770f7c90cSmrg# AM_SILENT_RULES([DEFAULT])
85870f7c90cSmrg# --------------------------
85970f7c90cSmrg# Enable less verbose build rules; with the default set to DEFAULT
86070f7c90cSmrg# (`yes' being less verbose, `no' or empty being verbose).
86170f7c90cSmrgAC_DEFUN([AM_SILENT_RULES],
86270f7c90cSmrg[AC_ARG_ENABLE([silent-rules],
86370f7c90cSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
86470f7c90cSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
86570f7c90cSmrgcase $enable_silent_rules in
86670f7c90cSmrgyes) AM_DEFAULT_VERBOSITY=0;;
86770f7c90cSmrgno)  AM_DEFAULT_VERBOSITY=1;;
86870f7c90cSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86970f7c90cSmrgesac
87070f7c90cSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
87170f7c90cSmrgAM_BACKSLASH='\'
87270f7c90cSmrgAC_SUBST([AM_BACKSLASH])dnl
87370f7c90cSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
87470f7c90cSmrg])
87570f7c90cSmrg
87670f7c90cSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877a850946eSmrg#
87870f7c90cSmrg# This file is free software; the Free Software Foundation
87970f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
88070f7c90cSmrg# with or without modifications, as long as this notice is preserved.
881a850946eSmrg
88270f7c90cSmrg# AM_PROG_INSTALL_STRIP
88370f7c90cSmrg# ---------------------
88470f7c90cSmrg# One issue with vendor `install' (even GNU) is that you can't
88570f7c90cSmrg# specify the program used to strip binaries.  This is especially
88670f7c90cSmrg# annoying in cross-compiling environments, where the build's strip
88770f7c90cSmrg# is unlikely to handle the host's binaries.
88870f7c90cSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88970f7c90cSmrg# always use install-sh in `make install-strip', and initialize
89070f7c90cSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
89170f7c90cSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89270f7c90cSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89370f7c90cSmrg# Installed binaries are usually stripped using `strip' when the user
89470f7c90cSmrg# run `make install-strip'.  However `strip' might not be the right
89570f7c90cSmrg# tool to use in cross-compilation environments, therefore Automake
89670f7c90cSmrg# will honor the `STRIP' environment variable to overrule this program.
89770f7c90cSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89870f7c90cSmrgif test "$cross_compiling" != no; then
89970f7c90cSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
90070f7c90cSmrgfi
90170f7c90cSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90270f7c90cSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903a850946eSmrg
90470f7c90cSmrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90570f7c90cSmrg#
90670f7c90cSmrg# This file is free software; the Free Software Foundation
90770f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
90870f7c90cSmrg# with or without modifications, as long as this notice is preserved.
909a850946eSmrg
91070f7c90cSmrg# serial 2
911a850946eSmrg
91270f7c90cSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
91370f7c90cSmrg# ---------------------------
91470f7c90cSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91570f7c90cSmrg# This macro is traced by Automake.
91670f7c90cSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917a850946eSmrg
91870f7c90cSmrg# AM_SUBST_NOTMAKE(VARIABLE)
91970f7c90cSmrg# ---------------------------
92070f7c90cSmrg# Public sister of _AM_SUBST_NOTMAKE.
92170f7c90cSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922a850946eSmrg
92370f7c90cSmrg# Check how to create a tarball.                            -*- Autoconf -*-
924a850946eSmrg
92570f7c90cSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92670f7c90cSmrg#
92770f7c90cSmrg# This file is free software; the Free Software Foundation
92870f7c90cSmrg# gives unlimited permission to copy and/or distribute it,
92970f7c90cSmrg# with or without modifications, as long as this notice is preserved.
930a850946eSmrg
93170f7c90cSmrg# serial 2
932a850946eSmrg
93370f7c90cSmrg# _AM_PROG_TAR(FORMAT)
93470f7c90cSmrg# --------------------
93570f7c90cSmrg# Check how to create a tarball in format FORMAT.
93670f7c90cSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
93770f7c90cSmrg#
93870f7c90cSmrg# Substitute a variable $(am__tar) that is a command
93970f7c90cSmrg# writing to stdout a FORMAT-tarball containing the directory
94070f7c90cSmrg# $tardir.
94170f7c90cSmrg#     tardir=directory && $(am__tar) > result.tar
94270f7c90cSmrg#
94370f7c90cSmrg# Substitute a variable $(am__untar) that extract such
94470f7c90cSmrg# a tarball read from stdin.
94570f7c90cSmrg#     $(am__untar) < result.tar
94670f7c90cSmrgAC_DEFUN([_AM_PROG_TAR],
94770f7c90cSmrg[# Always define AMTAR for backward compatibility.
94870f7c90cSmrgAM_MISSING_PROG([AMTAR], [tar])
94970f7c90cSmrgm4_if([$1], [v7],
95070f7c90cSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95170f7c90cSmrg     [m4_case([$1], [ustar],, [pax],,
95270f7c90cSmrg              [m4_fatal([Unknown tar format])])
95370f7c90cSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95470f7c90cSmrg# Loop over all known methods to create a tar archive until one works.
95570f7c90cSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95670f7c90cSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95770f7c90cSmrg# Do not fold the above two line into one, because Tru64 sh and
95870f7c90cSmrg# Solaris sh will not grok spaces in the rhs of `-'.
95970f7c90cSmrgfor _am_tool in $_am_tools
96070f7c90cSmrgdo
96170f7c90cSmrg  case $_am_tool in
96270f7c90cSmrg  gnutar)
96370f7c90cSmrg    for _am_tar in tar gnutar gtar;
96470f7c90cSmrg    do
96570f7c90cSmrg      AM_RUN_LOG([$_am_tar --version]) && break
96670f7c90cSmrg    done
96770f7c90cSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96870f7c90cSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96970f7c90cSmrg    am__untar="$_am_tar -xf -"
97070f7c90cSmrg    ;;
97170f7c90cSmrg  plaintar)
97270f7c90cSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97370f7c90cSmrg    # ustar tarball either.
97470f7c90cSmrg    (tar --version) >/dev/null 2>&1 && continue
97570f7c90cSmrg    am__tar='tar chf - "$$tardir"'
97670f7c90cSmrg    am__tar_='tar chf - "$tardir"'
97770f7c90cSmrg    am__untar='tar xf -'
97870f7c90cSmrg    ;;
97970f7c90cSmrg  pax)
98070f7c90cSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
98170f7c90cSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
98270f7c90cSmrg    am__untar='pax -r'
98370f7c90cSmrg    ;;
98470f7c90cSmrg  cpio)
98570f7c90cSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98670f7c90cSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98770f7c90cSmrg    am__untar='cpio -i -H $1 -d'
98870f7c90cSmrg    ;;
98970f7c90cSmrg  none)
99070f7c90cSmrg    am__tar=false
99170f7c90cSmrg    am__tar_=false
99270f7c90cSmrg    am__untar=false
99370f7c90cSmrg    ;;
99470f7c90cSmrg  esac
995a850946eSmrg
99670f7c90cSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
99770f7c90cSmrg  # and am__untar set.
99870f7c90cSmrg  test -n "${am_cv_prog_tar_$1}" && break
99970f7c90cSmrg
100070f7c90cSmrg  # tar/untar a dummy directory, and stop if the command works
100170f7c90cSmrg  rm -rf conftest.dir
100270f7c90cSmrg  mkdir conftest.dir
100370f7c90cSmrg  echo GrepMe > conftest.dir/file
100470f7c90cSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100570f7c90cSmrg  rm -rf conftest.dir
100670f7c90cSmrg  if test -s conftest.tar; then
100770f7c90cSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
100870f7c90cSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100970f7c90cSmrg  fi
101070f7c90cSmrgdone
101170f7c90cSmrgrm -rf conftest.dir
1012a850946eSmrg
101370f7c90cSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101470f7c90cSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101570f7c90cSmrgAC_SUBST([am__tar])
101670f7c90cSmrgAC_SUBST([am__untar])
101770f7c90cSmrg]) # _AM_PROG_TAR
101870f7c90cSmrg
101970f7c90cSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1020a850946eSmrgdnl
102169a1fe56Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1022a850946eSmrgdnl 
102370f7c90cSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
10247dff02feSmrgdnl copy of this software and associated documentation files (the "Software"),
10257dff02feSmrgdnl to deal in the Software without restriction, including without limitation
10267dff02feSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10277dff02feSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
10287dff02feSmrgdnl Software is furnished to do so, subject to the following conditions:
102970f7c90cSmrgdnl
10307dff02feSmrgdnl The above copyright notice and this permission notice (including the next
10317dff02feSmrgdnl paragraph) shall be included in all copies or substantial portions of the
10327dff02feSmrgdnl Software.
103370f7c90cSmrgdnl
10347dff02feSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10357dff02feSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10367dff02feSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
10377dff02feSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10387dff02feSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
10397dff02feSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
10407dff02feSmrgdnl DEALINGS IN THE SOFTWARE.
104170f7c90cSmrg
104270f7c90cSmrg# XORG_MACROS_VERSION(required-version)
104370f7c90cSmrg# -------------------------------------
104470f7c90cSmrg# Minimum version: 1.1.0
104570f7c90cSmrg#
104670f7c90cSmrg# If you're using a macro added in Version 1.1 or newer, include this in
104770f7c90cSmrg# your configure.ac with the minimum required version, such as:
104870f7c90cSmrg# XORG_MACROS_VERSION(1.1)
104970f7c90cSmrg#
105070f7c90cSmrg# To ensure that this macro is defined, also add:
105170f7c90cSmrg# m4_ifndef([XORG_MACROS_VERSION],
105270f7c90cSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
105370f7c90cSmrg#
105470f7c90cSmrg#
105570f7c90cSmrg# See the "minimum version" comment for each macro you use to see what 
105670f7c90cSmrg# version you require.
105770f7c90cSmrgm4_defun([XORG_MACROS_VERSION],[
10588e46b049Smrgm4_define([vers_have], [1.14.0])
105970f7c90cSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
106070f7c90cSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
106170f7c90cSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
106270f7c90cSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
106370f7c90cSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
106470f7c90cSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
106570f7c90cSmrgm4_undefine([vers_have])
106670f7c90cSmrgm4_undefine([maj_have])
106770f7c90cSmrgm4_undefine([maj_needed])
106870f7c90cSmrg]) # XORG_MACROS_VERSION
1069a850946eSmrg
1070a850946eSmrg# XORG_PROG_RAWCPP()
1071a850946eSmrg# ------------------
107270f7c90cSmrg# Minimum version: 1.0.0
107370f7c90cSmrg#
1074a850946eSmrg# Find cpp program and necessary flags for use in pre-processing text files
1075a850946eSmrg# such as man pages and config files
1076a850946eSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1077a850946eSmrgAC_REQUIRE([AC_PROG_CPP])
1078a850946eSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1079a850946eSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1080a850946eSmrg
1081a850946eSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1082a850946eSmrg# which is not the best choice for supporting other OS'es, but covers most
1083a850946eSmrg# of the ones we need for now.
1084a850946eSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1085a850946eSmrgAC_LANG_CONFTEST([Does cpp redefine unix ?])
1086a850946eSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1087a850946eSmrg	AC_MSG_RESULT([no])
1088a850946eSmrgelse
1089a850946eSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1090a850946eSmrg		RAWCPPFLAGS=-undef
1091a850946eSmrg		AC_MSG_RESULT([yes])
109270f7c90cSmrg	# under Cygwin unix is still defined even with -undef
109370f7c90cSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
109470f7c90cSmrg		RAWCPPFLAGS="-undef -ansi"
109570f7c90cSmrg		AC_MSG_RESULT([yes, with -ansi])
1096a850946eSmrg	else
1097a850946eSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1098a850946eSmrg	fi
1099a850946eSmrgfi
1100a850946eSmrgrm -f conftest.$ac_ext
1101a850946eSmrg
1102a850946eSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1103a850946eSmrgAC_LANG_CONFTEST([Does cpp preserve   "whitespace"?])
1104a850946eSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1105a850946eSmrg	AC_MSG_RESULT([no])
1106a850946eSmrgelse
1107a850946eSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1108a850946eSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1109a850946eSmrg		AC_MSG_RESULT([yes])
1110a850946eSmrg	else
1111a850946eSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1112a850946eSmrg	fi
1113a850946eSmrgfi
1114a850946eSmrgrm -f conftest.$ac_ext
1115a850946eSmrgAC_SUBST(RAWCPPFLAGS)
1116a850946eSmrg]) # XORG_PROG_RAWCPP
1117a850946eSmrg
1118a850946eSmrg# XORG_MANPAGE_SECTIONS()
1119a850946eSmrg# -----------------------
112070f7c90cSmrg# Minimum version: 1.0.0
112170f7c90cSmrg#
1122a850946eSmrg# Determine which sections man pages go in for the different man page types
1123a850946eSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1124a850946eSmrg# Not sure if there's any better way than just hardcoding by OS name.
1125a850946eSmrg# Override default settings by setting environment variables
11267dff02feSmrg# Added MAN_SUBSTS in version 1.8
112769a1fe56Smrg# Added AC_PROG_SED in version 1.8
1128a850946eSmrg
1129a850946eSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1130a850946eSmrgAC_REQUIRE([AC_CANONICAL_HOST])
113169a1fe56SmrgAC_REQUIRE([AC_PROG_SED])
1132a850946eSmrg
1133a850946eSmrgif test x$APP_MAN_SUFFIX = x    ; then
113470f7c90cSmrg    APP_MAN_SUFFIX=1
1135a850946eSmrgfi
1136a850946eSmrgif test x$APP_MAN_DIR = x    ; then
113770f7c90cSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1138a850946eSmrgfi
1139a850946eSmrg
1140a850946eSmrgif test x$LIB_MAN_SUFFIX = x    ; then
114170f7c90cSmrg    LIB_MAN_SUFFIX=3
1142a850946eSmrgfi
1143a850946eSmrgif test x$LIB_MAN_DIR = x    ; then
114470f7c90cSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1145a850946eSmrgfi
1146a850946eSmrg
1147a850946eSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1148a850946eSmrg    case $host_os in
1149a850946eSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1150a850946eSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1151a850946eSmrg    esac
1152a850946eSmrgfi
1153a850946eSmrgif test x$FILE_MAN_DIR = x    ; then
115470f7c90cSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1155a850946eSmrgfi
1156a850946eSmrg
1157a850946eSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1158a850946eSmrg    case $host_os in
1159a850946eSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1160a850946eSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1161a850946eSmrg    esac
1162a850946eSmrgfi
1163a850946eSmrgif test x$MISC_MAN_DIR = x    ; then
116470f7c90cSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1165a850946eSmrgfi
1166a850946eSmrg
1167a850946eSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1168a850946eSmrg    case $host_os in
1169a850946eSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1170a850946eSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1171a850946eSmrg    esac
1172a850946eSmrgfi
1173a850946eSmrgif test x$DRIVER_MAN_DIR = x    ; then
117470f7c90cSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1175a850946eSmrgfi
1176a850946eSmrg
1177a850946eSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1178a850946eSmrg    case $host_os in
1179a850946eSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1180a850946eSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1181a850946eSmrg    esac
1182a850946eSmrgfi
1183a850946eSmrgif test x$ADMIN_MAN_DIR = x    ; then
1184a850946eSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1185a850946eSmrgfi
1186a850946eSmrg
1187a850946eSmrg
1188a850946eSmrgAC_SUBST([APP_MAN_SUFFIX])
1189a850946eSmrgAC_SUBST([LIB_MAN_SUFFIX])
1190a850946eSmrgAC_SUBST([FILE_MAN_SUFFIX])
1191a850946eSmrgAC_SUBST([MISC_MAN_SUFFIX])
1192a850946eSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1193a850946eSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1194a850946eSmrgAC_SUBST([APP_MAN_DIR])
1195a850946eSmrgAC_SUBST([LIB_MAN_DIR])
1196a850946eSmrgAC_SUBST([FILE_MAN_DIR])
1197a850946eSmrgAC_SUBST([MISC_MAN_DIR])
1198a850946eSmrgAC_SUBST([DRIVER_MAN_DIR])
1199a850946eSmrgAC_SUBST([ADMIN_MAN_DIR])
12007dff02feSmrg
12017dff02feSmrgXORG_MAN_PAGE="X Version 11"
12027dff02feSmrgAC_SUBST([XORG_MAN_PAGE])
12037dff02feSmrgMAN_SUBSTS="\
12047dff02feSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
12057dff02feSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
12067dff02feSmrg	-e 's|__xservername__|Xorg|g' \
12077dff02feSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
12087dff02feSmrg	-e 's|__projectroot__|\$(prefix)|g' \
120969a1fe56Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
12107dff02feSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
12117dff02feSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
12127dff02feSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
12137dff02feSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
12147dff02feSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
12157dff02feSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
12167dff02feSmrgAC_SUBST([MAN_SUBSTS])
12177dff02feSmrg
1218a850946eSmrg]) # XORG_MANPAGE_SECTIONS
1219a850946eSmrg
12207dff02feSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
12217dff02feSmrg# ------------------------
12227dff02feSmrg# Minimum version: 1.7.0
12237dff02feSmrg#
12247dff02feSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
12257dff02feSmrg# provided by xorg-sgml-doctools, if installed.
12267dff02feSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
12277dff02feSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
12287dff02feSmrgXORG_SGML_PATH=
12297dff02feSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
12307dff02feSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
12317dff02feSmrg    [m4_ifval([$1],[:],
12327dff02feSmrg        [if test x"$cross_compiling" != x"yes" ; then
12337dff02feSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
12347dff02feSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
12357dff02feSmrg         fi])
12367dff02feSmrg    ])
12377dff02feSmrg
123869a1fe56Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
123969a1fe56Smrg# the path and the name of the doc stylesheet
12407dff02feSmrgif test "x$XORG_SGML_PATH" != "x" ; then
12417dff02feSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
124269a1fe56Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
124369a1fe56Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
12447dff02feSmrgelse
12457dff02feSmrg   AC_MSG_RESULT([no])
12467dff02feSmrgfi
12477dff02feSmrg
12487dff02feSmrgAC_SUBST(XORG_SGML_PATH)
124969a1fe56SmrgAC_SUBST(STYLESHEET_SRCDIR)
125069a1fe56SmrgAC_SUBST(XSL_STYLESHEET)
125169a1fe56SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
12527dff02feSmrg]) # XORG_CHECK_SGML_DOCTOOLS
12537dff02feSmrg
1254a850946eSmrg# XORG_CHECK_LINUXDOC
1255a850946eSmrg# -------------------
125670f7c90cSmrg# Minimum version: 1.0.0
125770f7c90cSmrg#
1258a850946eSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1259a850946eSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1260a850946eSmrg# Whether or not the necessary tools and files are found can be checked
1261a850946eSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1262a850946eSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
12637dff02feSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
12647dff02feSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1265a850946eSmrg
1266a850946eSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1267a850946eSmrg
12687dff02feSmrgAC_MSG_CHECKING([whether to build documentation])
1269a850946eSmrg
12707dff02feSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1271a850946eSmrg   BUILDDOC=yes
1272a850946eSmrgelse
1273a850946eSmrg   BUILDDOC=no
1274a850946eSmrgfi
1275a850946eSmrg
1276a850946eSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1277a850946eSmrg
1278a850946eSmrgAC_MSG_RESULT([$BUILDDOC])
1279a850946eSmrg
12807dff02feSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1281a850946eSmrg
12827dff02feSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1283a850946eSmrg   BUILDPDFDOC=yes
1284a850946eSmrgelse
1285a850946eSmrg   BUILDPDFDOC=no
1286a850946eSmrgfi
1287a850946eSmrg
1288a850946eSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1289a850946eSmrg
1290a850946eSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1291a850946eSmrg
12927dff02feSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
129370f7c90cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1294a850946eSmrgMAKE_PDF="$PS2PDF"
129570f7c90cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1296a850946eSmrg
1297a850946eSmrgAC_SUBST(MAKE_TEXT)
1298a850946eSmrgAC_SUBST(MAKE_PS)
1299a850946eSmrgAC_SUBST(MAKE_PDF)
1300a850946eSmrgAC_SUBST(MAKE_HTML)
1301a850946eSmrg]) # XORG_CHECK_LINUXDOC
1302a850946eSmrg
130370f7c90cSmrg# XORG_CHECK_DOCBOOK
130470f7c90cSmrg# -------------------
130570f7c90cSmrg# Minimum version: 1.0.0
130670f7c90cSmrg#
130770f7c90cSmrg# Checks for the ability to build output formats from SGML DocBook source.
130870f7c90cSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
130970f7c90cSmrg# indicates whether the necessary tools and files are found and, if set,
131070f7c90cSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
131170f7c90cSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
13127dff02feSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
13137dff02feSmrg
131470f7c90cSmrgBUILDTXTDOC=no
131570f7c90cSmrgBUILDPDFDOC=no
131670f7c90cSmrgBUILDPSDOC=no
131770f7c90cSmrgBUILDHTMLDOC=no
131870f7c90cSmrg
131970f7c90cSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
132070f7c90cSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
132170f7c90cSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
132270f7c90cSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
132370f7c90cSmrg
13247dff02feSmrgAC_MSG_CHECKING([whether to build text documentation])
13257dff02feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
132670f7c90cSmrg   test x$BUILD_TXTDOC != xno; then
132770f7c90cSmrg	BUILDTXTDOC=yes
132870f7c90cSmrgfi
132970f7c90cSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
133070f7c90cSmrgAC_MSG_RESULT([$BUILDTXTDOC])
133170f7c90cSmrg
13327dff02feSmrgAC_MSG_CHECKING([whether to build PDF documentation])
13337dff02feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
133470f7c90cSmrg   test x$BUILD_PDFDOC != xno; then
133570f7c90cSmrg	BUILDPDFDOC=yes
133670f7c90cSmrgfi
133770f7c90cSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
133870f7c90cSmrgAC_MSG_RESULT([$BUILDPDFDOC])
133970f7c90cSmrg
13407dff02feSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
13417dff02feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
134270f7c90cSmrg   test x$BUILD_PSDOC != xno; then
134370f7c90cSmrg	BUILDPSDOC=yes
134470f7c90cSmrgfi
134570f7c90cSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
134670f7c90cSmrgAC_MSG_RESULT([$BUILDPSDOC])
134770f7c90cSmrg
13487dff02feSmrgAC_MSG_CHECKING([whether to build HTML documentation])
13497dff02feSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
135070f7c90cSmrg   test x$BUILD_HTMLDOC != xno; then
135170f7c90cSmrg	BUILDHTMLDOC=yes
135270f7c90cSmrgfi
135370f7c90cSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
135470f7c90cSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
135570f7c90cSmrg
135670f7c90cSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
135770f7c90cSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
135870f7c90cSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
135970f7c90cSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
136070f7c90cSmrg
136170f7c90cSmrgAC_SUBST(MAKE_TEXT)
136270f7c90cSmrgAC_SUBST(MAKE_PS)
136370f7c90cSmrgAC_SUBST(MAKE_PDF)
136470f7c90cSmrgAC_SUBST(MAKE_HTML)
136570f7c90cSmrg]) # XORG_CHECK_DOCBOOK
136670f7c90cSmrg
13678e46b049Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
13687dff02feSmrg# ----------------
13697dff02feSmrg# Minimum version: 1.5.0
13708e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
13717dff02feSmrg#
13727dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
13737dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
13747dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
13757dff02feSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
13768e46b049Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
13778e46b049Smrg# --with-xmlto assumes 'auto'.
13787dff02feSmrg#
13797dff02feSmrg# Interface to module:
13807dff02feSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
13817dff02feSmrg# XMLTO:	returns the path of the xmlto program found
13827dff02feSmrg#		returns the path set by the user in the environment
13837dff02feSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
13847dff02feSmrg#		'no' user instructs the module not to use xmlto
13857dff02feSmrg#
138669a1fe56Smrg# Added in version 1.10.0
138769a1fe56Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
138869a1fe56Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
138969a1fe56Smrg#
13907dff02feSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
13917dff02feSmrg#
13927dff02feSmrgAC_DEFUN([XORG_WITH_XMLTO],[
13937dff02feSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
13948e46b049Smrgm4_define([_defopt], m4_default([$2], [auto]))
13957dff02feSmrgAC_ARG_WITH(xmlto,
13967dff02feSmrg	AS_HELP_STRING([--with-xmlto],
13978e46b049Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
13988e46b049Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
13998e46b049Smrgm4_undefine([_defopt])
14007dff02feSmrg
14017dff02feSmrgif test "x$use_xmlto" = x"auto"; then
14027dff02feSmrg   AC_PATH_PROG([XMLTO], [xmlto])
14037dff02feSmrg   if test "x$XMLTO" = "x"; then
14047dff02feSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
14057dff02feSmrg	have_xmlto=no
14067dff02feSmrg   else
14077dff02feSmrg        have_xmlto=yes
14087dff02feSmrg   fi
14097dff02feSmrgelif test "x$use_xmlto" = x"yes" ; then
14107dff02feSmrg   AC_PATH_PROG([XMLTO], [xmlto])
14117dff02feSmrg   if test "x$XMLTO" = "x"; then
14127dff02feSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
14137dff02feSmrg   fi
14147dff02feSmrg   have_xmlto=yes
14157dff02feSmrgelif test "x$use_xmlto" = x"no" ; then
14167dff02feSmrg   if test "x$XMLTO" != "x"; then
14177dff02feSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
14187dff02feSmrg   fi
14197dff02feSmrg   have_xmlto=no
14207dff02feSmrgelse
14217dff02feSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
14227dff02feSmrgfi
142369a1fe56Smrg
142469a1fe56Smrg# Test for a minimum version of xmlto, if provided.
14257dff02feSmrgm4_ifval([$1],
14267dff02feSmrg[if test "$have_xmlto" = yes; then
14277dff02feSmrg    # scrape the xmlto version
14287dff02feSmrg    AC_MSG_CHECKING([the xmlto version])
14297dff02feSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
14307dff02feSmrg    AC_MSG_RESULT([$xmlto_version])
14317dff02feSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
14327dff02feSmrg        [if test "x$use_xmlto" = xauto; then
14337dff02feSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
14347dff02feSmrg            have_xmlto=no
14357dff02feSmrg        else
14367dff02feSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
14377dff02feSmrg        fi])
14387dff02feSmrgfi])
143969a1fe56Smrg
144069a1fe56Smrg# Test for the ability of xmlto to generate a text target
144169a1fe56Smrghave_xmlto_text=no
144269a1fe56Smrgcat > conftest.xml << "EOF"
144369a1fe56SmrgEOF
144469a1fe56SmrgAS_IF([test "$have_xmlto" = yes],
144569a1fe56Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
144669a1fe56Smrg             [have_xmlto_text=yes],
144769a1fe56Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
144869a1fe56Smrgrm -f conftest.xml
144969a1fe56SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
14507dff02feSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
14517dff02feSmrg]) # XORG_WITH_XMLTO
14527dff02feSmrg
14538e46b049Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
14548e46b049Smrg# --------------------------------------------
14558e46b049Smrg# Minimum version: 1.12.0
14568e46b049Smrg# Minimum version for optional DEFAULT argument: 1.12.0
14578e46b049Smrg#
14588e46b049Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
14598e46b049Smrg# XML-based language used for the transformation of XML documents.
14608e46b049Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
14618e46b049Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
14628e46b049Smrg# The XSLT processor is often used as a standalone tool for transformations.
14638e46b049Smrg# It should not be assumed that this tool is used only to work with documnetation.
14648e46b049Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
14658e46b049Smrg#
14668e46b049Smrg# Interface to module:
14678e46b049Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
14688e46b049Smrg# XSLTPROC:	 returns the path of the xsltproc program found
14698e46b049Smrg#		 returns the path set by the user in the environment
14708e46b049Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
14718e46b049Smrg#		  'no' user instructs the module not to use xsltproc
14728e46b049Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
14738e46b049Smrg#
14748e46b049Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
14758e46b049Smrg#
14768e46b049SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
14778e46b049SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
14788e46b049Smrgm4_define([_defopt], m4_default([$2], [auto]))
14798e46b049SmrgAC_ARG_WITH(xsltproc,
14808e46b049Smrg	AS_HELP_STRING([--with-xsltproc],
14818e46b049Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
14828e46b049Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
14838e46b049Smrgm4_undefine([_defopt])
14848e46b049Smrg
14858e46b049Smrgif test "x$use_xsltproc" = x"auto"; then
14868e46b049Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14878e46b049Smrg   if test "x$XSLTPROC" = "x"; then
14888e46b049Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
14898e46b049Smrg	have_xsltproc=no
14908e46b049Smrg   else
14918e46b049Smrg        have_xsltproc=yes
14928e46b049Smrg   fi
14938e46b049Smrgelif test "x$use_xsltproc" = x"yes" ; then
14948e46b049Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
14958e46b049Smrg   if test "x$XSLTPROC" = "x"; then
14968e46b049Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
14978e46b049Smrg   fi
14988e46b049Smrg   have_xsltproc=yes
14998e46b049Smrgelif test "x$use_xsltproc" = x"no" ; then
15008e46b049Smrg   if test "x$XSLTPROC" != "x"; then
15018e46b049Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
15028e46b049Smrg   fi
15038e46b049Smrg   have_xsltproc=no
15048e46b049Smrgelse
15058e46b049Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
15068e46b049Smrgfi
15078e46b049Smrg
15088e46b049Smrg# Checking for minimum version is not implemented
15098e46b049Smrg# but we want to keep the interface consistent with other commands
15108e46b049Smrgm4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
15118e46b049Smrg
15128e46b049SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
15138e46b049Smrg]) # XORG_WITH_XSLTPROC
15148e46b049Smrg
15158e46b049Smrg
15168e46b049Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
15177dff02feSmrg# ----------------
15187dff02feSmrg# Minimum version: 1.5.0
15198e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15207dff02feSmrg#
15217dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
15227dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
15237dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
15247dff02feSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
15258e46b049Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
15268e46b049Smrg# --with-asciidoc assumes 'auto'.
15277dff02feSmrg#
15287dff02feSmrg# Interface to module:
15297dff02feSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
15307dff02feSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
15317dff02feSmrg#		 returns the path set by the user in the environment
15327dff02feSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
15337dff02feSmrg#		  'no' user instructs the module not to use asciidoc
15347dff02feSmrg#
15357dff02feSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
15367dff02feSmrg#
15377dff02feSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
15387dff02feSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
15398e46b049Smrgm4_define([_defopt], m4_default([$2], [auto]))
15407dff02feSmrgAC_ARG_WITH(asciidoc,
15417dff02feSmrg	AS_HELP_STRING([--with-asciidoc],
15428e46b049Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
15438e46b049Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
15448e46b049Smrgm4_undefine([_defopt])
15457dff02feSmrg
15467dff02feSmrgif test "x$use_asciidoc" = x"auto"; then
15477dff02feSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
15487dff02feSmrg   if test "x$ASCIIDOC" = "x"; then
15497dff02feSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
15507dff02feSmrg	have_asciidoc=no
15517dff02feSmrg   else
15527dff02feSmrg        have_asciidoc=yes
15537dff02feSmrg   fi
15547dff02feSmrgelif test "x$use_asciidoc" = x"yes" ; then
15557dff02feSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
15567dff02feSmrg   if test "x$ASCIIDOC" = "x"; then
15577dff02feSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
15587dff02feSmrg   fi
15597dff02feSmrg   have_asciidoc=yes
15607dff02feSmrgelif test "x$use_asciidoc" = x"no" ; then
15617dff02feSmrg   if test "x$ASCIIDOC" != "x"; then
15627dff02feSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
15637dff02feSmrg   fi
15647dff02feSmrg   have_asciidoc=no
15657dff02feSmrgelse
15667dff02feSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
15677dff02feSmrgfi
15687dff02feSmrgm4_ifval([$1],
15697dff02feSmrg[if test "$have_asciidoc" = yes; then
15707dff02feSmrg    # scrape the asciidoc version
15717dff02feSmrg    AC_MSG_CHECKING([the asciidoc version])
15727dff02feSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
15737dff02feSmrg    AC_MSG_RESULT([$asciidoc_version])
15747dff02feSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
15757dff02feSmrg        [if test "x$use_asciidoc" = xauto; then
15767dff02feSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
15777dff02feSmrg            have_asciidoc=no
15787dff02feSmrg        else
15797dff02feSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
15807dff02feSmrg        fi])
15817dff02feSmrgfi])
15827dff02feSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
15837dff02feSmrg]) # XORG_WITH_ASCIIDOC
15847dff02feSmrg
15858e46b049Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
15867dff02feSmrg# --------------------------------
15877dff02feSmrg# Minimum version: 1.5.0
15888e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
15897dff02feSmrg#
15907dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
15917dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
15927dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
15937dff02feSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
15948e46b049Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
15958e46b049Smrg# --with-doxygen assumes 'auto'.
15967dff02feSmrg#
15977dff02feSmrg# Interface to module:
15987dff02feSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
15997dff02feSmrg# DOXYGEN:	 returns the path of the doxygen program found
16007dff02feSmrg#		 returns the path set by the user in the environment
16017dff02feSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
16027dff02feSmrg#		  'no' user instructs the module not to use doxygen
16037dff02feSmrg#
16047dff02feSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
16057dff02feSmrg#
16067dff02feSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
16077dff02feSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
16088e46b049Smrgm4_define([_defopt], m4_default([$2], [auto]))
16097dff02feSmrgAC_ARG_WITH(doxygen,
16107dff02feSmrg	AS_HELP_STRING([--with-doxygen],
16118e46b049Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
16128e46b049Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
16138e46b049Smrgm4_undefine([_defopt])
16147dff02feSmrg
16157dff02feSmrgif test "x$use_doxygen" = x"auto"; then
16167dff02feSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
16177dff02feSmrg   if test "x$DOXYGEN" = "x"; then
16187dff02feSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
16197dff02feSmrg	have_doxygen=no
16207dff02feSmrg   else
16217dff02feSmrg        have_doxygen=yes
16227dff02feSmrg   fi
16237dff02feSmrgelif test "x$use_doxygen" = x"yes" ; then
16247dff02feSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
16257dff02feSmrg   if test "x$DOXYGEN" = "x"; then
16267dff02feSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
16277dff02feSmrg   fi
16287dff02feSmrg   have_doxygen=yes
16297dff02feSmrgelif test "x$use_doxygen" = x"no" ; then
16307dff02feSmrg   if test "x$DOXYGEN" != "x"; then
16317dff02feSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
16327dff02feSmrg   fi
16337dff02feSmrg   have_doxygen=no
16347dff02feSmrgelse
16357dff02feSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
16367dff02feSmrgfi
16377dff02feSmrgm4_ifval([$1],
16387dff02feSmrg[if test "$have_doxygen" = yes; then
16397dff02feSmrg    # scrape the doxygen version
16407dff02feSmrg    AC_MSG_CHECKING([the doxygen version])
16417dff02feSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
16427dff02feSmrg    AC_MSG_RESULT([$doxygen_version])
16437dff02feSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
16447dff02feSmrg        [if test "x$use_doxygen" = xauto; then
16457dff02feSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
16467dff02feSmrg            have_doxygen=no
16477dff02feSmrg        else
16487dff02feSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
16497dff02feSmrg        fi])
16507dff02feSmrgfi])
16517dff02feSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
16527dff02feSmrg]) # XORG_WITH_DOXYGEN
16537dff02feSmrg
16548e46b049Smrg# XORG_WITH_GROFF([DEFAULT])
16557dff02feSmrg# ----------------
16567dff02feSmrg# Minimum version: 1.6.0
16578e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
16587dff02feSmrg#
16597dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
16607dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
16617dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
16627dff02feSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
16638e46b049Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
16648e46b049Smrg# --with-groff assumes 'auto'.
16657dff02feSmrg#
16667dff02feSmrg# Interface to module:
16677dff02feSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
16687dff02feSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
16697dff02feSmrg# HAVE_GROFF_MS: the -ms macros package
16707dff02feSmrg# GROFF:	 returns the path of the groff program found
16717dff02feSmrg#		 returns the path set by the user in the environment
16727dff02feSmrg# --with-groff:	 'yes' user instructs the module to use groff
16737dff02feSmrg#		 'no' user instructs the module not to use groff
16747dff02feSmrg#
167569a1fe56Smrg# Added in version 1.9.0:
167669a1fe56Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
167769a1fe56Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
167869a1fe56Smrg#		   psselect from the psutils package.
167969a1fe56Smrg#		   the ghostcript package. Refer to the grohtml man pages
168069a1fe56Smrg#
16817dff02feSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
16827dff02feSmrg#
16837dff02feSmrg# OS and distros often splits groff in a basic and full package, the former
16847dff02feSmrg# having the groff program and the later having devices, fonts and macros
16857dff02feSmrg# Checking for the groff executable is not enough.
16867dff02feSmrg#
16877dff02feSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
16887dff02feSmrg# unset HAVE_GROFF or GROFF env variables.
16897dff02feSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
16907dff02feSmrg#
16917dff02feSmrgAC_DEFUN([XORG_WITH_GROFF],[
16927dff02feSmrgAC_ARG_VAR([GROFF], [Path to groff command])
16938e46b049Smrgm4_define([_defopt], m4_default([$1], [auto]))
16947dff02feSmrgAC_ARG_WITH(groff,
16957dff02feSmrg	AS_HELP_STRING([--with-groff],
16968e46b049Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
16978e46b049Smrg	   [use_groff=$withval], [use_groff=]_defopt)
16988e46b049Smrgm4_undefine([_defopt])
16997dff02feSmrg
17007dff02feSmrgif test "x$use_groff" = x"auto"; then
17017dff02feSmrg   AC_PATH_PROG([GROFF], [groff])
17027dff02feSmrg   if test "x$GROFF" = "x"; then
17037dff02feSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
17047dff02feSmrg	have_groff=no
17057dff02feSmrg   else
17067dff02feSmrg        have_groff=yes
17077dff02feSmrg   fi
17087dff02feSmrgelif test "x$use_groff" = x"yes" ; then
17097dff02feSmrg   AC_PATH_PROG([GROFF], [groff])
17107dff02feSmrg   if test "x$GROFF" = "x"; then
17117dff02feSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
17127dff02feSmrg   fi
17137dff02feSmrg   have_groff=yes
17147dff02feSmrgelif test "x$use_groff" = x"no" ; then
17157dff02feSmrg   if test "x$GROFF" != "x"; then
17167dff02feSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
17177dff02feSmrg   fi
17187dff02feSmrg   have_groff=no
17197dff02feSmrgelse
17207dff02feSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
17217dff02feSmrgfi
172269a1fe56Smrg
17237dff02feSmrg# We have groff, test for the presence of the macro packages
17247dff02feSmrgif test "x$have_groff" = x"yes"; then
17257dff02feSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
17267dff02feSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
17277dff02feSmrg        groff_ms_works=yes
17287dff02feSmrg    else
17297dff02feSmrg        groff_ms_works=no
17307dff02feSmrg    fi
17317dff02feSmrg    AC_MSG_RESULT([$groff_ms_works])
17327dff02feSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
17337dff02feSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
17347dff02feSmrg        groff_mm_works=yes
17357dff02feSmrg    else
17367dff02feSmrg        groff_mm_works=no
17377dff02feSmrg    fi
17387dff02feSmrg    AC_MSG_RESULT([$groff_mm_works])
17397dff02feSmrgfi
174069a1fe56Smrg
174169a1fe56Smrg# We have groff, test for HTML dependencies, one command per package
174269a1fe56Smrgif test "x$have_groff" = x"yes"; then
174369a1fe56Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
174469a1fe56Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
174569a1fe56Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
174669a1fe56Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
174769a1fe56Smrg      have_groff_html=yes
174869a1fe56Smrg   else
174969a1fe56Smrg      have_groff_html=no
175069a1fe56Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
175169a1fe56Smrg   fi
175269a1fe56Smrgfi
175369a1fe56Smrg
175469a1fe56Smrg# Set Automake conditionals for Makefiles
17557dff02feSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
17567dff02feSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
17577dff02feSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
175869a1fe56SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
17597dff02feSmrg]) # XORG_WITH_GROFF
17607dff02feSmrg
17618e46b049Smrg# XORG_WITH_FOP([DEFAULT])
17627dff02feSmrg# ----------------
17637dff02feSmrg# Minimum version: 1.6.0
17648e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17657dff02feSmrg#
17667dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
17677dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
17687dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17697dff02feSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
17708e46b049Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
17718e46b049Smrg# --with-fop assumes 'auto'.
17727dff02feSmrg#
17737dff02feSmrg# Interface to module:
17747dff02feSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
17757dff02feSmrg# FOP:	 	returns the path of the fop program found
17767dff02feSmrg#		returns the path set by the user in the environment
17777dff02feSmrg# --with-fop: 	'yes' user instructs the module to use fop
17787dff02feSmrg#		'no' user instructs the module not to use fop
17797dff02feSmrg#
17807dff02feSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
17817dff02feSmrg#
17827dff02feSmrgAC_DEFUN([XORG_WITH_FOP],[
17837dff02feSmrgAC_ARG_VAR([FOP], [Path to fop command])
17848e46b049Smrgm4_define([_defopt], m4_default([$1], [auto]))
17857dff02feSmrgAC_ARG_WITH(fop,
17867dff02feSmrg	AS_HELP_STRING([--with-fop],
17878e46b049Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
17888e46b049Smrg	   [use_fop=$withval], [use_fop=]_defopt)
17898e46b049Smrgm4_undefine([_defopt])
17907dff02feSmrg
17917dff02feSmrgif test "x$use_fop" = x"auto"; then
17927dff02feSmrg   AC_PATH_PROG([FOP], [fop])
17937dff02feSmrg   if test "x$FOP" = "x"; then
17947dff02feSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
17957dff02feSmrg	have_fop=no
17967dff02feSmrg   else
17977dff02feSmrg        have_fop=yes
17987dff02feSmrg   fi
17997dff02feSmrgelif test "x$use_fop" = x"yes" ; then
18007dff02feSmrg   AC_PATH_PROG([FOP], [fop])
18017dff02feSmrg   if test "x$FOP" = "x"; then
18027dff02feSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
18037dff02feSmrg   fi
18047dff02feSmrg   have_fop=yes
18057dff02feSmrgelif test "x$use_fop" = x"no" ; then
18067dff02feSmrg   if test "x$FOP" != "x"; then
18077dff02feSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
18087dff02feSmrg   fi
18097dff02feSmrg   have_fop=no
18107dff02feSmrgelse
18117dff02feSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
18127dff02feSmrgfi
18137dff02feSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
18147dff02feSmrg]) # XORG_WITH_FOP
18157dff02feSmrg
18168e46b049Smrg# XORG_WITH_PS2PDF([DEFAULT])
18177dff02feSmrg# ----------------
18187dff02feSmrg# Minimum version: 1.6.0
18198e46b049Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18207dff02feSmrg#
18217dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
18227dff02feSmrg# not at the appropriate level. This macro enables a module to test for the
18237dff02feSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
18247dff02feSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
18258e46b049Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
18268e46b049Smrg# --with-ps2pdf assumes 'auto'.
18277dff02feSmrg#
18287dff02feSmrg# Interface to module:
18297dff02feSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
18307dff02feSmrg# PS2PDF:	returns the path of the ps2pdf program found
18317dff02feSmrg#		returns the path set by the user in the environment
18327dff02feSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
18337dff02feSmrg#		 'no' user instructs the module not to use ps2pdf
18347dff02feSmrg#
18357dff02feSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
18367dff02feSmrg#
18377dff02feSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
18387dff02feSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
18398e46b049Smrgm4_define([_defopt], m4_default([$1], [auto]))
18407dff02feSmrgAC_ARG_WITH(ps2pdf,
18417dff02feSmrg	AS_HELP_STRING([--with-ps2pdf],
18428e46b049Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
18438e46b049Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
18448e46b049Smrgm4_undefine([_defopt])
18457dff02feSmrg
18467dff02feSmrgif test "x$use_ps2pdf" = x"auto"; then
18477dff02feSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
18487dff02feSmrg   if test "x$PS2PDF" = "x"; then
18497dff02feSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
18507dff02feSmrg	have_ps2pdf=no
18517dff02feSmrg   else
18527dff02feSmrg        have_ps2pdf=yes
18537dff02feSmrg   fi
18547dff02feSmrgelif test "x$use_ps2pdf" = x"yes" ; then
18557dff02feSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
18567dff02feSmrg   if test "x$PS2PDF" = "x"; then
18577dff02feSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
18587dff02feSmrg   fi
18597dff02feSmrg   have_ps2pdf=yes
18607dff02feSmrgelif test "x$use_ps2pdf" = x"no" ; then
18617dff02feSmrg   if test "x$PS2PDF" != "x"; then
18627dff02feSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
18637dff02feSmrg   fi
18647dff02feSmrg   have_ps2pdf=no
18657dff02feSmrgelse
18667dff02feSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
18677dff02feSmrgfi
18687dff02feSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
18697dff02feSmrg]) # XORG_WITH_PS2PDF
18707dff02feSmrg
18717dff02feSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
18727dff02feSmrg# ----------------
18737dff02feSmrg# Minimum version: 1.6.0
18747dff02feSmrg#
18757dff02feSmrg# Documentation tools are not always available on all platforms and sometimes
18767dff02feSmrg# not at the appropriate level. This macro enables a builder to skip all
18777dff02feSmrg# documentation targets except traditional man pages.
18787dff02feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
18797dff02feSmrg# maximum flexibilty in controlling documentation building.
18807dff02feSmrg# Refer to:
18817dff02feSmrg# XORG_WITH_XMLTO         --with-xmlto
18827dff02feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
18837dff02feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
18847dff02feSmrg# XORG_WITH_FOP           --with-fop
18857dff02feSmrg# XORG_WITH_GROFF         --with-groff
18867dff02feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
18877dff02feSmrg#
18887dff02feSmrg# Interface to module:
18897dff02feSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
18907dff02feSmrg# --enable-docs: 'yes' user instructs the module to generate docs
18917dff02feSmrg#		 'no' user instructs the module not to generate docs
18927dff02feSmrg# parm1:	specify the default value, yes or no.
18937dff02feSmrg#
18947dff02feSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
18958e46b049Smrgm4_define([docs_default], m4_default([$1], [yes]))
18967dff02feSmrgAC_ARG_ENABLE(docs,
18977dff02feSmrg	AS_HELP_STRING([--enable-docs],
18988e46b049Smrg	   [Enable building the documentation (default: ]docs_default[)]),
18998e46b049Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
19008e46b049Smrgm4_undefine([docs_default])
19017dff02feSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
19027dff02feSmrgAC_MSG_CHECKING([whether to build documentation])
19037dff02feSmrgAC_MSG_RESULT([$build_docs])
19047dff02feSmrg]) # XORG_ENABLE_DOCS
19057dff02feSmrg
19067dff02feSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
19077dff02feSmrg# ----------------
19087dff02feSmrg# Minimum version: 1.6.0
19097dff02feSmrg#
19107dff02feSmrg# This macro enables a builder to skip all developer documentation.
19117dff02feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
19127dff02feSmrg# maximum flexibilty in controlling documentation building.
19137dff02feSmrg# Refer to:
19147dff02feSmrg# XORG_WITH_XMLTO         --with-xmlto
19157dff02feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
19167dff02feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
19177dff02feSmrg# XORG_WITH_FOP           --with-fop
19187dff02feSmrg# XORG_WITH_GROFF         --with-groff
19197dff02feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
19207dff02feSmrg#
19217dff02feSmrg# Interface to module:
19227dff02feSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
19237dff02feSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
19247dff02feSmrg#			'no' user instructs the module not to generate developer docs
19257dff02feSmrg# parm1:		specify the default value, yes or no.
19267dff02feSmrg#
19277dff02feSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
19288e46b049Smrgm4_define([devel_default], m4_default([$1], [yes]))
19297dff02feSmrgAC_ARG_ENABLE(devel-docs,
19307dff02feSmrg	AS_HELP_STRING([--enable-devel-docs],
19318e46b049Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
19328e46b049Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
19338e46b049Smrgm4_undefine([devel_default])
19347dff02feSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
19357dff02feSmrgAC_MSG_CHECKING([whether to build developer documentation])
19367dff02feSmrgAC_MSG_RESULT([$build_devel_docs])
19377dff02feSmrg]) # XORG_ENABLE_DEVEL_DOCS
19387dff02feSmrg
19397dff02feSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
19407dff02feSmrg# ----------------
19417dff02feSmrg# Minimum version: 1.6.0
19427dff02feSmrg#
19437dff02feSmrg# This macro enables a builder to skip all functional specification targets.
19447dff02feSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
19457dff02feSmrg# maximum flexibilty in controlling documentation building.
19467dff02feSmrg# Refer to:
19477dff02feSmrg# XORG_WITH_XMLTO         --with-xmlto
19487dff02feSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
19497dff02feSmrg# XORG_WITH_DOXYGEN       --with-doxygen
19507dff02feSmrg# XORG_WITH_FOP           --with-fop
19517dff02feSmrg# XORG_WITH_GROFF         --with-groff
19527dff02feSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
19537dff02feSmrg#
19547dff02feSmrg# Interface to module:
19557dff02feSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
19567dff02feSmrg# --enable-specs:	'yes' user instructs the module to generate specs
19577dff02feSmrg#			'no' user instructs the module not to generate specs
19587dff02feSmrg# parm1:		specify the default value, yes or no.
19597dff02feSmrg#
19607dff02feSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
19618e46b049Smrgm4_define([spec_default], m4_default([$1], [yes]))
19627dff02feSmrgAC_ARG_ENABLE(specs,
19637dff02feSmrg	AS_HELP_STRING([--enable-specs],
19648e46b049Smrg	   [Enable building the specs (default: ]spec_default[)]),
19658e46b049Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
19668e46b049Smrgm4_undefine([spec_default])
19677dff02feSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
19687dff02feSmrgAC_MSG_CHECKING([whether to build functional specifications])
19697dff02feSmrgAC_MSG_RESULT([$build_specs])
19707dff02feSmrg]) # XORG_ENABLE_SPECS
19717dff02feSmrg
19728e46b049Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
19738e46b049Smrg# ----------------------------------------------
19748e46b049Smrg# Minimum version: 1.13.0
19758e46b049Smrg#
19768e46b049Smrg# This macro enables a builder to enable/disable unit testing
19778e46b049Smrg# It makes no assumption about the test cases implementation
19788e46b049Smrg# Test cases may or may not use Automake "Support for test suites"
19798e46b049Smrg# They may or may not use the software utility library GLib
19808e46b049Smrg#
19818e46b049Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
19828e46b049Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
19838e46b049Smrg# The variable enable_unit_tests is used by other macros in this file.
19848e46b049Smrg#
19858e46b049Smrg# Interface to module:
19868e46b049Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
19878e46b049Smrg# enable_unit_tests:    used in configure.ac for additional configuration
19888e46b049Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
19898e46b049Smrg#			'no' user instructs the module not to build tests
19908e46b049Smrg# parm1:		specify the default value, yes or no.
19918e46b049Smrg#
19928e46b049SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
19938e46b049SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
19948e46b049SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
19958e46b049Smrgm4_define([_defopt], m4_default([$1], [auto]))
19968e46b049SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
19978e46b049Smrg	[Enable building unit test cases (default: ]_defopt[)]),
19988e46b049Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
19998e46b049Smrgm4_undefine([_defopt])
20008e46b049SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
20018e46b049SmrgAC_MSG_CHECKING([whether to build unit test cases])
20028e46b049SmrgAC_MSG_RESULT([$enable_unit_tests])
20038e46b049Smrg]) # XORG_ENABLE_UNIT_TESTS
20048e46b049Smrg
20058e46b049Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
20068e46b049Smrg# ----------------------------------------
20078e46b049Smrg# Minimum version: 1.13.0
20088e46b049Smrg#
20098e46b049Smrg# GLib is a library which provides advanced data structures and functions.
20108e46b049Smrg# This macro enables a module to test for the presence of Glib.
20118e46b049Smrg#
20128e46b049Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
20138e46b049Smrg# Otherwise the value of $enable_unit_tests is blank.
20148e46b049Smrg#
20158e46b049Smrg# Interface to module:
20168e46b049Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
20178e46b049Smrg# with_glib: used in configure.ac to know if GLib has been found
20188e46b049Smrg# --with-glib:	'yes' user instructs the module to use glib
20198e46b049Smrg#		'no' user instructs the module not to use glib
20208e46b049Smrg#
20218e46b049SmrgAC_DEFUN([XORG_WITH_GLIB],[
20228e46b049SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
20238e46b049Smrgm4_define([_defopt], m4_default([$2], [auto]))
20248e46b049SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
20258e46b049Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
20268e46b049Smrg	[with_glib=$withval], [with_glib=]_defopt)
20278e46b049Smrgm4_undefine([_defopt])
20288e46b049Smrg
20298e46b049Smrghave_glib=no
20308e46b049Smrg# Do not probe GLib if user explicitly disabled unit testing
20318e46b049Smrgif test "x$enable_unit_tests" != x"no"; then
20328e46b049Smrg  # Do not probe GLib if user explicitly disabled it
20338e46b049Smrg  if test "x$with_glib" != x"no"; then
20348e46b049Smrg    m4_ifval(
20358e46b049Smrg      [$1],
20368e46b049Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
20378e46b049Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
20388e46b049Smrg    )
20398e46b049Smrg  fi
20408e46b049Smrgfi
20418e46b049Smrg
20428e46b049Smrg# Not having GLib when unit testing has been explicitly requested is an error
20438e46b049Smrgif test "x$enable_unit_tests" = x"yes"; then
20448e46b049Smrg  if test "x$have_glib" = x"no"; then
20458e46b049Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
20468e46b049Smrg  fi
20478e46b049Smrgfi
20488e46b049Smrg
20498e46b049Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
20508e46b049Smrgif test "x$enable_unit_tests" = x"no"; then
20518e46b049Smrg  if test "x$with_glib" = x"yes"; then
20528e46b049Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
20538e46b049Smrg  fi
20548e46b049Smrgfi
20558e46b049Smrg
20568e46b049Smrg# Not having GLib when it has been explicitly requested is an error
20578e46b049Smrgif test "x$with_glib" = x"yes"; then
20588e46b049Smrg  if test "x$have_glib" = x"no"; then
20598e46b049Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
20608e46b049Smrg  fi
20618e46b049Smrgfi
20628e46b049Smrg
20638e46b049SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
20648e46b049Smrg]) # XORG_WITH_GLIB
20658e46b049Smrg
20668e46b049Smrg# XORG_LD_WRAP
20678e46b049Smrg# ------------
20688e46b049Smrg# Minimum version: 1.13.0
20698e46b049Smrg#
20708e46b049Smrg# Check if linker supports -wrap, passed via compiler flags
20718e46b049Smrg#
20728e46b049Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
20738e46b049Smrg# Otherwise the value of $enable_unit_tests is blank.
20748e46b049Smrg#
20758e46b049SmrgAC_DEFUN([XORG_LD_WRAP],[
20768e46b049SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
20778e46b049Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
20788e46b049Smrgif test "x$enable_unit_tests" = x"yes"; then
20798e46b049Smrg  if test "x$have_ld_wrap" = x"no"; then
20808e46b049Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
20818e46b049Smrg  fi
20828e46b049Smrgfi
20838e46b049SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
20848e46b049Smrg#
20858e46b049Smrg]) # XORG_LD_WRAP
20868e46b049Smrg
20878e46b049Smrg# XORG_CHECK_LINKER_FLAGS
20888e46b049Smrg# -----------------------
20898e46b049Smrg# SYNOPSIS
20908e46b049Smrg#
20918e46b049Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
20928e46b049Smrg#
20938e46b049Smrg# DESCRIPTION
20948e46b049Smrg#
20958e46b049Smrg#   Check whether the given linker FLAGS work with the current language's
20968e46b049Smrg#   linker, or whether they give an error.
20978e46b049Smrg#
20988e46b049Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
20998e46b049Smrg#   success/failure.
21008e46b049Smrg#
21018e46b049Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
21028e46b049Smrg#
21038e46b049Smrg# LICENSE
21048e46b049Smrg#
21058e46b049Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
21068e46b049Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
21078e46b049Smrg#   Copyright (c) 2009 Matteo Frigo
21088e46b049Smrg#
21098e46b049Smrg#   This program is free software: you can redistribute it and/or modify it
21108e46b049Smrg#   under the terms of the GNU General Public License as published by the
21118e46b049Smrg#   Free Software Foundation, either version 3 of the License, or (at your
21128e46b049Smrg#   option) any later version.
21138e46b049Smrg#
21148e46b049Smrg#   This program is distributed in the hope that it will be useful, but
21158e46b049Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
21168e46b049Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
21178e46b049Smrg#   Public License for more details.
21188e46b049Smrg#
21198e46b049Smrg#   You should have received a copy of the GNU General Public License along
21208e46b049Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
21218e46b049Smrg#
21228e46b049Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
21238e46b049Smrg#   gives unlimited permission to copy, distribute and modify the configure
21248e46b049Smrg#   scripts that are the output of Autoconf when processing the Macro. You
21258e46b049Smrg#   need not follow the terms of the GNU General Public License when using
21268e46b049Smrg#   or distributing such scripts, even though portions of the text of the
21278e46b049Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
21288e46b049Smrg#   all other use of the material that constitutes the Autoconf Macro.
21298e46b049Smrg#
21308e46b049Smrg#   This special exception to the GPL applies to versions of the Autoconf
21318e46b049Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
21328e46b049Smrg#   modified version of the Autoconf Macro, you may extend this special
21338e46b049Smrg#   exception to the GPL to apply to your modified version as well.#
21348e46b049SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
21358e46b049Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
21368e46b049Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
21378e46b049SmrgAS_LITERAL_IF([$1],
21388e46b049Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
21398e46b049Smrg      ax_save_FLAGS=$LDFLAGS
21408e46b049Smrg      LDFLAGS="$1"
21418e46b049Smrg      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
21428e46b049Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
21438e46b049Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
21448e46b049Smrg      LDFLAGS=$ax_save_FLAGS])],
21458e46b049Smrg  [ax_save_FLAGS=$LDFLAGS
21468e46b049Smrg   LDFLAGS="$1"
21478e46b049Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
21488e46b049Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
21498e46b049Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
21508e46b049Smrg   LDFLAGS=$ax_save_FLAGS])
21518e46b049Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
21528e46b049SmrgAC_MSG_RESULT($xorg_check_linker_flags)
21538e46b049Smrgif test "x$xorg_check_linker_flags" = xyes; then
21548e46b049Smrg	m4_default([$2], :)
21558e46b049Smrgelse
21568e46b049Smrg	m4_default([$3], :)
21578e46b049Smrgfi
21588e46b049Smrg]) # XORG_CHECK_LINKER_FLAGS
21598e46b049Smrg
2160a850946eSmrg# XORG_CHECK_MALLOC_ZERO
2161a850946eSmrg# ----------------------
216270f7c90cSmrg# Minimum version: 1.0.0
216370f7c90cSmrg#
2164a850946eSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2165a850946eSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2166a850946eSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2167a850946eSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2168a850946eSmrgAC_ARG_ENABLE(malloc0returnsnull,
216970f7c90cSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2170a850946eSmrg		       [malloc(0) returns NULL (default: auto)]),
2171a850946eSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2172a850946eSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2173a850946eSmrg
2174a850946eSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2175a850946eSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
21768e46b049Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
21778e46b049Smrg#include <stdlib.h>
21788e46b049Smrg],[
2179a850946eSmrg    char *m0, *r0, *c0, *p;
2180a850946eSmrg    m0 = malloc(0);
2181a850946eSmrg    p = malloc(10);
2182a850946eSmrg    r0 = realloc(p,0);
21838e46b049Smrg    c0 = calloc(0,10);
21848e46b049Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
21858e46b049Smrg])],
2186a850946eSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
21877dff02feSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
21887dff02feSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2189a850946eSmrgfi
2190a850946eSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2191a850946eSmrg
2192a850946eSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2193a850946eSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2194a850946eSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2195a850946eSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2196a850946eSmrgelse
2197a850946eSmrg	MALLOC_ZERO_CFLAGS=""
2198a850946eSmrg	XMALLOC_ZERO_CFLAGS=""
2199a850946eSmrg	XTMALLOC_ZERO_CFLAGS=""
2200a850946eSmrgfi
2201a850946eSmrg
2202a850946eSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2203a850946eSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2204a850946eSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2205a850946eSmrg]) # XORG_CHECK_MALLOC_ZERO
2206a850946eSmrg
220770f7c90cSmrg# XORG_WITH_LINT()
220870f7c90cSmrg# ----------------
220970f7c90cSmrg# Minimum version: 1.1.0
221070f7c90cSmrg#
221169a1fe56Smrg# This macro enables the use of a tool that flags some suspicious and
221269a1fe56Smrg# non-portable constructs (likely to be bugs) in C language source code.
221369a1fe56Smrg# It will attempt to locate the tool and use appropriate options.
221469a1fe56Smrg# There are various lint type tools on different platforms.
221569a1fe56Smrg#
221669a1fe56Smrg# Interface to module:
221769a1fe56Smrg# LINT:		returns the path to the tool found on the platform
221869a1fe56Smrg#		or the value set to LINT on the configure cmd line
221969a1fe56Smrg#		also an Automake conditional
222069a1fe56Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
222169a1fe56Smrg#
222269a1fe56Smrg# --with-lint:	'yes' user instructs the module to use lint
222369a1fe56Smrg#		'no' user instructs the module not to use lint (default)
222469a1fe56Smrg#
222569a1fe56Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
222669a1fe56Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
222770f7c90cSmrg#
222870f7c90cSmrgAC_DEFUN([XORG_WITH_LINT],[
222970f7c90cSmrg
223069a1fe56SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
223169a1fe56SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
223270f7c90cSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
223370f7c90cSmrg		[Use a lint-style source code checker (default: disabled)])],
223470f7c90cSmrg		[use_lint=$withval], [use_lint=no])
223569a1fe56Smrg
223669a1fe56Smrg# Obtain platform specific info like program name and options
223769a1fe56Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
223869a1fe56Smrgcase $host_os in
223969a1fe56Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
224069a1fe56Smrg	lint_name=splint
224169a1fe56Smrg	lint_options="-badflag"
224269a1fe56Smrg	;;
224369a1fe56Smrg  *freebsd* | *netbsd*)
224469a1fe56Smrg	lint_name=lint
224569a1fe56Smrg	lint_options="-u -b"
224669a1fe56Smrg	;;
224769a1fe56Smrg  *solaris*)
224869a1fe56Smrg	lint_name=lint
224969a1fe56Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
225069a1fe56Smrg	;;
225169a1fe56Smrgesac
225269a1fe56Smrg
225369a1fe56Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
225469a1fe56Smrgif test "x$use_lint" = x"yes" ; then
225569a1fe56Smrg   AC_PATH_PROG([LINT], [$lint_name])
225669a1fe56Smrg   if test "x$LINT" = "x"; then
225769a1fe56Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
225869a1fe56Smrg   fi
225969a1fe56Smrgelif test "x$use_lint" = x"no" ; then
226069a1fe56Smrg   if test "x$LINT" != "x"; then
226169a1fe56Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
226269a1fe56Smrg   fi
226370f7c90cSmrgelse
226469a1fe56Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
226570f7c90cSmrgfi
226669a1fe56Smrg
226769a1fe56Smrg# User supplied flags override default flags
226869a1fe56Smrgif test "x$LINT_FLAGS" != "x"; then
226969a1fe56Smrg   lint_options=$LINT_FLAGS
227070f7c90cSmrgfi
227170f7c90cSmrg
227269a1fe56SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
227369a1fe56SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
227470f7c90cSmrg
227570f7c90cSmrg]) # XORG_WITH_LINT
227670f7c90cSmrg
227770f7c90cSmrg# XORG_LINT_LIBRARY(LIBNAME)
227870f7c90cSmrg# --------------------------
227970f7c90cSmrg# Minimum version: 1.1.0
228070f7c90cSmrg#
228170f7c90cSmrg# Sets up flags for building lint libraries for checking programs that call
228270f7c90cSmrg# functions in the library.
228370f7c90cSmrg#
228469a1fe56Smrg# Interface to module:
228569a1fe56Smrg# LINTLIB		- Automake variable with the name of lint library file to make
228669a1fe56Smrg# MAKE_LINT_LIB		- Automake conditional
228769a1fe56Smrg#
228869a1fe56Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
228969a1fe56Smrg#			  - 'no' user instructs the module not to create a lint library (default)
229070f7c90cSmrg
229170f7c90cSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
229270f7c90cSmrgAC_REQUIRE([XORG_WITH_LINT])
229370f7c90cSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
229470f7c90cSmrg	[Create lint library (default: disabled)])],
229570f7c90cSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
229669a1fe56Smrg
229769a1fe56Smrgif test "x$make_lint_lib" = x"yes" ; then
229869a1fe56Smrg   LINTLIB=llib-l$1.ln
229969a1fe56Smrg   if test "x$LINT" = "x"; then
230069a1fe56Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
230169a1fe56Smrg   fi
230269a1fe56Smrgelif test "x$make_lint_lib" != x"no" ; then
230369a1fe56Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
230470f7c90cSmrgfi
230569a1fe56Smrg
230670f7c90cSmrgAC_SUBST(LINTLIB)
230770f7c90cSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
230870f7c90cSmrg
230970f7c90cSmrg]) # XORG_LINT_LIBRARY
231070f7c90cSmrg
231170f7c90cSmrg# XORG_CWARNFLAGS
231270f7c90cSmrg# ---------------
231370f7c90cSmrg# Minimum version: 1.2.0
231470f7c90cSmrg#
231570f7c90cSmrg# Defines CWARNFLAGS to enable C compiler warnings.
231670f7c90cSmrg#
231770f7c90cSmrgAC_DEFUN([XORG_CWARNFLAGS], [
231869a1fe56SmrgAC_REQUIRE([AC_PROG_CC_C99])
231970f7c90cSmrgif  test "x$GCC" = xyes ; then
232070f7c90cSmrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
232170f7c90cSmrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
23227dff02feSmrg-Wbad-function-cast -Wformat=2"
232370f7c90cSmrg    case `$CC -dumpversion` in
232470f7c90cSmrg    3.4.* | 4.*)
232570f7c90cSmrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
232670f7c90cSmrg	;;
232770f7c90cSmrg    esac
232870f7c90cSmrgelse
232970f7c90cSmrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
233070f7c90cSmrg    if test "x$SUNCC" = "xyes"; then
233170f7c90cSmrg	CWARNFLAGS="-v"
233270f7c90cSmrg    fi
233370f7c90cSmrgfi
233470f7c90cSmrgAC_SUBST(CWARNFLAGS)
233570f7c90cSmrg]) # XORG_CWARNFLAGS
233670f7c90cSmrg
233770f7c90cSmrg# XORG_STRICT_OPTION
233870f7c90cSmrg# -----------------------
233970f7c90cSmrg# Minimum version: 1.3.0
234070f7c90cSmrg#
234170f7c90cSmrg# Add configure option to enable strict compilation
234270f7c90cSmrgAC_DEFUN([XORG_STRICT_OPTION], [
234369a1fe56Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
234470f7c90cSmrgAC_REQUIRE([AC_PROG_CC_C99])
234570f7c90cSmrgAC_REQUIRE([XORG_CWARNFLAGS])
234670f7c90cSmrg
234770f7c90cSmrgAC_ARG_ENABLE(strict-compilation,
234870f7c90cSmrg			  AS_HELP_STRING([--enable-strict-compilation],
234970f7c90cSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
235070f7c90cSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
235170f7c90cSmrgif test "x$STRICT_COMPILE" = "xyes"; then
235270f7c90cSmrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
235370f7c90cSmrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
235470f7c90cSmrg	if test "x$GCC" = xyes ; then
235570f7c90cSmrg		STRICT_CFLAGS="-pedantic -Werror"
235670f7c90cSmrg	elif test "x$SUNCC" = "xyes"; then
235770f7c90cSmrg		STRICT_CFLAGS="-errwarn"
235870f7c90cSmrg    elif test "x$INTELCC" = "xyes"; then
235970f7c90cSmrg		STRICT_CFLAGS="-Werror"
236070f7c90cSmrg	fi
236170f7c90cSmrgfi
236270f7c90cSmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
236370f7c90cSmrgAC_SUBST([CWARNFLAGS])
236470f7c90cSmrg]) # XORG_STRICT_OPTION
236570f7c90cSmrg
236670f7c90cSmrg# XORG_DEFAULT_OPTIONS
236770f7c90cSmrg# --------------------
236870f7c90cSmrg# Minimum version: 1.3.0
236970f7c90cSmrg#
237070f7c90cSmrg# Defines default options for X.Org modules.
237170f7c90cSmrg#
237270f7c90cSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
237369a1fe56SmrgAC_REQUIRE([AC_PROG_INSTALL])
237470f7c90cSmrgXORG_CWARNFLAGS
237570f7c90cSmrgXORG_STRICT_OPTION
237670f7c90cSmrgXORG_RELEASE_VERSION
237770f7c90cSmrgXORG_CHANGELOG
23787dff02feSmrgXORG_INSTALL
237970f7c90cSmrgXORG_MANPAGE_SECTIONS
23807dff02feSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
23817dff02feSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
238270f7c90cSmrg]) # XORG_DEFAULT_OPTIONS
23837dff02feSmrg
23847dff02feSmrg# XORG_INSTALL()
23857dff02feSmrg# ----------------
23867dff02feSmrg# Minimum version: 1.4.0
23877dff02feSmrg#
23887dff02feSmrg# Defines the variable INSTALL_CMD as the command to copy
23897dff02feSmrg# INSTALL from $prefix/share/util-macros.
23907dff02feSmrg#
23917dff02feSmrgAC_DEFUN([XORG_INSTALL], [
23927dff02feSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
23937dff02feSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
23947dff02feSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
23957dff02feSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
23967dff02feSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
23977dff02feSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
23987dff02feSmrgAC_SUBST([INSTALL_CMD])
23997dff02feSmrg]) # XORG_INSTALL
2400a850946eSmrgdnl Copyright 2005 Red Hat, Inc
2401a850946eSmrgdnl
2402a850946eSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2403a850946eSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2404a850946eSmrgdnl the above copyright notice appear in all copies and that both that
2405a850946eSmrgdnl copyright notice and this permission notice appear in supporting
2406a850946eSmrgdnl documentation.
2407a850946eSmrgdnl
2408a850946eSmrgdnl The above copyright notice and this permission notice shall be included
2409a850946eSmrgdnl in all copies or substantial portions of the Software.
2410a850946eSmrgdnl
2411a850946eSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2412a850946eSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2413a850946eSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2414a850946eSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2415a850946eSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2416a850946eSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2417a850946eSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
2418a850946eSmrgdnl
2419a850946eSmrgdnl Except as contained in this notice, the name of the copyright holders shall
2420a850946eSmrgdnl not be used in advertising or otherwise to promote the sale, use or
2421a850946eSmrgdnl other dealings in this Software without prior written authorization
2422a850946eSmrgdnl from the copyright holders.
2423a850946eSmrgdnl
2424a850946eSmrg
2425a850946eSmrg# XORG_RELEASE_VERSION
2426a850946eSmrg# --------------------
242769a1fe56Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
2428a850946eSmrg 
2429a850946eSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
243070f7c90cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
243170f7c90cSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
243270f7c90cSmrg		[Major version of this package])
243370f7c90cSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
243470f7c90cSmrg	if test "x$PVM" = "x"; then
243570f7c90cSmrg		PVM="0"
243670f7c90cSmrg	fi
243770f7c90cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
243870f7c90cSmrg		[$PVM],
243970f7c90cSmrg		[Minor version of this package])
244070f7c90cSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
244170f7c90cSmrg	if test "x$PVP" = "x"; then
244270f7c90cSmrg		PVP="0"
244370f7c90cSmrg	fi
244470f7c90cSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
244570f7c90cSmrg		[$PVP],
244670f7c90cSmrg		[Patch version of this package])
2447a850946eSmrg])
2448a850946eSmrg
244970f7c90cSmrg# XORG_CHANGELOG()
245070f7c90cSmrg# ----------------
245170f7c90cSmrg# Minimum version: 1.2.0
245270f7c90cSmrg#
245370f7c90cSmrg# Defines the variable CHANGELOG_CMD as the command to generate
245470f7c90cSmrg# ChangeLog from git.
245570f7c90cSmrg#
245670f7c90cSmrg#
245770f7c90cSmrgAC_DEFUN([XORG_CHANGELOG], [
24587dff02feSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
24597dff02feSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
24607dff02feSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
246170f7c90cSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
246270f7c90cSmrgAC_SUBST([CHANGELOG_CMD])
246370f7c90cSmrg]) # XORG_CHANGELOG
246470f7c90cSmrg
246570f7c90cSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
246670f7c90cSmrg# 
246770f7c90cSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
246870f7c90cSmrg#
246970f7c90cSmrg# This program is free software; you can redistribute it and/or modify
247070f7c90cSmrg# it under the terms of the GNU General Public License as published by
247170f7c90cSmrg# the Free Software Foundation; either version 2 of the License, or
247270f7c90cSmrg# (at your option) any later version.
247370f7c90cSmrg#
247470f7c90cSmrg# This program is distributed in the hope that it will be useful, but
247570f7c90cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
247670f7c90cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
247770f7c90cSmrg# General Public License for more details.
247870f7c90cSmrg#
247970f7c90cSmrg# You should have received a copy of the GNU General Public License
248070f7c90cSmrg# along with this program; if not, write to the Free Software
248170f7c90cSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
248270f7c90cSmrg#
248370f7c90cSmrg# As a special exception to the GNU General Public License, if you
248470f7c90cSmrg# distribute this file as part of a program that contains a
248570f7c90cSmrg# configuration script generated by Autoconf, you may include it under
248670f7c90cSmrg# the same distribution terms that you use for the rest of that program.
248770f7c90cSmrg
248870f7c90cSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
248970f7c90cSmrg# ----------------------------------
249070f7c90cSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
249170f7c90cSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
249270f7c90cSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
249370f7c90cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
249470f7c90cSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
249570f7c90cSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
249670f7c90cSmrgfi
249770f7c90cSmrgif test -n "$PKG_CONFIG"; then
249870f7c90cSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
249970f7c90cSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
250070f7c90cSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
250170f7c90cSmrg		AC_MSG_RESULT([yes])
250270f7c90cSmrg	else
250370f7c90cSmrg		AC_MSG_RESULT([no])
250470f7c90cSmrg		PKG_CONFIG=""
250570f7c90cSmrg	fi
250670f7c90cSmrg		
250770f7c90cSmrgfi[]dnl
250870f7c90cSmrg])# PKG_PROG_PKG_CONFIG
250970f7c90cSmrg
251070f7c90cSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
251170f7c90cSmrg#
251270f7c90cSmrg# Check to see whether a particular set of modules exists.  Similar
251370f7c90cSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
251470f7c90cSmrg#
251570f7c90cSmrg#
251670f7c90cSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
251770f7c90cSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
251870f7c90cSmrg# PKG_CHECK_EXISTS manually
251970f7c90cSmrg# --------------------------------------------------------------
252070f7c90cSmrgAC_DEFUN([PKG_CHECK_EXISTS],
252170f7c90cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
252270f7c90cSmrgif test -n "$PKG_CONFIG" && \
252370f7c90cSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
252470f7c90cSmrg  m4_ifval([$2], [$2], [:])
252570f7c90cSmrgm4_ifvaln([$3], [else
252670f7c90cSmrg  $3])dnl
252770f7c90cSmrgfi])
252870f7c90cSmrg
252970f7c90cSmrg
253070f7c90cSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
253170f7c90cSmrg# ---------------------------------------------
253270f7c90cSmrgm4_define([_PKG_CONFIG],
253370f7c90cSmrg[if test -n "$$1"; then
253470f7c90cSmrg    pkg_cv_[]$1="$$1"
253570f7c90cSmrg elif test -n "$PKG_CONFIG"; then
253670f7c90cSmrg    PKG_CHECK_EXISTS([$3],
253770f7c90cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
253870f7c90cSmrg		     [pkg_failed=yes])
253970f7c90cSmrg else
254070f7c90cSmrg    pkg_failed=untried
254170f7c90cSmrgfi[]dnl
254270f7c90cSmrg])# _PKG_CONFIG
254370f7c90cSmrg
254470f7c90cSmrg# _PKG_SHORT_ERRORS_SUPPORTED
254570f7c90cSmrg# -----------------------------
254670f7c90cSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
254770f7c90cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
254870f7c90cSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
254970f7c90cSmrg        _pkg_short_errors_supported=yes
255070f7c90cSmrgelse
255170f7c90cSmrg        _pkg_short_errors_supported=no
255270f7c90cSmrgfi[]dnl
255370f7c90cSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
255470f7c90cSmrg
255570f7c90cSmrg
255670f7c90cSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
255770f7c90cSmrg# [ACTION-IF-NOT-FOUND])
255870f7c90cSmrg#
255970f7c90cSmrg#
256070f7c90cSmrg# Note that if there is a possibility the first call to
256170f7c90cSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
256270f7c90cSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
256370f7c90cSmrg#
256470f7c90cSmrg#
256570f7c90cSmrg# --------------------------------------------------------------
256670f7c90cSmrgAC_DEFUN([PKG_CHECK_MODULES],
256770f7c90cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
256870f7c90cSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
256970f7c90cSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
257070f7c90cSmrg
257170f7c90cSmrgpkg_failed=no
257270f7c90cSmrgAC_MSG_CHECKING([for $1])
257370f7c90cSmrg
257470f7c90cSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
257570f7c90cSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
257670f7c90cSmrg
257770f7c90cSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
257870f7c90cSmrgand $1[]_LIBS to avoid the need to call pkg-config.
257970f7c90cSmrgSee the pkg-config man page for more details.])
258070f7c90cSmrg
258170f7c90cSmrgif test $pkg_failed = yes; then
258270f7c90cSmrg        _PKG_SHORT_ERRORS_SUPPORTED
258370f7c90cSmrg        if test $_pkg_short_errors_supported = yes; then
258470f7c90cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
258570f7c90cSmrg        else 
258670f7c90cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
258770f7c90cSmrg        fi
258870f7c90cSmrg	# Put the nasty error message in config.log where it belongs
258970f7c90cSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
259070f7c90cSmrg
259170f7c90cSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
259270f7c90cSmrg[Package requirements ($2) were not met:
259370f7c90cSmrg
259470f7c90cSmrg$$1_PKG_ERRORS
259570f7c90cSmrg
259670f7c90cSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
259770f7c90cSmrginstalled software in a non-standard prefix.
259870f7c90cSmrg
259970f7c90cSmrg_PKG_TEXT
260070f7c90cSmrg])],
260170f7c90cSmrg		[AC_MSG_RESULT([no])
260270f7c90cSmrg                $4])
260370f7c90cSmrgelif test $pkg_failed = untried; then
260470f7c90cSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
260570f7c90cSmrg[The pkg-config script could not be found or is too old.  Make sure it
260670f7c90cSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
260770f7c90cSmrgpath to pkg-config.
260870f7c90cSmrg
260970f7c90cSmrg_PKG_TEXT
261070f7c90cSmrg
261170f7c90cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
261270f7c90cSmrg		[$4])
261370f7c90cSmrgelse
261470f7c90cSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
261570f7c90cSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
261670f7c90cSmrg        AC_MSG_RESULT([yes])
261770f7c90cSmrg	ifelse([$3], , :, [$3])
261870f7c90cSmrgfi[]dnl
261970f7c90cSmrg])# PKG_CHECK_MODULES
262070f7c90cSmrg
2621