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