1a4a4261fSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e7c933f3Smrg
3a4a4261fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4cbeba4aeSmrg
5cbeba4aeSmrg# This file is free software; the Free Software Foundation
6cbeba4aeSmrg# gives unlimited permission to copy and/or distribute it,
7cbeba4aeSmrg# with or without modifications, as long as this notice is preserved.
8cbeba4aeSmrg
9cbeba4aeSmrg# This program is distributed in the hope that it will be useful,
10cbeba4aeSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11cbeba4aeSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12cbeba4aeSmrg# PARTICULAR PURPOSE.
13cbeba4aeSmrg
14e7c933f3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157bd0f98dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
167bd0f98dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17b0d3a7b0Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18b0d3a7b0Smrg[m4_warning([this file was generated for autoconf 2.72.
197bd0f98dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207bd0f98dSmrgIf you have problems, you may need to regenerate the build system entirely.
21e7c933f3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22cbeba4aeSmrg
23a4a4261fSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24a4a4261fSmrg#
25a4a4261fSmrg# This file is free software; the Free Software Foundation
26a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
27a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
28e7c933f3Smrg
29a4a4261fSmrg# AM_AUTOMAKE_VERSION(VERSION)
30a4a4261fSmrg# ----------------------------
31a4a4261fSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32a4a4261fSmrg# generated from the m4 files accompanying Automake X.Y.
33a4a4261fSmrg# (This private macro should not be called outside this file.)
34a4a4261fSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35a4a4261fSmrg[am__api_version='1.16'
36a4a4261fSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37a4a4261fSmrgdnl require some minimum version.  Point them to the right macro.
38a4a4261fSmrgm4_if([$1], [1.16.5], [],
39a4a4261fSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40a4a4261fSmrg])
41e7c933f3Smrg
42a4a4261fSmrg# _AM_AUTOCONF_VERSION(VERSION)
43a4a4261fSmrg# -----------------------------
44a4a4261fSmrg# aclocal traces this macro to find the Autoconf version.
45a4a4261fSmrg# This is a private macro too.  Using m4_define simplifies
46a4a4261fSmrg# the logic in aclocal, which can simply ignore this definition.
47a4a4261fSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48cbeba4aeSmrg
49a4a4261fSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50a4a4261fSmrg# -------------------------------
51a4a4261fSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52a4a4261fSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53a4a4261fSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54a4a4261fSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55a4a4261fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56a4a4261fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57a4a4261fSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
587bd0f98dSmrg
59a4a4261fSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60cbeba4aeSmrg
61a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62a4a4261fSmrg#
63a4a4261fSmrg# This file is free software; the Free Software Foundation
64a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
65a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
66cbeba4aeSmrg
67a4a4261fSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68a4a4261fSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69a4a4261fSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70a4a4261fSmrg#
71a4a4261fSmrg# Of course, Automake must honor this variable whenever it calls a
72a4a4261fSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73a4a4261fSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74a4a4261fSmrg# depending on how configure is run.  This is pretty annoying, since
75a4a4261fSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76a4a4261fSmrg# source directory, any form will work fine, but in subdirectories a
77a4a4261fSmrg# relative path needs to be adjusted first.
78a4a4261fSmrg#
79a4a4261fSmrg# $ac_aux_dir/missing
80a4a4261fSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81a4a4261fSmrg# $top_srcdir/$ac_aux_dir/missing
82a4a4261fSmrg#    fails if $ac_aux_dir is absolute,
83a4a4261fSmrg#    fails when called from a subdirectory in a VPATH build with
84a4a4261fSmrg#          a relative $ac_aux_dir
85a4a4261fSmrg#
86a4a4261fSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87a4a4261fSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88a4a4261fSmrg# harmless because $srcdir is '.', but things will broke when you
89a4a4261fSmrg# start a VPATH build or use an absolute $srcdir.
90a4a4261fSmrg#
91a4a4261fSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92a4a4261fSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93a4a4261fSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94a4a4261fSmrg# and then we would define $MISSING as
95a4a4261fSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96a4a4261fSmrg# This will work as long as MISSING is not called from configure, because
97a4a4261fSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98a4a4261fSmrg# However there are other variables, like CC, which are often used in
99a4a4261fSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100a4a4261fSmrg#
101a4a4261fSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102a4a4261fSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103a4a4261fSmrg# configured tree to be moved without reconfiguration.
104cbeba4aeSmrg
105a4a4261fSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106a4a4261fSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107a4a4261fSmrg# Expand $ac_aux_dir to an absolute path.
108a4a4261fSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109a4a4261fSmrg])
110cbeba4aeSmrg
111a4a4261fSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112cbeba4aeSmrg
113a4a4261fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114a4a4261fSmrg#
115a4a4261fSmrg# This file is free software; the Free Software Foundation
116a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
117a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
118cbeba4aeSmrg
119a4a4261fSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120a4a4261fSmrg# -------------------------------------
121a4a4261fSmrg# Define a conditional.
122a4a4261fSmrgAC_DEFUN([AM_CONDITIONAL],
123a4a4261fSmrg[AC_PREREQ([2.52])dnl
124a4a4261fSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125a4a4261fSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126a4a4261fSmrgAC_SUBST([$1_TRUE])dnl
127a4a4261fSmrgAC_SUBST([$1_FALSE])dnl
128a4a4261fSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129a4a4261fSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130a4a4261fSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131a4a4261fSmrgif $2; then
132a4a4261fSmrg  $1_TRUE=
133a4a4261fSmrg  $1_FALSE='#'
134a4a4261fSmrgelse
135a4a4261fSmrg  $1_TRUE='#'
136a4a4261fSmrg  $1_FALSE=
137a4a4261fSmrgfi
138a4a4261fSmrgAC_CONFIG_COMMANDS_PRE(
139a4a4261fSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140a4a4261fSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141a4a4261fSmrgUsually this means the macro was only invoked conditionally.]])
142a4a4261fSmrgfi])])
143cbeba4aeSmrg
144a4a4261fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145a4a4261fSmrg#
146a4a4261fSmrg# This file is free software; the Free Software Foundation
147a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
148a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
149cbeba4aeSmrg
150cbeba4aeSmrg
151a4a4261fSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152a4a4261fSmrg# written in clear, in which case automake, when reading aclocal.m4,
153a4a4261fSmrg# will think it sees a *use*, and therefore will trigger all it's
154a4a4261fSmrg# C support machinery.  Also note that it means that autoscan, seeing
155a4a4261fSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156cbeba4aeSmrg
157cbeba4aeSmrg
158a4a4261fSmrg# _AM_DEPENDENCIES(NAME)
159a4a4261fSmrg# ----------------------
160a4a4261fSmrg# See how the compiler implements dependency checking.
161a4a4261fSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162a4a4261fSmrg# We try a few techniques and use that to set a single cache variable.
163a4a4261fSmrg#
164a4a4261fSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165a4a4261fSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166a4a4261fSmrg# dependency, and given that the user is not expected to run this macro,
167a4a4261fSmrg# just rely on AC_PROG_CC.
168a4a4261fSmrgAC_DEFUN([_AM_DEPENDENCIES],
169a4a4261fSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170a4a4261fSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171a4a4261fSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172a4a4261fSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173cbeba4aeSmrg
174a4a4261fSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175a4a4261fSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176a4a4261fSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177a4a4261fSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178a4a4261fSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179a4a4261fSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180a4a4261fSmrg                    [depcc="$$1"   am_compiler_list=])
181cbeba4aeSmrg
182a4a4261fSmrgAC_CACHE_CHECK([dependency style of $depcc],
183a4a4261fSmrg               [am_cv_$1_dependencies_compiler_type],
184a4a4261fSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185a4a4261fSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186a4a4261fSmrg  # making bogus files that we don't know about and never remove.  For
187a4a4261fSmrg  # instance it was reported that on HP-UX the gcc test will end up
188a4a4261fSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189a4a4261fSmrg  # in D".
190a4a4261fSmrg  rm -rf conftest.dir
191a4a4261fSmrg  mkdir conftest.dir
192a4a4261fSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193a4a4261fSmrg  # using a relative directory.
194a4a4261fSmrg  cp "$am_depcomp" conftest.dir
195a4a4261fSmrg  cd conftest.dir
196a4a4261fSmrg  # We will build objects and dependencies in a subdirectory because
197a4a4261fSmrg  # it helps to detect inapplicable dependency modes.  For instance
198a4a4261fSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199a4a4261fSmrg  # side effect of compilation, but ICC will put the dependencies in
200a4a4261fSmrg  # the current directory while Tru64 will put them in the object
201a4a4261fSmrg  # directory.
202a4a4261fSmrg  mkdir sub
203cbeba4aeSmrg
204a4a4261fSmrg  am_cv_$1_dependencies_compiler_type=none
205a4a4261fSmrg  if test "$am_compiler_list" = ""; then
206a4a4261fSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207a4a4261fSmrg  fi
208a4a4261fSmrg  am__universal=false
209a4a4261fSmrg  m4_case([$1], [CC],
210a4a4261fSmrg    [case " $depcc " in #(
211a4a4261fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212a4a4261fSmrg     esac],
213a4a4261fSmrg    [CXX],
214a4a4261fSmrg    [case " $depcc " in #(
215a4a4261fSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216a4a4261fSmrg     esac])
217cbeba4aeSmrg
218a4a4261fSmrg  for depmode in $am_compiler_list; do
219a4a4261fSmrg    # Setup a source with many dependencies, because some compilers
220a4a4261fSmrg    # like to wrap large dependency lists on column 80 (with \), and
221a4a4261fSmrg    # we should not choose a depcomp mode which is confused by this.
222a4a4261fSmrg    #
223a4a4261fSmrg    # We need to recreate these files for each test, as the compiler may
224a4a4261fSmrg    # overwrite some of them when testing with obscure command lines.
225a4a4261fSmrg    # This happens at least with the AIX C compiler.
226a4a4261fSmrg    : > sub/conftest.c
227a4a4261fSmrg    for i in 1 2 3 4 5 6; do
228a4a4261fSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229a4a4261fSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230a4a4261fSmrg      # Solaris 10 /bin/sh.
231a4a4261fSmrg      echo '/* dummy */' > sub/conftst$i.h
232a4a4261fSmrg    done
233a4a4261fSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234cbeba4aeSmrg
235a4a4261fSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236a4a4261fSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237a4a4261fSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238a4a4261fSmrg    # versions had trouble with output in subdirs.
239a4a4261fSmrg    am__obj=sub/conftest.${OBJEXT-o}
240a4a4261fSmrg    am__minus_obj="-o $am__obj"
241a4a4261fSmrg    case $depmode in
242a4a4261fSmrg    gcc)
243a4a4261fSmrg      # This depmode causes a compiler race in universal mode.
244a4a4261fSmrg      test "$am__universal" = false || continue
245a4a4261fSmrg      ;;
246a4a4261fSmrg    nosideeffect)
247a4a4261fSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248a4a4261fSmrg      # only be used when explicitly requested.
249a4a4261fSmrg      if test "x$enable_dependency_tracking" = xyes; then
250a4a4261fSmrg	continue
251a4a4261fSmrg      else
252a4a4261fSmrg	break
253a4a4261fSmrg      fi
254a4a4261fSmrg      ;;
255a4a4261fSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256a4a4261fSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257a4a4261fSmrg      # not run yet.  These depmodes are late enough in the game, and
258a4a4261fSmrg      # so weak that their functioning should not be impacted.
259a4a4261fSmrg      am__obj=conftest.${OBJEXT-o}
260a4a4261fSmrg      am__minus_obj=
261a4a4261fSmrg      ;;
262a4a4261fSmrg    none) break ;;
263a4a4261fSmrg    esac
264a4a4261fSmrg    if depmode=$depmode \
265a4a4261fSmrg       source=sub/conftest.c object=$am__obj \
266a4a4261fSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267a4a4261fSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268a4a4261fSmrg         >/dev/null 2>conftest.err &&
269a4a4261fSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270a4a4261fSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271a4a4261fSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272a4a4261fSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273a4a4261fSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274a4a4261fSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275a4a4261fSmrg      # that says an option was ignored or not supported.
276a4a4261fSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277a4a4261fSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278a4a4261fSmrg      # The diagnosis changed in icc 8.0:
279a4a4261fSmrg      #   icc: Command line remark: option '-MP' not supported
280a4a4261fSmrg      if (grep 'ignoring option' conftest.err ||
281a4a4261fSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282a4a4261fSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283a4a4261fSmrg        break
284a4a4261fSmrg      fi
285a4a4261fSmrg    fi
286a4a4261fSmrg  done
287cbeba4aeSmrg
288a4a4261fSmrg  cd ..
289a4a4261fSmrg  rm -rf conftest.dir
290a4a4261fSmrgelse
291a4a4261fSmrg  am_cv_$1_dependencies_compiler_type=none
292a4a4261fSmrgfi
293a4a4261fSmrg])
294a4a4261fSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295a4a4261fSmrgAM_CONDITIONAL([am__fastdep$1], [
296a4a4261fSmrg  test "x$enable_dependency_tracking" != xno \
297a4a4261fSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298a4a4261fSmrg])
2997bd0f98dSmrg
300e7c933f3Smrg
301a4a4261fSmrg# AM_SET_DEPDIR
302a4a4261fSmrg# -------------
303a4a4261fSmrg# Choose a directory name for dependency files.
304a4a4261fSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305a4a4261fSmrgAC_DEFUN([AM_SET_DEPDIR],
306a4a4261fSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307a4a4261fSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308a4a4261fSmrg])
309e7c933f3Smrg
310e7c933f3Smrg
311a4a4261fSmrg# AM_DEP_TRACK
312a4a4261fSmrg# ------------
313a4a4261fSmrgAC_DEFUN([AM_DEP_TRACK],
314a4a4261fSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315a4a4261fSmrgAS_HELP_STRING(
316a4a4261fSmrg  [--enable-dependency-tracking],
317a4a4261fSmrg  [do not reject slow dependency extractors])
318a4a4261fSmrgAS_HELP_STRING(
319a4a4261fSmrg  [--disable-dependency-tracking],
320a4a4261fSmrg  [speeds up one-time build])])
321a4a4261fSmrgif test "x$enable_dependency_tracking" != xno; then
322a4a4261fSmrg  am_depcomp="$ac_aux_dir/depcomp"
323a4a4261fSmrg  AMDEPBACKSLASH='\'
324a4a4261fSmrg  am__nodep='_no'
325a4a4261fSmrgfi
326a4a4261fSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327a4a4261fSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328a4a4261fSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329a4a4261fSmrgAC_SUBST([am__nodep])dnl
330a4a4261fSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331a4a4261fSmrg])
332e7c933f3Smrg
333a4a4261fSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334cbeba4aeSmrg
335a4a4261fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336e7c933f3Smrg#
337a4a4261fSmrg# This file is free software; the Free Software Foundation
338a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
339a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
340cbeba4aeSmrg
341a4a4261fSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342a4a4261fSmrg# ------------------------------
343a4a4261fSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344a4a4261fSmrg[{
345a4a4261fSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346a4a4261fSmrg  # are listed without --file.  Let's play safe and only enable the eval
347a4a4261fSmrg  # if we detect the quoting.
348a4a4261fSmrg  # TODO: see whether this extra hack can be removed once we start
349a4a4261fSmrg  # requiring Autoconf 2.70 or later.
350a4a4261fSmrg  AS_CASE([$CONFIG_FILES],
351a4a4261fSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352a4a4261fSmrg          [*], [set x $CONFIG_FILES])
353a4a4261fSmrg  shift
354a4a4261fSmrg  # Used to flag and report bootstrapping failures.
355a4a4261fSmrg  am_rc=0
356a4a4261fSmrg  for am_mf
357a4a4261fSmrg  do
358a4a4261fSmrg    # Strip MF so we end up with the name of the file.
359a4a4261fSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360a4a4261fSmrg    # Check whether this is an Automake generated Makefile which includes
361a4a4261fSmrg    # dependency-tracking related rules and includes.
362a4a4261fSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363a4a4261fSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364a4a4261fSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365a4a4261fSmrg      || continue
366a4a4261fSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367a4a4261fSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368a4a4261fSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369a4a4261fSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370a4a4261fSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371a4a4261fSmrg  done
372a4a4261fSmrg  if test $am_rc -ne 0; then
373a4a4261fSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374a4a4261fSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375a4a4261fSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376a4a4261fSmrg    necessary).  You can also try re-running configure with the
377a4a4261fSmrg    '--disable-dependency-tracking' option to at least be able to build
378a4a4261fSmrg    the package (albeit without support for automatic dependency tracking).])
379a4a4261fSmrg  fi
380a4a4261fSmrg  AS_UNSET([am_dirpart])
381a4a4261fSmrg  AS_UNSET([am_filepart])
382a4a4261fSmrg  AS_UNSET([am_mf])
383a4a4261fSmrg  AS_UNSET([am_rc])
384a4a4261fSmrg  rm -f conftest-deps.mk
385a4a4261fSmrg}
386a4a4261fSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387cbeba4aeSmrg
388cbeba4aeSmrg
389a4a4261fSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390a4a4261fSmrg# -----------------------------
391a4a4261fSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3927bd0f98dSmrg#
393a4a4261fSmrg# This code is only required when automatic dependency tracking is enabled.
394a4a4261fSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395a4a4261fSmrg# order to bootstrap the dependency handling code.
396a4a4261fSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397a4a4261fSmrg[AC_CONFIG_COMMANDS([depfiles],
398a4a4261fSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399a4a4261fSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400cbeba4aeSmrg
401a4a4261fSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402cbeba4aeSmrg
403a4a4261fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404a4a4261fSmrg#
405a4a4261fSmrg# This file is free software; the Free Software Foundation
406a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
407a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
408cbeba4aeSmrg
409a4a4261fSmrg# This macro actually does too much.  Some checks are only needed if
410a4a4261fSmrg# your package does certain things.  But this isn't really a big deal.
411cbeba4aeSmrg
412a4a4261fSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413a4a4261fSmrgm4_define([AC_PROG_CC],
414a4a4261fSmrgm4_defn([AC_PROG_CC])
415a4a4261fSmrg[_AM_PROG_CC_C_O
416a4a4261fSmrg])
417cbeba4aeSmrg
418a4a4261fSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419a4a4261fSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420a4a4261fSmrg# -----------------------------------------------
421a4a4261fSmrg# The call with PACKAGE and VERSION arguments is the old style
422a4a4261fSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423a4a4261fSmrg# and VERSION should now be passed to AC_INIT and removed from
424a4a4261fSmrg# the call to AM_INIT_AUTOMAKE.
425a4a4261fSmrg# We support both call styles for the transition.  After
426a4a4261fSmrg# the next Automake release, Autoconf can make the AC_INIT
427a4a4261fSmrg# arguments mandatory, and then we can depend on a new Autoconf
428a4a4261fSmrg# release and drop the old call support.
429a4a4261fSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430a4a4261fSmrg[AC_PREREQ([2.65])dnl
431a4a4261fSmrgm4_ifdef([_$0_ALREADY_INIT],
432a4a4261fSmrg  [m4_fatal([$0 expanded multiple times
433a4a4261fSmrg]m4_defn([_$0_ALREADY_INIT]))],
434a4a4261fSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435a4a4261fSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436a4a4261fSmrgdnl the ones we care about.
437a4a4261fSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438a4a4261fSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439a4a4261fSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440a4a4261fSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441a4a4261fSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442a4a4261fSmrg  # is not polluted with repeated "-I."
443a4a4261fSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444a4a4261fSmrg  # test to see if srcdir already configured
445a4a4261fSmrg  if test -f $srcdir/config.status; then
446a4a4261fSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447a4a4261fSmrg  fi
448e7c933f3Smrgfi
4497bd0f98dSmrg
450a4a4261fSmrg# test whether we have cygpath
451a4a4261fSmrgif test -z "$CYGPATH_W"; then
452a4a4261fSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453a4a4261fSmrg    CYGPATH_W='cygpath -w'
454a4a4261fSmrg  else
455a4a4261fSmrg    CYGPATH_W=echo
456a4a4261fSmrg  fi
457cbeba4aeSmrgfi
458a4a4261fSmrgAC_SUBST([CYGPATH_W])
4597bd0f98dSmrg
460a4a4261fSmrg# Define the identity of the package.
461a4a4261fSmrgdnl Distinguish between old-style and new-style calls.
462a4a4261fSmrgm4_ifval([$2],
463a4a4261fSmrg[AC_DIAGNOSE([obsolete],
464a4a4261fSmrg             [$0: two- and three-arguments forms are deprecated.])
465a4a4261fSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466a4a4261fSmrg AC_SUBST([PACKAGE], [$1])dnl
467a4a4261fSmrg AC_SUBST([VERSION], [$2])],
468a4a4261fSmrg[_AM_SET_OPTIONS([$1])dnl
469a4a4261fSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470a4a4261fSmrgm4_if(
471a4a4261fSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472a4a4261fSmrg  [ok:ok],,
473a4a4261fSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474a4a4261fSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475a4a4261fSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476cbeba4aeSmrg
477a4a4261fSmrg_AM_IF_OPTION([no-define],,
478a4a4261fSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479a4a4261fSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480cbeba4aeSmrg
481a4a4261fSmrg# Some tools Automake needs.
482a4a4261fSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483a4a4261fSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484a4a4261fSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485a4a4261fSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486a4a4261fSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487a4a4261fSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488a4a4261fSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489a4a4261fSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490a4a4261fSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491a4a4261fSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492a4a4261fSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
493a4a4261fSmrg# dies out for good.  For more background, see:
494a4a4261fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495a4a4261fSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496a4a4261fSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497a4a4261fSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498a4a4261fSmrg# system "awk" is bad on some platforms.
499a4a4261fSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500a4a4261fSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501a4a4261fSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502a4a4261fSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503a4a4261fSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504a4a4261fSmrg			     [_AM_PROG_TAR([v7])])])
505a4a4261fSmrg_AM_IF_OPTION([no-dependencies],,
506a4a4261fSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507a4a4261fSmrg		  [_AM_DEPENDENCIES([CC])],
508a4a4261fSmrg		  [m4_define([AC_PROG_CC],
509a4a4261fSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510a4a4261fSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511a4a4261fSmrg		  [_AM_DEPENDENCIES([CXX])],
512a4a4261fSmrg		  [m4_define([AC_PROG_CXX],
513a4a4261fSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514a4a4261fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515a4a4261fSmrg		  [_AM_DEPENDENCIES([OBJC])],
516a4a4261fSmrg		  [m4_define([AC_PROG_OBJC],
517a4a4261fSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518a4a4261fSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519a4a4261fSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
520a4a4261fSmrg		  [m4_define([AC_PROG_OBJCXX],
521a4a4261fSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522a4a4261fSmrg])
523a4a4261fSmrg# Variables for tags utilities; see am/tags.am
524a4a4261fSmrgif test -z "$CTAGS"; then
525a4a4261fSmrg  CTAGS=ctags
526a4a4261fSmrgfi
527a4a4261fSmrgAC_SUBST([CTAGS])
528a4a4261fSmrgif test -z "$ETAGS"; then
529a4a4261fSmrg  ETAGS=etags
530a4a4261fSmrgfi
531a4a4261fSmrgAC_SUBST([ETAGS])
532a4a4261fSmrgif test -z "$CSCOPE"; then
533a4a4261fSmrg  CSCOPE=cscope
534a4a4261fSmrgfi
535a4a4261fSmrgAC_SUBST([CSCOPE])
536cbeba4aeSmrg
537a4a4261fSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538a4a4261fSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
539a4a4261fSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540a4a4261fSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541a4a4261fSmrgAC_CONFIG_COMMANDS_PRE(dnl
542a4a4261fSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543a4a4261fSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544cbeba4aeSmrg
545a4a4261fSmrg# POSIX will say in a future version that running "rm -f" with no argument
546a4a4261fSmrg# is OK; and we want to be able to make that assumption in our Makefile
547a4a4261fSmrg# recipes.  So use an aggressive probe to check that the usage we want is
548a4a4261fSmrg# actually supported "in the wild" to an acceptable degree.
549a4a4261fSmrg# See automake bug#10828.
550a4a4261fSmrg# To make any issue more visible, cause the running configure to be aborted
551a4a4261fSmrg# by default if the 'rm' program in use doesn't match our expectations; the
552a4a4261fSmrg# user can still override this though.
553a4a4261fSmrgif rm -f && rm -fr && rm -rf; then : OK; else
554a4a4261fSmrg  cat >&2 <<'END'
555a4a4261fSmrgOops!
556cbeba4aeSmrg
557a4a4261fSmrgYour 'rm' program seems unable to run without file operands specified
558a4a4261fSmrgon the command line, even when the '-f' option is present.  This is contrary
559a4a4261fSmrgto the behaviour of most rm programs out there, and not conforming with
560a4a4261fSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5617bd0f98dSmrg
562a4a4261fSmrgPlease tell bug-automake@gnu.org about your system, including the value
563a4a4261fSmrgof your $PATH and any error possibly output before this message.  This
564a4a4261fSmrgcan help us improve future automake versions.
565cbeba4aeSmrg
566a4a4261fSmrgEND
567a4a4261fSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568a4a4261fSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569a4a4261fSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570a4a4261fSmrg    echo >&2
571a4a4261fSmrg  else
572a4a4261fSmrg    cat >&2 <<'END'
573a4a4261fSmrgAborting the configuration process, to ensure you take notice of the issue.
574cbeba4aeSmrg
575a4a4261fSmrgYou can download and install GNU coreutils to get an 'rm' implementation
576a4a4261fSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577e7c933f3Smrg
578a4a4261fSmrgIf you want to complete the configuration process using your problematic
579a4a4261fSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580a4a4261fSmrgto "yes", and re-run configure.
581e7c933f3Smrg
582a4a4261fSmrgEND
583a4a4261fSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584a4a4261fSmrg  fi
585cbeba4aeSmrgfi
586a4a4261fSmrgdnl The trailing newline in this macro's definition is deliberate, for
587a4a4261fSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588a4a4261fSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589a4a4261fSmrg])
590cbeba4aeSmrg
591a4a4261fSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592a4a4261fSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593a4a4261fSmrgdnl mangled by Autoconf and run in a shell conditional statement.
594a4a4261fSmrgm4_define([_AC_COMPILER_EXEEXT],
595a4a4261fSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596e7c933f3Smrg
597a4a4261fSmrg# When config.status generates a header, we must update the stamp-h file.
598a4a4261fSmrg# This file resides in the same directory as the config header
599a4a4261fSmrg# that is generated.  The stamp files are numbered to have different names.
600cbeba4aeSmrg
601a4a4261fSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602a4a4261fSmrg# loop where config.status creates the headers, so we can generate
603a4a4261fSmrg# our stamp files there.
604a4a4261fSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605a4a4261fSmrg[# Compute $1's index in $config_headers.
606a4a4261fSmrg_am_arg=$1
607a4a4261fSmrg_am_stamp_count=1
608a4a4261fSmrgfor _am_header in $config_headers :; do
609a4a4261fSmrg  case $_am_header in
610a4a4261fSmrg    $_am_arg | $_am_arg:* )
611a4a4261fSmrg      break ;;
612a4a4261fSmrg    * )
613a4a4261fSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614a4a4261fSmrg  esac
615a4a4261fSmrgdone
616a4a4261fSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617cbeba4aeSmrg
618a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619a4a4261fSmrg#
620a4a4261fSmrg# This file is free software; the Free Software Foundation
621a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
622a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
623a4a4261fSmrg
624a4a4261fSmrg# AM_PROG_INSTALL_SH
625a4a4261fSmrg# ------------------
626a4a4261fSmrg# Define $install_sh.
627a4a4261fSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628a4a4261fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629a4a4261fSmrgif test x"${install_sh+set}" != xset; then
630a4a4261fSmrg  case $am_aux_dir in
631a4a4261fSmrg  *\ * | *\	*)
632a4a4261fSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633a4a4261fSmrg  *)
634a4a4261fSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635a4a4261fSmrg  esac
636a4a4261fSmrgfi
637a4a4261fSmrgAC_SUBST([install_sh])])
638a4a4261fSmrg
639a4a4261fSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640a4a4261fSmrg#
641a4a4261fSmrg# This file is free software; the Free Software Foundation
642a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
643a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
644a4a4261fSmrg
645a4a4261fSmrg# Check whether the underlying file-system supports filenames
646a4a4261fSmrg# with a leading dot.  For instance MS-DOS doesn't.
647a4a4261fSmrgAC_DEFUN([AM_SET_LEADING_DOT],
648a4a4261fSmrg[rm -rf .tst 2>/dev/null
649a4a4261fSmrgmkdir .tst 2>/dev/null
650a4a4261fSmrgif test -d .tst; then
651a4a4261fSmrg  am__leading_dot=.
6527bd0f98dSmrgelse
653a4a4261fSmrg  am__leading_dot=_
6547bd0f98dSmrgfi
655a4a4261fSmrgrmdir .tst 2>/dev/null
656a4a4261fSmrgAC_SUBST([am__leading_dot])])
657cbeba4aeSmrg
658a4a4261fSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659cbeba4aeSmrg
660a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661a4a4261fSmrg#
662a4a4261fSmrg# This file is free software; the Free Software Foundation
663a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
664a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
665cbeba4aeSmrg
666a4a4261fSmrg# AM_MAKE_INCLUDE()
667a4a4261fSmrg# -----------------
668a4a4261fSmrg# Check whether make has an 'include' directive that can support all
669a4a4261fSmrg# the idioms we need for our automatic dependency tracking code.
670a4a4261fSmrgAC_DEFUN([AM_MAKE_INCLUDE],
671a4a4261fSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672a4a4261fSmrgcat > confinc.mk << 'END'
673a4a4261fSmrgam__doit:
674a4a4261fSmrg	@echo this is the am__doit target >confinc.out
675a4a4261fSmrg.PHONY: am__doit
676a4a4261fSmrgEND
677a4a4261fSmrgam__include="#"
678a4a4261fSmrgam__quote=
679a4a4261fSmrg# BSD make does it like this.
680a4a4261fSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681a4a4261fSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682a4a4261fSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683a4a4261fSmrg_am_result=no
684a4a4261fSmrgfor s in GNU BSD; do
685a4a4261fSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686a4a4261fSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687a4a4261fSmrg      ['0:this is the am__doit target'],
688a4a4261fSmrg      [AS_CASE([$s],
689a4a4261fSmrg          [BSD], [am__include='.include' am__quote='"'],
690a4a4261fSmrg          [am__include='include' am__quote=''])])
691a4a4261fSmrg  if test "$am__include" != "#"; then
692a4a4261fSmrg    _am_result="yes ($s style)"
693a4a4261fSmrg    break
694a4a4261fSmrg  fi
695a4a4261fSmrgdone
696a4a4261fSmrgrm -f confinc.* confmf.*
697a4a4261fSmrgAC_MSG_RESULT([${_am_result}])
698a4a4261fSmrgAC_SUBST([am__include])])
699a4a4261fSmrgAC_SUBST([am__quote])])
700cbeba4aeSmrg
701a4a4261fSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702cbeba4aeSmrg
703a4a4261fSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7047bd0f98dSmrg#
705a4a4261fSmrg# This file is free software; the Free Software Foundation
706a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
707a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
708cbeba4aeSmrg
709a4a4261fSmrg# AM_MISSING_PROG(NAME, PROGRAM)
710a4a4261fSmrg# ------------------------------
711a4a4261fSmrgAC_DEFUN([AM_MISSING_PROG],
712a4a4261fSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713a4a4261fSmrg$1=${$1-"${am_missing_run}$2"}
714a4a4261fSmrgAC_SUBST($1)])
715cbeba4aeSmrg
716a4a4261fSmrg# AM_MISSING_HAS_RUN
717a4a4261fSmrg# ------------------
718a4a4261fSmrg# Define MISSING if not defined so far and test if it is modern enough.
719a4a4261fSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720a4a4261fSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721a4a4261fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722a4a4261fSmrgAC_REQUIRE_AUX_FILE([missing])dnl
723a4a4261fSmrgif test x"${MISSING+set}" != xset; then
724a4a4261fSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725e7c933f3Smrgfi
726a4a4261fSmrg# Use eval to expand $SHELL
727a4a4261fSmrgif eval "$MISSING --is-lightweight"; then
728a4a4261fSmrg  am_missing_run="$MISSING "
729a4a4261fSmrgelse
730a4a4261fSmrg  am_missing_run=
731a4a4261fSmrg  AC_MSG_WARN(['missing' script is too old or missing])
7327bd0f98dSmrgfi
733a4a4261fSmrg])
734e7c933f3Smrg
735a4a4261fSmrg# Helper functions for option handling.                     -*- Autoconf -*-
736cbeba4aeSmrg
737a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738a4a4261fSmrg#
739a4a4261fSmrg# This file is free software; the Free Software Foundation
740a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
741a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
742cbeba4aeSmrg
743a4a4261fSmrg# _AM_MANGLE_OPTION(NAME)
744a4a4261fSmrg# -----------------------
745a4a4261fSmrgAC_DEFUN([_AM_MANGLE_OPTION],
746a4a4261fSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747cbeba4aeSmrg
748a4a4261fSmrg# _AM_SET_OPTION(NAME)
749a4a4261fSmrg# --------------------
750a4a4261fSmrg# Set option NAME.  Presently that only means defining a flag for this option.
751a4a4261fSmrgAC_DEFUN([_AM_SET_OPTION],
752a4a4261fSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7537bd0f98dSmrg
754a4a4261fSmrg# _AM_SET_OPTIONS(OPTIONS)
755a4a4261fSmrg# ------------------------
756a4a4261fSmrg# OPTIONS is a space-separated list of Automake options.
757a4a4261fSmrgAC_DEFUN([_AM_SET_OPTIONS],
758a4a4261fSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759a4a4261fSmrg
760a4a4261fSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761a4a4261fSmrg# -------------------------------------------
762a4a4261fSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763a4a4261fSmrgAC_DEFUN([_AM_IF_OPTION],
764a4a4261fSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765a4a4261fSmrg
766a4a4261fSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767e7c933f3Smrg#
768a4a4261fSmrg# This file is free software; the Free Software Foundation
769a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
770a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
771cbeba4aeSmrg
772a4a4261fSmrg# _AM_PROG_CC_C_O
773a4a4261fSmrg# ---------------
774a4a4261fSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775a4a4261fSmrg# to automatically call this.
776a4a4261fSmrgAC_DEFUN([_AM_PROG_CC_C_O],
777a4a4261fSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778a4a4261fSmrgAC_REQUIRE_AUX_FILE([compile])dnl
779a4a4261fSmrgAC_LANG_PUSH([C])dnl
780a4a4261fSmrgAC_CACHE_CHECK(
781a4a4261fSmrg  [whether $CC understands -c and -o together],
782a4a4261fSmrg  [am_cv_prog_cc_c_o],
783a4a4261fSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784a4a4261fSmrg  # Make sure it works both with $CC and with simple cc.
785a4a4261fSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786a4a4261fSmrg  # compilers refuse to overwrite an existing .o file with -o,
787a4a4261fSmrg  # though they will create one.
788a4a4261fSmrg  am_cv_prog_cc_c_o=yes
789a4a4261fSmrg  for am_i in 1 2; do
790a4a4261fSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791a4a4261fSmrg         && test -f conftest2.$ac_objext; then
792a4a4261fSmrg      : OK
793a4a4261fSmrg    else
794a4a4261fSmrg      am_cv_prog_cc_c_o=no
795a4a4261fSmrg      break
796a4a4261fSmrg    fi
797a4a4261fSmrg  done
798a4a4261fSmrg  rm -f core conftest*
799a4a4261fSmrg  unset am_i])
800a4a4261fSmrgif test "$am_cv_prog_cc_c_o" != yes; then
801a4a4261fSmrg   # Losing compiler, so override with the script.
802a4a4261fSmrg   # FIXME: It is wrong to rewrite CC.
803a4a4261fSmrg   # But if we don't then we get into trouble of one sort or another.
804a4a4261fSmrg   # A longer-term fix would be to have automake use am__CC in this case,
805a4a4261fSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806a4a4261fSmrg   CC="$am_aux_dir/compile $CC"
8077bd0f98dSmrgfi
808a4a4261fSmrgAC_LANG_POP([C])])
8097bd0f98dSmrg
810a4a4261fSmrg# For backward compatibility.
811a4a4261fSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8127bd0f98dSmrg
813a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814cbeba4aeSmrg#
815a4a4261fSmrg# This file is free software; the Free Software Foundation
816a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
817a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
8187bd0f98dSmrg
819a4a4261fSmrg# AM_RUN_LOG(COMMAND)
820a4a4261fSmrg# -------------------
821a4a4261fSmrg# Run COMMAND, save the exit status in ac_status, and log it.
822a4a4261fSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823a4a4261fSmrgAC_DEFUN([AM_RUN_LOG],
824a4a4261fSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825a4a4261fSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826a4a4261fSmrg   ac_status=$?
827a4a4261fSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828a4a4261fSmrg   (exit $ac_status); }])
829a4a4261fSmrg
830a4a4261fSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831a4a4261fSmrg
832a4a4261fSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8337bd0f98dSmrg#
834a4a4261fSmrg# This file is free software; the Free Software Foundation
835a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
836a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
837cbeba4aeSmrg
838a4a4261fSmrg# AM_SANITY_CHECK
839a4a4261fSmrg# ---------------
840a4a4261fSmrgAC_DEFUN([AM_SANITY_CHECK],
841a4a4261fSmrg[AC_MSG_CHECKING([whether build environment is sane])
842a4a4261fSmrg# Reject unsafe characters in $srcdir or the absolute working directory
843a4a4261fSmrg# name.  Accept space and tab only in the latter.
844a4a4261fSmrgam_lf='
845a4a4261fSmrg'
846a4a4261fSmrgcase `pwd` in
847a4a4261fSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848a4a4261fSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849a4a4261fSmrgesac
850a4a4261fSmrgcase $srcdir in
851a4a4261fSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852a4a4261fSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853a4a4261fSmrgesac
854a4a4261fSmrg
855a4a4261fSmrg# Do 'set' in a subshell so we don't clobber the current shell's
856a4a4261fSmrg# arguments.  Must try -L first in case configure is actually a
857a4a4261fSmrg# symlink; some systems play weird games with the mod time of symlinks
858a4a4261fSmrg# (eg FreeBSD returns the mod time of the symlink's containing
859a4a4261fSmrg# directory).
860a4a4261fSmrgif (
861a4a4261fSmrg   am_has_slept=no
862a4a4261fSmrg   for am_try in 1 2; do
863a4a4261fSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864a4a4261fSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865a4a4261fSmrg     if test "$[*]" = "X"; then
866a4a4261fSmrg	# -L didn't work.
867a4a4261fSmrg	set X `ls -t "$srcdir/configure" conftest.file`
868a4a4261fSmrg     fi
869a4a4261fSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870a4a4261fSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871a4a4261fSmrg
872a4a4261fSmrg	# If neither matched, then we have a broken ls.  This can happen
873a4a4261fSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874a4a4261fSmrg	# broken ls alias from the environment.  This has actually
875a4a4261fSmrg	# happened.  Such a system could not be considered "sane".
876a4a4261fSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877a4a4261fSmrg  alias in your environment])
878a4a4261fSmrg     fi
879a4a4261fSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880a4a4261fSmrg       break
881a4a4261fSmrg     fi
882a4a4261fSmrg     # Just in case.
883a4a4261fSmrg     sleep 1
884a4a4261fSmrg     am_has_slept=yes
885a4a4261fSmrg   done
886a4a4261fSmrg   test "$[2]" = conftest.file
887a4a4261fSmrg   )
888a4a4261fSmrgthen
889a4a4261fSmrg   # Ok.
890a4a4261fSmrg   :
891e7c933f3Smrgelse
892a4a4261fSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
893a4a4261fSmrgCheck your system clock])
894e7c933f3Smrgfi
895a4a4261fSmrgAC_MSG_RESULT([yes])
896a4a4261fSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897a4a4261fSmrg# generated files are strictly newer.
898a4a4261fSmrgam_sleep_pid=
899a4a4261fSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900a4a4261fSmrg  ( sleep 1 ) &
901a4a4261fSmrg  am_sleep_pid=$!
902a4a4261fSmrgfi
903a4a4261fSmrgAC_CONFIG_COMMANDS_PRE(
904a4a4261fSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905a4a4261fSmrg   if test -n "$am_sleep_pid"; then
906a4a4261fSmrg     # Hide warnings about reused PIDs.
907a4a4261fSmrg     wait $am_sleep_pid 2>/dev/null
908a4a4261fSmrg   fi
909a4a4261fSmrg   AC_MSG_RESULT([done])])
910a4a4261fSmrgrm -f conftest.file
911a4a4261fSmrg])
912cbeba4aeSmrg
913a4a4261fSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9141a669bc9Smrg#
915a4a4261fSmrg# This file is free software; the Free Software Foundation
916a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
917a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
9181a669bc9Smrg
919a4a4261fSmrg# AM_SILENT_RULES([DEFAULT])
920a4a4261fSmrg# --------------------------
921a4a4261fSmrg# Enable less verbose build rules; with the default set to DEFAULT
922a4a4261fSmrg# ("yes" being less verbose, "no" or empty being verbose).
923a4a4261fSmrgAC_DEFUN([AM_SILENT_RULES],
924a4a4261fSmrg[AC_ARG_ENABLE([silent-rules], [dnl
925a4a4261fSmrgAS_HELP_STRING(
926a4a4261fSmrg  [--enable-silent-rules],
927a4a4261fSmrg  [less verbose build output (undo: "make V=1")])
928a4a4261fSmrgAS_HELP_STRING(
929a4a4261fSmrg  [--disable-silent-rules],
930a4a4261fSmrg  [verbose build output (undo: "make V=0")])dnl
931a4a4261fSmrg])
932a4a4261fSmrgcase $enable_silent_rules in @%:@ (((
933a4a4261fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
934a4a4261fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
935a4a4261fSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936a4a4261fSmrgesac
937a4a4261fSmrgdnl
938a4a4261fSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939a4a4261fSmrgdnl do not support nested variable expansions.
940a4a4261fSmrgdnl See automake bug#9928 and bug#10237.
941a4a4261fSmrgam_make=${MAKE-make}
942a4a4261fSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943a4a4261fSmrg   [am_cv_make_support_nested_variables],
944a4a4261fSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945a4a4261fSmrgBAR0=false
946a4a4261fSmrgBAR1=true
947a4a4261fSmrgV=1
948a4a4261fSmrgam__doit:
949a4a4261fSmrg	@$(TRUE)
950a4a4261fSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951a4a4261fSmrg  am_cv_make_support_nested_variables=yes
9521a669bc9Smrgelse
953a4a4261fSmrg  am_cv_make_support_nested_variables=no
954a4a4261fSmrgfi])
955a4a4261fSmrgif test $am_cv_make_support_nested_variables = yes; then
956a4a4261fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957a4a4261fSmrg  AM_V='$(V)'
958a4a4261fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959a4a4261fSmrgelse
960a4a4261fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
961a4a4261fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962e7c933f3Smrgfi
963a4a4261fSmrgAC_SUBST([AM_V])dnl
964a4a4261fSmrgAM_SUBST_NOTMAKE([AM_V])dnl
965a4a4261fSmrgAC_SUBST([AM_DEFAULT_V])dnl
966a4a4261fSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967a4a4261fSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968a4a4261fSmrgAM_BACKSLASH='\'
969a4a4261fSmrgAC_SUBST([AM_BACKSLASH])dnl
970a4a4261fSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971a4a4261fSmrg])
9721a669bc9Smrg
973a4a4261fSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9741a669bc9Smrg#
975a4a4261fSmrg# This file is free software; the Free Software Foundation
976a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
977a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
9781a669bc9Smrg
979a4a4261fSmrg# AM_PROG_INSTALL_STRIP
980a4a4261fSmrg# ---------------------
981a4a4261fSmrg# One issue with vendor 'install' (even GNU) is that you can't
982a4a4261fSmrg# specify the program used to strip binaries.  This is especially
983a4a4261fSmrg# annoying in cross-compiling environments, where the build's strip
984a4a4261fSmrg# is unlikely to handle the host's binaries.
985a4a4261fSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986a4a4261fSmrg# always use install-sh in "make install-strip", and initialize
987a4a4261fSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
988a4a4261fSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989a4a4261fSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990a4a4261fSmrg# Installed binaries are usually stripped using 'strip' when the user
991a4a4261fSmrg# run "make install-strip".  However 'strip' might not be the right
992a4a4261fSmrg# tool to use in cross-compilation environments, therefore Automake
993a4a4261fSmrg# will honor the 'STRIP' environment variable to overrule this program.
994a4a4261fSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995a4a4261fSmrgif test "$cross_compiling" != no; then
996a4a4261fSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
997e7c933f3Smrgfi
998a4a4261fSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999a4a4261fSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10007bd0f98dSmrg
1001a4a4261fSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10027bd0f98dSmrg#
1003a4a4261fSmrg# This file is free software; the Free Software Foundation
1004a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
1005a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
1006cbeba4aeSmrg
1007a4a4261fSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008a4a4261fSmrg# ---------------------------
1009a4a4261fSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010a4a4261fSmrg# This macro is traced by Automake.
1011a4a4261fSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012cbeba4aeSmrg
1013a4a4261fSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1014a4a4261fSmrg# --------------------------
1015a4a4261fSmrg# Public sister of _AM_SUBST_NOTMAKE.
1016a4a4261fSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017cbeba4aeSmrg
1018a4a4261fSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1019cbeba4aeSmrg
1020a4a4261fSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021e7c933f3Smrg#
1022a4a4261fSmrg# This file is free software; the Free Software Foundation
1023a4a4261fSmrg# gives unlimited permission to copy and/or distribute it,
1024a4a4261fSmrg# with or without modifications, as long as this notice is preserved.
1025a4a4261fSmrg
1026a4a4261fSmrg# _AM_PROG_TAR(FORMAT)
1027a4a4261fSmrg# --------------------
1028a4a4261fSmrg# Check how to create a tarball in format FORMAT.
1029a4a4261fSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030e7c933f3Smrg#
1031a4a4261fSmrg# Substitute a variable $(am__tar) that is a command
1032a4a4261fSmrg# writing to stdout a FORMAT-tarball containing the directory
1033a4a4261fSmrg# $tardir.
1034a4a4261fSmrg#     tardir=directory && $(am__tar) > result.tar
1035e7c933f3Smrg#
1036a4a4261fSmrg# Substitute a variable $(am__untar) that extract such
1037a4a4261fSmrg# a tarball read from stdin.
1038a4a4261fSmrg#     $(am__untar) < result.tar
1039e7c933f3Smrg#
1040a4a4261fSmrgAC_DEFUN([_AM_PROG_TAR],
1041a4a4261fSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042a4a4261fSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1043a4a4261fSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044cbeba4aeSmrg
1045a4a4261fSmrg# We'll loop over all known methods to create a tar archive until one works.
1046a4a4261fSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047cbeba4aeSmrg
1048a4a4261fSmrgm4_if([$1], [v7],
1049a4a4261fSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050cbeba4aeSmrg
1051a4a4261fSmrg  [m4_case([$1],
1052a4a4261fSmrg    [ustar],
1053a4a4261fSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054a4a4261fSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055a4a4261fSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056a4a4261fSmrg      # and bug#13588).
1057a4a4261fSmrg      am_max_uid=2097151 # 2^21 - 1
1058a4a4261fSmrg      am_max_gid=$am_max_uid
1059a4a4261fSmrg      # The $UID and $GID variables are not portable, so we need to resort
1060a4a4261fSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061a4a4261fSmrg      # below are definitely unexpected, so allow the users to see them
1062a4a4261fSmrg      # (that is, avoid stderr redirection).
1063a4a4261fSmrg      am_uid=`id -u || echo unknown`
1064a4a4261fSmrg      am_gid=`id -g || echo unknown`
1065a4a4261fSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066a4a4261fSmrg      if test $am_uid -le $am_max_uid; then
1067a4a4261fSmrg         AC_MSG_RESULT([yes])
1068a4a4261fSmrg      else
1069a4a4261fSmrg         AC_MSG_RESULT([no])
1070a4a4261fSmrg         _am_tools=none
1071a4a4261fSmrg      fi
1072a4a4261fSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073a4a4261fSmrg      if test $am_gid -le $am_max_gid; then
1074a4a4261fSmrg         AC_MSG_RESULT([yes])
1075a4a4261fSmrg      else
1076a4a4261fSmrg        AC_MSG_RESULT([no])
1077a4a4261fSmrg        _am_tools=none
1078a4a4261fSmrg      fi],
10791a669bc9Smrg
1080a4a4261fSmrg  [pax],
1081a4a4261fSmrg    [],
1082cbeba4aeSmrg
1083a4a4261fSmrg  [m4_fatal([Unknown tar format])])
1084e7c933f3Smrg
1085a4a4261fSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086cbeba4aeSmrg
1087a4a4261fSmrg  # Go ahead even if we have the value already cached.  We do so because we
1088a4a4261fSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089a4a4261fSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090cbeba4aeSmrg
1091a4a4261fSmrg  for _am_tool in $_am_tools; do
1092a4a4261fSmrg    case $_am_tool in
1093a4a4261fSmrg    gnutar)
1094a4a4261fSmrg      for _am_tar in tar gnutar gtar; do
1095a4a4261fSmrg        AM_RUN_LOG([$_am_tar --version]) && break
1096a4a4261fSmrg      done
1097a4a4261fSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098a4a4261fSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099a4a4261fSmrg      am__untar="$_am_tar -xf -"
1100a4a4261fSmrg      ;;
1101a4a4261fSmrg    plaintar)
1102a4a4261fSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103a4a4261fSmrg      # ustar tarball either.
1104a4a4261fSmrg      (tar --version) >/dev/null 2>&1 && continue
1105a4a4261fSmrg      am__tar='tar chf - "$$tardir"'
1106a4a4261fSmrg      am__tar_='tar chf - "$tardir"'
1107a4a4261fSmrg      am__untar='tar xf -'
1108a4a4261fSmrg      ;;
1109a4a4261fSmrg    pax)
1110a4a4261fSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111a4a4261fSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112a4a4261fSmrg      am__untar='pax -r'
1113a4a4261fSmrg      ;;
1114a4a4261fSmrg    cpio)
1115a4a4261fSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116a4a4261fSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117a4a4261fSmrg      am__untar='cpio -i -H $1 -d'
1118a4a4261fSmrg      ;;
1119a4a4261fSmrg    none)
1120a4a4261fSmrg      am__tar=false
1121a4a4261fSmrg      am__tar_=false
1122a4a4261fSmrg      am__untar=false
1123a4a4261fSmrg      ;;
1124a4a4261fSmrg    esac
11251a669bc9Smrg
1126a4a4261fSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127a4a4261fSmrg    # and am__untar set.
1128a4a4261fSmrg    test -n "${am_cv_prog_tar_$1}" && break
11291a669bc9Smrg
1130a4a4261fSmrg    # tar/untar a dummy directory, and stop if the command works.
1131a4a4261fSmrg    rm -rf conftest.dir
1132a4a4261fSmrg    mkdir conftest.dir
1133a4a4261fSmrg    echo GrepMe > conftest.dir/file
1134a4a4261fSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135a4a4261fSmrg    rm -rf conftest.dir
1136a4a4261fSmrg    if test -s conftest.tar; then
1137a4a4261fSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138a4a4261fSmrg      AM_RUN_LOG([cat conftest.dir/file])
1139a4a4261fSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140a4a4261fSmrg    fi
1141a4a4261fSmrg  done
1142a4a4261fSmrg  rm -rf conftest.dir
11431a669bc9Smrg
1144a4a4261fSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145a4a4261fSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11461a669bc9Smrg
1147a4a4261fSmrgAC_SUBST([am__tar])
1148a4a4261fSmrgAC_SUBST([am__untar])
1149a4a4261fSmrg]) # _AM_PROG_TAR
11501a669bc9Smrg
1151a4a4261fSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152a4a4261fSmrgdnl serial 11 (pkg-config-0.29)
1153a4a4261fSmrgdnl
1154a4a4261fSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155a4a4261fSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156a4a4261fSmrgdnl
1157a4a4261fSmrgdnl This program is free software; you can redistribute it and/or modify
1158a4a4261fSmrgdnl it under the terms of the GNU General Public License as published by
1159a4a4261fSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160a4a4261fSmrgdnl (at your option) any later version.
1161a4a4261fSmrgdnl
1162a4a4261fSmrgdnl This program is distributed in the hope that it will be useful, but
1163a4a4261fSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164a4a4261fSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165a4a4261fSmrgdnl General Public License for more details.
1166a4a4261fSmrgdnl
1167a4a4261fSmrgdnl You should have received a copy of the GNU General Public License
1168a4a4261fSmrgdnl along with this program; if not, write to the Free Software
1169a4a4261fSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170a4a4261fSmrgdnl 02111-1307, USA.
1171a4a4261fSmrgdnl
1172a4a4261fSmrgdnl As a special exception to the GNU General Public License, if you
1173a4a4261fSmrgdnl distribute this file as part of a program that contains a
1174a4a4261fSmrgdnl configuration script generated by Autoconf, you may include it under
1175a4a4261fSmrgdnl the same distribution terms that you use for the rest of that
1176a4a4261fSmrgdnl program.
11771a669bc9Smrg
1178a4a4261fSmrgdnl PKG_PREREQ(MIN-VERSION)
1179a4a4261fSmrgdnl -----------------------
1180a4a4261fSmrgdnl Since: 0.29
1181a4a4261fSmrgdnl
1182a4a4261fSmrgdnl Verify that the version of the pkg-config macros are at least
1183a4a4261fSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184a4a4261fSmrgdnl installed version of pkg-config, this checks the developer's version
1185a4a4261fSmrgdnl of pkg.m4 when generating configure.
1186a4a4261fSmrgdnl
1187a4a4261fSmrgdnl To ensure that this macro is defined, also add:
1188a4a4261fSmrgdnl m4_ifndef([PKG_PREREQ],
1189a4a4261fSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190a4a4261fSmrgdnl
1191a4a4261fSmrgdnl See the "Since" comment for each macro you use to see what version
1192a4a4261fSmrgdnl of the macros you require.
1193a4a4261fSmrgm4_defun([PKG_PREREQ],
1194a4a4261fSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195a4a4261fSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196a4a4261fSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197a4a4261fSmrg])dnl PKG_PREREQ
11981a669bc9Smrg
1199a4a4261fSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200a4a4261fSmrgdnl ----------------------------------
1201a4a4261fSmrgdnl Since: 0.16
1202a4a4261fSmrgdnl
1203a4a4261fSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204a4a4261fSmrgdnl first found in the path. Checks that the version of pkg-config found
1205a4a4261fSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206a4a4261fSmrgdnl used since that's the first version where most current features of
1207a4a4261fSmrgdnl pkg-config existed.
1208a4a4261fSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209a4a4261fSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210a4a4261fSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211a4a4261fSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212a4a4261fSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213a4a4261fSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214a4a4261fSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12151a669bc9Smrg
1216a4a4261fSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217a4a4261fSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12181a669bc9Smrgfi
1219a4a4261fSmrgif test -n "$PKG_CONFIG"; then
1220a4a4261fSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221a4a4261fSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222a4a4261fSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223a4a4261fSmrg		AC_MSG_RESULT([yes])
1224a4a4261fSmrg	else
1225a4a4261fSmrg		AC_MSG_RESULT([no])
1226a4a4261fSmrg		PKG_CONFIG=""
1227a4a4261fSmrg	fi
1228a4a4261fSmrgfi[]dnl
1229a4a4261fSmrg])dnl PKG_PROG_PKG_CONFIG
12301a669bc9Smrg
1231a4a4261fSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232a4a4261fSmrgdnl -------------------------------------------------------------------
1233a4a4261fSmrgdnl Since: 0.18
1234a4a4261fSmrgdnl
1235a4a4261fSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236a4a4261fSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237a4a4261fSmrgdnl
1238a4a4261fSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239a4a4261fSmrgdnl only at the first occurence in configure.ac, so if the first place
1240a4a4261fSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241a4a4261fSmrgdnl have to call PKG_CHECK_EXISTS manually
1242a4a4261fSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243a4a4261fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244a4a4261fSmrgif test -n "$PKG_CONFIG" && \
1245a4a4261fSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246a4a4261fSmrg  m4_default([$2], [:])
1247a4a4261fSmrgm4_ifvaln([$3], [else
1248a4a4261fSmrg  $3])dnl
1249a4a4261fSmrgfi])
1250a4a4261fSmrg
1251a4a4261fSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252a4a4261fSmrgdnl ---------------------------------------------
1253a4a4261fSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254a4a4261fSmrgdnl pkg_failed based on the result.
1255a4a4261fSmrgm4_define([_PKG_CONFIG],
1256a4a4261fSmrg[if test -n "$$1"; then
1257a4a4261fSmrg    pkg_cv_[]$1="$$1"
1258a4a4261fSmrg elif test -n "$PKG_CONFIG"; then
1259a4a4261fSmrg    PKG_CHECK_EXISTS([$3],
1260a4a4261fSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261a4a4261fSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262a4a4261fSmrg		     [pkg_failed=yes])
1263a4a4261fSmrg else
1264a4a4261fSmrg    pkg_failed=untried
1265a4a4261fSmrgfi[]dnl
1266a4a4261fSmrg])dnl _PKG_CONFIG
1267a4a4261fSmrg
1268a4a4261fSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269a4a4261fSmrgdnl ---------------------------
1270a4a4261fSmrgdnl Internal check to see if pkg-config supports short errors.
1271a4a4261fSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272a4a4261fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273a4a4261fSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274a4a4261fSmrg        _pkg_short_errors_supported=yes
1275e7c933f3Smrgelse
1276a4a4261fSmrg        _pkg_short_errors_supported=no
1277a4a4261fSmrgfi[]dnl
1278a4a4261fSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12791a669bc9Smrg
12801a669bc9Smrg
1281a4a4261fSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282a4a4261fSmrgdnl   [ACTION-IF-NOT-FOUND])
1283a4a4261fSmrgdnl --------------------------------------------------------------
1284a4a4261fSmrgdnl Since: 0.4.0
1285a4a4261fSmrgdnl
1286a4a4261fSmrgdnl Note that if there is a possibility the first call to
1287a4a4261fSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288a4a4261fSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289a4a4261fSmrgAC_DEFUN([PKG_CHECK_MODULES],
1290a4a4261fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291a4a4261fSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292a4a4261fSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293e7c933f3Smrg
1294a4a4261fSmrgpkg_failed=no
1295a4a4261fSmrgAC_MSG_CHECKING([for $1])
1296e7c933f3Smrg
1297a4a4261fSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298a4a4261fSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299e7c933f3Smrg
1300a4a4261fSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301a4a4261fSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1302a4a4261fSmrgSee the pkg-config man page for more details.])
1303e7c933f3Smrg
1304a4a4261fSmrgif test $pkg_failed = yes; then
1305a4a4261fSmrg   	AC_MSG_RESULT([no])
1306a4a4261fSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1307a4a4261fSmrg        if test $_pkg_short_errors_supported = yes; then
1308a4a4261fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309a4a4261fSmrg        else 
1310a4a4261fSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311a4a4261fSmrg        fi
1312a4a4261fSmrg	# Put the nasty error message in config.log where it belongs
1313a4a4261fSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314e7c933f3Smrg
1315a4a4261fSmrg	m4_default([$4], [AC_MSG_ERROR(
1316a4a4261fSmrg[Package requirements ($2) were not met:
1317e7c933f3Smrg
1318a4a4261fSmrg$$1_PKG_ERRORS
1319a4a4261fSmrg
1320a4a4261fSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321a4a4261fSmrginstalled software in a non-standard prefix.
1322a4a4261fSmrg
1323a4a4261fSmrg_PKG_TEXT])[]dnl
1324a4a4261fSmrg        ])
1325a4a4261fSmrgelif test $pkg_failed = untried; then
1326a4a4261fSmrg     	AC_MSG_RESULT([no])
1327a4a4261fSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328a4a4261fSmrg[The pkg-config script could not be found or is too old.  Make sure it
1329a4a4261fSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330a4a4261fSmrgpath to pkg-config.
1331a4a4261fSmrg
1332a4a4261fSmrg_PKG_TEXT
1333a4a4261fSmrg
1334a4a4261fSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335a4a4261fSmrg        ])
1336e7c933f3Smrgelse
1337a4a4261fSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338a4a4261fSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339a4a4261fSmrg        AC_MSG_RESULT([yes])
1340a4a4261fSmrg	$3
1341a4a4261fSmrgfi[]dnl
1342a4a4261fSmrg])dnl PKG_CHECK_MODULES
1343e7c933f3Smrg
1344e7c933f3Smrg
1345a4a4261fSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346a4a4261fSmrgdnl   [ACTION-IF-NOT-FOUND])
1347a4a4261fSmrgdnl ---------------------------------------------------------------------
1348a4a4261fSmrgdnl Since: 0.29
1349a4a4261fSmrgdnl
1350a4a4261fSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351a4a4261fSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352a4a4261fSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353a4a4261fSmrgdnl
1354a4a4261fSmrgdnl Note that if there is a possibility the first call to
1355a4a4261fSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356a4a4261fSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357a4a4261fSmrgdnl configure.ac.
1358a4a4261fSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359a4a4261fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360a4a4261fSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361a4a4261fSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362a4a4261fSmrgPKG_CHECK_MODULES($@)
1363a4a4261fSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364a4a4261fSmrg])dnl PKG_CHECK_MODULES_STATIC
13651a669bc9Smrg
13661a669bc9Smrg
1367a4a4261fSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368a4a4261fSmrgdnl -------------------------
1369a4a4261fSmrgdnl Since: 0.27
1370a4a4261fSmrgdnl
1371a4a4261fSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372a4a4261fSmrgdnl should install pkg-config .pc files. By default the directory is
1373a4a4261fSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374a4a4261fSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375a4a4261fSmrgdnl parameter.
1376a4a4261fSmrgAC_DEFUN([PKG_INSTALLDIR],
1377a4a4261fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378a4a4261fSmrgm4_pushdef([pkg_description],
1379a4a4261fSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380a4a4261fSmrgAC_ARG_WITH([pkgconfigdir],
1381a4a4261fSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382a4a4261fSmrg    [with_pkgconfigdir=]pkg_default)
1383a4a4261fSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384a4a4261fSmrgm4_popdef([pkg_default])
1385a4a4261fSmrgm4_popdef([pkg_description])
1386a4a4261fSmrg])dnl PKG_INSTALLDIR
1387a4a4261fSmrg
1388a4a4261fSmrg
1389a4a4261fSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390a4a4261fSmrgdnl --------------------------------
1391a4a4261fSmrgdnl Since: 0.27
1392a4a4261fSmrgdnl
1393a4a4261fSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394a4a4261fSmrgdnl module should install arch-independent pkg-config .pc files. By
1395a4a4261fSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396a4a4261fSmrgdnl changed by passing DIRECTORY. The user can override through the
1397a4a4261fSmrgdnl --with-noarch-pkgconfigdir parameter.
1398a4a4261fSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399a4a4261fSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400a4a4261fSmrgm4_pushdef([pkg_description],
1401a4a4261fSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402a4a4261fSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403a4a4261fSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404a4a4261fSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405a4a4261fSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406a4a4261fSmrgm4_popdef([pkg_default])
1407a4a4261fSmrgm4_popdef([pkg_description])
1408a4a4261fSmrg])dnl PKG_NOARCH_INSTALLDIR
1409a4a4261fSmrg
14101a669bc9Smrg
1411a4a4261fSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412a4a4261fSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413a4a4261fSmrgdnl -------------------------------------------
1414a4a4261fSmrgdnl Since: 0.28
1415a4a4261fSmrgdnl
1416a4a4261fSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417a4a4261fSmrgAC_DEFUN([PKG_CHECK_VAR],
1418a4a4261fSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419a4a4261fSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14201a669bc9Smrg
1421a4a4261fSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422a4a4261fSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14231a669bc9Smrg
1424a4a4261fSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425a4a4261fSmrg])dnl PKG_CHECK_VAR
14261a669bc9Smrg
1427a4a4261fSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428a4a4261fSmrgdnl
1429b0d3a7b0Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430a4a4261fSmrgdnl
1431a4a4261fSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432a4a4261fSmrgdnl copy of this software and associated documentation files (the "Software"),
1433a4a4261fSmrgdnl to deal in the Software without restriction, including without limitation
1434a4a4261fSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435a4a4261fSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436a4a4261fSmrgdnl Software is furnished to do so, subject to the following conditions:
1437a4a4261fSmrgdnl
1438a4a4261fSmrgdnl The above copyright notice and this permission notice (including the next
1439a4a4261fSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1440a4a4261fSmrgdnl Software.
1441a4a4261fSmrgdnl
1442a4a4261fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443a4a4261fSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444a4a4261fSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445a4a4261fSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446a4a4261fSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447a4a4261fSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448a4a4261fSmrgdnl DEALINGS IN THE SOFTWARE.
1449e7c933f3Smrg
1450a4a4261fSmrg# XORG_MACROS_VERSION(required-version)
1451a4a4261fSmrg# -------------------------------------
1452e7c933f3Smrg# Minimum version: 1.1.0
14531a669bc9Smrg#
1454a4a4261fSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1455a4a4261fSmrg# your configure.ac with the minimum required version, such as:
1456a4a4261fSmrg# XORG_MACROS_VERSION(1.1)
14571a669bc9Smrg#
1458a4a4261fSmrg# To ensure that this macro is defined, also add:
1459a4a4261fSmrg# m4_ifndef([XORG_MACROS_VERSION],
1460a4a4261fSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14611a669bc9Smrg#
1462a4a4261fSmrg#
1463a4a4261fSmrg# See the "minimum version" comment for each macro you use to see what
1464a4a4261fSmrg# version you require.
1465a4a4261fSmrgm4_defun([XORG_MACROS_VERSION],[
1466b0d3a7b0Smrgm4_define([vers_have], [1.20.0])
1467a4a4261fSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468a4a4261fSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469a4a4261fSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470a4a4261fSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471a4a4261fSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472a4a4261fSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473a4a4261fSmrgm4_undefine([vers_have])
1474a4a4261fSmrgm4_undefine([maj_have])
1475a4a4261fSmrgm4_undefine([maj_needed])
1476a4a4261fSmrg]) # XORG_MACROS_VERSION
1477e7c933f3Smrg
1478a4a4261fSmrg# XORG_PROG_RAWCPP()
1479a4a4261fSmrg# ------------------
1480a4a4261fSmrg# Minimum version: 1.0.0
1481a4a4261fSmrg#
1482a4a4261fSmrg# Find cpp program and necessary flags for use in pre-processing text files
1483a4a4261fSmrg# such as man pages and config files
1484a4a4261fSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485a4a4261fSmrgAC_REQUIRE([AC_PROG_CPP])
1486a4a4261fSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487a4a4261fSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488e7c933f3Smrg
1489a4a4261fSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490a4a4261fSmrg# which is not the best choice for supporting other OS'es, but covers most
1491a4a4261fSmrg# of the ones we need for now.
1492a4a4261fSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493a4a4261fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494a4a4261fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495a4a4261fSmrg	AC_MSG_RESULT([no])
1496a4a4261fSmrgelse
1497a4a4261fSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498a4a4261fSmrg		RAWCPPFLAGS=-undef
1499a4a4261fSmrg		AC_MSG_RESULT([yes])
1500a4a4261fSmrg	# under Cygwin unix is still defined even with -undef
1501a4a4261fSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502a4a4261fSmrg		RAWCPPFLAGS="-undef -ansi"
1503a4a4261fSmrg		AC_MSG_RESULT([yes, with -ansi])
1504a4a4261fSmrg	else
1505a4a4261fSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506a4a4261fSmrg	fi
15071a669bc9Smrgfi
1508a4a4261fSmrgrm -f conftest.$ac_ext
15091a669bc9Smrg
1510a4a4261fSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511a4a4261fSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512b0d3a7b0Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513a4a4261fSmrg	AC_MSG_RESULT([no])
1514a4a4261fSmrgelse
1515b0d3a7b0Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516a4a4261fSmrg		TRADITIONALCPPFLAGS="-traditional"
1517a4a4261fSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518a4a4261fSmrg		AC_MSG_RESULT([yes])
1519a4a4261fSmrg	else
1520a4a4261fSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521a4a4261fSmrg	fi
1522a4a4261fSmrgfi
1523a4a4261fSmrgrm -f conftest.$ac_ext
1524a4a4261fSmrgAC_SUBST(RAWCPPFLAGS)
1525a4a4261fSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526a4a4261fSmrg]) # XORG_PROG_RAWCPP
1527e7c933f3Smrg
1528a4a4261fSmrg# XORG_MANPAGE_SECTIONS()
1529a4a4261fSmrg# -----------------------
1530a4a4261fSmrg# Minimum version: 1.0.0
15311a669bc9Smrg#
1532a4a4261fSmrg# Determine which sections man pages go in for the different man page types
1533a4a4261fSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534a4a4261fSmrg# Not sure if there's any better way than just hardcoding by OS name.
1535a4a4261fSmrg# Override default settings by setting environment variables
1536a4a4261fSmrg# Added MAN_SUBSTS in version 1.8
1537a4a4261fSmrg# Added AC_PROG_SED in version 1.8
1538e7c933f3Smrg
1539a4a4261fSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540a4a4261fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541a4a4261fSmrgAC_REQUIRE([AC_PROG_SED])
1542e7c933f3Smrg
1543a4a4261fSmrgcase $host_os in
1544a4a4261fSmrg    solaris*)
1545a4a4261fSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546a4a4261fSmrg        # check for a man page file found in later versions that use
1547a4a4261fSmrg        # traditional section numbers instead
1548a4a4261fSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549a4a4261fSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550a4a4261fSmrg        ;;
1551a4a4261fSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552a4a4261fSmrgesac
1553e7c933f3Smrg
1554a4a4261fSmrgif test x$APP_MAN_SUFFIX = x    ; then
1555a4a4261fSmrg    APP_MAN_SUFFIX=1
1556a4a4261fSmrgfi
1557a4a4261fSmrgif test x$APP_MAN_DIR = x    ; then
1558a4a4261fSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559a4a4261fSmrgfi
1560e7c933f3Smrg
1561a4a4261fSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1562a4a4261fSmrg    LIB_MAN_SUFFIX=3
1563a4a4261fSmrgfi
1564a4a4261fSmrgif test x$LIB_MAN_DIR = x    ; then
1565a4a4261fSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566a4a4261fSmrgfi
1567e7c933f3Smrg
1568a4a4261fSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1569a4a4261fSmrg    case $SYSV_MAN_SECTIONS in
1570a4a4261fSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1571a4a4261fSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1572a4a4261fSmrg    esac
1573a4a4261fSmrgfi
1574a4a4261fSmrgif test x$FILE_MAN_DIR = x    ; then
1575a4a4261fSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576e7c933f3Smrgfi
1577e7c933f3Smrg
1578a4a4261fSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1579a4a4261fSmrg    case $SYSV_MAN_SECTIONS in
1580a4a4261fSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1581a4a4261fSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1582a4a4261fSmrg    esac
1583a4a4261fSmrgfi
1584a4a4261fSmrgif test x$MISC_MAN_DIR = x    ; then
1585a4a4261fSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586e7c933f3Smrgfi
1587e7c933f3Smrg
1588a4a4261fSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589a4a4261fSmrg    case $SYSV_MAN_SECTIONS in
1590a4a4261fSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591a4a4261fSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592a4a4261fSmrg    esac
1593a4a4261fSmrgfi
1594a4a4261fSmrgif test x$DRIVER_MAN_DIR = x    ; then
1595a4a4261fSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596a4a4261fSmrgfi
1597e7c933f3Smrg
1598a4a4261fSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599a4a4261fSmrg    case $SYSV_MAN_SECTIONS in
1600a4a4261fSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601a4a4261fSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602a4a4261fSmrg    esac
1603a4a4261fSmrgfi
1604a4a4261fSmrgif test x$ADMIN_MAN_DIR = x    ; then
1605a4a4261fSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606a4a4261fSmrgfi
1607e7c933f3Smrg
1608e7c933f3Smrg
1609a4a4261fSmrgAC_SUBST([APP_MAN_SUFFIX])
1610a4a4261fSmrgAC_SUBST([LIB_MAN_SUFFIX])
1611a4a4261fSmrgAC_SUBST([FILE_MAN_SUFFIX])
1612a4a4261fSmrgAC_SUBST([MISC_MAN_SUFFIX])
1613a4a4261fSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614a4a4261fSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615a4a4261fSmrgAC_SUBST([APP_MAN_DIR])
1616a4a4261fSmrgAC_SUBST([LIB_MAN_DIR])
1617a4a4261fSmrgAC_SUBST([FILE_MAN_DIR])
1618a4a4261fSmrgAC_SUBST([MISC_MAN_DIR])
1619a4a4261fSmrgAC_SUBST([DRIVER_MAN_DIR])
1620a4a4261fSmrgAC_SUBST([ADMIN_MAN_DIR])
1621e7c933f3Smrg
1622a4a4261fSmrgXORG_MAN_PAGE="X Version 11"
1623a4a4261fSmrgAC_SUBST([XORG_MAN_PAGE])
1624a4a4261fSmrgMAN_SUBSTS="\
1625a4a4261fSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626a4a4261fSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627a4a4261fSmrg	-e 's|__xservername__|Xorg|g' \
1628a4a4261fSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629a4a4261fSmrg	-e 's|__projectroot__|\$(prefix)|g' \
1630a4a4261fSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631a4a4261fSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632a4a4261fSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633a4a4261fSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634a4a4261fSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635a4a4261fSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636a4a4261fSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637a4a4261fSmrgAC_SUBST([MAN_SUBSTS])
1638e7c933f3Smrg
1639a4a4261fSmrg]) # XORG_MANPAGE_SECTIONS
1640e7c933f3Smrg
1641a4a4261fSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642a4a4261fSmrg# ------------------------
1643a4a4261fSmrg# Minimum version: 1.7.0
16441a669bc9Smrg#
1645a4a4261fSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646a4a4261fSmrg# provided by xorg-sgml-doctools, if installed.
1647a4a4261fSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648a4a4261fSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649a4a4261fSmrgXORG_SGML_PATH=
1650a4a4261fSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651a4a4261fSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652a4a4261fSmrg    [m4_ifval([$1],[:],
1653a4a4261fSmrg        [if test x"$cross_compiling" != x"yes" ; then
1654a4a4261fSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655a4a4261fSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656a4a4261fSmrg         fi])
1657a4a4261fSmrg    ])
1658a4a4261fSmrg
1659a4a4261fSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660a4a4261fSmrg# the path and the name of the doc stylesheet
1661a4a4261fSmrgif test "x$XORG_SGML_PATH" != "x" ; then
1662a4a4261fSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663a4a4261fSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664a4a4261fSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665a4a4261fSmrgelse
1666a4a4261fSmrg   AC_MSG_RESULT([no])
1667a4a4261fSmrgfi
1668a4a4261fSmrg
1669a4a4261fSmrgAC_SUBST(XORG_SGML_PATH)
1670a4a4261fSmrgAC_SUBST(STYLESHEET_SRCDIR)
1671a4a4261fSmrgAC_SUBST(XSL_STYLESHEET)
1672a4a4261fSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673a4a4261fSmrg]) # XORG_CHECK_SGML_DOCTOOLS
1674a4a4261fSmrg
1675a4a4261fSmrg# XORG_CHECK_LINUXDOC
1676a4a4261fSmrg# -------------------
1677a4a4261fSmrg# Minimum version: 1.0.0
16781a669bc9Smrg#
1679a4a4261fSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1680a4a4261fSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681a4a4261fSmrg# Whether or not the necessary tools and files are found can be checked
1682a4a4261fSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683a4a4261fSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684a4a4261fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685a4a4261fSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686e7c933f3Smrg
1687a4a4261fSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688e7c933f3Smrg
1689a4a4261fSmrgAC_MSG_CHECKING([whether to build documentation])
1690a4a4261fSmrg
1691a4a4261fSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692a4a4261fSmrg   BUILDDOC=yes
1693e7c933f3Smrgelse
1694a4a4261fSmrg   BUILDDOC=no
1695e7c933f3Smrgfi
1696e7c933f3Smrg
1697a4a4261fSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698e7c933f3Smrg
1699a4a4261fSmrgAC_MSG_RESULT([$BUILDDOC])
1700e7c933f3Smrg
1701a4a4261fSmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702a4a4261fSmrg
1703a4a4261fSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704a4a4261fSmrg   BUILDPDFDOC=yes
1705a4a4261fSmrgelse
1706a4a4261fSmrg   BUILDPDFDOC=no
1707a4a4261fSmrgfi
1708a4a4261fSmrg
1709a4a4261fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710a4a4261fSmrg
1711a4a4261fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712a4a4261fSmrg
1713a4a4261fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714a4a4261fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715a4a4261fSmrgMAKE_PDF="$PS2PDF"
1716a4a4261fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717a4a4261fSmrg
1718a4a4261fSmrgAC_SUBST(MAKE_TEXT)
1719a4a4261fSmrgAC_SUBST(MAKE_PS)
1720a4a4261fSmrgAC_SUBST(MAKE_PDF)
1721a4a4261fSmrgAC_SUBST(MAKE_HTML)
1722a4a4261fSmrg]) # XORG_CHECK_LINUXDOC
1723a4a4261fSmrg
1724a4a4261fSmrg# XORG_CHECK_DOCBOOK
1725a4a4261fSmrg# -------------------
1726a4a4261fSmrg# Minimum version: 1.0.0
1727a4a4261fSmrg#
1728a4a4261fSmrg# Checks for the ability to build output formats from SGML DocBook source.
1729a4a4261fSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730a4a4261fSmrg# indicates whether the necessary tools and files are found and, if set,
1731a4a4261fSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732a4a4261fSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733a4a4261fSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734a4a4261fSmrg
1735a4a4261fSmrgBUILDTXTDOC=no
1736a4a4261fSmrgBUILDPDFDOC=no
1737a4a4261fSmrgBUILDPSDOC=no
1738a4a4261fSmrgBUILDHTMLDOC=no
1739a4a4261fSmrg
1740a4a4261fSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741a4a4261fSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742a4a4261fSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743a4a4261fSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744e7c933f3Smrg
1745a4a4261fSmrgAC_MSG_CHECKING([whether to build text documentation])
1746a4a4261fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747a4a4261fSmrg   test x$BUILD_TXTDOC != xno; then
1748a4a4261fSmrg	BUILDTXTDOC=yes
1749a4a4261fSmrgfi
1750a4a4261fSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751a4a4261fSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752e7c933f3Smrg
1753a4a4261fSmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754a4a4261fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755a4a4261fSmrg   test x$BUILD_PDFDOC != xno; then
1756a4a4261fSmrg	BUILDPDFDOC=yes
1757a4a4261fSmrgfi
1758a4a4261fSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759a4a4261fSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760e7c933f3Smrg
1761a4a4261fSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762a4a4261fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763a4a4261fSmrg   test x$BUILD_PSDOC != xno; then
1764a4a4261fSmrg	BUILDPSDOC=yes
1765e7c933f3Smrgfi
1766a4a4261fSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767a4a4261fSmrgAC_MSG_RESULT([$BUILDPSDOC])
1768e7c933f3Smrg
1769a4a4261fSmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770a4a4261fSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771a4a4261fSmrg   test x$BUILD_HTMLDOC != xno; then
1772a4a4261fSmrg	BUILDHTMLDOC=yes
1773a4a4261fSmrgfi
1774a4a4261fSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775a4a4261fSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776e7c933f3Smrg
1777a4a4261fSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778a4a4261fSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779a4a4261fSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780a4a4261fSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781a4a4261fSmrg
1782a4a4261fSmrgAC_SUBST(MAKE_TEXT)
1783a4a4261fSmrgAC_SUBST(MAKE_PS)
1784a4a4261fSmrgAC_SUBST(MAKE_PDF)
1785a4a4261fSmrgAC_SUBST(MAKE_HTML)
1786a4a4261fSmrg]) # XORG_CHECK_DOCBOOK
1787a4a4261fSmrg
1788a4a4261fSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789a4a4261fSmrg# ----------------
1790a4a4261fSmrg# Minimum version: 1.5.0
1791a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17921a669bc9Smrg#
1793a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
1794a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
1795a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796b0d3a7b0Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797a4a4261fSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798a4a4261fSmrg# --with-xmlto assumes 'auto'.
17991a669bc9Smrg#
1800a4a4261fSmrg# Interface to module:
1801a4a4261fSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802a4a4261fSmrg# XMLTO:	returns the path of the xmlto program found
1803a4a4261fSmrg#		returns the path set by the user in the environment
1804a4a4261fSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805a4a4261fSmrg#		'no' user instructs the module not to use xmlto
18061a669bc9Smrg#
1807a4a4261fSmrg# Added in version 1.10.0
1808a4a4261fSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809a4a4261fSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810e7c933f3Smrg#
1811a4a4261fSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812e7c933f3Smrg#
1813a4a4261fSmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814a4a4261fSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
1816a4a4261fSmrgAC_ARG_WITH(xmlto,
1817a4a4261fSmrg	AS_HELP_STRING([--with-xmlto],
1818a4a4261fSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819a4a4261fSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820a4a4261fSmrgm4_undefine([_defopt])
1821e7c933f3Smrg
1822a4a4261fSmrgif test "x$use_xmlto" = x"auto"; then
1823a4a4261fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1824a4a4261fSmrg   if test "x$XMLTO" = "x"; then
1825a4a4261fSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826a4a4261fSmrg	have_xmlto=no
1827a4a4261fSmrg   else
1828a4a4261fSmrg        have_xmlto=yes
1829a4a4261fSmrg   fi
1830a4a4261fSmrgelif test "x$use_xmlto" = x"yes" ; then
1831a4a4261fSmrg   AC_PATH_PROG([XMLTO], [xmlto])
1832a4a4261fSmrg   if test "x$XMLTO" = "x"; then
1833a4a4261fSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834a4a4261fSmrg   fi
1835a4a4261fSmrg   have_xmlto=yes
1836a4a4261fSmrgelif test "x$use_xmlto" = x"no" ; then
1837a4a4261fSmrg   if test "x$XMLTO" != "x"; then
1838a4a4261fSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839a4a4261fSmrg   fi
1840a4a4261fSmrg   have_xmlto=no
1841a4a4261fSmrgelse
1842a4a4261fSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843a4a4261fSmrgfi
1844e7c933f3Smrg
1845a4a4261fSmrg# Test for a minimum version of xmlto, if provided.
1846a4a4261fSmrgm4_ifval([$1],
1847a4a4261fSmrg[if test "$have_xmlto" = yes; then
1848a4a4261fSmrg    # scrape the xmlto version
1849a4a4261fSmrg    AC_MSG_CHECKING([the xmlto version])
1850a4a4261fSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851a4a4261fSmrg    AC_MSG_RESULT([$xmlto_version])
1852a4a4261fSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853a4a4261fSmrg        [if test "x$use_xmlto" = xauto; then
1854a4a4261fSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855a4a4261fSmrg            have_xmlto=no
1856a4a4261fSmrg        else
1857a4a4261fSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858a4a4261fSmrg        fi])
1859a4a4261fSmrgfi])
1860e7c933f3Smrg
1861a4a4261fSmrg# Test for the ability of xmlto to generate a text target
1862a4a4261fSmrg#
1863a4a4261fSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864a4a4261fSmrg# following test for empty XML docbook files.
1865a4a4261fSmrg# For compatibility reasons use the following empty XML docbook file and if
1866a4a4261fSmrg# it fails try it again with a non-empty XML file.
1867a4a4261fSmrghave_xmlto_text=no
1868a4a4261fSmrgcat > conftest.xml << "EOF"
1869a4a4261fSmrgEOF
1870a4a4261fSmrgAS_IF([test "$have_xmlto" = yes],
1871a4a4261fSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872a4a4261fSmrg             [have_xmlto_text=yes],
1873a4a4261fSmrg             [# Try it again with a non-empty XML file.
1874a4a4261fSmrg              cat > conftest.xml << "EOF"
1875a4a4261fSmrg<x></x>
1876a4a4261fSmrgEOF
1877a4a4261fSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878a4a4261fSmrg                    [have_xmlto_text=yes],
1879a4a4261fSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880a4a4261fSmrgrm -f conftest.xml
1881a4a4261fSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882a4a4261fSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883a4a4261fSmrg]) # XORG_WITH_XMLTO
1884e7c933f3Smrg
1885a4a4261fSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886a4a4261fSmrg# --------------------------------------------
1887a4a4261fSmrg# Minimum version: 1.12.0
1888a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1889a4a4261fSmrg#
1890a4a4261fSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891a4a4261fSmrg# XML-based language used for the transformation of XML documents.
1892a4a4261fSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893a4a4261fSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894a4a4261fSmrg# The XSLT processor is often used as a standalone tool for transformations.
1895a4a4261fSmrg# It should not be assumed that this tool is used only to work with documnetation.
1896a4a4261fSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897a4a4261fSmrg#
1898a4a4261fSmrg# Interface to module:
1899a4a4261fSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900a4a4261fSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1901a4a4261fSmrg#		 returns the path set by the user in the environment
1902a4a4261fSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903a4a4261fSmrg#		  'no' user instructs the module not to use xsltproc
1904a4a4261fSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905a4a4261fSmrg#
1906a4a4261fSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907a4a4261fSmrg#
1908a4a4261fSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909a4a4261fSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910a4a4261fSmrg# Preserves the interface, should it be implemented later
1911a4a4261fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
1913a4a4261fSmrgAC_ARG_WITH(xsltproc,
1914a4a4261fSmrg	AS_HELP_STRING([--with-xsltproc],
1915a4a4261fSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916a4a4261fSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917a4a4261fSmrgm4_undefine([_defopt])
1918e7c933f3Smrg
1919a4a4261fSmrgif test "x$use_xsltproc" = x"auto"; then
1920a4a4261fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921a4a4261fSmrg   if test "x$XSLTPROC" = "x"; then
1922a4a4261fSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923a4a4261fSmrg	have_xsltproc=no
1924a4a4261fSmrg   else
1925a4a4261fSmrg        have_xsltproc=yes
1926a4a4261fSmrg   fi
1927a4a4261fSmrgelif test "x$use_xsltproc" = x"yes" ; then
1928a4a4261fSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929a4a4261fSmrg   if test "x$XSLTPROC" = "x"; then
1930a4a4261fSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931a4a4261fSmrg   fi
1932a4a4261fSmrg   have_xsltproc=yes
1933a4a4261fSmrgelif test "x$use_xsltproc" = x"no" ; then
1934a4a4261fSmrg   if test "x$XSLTPROC" != "x"; then
1935a4a4261fSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936a4a4261fSmrg   fi
1937a4a4261fSmrg   have_xsltproc=no
1938a4a4261fSmrgelse
1939a4a4261fSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19401a669bc9Smrgfi
1941e7c933f3Smrg
1942a4a4261fSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943a4a4261fSmrg]) # XORG_WITH_XSLTPROC
1944a4a4261fSmrg
1945a4a4261fSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946a4a4261fSmrg# ----------------------------------------
1947a4a4261fSmrg# Minimum version: 1.15.0
1948e7c933f3Smrg#
1949a4a4261fSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950a4a4261fSmrg# scanning arbitrary text files, extracting information from those text files,
1951a4a4261fSmrg# and printing reports based on that information.
1952e7c933f3Smrg#
1953a4a4261fSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954e7c933f3Smrg#
1955a4a4261fSmrg# Interface to module:
1956a4a4261fSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957a4a4261fSmrg# PERL:	     returns the path of the perl program found
1958a4a4261fSmrg#	     returns the path set by the user in the environment
1959a4a4261fSmrg# --with-perl: 'yes' user instructs the module to use perl
1960a4a4261fSmrg#	       'no' user instructs the module not to use perl
1961a4a4261fSmrg# have_perl: returns yes if perl found in PATH or no
1962e7c933f3Smrg#
1963a4a4261fSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964a4a4261fSmrg#
1965a4a4261fSmrgAC_DEFUN([XORG_WITH_PERL],[
1966a4a4261fSmrgAC_ARG_VAR([PERL], [Path to perl command])
1967a4a4261fSmrg# Preserves the interface, should it be implemented later
1968a4a4261fSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
1970a4a4261fSmrgAC_ARG_WITH(perl,
1971a4a4261fSmrg	AS_HELP_STRING([--with-perl],
1972a4a4261fSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973a4a4261fSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1974a4a4261fSmrgm4_undefine([_defopt])
1975e7c933f3Smrg
1976a4a4261fSmrgif test "x$use_perl" = x"auto"; then
1977a4a4261fSmrg   AC_PATH_PROG([PERL], [perl])
1978a4a4261fSmrg   if test "x$PERL" = "x"; then
1979a4a4261fSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980a4a4261fSmrg	have_perl=no
1981a4a4261fSmrg   else
1982a4a4261fSmrg        have_perl=yes
1983a4a4261fSmrg   fi
1984a4a4261fSmrgelif test "x$use_perl" = x"yes" ; then
1985a4a4261fSmrg   AC_PATH_PROG([PERL], [perl])
1986a4a4261fSmrg   if test "x$PERL" = "x"; then
1987a4a4261fSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988a4a4261fSmrg   fi
1989a4a4261fSmrg   have_perl=yes
1990a4a4261fSmrgelif test "x$use_perl" = x"no" ; then
1991a4a4261fSmrg   if test "x$PERL" != "x"; then
1992a4a4261fSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993a4a4261fSmrg   fi
1994a4a4261fSmrg   have_perl=no
1995a4a4261fSmrgelse
1996a4a4261fSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997a4a4261fSmrgfi
1998e7c933f3Smrg
1999a4a4261fSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000a4a4261fSmrg]) # XORG_WITH_PERL
2001e7c933f3Smrg
2002a4a4261fSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003e7c933f3Smrg# ----------------
2004a4a4261fSmrg# Minimum version: 1.5.0
2005a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2006e7c933f3Smrg#
2007a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2008a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
2009a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010b0d3a7b0Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011a4a4261fSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012a4a4261fSmrg# --with-asciidoc assumes 'auto'.
2013e7c933f3Smrg#
2014a4a4261fSmrg# Interface to module:
2015a4a4261fSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016a4a4261fSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017a4a4261fSmrg#		 returns the path set by the user in the environment
2018a4a4261fSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019a4a4261fSmrg#		  'no' user instructs the module not to use asciidoc
2020e7c933f3Smrg#
2021a4a4261fSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022e7c933f3Smrg#
2023a4a4261fSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024a4a4261fSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
2026a4a4261fSmrgAC_ARG_WITH(asciidoc,
2027a4a4261fSmrg	AS_HELP_STRING([--with-asciidoc],
2028a4a4261fSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029a4a4261fSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030a4a4261fSmrgm4_undefine([_defopt])
2031e7c933f3Smrg
2032a4a4261fSmrgif test "x$use_asciidoc" = x"auto"; then
2033a4a4261fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034a4a4261fSmrg   if test "x$ASCIIDOC" = "x"; then
2035a4a4261fSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036a4a4261fSmrg	have_asciidoc=no
2037a4a4261fSmrg   else
2038a4a4261fSmrg        have_asciidoc=yes
2039a4a4261fSmrg   fi
2040a4a4261fSmrgelif test "x$use_asciidoc" = x"yes" ; then
2041a4a4261fSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042a4a4261fSmrg   if test "x$ASCIIDOC" = "x"; then
2043a4a4261fSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044a4a4261fSmrg   fi
2045a4a4261fSmrg   have_asciidoc=yes
2046a4a4261fSmrgelif test "x$use_asciidoc" = x"no" ; then
2047a4a4261fSmrg   if test "x$ASCIIDOC" != "x"; then
2048a4a4261fSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049a4a4261fSmrg   fi
2050a4a4261fSmrg   have_asciidoc=no
2051a4a4261fSmrgelse
2052a4a4261fSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053a4a4261fSmrgfi
2054a4a4261fSmrgm4_ifval([$1],
2055a4a4261fSmrg[if test "$have_asciidoc" = yes; then
2056a4a4261fSmrg    # scrape the asciidoc version
2057a4a4261fSmrg    AC_MSG_CHECKING([the asciidoc version])
2058a4a4261fSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059a4a4261fSmrg    AC_MSG_RESULT([$asciidoc_version])
2060a4a4261fSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061a4a4261fSmrg        [if test "x$use_asciidoc" = xauto; then
2062a4a4261fSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063a4a4261fSmrg            have_asciidoc=no
2064a4a4261fSmrg        else
2065a4a4261fSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066a4a4261fSmrg        fi])
2067a4a4261fSmrgfi])
2068a4a4261fSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069a4a4261fSmrg]) # XORG_WITH_ASCIIDOC
2070e7c933f3Smrg
2071a4a4261fSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072a4a4261fSmrg# -------------------------------------------
2073a4a4261fSmrg# Minimum version: 1.5.0
2074a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2075a4a4261fSmrg# Minimum version for optional DOT checking: 1.18.0
2076e7c933f3Smrg#
2077a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2078a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
2079a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080b0d3a7b0Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081a4a4261fSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082a4a4261fSmrg# --with-doxygen assumes 'auto'.
2083e7c933f3Smrg#
2084a4a4261fSmrg# Interface to module:
2085a4a4261fSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086a4a4261fSmrg# DOXYGEN:	 returns the path of the doxygen program found
2087a4a4261fSmrg#		 returns the path set by the user in the environment
2088a4a4261fSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089a4a4261fSmrg#		  'no' user instructs the module not to use doxygen
2090e7c933f3Smrg#
2091a4a4261fSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092e7c933f3Smrg#
2093a4a4261fSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094a4a4261fSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095a4a4261fSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
2097a4a4261fSmrgAC_ARG_WITH(doxygen,
2098a4a4261fSmrg	AS_HELP_STRING([--with-doxygen],
2099a4a4261fSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100a4a4261fSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101a4a4261fSmrgm4_undefine([_defopt])
2102e7c933f3Smrg
2103a4a4261fSmrgif test "x$use_doxygen" = x"auto"; then
2104a4a4261fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105a4a4261fSmrg   if test "x$DOXYGEN" = "x"; then
2106a4a4261fSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107a4a4261fSmrg	have_doxygen=no
2108a4a4261fSmrg   else
2109a4a4261fSmrg        have_doxygen=yes
2110a4a4261fSmrg   fi
2111a4a4261fSmrgelif test "x$use_doxygen" = x"yes" ; then
2112a4a4261fSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113a4a4261fSmrg   if test "x$DOXYGEN" = "x"; then
2114a4a4261fSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115a4a4261fSmrg   fi
2116a4a4261fSmrg   have_doxygen=yes
2117a4a4261fSmrgelif test "x$use_doxygen" = x"no" ; then
2118a4a4261fSmrg   if test "x$DOXYGEN" != "x"; then
2119a4a4261fSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120a4a4261fSmrg   fi
2121a4a4261fSmrg   have_doxygen=no
2122e7c933f3Smrgelse
2123a4a4261fSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124e7c933f3Smrgfi
2125a4a4261fSmrgm4_ifval([$1],
2126a4a4261fSmrg[if test "$have_doxygen" = yes; then
2127a4a4261fSmrg    # scrape the doxygen version
2128a4a4261fSmrg    AC_MSG_CHECKING([the doxygen version])
2129a4a4261fSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130a4a4261fSmrg    AC_MSG_RESULT([$doxygen_version])
2131a4a4261fSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132a4a4261fSmrg        [if test "x$use_doxygen" = xauto; then
2133a4a4261fSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134a4a4261fSmrg            have_doxygen=no
2135a4a4261fSmrg        else
2136a4a4261fSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137a4a4261fSmrg        fi])
2138a4a4261fSmrgfi])
2139e7c933f3Smrg
2140a4a4261fSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141a4a4261fSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142a4a4261fSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2143a4a4261fSmrgHAVE_DOT=no
2144a4a4261fSmrgif test "x$have_doxygen" = "xyes"; then
2145a4a4261fSmrg  AC_PATH_PROG([DOT], [dot])
2146a4a4261fSmrg    if test "x$DOT" != "x"; then
2147a4a4261fSmrg      HAVE_DOT=yes
2148a4a4261fSmrg    fi
2149a4a4261fSmrgfi
2150e7c933f3Smrg
2151a4a4261fSmrgAC_SUBST([HAVE_DOT])
2152a4a4261fSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153a4a4261fSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154a4a4261fSmrg]) # XORG_WITH_DOXYGEN
2155e7c933f3Smrg
2156a4a4261fSmrg# XORG_WITH_GROFF([DEFAULT])
2157a4a4261fSmrg# ----------------
2158a4a4261fSmrg# Minimum version: 1.6.0
2159a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2160e7c933f3Smrg#
2161a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2162a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
2163a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164b0d3a7b0Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165a4a4261fSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166a4a4261fSmrg# --with-groff assumes 'auto'.
2167a4a4261fSmrg#
2168a4a4261fSmrg# Interface to module:
2169a4a4261fSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170a4a4261fSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171a4a4261fSmrg# HAVE_GROFF_MS: the -ms macros package
2172a4a4261fSmrg# GROFF:	 returns the path of the groff program found
2173a4a4261fSmrg#		 returns the path set by the user in the environment
2174a4a4261fSmrg# --with-groff:	 'yes' user instructs the module to use groff
2175a4a4261fSmrg#		 'no' user instructs the module not to use groff
2176a4a4261fSmrg#
2177a4a4261fSmrg# Added in version 1.9.0:
2178a4a4261fSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179a4a4261fSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180a4a4261fSmrg#		   psselect from the psutils package.
2181a4a4261fSmrg#		   the ghostcript package. Refer to the grohtml man pages
2182a4a4261fSmrg#
2183a4a4261fSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184a4a4261fSmrg#
2185a4a4261fSmrg# OS and distros often splits groff in a basic and full package, the former
2186a4a4261fSmrg# having the groff program and the later having devices, fonts and macros
2187a4a4261fSmrg# Checking for the groff executable is not enough.
2188a4a4261fSmrg#
2189a4a4261fSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190a4a4261fSmrg# unset HAVE_GROFF or GROFF env variables.
2191a4a4261fSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192a4a4261fSmrg#
2193a4a4261fSmrgAC_DEFUN([XORG_WITH_GROFF],[
2194a4a4261fSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195a4a4261fSmrgm4_define([_defopt], m4_default([$1], [auto]))
2196a4a4261fSmrgAC_ARG_WITH(groff,
2197a4a4261fSmrg	AS_HELP_STRING([--with-groff],
2198a4a4261fSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199a4a4261fSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2200a4a4261fSmrgm4_undefine([_defopt])
2201e7c933f3Smrg
2202a4a4261fSmrgif test "x$use_groff" = x"auto"; then
2203a4a4261fSmrg   AC_PATH_PROG([GROFF], [groff])
2204a4a4261fSmrg   if test "x$GROFF" = "x"; then
2205a4a4261fSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206a4a4261fSmrg	have_groff=no
2207a4a4261fSmrg   else
2208a4a4261fSmrg        have_groff=yes
2209a4a4261fSmrg   fi
2210a4a4261fSmrgelif test "x$use_groff" = x"yes" ; then
2211a4a4261fSmrg   AC_PATH_PROG([GROFF], [groff])
2212a4a4261fSmrg   if test "x$GROFF" = "x"; then
2213a4a4261fSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214a4a4261fSmrg   fi
2215a4a4261fSmrg   have_groff=yes
2216a4a4261fSmrgelif test "x$use_groff" = x"no" ; then
2217a4a4261fSmrg   if test "x$GROFF" != "x"; then
2218a4a4261fSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219a4a4261fSmrg   fi
2220a4a4261fSmrg   have_groff=no
2221a4a4261fSmrgelse
2222a4a4261fSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223a4a4261fSmrgfi
2224e7c933f3Smrg
2225a4a4261fSmrg# We have groff, test for the presence of the macro packages
2226a4a4261fSmrgif test "x$have_groff" = x"yes"; then
2227a4a4261fSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228a4a4261fSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229a4a4261fSmrg        groff_ms_works=yes
2230a4a4261fSmrg    else
2231a4a4261fSmrg        groff_ms_works=no
2232e7c933f3Smrg    fi
2233a4a4261fSmrg    AC_MSG_RESULT([$groff_ms_works])
2234a4a4261fSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235a4a4261fSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236a4a4261fSmrg        groff_mm_works=yes
2237a4a4261fSmrg    else
2238a4a4261fSmrg        groff_mm_works=no
2239a4a4261fSmrg    fi
2240a4a4261fSmrg    AC_MSG_RESULT([$groff_mm_works])
2241a4a4261fSmrgfi
2242e7c933f3Smrg
2243a4a4261fSmrg# We have groff, test for HTML dependencies, one command per package
2244a4a4261fSmrgif test "x$have_groff" = x"yes"; then
2245a4a4261fSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246a4a4261fSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247a4a4261fSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248a4a4261fSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249a4a4261fSmrg      have_groff_html=yes
2250a4a4261fSmrg   else
2251a4a4261fSmrg      have_groff_html=no
2252a4a4261fSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253a4a4261fSmrg   fi
2254a4a4261fSmrgfi
2255a4a4261fSmrg
2256a4a4261fSmrg# Set Automake conditionals for Makefiles
2257a4a4261fSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258a4a4261fSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259a4a4261fSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260a4a4261fSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261a4a4261fSmrg]) # XORG_WITH_GROFF
2262a4a4261fSmrg
2263a4a4261fSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264a4a4261fSmrg# ---------------------------------------
2265a4a4261fSmrg# Minimum version: 1.6.0
2266a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2267a4a4261fSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268a4a4261fSmrg#
2269a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2270a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
2271a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272b0d3a7b0Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273a4a4261fSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274a4a4261fSmrg# --with-fop assumes 'auto'.
2275a4a4261fSmrg#
2276a4a4261fSmrg# Interface to module:
2277a4a4261fSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278a4a4261fSmrg# FOP:	 	returns the path of the fop program found
2279a4a4261fSmrg#		returns the path set by the user in the environment
2280a4a4261fSmrg# --with-fop: 	'yes' user instructs the module to use fop
2281a4a4261fSmrg#		'no' user instructs the module not to use fop
2282a4a4261fSmrg#
2283a4a4261fSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284a4a4261fSmrg#
2285a4a4261fSmrgAC_DEFUN([XORG_WITH_FOP],[
2286a4a4261fSmrgAC_ARG_VAR([FOP], [Path to fop command])
2287a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
2288a4a4261fSmrgAC_ARG_WITH(fop,
2289a4a4261fSmrg	AS_HELP_STRING([--with-fop],
2290a4a4261fSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291a4a4261fSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2292a4a4261fSmrgm4_undefine([_defopt])
2293a4a4261fSmrg
2294a4a4261fSmrgif test "x$use_fop" = x"auto"; then
2295a4a4261fSmrg   AC_PATH_PROG([FOP], [fop])
2296a4a4261fSmrg   if test "x$FOP" = "x"; then
2297a4a4261fSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298a4a4261fSmrg	have_fop=no
2299a4a4261fSmrg   else
2300a4a4261fSmrg        have_fop=yes
2301a4a4261fSmrg   fi
2302a4a4261fSmrgelif test "x$use_fop" = x"yes" ; then
2303a4a4261fSmrg   AC_PATH_PROG([FOP], [fop])
2304a4a4261fSmrg   if test "x$FOP" = "x"; then
2305a4a4261fSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306a4a4261fSmrg   fi
2307a4a4261fSmrg   have_fop=yes
2308a4a4261fSmrgelif test "x$use_fop" = x"no" ; then
2309a4a4261fSmrg   if test "x$FOP" != "x"; then
2310a4a4261fSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311a4a4261fSmrg   fi
2312a4a4261fSmrg   have_fop=no
2313e7c933f3Smrgelse
2314a4a4261fSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315e7c933f3Smrgfi
2316e7c933f3Smrg
2317a4a4261fSmrg# Test for a minimum version of fop, if provided.
2318a4a4261fSmrgm4_ifval([$1],
2319a4a4261fSmrg[if test "$have_fop" = yes; then
2320a4a4261fSmrg    # scrape the fop version
2321a4a4261fSmrg    AC_MSG_CHECKING([for fop minimum version])
2322a4a4261fSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323a4a4261fSmrg    AC_MSG_RESULT([$fop_version])
2324a4a4261fSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325a4a4261fSmrg        [if test "x$use_fop" = xauto; then
2326a4a4261fSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327a4a4261fSmrg            have_fop=no
2328a4a4261fSmrg        else
2329a4a4261fSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330a4a4261fSmrg        fi])
2331a4a4261fSmrgfi])
2332a4a4261fSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333a4a4261fSmrg]) # XORG_WITH_FOP
2334a4a4261fSmrg
2335a4a4261fSmrg# XORG_WITH_M4([MIN-VERSION])
2336a4a4261fSmrg# ---------------------------
2337a4a4261fSmrg# Minimum version: 1.19.0
2338a4a4261fSmrg#
2339a4a4261fSmrg# This macro attempts to locate an m4 macro processor which supports
2340a4a4261fSmrg# -I option and is only useful for modules relying on M4 in order to
2341a4a4261fSmrg# expand macros in source code files.
2342a4a4261fSmrg#
2343a4a4261fSmrg# Interface to module:
2344a4a4261fSmrg# M4:	 	returns the path of the m4 program found
2345a4a4261fSmrg#		returns the path set by the user in the environment
2346a4a4261fSmrg#
2347a4a4261fSmrgAC_DEFUN([XORG_WITH_M4], [
2348a4a4261fSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349a4a4261fSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350a4a4261fSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351a4a4261fSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352a4a4261fSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353a4a4261fSmrg   [$PATH:/usr/gnu/bin])])
2354e7c933f3Smrg
2355a4a4261fSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356a4a4261fSmrg]) # XORG_WITH_M4
2357e7c933f3Smrg
2358a4a4261fSmrg# XORG_WITH_PS2PDF([DEFAULT])
2359a4a4261fSmrg# ----------------
2360a4a4261fSmrg# Minimum version: 1.6.0
2361a4a4261fSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2362a4a4261fSmrg#
2363a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2364a4a4261fSmrg# not at the appropriate level. This macro enables a module to test for the
2365a4a4261fSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366b0d3a7b0Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367a4a4261fSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368a4a4261fSmrg# --with-ps2pdf assumes 'auto'.
2369a4a4261fSmrg#
2370a4a4261fSmrg# Interface to module:
2371a4a4261fSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372a4a4261fSmrg# PS2PDF:	returns the path of the ps2pdf program found
2373a4a4261fSmrg#		returns the path set by the user in the environment
2374a4a4261fSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375a4a4261fSmrg#		 'no' user instructs the module not to use ps2pdf
2376a4a4261fSmrg#
2377a4a4261fSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378a4a4261fSmrg#
2379a4a4261fSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380a4a4261fSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381a4a4261fSmrgm4_define([_defopt], m4_default([$1], [auto]))
2382a4a4261fSmrgAC_ARG_WITH(ps2pdf,
2383a4a4261fSmrg	AS_HELP_STRING([--with-ps2pdf],
2384a4a4261fSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385a4a4261fSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386a4a4261fSmrgm4_undefine([_defopt])
2387e7c933f3Smrg
2388a4a4261fSmrgif test "x$use_ps2pdf" = x"auto"; then
2389a4a4261fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390a4a4261fSmrg   if test "x$PS2PDF" = "x"; then
2391a4a4261fSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392a4a4261fSmrg	have_ps2pdf=no
2393a4a4261fSmrg   else
2394a4a4261fSmrg        have_ps2pdf=yes
2395a4a4261fSmrg   fi
2396a4a4261fSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2397a4a4261fSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398a4a4261fSmrg   if test "x$PS2PDF" = "x"; then
2399a4a4261fSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400a4a4261fSmrg   fi
2401a4a4261fSmrg   have_ps2pdf=yes
2402a4a4261fSmrgelif test "x$use_ps2pdf" = x"no" ; then
2403a4a4261fSmrg   if test "x$PS2PDF" != "x"; then
2404a4a4261fSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405a4a4261fSmrg   fi
2406a4a4261fSmrg   have_ps2pdf=no
2407a4a4261fSmrgelse
2408a4a4261fSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409e7c933f3Smrgfi
2410a4a4261fSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411a4a4261fSmrg]) # XORG_WITH_PS2PDF
2412e7c933f3Smrg
2413a4a4261fSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414a4a4261fSmrg# ----------------
2415a4a4261fSmrg# Minimum version: 1.6.0
2416e7c933f3Smrg#
2417a4a4261fSmrg# Documentation tools are not always available on all platforms and sometimes
2418a4a4261fSmrg# not at the appropriate level. This macro enables a builder to skip all
2419a4a4261fSmrg# documentation targets except traditional man pages.
2420a4a4261fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421b0d3a7b0Smrg# maximum flexibility in controlling documentation building.
2422a4a4261fSmrg# Refer to:
2423a4a4261fSmrg# XORG_WITH_XMLTO         --with-xmlto
2424a4a4261fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425a4a4261fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2426a4a4261fSmrg# XORG_WITH_FOP           --with-fop
2427a4a4261fSmrg# XORG_WITH_GROFF         --with-groff
2428a4a4261fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429a4a4261fSmrg#
2430a4a4261fSmrg# Interface to module:
2431a4a4261fSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432a4a4261fSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2433a4a4261fSmrg#		 'no' user instructs the module not to generate docs
2434a4a4261fSmrg# parm1:	specify the default value, yes or no.
2435a4a4261fSmrg#
2436a4a4261fSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437a4a4261fSmrgm4_define([docs_default], m4_default([$1], [yes]))
2438a4a4261fSmrgAC_ARG_ENABLE(docs,
2439a4a4261fSmrg	AS_HELP_STRING([--enable-docs],
2440a4a4261fSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2441a4a4261fSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442a4a4261fSmrgm4_undefine([docs_default])
2443a4a4261fSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444a4a4261fSmrgAC_MSG_CHECKING([whether to build documentation])
2445a4a4261fSmrgAC_MSG_RESULT([$build_docs])
2446a4a4261fSmrg]) # XORG_ENABLE_DOCS
2447e7c933f3Smrg
2448a4a4261fSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449a4a4261fSmrg# ----------------
2450a4a4261fSmrg# Minimum version: 1.6.0
2451a4a4261fSmrg#
2452a4a4261fSmrg# This macro enables a builder to skip all developer documentation.
2453a4a4261fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454b0d3a7b0Smrg# maximum flexibility in controlling documentation building.
2455a4a4261fSmrg# Refer to:
2456a4a4261fSmrg# XORG_WITH_XMLTO         --with-xmlto
2457a4a4261fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458a4a4261fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2459a4a4261fSmrg# XORG_WITH_FOP           --with-fop
2460a4a4261fSmrg# XORG_WITH_GROFF         --with-groff
2461a4a4261fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462a4a4261fSmrg#
2463a4a4261fSmrg# Interface to module:
2464a4a4261fSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465a4a4261fSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466a4a4261fSmrg#			'no' user instructs the module not to generate developer docs
2467a4a4261fSmrg# parm1:		specify the default value, yes or no.
2468a4a4261fSmrg#
2469a4a4261fSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470a4a4261fSmrgm4_define([devel_default], m4_default([$1], [yes]))
2471a4a4261fSmrgAC_ARG_ENABLE(devel-docs,
2472a4a4261fSmrg	AS_HELP_STRING([--enable-devel-docs],
2473a4a4261fSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474a4a4261fSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475a4a4261fSmrgm4_undefine([devel_default])
2476a4a4261fSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477a4a4261fSmrgAC_MSG_CHECKING([whether to build developer documentation])
2478a4a4261fSmrgAC_MSG_RESULT([$build_devel_docs])
2479a4a4261fSmrg]) # XORG_ENABLE_DEVEL_DOCS
24801a669bc9Smrg
2481a4a4261fSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482a4a4261fSmrg# ----------------
2483a4a4261fSmrg# Minimum version: 1.6.0
2484a4a4261fSmrg#
2485a4a4261fSmrg# This macro enables a builder to skip all functional specification targets.
2486a4a4261fSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487b0d3a7b0Smrg# maximum flexibility in controlling documentation building.
2488a4a4261fSmrg# Refer to:
2489a4a4261fSmrg# XORG_WITH_XMLTO         --with-xmlto
2490a4a4261fSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491a4a4261fSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2492a4a4261fSmrg# XORG_WITH_FOP           --with-fop
2493a4a4261fSmrg# XORG_WITH_GROFF         --with-groff
2494a4a4261fSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495a4a4261fSmrg#
2496a4a4261fSmrg# Interface to module:
2497a4a4261fSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498a4a4261fSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2499a4a4261fSmrg#			'no' user instructs the module not to generate specs
2500a4a4261fSmrg# parm1:		specify the default value, yes or no.
2501a4a4261fSmrg#
2502a4a4261fSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503a4a4261fSmrgm4_define([spec_default], m4_default([$1], [yes]))
2504a4a4261fSmrgAC_ARG_ENABLE(specs,
2505a4a4261fSmrg	AS_HELP_STRING([--enable-specs],
2506a4a4261fSmrg	   [Enable building the specs (default: ]spec_default[)]),
2507a4a4261fSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508a4a4261fSmrgm4_undefine([spec_default])
2509a4a4261fSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510a4a4261fSmrgAC_MSG_CHECKING([whether to build functional specifications])
2511a4a4261fSmrgAC_MSG_RESULT([$build_specs])
2512a4a4261fSmrg]) # XORG_ENABLE_SPECS
2513e7c933f3Smrg
2514a4a4261fSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515a4a4261fSmrg# ----------------------------------------------
2516a4a4261fSmrg# Minimum version: 1.13.0
25171a669bc9Smrg#
2518a4a4261fSmrg# This macro enables a builder to enable/disable unit testing
2519a4a4261fSmrg# It makes no assumption about the test cases implementation
2520a4a4261fSmrg# Test cases may or may not use Automake "Support for test suites"
2521a4a4261fSmrg# They may or may not use the software utility library GLib
2522a4a4261fSmrg#
2523a4a4261fSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524a4a4261fSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525a4a4261fSmrg# The variable enable_unit_tests is used by other macros in this file.
2526a4a4261fSmrg#
2527a4a4261fSmrg# Interface to module:
2528a4a4261fSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529a4a4261fSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2530a4a4261fSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531a4a4261fSmrg#			'no' user instructs the module not to build tests
2532a4a4261fSmrg# parm1:		specify the default value, yes or no.
2533a4a4261fSmrg#
2534a4a4261fSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535a4a4261fSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536a4a4261fSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537a4a4261fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538a4a4261fSmrgm4_define([_defopt], m4_default([$1], [auto]))
2539a4a4261fSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540a4a4261fSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2541a4a4261fSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542a4a4261fSmrgm4_undefine([_defopt])
2543a4a4261fSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544a4a4261fSmrgAC_MSG_CHECKING([whether to build unit test cases])
2545a4a4261fSmrgAC_MSG_RESULT([$enable_unit_tests])
2546a4a4261fSmrg]) # XORG_ENABLE_UNIT_TESTS
2547e7c933f3Smrg
2548a4a4261fSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549a4a4261fSmrg# ------------------------------------------------------
2550a4a4261fSmrg# Minimum version: 1.17.0
2551a4a4261fSmrg#
2552a4a4261fSmrg# This macro enables a builder to enable/disable integration testing
2553a4a4261fSmrg# It makes no assumption about the test cases' implementation
2554a4a4261fSmrg# Test cases may or may not use Automake "Support for test suites"
2555a4a4261fSmrg#
2556a4a4261fSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557a4a4261fSmrg# usually requires less dependencies and may be built and run under less
2558a4a4261fSmrg# stringent environments than integration tests.
2559a4a4261fSmrg#
2560a4a4261fSmrg# Interface to module:
2561a4a4261fSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562a4a4261fSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2563a4a4261fSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564a4a4261fSmrg#                             'no' user instructs the module not to build tests
2565a4a4261fSmrg# parm1:                      specify the default value, yes or no.
2566a4a4261fSmrg#
2567a4a4261fSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568a4a4261fSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569a4a4261fSmrgm4_define([_defopt], m4_default([$1], [auto]))
2570a4a4261fSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571a4a4261fSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2572a4a4261fSmrg	[enable_integration_tests=$enableval],
2573a4a4261fSmrg	[enable_integration_tests=]_defopt)
2574a4a4261fSmrgm4_undefine([_defopt])
2575a4a4261fSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576a4a4261fSmrg	[test "x$enable_integration_tests" != xno])
2577a4a4261fSmrgAC_MSG_CHECKING([whether to build unit test cases])
2578a4a4261fSmrgAC_MSG_RESULT([$enable_integration_tests])
2579a4a4261fSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580e7c933f3Smrg
2581a4a4261fSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582a4a4261fSmrg# ----------------------------------------
2583a4a4261fSmrg# Minimum version: 1.13.0
2584a4a4261fSmrg#
2585a4a4261fSmrg# GLib is a library which provides advanced data structures and functions.
2586a4a4261fSmrg# This macro enables a module to test for the presence of Glib.
2587a4a4261fSmrg#
2588a4a4261fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589a4a4261fSmrg# Otherwise the value of $enable_unit_tests is blank.
2590a4a4261fSmrg#
2591a4a4261fSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592a4a4261fSmrg# test support usually requires less dependencies and may be built and run under
2593a4a4261fSmrg# less stringent environments than integration tests.
25941a669bc9Smrg#
2595a4a4261fSmrg# Interface to module:
2596a4a4261fSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597a4a4261fSmrg# with_glib: used in configure.ac to know if GLib has been found
2598a4a4261fSmrg# --with-glib:	'yes' user instructs the module to use glib
2599a4a4261fSmrg#		'no' user instructs the module not to use glib
2600a4a4261fSmrg#
2601a4a4261fSmrgAC_DEFUN([XORG_WITH_GLIB],[
2602a4a4261fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603a4a4261fSmrgm4_define([_defopt], m4_default([$2], [auto]))
2604a4a4261fSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605a4a4261fSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606a4a4261fSmrg	[with_glib=$withval], [with_glib=]_defopt)
2607a4a4261fSmrgm4_undefine([_defopt])
26081a669bc9Smrg
2609a4a4261fSmrghave_glib=no
2610a4a4261fSmrg# Do not probe GLib if user explicitly disabled unit testing
2611a4a4261fSmrgif test "x$enable_unit_tests" != x"no"; then
2612a4a4261fSmrg  # Do not probe GLib if user explicitly disabled it
2613a4a4261fSmrg  if test "x$with_glib" != x"no"; then
2614a4a4261fSmrg    m4_ifval(
2615a4a4261fSmrg      [$1],
2616a4a4261fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617a4a4261fSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618a4a4261fSmrg    )
2619e7c933f3Smrg  fi
26201a669bc9Smrgfi
26211a669bc9Smrg
2622a4a4261fSmrg# Not having GLib when unit testing has been explicitly requested is an error
2623a4a4261fSmrgif test "x$enable_unit_tests" = x"yes"; then
2624a4a4261fSmrg  if test "x$have_glib" = x"no"; then
2625a4a4261fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626e7c933f3Smrg  fi
2627e7c933f3Smrgfi
26281a669bc9Smrg
2629a4a4261fSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630a4a4261fSmrgif test "x$enable_unit_tests" = x"no"; then
2631a4a4261fSmrg  if test "x$with_glib" = x"yes"; then
2632a4a4261fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633a4a4261fSmrg  fi
2634a4a4261fSmrgfi
26351a669bc9Smrg
2636a4a4261fSmrg# Not having GLib when it has been explicitly requested is an error
2637a4a4261fSmrgif test "x$with_glib" = x"yes"; then
2638a4a4261fSmrg  if test "x$have_glib" = x"no"; then
2639a4a4261fSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640a4a4261fSmrg  fi
2641a4a4261fSmrgfi
2642e7c933f3Smrg
2643a4a4261fSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644a4a4261fSmrg]) # XORG_WITH_GLIB
2645e7c933f3Smrg
2646a4a4261fSmrg# XORG_LD_WRAP([required|optional])
2647a4a4261fSmrg# ---------------------------------
2648a4a4261fSmrg# Minimum version: 1.13.0
2649a4a4261fSmrg#
2650a4a4261fSmrg# Check if linker supports -wrap, passed via compiler flags
2651a4a4261fSmrg#
2652a4a4261fSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653a4a4261fSmrg# Otherwise the value of $enable_unit_tests is blank.
2654a4a4261fSmrg#
2655a4a4261fSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656a4a4261fSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657a4a4261fSmrg# available, an argument of "optional" allows use when some unit tests require
2658a4a4261fSmrg# ld -wrap and others do not.
2659a4a4261fSmrg#
2660a4a4261fSmrgAC_DEFUN([XORG_LD_WRAP],[
2661a4a4261fSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662a4a4261fSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663a4a4261fSmrg                      void __wrap_exit(int status) { return; }],
2664a4a4261fSmrg                     [exit(0);])])
2665a4a4261fSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666a4a4261fSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667a4a4261fSmrg  if test "x$have_ld_wrap" = x"no"; then
2668a4a4261fSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669a4a4261fSmrg  fi
2670a4a4261fSmrgfi
2671a4a4261fSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672a4a4261fSmrg#
2673a4a4261fSmrg]) # XORG_LD_WRAP
2674e7c933f3Smrg
2675a4a4261fSmrg# XORG_CHECK_LINKER_FLAGS
2676a4a4261fSmrg# -----------------------
2677a4a4261fSmrg# SYNOPSIS
2678a4a4261fSmrg#
2679a4a4261fSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680a4a4261fSmrg#
2681a4a4261fSmrg# DESCRIPTION
2682a4a4261fSmrg#
2683a4a4261fSmrg#   Check whether the given linker FLAGS work with the current language's
2684a4a4261fSmrg#   linker, or whether they give an error.
2685a4a4261fSmrg#
2686a4a4261fSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687a4a4261fSmrg#   success/failure.
2688a4a4261fSmrg#
2689a4a4261fSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690a4a4261fSmrg#
2691a4a4261fSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692a4a4261fSmrg#
2693a4a4261fSmrg# LICENSE
2694a4a4261fSmrg#
2695a4a4261fSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696a4a4261fSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697a4a4261fSmrg#   Copyright (c) 2009 Matteo Frigo
2698a4a4261fSmrg#
2699a4a4261fSmrg#   This program is free software: you can redistribute it and/or modify it
2700a4a4261fSmrg#   under the terms of the GNU General Public License as published by the
2701a4a4261fSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2702a4a4261fSmrg#   option) any later version.
2703a4a4261fSmrg#
2704a4a4261fSmrg#   This program is distributed in the hope that it will be useful, but
2705a4a4261fSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706a4a4261fSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707a4a4261fSmrg#   Public License for more details.
2708a4a4261fSmrg#
2709a4a4261fSmrg#   You should have received a copy of the GNU General Public License along
2710a4a4261fSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711a4a4261fSmrg#
2712a4a4261fSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713a4a4261fSmrg#   gives unlimited permission to copy, distribute and modify the configure
2714a4a4261fSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2715a4a4261fSmrg#   need not follow the terms of the GNU General Public License when using
2716a4a4261fSmrg#   or distributing such scripts, even though portions of the text of the
2717a4a4261fSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718a4a4261fSmrg#   all other use of the material that constitutes the Autoconf Macro.
2719a4a4261fSmrg#
2720a4a4261fSmrg#   This special exception to the GPL applies to versions of the Autoconf
2721a4a4261fSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722a4a4261fSmrg#   modified version of the Autoconf Macro, you may extend this special
2723a4a4261fSmrg#   exception to the GPL to apply to your modified version as well.#
2724a4a4261fSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725a4a4261fSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726a4a4261fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727a4a4261fSmrgAS_LITERAL_IF([$1],
2728a4a4261fSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729a4a4261fSmrg      ax_save_FLAGS=$LDFLAGS
2730a4a4261fSmrg      LDFLAGS="$1"
2731a4a4261fSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732a4a4261fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733a4a4261fSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734a4a4261fSmrg      LDFLAGS=$ax_save_FLAGS])],
2735a4a4261fSmrg  [ax_save_FLAGS=$LDFLAGS
2736a4a4261fSmrg   LDFLAGS="$1"
2737a4a4261fSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738a4a4261fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739a4a4261fSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740a4a4261fSmrg   LDFLAGS=$ax_save_FLAGS])
2741a4a4261fSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742a4a4261fSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743a4a4261fSmrgif test "x$xorg_check_linker_flags" = xyes; then
2744a4a4261fSmrg	m4_default([$2], :)
2745a4a4261fSmrgelse
2746a4a4261fSmrg	m4_default([$3], :)
2747a4a4261fSmrgfi
2748a4a4261fSmrg]) # XORG_CHECK_LINKER_FLAGS
2749e7c933f3Smrg
2750a4a4261fSmrg# XORG_MEMORY_CHECK_FLAGS
2751a4a4261fSmrg# -----------------------
2752a4a4261fSmrg# Minimum version: 1.16.0
2753a4a4261fSmrg#
2754a4a4261fSmrg# This macro attempts to find appropriate memory checking functionality
2755a4a4261fSmrg# for various platforms which unit testing code may use to catch various
2756a4a4261fSmrg# forms of memory allocation and access errors in testing.
2757a4a4261fSmrg#
2758a4a4261fSmrg# Interface to module:
2759a4a4261fSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760a4a4261fSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761a4a4261fSmrg#
2762a4a4261fSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763a4a4261fSmrg#
2764a4a4261fSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765e7c933f3Smrg
2766a4a4261fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767a4a4261fSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768a4a4261fSmrg           [Environment variables to enable memory checking in tests])
2769e7c933f3Smrg
2770a4a4261fSmrg# Check for different types of support on different platforms
2771a4a4261fSmrgcase $host_os in
2772a4a4261fSmrg    solaris*)
2773a4a4261fSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2774a4a4261fSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775a4a4261fSmrg        ;;
2776a4a4261fSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777a4a4261fSmrg        # both directly and inverted, so should not be 0 or 255.
2778a4a4261fSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779a4a4261fSmrg        ;;
2780a4a4261fSmrg    darwin*)
2781a4a4261fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782a4a4261fSmrg        ;;
2783a4a4261fSmrg    *bsd*)
2784a4a4261fSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785a4a4261fSmrg        ;;
2786a4a4261fSmrgesac
2787e7c933f3Smrg
2788a4a4261fSmrg# User supplied flags override default flags
2789a4a4261fSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790a4a4261fSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27911a669bc9Smrgfi
2792e7c933f3Smrg
2793a4a4261fSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794a4a4261fSmrg]) # XORG_WITH_LINT
2795e7c933f3Smrg
2796a4a4261fSmrg# XORG_CHECK_MALLOC_ZERO
2797a4a4261fSmrg# ----------------------
2798a4a4261fSmrg# Minimum version: 1.0.0
27991a669bc9Smrg#
2800a4a4261fSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801a4a4261fSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802a4a4261fSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803a4a4261fSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804a4a4261fSmrgAC_ARG_ENABLE(malloc0returnsnull,
2805a4a4261fSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806a4a4261fSmrg		       [malloc(0) returns NULL (default: auto)]),
2807a4a4261fSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808a4a4261fSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28091a669bc9Smrg
2810a4a4261fSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811a4a4261fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812a4a4261fSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813a4a4261fSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814a4a4261fSmrg#include <stdlib.h>
2815a4a4261fSmrg],[
2816a4a4261fSmrg    char *m0, *r0, *c0, *p;
2817a4a4261fSmrg    m0 = malloc(0);
2818a4a4261fSmrg    p = malloc(10);
2819a4a4261fSmrg    r0 = realloc(p,0);
2820a4a4261fSmrg    c0 = calloc(0,10);
2821a4a4261fSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822a4a4261fSmrg])],
2823a4a4261fSmrg		[xorg_cv_malloc0_returns_null=yes],
2824a4a4261fSmrg		[xorg_cv_malloc0_returns_null=no])])
2825a4a4261fSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826e7c933f3Smrgfi
2827a4a4261fSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28281a669bc9Smrg
2829a4a4261fSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830a4a4261fSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831a4a4261fSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832a4a4261fSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28331a669bc9Smrgelse
2834a4a4261fSmrg	MALLOC_ZERO_CFLAGS=""
2835a4a4261fSmrg	XMALLOC_ZERO_CFLAGS=""
2836a4a4261fSmrg	XTMALLOC_ZERO_CFLAGS=""
28371a669bc9Smrgfi
28381a669bc9Smrg
2839a4a4261fSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840a4a4261fSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841a4a4261fSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842a4a4261fSmrg]) # XORG_CHECK_MALLOC_ZERO
28431a669bc9Smrg
2844a4a4261fSmrg# XORG_WITH_LINT()
2845a4a4261fSmrg# ----------------
2846a4a4261fSmrg# Minimum version: 1.1.0
2847e7c933f3Smrg#
2848a4a4261fSmrg# This macro enables the use of a tool that flags some suspicious and
2849a4a4261fSmrg# non-portable constructs (likely to be bugs) in C language source code.
2850a4a4261fSmrg# It will attempt to locate the tool and use appropriate options.
2851a4a4261fSmrg# There are various lint type tools on different platforms.
28521a669bc9Smrg#
2853a4a4261fSmrg# Interface to module:
2854a4a4261fSmrg# LINT:		returns the path to the tool found on the platform
2855a4a4261fSmrg#		or the value set to LINT on the configure cmd line
2856a4a4261fSmrg#		also an Automake conditional
2857a4a4261fSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858a4a4261fSmrg#
2859a4a4261fSmrg# --with-lint:	'yes' user instructs the module to use lint
2860a4a4261fSmrg#		'no' user instructs the module not to use lint (default)
2861a4a4261fSmrg#
2862a4a4261fSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863a4a4261fSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864a4a4261fSmrg#
2865a4a4261fSmrgAC_DEFUN([XORG_WITH_LINT],[
28661a669bc9Smrg
2867a4a4261fSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868a4a4261fSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869a4a4261fSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870a4a4261fSmrg		[Use a lint-style source code checker (default: disabled)])],
2871a4a4261fSmrg		[use_lint=$withval], [use_lint=no])
28721a669bc9Smrg
2873a4a4261fSmrg# Obtain platform specific info like program name and options
2874a4a4261fSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875a4a4261fSmrgcase $host_os in
2876a4a4261fSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877a4a4261fSmrg	lint_name=splint
2878a4a4261fSmrg	lint_options="-badflag"
2879a4a4261fSmrg	;;
2880a4a4261fSmrg  *freebsd* | *netbsd*)
2881a4a4261fSmrg	lint_name=lint
2882a4a4261fSmrg	lint_options="-u -b"
2883a4a4261fSmrg	;;
2884a4a4261fSmrg  *solaris*)
2885a4a4261fSmrg	lint_name=lint
2886a4a4261fSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887a4a4261fSmrg	;;
2888a4a4261fSmrgesac
2889a4a4261fSmrg
2890a4a4261fSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891a4a4261fSmrgif test "x$use_lint" = x"yes" ; then
2892a4a4261fSmrg   AC_PATH_PROG([LINT], [$lint_name])
2893a4a4261fSmrg   if test "x$LINT" = "x"; then
2894a4a4261fSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895a4a4261fSmrg   fi
2896a4a4261fSmrgelif test "x$use_lint" = x"no" ; then
2897a4a4261fSmrg   if test "x$LINT" != "x"; then
2898a4a4261fSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899a4a4261fSmrg   fi
2900e7c933f3Smrgelse
2901a4a4261fSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902e7c933f3Smrgfi
29031a669bc9Smrg
2904a4a4261fSmrg# User supplied flags override default flags
2905a4a4261fSmrgif test "x$LINT_FLAGS" != "x"; then
2906a4a4261fSmrg   lint_options=$LINT_FLAGS
2907a4a4261fSmrgfi
29081a669bc9Smrg
2909a4a4261fSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910a4a4261fSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29111a669bc9Smrg
2912a4a4261fSmrg]) # XORG_WITH_LINT
29131a669bc9Smrg
2914a4a4261fSmrg# XORG_LINT_LIBRARY(LIBNAME)
2915a4a4261fSmrg# --------------------------
2916a4a4261fSmrg# Minimum version: 1.1.0
2917e7c933f3Smrg#
2918a4a4261fSmrg# Sets up flags for building lint libraries for checking programs that call
2919a4a4261fSmrg# functions in the library.
2920a4a4261fSmrg#
2921a4a4261fSmrg# Interface to module:
2922a4a4261fSmrg# LINTLIB		- Automake variable with the name of lint library file to make
2923a4a4261fSmrg# MAKE_LINT_LIB		- Automake conditional
2924a4a4261fSmrg#
2925a4a4261fSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926a4a4261fSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29271a669bc9Smrg
2928a4a4261fSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929a4a4261fSmrgAC_REQUIRE([XORG_WITH_LINT])
2930a4a4261fSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931a4a4261fSmrg	[Create lint library (default: disabled)])],
2932a4a4261fSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933a4a4261fSmrg
2934a4a4261fSmrgif test "x$make_lint_lib" = x"yes" ; then
2935a4a4261fSmrg   LINTLIB=llib-l$1.ln
2936a4a4261fSmrg   if test "x$LINT" = "x"; then
2937a4a4261fSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938a4a4261fSmrg   fi
2939a4a4261fSmrgelif test "x$make_lint_lib" != x"no" ; then
2940a4a4261fSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941e7c933f3Smrgfi
29421a669bc9Smrg
2943a4a4261fSmrgAC_SUBST(LINTLIB)
2944a4a4261fSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29451a669bc9Smrg
2946a4a4261fSmrg]) # XORG_LINT_LIBRARY
29471a669bc9Smrg
2948a4a4261fSmrg# XORG_COMPILER_BRAND
2949e7c933f3Smrg# -------------------
2950a4a4261fSmrg# Minimum version: 1.14.0
29511a669bc9Smrg#
2952a4a4261fSmrg# Checks for various brands of compilers and sets flags as appropriate:
2953a4a4261fSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954a4a4261fSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955a4a4261fSmrg#   clang compiler - sets CLANGCC to "yes"
2956a4a4261fSmrg#   Intel compiler - sets INTELCC to "yes"
2957a4a4261fSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958a4a4261fSmrg#
2959a4a4261fSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960a4a4261fSmrgAC_LANG_CASE(
2961a4a4261fSmrg	[C], [
2962b0d3a7b0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963b0d3a7b0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964b0d3a7b0Smrg		m4_version_prereq([2.70],
2965b0d3a7b0Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966b0d3a7b0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967a4a4261fSmrg	],
2968a4a4261fSmrg	[C++], [
2969a4a4261fSmrg		AC_REQUIRE([AC_PROG_CXX])
2970a4a4261fSmrg	]
2971a4a4261fSmrg)
2972a4a4261fSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973a4a4261fSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974a4a4261fSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975a4a4261fSmrg]) # XORG_COMPILER_BRAND
29761a669bc9Smrg
2977a4a4261fSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978e7c933f3Smrg# ---------------
2979a4a4261fSmrg# Minimum version: 1.16.0
2980a4a4261fSmrg#
2981a4a4261fSmrg# Test if the compiler works when passed the given flag as a command line argument.
2982b0d3a7b0Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983a4a4261fSmrg# next flag in the list until there are no more options.
2984a4a4261fSmrg#
2985a4a4261fSmrg# Note that this does not guarantee that the compiler supports the flag as some
2986a4a4261fSmrg# compilers will simply ignore arguments that they do not understand, but we do
2987a4a4261fSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988a4a4261fSmrg# -Werror=unused-command-line-argument
2989a4a4261fSmrg#
2990a4a4261fSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991a4a4261fSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992a4a4261fSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29931a669bc9Smrg
2994a4a4261fSmrgAC_LANG_COMPILER_REQUIRE
2995e7c933f3Smrg
2996a4a4261fSmrgAC_LANG_CASE(
2997a4a4261fSmrg	[C], [
2998b0d3a7b0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999b0d3a7b0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000b0d3a7b0Smrg		m4_version_prereq([2.70],
3001b0d3a7b0Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002b0d3a7b0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003a4a4261fSmrg		define([PREFIX], [C])
3004a4a4261fSmrg		define([CACHE_PREFIX], [cc])
3005a4a4261fSmrg		define([COMPILER], [$CC])
3006a4a4261fSmrg	],
3007a4a4261fSmrg	[C++], [
3008a4a4261fSmrg		define([PREFIX], [CXX])
3009a4a4261fSmrg		define([CACHE_PREFIX], [cxx])
3010a4a4261fSmrg		define([COMPILER], [$CXX])
3011a4a4261fSmrg	]
3012a4a4261fSmrg)
3013a4a4261fSmrg
3014a4a4261fSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015a4a4261fSmrg
3016a4a4261fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017a4a4261fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018a4a4261fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019a4a4261fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020a4a4261fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021a4a4261fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022a4a4261fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023a4a4261fSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024a4a4261fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025e7c933f3Smrgfi
3026a4a4261fSmrg
3027a4a4261fSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028a4a4261fSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029a4a4261fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030a4a4261fSmrg	fi
3031a4a4261fSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032a4a4261fSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033a4a4261fSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034a4a4261fSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035a4a4261fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036a4a4261fSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037a4a4261fSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038a4a4261fSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039a4a4261fSmrgfi
3040a4a4261fSmrg
3041a4a4261fSmrgfound="no"
3042a4a4261fSmrgm4_foreach([flag], m4_cdr($@), [
3043a4a4261fSmrg	if test $found = "no" ; then
3044a4a4261fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045a4a4261fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046a4a4261fSmrg		fi
3047a4a4261fSmrg
3048a4a4261fSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049a4a4261fSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050a4a4261fSmrg		fi
3051a4a4261fSmrg
3052a4a4261fSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053a4a4261fSmrg
3054a4a4261fSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055a4a4261fSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056a4a4261fSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057a4a4261fSmrg		AC_CACHE_VAL($cacheid,
3058a4a4261fSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059a4a4261fSmrg					     [eval $cacheid=yes],
3060a4a4261fSmrg					     [eval $cacheid=no])])
3061a4a4261fSmrg
3062a4a4261fSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063a4a4261fSmrg
3064a4a4261fSmrg		eval supported=\$$cacheid
3065a4a4261fSmrg		AC_MSG_RESULT([$supported])
3066a4a4261fSmrg		if test "$supported" = "yes" ; then
3067a4a4261fSmrg			$1="$$1 ]flag["
3068a4a4261fSmrg			found="yes"
3069a4a4261fSmrg		fi
3070a4a4261fSmrg	fi
3071e7c933f3Smrg])
3072a4a4261fSmrg]) # XORG_TESTSET_CFLAG
30731a669bc9Smrg
3074a4a4261fSmrg# XORG_COMPILER_FLAGS
3075a4a4261fSmrg# ---------------
3076a4a4261fSmrg# Minimum version: 1.16.0
3077e7c933f3Smrg#
3078a4a4261fSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079a4a4261fSmrg# arguments supported by the selected compiler which do NOT alter the generated
3080a4a4261fSmrg# code.  These arguments will cause the compiler to print various warnings
3081a4a4261fSmrg# during compilation AND turn a conservative set of warnings into errors.
3082a4a4261fSmrg#
3083a4a4261fSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084a4a4261fSmrg# future versions of util-macros as options are added to new compilers.
3085a4a4261fSmrg#
3086a4a4261fSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087a4a4261fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30881a669bc9Smrg
3089a4a4261fSmrgAC_ARG_ENABLE(selective-werror,
3090a4a4261fSmrg              AS_HELP_STRING([--disable-selective-werror],
3091a4a4261fSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3092a4a4261fSmrg              [SELECTIVE_WERROR=$enableval],
3093a4a4261fSmrg              [SELECTIVE_WERROR=yes])
3094a4a4261fSmrg
3095a4a4261fSmrgAC_LANG_CASE(
3096a4a4261fSmrg        [C], [
3097a4a4261fSmrg                define([PREFIX], [C])
3098a4a4261fSmrg        ],
3099a4a4261fSmrg        [C++], [
3100a4a4261fSmrg                define([PREFIX], [CXX])
3101a4a4261fSmrg        ]
3102a4a4261fSmrg)
3103a4a4261fSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104a4a4261fSmrgif test "x$SUNCC" = "xyes"; then
3105a4a4261fSmrg    [BASE_]PREFIX[FLAGS]="-v"
3106e7c933f3Smrgelse
3107a4a4261fSmrg    [BASE_]PREFIX[FLAGS]=""
3108e7c933f3Smrgfi
31091a669bc9Smrg
3110a4a4261fSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115e7c933f3Smrg
3116a4a4261fSmrgAC_LANG_CASE(
3117a4a4261fSmrg	[C], [
3118a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123a4a4261fSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124a4a4261fSmrg	]
3125a4a4261fSmrg)
31267bd0f98dSmrg
3127a4a4261fSmrg# This chunk adds additional warnings that could catch undesired effects.
3128a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31357bd0f98dSmrg
3136a4a4261fSmrg# These are currently disabled because they are noisy.  They will be enabled
3137a4a4261fSmrg# in the future once the codebase is sufficiently modernized to silence
3138a4a4261fSmrg# them.  For now, I don't want them to drown out the other warnings.
3139a4a4261fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140a4a4261fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141a4a4261fSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31421a669bc9Smrg
3143b0d3a7b0Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144a4a4261fSmrg# when there are problems that should be fixed.
31451a669bc9Smrg
3146a4a4261fSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160a4a4261fSmrgelse
3161a4a4261fSmrgAC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
3162a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174a4a4261fSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175a4a4261fSmrgfi
31761a669bc9Smrg
3177a4a4261fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178a4a4261fSmrg]) # XORG_COMPILER_FLAGS
31797bd0f98dSmrg
3180a4a4261fSmrg# XORG_CWARNFLAGS
3181a4a4261fSmrg# ---------------
3182a4a4261fSmrg# Minimum version: 1.2.0
3183a4a4261fSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31847bd0f98dSmrg#
3185a4a4261fSmrg# Defines CWARNFLAGS to enable C compiler warnings.
31867bd0f98dSmrg#
3187a4a4261fSmrg# This function is deprecated because it defines -fno-strict-aliasing
3188a4a4261fSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189a4a4261fSmrg# is needed, then it should be added explicitly in the module when
3190a4a4261fSmrg# it is updated to use BASE_CFLAGS.
31917bd0f98dSmrg#
3192a4a4261fSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193a4a4261fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194a4a4261fSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195a4a4261fSmrgAC_LANG_CASE(
3196a4a4261fSmrg	[C], [
3197a4a4261fSmrg		CWARNFLAGS="$BASE_CFLAGS"
3198a4a4261fSmrg		if  test "x$GCC" = xyes ; then
3199a4a4261fSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200a4a4261fSmrg		fi
3201a4a4261fSmrg		AC_SUBST(CWARNFLAGS)
3202a4a4261fSmrg	]
3203a4a4261fSmrg)
3204a4a4261fSmrg]) # XORG_CWARNFLAGS
3205cbeba4aeSmrg
3206a4a4261fSmrg# XORG_STRICT_OPTION
3207a4a4261fSmrg# -----------------------
3208a4a4261fSmrg# Minimum version: 1.3.0
3209a4a4261fSmrg#
3210a4a4261fSmrg# Add configure option to enable strict compilation flags, such as treating
3211a4a4261fSmrg# warnings as fatal errors.
3212a4a4261fSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213a4a4261fSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214a4a4261fSmrg#
3215a4a4261fSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216a4a4261fSmrg# when strict compilation is unconditionally desired.
3217a4a4261fSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218a4a4261fSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219a4a4261fSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220e7c933f3Smrg
3221a4a4261fSmrgAC_ARG_ENABLE(strict-compilation,
3222a4a4261fSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3223a4a4261fSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224a4a4261fSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225e7c933f3Smrg
3226a4a4261fSmrgAC_LANG_CASE(
3227a4a4261fSmrg        [C], [
3228a4a4261fSmrg                define([PREFIX], [C])
3229a4a4261fSmrg        ],
3230a4a4261fSmrg        [C++], [
3231a4a4261fSmrg                define([PREFIX], [CXX])
3232a4a4261fSmrg        ]
3233a4a4261fSmrg)
3234e7c933f3Smrg
3235a4a4261fSmrg[STRICT_]PREFIX[FLAGS]=""
3236a4a4261fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237a4a4261fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238e7c933f3Smrg
3239a4a4261fSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240a4a4261fSmrg# activate it with -Werror, so we add it here explicitly.
3241a4a4261fSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242e7c933f3Smrg
3243a4a4261fSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3244a4a4261fSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245a4a4261fSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246a4a4261fSmrgfi
3247a4a4261fSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248a4a4261fSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249a4a4261fSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250a4a4261fSmrg]) # XORG_STRICT_OPTION
3251e7c933f3Smrg
3252b0d3a7b0Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253b0d3a7b0Smrg# ---------------------------
3254b0d3a7b0Smrg# Minimum version: 1.20.0
3255b0d3a7b0Smrg#
3256b0d3a7b0Smrg# Defines default options for X.Org modules which don't compile code,
3257b0d3a7b0Smrg# such as fonts, bitmaps, cursors, and docs.
3258b0d3a7b0Smrg#
3259b0d3a7b0SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260b0d3a7b0SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261b0d3a7b0SmrgXORG_RELEASE_VERSION
3262b0d3a7b0SmrgXORG_CHANGELOG
3263b0d3a7b0SmrgXORG_INSTALL
3264b0d3a7b0SmrgXORG_MANPAGE_SECTIONS
3265b0d3a7b0Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266b0d3a7b0Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267b0d3a7b0Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268b0d3a7b0Smrg
3269a4a4261fSmrg# XORG_DEFAULT_OPTIONS
3270a4a4261fSmrg# --------------------
3271a4a4261fSmrg# Minimum version: 1.3.0
3272a4a4261fSmrg#
3273b0d3a7b0Smrg# Defines default options for X.Org modules which compile code.
3274a4a4261fSmrg#
3275a4a4261fSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276a4a4261fSmrgAC_REQUIRE([AC_PROG_INSTALL])
3277a4a4261fSmrgXORG_COMPILER_FLAGS
3278a4a4261fSmrgXORG_CWARNFLAGS
3279a4a4261fSmrgXORG_STRICT_OPTION
3280b0d3a7b0SmrgXORG_DEFAULT_NOCODE_OPTIONS
3281a4a4261fSmrg]) # XORG_DEFAULT_OPTIONS
3282e7c933f3Smrg
3283a4a4261fSmrg# XORG_INSTALL()
3284a4a4261fSmrg# ----------------
3285a4a4261fSmrg# Minimum version: 1.4.0
3286a4a4261fSmrg#
3287a4a4261fSmrg# Defines the variable INSTALL_CMD as the command to copy
3288a4a4261fSmrg# INSTALL from $prefix/share/util-macros.
3289a4a4261fSmrg#
3290a4a4261fSmrgAC_DEFUN([XORG_INSTALL], [
3291a4a4261fSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292a4a4261fSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293a4a4261fSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294a4a4261fSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295a4a4261fSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296a4a4261fSmrgtouch \$(top_srcdir)/INSTALL; \
3297a4a4261fSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298a4a4261fSmrgAC_SUBST([INSTALL_CMD])
3299a4a4261fSmrg]) # XORG_INSTALL
3300a4a4261fSmrgdnl Copyright 2005 Red Hat, Inc
3301a4a4261fSmrgdnl
3302a4a4261fSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303a4a4261fSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3304a4a4261fSmrgdnl the above copyright notice appear in all copies and that both that
3305a4a4261fSmrgdnl copyright notice and this permission notice appear in supporting
3306a4a4261fSmrgdnl documentation.
3307a4a4261fSmrgdnl
3308a4a4261fSmrgdnl The above copyright notice and this permission notice shall be included
3309a4a4261fSmrgdnl in all copies or substantial portions of the Software.
3310a4a4261fSmrgdnl
3311a4a4261fSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312a4a4261fSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313a4a4261fSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314a4a4261fSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315a4a4261fSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316a4a4261fSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317a4a4261fSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318a4a4261fSmrgdnl
3319a4a4261fSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3320a4a4261fSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3321a4a4261fSmrgdnl other dealings in this Software without prior written authorization
3322a4a4261fSmrgdnl from the copyright holders.
3323a4a4261fSmrgdnl
3324e7c933f3Smrg
3325a4a4261fSmrg# XORG_RELEASE_VERSION
3326a4a4261fSmrg# --------------------
3327a4a4261fSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328e7c933f3Smrg
3329a4a4261fSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330a4a4261fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331a4a4261fSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332a4a4261fSmrg		[Major version of this package])
3333a4a4261fSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334a4a4261fSmrg	if test "x$PVM" = "x"; then
3335a4a4261fSmrg		PVM="0"
3336a4a4261fSmrg	fi
3337a4a4261fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338a4a4261fSmrg		[$PVM],
3339a4a4261fSmrg		[Minor version of this package])
3340a4a4261fSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341a4a4261fSmrg	if test "x$PVP" = "x"; then
3342a4a4261fSmrg		PVP="0"
3343a4a4261fSmrg	fi
3344a4a4261fSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345a4a4261fSmrg		[$PVP],
3346a4a4261fSmrg		[Patch version of this package])
3347a4a4261fSmrg])
3348e7c933f3Smrg
3349a4a4261fSmrg# XORG_CHANGELOG()
3350a4a4261fSmrg# ----------------
3351a4a4261fSmrg# Minimum version: 1.2.0
3352a4a4261fSmrg#
3353a4a4261fSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3354a4a4261fSmrg# ChangeLog from git.
3355a4a4261fSmrg#
3356a4a4261fSmrg#
3357a4a4261fSmrgAC_DEFUN([XORG_CHANGELOG], [
3358a4a4261fSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359a4a4261fSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360a4a4261fSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361a4a4261fSmrgtouch \$(top_srcdir)/ChangeLog; \
3362a4a4261fSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363a4a4261fSmrgAC_SUBST([CHANGELOG_CMD])
3364a4a4261fSmrg]) # XORG_CHANGELOG
33657bd0f98dSmrg
3366