1291ca6f5Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2f66e55a2Smrg
3291ca6f5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
429459361Smrg
529459361Smrg# This file is free software; the Free Software Foundation
629459361Smrg# gives unlimited permission to copy and/or distribute it,
729459361Smrg# with or without modifications, as long as this notice is preserved.
829459361Smrg
929459361Smrg# This program is distributed in the hope that it will be useful,
1029459361Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1129459361Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1229459361Smrg# PARTICULAR PURPOSE.
1329459361Smrg
14f66e55a2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
155715adc0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
165715adc0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179683b4e0Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
189683b4e0Smrg[m4_warning([this file was generated for autoconf 2.72.
195715adc0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
205715adc0SmrgIf you have problems, you may need to regenerate the build system entirely.
21f66e55a2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
225715adc0Smrg
23291ca6f5Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24291ca6f5Smrg#
25291ca6f5Smrg# This file is free software; the Free Software Foundation
26291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
27291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
2827935385Smrg
29291ca6f5Smrg# AM_AUTOMAKE_VERSION(VERSION)
30291ca6f5Smrg# ----------------------------
31291ca6f5Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32291ca6f5Smrg# generated from the m4 files accompanying Automake X.Y.
33291ca6f5Smrg# (This private macro should not be called outside this file.)
34291ca6f5SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35291ca6f5Smrg[am__api_version='1.16'
36291ca6f5Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37291ca6f5Smrgdnl require some minimum version.  Point them to the right macro.
38291ca6f5Smrgm4_if([$1], [1.16.5], [],
39291ca6f5Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40291ca6f5Smrg])
4127935385Smrg
42291ca6f5Smrg# _AM_AUTOCONF_VERSION(VERSION)
43291ca6f5Smrg# -----------------------------
44291ca6f5Smrg# aclocal traces this macro to find the Autoconf version.
45291ca6f5Smrg# This is a private macro too.  Using m4_define simplifies
46291ca6f5Smrg# the logic in aclocal, which can simply ignore this definition.
47291ca6f5Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4829459361Smrg
49291ca6f5Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50291ca6f5Smrg# -------------------------------
51291ca6f5Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52291ca6f5Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53291ca6f5SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54291ca6f5Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55291ca6f5Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56291ca6f5Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57291ca6f5Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
585715adc0Smrg
59291ca6f5Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6029459361Smrg
61291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62291ca6f5Smrg#
63291ca6f5Smrg# This file is free software; the Free Software Foundation
64291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
65291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
6629459361Smrg
67291ca6f5Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68291ca6f5Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69291ca6f5Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70291ca6f5Smrg#
71291ca6f5Smrg# Of course, Automake must honor this variable whenever it calls a
72291ca6f5Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73291ca6f5Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74291ca6f5Smrg# depending on how configure is run.  This is pretty annoying, since
75291ca6f5Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76291ca6f5Smrg# source directory, any form will work fine, but in subdirectories a
77291ca6f5Smrg# relative path needs to be adjusted first.
78291ca6f5Smrg#
79291ca6f5Smrg# $ac_aux_dir/missing
80291ca6f5Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81291ca6f5Smrg# $top_srcdir/$ac_aux_dir/missing
82291ca6f5Smrg#    fails if $ac_aux_dir is absolute,
83291ca6f5Smrg#    fails when called from a subdirectory in a VPATH build with
84291ca6f5Smrg#          a relative $ac_aux_dir
85291ca6f5Smrg#
86291ca6f5Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87291ca6f5Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88291ca6f5Smrg# harmless because $srcdir is '.', but things will broke when you
89291ca6f5Smrg# start a VPATH build or use an absolute $srcdir.
90291ca6f5Smrg#
91291ca6f5Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92291ca6f5Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93291ca6f5Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94291ca6f5Smrg# and then we would define $MISSING as
95291ca6f5Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96291ca6f5Smrg# This will work as long as MISSING is not called from configure, because
97291ca6f5Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98291ca6f5Smrg# However there are other variables, like CC, which are often used in
99291ca6f5Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100291ca6f5Smrg#
101291ca6f5Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102291ca6f5Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103291ca6f5Smrg# configured tree to be moved without reconfiguration.
10429459361Smrg
105291ca6f5SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106291ca6f5Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107291ca6f5Smrg# Expand $ac_aux_dir to an absolute path.
108291ca6f5Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109291ca6f5Smrg])
11029459361Smrg
111291ca6f5Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11229459361Smrg
113291ca6f5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114291ca6f5Smrg#
115291ca6f5Smrg# This file is free software; the Free Software Foundation
116291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
117291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
11829459361Smrg
119291ca6f5Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120291ca6f5Smrg# -------------------------------------
121291ca6f5Smrg# Define a conditional.
122291ca6f5SmrgAC_DEFUN([AM_CONDITIONAL],
123291ca6f5Smrg[AC_PREREQ([2.52])dnl
124291ca6f5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125291ca6f5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126291ca6f5SmrgAC_SUBST([$1_TRUE])dnl
127291ca6f5SmrgAC_SUBST([$1_FALSE])dnl
128291ca6f5Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129291ca6f5Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130291ca6f5Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131291ca6f5Smrgif $2; then
132291ca6f5Smrg  $1_TRUE=
133291ca6f5Smrg  $1_FALSE='#'
134291ca6f5Smrgelse
135291ca6f5Smrg  $1_TRUE='#'
136291ca6f5Smrg  $1_FALSE=
137291ca6f5Smrgfi
138291ca6f5SmrgAC_CONFIG_COMMANDS_PRE(
139291ca6f5Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140291ca6f5Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141291ca6f5SmrgUsually this means the macro was only invoked conditionally.]])
142291ca6f5Smrgfi])])
14329459361Smrg
144291ca6f5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145291ca6f5Smrg#
146291ca6f5Smrg# This file is free software; the Free Software Foundation
147291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
148291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
14929459361Smrg
15029459361Smrg
151291ca6f5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152291ca6f5Smrg# written in clear, in which case automake, when reading aclocal.m4,
153291ca6f5Smrg# will think it sees a *use*, and therefore will trigger all it's
154291ca6f5Smrg# C support machinery.  Also note that it means that autoscan, seeing
155291ca6f5Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15629459361Smrg
15729459361Smrg
158291ca6f5Smrg# _AM_DEPENDENCIES(NAME)
159291ca6f5Smrg# ----------------------
160291ca6f5Smrg# See how the compiler implements dependency checking.
161291ca6f5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162291ca6f5Smrg# We try a few techniques and use that to set a single cache variable.
163291ca6f5Smrg#
164291ca6f5Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165291ca6f5Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166291ca6f5Smrg# dependency, and given that the user is not expected to run this macro,
167291ca6f5Smrg# just rely on AC_PROG_CC.
168291ca6f5SmrgAC_DEFUN([_AM_DEPENDENCIES],
169291ca6f5Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170291ca6f5SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171291ca6f5SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172291ca6f5SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17329459361Smrg
174291ca6f5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175291ca6f5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176291ca6f5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177291ca6f5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178291ca6f5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179291ca6f5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180291ca6f5Smrg                    [depcc="$$1"   am_compiler_list=])
18129459361Smrg
182291ca6f5SmrgAC_CACHE_CHECK([dependency style of $depcc],
183291ca6f5Smrg               [am_cv_$1_dependencies_compiler_type],
184291ca6f5Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185291ca6f5Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186291ca6f5Smrg  # making bogus files that we don't know about and never remove.  For
187291ca6f5Smrg  # instance it was reported that on HP-UX the gcc test will end up
188291ca6f5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189291ca6f5Smrg  # in D".
190291ca6f5Smrg  rm -rf conftest.dir
191291ca6f5Smrg  mkdir conftest.dir
192291ca6f5Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193291ca6f5Smrg  # using a relative directory.
194291ca6f5Smrg  cp "$am_depcomp" conftest.dir
195291ca6f5Smrg  cd conftest.dir
196291ca6f5Smrg  # We will build objects and dependencies in a subdirectory because
197291ca6f5Smrg  # it helps to detect inapplicable dependency modes.  For instance
198291ca6f5Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199291ca6f5Smrg  # side effect of compilation, but ICC will put the dependencies in
200291ca6f5Smrg  # the current directory while Tru64 will put them in the object
201291ca6f5Smrg  # directory.
202291ca6f5Smrg  mkdir sub
20329459361Smrg
204291ca6f5Smrg  am_cv_$1_dependencies_compiler_type=none
205291ca6f5Smrg  if test "$am_compiler_list" = ""; then
206291ca6f5Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207291ca6f5Smrg  fi
208291ca6f5Smrg  am__universal=false
209291ca6f5Smrg  m4_case([$1], [CC],
210291ca6f5Smrg    [case " $depcc " in #(
211291ca6f5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212291ca6f5Smrg     esac],
213291ca6f5Smrg    [CXX],
214291ca6f5Smrg    [case " $depcc " in #(
215291ca6f5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216291ca6f5Smrg     esac])
21729459361Smrg
218291ca6f5Smrg  for depmode in $am_compiler_list; do
219291ca6f5Smrg    # Setup a source with many dependencies, because some compilers
220291ca6f5Smrg    # like to wrap large dependency lists on column 80 (with \), and
221291ca6f5Smrg    # we should not choose a depcomp mode which is confused by this.
222291ca6f5Smrg    #
223291ca6f5Smrg    # We need to recreate these files for each test, as the compiler may
224291ca6f5Smrg    # overwrite some of them when testing with obscure command lines.
225291ca6f5Smrg    # This happens at least with the AIX C compiler.
226291ca6f5Smrg    : > sub/conftest.c
227291ca6f5Smrg    for i in 1 2 3 4 5 6; do
228291ca6f5Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229291ca6f5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230291ca6f5Smrg      # Solaris 10 /bin/sh.
231291ca6f5Smrg      echo '/* dummy */' > sub/conftst$i.h
232291ca6f5Smrg    done
233291ca6f5Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23429459361Smrg
235291ca6f5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236291ca6f5Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237291ca6f5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238291ca6f5Smrg    # versions had trouble with output in subdirs.
239291ca6f5Smrg    am__obj=sub/conftest.${OBJEXT-o}
240291ca6f5Smrg    am__minus_obj="-o $am__obj"
241291ca6f5Smrg    case $depmode in
242291ca6f5Smrg    gcc)
243291ca6f5Smrg      # This depmode causes a compiler race in universal mode.
244291ca6f5Smrg      test "$am__universal" = false || continue
245291ca6f5Smrg      ;;
246291ca6f5Smrg    nosideeffect)
247291ca6f5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248291ca6f5Smrg      # only be used when explicitly requested.
249291ca6f5Smrg      if test "x$enable_dependency_tracking" = xyes; then
250291ca6f5Smrg	continue
251291ca6f5Smrg      else
252291ca6f5Smrg	break
253291ca6f5Smrg      fi
254291ca6f5Smrg      ;;
255291ca6f5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256291ca6f5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257291ca6f5Smrg      # not run yet.  These depmodes are late enough in the game, and
258291ca6f5Smrg      # so weak that their functioning should not be impacted.
259291ca6f5Smrg      am__obj=conftest.${OBJEXT-o}
260291ca6f5Smrg      am__minus_obj=
261291ca6f5Smrg      ;;
262291ca6f5Smrg    none) break ;;
263291ca6f5Smrg    esac
264291ca6f5Smrg    if depmode=$depmode \
265291ca6f5Smrg       source=sub/conftest.c object=$am__obj \
266291ca6f5Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267291ca6f5Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268291ca6f5Smrg         >/dev/null 2>conftest.err &&
269291ca6f5Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270291ca6f5Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271291ca6f5Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272291ca6f5Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273291ca6f5Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274291ca6f5Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275291ca6f5Smrg      # that says an option was ignored or not supported.
276291ca6f5Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277291ca6f5Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278291ca6f5Smrg      # The diagnosis changed in icc 8.0:
279291ca6f5Smrg      #   icc: Command line remark: option '-MP' not supported
280291ca6f5Smrg      if (grep 'ignoring option' conftest.err ||
281291ca6f5Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282291ca6f5Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283291ca6f5Smrg        break
284291ca6f5Smrg      fi
285291ca6f5Smrg    fi
286291ca6f5Smrg  done
2875715adc0Smrg
288291ca6f5Smrg  cd ..
289291ca6f5Smrg  rm -rf conftest.dir
290291ca6f5Smrgelse
291291ca6f5Smrg  am_cv_$1_dependencies_compiler_type=none
292291ca6f5Smrgfi
293291ca6f5Smrg])
294291ca6f5SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295291ca6f5SmrgAM_CONDITIONAL([am__fastdep$1], [
296291ca6f5Smrg  test "x$enable_dependency_tracking" != xno \
297291ca6f5Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298291ca6f5Smrg])
29929459361Smrg
30027935385Smrg
301291ca6f5Smrg# AM_SET_DEPDIR
302291ca6f5Smrg# -------------
303291ca6f5Smrg# Choose a directory name for dependency files.
304291ca6f5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305291ca6f5SmrgAC_DEFUN([AM_SET_DEPDIR],
306291ca6f5Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307291ca6f5SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308291ca6f5Smrg])
30927935385Smrg
31027935385Smrg
311291ca6f5Smrg# AM_DEP_TRACK
312291ca6f5Smrg# ------------
313291ca6f5SmrgAC_DEFUN([AM_DEP_TRACK],
314291ca6f5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315291ca6f5SmrgAS_HELP_STRING(
316291ca6f5Smrg  [--enable-dependency-tracking],
317291ca6f5Smrg  [do not reject slow dependency extractors])
318291ca6f5SmrgAS_HELP_STRING(
319291ca6f5Smrg  [--disable-dependency-tracking],
320291ca6f5Smrg  [speeds up one-time build])])
321291ca6f5Smrgif test "x$enable_dependency_tracking" != xno; then
322291ca6f5Smrg  am_depcomp="$ac_aux_dir/depcomp"
323291ca6f5Smrg  AMDEPBACKSLASH='\'
324291ca6f5Smrg  am__nodep='_no'
325291ca6f5Smrgfi
326291ca6f5SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327291ca6f5SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328291ca6f5Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329291ca6f5SmrgAC_SUBST([am__nodep])dnl
330291ca6f5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331291ca6f5Smrg])
33227935385Smrg
333291ca6f5Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33427935385Smrg
335291ca6f5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33627935385Smrg#
337291ca6f5Smrg# This file is free software; the Free Software Foundation
338291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
339291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
34027935385Smrg
341291ca6f5Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342291ca6f5Smrg# ------------------------------
343291ca6f5SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344291ca6f5Smrg[{
345291ca6f5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346291ca6f5Smrg  # are listed without --file.  Let's play safe and only enable the eval
347291ca6f5Smrg  # if we detect the quoting.
348291ca6f5Smrg  # TODO: see whether this extra hack can be removed once we start
349291ca6f5Smrg  # requiring Autoconf 2.70 or later.
350291ca6f5Smrg  AS_CASE([$CONFIG_FILES],
351291ca6f5Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352291ca6f5Smrg          [*], [set x $CONFIG_FILES])
353291ca6f5Smrg  shift
354291ca6f5Smrg  # Used to flag and report bootstrapping failures.
355291ca6f5Smrg  am_rc=0
356291ca6f5Smrg  for am_mf
357291ca6f5Smrg  do
358291ca6f5Smrg    # Strip MF so we end up with the name of the file.
359291ca6f5Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360291ca6f5Smrg    # Check whether this is an Automake generated Makefile which includes
361291ca6f5Smrg    # dependency-tracking related rules and includes.
362291ca6f5Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363291ca6f5Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364291ca6f5Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365291ca6f5Smrg      || continue
366291ca6f5Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367291ca6f5Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368291ca6f5Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369291ca6f5Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370291ca6f5Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371291ca6f5Smrg  done
372291ca6f5Smrg  if test $am_rc -ne 0; then
373291ca6f5Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374291ca6f5Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375291ca6f5Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376291ca6f5Smrg    necessary).  You can also try re-running configure with the
377291ca6f5Smrg    '--disable-dependency-tracking' option to at least be able to build
378291ca6f5Smrg    the package (albeit without support for automatic dependency tracking).])
379291ca6f5Smrg  fi
380291ca6f5Smrg  AS_UNSET([am_dirpart])
381291ca6f5Smrg  AS_UNSET([am_filepart])
382291ca6f5Smrg  AS_UNSET([am_mf])
383291ca6f5Smrg  AS_UNSET([am_rc])
384291ca6f5Smrg  rm -f conftest-deps.mk
385291ca6f5Smrg}
386291ca6f5Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38729459361Smrg
38829459361Smrg
389291ca6f5Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390291ca6f5Smrg# -----------------------------
391291ca6f5Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39227935385Smrg#
393291ca6f5Smrg# This code is only required when automatic dependency tracking is enabled.
394291ca6f5Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395291ca6f5Smrg# order to bootstrap the dependency handling code.
396291ca6f5SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397291ca6f5Smrg[AC_CONFIG_COMMANDS([depfiles],
398291ca6f5Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399291ca6f5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40029459361Smrg
401291ca6f5Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40229459361Smrg
403291ca6f5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404291ca6f5Smrg#
405291ca6f5Smrg# This file is free software; the Free Software Foundation
406291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
407291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
40829459361Smrg
409291ca6f5Smrg# This macro actually does too much.  Some checks are only needed if
410291ca6f5Smrg# your package does certain things.  But this isn't really a big deal.
41129459361Smrg
412291ca6f5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413291ca6f5Smrgm4_define([AC_PROG_CC],
414291ca6f5Smrgm4_defn([AC_PROG_CC])
415291ca6f5Smrg[_AM_PROG_CC_C_O
416291ca6f5Smrg])
41729459361Smrg
418291ca6f5Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419291ca6f5Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420291ca6f5Smrg# -----------------------------------------------
421291ca6f5Smrg# The call with PACKAGE and VERSION arguments is the old style
422291ca6f5Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423291ca6f5Smrg# and VERSION should now be passed to AC_INIT and removed from
424291ca6f5Smrg# the call to AM_INIT_AUTOMAKE.
425291ca6f5Smrg# We support both call styles for the transition.  After
426291ca6f5Smrg# the next Automake release, Autoconf can make the AC_INIT
427291ca6f5Smrg# arguments mandatory, and then we can depend on a new Autoconf
428291ca6f5Smrg# release and drop the old call support.
429291ca6f5SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430291ca6f5Smrg[AC_PREREQ([2.65])dnl
431291ca6f5Smrgm4_ifdef([_$0_ALREADY_INIT],
432291ca6f5Smrg  [m4_fatal([$0 expanded multiple times
433291ca6f5Smrg]m4_defn([_$0_ALREADY_INIT]))],
434291ca6f5Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435291ca6f5Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436291ca6f5Smrgdnl the ones we care about.
437291ca6f5Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438291ca6f5SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439291ca6f5SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440291ca6f5Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441291ca6f5Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442291ca6f5Smrg  # is not polluted with repeated "-I."
443291ca6f5Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444291ca6f5Smrg  # test to see if srcdir already configured
445291ca6f5Smrg  if test -f $srcdir/config.status; then
446291ca6f5Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447291ca6f5Smrg  fi
44827935385Smrgfi
44929459361Smrg
450291ca6f5Smrg# test whether we have cygpath
451291ca6f5Smrgif test -z "$CYGPATH_W"; then
452291ca6f5Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453291ca6f5Smrg    CYGPATH_W='cygpath -w'
454291ca6f5Smrg  else
455291ca6f5Smrg    CYGPATH_W=echo
456291ca6f5Smrg  fi
45727935385Smrgfi
458291ca6f5SmrgAC_SUBST([CYGPATH_W])
45929459361Smrg
460291ca6f5Smrg# Define the identity of the package.
461291ca6f5Smrgdnl Distinguish between old-style and new-style calls.
462291ca6f5Smrgm4_ifval([$2],
463291ca6f5Smrg[AC_DIAGNOSE([obsolete],
464291ca6f5Smrg             [$0: two- and three-arguments forms are deprecated.])
465291ca6f5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466291ca6f5Smrg AC_SUBST([PACKAGE], [$1])dnl
467291ca6f5Smrg AC_SUBST([VERSION], [$2])],
468291ca6f5Smrg[_AM_SET_OPTIONS([$1])dnl
469291ca6f5Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470291ca6f5Smrgm4_if(
471291ca6f5Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472291ca6f5Smrg  [ok:ok],,
473291ca6f5Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474291ca6f5Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475291ca6f5Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47629459361Smrg
477291ca6f5Smrg_AM_IF_OPTION([no-define],,
478291ca6f5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479291ca6f5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48029459361Smrg
481291ca6f5Smrg# Some tools Automake needs.
482291ca6f5SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483291ca6f5SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484291ca6f5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485291ca6f5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486291ca6f5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487291ca6f5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488291ca6f5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489291ca6f5SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490291ca6f5SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491291ca6f5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492291ca6f5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493291ca6f5Smrg# dies out for good.  For more background, see:
494291ca6f5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495291ca6f5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496291ca6f5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497291ca6f5Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498291ca6f5Smrg# system "awk" is bad on some platforms.
499291ca6f5SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500291ca6f5SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501291ca6f5SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502291ca6f5Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503291ca6f5Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504291ca6f5Smrg			     [_AM_PROG_TAR([v7])])])
505291ca6f5Smrg_AM_IF_OPTION([no-dependencies],,
506291ca6f5Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507291ca6f5Smrg		  [_AM_DEPENDENCIES([CC])],
508291ca6f5Smrg		  [m4_define([AC_PROG_CC],
509291ca6f5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510291ca6f5SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511291ca6f5Smrg		  [_AM_DEPENDENCIES([CXX])],
512291ca6f5Smrg		  [m4_define([AC_PROG_CXX],
513291ca6f5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514291ca6f5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515291ca6f5Smrg		  [_AM_DEPENDENCIES([OBJC])],
516291ca6f5Smrg		  [m4_define([AC_PROG_OBJC],
517291ca6f5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518291ca6f5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519291ca6f5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520291ca6f5Smrg		  [m4_define([AC_PROG_OBJCXX],
521291ca6f5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522291ca6f5Smrg])
523291ca6f5Smrg# Variables for tags utilities; see am/tags.am
524291ca6f5Smrgif test -z "$CTAGS"; then
525291ca6f5Smrg  CTAGS=ctags
526291ca6f5Smrgfi
527291ca6f5SmrgAC_SUBST([CTAGS])
528291ca6f5Smrgif test -z "$ETAGS"; then
529291ca6f5Smrg  ETAGS=etags
530291ca6f5Smrgfi
531291ca6f5SmrgAC_SUBST([ETAGS])
532291ca6f5Smrgif test -z "$CSCOPE"; then
533291ca6f5Smrg  CSCOPE=cscope
534291ca6f5Smrgfi
535291ca6f5SmrgAC_SUBST([CSCOPE])
53629459361Smrg
537291ca6f5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538291ca6f5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539291ca6f5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540291ca6f5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541291ca6f5SmrgAC_CONFIG_COMMANDS_PRE(dnl
542291ca6f5Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543291ca6f5Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54429459361Smrg
545291ca6f5Smrg# POSIX will say in a future version that running "rm -f" with no argument
546291ca6f5Smrg# is OK; and we want to be able to make that assumption in our Makefile
547291ca6f5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548291ca6f5Smrg# actually supported "in the wild" to an acceptable degree.
549291ca6f5Smrg# See automake bug#10828.
550291ca6f5Smrg# To make any issue more visible, cause the running configure to be aborted
551291ca6f5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552291ca6f5Smrg# user can still override this though.
553291ca6f5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554291ca6f5Smrg  cat >&2 <<'END'
555291ca6f5SmrgOops!
55629459361Smrg
557291ca6f5SmrgYour 'rm' program seems unable to run without file operands specified
558291ca6f5Smrgon the command line, even when the '-f' option is present.  This is contrary
559291ca6f5Smrgto the behaviour of most rm programs out there, and not conforming with
560291ca6f5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56129459361Smrg
562291ca6f5SmrgPlease tell bug-automake@gnu.org about your system, including the value
563291ca6f5Smrgof your $PATH and any error possibly output before this message.  This
564291ca6f5Smrgcan help us improve future automake versions.
56529459361Smrg
566291ca6f5SmrgEND
567291ca6f5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568291ca6f5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569291ca6f5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570291ca6f5Smrg    echo >&2
571291ca6f5Smrg  else
572291ca6f5Smrg    cat >&2 <<'END'
573291ca6f5SmrgAborting the configuration process, to ensure you take notice of the issue.
57429459361Smrg
575291ca6f5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576291ca6f5Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57729459361Smrg
578291ca6f5SmrgIf you want to complete the configuration process using your problematic
579291ca6f5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580291ca6f5Smrgto "yes", and re-run configure.
5815715adc0Smrg
582291ca6f5SmrgEND
583291ca6f5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584291ca6f5Smrg  fi
58527935385Smrgfi
586291ca6f5Smrgdnl The trailing newline in this macro's definition is deliberate, for
587291ca6f5Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588291ca6f5Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589291ca6f5Smrg])
59029459361Smrg
591291ca6f5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592291ca6f5Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593291ca6f5Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594291ca6f5Smrgm4_define([_AC_COMPILER_EXEEXT],
595291ca6f5Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
59629459361Smrg
597291ca6f5Smrg# When config.status generates a header, we must update the stamp-h file.
598291ca6f5Smrg# This file resides in the same directory as the config header
599291ca6f5Smrg# that is generated.  The stamp files are numbered to have different names.
60029459361Smrg
601291ca6f5Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602291ca6f5Smrg# loop where config.status creates the headers, so we can generate
603291ca6f5Smrg# our stamp files there.
604291ca6f5SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605291ca6f5Smrg[# Compute $1's index in $config_headers.
606291ca6f5Smrg_am_arg=$1
607291ca6f5Smrg_am_stamp_count=1
608291ca6f5Smrgfor _am_header in $config_headers :; do
609291ca6f5Smrg  case $_am_header in
610291ca6f5Smrg    $_am_arg | $_am_arg:* )
611291ca6f5Smrg      break ;;
612291ca6f5Smrg    * )
613291ca6f5Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614291ca6f5Smrg  esac
615291ca6f5Smrgdone
616291ca6f5Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61729459361Smrg
618291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619291ca6f5Smrg#
620291ca6f5Smrg# This file is free software; the Free Software Foundation
621291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
622291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
623291ca6f5Smrg
624291ca6f5Smrg# AM_PROG_INSTALL_SH
625291ca6f5Smrg# ------------------
626291ca6f5Smrg# Define $install_sh.
627291ca6f5SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628291ca6f5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629291ca6f5Smrgif test x"${install_sh+set}" != xset; then
630291ca6f5Smrg  case $am_aux_dir in
631291ca6f5Smrg  *\ * | *\	*)
632291ca6f5Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633291ca6f5Smrg  *)
634291ca6f5Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635291ca6f5Smrg  esac
636291ca6f5Smrgfi
637291ca6f5SmrgAC_SUBST([install_sh])])
638291ca6f5Smrg
639291ca6f5Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640291ca6f5Smrg#
641291ca6f5Smrg# This file is free software; the Free Software Foundation
642291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
643291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
644291ca6f5Smrg
645291ca6f5Smrg# Check whether the underlying file-system supports filenames
646291ca6f5Smrg# with a leading dot.  For instance MS-DOS doesn't.
647291ca6f5SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648291ca6f5Smrg[rm -rf .tst 2>/dev/null
649291ca6f5Smrgmkdir .tst 2>/dev/null
650291ca6f5Smrgif test -d .tst; then
651291ca6f5Smrg  am__leading_dot=.
65229459361Smrgelse
653291ca6f5Smrg  am__leading_dot=_
65429459361Smrgfi
655291ca6f5Smrgrmdir .tst 2>/dev/null
656291ca6f5SmrgAC_SUBST([am__leading_dot])])
65729459361Smrg
658291ca6f5Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65929459361Smrg
660291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661291ca6f5Smrg#
662291ca6f5Smrg# This file is free software; the Free Software Foundation
663291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
664291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
66529459361Smrg
666291ca6f5Smrg# AM_MAKE_INCLUDE()
667291ca6f5Smrg# -----------------
668291ca6f5Smrg# Check whether make has an 'include' directive that can support all
669291ca6f5Smrg# the idioms we need for our automatic dependency tracking code.
670291ca6f5SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671291ca6f5Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672291ca6f5Smrgcat > confinc.mk << 'END'
673291ca6f5Smrgam__doit:
674291ca6f5Smrg	@echo this is the am__doit target >confinc.out
675291ca6f5Smrg.PHONY: am__doit
676291ca6f5SmrgEND
677291ca6f5Smrgam__include="#"
678291ca6f5Smrgam__quote=
679291ca6f5Smrg# BSD make does it like this.
680291ca6f5Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681291ca6f5Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682291ca6f5Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683291ca6f5Smrg_am_result=no
684291ca6f5Smrgfor s in GNU BSD; do
685291ca6f5Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686291ca6f5Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687291ca6f5Smrg      ['0:this is the am__doit target'],
688291ca6f5Smrg      [AS_CASE([$s],
689291ca6f5Smrg          [BSD], [am__include='.include' am__quote='"'],
690291ca6f5Smrg          [am__include='include' am__quote=''])])
691291ca6f5Smrg  if test "$am__include" != "#"; then
692291ca6f5Smrg    _am_result="yes ($s style)"
693291ca6f5Smrg    break
694291ca6f5Smrg  fi
695291ca6f5Smrgdone
696291ca6f5Smrgrm -f confinc.* confmf.*
697291ca6f5SmrgAC_MSG_RESULT([${_am_result}])
698291ca6f5SmrgAC_SUBST([am__include])])
699291ca6f5SmrgAC_SUBST([am__quote])])
70029459361Smrg
701291ca6f5Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70229459361Smrg
703291ca6f5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70429459361Smrg#
705291ca6f5Smrg# This file is free software; the Free Software Foundation
706291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
707291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
70829459361Smrg
709291ca6f5Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710291ca6f5Smrg# ------------------------------
711291ca6f5SmrgAC_DEFUN([AM_MISSING_PROG],
712291ca6f5Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713291ca6f5Smrg$1=${$1-"${am_missing_run}$2"}
714291ca6f5SmrgAC_SUBST($1)])
71529459361Smrg
716291ca6f5Smrg# AM_MISSING_HAS_RUN
717291ca6f5Smrg# ------------------
718291ca6f5Smrg# Define MISSING if not defined so far and test if it is modern enough.
719291ca6f5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720291ca6f5SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721291ca6f5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722291ca6f5SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723291ca6f5Smrgif test x"${MISSING+set}" != xset; then
724291ca6f5Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72529459361Smrgfi
726291ca6f5Smrg# Use eval to expand $SHELL
727291ca6f5Smrgif eval "$MISSING --is-lightweight"; then
728291ca6f5Smrg  am_missing_run="$MISSING "
729291ca6f5Smrgelse
730291ca6f5Smrg  am_missing_run=
731291ca6f5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73227935385Smrgfi
733291ca6f5Smrg])
73429459361Smrg
735291ca6f5Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73629459361Smrg
737291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738291ca6f5Smrg#
739291ca6f5Smrg# This file is free software; the Free Software Foundation
740291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
741291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
74229459361Smrg
743291ca6f5Smrg# _AM_MANGLE_OPTION(NAME)
744291ca6f5Smrg# -----------------------
745291ca6f5SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746291ca6f5Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74729459361Smrg
748291ca6f5Smrg# _AM_SET_OPTION(NAME)
749291ca6f5Smrg# --------------------
750291ca6f5Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751291ca6f5SmrgAC_DEFUN([_AM_SET_OPTION],
752291ca6f5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75329459361Smrg
754291ca6f5Smrg# _AM_SET_OPTIONS(OPTIONS)
755291ca6f5Smrg# ------------------------
756291ca6f5Smrg# OPTIONS is a space-separated list of Automake options.
757291ca6f5SmrgAC_DEFUN([_AM_SET_OPTIONS],
758291ca6f5Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759291ca6f5Smrg
760291ca6f5Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761291ca6f5Smrg# -------------------------------------------
762291ca6f5Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763291ca6f5SmrgAC_DEFUN([_AM_IF_OPTION],
764291ca6f5Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765291ca6f5Smrg
766291ca6f5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76727935385Smrg#
768291ca6f5Smrg# This file is free software; the Free Software Foundation
769291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
770291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
771f66e55a2Smrg
772291ca6f5Smrg# _AM_PROG_CC_C_O
773291ca6f5Smrg# ---------------
774291ca6f5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775291ca6f5Smrg# to automatically call this.
776291ca6f5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777291ca6f5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778291ca6f5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779291ca6f5SmrgAC_LANG_PUSH([C])dnl
780291ca6f5SmrgAC_CACHE_CHECK(
781291ca6f5Smrg  [whether $CC understands -c and -o together],
782291ca6f5Smrg  [am_cv_prog_cc_c_o],
783291ca6f5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784291ca6f5Smrg  # Make sure it works both with $CC and with simple cc.
785291ca6f5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786291ca6f5Smrg  # compilers refuse to overwrite an existing .o file with -o,
787291ca6f5Smrg  # though they will create one.
788291ca6f5Smrg  am_cv_prog_cc_c_o=yes
789291ca6f5Smrg  for am_i in 1 2; do
790291ca6f5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791291ca6f5Smrg         && test -f conftest2.$ac_objext; then
792291ca6f5Smrg      : OK
793291ca6f5Smrg    else
794291ca6f5Smrg      am_cv_prog_cc_c_o=no
795291ca6f5Smrg      break
796291ca6f5Smrg    fi
797291ca6f5Smrg  done
798291ca6f5Smrg  rm -f core conftest*
799291ca6f5Smrg  unset am_i])
800291ca6f5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801291ca6f5Smrg   # Losing compiler, so override with the script.
802291ca6f5Smrg   # FIXME: It is wrong to rewrite CC.
803291ca6f5Smrg   # But if we don't then we get into trouble of one sort or another.
804291ca6f5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805291ca6f5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806291ca6f5Smrg   CC="$am_aux_dir/compile $CC"
807f66e55a2Smrgfi
808291ca6f5SmrgAC_LANG_POP([C])])
8095715adc0Smrg
810291ca6f5Smrg# For backward compatibility.
811291ca6f5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8125715adc0Smrg
813291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81429459361Smrg#
815291ca6f5Smrg# This file is free software; the Free Software Foundation
816291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
817291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
81829459361Smrg
819291ca6f5Smrg# AM_RUN_LOG(COMMAND)
820291ca6f5Smrg# -------------------
821291ca6f5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822291ca6f5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823291ca6f5SmrgAC_DEFUN([AM_RUN_LOG],
824291ca6f5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825291ca6f5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826291ca6f5Smrg   ac_status=$?
827291ca6f5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828291ca6f5Smrg   (exit $ac_status); }])
829291ca6f5Smrg
830291ca6f5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831291ca6f5Smrg
832291ca6f5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83329459361Smrg#
834291ca6f5Smrg# This file is free software; the Free Software Foundation
835291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
836291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
83729459361Smrg
838291ca6f5Smrg# AM_SANITY_CHECK
839291ca6f5Smrg# ---------------
840291ca6f5SmrgAC_DEFUN([AM_SANITY_CHECK],
841291ca6f5Smrg[AC_MSG_CHECKING([whether build environment is sane])
842291ca6f5Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843291ca6f5Smrg# name.  Accept space and tab only in the latter.
844291ca6f5Smrgam_lf='
845291ca6f5Smrg'
846291ca6f5Smrgcase `pwd` in
847291ca6f5Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848291ca6f5Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849291ca6f5Smrgesac
850291ca6f5Smrgcase $srcdir in
851291ca6f5Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852291ca6f5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853291ca6f5Smrgesac
854291ca6f5Smrg
855291ca6f5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856291ca6f5Smrg# arguments.  Must try -L first in case configure is actually a
857291ca6f5Smrg# symlink; some systems play weird games with the mod time of symlinks
858291ca6f5Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859291ca6f5Smrg# directory).
860291ca6f5Smrgif (
861291ca6f5Smrg   am_has_slept=no
862291ca6f5Smrg   for am_try in 1 2; do
863291ca6f5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864291ca6f5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865291ca6f5Smrg     if test "$[*]" = "X"; then
866291ca6f5Smrg	# -L didn't work.
867291ca6f5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868291ca6f5Smrg     fi
869291ca6f5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870291ca6f5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871291ca6f5Smrg
872291ca6f5Smrg	# If neither matched, then we have a broken ls.  This can happen
873291ca6f5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874291ca6f5Smrg	# broken ls alias from the environment.  This has actually
875291ca6f5Smrg	# happened.  Such a system could not be considered "sane".
876291ca6f5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877291ca6f5Smrg  alias in your environment])
878291ca6f5Smrg     fi
879291ca6f5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880291ca6f5Smrg       break
881291ca6f5Smrg     fi
882291ca6f5Smrg     # Just in case.
883291ca6f5Smrg     sleep 1
884291ca6f5Smrg     am_has_slept=yes
885291ca6f5Smrg   done
886291ca6f5Smrg   test "$[2]" = conftest.file
887291ca6f5Smrg   )
888291ca6f5Smrgthen
889291ca6f5Smrg   # Ok.
890291ca6f5Smrg   :
89127935385Smrgelse
892291ca6f5Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893291ca6f5SmrgCheck your system clock])
89427935385Smrgfi
895291ca6f5SmrgAC_MSG_RESULT([yes])
896291ca6f5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897291ca6f5Smrg# generated files are strictly newer.
898291ca6f5Smrgam_sleep_pid=
899291ca6f5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900291ca6f5Smrg  ( sleep 1 ) &
901291ca6f5Smrg  am_sleep_pid=$!
902291ca6f5Smrgfi
903291ca6f5SmrgAC_CONFIG_COMMANDS_PRE(
904291ca6f5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905291ca6f5Smrg   if test -n "$am_sleep_pid"; then
906291ca6f5Smrg     # Hide warnings about reused PIDs.
907291ca6f5Smrg     wait $am_sleep_pid 2>/dev/null
908291ca6f5Smrg   fi
909291ca6f5Smrg   AC_MSG_RESULT([done])])
910291ca6f5Smrgrm -f conftest.file
911291ca6f5Smrg])
912f66e55a2Smrg
913291ca6f5Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914f66e55a2Smrg#
915291ca6f5Smrg# This file is free software; the Free Software Foundation
916291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
917291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
918f66e55a2Smrg
919291ca6f5Smrg# AM_SILENT_RULES([DEFAULT])
920291ca6f5Smrg# --------------------------
921291ca6f5Smrg# Enable less verbose build rules; with the default set to DEFAULT
922291ca6f5Smrg# ("yes" being less verbose, "no" or empty being verbose).
923291ca6f5SmrgAC_DEFUN([AM_SILENT_RULES],
924291ca6f5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925291ca6f5SmrgAS_HELP_STRING(
926291ca6f5Smrg  [--enable-silent-rules],
927291ca6f5Smrg  [less verbose build output (undo: "make V=1")])
928291ca6f5SmrgAS_HELP_STRING(
929291ca6f5Smrg  [--disable-silent-rules],
930291ca6f5Smrg  [verbose build output (undo: "make V=0")])dnl
931291ca6f5Smrg])
932291ca6f5Smrgcase $enable_silent_rules in @%:@ (((
933291ca6f5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934291ca6f5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935291ca6f5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936291ca6f5Smrgesac
937291ca6f5Smrgdnl
938291ca6f5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939291ca6f5Smrgdnl do not support nested variable expansions.
940291ca6f5Smrgdnl See automake bug#9928 and bug#10237.
941291ca6f5Smrgam_make=${MAKE-make}
942291ca6f5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943291ca6f5Smrg   [am_cv_make_support_nested_variables],
944291ca6f5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945291ca6f5SmrgBAR0=false
946291ca6f5SmrgBAR1=true
947291ca6f5SmrgV=1
948291ca6f5Smrgam__doit:
949291ca6f5Smrg	@$(TRUE)
950291ca6f5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951291ca6f5Smrg  am_cv_make_support_nested_variables=yes
952f66e55a2Smrgelse
953291ca6f5Smrg  am_cv_make_support_nested_variables=no
954291ca6f5Smrgfi])
955291ca6f5Smrgif test $am_cv_make_support_nested_variables = yes; then
956291ca6f5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957291ca6f5Smrg  AM_V='$(V)'
958291ca6f5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959291ca6f5Smrgelse
960291ca6f5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961291ca6f5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96227935385Smrgfi
963291ca6f5SmrgAC_SUBST([AM_V])dnl
964291ca6f5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965291ca6f5SmrgAC_SUBST([AM_DEFAULT_V])dnl
966291ca6f5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967291ca6f5SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968291ca6f5SmrgAM_BACKSLASH='\'
969291ca6f5SmrgAC_SUBST([AM_BACKSLASH])dnl
970291ca6f5Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971291ca6f5Smrg])
972f66e55a2Smrg
973291ca6f5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974f66e55a2Smrg#
975291ca6f5Smrg# This file is free software; the Free Software Foundation
976291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
977291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
978f66e55a2Smrg
979291ca6f5Smrg# AM_PROG_INSTALL_STRIP
980291ca6f5Smrg# ---------------------
981291ca6f5Smrg# One issue with vendor 'install' (even GNU) is that you can't
982291ca6f5Smrg# specify the program used to strip binaries.  This is especially
983291ca6f5Smrg# annoying in cross-compiling environments, where the build's strip
984291ca6f5Smrg# is unlikely to handle the host's binaries.
985291ca6f5Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986291ca6f5Smrg# always use install-sh in "make install-strip", and initialize
987291ca6f5Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988291ca6f5SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989291ca6f5Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990291ca6f5Smrg# Installed binaries are usually stripped using 'strip' when the user
991291ca6f5Smrg# run "make install-strip".  However 'strip' might not be the right
992291ca6f5Smrg# tool to use in cross-compilation environments, therefore Automake
993291ca6f5Smrg# will honor the 'STRIP' environment variable to overrule this program.
994291ca6f5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995291ca6f5Smrgif test "$cross_compiling" != no; then
996291ca6f5Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99727935385Smrgfi
998291ca6f5SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999291ca6f5SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100029459361Smrg
1001291ca6f5Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100229459361Smrg#
1003291ca6f5Smrg# This file is free software; the Free Software Foundation
1004291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
1005291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
100629459361Smrg
1007291ca6f5Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008291ca6f5Smrg# ---------------------------
1009291ca6f5Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010291ca6f5Smrg# This macro is traced by Automake.
1011291ca6f5SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101229459361Smrg
1013291ca6f5Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014291ca6f5Smrg# --------------------------
1015291ca6f5Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016291ca6f5SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101729459361Smrg
1018291ca6f5Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101929459361Smrg
1020291ca6f5Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102127935385Smrg#
1022291ca6f5Smrg# This file is free software; the Free Software Foundation
1023291ca6f5Smrg# gives unlimited permission to copy and/or distribute it,
1024291ca6f5Smrg# with or without modifications, as long as this notice is preserved.
1025291ca6f5Smrg
1026291ca6f5Smrg# _AM_PROG_TAR(FORMAT)
1027291ca6f5Smrg# --------------------
1028291ca6f5Smrg# Check how to create a tarball in format FORMAT.
1029291ca6f5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103027935385Smrg#
1031291ca6f5Smrg# Substitute a variable $(am__tar) that is a command
1032291ca6f5Smrg# writing to stdout a FORMAT-tarball containing the directory
1033291ca6f5Smrg# $tardir.
1034291ca6f5Smrg#     tardir=directory && $(am__tar) > result.tar
103527935385Smrg#
1036291ca6f5Smrg# Substitute a variable $(am__untar) that extract such
1037291ca6f5Smrg# a tarball read from stdin.
1038291ca6f5Smrg#     $(am__untar) < result.tar
103927935385Smrg#
1040291ca6f5SmrgAC_DEFUN([_AM_PROG_TAR],
1041291ca6f5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042291ca6f5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043291ca6f5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104429459361Smrg
1045291ca6f5Smrg# We'll loop over all known methods to create a tar archive until one works.
1046291ca6f5Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104729459361Smrg
1048291ca6f5Smrgm4_if([$1], [v7],
1049291ca6f5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105029459361Smrg
1051291ca6f5Smrg  [m4_case([$1],
1052291ca6f5Smrg    [ustar],
1053291ca6f5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054291ca6f5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055291ca6f5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056291ca6f5Smrg      # and bug#13588).
1057291ca6f5Smrg      am_max_uid=2097151 # 2^21 - 1
1058291ca6f5Smrg      am_max_gid=$am_max_uid
1059291ca6f5Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060291ca6f5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061291ca6f5Smrg      # below are definitely unexpected, so allow the users to see them
1062291ca6f5Smrg      # (that is, avoid stderr redirection).
1063291ca6f5Smrg      am_uid=`id -u || echo unknown`
1064291ca6f5Smrg      am_gid=`id -g || echo unknown`
1065291ca6f5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066291ca6f5Smrg      if test $am_uid -le $am_max_uid; then
1067291ca6f5Smrg         AC_MSG_RESULT([yes])
1068291ca6f5Smrg      else
1069291ca6f5Smrg         AC_MSG_RESULT([no])
1070291ca6f5Smrg         _am_tools=none
1071291ca6f5Smrg      fi
1072291ca6f5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073291ca6f5Smrg      if test $am_gid -le $am_max_gid; then
1074291ca6f5Smrg         AC_MSG_RESULT([yes])
1075291ca6f5Smrg      else
1076291ca6f5Smrg        AC_MSG_RESULT([no])
1077291ca6f5Smrg        _am_tools=none
1078291ca6f5Smrg      fi],
1079c3c9b392Smrg
1080291ca6f5Smrg  [pax],
1081291ca6f5Smrg    [],
1082c3c9b392Smrg
1083291ca6f5Smrg  [m4_fatal([Unknown tar format])])
1084f66e55a2Smrg
1085291ca6f5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086f66e55a2Smrg
1087291ca6f5Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088291ca6f5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089291ca6f5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090f66e55a2Smrg
1091291ca6f5Smrg  for _am_tool in $_am_tools; do
1092291ca6f5Smrg    case $_am_tool in
1093291ca6f5Smrg    gnutar)
1094291ca6f5Smrg      for _am_tar in tar gnutar gtar; do
1095291ca6f5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096291ca6f5Smrg      done
1097291ca6f5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098291ca6f5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099291ca6f5Smrg      am__untar="$_am_tar -xf -"
1100291ca6f5Smrg      ;;
1101291ca6f5Smrg    plaintar)
1102291ca6f5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103291ca6f5Smrg      # ustar tarball either.
1104291ca6f5Smrg      (tar --version) >/dev/null 2>&1 && continue
1105291ca6f5Smrg      am__tar='tar chf - "$$tardir"'
1106291ca6f5Smrg      am__tar_='tar chf - "$tardir"'
1107291ca6f5Smrg      am__untar='tar xf -'
1108291ca6f5Smrg      ;;
1109291ca6f5Smrg    pax)
1110291ca6f5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111291ca6f5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112291ca6f5Smrg      am__untar='pax -r'
1113291ca6f5Smrg      ;;
1114291ca6f5Smrg    cpio)
1115291ca6f5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116291ca6f5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117291ca6f5Smrg      am__untar='cpio -i -H $1 -d'
1118291ca6f5Smrg      ;;
1119291ca6f5Smrg    none)
1120291ca6f5Smrg      am__tar=false
1121291ca6f5Smrg      am__tar_=false
1122291ca6f5Smrg      am__untar=false
1123291ca6f5Smrg      ;;
1124291ca6f5Smrg    esac
1125f66e55a2Smrg
1126291ca6f5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127291ca6f5Smrg    # and am__untar set.
1128291ca6f5Smrg    test -n "${am_cv_prog_tar_$1}" && break
112927935385Smrg
1130291ca6f5Smrg    # tar/untar a dummy directory, and stop if the command works.
1131291ca6f5Smrg    rm -rf conftest.dir
1132291ca6f5Smrg    mkdir conftest.dir
1133291ca6f5Smrg    echo GrepMe > conftest.dir/file
1134291ca6f5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135291ca6f5Smrg    rm -rf conftest.dir
1136291ca6f5Smrg    if test -s conftest.tar; then
1137291ca6f5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138291ca6f5Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139291ca6f5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140291ca6f5Smrg    fi
1141291ca6f5Smrg  done
1142291ca6f5Smrg  rm -rf conftest.dir
1143c3c9b392Smrg
1144291ca6f5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145291ca6f5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146c3c9b392Smrg
1147291ca6f5SmrgAC_SUBST([am__tar])
1148291ca6f5SmrgAC_SUBST([am__untar])
1149291ca6f5Smrg]) # _AM_PROG_TAR
115027935385Smrg
1151291ca6f5Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152291ca6f5Smrgdnl serial 11 (pkg-config-0.29)
1153291ca6f5Smrgdnl
1154291ca6f5Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155291ca6f5Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156291ca6f5Smrgdnl
1157291ca6f5Smrgdnl This program is free software; you can redistribute it and/or modify
1158291ca6f5Smrgdnl it under the terms of the GNU General Public License as published by
1159291ca6f5Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160291ca6f5Smrgdnl (at your option) any later version.
1161291ca6f5Smrgdnl
1162291ca6f5Smrgdnl This program is distributed in the hope that it will be useful, but
1163291ca6f5Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164291ca6f5Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165291ca6f5Smrgdnl General Public License for more details.
1166291ca6f5Smrgdnl
1167291ca6f5Smrgdnl You should have received a copy of the GNU General Public License
1168291ca6f5Smrgdnl along with this program; if not, write to the Free Software
1169291ca6f5Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170291ca6f5Smrgdnl 02111-1307, USA.
1171291ca6f5Smrgdnl
1172291ca6f5Smrgdnl As a special exception to the GNU General Public License, if you
1173291ca6f5Smrgdnl distribute this file as part of a program that contains a
1174291ca6f5Smrgdnl configuration script generated by Autoconf, you may include it under
1175291ca6f5Smrgdnl the same distribution terms that you use for the rest of that
1176291ca6f5Smrgdnl program.
117727935385Smrg
1178291ca6f5Smrgdnl PKG_PREREQ(MIN-VERSION)
1179291ca6f5Smrgdnl -----------------------
1180291ca6f5Smrgdnl Since: 0.29
1181291ca6f5Smrgdnl
1182291ca6f5Smrgdnl Verify that the version of the pkg-config macros are at least
1183291ca6f5Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184291ca6f5Smrgdnl installed version of pkg-config, this checks the developer's version
1185291ca6f5Smrgdnl of pkg.m4 when generating configure.
1186291ca6f5Smrgdnl
1187291ca6f5Smrgdnl To ensure that this macro is defined, also add:
1188291ca6f5Smrgdnl m4_ifndef([PKG_PREREQ],
1189291ca6f5Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190291ca6f5Smrgdnl
1191291ca6f5Smrgdnl See the "Since" comment for each macro you use to see what version
1192291ca6f5Smrgdnl of the macros you require.
1193291ca6f5Smrgm4_defun([PKG_PREREQ],
1194291ca6f5Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195291ca6f5Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196291ca6f5Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197291ca6f5Smrg])dnl PKG_PREREQ
119827935385Smrg
1199291ca6f5Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200291ca6f5Smrgdnl ----------------------------------
1201291ca6f5Smrgdnl Since: 0.16
1202291ca6f5Smrgdnl
1203291ca6f5Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204291ca6f5Smrgdnl first found in the path. Checks that the version of pkg-config found
1205291ca6f5Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206291ca6f5Smrgdnl used since that's the first version where most current features of
1207291ca6f5Smrgdnl pkg-config existed.
1208291ca6f5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209291ca6f5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210291ca6f5Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211291ca6f5Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212291ca6f5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213291ca6f5SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214291ca6f5SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
121527935385Smrg
1216291ca6f5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217291ca6f5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218c3c9b392Smrgfi
1219291ca6f5Smrgif test -n "$PKG_CONFIG"; then
1220291ca6f5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221291ca6f5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222291ca6f5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223291ca6f5Smrg		AC_MSG_RESULT([yes])
1224291ca6f5Smrg	else
1225291ca6f5Smrg		AC_MSG_RESULT([no])
1226291ca6f5Smrg		PKG_CONFIG=""
1227291ca6f5Smrg	fi
1228291ca6f5Smrgfi[]dnl
1229291ca6f5Smrg])dnl PKG_PROG_PKG_CONFIG
1230c3c9b392Smrg
1231291ca6f5Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232291ca6f5Smrgdnl -------------------------------------------------------------------
1233291ca6f5Smrgdnl Since: 0.18
1234291ca6f5Smrgdnl
1235291ca6f5Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236291ca6f5Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237291ca6f5Smrgdnl
1238291ca6f5Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239291ca6f5Smrgdnl only at the first occurence in configure.ac, so if the first place
1240291ca6f5Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241291ca6f5Smrgdnl have to call PKG_CHECK_EXISTS manually
1242291ca6f5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243291ca6f5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244291ca6f5Smrgif test -n "$PKG_CONFIG" && \
1245291ca6f5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246291ca6f5Smrg  m4_default([$2], [:])
1247291ca6f5Smrgm4_ifvaln([$3], [else
1248291ca6f5Smrg  $3])dnl
1249291ca6f5Smrgfi])
1250291ca6f5Smrg
1251291ca6f5Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252291ca6f5Smrgdnl ---------------------------------------------
1253291ca6f5Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254291ca6f5Smrgdnl pkg_failed based on the result.
1255291ca6f5Smrgm4_define([_PKG_CONFIG],
1256291ca6f5Smrg[if test -n "$$1"; then
1257291ca6f5Smrg    pkg_cv_[]$1="$$1"
1258291ca6f5Smrg elif test -n "$PKG_CONFIG"; then
1259291ca6f5Smrg    PKG_CHECK_EXISTS([$3],
1260291ca6f5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261291ca6f5Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262291ca6f5Smrg		     [pkg_failed=yes])
1263291ca6f5Smrg else
1264291ca6f5Smrg    pkg_failed=untried
1265291ca6f5Smrgfi[]dnl
1266291ca6f5Smrg])dnl _PKG_CONFIG
1267291ca6f5Smrg
1268291ca6f5Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269291ca6f5Smrgdnl ---------------------------
1270291ca6f5Smrgdnl Internal check to see if pkg-config supports short errors.
1271291ca6f5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272291ca6f5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273291ca6f5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274291ca6f5Smrg        _pkg_short_errors_supported=yes
127527935385Smrgelse
1276291ca6f5Smrg        _pkg_short_errors_supported=no
1277291ca6f5Smrgfi[]dnl
1278291ca6f5Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279c3c9b392Smrg
1280c3c9b392Smrg
1281291ca6f5Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282291ca6f5Smrgdnl   [ACTION-IF-NOT-FOUND])
1283291ca6f5Smrgdnl --------------------------------------------------------------
1284291ca6f5Smrgdnl Since: 0.4.0
1285291ca6f5Smrgdnl
1286291ca6f5Smrgdnl Note that if there is a possibility the first call to
1287291ca6f5Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288291ca6f5Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289291ca6f5SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290291ca6f5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291291ca6f5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292291ca6f5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129327935385Smrg
1294291ca6f5Smrgpkg_failed=no
1295291ca6f5SmrgAC_MSG_CHECKING([for $1])
129627935385Smrg
1297291ca6f5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298291ca6f5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129927935385Smrg
1300291ca6f5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301291ca6f5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302291ca6f5SmrgSee the pkg-config man page for more details.])
130327935385Smrg
1304291ca6f5Smrgif test $pkg_failed = yes; then
1305291ca6f5Smrg   	AC_MSG_RESULT([no])
1306291ca6f5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307291ca6f5Smrg        if test $_pkg_short_errors_supported = yes; then
1308291ca6f5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309291ca6f5Smrg        else 
1310291ca6f5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311291ca6f5Smrg        fi
1312291ca6f5Smrg	# Put the nasty error message in config.log where it belongs
1313291ca6f5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131427935385Smrg
1315291ca6f5Smrg	m4_default([$4], [AC_MSG_ERROR(
1316291ca6f5Smrg[Package requirements ($2) were not met:
131727935385Smrg
1318291ca6f5Smrg$$1_PKG_ERRORS
1319291ca6f5Smrg
1320291ca6f5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321291ca6f5Smrginstalled software in a non-standard prefix.
1322291ca6f5Smrg
1323291ca6f5Smrg_PKG_TEXT])[]dnl
1324291ca6f5Smrg        ])
1325291ca6f5Smrgelif test $pkg_failed = untried; then
1326291ca6f5Smrg     	AC_MSG_RESULT([no])
1327291ca6f5Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328291ca6f5Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329291ca6f5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330291ca6f5Smrgpath to pkg-config.
1331291ca6f5Smrg
1332291ca6f5Smrg_PKG_TEXT
1333291ca6f5Smrg
1334291ca6f5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335291ca6f5Smrg        ])
1336c3c9b392Smrgelse
1337291ca6f5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338291ca6f5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339291ca6f5Smrg        AC_MSG_RESULT([yes])
1340291ca6f5Smrg	$3
1341291ca6f5Smrgfi[]dnl
1342291ca6f5Smrg])dnl PKG_CHECK_MODULES
1343f66e55a2Smrg
1344c3c9b392Smrg
1345291ca6f5Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346291ca6f5Smrgdnl   [ACTION-IF-NOT-FOUND])
1347291ca6f5Smrgdnl ---------------------------------------------------------------------
1348291ca6f5Smrgdnl Since: 0.29
1349291ca6f5Smrgdnl
1350291ca6f5Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351291ca6f5Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352291ca6f5Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353291ca6f5Smrgdnl
1354291ca6f5Smrgdnl Note that if there is a possibility the first call to
1355291ca6f5Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356291ca6f5Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357291ca6f5Smrgdnl configure.ac.
1358291ca6f5SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359291ca6f5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360291ca6f5Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361291ca6f5SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362291ca6f5SmrgPKG_CHECK_MODULES($@)
1363291ca6f5SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364291ca6f5Smrg])dnl PKG_CHECK_MODULES_STATIC
1365c3c9b392Smrg
136627935385Smrg
1367291ca6f5Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368291ca6f5Smrgdnl -------------------------
1369291ca6f5Smrgdnl Since: 0.27
1370291ca6f5Smrgdnl
1371291ca6f5Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372291ca6f5Smrgdnl should install pkg-config .pc files. By default the directory is
1373291ca6f5Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374291ca6f5Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375291ca6f5Smrgdnl parameter.
1376291ca6f5SmrgAC_DEFUN([PKG_INSTALLDIR],
1377291ca6f5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378291ca6f5Smrgm4_pushdef([pkg_description],
1379291ca6f5Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380291ca6f5SmrgAC_ARG_WITH([pkgconfigdir],
1381291ca6f5Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382291ca6f5Smrg    [with_pkgconfigdir=]pkg_default)
1383291ca6f5SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384291ca6f5Smrgm4_popdef([pkg_default])
1385291ca6f5Smrgm4_popdef([pkg_description])
1386291ca6f5Smrg])dnl PKG_INSTALLDIR
1387291ca6f5Smrg
1388291ca6f5Smrg
1389291ca6f5Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390291ca6f5Smrgdnl --------------------------------
1391291ca6f5Smrgdnl Since: 0.27
1392291ca6f5Smrgdnl
1393291ca6f5Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394291ca6f5Smrgdnl module should install arch-independent pkg-config .pc files. By
1395291ca6f5Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396291ca6f5Smrgdnl changed by passing DIRECTORY. The user can override through the
1397291ca6f5Smrgdnl --with-noarch-pkgconfigdir parameter.
1398291ca6f5SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399291ca6f5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400291ca6f5Smrgm4_pushdef([pkg_description],
1401291ca6f5Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402291ca6f5SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403291ca6f5Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404291ca6f5Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405291ca6f5SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406291ca6f5Smrgm4_popdef([pkg_default])
1407291ca6f5Smrgm4_popdef([pkg_description])
1408291ca6f5Smrg])dnl PKG_NOARCH_INSTALLDIR
1409291ca6f5Smrg
141027935385Smrg
1411291ca6f5Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412291ca6f5Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413291ca6f5Smrgdnl -------------------------------------------
1414291ca6f5Smrgdnl Since: 0.28
1415291ca6f5Smrgdnl
1416291ca6f5Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417291ca6f5SmrgAC_DEFUN([PKG_CHECK_VAR],
1418291ca6f5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419291ca6f5SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420c3c9b392Smrg
1421291ca6f5Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422291ca6f5SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423c3c9b392Smrg
1424291ca6f5SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425291ca6f5Smrg])dnl PKG_CHECK_VAR
1426c3c9b392Smrg
1427291ca6f5Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428291ca6f5Smrgdnl
14299683b4e0Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430291ca6f5Smrgdnl
1431291ca6f5Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432291ca6f5Smrgdnl copy of this software and associated documentation files (the "Software"),
1433291ca6f5Smrgdnl to deal in the Software without restriction, including without limitation
1434291ca6f5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435291ca6f5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436291ca6f5Smrgdnl Software is furnished to do so, subject to the following conditions:
1437291ca6f5Smrgdnl
1438291ca6f5Smrgdnl The above copyright notice and this permission notice (including the next
1439291ca6f5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440291ca6f5Smrgdnl Software.
1441291ca6f5Smrgdnl
1442291ca6f5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443291ca6f5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444291ca6f5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445291ca6f5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446291ca6f5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447291ca6f5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448291ca6f5Smrgdnl DEALINGS IN THE SOFTWARE.
144927935385Smrg
1450291ca6f5Smrg# XORG_MACROS_VERSION(required-version)
1451291ca6f5Smrg# -------------------------------------
145227935385Smrg# Minimum version: 1.1.0
1453c3c9b392Smrg#
1454291ca6f5Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455291ca6f5Smrg# your configure.ac with the minimum required version, such as:
1456291ca6f5Smrg# XORG_MACROS_VERSION(1.1)
1457c3c9b392Smrg#
1458291ca6f5Smrg# To ensure that this macro is defined, also add:
1459291ca6f5Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460291ca6f5Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461c3c9b392Smrg#
1462291ca6f5Smrg#
1463291ca6f5Smrg# See the "minimum version" comment for each macro you use to see what
1464291ca6f5Smrg# version you require.
1465291ca6f5Smrgm4_defun([XORG_MACROS_VERSION],[
14669683b4e0Smrgm4_define([vers_have], [1.20.1])
1467291ca6f5Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468291ca6f5Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469291ca6f5Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470291ca6f5Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471291ca6f5Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472291ca6f5Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473291ca6f5Smrgm4_undefine([vers_have])
1474291ca6f5Smrgm4_undefine([maj_have])
1475291ca6f5Smrgm4_undefine([maj_needed])
1476291ca6f5Smrg]) # XORG_MACROS_VERSION
1477c3c9b392Smrg
1478291ca6f5Smrg# XORG_PROG_RAWCPP()
1479291ca6f5Smrg# ------------------
1480291ca6f5Smrg# Minimum version: 1.0.0
1481291ca6f5Smrg#
1482291ca6f5Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483291ca6f5Smrg# such as man pages and config files
1484291ca6f5SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485291ca6f5SmrgAC_REQUIRE([AC_PROG_CPP])
1486291ca6f5SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487291ca6f5Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148827935385Smrg
1489291ca6f5Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490291ca6f5Smrg# which is not the best choice for supporting other OS'es, but covers most
1491291ca6f5Smrg# of the ones we need for now.
1492291ca6f5SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493291ca6f5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494291ca6f5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495291ca6f5Smrg	AC_MSG_RESULT([no])
1496291ca6f5Smrgelse
1497291ca6f5Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498291ca6f5Smrg		RAWCPPFLAGS=-undef
1499291ca6f5Smrg		AC_MSG_RESULT([yes])
1500291ca6f5Smrg	# under Cygwin unix is still defined even with -undef
1501291ca6f5Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502291ca6f5Smrg		RAWCPPFLAGS="-undef -ansi"
1503291ca6f5Smrg		AC_MSG_RESULT([yes, with -ansi])
1504291ca6f5Smrg	else
1505291ca6f5Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506291ca6f5Smrg	fi
150727935385Smrgfi
1508291ca6f5Smrgrm -f conftest.$ac_ext
150927935385Smrg
1510291ca6f5SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511291ca6f5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15129683b4e0Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513291ca6f5Smrg	AC_MSG_RESULT([no])
1514291ca6f5Smrgelse
15159683b4e0Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516291ca6f5Smrg		TRADITIONALCPPFLAGS="-traditional"
1517291ca6f5Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518291ca6f5Smrg		AC_MSG_RESULT([yes])
1519291ca6f5Smrg	else
1520291ca6f5Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521291ca6f5Smrg	fi
1522291ca6f5Smrgfi
1523291ca6f5Smrgrm -f conftest.$ac_ext
1524291ca6f5SmrgAC_SUBST(RAWCPPFLAGS)
1525291ca6f5SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526291ca6f5Smrg]) # XORG_PROG_RAWCPP
152727935385Smrg
1528291ca6f5Smrg# XORG_MANPAGE_SECTIONS()
1529291ca6f5Smrg# -----------------------
1530291ca6f5Smrg# Minimum version: 1.0.0
1531f66e55a2Smrg#
1532291ca6f5Smrg# Determine which sections man pages go in for the different man page types
1533291ca6f5Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534291ca6f5Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535291ca6f5Smrg# Override default settings by setting environment variables
1536291ca6f5Smrg# Added MAN_SUBSTS in version 1.8
1537291ca6f5Smrg# Added AC_PROG_SED in version 1.8
1538f66e55a2Smrg
1539291ca6f5SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540291ca6f5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541291ca6f5SmrgAC_REQUIRE([AC_PROG_SED])
1542f66e55a2Smrg
1543291ca6f5Smrgcase $host_os in
1544291ca6f5Smrg    solaris*)
1545291ca6f5Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546291ca6f5Smrg        # check for a man page file found in later versions that use
1547291ca6f5Smrg        # traditional section numbers instead
1548291ca6f5Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549291ca6f5Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550291ca6f5Smrg        ;;
1551291ca6f5Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552291ca6f5Smrgesac
155327935385Smrg
1554291ca6f5Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555291ca6f5Smrg    APP_MAN_SUFFIX=1
1556291ca6f5Smrgfi
1557291ca6f5Smrgif test x$APP_MAN_DIR = x    ; then
1558291ca6f5Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559291ca6f5Smrgfi
156027935385Smrg
1561291ca6f5Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562291ca6f5Smrg    LIB_MAN_SUFFIX=3
1563291ca6f5Smrgfi
1564291ca6f5Smrgif test x$LIB_MAN_DIR = x    ; then
1565291ca6f5Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566291ca6f5Smrgfi
156727935385Smrg
1568291ca6f5Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569291ca6f5Smrg    case $SYSV_MAN_SECTIONS in
1570291ca6f5Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571291ca6f5Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572291ca6f5Smrg    esac
1573291ca6f5Smrgfi
1574291ca6f5Smrgif test x$FILE_MAN_DIR = x    ; then
1575291ca6f5Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157627935385Smrgfi
157727935385Smrg
1578291ca6f5Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579291ca6f5Smrg    case $SYSV_MAN_SECTIONS in
1580291ca6f5Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581291ca6f5Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582291ca6f5Smrg    esac
1583291ca6f5Smrgfi
1584291ca6f5Smrgif test x$MISC_MAN_DIR = x    ; then
1585291ca6f5Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158627935385Smrgfi
158727935385Smrg
1588291ca6f5Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589291ca6f5Smrg    case $SYSV_MAN_SECTIONS in
1590291ca6f5Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591291ca6f5Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592291ca6f5Smrg    esac
1593291ca6f5Smrgfi
1594291ca6f5Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595291ca6f5Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596291ca6f5Smrgfi
159727935385Smrg
1598291ca6f5Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599291ca6f5Smrg    case $SYSV_MAN_SECTIONS in
1600291ca6f5Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601291ca6f5Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602291ca6f5Smrg    esac
1603291ca6f5Smrgfi
1604291ca6f5Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605291ca6f5Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606291ca6f5Smrgfi
160727935385Smrg
160827935385Smrg
1609291ca6f5SmrgAC_SUBST([APP_MAN_SUFFIX])
1610291ca6f5SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611291ca6f5SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612291ca6f5SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613291ca6f5SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614291ca6f5SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615291ca6f5SmrgAC_SUBST([APP_MAN_DIR])
1616291ca6f5SmrgAC_SUBST([LIB_MAN_DIR])
1617291ca6f5SmrgAC_SUBST([FILE_MAN_DIR])
1618291ca6f5SmrgAC_SUBST([MISC_MAN_DIR])
1619291ca6f5SmrgAC_SUBST([DRIVER_MAN_DIR])
1620291ca6f5SmrgAC_SUBST([ADMIN_MAN_DIR])
162127935385Smrg
1622291ca6f5SmrgXORG_MAN_PAGE="X Version 11"
1623291ca6f5SmrgAC_SUBST([XORG_MAN_PAGE])
1624291ca6f5SmrgMAN_SUBSTS="\
1625291ca6f5Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626291ca6f5Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627291ca6f5Smrg	-e 's|__xservername__|Xorg|g' \
1628291ca6f5Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629291ca6f5Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630291ca6f5Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631291ca6f5Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632291ca6f5Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633291ca6f5Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634291ca6f5Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635291ca6f5Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636291ca6f5Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637291ca6f5SmrgAC_SUBST([MAN_SUBSTS])
163827935385Smrg
1639291ca6f5Smrg]) # XORG_MANPAGE_SECTIONS
164027935385Smrg
1641291ca6f5Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642291ca6f5Smrg# ------------------------
1643291ca6f5Smrg# Minimum version: 1.7.0
1644f66e55a2Smrg#
1645291ca6f5Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646291ca6f5Smrg# provided by xorg-sgml-doctools, if installed.
1647291ca6f5SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648291ca6f5SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649291ca6f5SmrgXORG_SGML_PATH=
1650291ca6f5SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651291ca6f5Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652291ca6f5Smrg    [m4_ifval([$1],[:],
1653291ca6f5Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654291ca6f5Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655291ca6f5Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656291ca6f5Smrg         fi])
1657291ca6f5Smrg    ])
1658291ca6f5Smrg
1659291ca6f5Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660291ca6f5Smrg# the path and the name of the doc stylesheet
1661291ca6f5Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662291ca6f5Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663291ca6f5Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664291ca6f5Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665291ca6f5Smrgelse
1666291ca6f5Smrg   AC_MSG_RESULT([no])
1667291ca6f5Smrgfi
1668291ca6f5Smrg
1669291ca6f5SmrgAC_SUBST(XORG_SGML_PATH)
1670291ca6f5SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671291ca6f5SmrgAC_SUBST(XSL_STYLESHEET)
1672291ca6f5SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673291ca6f5Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674291ca6f5Smrg
1675291ca6f5Smrg# XORG_CHECK_LINUXDOC
1676291ca6f5Smrg# -------------------
1677291ca6f5Smrg# Minimum version: 1.0.0
167827935385Smrg#
1679291ca6f5Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680291ca6f5Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681291ca6f5Smrg# Whether or not the necessary tools and files are found can be checked
1682291ca6f5Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683291ca6f5SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684291ca6f5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685291ca6f5SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168627935385Smrg
1687291ca6f5SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168827935385Smrg
1689291ca6f5SmrgAC_MSG_CHECKING([whether to build documentation])
1690291ca6f5Smrg
1691291ca6f5Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692291ca6f5Smrg   BUILDDOC=yes
169327935385Smrgelse
1694291ca6f5Smrg   BUILDDOC=no
169527935385Smrgfi
169627935385Smrg
1697291ca6f5SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169827935385Smrg
1699291ca6f5SmrgAC_MSG_RESULT([$BUILDDOC])
170027935385Smrg
1701291ca6f5SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702291ca6f5Smrg
1703291ca6f5Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704291ca6f5Smrg   BUILDPDFDOC=yes
1705291ca6f5Smrgelse
1706291ca6f5Smrg   BUILDPDFDOC=no
1707291ca6f5Smrgfi
1708291ca6f5Smrg
1709291ca6f5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710291ca6f5Smrg
1711291ca6f5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712291ca6f5Smrg
1713291ca6f5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714291ca6f5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715291ca6f5SmrgMAKE_PDF="$PS2PDF"
1716291ca6f5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717291ca6f5Smrg
1718291ca6f5SmrgAC_SUBST(MAKE_TEXT)
1719291ca6f5SmrgAC_SUBST(MAKE_PS)
1720291ca6f5SmrgAC_SUBST(MAKE_PDF)
1721291ca6f5SmrgAC_SUBST(MAKE_HTML)
1722291ca6f5Smrg]) # XORG_CHECK_LINUXDOC
1723291ca6f5Smrg
1724291ca6f5Smrg# XORG_CHECK_DOCBOOK
1725291ca6f5Smrg# -------------------
1726291ca6f5Smrg# Minimum version: 1.0.0
1727291ca6f5Smrg#
1728291ca6f5Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729291ca6f5Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730291ca6f5Smrg# indicates whether the necessary tools and files are found and, if set,
1731291ca6f5Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732291ca6f5SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733291ca6f5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734291ca6f5Smrg
1735291ca6f5SmrgBUILDTXTDOC=no
1736291ca6f5SmrgBUILDPDFDOC=no
1737291ca6f5SmrgBUILDPSDOC=no
1738291ca6f5SmrgBUILDHTMLDOC=no
1739291ca6f5Smrg
1740291ca6f5SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741291ca6f5SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742291ca6f5SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743291ca6f5SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174427935385Smrg
1745291ca6f5SmrgAC_MSG_CHECKING([whether to build text documentation])
1746291ca6f5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747291ca6f5Smrg   test x$BUILD_TXTDOC != xno; then
1748291ca6f5Smrg	BUILDTXTDOC=yes
1749291ca6f5Smrgfi
1750291ca6f5SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751291ca6f5SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175227935385Smrg
1753291ca6f5SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754291ca6f5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755291ca6f5Smrg   test x$BUILD_PDFDOC != xno; then
1756291ca6f5Smrg	BUILDPDFDOC=yes
1757291ca6f5Smrgfi
1758291ca6f5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759291ca6f5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176027935385Smrg
1761291ca6f5SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762291ca6f5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763291ca6f5Smrg   test x$BUILD_PSDOC != xno; then
1764291ca6f5Smrg	BUILDPSDOC=yes
176527935385Smrgfi
1766291ca6f5SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767291ca6f5SmrgAC_MSG_RESULT([$BUILDPSDOC])
176827935385Smrg
1769291ca6f5SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770291ca6f5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771291ca6f5Smrg   test x$BUILD_HTMLDOC != xno; then
1772291ca6f5Smrg	BUILDHTMLDOC=yes
1773291ca6f5Smrgfi
1774291ca6f5SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775291ca6f5SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177627935385Smrg
1777291ca6f5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778291ca6f5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779291ca6f5SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780291ca6f5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781291ca6f5Smrg
1782291ca6f5SmrgAC_SUBST(MAKE_TEXT)
1783291ca6f5SmrgAC_SUBST(MAKE_PS)
1784291ca6f5SmrgAC_SUBST(MAKE_PDF)
1785291ca6f5SmrgAC_SUBST(MAKE_HTML)
1786291ca6f5Smrg]) # XORG_CHECK_DOCBOOK
1787291ca6f5Smrg
1788291ca6f5Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789291ca6f5Smrg# ----------------
1790291ca6f5Smrg# Minimum version: 1.5.0
1791291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179227935385Smrg#
1793291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
1794291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
1795291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17969683b4e0Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797291ca6f5Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798291ca6f5Smrg# --with-xmlto assumes 'auto'.
179927935385Smrg#
1800291ca6f5Smrg# Interface to module:
1801291ca6f5Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802291ca6f5Smrg# XMLTO:	returns the path of the xmlto program found
1803291ca6f5Smrg#		returns the path set by the user in the environment
1804291ca6f5Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805291ca6f5Smrg#		'no' user instructs the module not to use xmlto
180627935385Smrg#
1807291ca6f5Smrg# Added in version 1.10.0
1808291ca6f5Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809291ca6f5Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181027935385Smrg#
1811291ca6f5Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181227935385Smrg#
1813291ca6f5SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814291ca6f5SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816291ca6f5SmrgAC_ARG_WITH(xmlto,
1817291ca6f5Smrg	AS_HELP_STRING([--with-xmlto],
1818291ca6f5Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819291ca6f5Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820291ca6f5Smrgm4_undefine([_defopt])
182127935385Smrg
1822291ca6f5Smrgif test "x$use_xmlto" = x"auto"; then
1823291ca6f5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824291ca6f5Smrg   if test "x$XMLTO" = "x"; then
1825291ca6f5Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826291ca6f5Smrg	have_xmlto=no
1827291ca6f5Smrg   else
1828291ca6f5Smrg        have_xmlto=yes
1829291ca6f5Smrg   fi
1830291ca6f5Smrgelif test "x$use_xmlto" = x"yes" ; then
1831291ca6f5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832291ca6f5Smrg   if test "x$XMLTO" = "x"; then
1833291ca6f5Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834291ca6f5Smrg   fi
1835291ca6f5Smrg   have_xmlto=yes
1836291ca6f5Smrgelif test "x$use_xmlto" = x"no" ; then
1837291ca6f5Smrg   if test "x$XMLTO" != "x"; then
1838291ca6f5Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839291ca6f5Smrg   fi
1840291ca6f5Smrg   have_xmlto=no
1841291ca6f5Smrgelse
1842291ca6f5Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843291ca6f5Smrgfi
184427935385Smrg
1845291ca6f5Smrg# Test for a minimum version of xmlto, if provided.
1846291ca6f5Smrgm4_ifval([$1],
1847291ca6f5Smrg[if test "$have_xmlto" = yes; then
1848291ca6f5Smrg    # scrape the xmlto version
1849291ca6f5Smrg    AC_MSG_CHECKING([the xmlto version])
1850291ca6f5Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851291ca6f5Smrg    AC_MSG_RESULT([$xmlto_version])
1852291ca6f5Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853291ca6f5Smrg        [if test "x$use_xmlto" = xauto; then
1854291ca6f5Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855291ca6f5Smrg            have_xmlto=no
1856291ca6f5Smrg        else
1857291ca6f5Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858291ca6f5Smrg        fi])
1859291ca6f5Smrgfi])
186027935385Smrg
1861291ca6f5Smrg# Test for the ability of xmlto to generate a text target
1862291ca6f5Smrg#
1863291ca6f5Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864291ca6f5Smrg# following test for empty XML docbook files.
1865291ca6f5Smrg# For compatibility reasons use the following empty XML docbook file and if
1866291ca6f5Smrg# it fails try it again with a non-empty XML file.
1867291ca6f5Smrghave_xmlto_text=no
1868291ca6f5Smrgcat > conftest.xml << "EOF"
1869291ca6f5SmrgEOF
1870291ca6f5SmrgAS_IF([test "$have_xmlto" = yes],
1871291ca6f5Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872291ca6f5Smrg             [have_xmlto_text=yes],
1873291ca6f5Smrg             [# Try it again with a non-empty XML file.
1874291ca6f5Smrg              cat > conftest.xml << "EOF"
1875291ca6f5Smrg<x></x>
1876291ca6f5SmrgEOF
1877291ca6f5Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878291ca6f5Smrg                    [have_xmlto_text=yes],
1879291ca6f5Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880291ca6f5Smrgrm -f conftest.xml
1881291ca6f5SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882291ca6f5SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883291ca6f5Smrg]) # XORG_WITH_XMLTO
188427935385Smrg
1885291ca6f5Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886291ca6f5Smrg# --------------------------------------------
1887291ca6f5Smrg# Minimum version: 1.12.0
1888291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889291ca6f5Smrg#
1890291ca6f5Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891291ca6f5Smrg# XML-based language used for the transformation of XML documents.
1892291ca6f5Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893291ca6f5Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894291ca6f5Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895291ca6f5Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896291ca6f5Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897291ca6f5Smrg#
1898291ca6f5Smrg# Interface to module:
1899291ca6f5Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900291ca6f5Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901291ca6f5Smrg#		 returns the path set by the user in the environment
1902291ca6f5Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903291ca6f5Smrg#		  'no' user instructs the module not to use xsltproc
1904291ca6f5Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905291ca6f5Smrg#
1906291ca6f5Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907291ca6f5Smrg#
1908291ca6f5SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909291ca6f5SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910291ca6f5Smrg# Preserves the interface, should it be implemented later
1911291ca6f5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913291ca6f5SmrgAC_ARG_WITH(xsltproc,
1914291ca6f5Smrg	AS_HELP_STRING([--with-xsltproc],
1915291ca6f5Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916291ca6f5Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917291ca6f5Smrgm4_undefine([_defopt])
191827935385Smrg
1919291ca6f5Smrgif test "x$use_xsltproc" = x"auto"; then
1920291ca6f5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921291ca6f5Smrg   if test "x$XSLTPROC" = "x"; then
1922291ca6f5Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923291ca6f5Smrg	have_xsltproc=no
1924291ca6f5Smrg   else
1925291ca6f5Smrg        have_xsltproc=yes
1926291ca6f5Smrg   fi
1927291ca6f5Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928291ca6f5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929291ca6f5Smrg   if test "x$XSLTPROC" = "x"; then
1930291ca6f5Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931291ca6f5Smrg   fi
1932291ca6f5Smrg   have_xsltproc=yes
1933291ca6f5Smrgelif test "x$use_xsltproc" = x"no" ; then
1934291ca6f5Smrg   if test "x$XSLTPROC" != "x"; then
1935291ca6f5Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936291ca6f5Smrg   fi
1937291ca6f5Smrg   have_xsltproc=no
1938291ca6f5Smrgelse
1939291ca6f5Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194027935385Smrgfi
194127935385Smrg
1942291ca6f5SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943291ca6f5Smrg]) # XORG_WITH_XSLTPROC
1944291ca6f5Smrg
1945291ca6f5Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946291ca6f5Smrg# ----------------------------------------
1947291ca6f5Smrg# Minimum version: 1.15.0
194827935385Smrg#
1949291ca6f5Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950291ca6f5Smrg# scanning arbitrary text files, extracting information from those text files,
1951291ca6f5Smrg# and printing reports based on that information.
195227935385Smrg#
1953291ca6f5Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195427935385Smrg#
1955291ca6f5Smrg# Interface to module:
1956291ca6f5Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957291ca6f5Smrg# PERL:	     returns the path of the perl program found
1958291ca6f5Smrg#	     returns the path set by the user in the environment
1959291ca6f5Smrg# --with-perl: 'yes' user instructs the module to use perl
1960291ca6f5Smrg#	       'no' user instructs the module not to use perl
1961291ca6f5Smrg# have_perl: returns yes if perl found in PATH or no
196227935385Smrg#
1963291ca6f5Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964291ca6f5Smrg#
1965291ca6f5SmrgAC_DEFUN([XORG_WITH_PERL],[
1966291ca6f5SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967291ca6f5Smrg# Preserves the interface, should it be implemented later
1968291ca6f5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970291ca6f5SmrgAC_ARG_WITH(perl,
1971291ca6f5Smrg	AS_HELP_STRING([--with-perl],
1972291ca6f5Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973291ca6f5Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974291ca6f5Smrgm4_undefine([_defopt])
197527935385Smrg
1976291ca6f5Smrgif test "x$use_perl" = x"auto"; then
1977291ca6f5Smrg   AC_PATH_PROG([PERL], [perl])
1978291ca6f5Smrg   if test "x$PERL" = "x"; then
1979291ca6f5Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980291ca6f5Smrg	have_perl=no
1981291ca6f5Smrg   else
1982291ca6f5Smrg        have_perl=yes
1983291ca6f5Smrg   fi
1984291ca6f5Smrgelif test "x$use_perl" = x"yes" ; then
1985291ca6f5Smrg   AC_PATH_PROG([PERL], [perl])
1986291ca6f5Smrg   if test "x$PERL" = "x"; then
1987291ca6f5Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988291ca6f5Smrg   fi
1989291ca6f5Smrg   have_perl=yes
1990291ca6f5Smrgelif test "x$use_perl" = x"no" ; then
1991291ca6f5Smrg   if test "x$PERL" != "x"; then
1992291ca6f5Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993291ca6f5Smrg   fi
1994291ca6f5Smrg   have_perl=no
1995291ca6f5Smrgelse
1996291ca6f5Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997291ca6f5Smrgfi
199827935385Smrg
1999291ca6f5SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000291ca6f5Smrg]) # XORG_WITH_PERL
200127935385Smrg
2002291ca6f5Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200327935385Smrg# ----------------
2004291ca6f5Smrg# Minimum version: 1.5.0
2005291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200627935385Smrg#
2007291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2008291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
2009291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20109683b4e0Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011291ca6f5Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012291ca6f5Smrg# --with-asciidoc assumes 'auto'.
201327935385Smrg#
2014291ca6f5Smrg# Interface to module:
2015291ca6f5Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016291ca6f5Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017291ca6f5Smrg#		 returns the path set by the user in the environment
2018291ca6f5Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019291ca6f5Smrg#		  'no' user instructs the module not to use asciidoc
202027935385Smrg#
2021291ca6f5Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202227935385Smrg#
2023291ca6f5SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024291ca6f5SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026291ca6f5SmrgAC_ARG_WITH(asciidoc,
2027291ca6f5Smrg	AS_HELP_STRING([--with-asciidoc],
2028291ca6f5Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029291ca6f5Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030291ca6f5Smrgm4_undefine([_defopt])
203127935385Smrg
2032291ca6f5Smrgif test "x$use_asciidoc" = x"auto"; then
2033291ca6f5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034291ca6f5Smrg   if test "x$ASCIIDOC" = "x"; then
2035291ca6f5Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036291ca6f5Smrg	have_asciidoc=no
2037291ca6f5Smrg   else
2038291ca6f5Smrg        have_asciidoc=yes
2039291ca6f5Smrg   fi
2040291ca6f5Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041291ca6f5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042291ca6f5Smrg   if test "x$ASCIIDOC" = "x"; then
2043291ca6f5Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044291ca6f5Smrg   fi
2045291ca6f5Smrg   have_asciidoc=yes
2046291ca6f5Smrgelif test "x$use_asciidoc" = x"no" ; then
2047291ca6f5Smrg   if test "x$ASCIIDOC" != "x"; then
2048291ca6f5Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049291ca6f5Smrg   fi
2050291ca6f5Smrg   have_asciidoc=no
2051291ca6f5Smrgelse
2052291ca6f5Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053291ca6f5Smrgfi
2054291ca6f5Smrgm4_ifval([$1],
2055291ca6f5Smrg[if test "$have_asciidoc" = yes; then
2056291ca6f5Smrg    # scrape the asciidoc version
2057291ca6f5Smrg    AC_MSG_CHECKING([the asciidoc version])
2058291ca6f5Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059291ca6f5Smrg    AC_MSG_RESULT([$asciidoc_version])
2060291ca6f5Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061291ca6f5Smrg        [if test "x$use_asciidoc" = xauto; then
2062291ca6f5Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063291ca6f5Smrg            have_asciidoc=no
2064291ca6f5Smrg        else
2065291ca6f5Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066291ca6f5Smrg        fi])
2067291ca6f5Smrgfi])
2068291ca6f5SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069291ca6f5Smrg]) # XORG_WITH_ASCIIDOC
207027935385Smrg
2071291ca6f5Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072291ca6f5Smrg# -------------------------------------------
2073291ca6f5Smrg# Minimum version: 1.5.0
2074291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075291ca6f5Smrg# Minimum version for optional DOT checking: 1.18.0
207627935385Smrg#
2077291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2078291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
2079291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20809683b4e0Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081291ca6f5Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082291ca6f5Smrg# --with-doxygen assumes 'auto'.
2083f66e55a2Smrg#
2084291ca6f5Smrg# Interface to module:
2085291ca6f5Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086291ca6f5Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087291ca6f5Smrg#		 returns the path set by the user in the environment
2088291ca6f5Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089291ca6f5Smrg#		  'no' user instructs the module not to use doxygen
2090f66e55a2Smrg#
2091291ca6f5Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092f66e55a2Smrg#
2093291ca6f5SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094291ca6f5SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095291ca6f5SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097291ca6f5SmrgAC_ARG_WITH(doxygen,
2098291ca6f5Smrg	AS_HELP_STRING([--with-doxygen],
2099291ca6f5Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100291ca6f5Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101291ca6f5Smrgm4_undefine([_defopt])
2102f66e55a2Smrg
2103291ca6f5Smrgif test "x$use_doxygen" = x"auto"; then
2104291ca6f5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105291ca6f5Smrg   if test "x$DOXYGEN" = "x"; then
2106291ca6f5Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107291ca6f5Smrg	have_doxygen=no
2108291ca6f5Smrg   else
2109291ca6f5Smrg        have_doxygen=yes
2110291ca6f5Smrg   fi
2111291ca6f5Smrgelif test "x$use_doxygen" = x"yes" ; then
2112291ca6f5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113291ca6f5Smrg   if test "x$DOXYGEN" = "x"; then
2114291ca6f5Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115291ca6f5Smrg   fi
2116291ca6f5Smrg   have_doxygen=yes
2117291ca6f5Smrgelif test "x$use_doxygen" = x"no" ; then
2118291ca6f5Smrg   if test "x$DOXYGEN" != "x"; then
2119291ca6f5Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120291ca6f5Smrg   fi
2121291ca6f5Smrg   have_doxygen=no
212227935385Smrgelse
2123291ca6f5Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124f66e55a2Smrgfi
2125291ca6f5Smrgm4_ifval([$1],
2126291ca6f5Smrg[if test "$have_doxygen" = yes; then
2127291ca6f5Smrg    # scrape the doxygen version
2128291ca6f5Smrg    AC_MSG_CHECKING([the doxygen version])
2129291ca6f5Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130291ca6f5Smrg    AC_MSG_RESULT([$doxygen_version])
2131291ca6f5Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132291ca6f5Smrg        [if test "x$use_doxygen" = xauto; then
2133291ca6f5Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134291ca6f5Smrg            have_doxygen=no
2135291ca6f5Smrg        else
2136291ca6f5Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137291ca6f5Smrg        fi])
2138291ca6f5Smrgfi])
213927935385Smrg
2140291ca6f5Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141291ca6f5Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142291ca6f5Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143291ca6f5SmrgHAVE_DOT=no
2144291ca6f5Smrgif test "x$have_doxygen" = "xyes"; then
2145291ca6f5Smrg  AC_PATH_PROG([DOT], [dot])
2146291ca6f5Smrg    if test "x$DOT" != "x"; then
2147291ca6f5Smrg      HAVE_DOT=yes
2148291ca6f5Smrg    fi
2149291ca6f5Smrgfi
215027935385Smrg
2151291ca6f5SmrgAC_SUBST([HAVE_DOT])
2152291ca6f5SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153291ca6f5SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154291ca6f5Smrg]) # XORG_WITH_DOXYGEN
215527935385Smrg
2156291ca6f5Smrg# XORG_WITH_GROFF([DEFAULT])
2157291ca6f5Smrg# ----------------
2158291ca6f5Smrg# Minimum version: 1.6.0
2159291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216027935385Smrg#
2161291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2162291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
2163291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21649683b4e0Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165291ca6f5Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166291ca6f5Smrg# --with-groff assumes 'auto'.
2167291ca6f5Smrg#
2168291ca6f5Smrg# Interface to module:
2169291ca6f5Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170291ca6f5Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171291ca6f5Smrg# HAVE_GROFF_MS: the -ms macros package
2172291ca6f5Smrg# GROFF:	 returns the path of the groff program found
2173291ca6f5Smrg#		 returns the path set by the user in the environment
2174291ca6f5Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175291ca6f5Smrg#		 'no' user instructs the module not to use groff
2176291ca6f5Smrg#
2177291ca6f5Smrg# Added in version 1.9.0:
2178291ca6f5Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179291ca6f5Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180291ca6f5Smrg#		   psselect from the psutils package.
2181291ca6f5Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182291ca6f5Smrg#
2183291ca6f5Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184291ca6f5Smrg#
2185291ca6f5Smrg# OS and distros often splits groff in a basic and full package, the former
2186291ca6f5Smrg# having the groff program and the later having devices, fonts and macros
2187291ca6f5Smrg# Checking for the groff executable is not enough.
2188291ca6f5Smrg#
2189291ca6f5Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190291ca6f5Smrg# unset HAVE_GROFF or GROFF env variables.
2191291ca6f5Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192291ca6f5Smrg#
2193291ca6f5SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194291ca6f5SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195291ca6f5Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196291ca6f5SmrgAC_ARG_WITH(groff,
2197291ca6f5Smrg	AS_HELP_STRING([--with-groff],
2198291ca6f5Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199291ca6f5Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200291ca6f5Smrgm4_undefine([_defopt])
220127935385Smrg
2202291ca6f5Smrgif test "x$use_groff" = x"auto"; then
2203291ca6f5Smrg   AC_PATH_PROG([GROFF], [groff])
2204291ca6f5Smrg   if test "x$GROFF" = "x"; then
2205291ca6f5Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206291ca6f5Smrg	have_groff=no
2207291ca6f5Smrg   else
2208291ca6f5Smrg        have_groff=yes
2209291ca6f5Smrg   fi
2210291ca6f5Smrgelif test "x$use_groff" = x"yes" ; then
2211291ca6f5Smrg   AC_PATH_PROG([GROFF], [groff])
2212291ca6f5Smrg   if test "x$GROFF" = "x"; then
2213291ca6f5Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214291ca6f5Smrg   fi
2215291ca6f5Smrg   have_groff=yes
2216291ca6f5Smrgelif test "x$use_groff" = x"no" ; then
2217291ca6f5Smrg   if test "x$GROFF" != "x"; then
2218291ca6f5Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219291ca6f5Smrg   fi
2220291ca6f5Smrg   have_groff=no
2221291ca6f5Smrgelse
2222291ca6f5Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223291ca6f5Smrgfi
222427935385Smrg
2225291ca6f5Smrg# We have groff, test for the presence of the macro packages
2226291ca6f5Smrgif test "x$have_groff" = x"yes"; then
2227291ca6f5Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228291ca6f5Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229291ca6f5Smrg        groff_ms_works=yes
2230291ca6f5Smrg    else
2231291ca6f5Smrg        groff_ms_works=no
223227935385Smrg    fi
2233291ca6f5Smrg    AC_MSG_RESULT([$groff_ms_works])
2234291ca6f5Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235291ca6f5Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236291ca6f5Smrg        groff_mm_works=yes
2237291ca6f5Smrg    else
2238291ca6f5Smrg        groff_mm_works=no
2239291ca6f5Smrg    fi
2240291ca6f5Smrg    AC_MSG_RESULT([$groff_mm_works])
2241291ca6f5Smrgfi
224227935385Smrg
2243291ca6f5Smrg# We have groff, test for HTML dependencies, one command per package
2244291ca6f5Smrgif test "x$have_groff" = x"yes"; then
2245291ca6f5Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246291ca6f5Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247291ca6f5Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248291ca6f5Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249291ca6f5Smrg      have_groff_html=yes
2250291ca6f5Smrg   else
2251291ca6f5Smrg      have_groff_html=no
2252291ca6f5Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253291ca6f5Smrg   fi
2254291ca6f5Smrgfi
2255291ca6f5Smrg
2256291ca6f5Smrg# Set Automake conditionals for Makefiles
2257291ca6f5SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258291ca6f5SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259291ca6f5SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260291ca6f5SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261291ca6f5Smrg]) # XORG_WITH_GROFF
2262291ca6f5Smrg
2263291ca6f5Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264291ca6f5Smrg# ---------------------------------------
2265291ca6f5Smrg# Minimum version: 1.6.0
2266291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267291ca6f5Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268291ca6f5Smrg#
2269291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2270291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
2271291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22729683b4e0Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273291ca6f5Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274291ca6f5Smrg# --with-fop assumes 'auto'.
2275291ca6f5Smrg#
2276291ca6f5Smrg# Interface to module:
2277291ca6f5Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278291ca6f5Smrg# FOP:	 	returns the path of the fop program found
2279291ca6f5Smrg#		returns the path set by the user in the environment
2280291ca6f5Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281291ca6f5Smrg#		'no' user instructs the module not to use fop
2282291ca6f5Smrg#
2283291ca6f5Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284291ca6f5Smrg#
2285291ca6f5SmrgAC_DEFUN([XORG_WITH_FOP],[
2286291ca6f5SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288291ca6f5SmrgAC_ARG_WITH(fop,
2289291ca6f5Smrg	AS_HELP_STRING([--with-fop],
2290291ca6f5Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291291ca6f5Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292291ca6f5Smrgm4_undefine([_defopt])
2293291ca6f5Smrg
2294291ca6f5Smrgif test "x$use_fop" = x"auto"; then
2295291ca6f5Smrg   AC_PATH_PROG([FOP], [fop])
2296291ca6f5Smrg   if test "x$FOP" = "x"; then
2297291ca6f5Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298291ca6f5Smrg	have_fop=no
2299291ca6f5Smrg   else
2300291ca6f5Smrg        have_fop=yes
2301291ca6f5Smrg   fi
2302291ca6f5Smrgelif test "x$use_fop" = x"yes" ; then
2303291ca6f5Smrg   AC_PATH_PROG([FOP], [fop])
2304291ca6f5Smrg   if test "x$FOP" = "x"; then
2305291ca6f5Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306291ca6f5Smrg   fi
2307291ca6f5Smrg   have_fop=yes
2308291ca6f5Smrgelif test "x$use_fop" = x"no" ; then
2309291ca6f5Smrg   if test "x$FOP" != "x"; then
2310291ca6f5Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311291ca6f5Smrg   fi
2312291ca6f5Smrg   have_fop=no
231327935385Smrgelse
2314291ca6f5Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315f66e55a2Smrgfi
2316f66e55a2Smrg
2317291ca6f5Smrg# Test for a minimum version of fop, if provided.
2318291ca6f5Smrgm4_ifval([$1],
2319291ca6f5Smrg[if test "$have_fop" = yes; then
2320291ca6f5Smrg    # scrape the fop version
2321291ca6f5Smrg    AC_MSG_CHECKING([for fop minimum version])
2322291ca6f5Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323291ca6f5Smrg    AC_MSG_RESULT([$fop_version])
2324291ca6f5Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325291ca6f5Smrg        [if test "x$use_fop" = xauto; then
2326291ca6f5Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327291ca6f5Smrg            have_fop=no
2328291ca6f5Smrg        else
2329291ca6f5Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330291ca6f5Smrg        fi])
2331291ca6f5Smrgfi])
2332291ca6f5SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333291ca6f5Smrg]) # XORG_WITH_FOP
2334291ca6f5Smrg
2335291ca6f5Smrg# XORG_WITH_M4([MIN-VERSION])
2336291ca6f5Smrg# ---------------------------
2337291ca6f5Smrg# Minimum version: 1.19.0
2338291ca6f5Smrg#
2339291ca6f5Smrg# This macro attempts to locate an m4 macro processor which supports
2340291ca6f5Smrg# -I option and is only useful for modules relying on M4 in order to
2341291ca6f5Smrg# expand macros in source code files.
2342291ca6f5Smrg#
2343291ca6f5Smrg# Interface to module:
2344291ca6f5Smrg# M4:	 	returns the path of the m4 program found
2345291ca6f5Smrg#		returns the path set by the user in the environment
2346291ca6f5Smrg#
2347291ca6f5SmrgAC_DEFUN([XORG_WITH_M4], [
2348291ca6f5SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349291ca6f5Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350291ca6f5Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351291ca6f5Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352291ca6f5Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353291ca6f5Smrg   [$PATH:/usr/gnu/bin])])
235427935385Smrg
2355291ca6f5SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356291ca6f5Smrg]) # XORG_WITH_M4
235727935385Smrg
2358291ca6f5Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359291ca6f5Smrg# ----------------
2360291ca6f5Smrg# Minimum version: 1.6.0
2361291ca6f5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362291ca6f5Smrg#
2363291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2364291ca6f5Smrg# not at the appropriate level. This macro enables a module to test for the
2365291ca6f5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23669683b4e0Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367291ca6f5Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368291ca6f5Smrg# --with-ps2pdf assumes 'auto'.
2369291ca6f5Smrg#
2370291ca6f5Smrg# Interface to module:
2371291ca6f5Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372291ca6f5Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373291ca6f5Smrg#		returns the path set by the user in the environment
2374291ca6f5Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375291ca6f5Smrg#		 'no' user instructs the module not to use ps2pdf
2376291ca6f5Smrg#
2377291ca6f5Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378291ca6f5Smrg#
2379291ca6f5SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380291ca6f5SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381291ca6f5Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382291ca6f5SmrgAC_ARG_WITH(ps2pdf,
2383291ca6f5Smrg	AS_HELP_STRING([--with-ps2pdf],
2384291ca6f5Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385291ca6f5Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386291ca6f5Smrgm4_undefine([_defopt])
238727935385Smrg
2388291ca6f5Smrgif test "x$use_ps2pdf" = x"auto"; then
2389291ca6f5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390291ca6f5Smrg   if test "x$PS2PDF" = "x"; then
2391291ca6f5Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392291ca6f5Smrg	have_ps2pdf=no
2393291ca6f5Smrg   else
2394291ca6f5Smrg        have_ps2pdf=yes
2395291ca6f5Smrg   fi
2396291ca6f5Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397291ca6f5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398291ca6f5Smrg   if test "x$PS2PDF" = "x"; then
2399291ca6f5Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400291ca6f5Smrg   fi
2401291ca6f5Smrg   have_ps2pdf=yes
2402291ca6f5Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403291ca6f5Smrg   if test "x$PS2PDF" != "x"; then
2404291ca6f5Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405291ca6f5Smrg   fi
2406291ca6f5Smrg   have_ps2pdf=no
2407291ca6f5Smrgelse
2408291ca6f5Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409f66e55a2Smrgfi
2410291ca6f5SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411291ca6f5Smrg]) # XORG_WITH_PS2PDF
2412f66e55a2Smrg
2413291ca6f5Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414291ca6f5Smrg# ----------------
2415291ca6f5Smrg# Minimum version: 1.6.0
2416f66e55a2Smrg#
2417291ca6f5Smrg# Documentation tools are not always available on all platforms and sometimes
2418291ca6f5Smrg# not at the appropriate level. This macro enables a builder to skip all
2419291ca6f5Smrg# documentation targets except traditional man pages.
2420291ca6f5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24219683b4e0Smrg# maximum flexibility in controlling documentation building.
2422291ca6f5Smrg# Refer to:
2423291ca6f5Smrg# XORG_WITH_XMLTO         --with-xmlto
2424291ca6f5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425291ca6f5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426291ca6f5Smrg# XORG_WITH_FOP           --with-fop
2427291ca6f5Smrg# XORG_WITH_GROFF         --with-groff
2428291ca6f5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429291ca6f5Smrg#
2430291ca6f5Smrg# Interface to module:
2431291ca6f5Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432291ca6f5Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433291ca6f5Smrg#		 'no' user instructs the module not to generate docs
2434291ca6f5Smrg# parm1:	specify the default value, yes or no.
2435291ca6f5Smrg#
2436291ca6f5SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437291ca6f5Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438291ca6f5SmrgAC_ARG_ENABLE(docs,
2439291ca6f5Smrg	AS_HELP_STRING([--enable-docs],
2440291ca6f5Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441291ca6f5Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442291ca6f5Smrgm4_undefine([docs_default])
2443291ca6f5SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444291ca6f5SmrgAC_MSG_CHECKING([whether to build documentation])
2445291ca6f5SmrgAC_MSG_RESULT([$build_docs])
2446291ca6f5Smrg]) # XORG_ENABLE_DOCS
2447f66e55a2Smrg
2448291ca6f5Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449291ca6f5Smrg# ----------------
2450291ca6f5Smrg# Minimum version: 1.6.0
2451291ca6f5Smrg#
2452291ca6f5Smrg# This macro enables a builder to skip all developer documentation.
2453291ca6f5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24549683b4e0Smrg# maximum flexibility in controlling documentation building.
2455291ca6f5Smrg# Refer to:
2456291ca6f5Smrg# XORG_WITH_XMLTO         --with-xmlto
2457291ca6f5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458291ca6f5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459291ca6f5Smrg# XORG_WITH_FOP           --with-fop
2460291ca6f5Smrg# XORG_WITH_GROFF         --with-groff
2461291ca6f5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462291ca6f5Smrg#
2463291ca6f5Smrg# Interface to module:
2464291ca6f5Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465291ca6f5Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466291ca6f5Smrg#			'no' user instructs the module not to generate developer docs
2467291ca6f5Smrg# parm1:		specify the default value, yes or no.
2468291ca6f5Smrg#
2469291ca6f5SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470291ca6f5Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471291ca6f5SmrgAC_ARG_ENABLE(devel-docs,
2472291ca6f5Smrg	AS_HELP_STRING([--enable-devel-docs],
2473291ca6f5Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474291ca6f5Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475291ca6f5Smrgm4_undefine([devel_default])
2476291ca6f5SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477291ca6f5SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478291ca6f5SmrgAC_MSG_RESULT([$build_devel_docs])
2479291ca6f5Smrg]) # XORG_ENABLE_DEVEL_DOCS
248027935385Smrg
2481291ca6f5Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482291ca6f5Smrg# ----------------
2483291ca6f5Smrg# Minimum version: 1.6.0
2484291ca6f5Smrg#
2485291ca6f5Smrg# This macro enables a builder to skip all functional specification targets.
2486291ca6f5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24879683b4e0Smrg# maximum flexibility in controlling documentation building.
2488291ca6f5Smrg# Refer to:
2489291ca6f5Smrg# XORG_WITH_XMLTO         --with-xmlto
2490291ca6f5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491291ca6f5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492291ca6f5Smrg# XORG_WITH_FOP           --with-fop
2493291ca6f5Smrg# XORG_WITH_GROFF         --with-groff
2494291ca6f5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495291ca6f5Smrg#
2496291ca6f5Smrg# Interface to module:
2497291ca6f5Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498291ca6f5Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499291ca6f5Smrg#			'no' user instructs the module not to generate specs
2500291ca6f5Smrg# parm1:		specify the default value, yes or no.
2501291ca6f5Smrg#
2502291ca6f5SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503291ca6f5Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504291ca6f5SmrgAC_ARG_ENABLE(specs,
2505291ca6f5Smrg	AS_HELP_STRING([--enable-specs],
2506291ca6f5Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507291ca6f5Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508291ca6f5Smrgm4_undefine([spec_default])
2509291ca6f5SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510291ca6f5SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511291ca6f5SmrgAC_MSG_RESULT([$build_specs])
2512291ca6f5Smrg]) # XORG_ENABLE_SPECS
251327935385Smrg
2514291ca6f5Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515291ca6f5Smrg# ----------------------------------------------
2516291ca6f5Smrg# Minimum version: 1.13.0
2517f66e55a2Smrg#
2518291ca6f5Smrg# This macro enables a builder to enable/disable unit testing
2519291ca6f5Smrg# It makes no assumption about the test cases implementation
2520291ca6f5Smrg# Test cases may or may not use Automake "Support for test suites"
2521291ca6f5Smrg# They may or may not use the software utility library GLib
2522291ca6f5Smrg#
2523291ca6f5Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524291ca6f5Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525291ca6f5Smrg# The variable enable_unit_tests is used by other macros in this file.
2526291ca6f5Smrg#
2527291ca6f5Smrg# Interface to module:
2528291ca6f5Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529291ca6f5Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530291ca6f5Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531291ca6f5Smrg#			'no' user instructs the module not to build tests
2532291ca6f5Smrg# parm1:		specify the default value, yes or no.
2533291ca6f5Smrg#
2534291ca6f5SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535291ca6f5SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536291ca6f5SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537291ca6f5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538291ca6f5Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539291ca6f5SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540291ca6f5Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541291ca6f5Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542291ca6f5Smrgm4_undefine([_defopt])
2543291ca6f5SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544291ca6f5SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545291ca6f5SmrgAC_MSG_RESULT([$enable_unit_tests])
2546291ca6f5Smrg]) # XORG_ENABLE_UNIT_TESTS
254727935385Smrg
2548291ca6f5Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549291ca6f5Smrg# ------------------------------------------------------
2550291ca6f5Smrg# Minimum version: 1.17.0
2551291ca6f5Smrg#
2552291ca6f5Smrg# This macro enables a builder to enable/disable integration testing
2553291ca6f5Smrg# It makes no assumption about the test cases' implementation
2554291ca6f5Smrg# Test cases may or may not use Automake "Support for test suites"
2555291ca6f5Smrg#
2556291ca6f5Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557291ca6f5Smrg# usually requires less dependencies and may be built and run under less
2558291ca6f5Smrg# stringent environments than integration tests.
2559291ca6f5Smrg#
2560291ca6f5Smrg# Interface to module:
2561291ca6f5Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562291ca6f5Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563291ca6f5Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564291ca6f5Smrg#                             'no' user instructs the module not to build tests
2565291ca6f5Smrg# parm1:                      specify the default value, yes or no.
2566291ca6f5Smrg#
2567291ca6f5SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568291ca6f5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569291ca6f5Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570291ca6f5SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571291ca6f5Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572291ca6f5Smrg	[enable_integration_tests=$enableval],
2573291ca6f5Smrg	[enable_integration_tests=]_defopt)
2574291ca6f5Smrgm4_undefine([_defopt])
2575291ca6f5SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576291ca6f5Smrg	[test "x$enable_integration_tests" != xno])
2577291ca6f5SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578291ca6f5SmrgAC_MSG_RESULT([$enable_integration_tests])
2579291ca6f5Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258027935385Smrg
2581291ca6f5Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582291ca6f5Smrg# ----------------------------------------
2583291ca6f5Smrg# Minimum version: 1.13.0
2584291ca6f5Smrg#
2585291ca6f5Smrg# GLib is a library which provides advanced data structures and functions.
2586291ca6f5Smrg# This macro enables a module to test for the presence of Glib.
2587291ca6f5Smrg#
2588291ca6f5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589291ca6f5Smrg# Otherwise the value of $enable_unit_tests is blank.
2590291ca6f5Smrg#
2591291ca6f5Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592291ca6f5Smrg# test support usually requires less dependencies and may be built and run under
2593291ca6f5Smrg# less stringent environments than integration tests.
2594f66e55a2Smrg#
2595291ca6f5Smrg# Interface to module:
2596291ca6f5Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597291ca6f5Smrg# with_glib: used in configure.ac to know if GLib has been found
2598291ca6f5Smrg# --with-glib:	'yes' user instructs the module to use glib
2599291ca6f5Smrg#		'no' user instructs the module not to use glib
2600291ca6f5Smrg#
2601291ca6f5SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602291ca6f5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603291ca6f5Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604291ca6f5SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605291ca6f5Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606291ca6f5Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607291ca6f5Smrgm4_undefine([_defopt])
2608f66e55a2Smrg
2609291ca6f5Smrghave_glib=no
2610291ca6f5Smrg# Do not probe GLib if user explicitly disabled unit testing
2611291ca6f5Smrgif test "x$enable_unit_tests" != x"no"; then
2612291ca6f5Smrg  # Do not probe GLib if user explicitly disabled it
2613291ca6f5Smrg  if test "x$with_glib" != x"no"; then
2614291ca6f5Smrg    m4_ifval(
2615291ca6f5Smrg      [$1],
2616291ca6f5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617291ca6f5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618291ca6f5Smrg    )
261927935385Smrg  fi
2620f66e55a2Smrgfi
2621f66e55a2Smrg
2622291ca6f5Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623291ca6f5Smrgif test "x$enable_unit_tests" = x"yes"; then
2624291ca6f5Smrg  if test "x$have_glib" = x"no"; then
2625291ca6f5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262627935385Smrg  fi
262727935385Smrgfi
262829459361Smrg
2629291ca6f5Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630291ca6f5Smrgif test "x$enable_unit_tests" = x"no"; then
2631291ca6f5Smrg  if test "x$with_glib" = x"yes"; then
2632291ca6f5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633291ca6f5Smrg  fi
2634291ca6f5Smrgfi
263529459361Smrg
2636291ca6f5Smrg# Not having GLib when it has been explicitly requested is an error
2637291ca6f5Smrgif test "x$with_glib" = x"yes"; then
2638291ca6f5Smrg  if test "x$have_glib" = x"no"; then
2639291ca6f5Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640291ca6f5Smrg  fi
2641291ca6f5Smrgfi
264229459361Smrg
2643291ca6f5SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644291ca6f5Smrg]) # XORG_WITH_GLIB
264527935385Smrg
2646291ca6f5Smrg# XORG_LD_WRAP([required|optional])
2647291ca6f5Smrg# ---------------------------------
2648291ca6f5Smrg# Minimum version: 1.13.0
2649291ca6f5Smrg#
2650291ca6f5Smrg# Check if linker supports -wrap, passed via compiler flags
2651291ca6f5Smrg#
2652291ca6f5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653291ca6f5Smrg# Otherwise the value of $enable_unit_tests is blank.
2654291ca6f5Smrg#
2655291ca6f5Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656291ca6f5Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657291ca6f5Smrg# available, an argument of "optional" allows use when some unit tests require
2658291ca6f5Smrg# ld -wrap and others do not.
2659291ca6f5Smrg#
2660291ca6f5SmrgAC_DEFUN([XORG_LD_WRAP],[
2661291ca6f5SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662291ca6f5Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663291ca6f5Smrg                      void __wrap_exit(int status) { return; }],
2664291ca6f5Smrg                     [exit(0);])])
2665291ca6f5Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666291ca6f5Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667291ca6f5Smrg  if test "x$have_ld_wrap" = x"no"; then
2668291ca6f5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669291ca6f5Smrg  fi
2670291ca6f5Smrgfi
2671291ca6f5SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672291ca6f5Smrg#
2673291ca6f5Smrg]) # XORG_LD_WRAP
267427935385Smrg
2675291ca6f5Smrg# XORG_CHECK_LINKER_FLAGS
2676291ca6f5Smrg# -----------------------
2677291ca6f5Smrg# SYNOPSIS
2678291ca6f5Smrg#
2679291ca6f5Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680291ca6f5Smrg#
2681291ca6f5Smrg# DESCRIPTION
2682291ca6f5Smrg#
2683291ca6f5Smrg#   Check whether the given linker FLAGS work with the current language's
2684291ca6f5Smrg#   linker, or whether they give an error.
2685291ca6f5Smrg#
2686291ca6f5Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687291ca6f5Smrg#   success/failure.
2688291ca6f5Smrg#
2689291ca6f5Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690291ca6f5Smrg#
2691291ca6f5Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692291ca6f5Smrg#
2693291ca6f5Smrg# LICENSE
2694291ca6f5Smrg#
2695291ca6f5Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696291ca6f5Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697291ca6f5Smrg#   Copyright (c) 2009 Matteo Frigo
2698291ca6f5Smrg#
2699291ca6f5Smrg#   This program is free software: you can redistribute it and/or modify it
2700291ca6f5Smrg#   under the terms of the GNU General Public License as published by the
2701291ca6f5Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702291ca6f5Smrg#   option) any later version.
2703291ca6f5Smrg#
2704291ca6f5Smrg#   This program is distributed in the hope that it will be useful, but
2705291ca6f5Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706291ca6f5Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707291ca6f5Smrg#   Public License for more details.
2708291ca6f5Smrg#
2709291ca6f5Smrg#   You should have received a copy of the GNU General Public License along
2710291ca6f5Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711291ca6f5Smrg#
2712291ca6f5Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713291ca6f5Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714291ca6f5Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715291ca6f5Smrg#   need not follow the terms of the GNU General Public License when using
2716291ca6f5Smrg#   or distributing such scripts, even though portions of the text of the
2717291ca6f5Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718291ca6f5Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719291ca6f5Smrg#
2720291ca6f5Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721291ca6f5Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722291ca6f5Smrg#   modified version of the Autoconf Macro, you may extend this special
2723291ca6f5Smrg#   exception to the GPL to apply to your modified version as well.#
2724291ca6f5SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725291ca6f5Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726291ca6f5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727291ca6f5SmrgAS_LITERAL_IF([$1],
2728291ca6f5Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729291ca6f5Smrg      ax_save_FLAGS=$LDFLAGS
2730291ca6f5Smrg      LDFLAGS="$1"
2731291ca6f5Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732291ca6f5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733291ca6f5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734291ca6f5Smrg      LDFLAGS=$ax_save_FLAGS])],
2735291ca6f5Smrg  [ax_save_FLAGS=$LDFLAGS
2736291ca6f5Smrg   LDFLAGS="$1"
2737291ca6f5Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738291ca6f5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739291ca6f5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740291ca6f5Smrg   LDFLAGS=$ax_save_FLAGS])
2741291ca6f5Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742291ca6f5SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743291ca6f5Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744291ca6f5Smrg	m4_default([$2], :)
2745291ca6f5Smrgelse
2746291ca6f5Smrg	m4_default([$3], :)
2747291ca6f5Smrgfi
2748291ca6f5Smrg]) # XORG_CHECK_LINKER_FLAGS
274929459361Smrg
2750291ca6f5Smrg# XORG_MEMORY_CHECK_FLAGS
2751291ca6f5Smrg# -----------------------
2752291ca6f5Smrg# Minimum version: 1.16.0
2753291ca6f5Smrg#
2754291ca6f5Smrg# This macro attempts to find appropriate memory checking functionality
2755291ca6f5Smrg# for various platforms which unit testing code may use to catch various
2756291ca6f5Smrg# forms of memory allocation and access errors in testing.
2757291ca6f5Smrg#
2758291ca6f5Smrg# Interface to module:
2759291ca6f5Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760291ca6f5Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761291ca6f5Smrg#
2762291ca6f5Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763291ca6f5Smrg#
2764291ca6f5SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276529459361Smrg
2766291ca6f5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767291ca6f5SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768291ca6f5Smrg           [Environment variables to enable memory checking in tests])
2769c3c9b392Smrg
2770291ca6f5Smrg# Check for different types of support on different platforms
2771291ca6f5Smrgcase $host_os in
2772291ca6f5Smrg    solaris*)
2773291ca6f5Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774291ca6f5Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775291ca6f5Smrg        ;;
2776291ca6f5Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777291ca6f5Smrg        # both directly and inverted, so should not be 0 or 255.
2778291ca6f5Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779291ca6f5Smrg        ;;
2780291ca6f5Smrg    darwin*)
2781291ca6f5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782291ca6f5Smrg        ;;
2783291ca6f5Smrg    *bsd*)
2784291ca6f5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785291ca6f5Smrg        ;;
2786291ca6f5Smrgesac
2787c3c9b392Smrg
2788291ca6f5Smrg# User supplied flags override default flags
2789291ca6f5Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790291ca6f5Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279129459361Smrgfi
279229459361Smrg
2793291ca6f5SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794291ca6f5Smrg]) # XORG_WITH_LINT
279529459361Smrg
2796291ca6f5Smrg# XORG_CHECK_MALLOC_ZERO
2797291ca6f5Smrg# ----------------------
2798291ca6f5Smrg# Minimum version: 1.0.0
2799c3c9b392Smrg#
2800291ca6f5Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801291ca6f5Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802291ca6f5Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803291ca6f5SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804291ca6f5SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805291ca6f5Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806291ca6f5Smrg		       [malloc(0) returns NULL (default: auto)]),
2807291ca6f5Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808291ca6f5Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280929459361Smrg
2810291ca6f5SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811291ca6f5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812291ca6f5SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813291ca6f5Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814291ca6f5Smrg#include <stdlib.h>
2815291ca6f5Smrg],[
2816291ca6f5Smrg    char *m0, *r0, *c0, *p;
2817291ca6f5Smrg    m0 = malloc(0);
2818291ca6f5Smrg    p = malloc(10);
2819291ca6f5Smrg    r0 = realloc(p,0);
2820291ca6f5Smrg    c0 = calloc(0,10);
2821291ca6f5Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822291ca6f5Smrg])],
2823291ca6f5Smrg		[xorg_cv_malloc0_returns_null=yes],
2824291ca6f5Smrg		[xorg_cv_malloc0_returns_null=no])])
2825291ca6f5SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282627935385Smrgfi
2827291ca6f5SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282827935385Smrg
2829291ca6f5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830291ca6f5Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831291ca6f5Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832291ca6f5Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283327935385Smrgelse
2834291ca6f5Smrg	MALLOC_ZERO_CFLAGS=""
2835291ca6f5Smrg	XMALLOC_ZERO_CFLAGS=""
2836291ca6f5Smrg	XTMALLOC_ZERO_CFLAGS=""
283729459361Smrgfi
2838c3c9b392Smrg
2839291ca6f5SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840291ca6f5SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841291ca6f5SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842291ca6f5Smrg]) # XORG_CHECK_MALLOC_ZERO
284329459361Smrg
2844291ca6f5Smrg# XORG_WITH_LINT()
2845291ca6f5Smrg# ----------------
2846291ca6f5Smrg# Minimum version: 1.1.0
2847f66e55a2Smrg#
2848291ca6f5Smrg# This macro enables the use of a tool that flags some suspicious and
2849291ca6f5Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850291ca6f5Smrg# It will attempt to locate the tool and use appropriate options.
2851291ca6f5Smrg# There are various lint type tools on different platforms.
285227935385Smrg#
2853291ca6f5Smrg# Interface to module:
2854291ca6f5Smrg# LINT:		returns the path to the tool found on the platform
2855291ca6f5Smrg#		or the value set to LINT on the configure cmd line
2856291ca6f5Smrg#		also an Automake conditional
2857291ca6f5Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858291ca6f5Smrg#
2859291ca6f5Smrg# --with-lint:	'yes' user instructs the module to use lint
2860291ca6f5Smrg#		'no' user instructs the module not to use lint (default)
2861291ca6f5Smrg#
2862291ca6f5Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863291ca6f5Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864291ca6f5Smrg#
2865291ca6f5SmrgAC_DEFUN([XORG_WITH_LINT],[
2866f66e55a2Smrg
2867291ca6f5SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868291ca6f5SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869291ca6f5SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870291ca6f5Smrg		[Use a lint-style source code checker (default: disabled)])],
2871291ca6f5Smrg		[use_lint=$withval], [use_lint=no])
2872f66e55a2Smrg
2873291ca6f5Smrg# Obtain platform specific info like program name and options
2874291ca6f5Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875291ca6f5Smrgcase $host_os in
2876291ca6f5Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877291ca6f5Smrg	lint_name=splint
2878291ca6f5Smrg	lint_options="-badflag"
2879291ca6f5Smrg	;;
2880291ca6f5Smrg  *freebsd* | *netbsd*)
2881291ca6f5Smrg	lint_name=lint
2882291ca6f5Smrg	lint_options="-u -b"
2883291ca6f5Smrg	;;
2884291ca6f5Smrg  *solaris*)
2885291ca6f5Smrg	lint_name=lint
2886291ca6f5Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887291ca6f5Smrg	;;
2888291ca6f5Smrgesac
2889291ca6f5Smrg
2890291ca6f5Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891291ca6f5Smrgif test "x$use_lint" = x"yes" ; then
2892291ca6f5Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893291ca6f5Smrg   if test "x$LINT" = "x"; then
2894291ca6f5Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895291ca6f5Smrg   fi
2896291ca6f5Smrgelif test "x$use_lint" = x"no" ; then
2897291ca6f5Smrg   if test "x$LINT" != "x"; then
2898291ca6f5Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899291ca6f5Smrg   fi
290027935385Smrgelse
2901291ca6f5Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902f66e55a2Smrgfi
2903f66e55a2Smrg
2904291ca6f5Smrg# User supplied flags override default flags
2905291ca6f5Smrgif test "x$LINT_FLAGS" != "x"; then
2906291ca6f5Smrg   lint_options=$LINT_FLAGS
2907291ca6f5Smrgfi
2908f66e55a2Smrg
2909291ca6f5SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910291ca6f5SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911f66e55a2Smrg
2912291ca6f5Smrg]) # XORG_WITH_LINT
2913f66e55a2Smrg
2914291ca6f5Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915291ca6f5Smrg# --------------------------
2916291ca6f5Smrg# Minimum version: 1.1.0
2917f66e55a2Smrg#
2918291ca6f5Smrg# Sets up flags for building lint libraries for checking programs that call
2919291ca6f5Smrg# functions in the library.
2920291ca6f5Smrg#
2921291ca6f5Smrg# Interface to module:
2922291ca6f5Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923291ca6f5Smrg# MAKE_LINT_LIB		- Automake conditional
2924291ca6f5Smrg#
2925291ca6f5Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926291ca6f5Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927f66e55a2Smrg
2928291ca6f5SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929291ca6f5SmrgAC_REQUIRE([XORG_WITH_LINT])
2930291ca6f5SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931291ca6f5Smrg	[Create lint library (default: disabled)])],
2932291ca6f5Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933291ca6f5Smrg
2934291ca6f5Smrgif test "x$make_lint_lib" = x"yes" ; then
2935291ca6f5Smrg   LINTLIB=llib-l$1.ln
2936291ca6f5Smrg   if test "x$LINT" = "x"; then
2937291ca6f5Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938291ca6f5Smrg   fi
2939291ca6f5Smrgelif test "x$make_lint_lib" != x"no" ; then
2940291ca6f5Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941f66e55a2Smrgfi
294227935385Smrg
2943291ca6f5SmrgAC_SUBST(LINTLIB)
2944291ca6f5SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294527935385Smrg
2946291ca6f5Smrg]) # XORG_LINT_LIBRARY
2947f66e55a2Smrg
2948291ca6f5Smrg# XORG_COMPILER_BRAND
294927935385Smrg# -------------------
2950291ca6f5Smrg# Minimum version: 1.14.0
295127935385Smrg#
2952291ca6f5Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953291ca6f5Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954291ca6f5Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955291ca6f5Smrg#   clang compiler - sets CLANGCC to "yes"
2956291ca6f5Smrg#   Intel compiler - sets INTELCC to "yes"
2957291ca6f5Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958291ca6f5Smrg#
2959291ca6f5SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960291ca6f5SmrgAC_LANG_CASE(
2961291ca6f5Smrg	[C], [
29629683b4e0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29639683b4e0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29649683b4e0Smrg		m4_version_prereq([2.70],
29659683b4e0Smrg			[AC_REQUIRE([AC_PROG_CC])],
29669683b4e0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967291ca6f5Smrg	],
2968291ca6f5Smrg	[C++], [
2969291ca6f5Smrg		AC_REQUIRE([AC_PROG_CXX])
2970291ca6f5Smrg	]
2971291ca6f5Smrg)
2972291ca6f5SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973291ca6f5SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974291ca6f5SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975291ca6f5Smrg]) # XORG_COMPILER_BRAND
2976f66e55a2Smrg
2977291ca6f5Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297827935385Smrg# ---------------
2979291ca6f5Smrg# Minimum version: 1.16.0
2980291ca6f5Smrg#
2981291ca6f5Smrg# Test if the compiler works when passed the given flag as a command line argument.
29829683b4e0Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983291ca6f5Smrg# next flag in the list until there are no more options.
2984291ca6f5Smrg#
2985291ca6f5Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986291ca6f5Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987291ca6f5Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988291ca6f5Smrg# -Werror=unused-command-line-argument
2989291ca6f5Smrg#
2990291ca6f5SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991291ca6f5Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992291ca6f5Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993f66e55a2Smrg
2994291ca6f5SmrgAC_LANG_COMPILER_REQUIRE
2995f66e55a2Smrg
2996291ca6f5SmrgAC_LANG_CASE(
2997291ca6f5Smrg	[C], [
29989683b4e0Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29999683b4e0Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30009683b4e0Smrg		m4_version_prereq([2.70],
30019683b4e0Smrg			[AC_REQUIRE([AC_PROG_CC])],
30029683b4e0Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003291ca6f5Smrg		define([PREFIX], [C])
3004291ca6f5Smrg		define([CACHE_PREFIX], [cc])
3005291ca6f5Smrg		define([COMPILER], [$CC])
3006291ca6f5Smrg	],
3007291ca6f5Smrg	[C++], [
3008291ca6f5Smrg		define([PREFIX], [CXX])
3009291ca6f5Smrg		define([CACHE_PREFIX], [cxx])
3010291ca6f5Smrg		define([COMPILER], [$CXX])
3011291ca6f5Smrg	]
3012291ca6f5Smrg)
3013291ca6f5Smrg
3014291ca6f5Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015291ca6f5Smrg
3016291ca6f5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017291ca6f5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018291ca6f5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019291ca6f5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020291ca6f5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021291ca6f5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022291ca6f5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023291ca6f5Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024291ca6f5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
302527935385Smrgfi
3026291ca6f5Smrg
3027291ca6f5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028291ca6f5Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029291ca6f5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030291ca6f5Smrg	fi
3031291ca6f5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032291ca6f5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033291ca6f5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034291ca6f5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035291ca6f5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036291ca6f5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037291ca6f5Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038291ca6f5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039291ca6f5Smrgfi
3040291ca6f5Smrg
3041291ca6f5Smrgfound="no"
3042291ca6f5Smrgm4_foreach([flag], m4_cdr($@), [
3043291ca6f5Smrg	if test $found = "no" ; then
3044291ca6f5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045291ca6f5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046291ca6f5Smrg		fi
3047291ca6f5Smrg
3048291ca6f5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049291ca6f5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050291ca6f5Smrg		fi
3051291ca6f5Smrg
3052291ca6f5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053291ca6f5Smrg
3054291ca6f5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055291ca6f5Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056291ca6f5Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057291ca6f5Smrg		AC_CACHE_VAL($cacheid,
3058291ca6f5Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059291ca6f5Smrg					     [eval $cacheid=yes],
3060291ca6f5Smrg					     [eval $cacheid=no])])
3061291ca6f5Smrg
3062291ca6f5Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063291ca6f5Smrg
3064291ca6f5Smrg		eval supported=\$$cacheid
3065291ca6f5Smrg		AC_MSG_RESULT([$supported])
3066291ca6f5Smrg		if test "$supported" = "yes" ; then
3067291ca6f5Smrg			$1="$$1 ]flag["
3068291ca6f5Smrg			found="yes"
3069291ca6f5Smrg		fi
3070291ca6f5Smrg	fi
307127935385Smrg])
3072291ca6f5Smrg]) # XORG_TESTSET_CFLAG
3073f66e55a2Smrg
3074291ca6f5Smrg# XORG_COMPILER_FLAGS
3075291ca6f5Smrg# ---------------
3076291ca6f5Smrg# Minimum version: 1.16.0
3077f66e55a2Smrg#
3078291ca6f5Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079291ca6f5Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080291ca6f5Smrg# code.  These arguments will cause the compiler to print various warnings
3081291ca6f5Smrg# during compilation AND turn a conservative set of warnings into errors.
3082291ca6f5Smrg#
3083291ca6f5Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084291ca6f5Smrg# future versions of util-macros as options are added to new compilers.
3085291ca6f5Smrg#
3086291ca6f5SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087291ca6f5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30885715adc0Smrg
3089291ca6f5SmrgAC_ARG_ENABLE(selective-werror,
3090291ca6f5Smrg              AS_HELP_STRING([--disable-selective-werror],
3091291ca6f5Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092291ca6f5Smrg              [SELECTIVE_WERROR=$enableval],
3093291ca6f5Smrg              [SELECTIVE_WERROR=yes])
3094291ca6f5Smrg
3095291ca6f5SmrgAC_LANG_CASE(
3096291ca6f5Smrg        [C], [
3097291ca6f5Smrg                define([PREFIX], [C])
3098291ca6f5Smrg        ],
3099291ca6f5Smrg        [C++], [
3100291ca6f5Smrg                define([PREFIX], [CXX])
3101291ca6f5Smrg        ]
3102291ca6f5Smrg)
3103291ca6f5Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104291ca6f5Smrgif test "x$SUNCC" = "xyes"; then
3105291ca6f5Smrg    [BASE_]PREFIX[FLAGS]="-v"
310627935385Smrgelse
3107291ca6f5Smrg    [BASE_]PREFIX[FLAGS]=""
310827935385Smrgfi
310927935385Smrg
3110291ca6f5Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
311527935385Smrg
3116291ca6f5SmrgAC_LANG_CASE(
3117291ca6f5Smrg	[C], [
3118291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123291ca6f5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124291ca6f5Smrg	]
3125291ca6f5Smrg)
31265715adc0Smrg
3127291ca6f5Smrg# This chunk adds additional warnings that could catch undesired effects.
3128291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135f66e55a2Smrg
3136291ca6f5Smrg# These are currently disabled because they are noisy.  They will be enabled
3137291ca6f5Smrg# in the future once the codebase is sufficiently modernized to silence
3138291ca6f5Smrg# them.  For now, I don't want them to drown out the other warnings.
3139291ca6f5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140291ca6f5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141291ca6f5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142f66e55a2Smrg
31439683b4e0Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144291ca6f5Smrg# when there are problems that should be fixed.
3145f66e55a2Smrg
3146291ca6f5Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160291ca6f5Smrgelse
3161291ca6f5SmrgAC_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])
3162291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174291ca6f5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175291ca6f5Smrgfi
3176f66e55a2Smrg
3177291ca6f5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178291ca6f5Smrg]) # XORG_COMPILER_FLAGS
31795715adc0Smrg
3180291ca6f5Smrg# XORG_CWARNFLAGS
3181291ca6f5Smrg# ---------------
3182291ca6f5Smrg# Minimum version: 1.2.0
3183291ca6f5Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31845715adc0Smrg#
3185291ca6f5Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186c3c9b392Smrg#
3187291ca6f5Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188291ca6f5Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189291ca6f5Smrg# is needed, then it should be added explicitly in the module when
3190291ca6f5Smrg# it is updated to use BASE_CFLAGS.
3191c3c9b392Smrg#
3192291ca6f5SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193291ca6f5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194291ca6f5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195291ca6f5SmrgAC_LANG_CASE(
3196291ca6f5Smrg	[C], [
3197291ca6f5Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198291ca6f5Smrg		if  test "x$GCC" = xyes ; then
3199291ca6f5Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200291ca6f5Smrg		fi
3201291ca6f5Smrg		AC_SUBST(CWARNFLAGS)
3202291ca6f5Smrg	]
3203291ca6f5Smrg)
3204291ca6f5Smrg]) # XORG_CWARNFLAGS
320529459361Smrg
3206291ca6f5Smrg# XORG_STRICT_OPTION
3207291ca6f5Smrg# -----------------------
3208291ca6f5Smrg# Minimum version: 1.3.0
3209291ca6f5Smrg#
3210291ca6f5Smrg# Add configure option to enable strict compilation flags, such as treating
3211291ca6f5Smrg# warnings as fatal errors.
3212291ca6f5Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213291ca6f5Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214291ca6f5Smrg#
3215291ca6f5Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216291ca6f5Smrg# when strict compilation is unconditionally desired.
3217291ca6f5SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218291ca6f5SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219291ca6f5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322027935385Smrg
3221291ca6f5SmrgAC_ARG_ENABLE(strict-compilation,
3222291ca6f5Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223291ca6f5Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224291ca6f5Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322527935385Smrg
3226291ca6f5SmrgAC_LANG_CASE(
3227291ca6f5Smrg        [C], [
3228291ca6f5Smrg                define([PREFIX], [C])
3229291ca6f5Smrg        ],
3230291ca6f5Smrg        [C++], [
3231291ca6f5Smrg                define([PREFIX], [CXX])
3232291ca6f5Smrg        ]
3233291ca6f5Smrg)
323427935385Smrg
3235291ca6f5Smrg[STRICT_]PREFIX[FLAGS]=""
3236291ca6f5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237291ca6f5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323827935385Smrg
3239291ca6f5Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240291ca6f5Smrg# activate it with -Werror, so we add it here explicitly.
3241291ca6f5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
324227935385Smrg
3243291ca6f5Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244291ca6f5Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245291ca6f5Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246291ca6f5Smrgfi
3247291ca6f5SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248291ca6f5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249291ca6f5SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250291ca6f5Smrg]) # XORG_STRICT_OPTION
325127935385Smrg
32529683b4e0Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32539683b4e0Smrg# ---------------------------
32549683b4e0Smrg# Minimum version: 1.20.0
32559683b4e0Smrg#
32569683b4e0Smrg# Defines default options for X.Org modules which don't compile code,
32579683b4e0Smrg# such as fonts, bitmaps, cursors, and docs.
32589683b4e0Smrg#
32599683b4e0SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32609683b4e0SmrgAC_REQUIRE([AC_PROG_INSTALL])
32619683b4e0SmrgXORG_RELEASE_VERSION
32629683b4e0SmrgXORG_CHANGELOG
32639683b4e0SmrgXORG_INSTALL
32649683b4e0SmrgXORG_MANPAGE_SECTIONS
32659683b4e0Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32669683b4e0Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32679683b4e0Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32689683b4e0Smrg
3269291ca6f5Smrg# XORG_DEFAULT_OPTIONS
3270291ca6f5Smrg# --------------------
3271291ca6f5Smrg# Minimum version: 1.3.0
3272291ca6f5Smrg#
32739683b4e0Smrg# Defines default options for X.Org modules which compile code.
3274291ca6f5Smrg#
3275291ca6f5SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276291ca6f5SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277291ca6f5SmrgXORG_COMPILER_FLAGS
3278291ca6f5SmrgXORG_CWARNFLAGS
3279291ca6f5SmrgXORG_STRICT_OPTION
32809683b4e0SmrgXORG_DEFAULT_NOCODE_OPTIONS
3281291ca6f5Smrg]) # XORG_DEFAULT_OPTIONS
328227935385Smrg
3283291ca6f5Smrg# XORG_INSTALL()
3284291ca6f5Smrg# ----------------
3285291ca6f5Smrg# Minimum version: 1.4.0
3286291ca6f5Smrg#
3287291ca6f5Smrg# Defines the variable INSTALL_CMD as the command to copy
3288291ca6f5Smrg# INSTALL from $prefix/share/util-macros.
3289291ca6f5Smrg#
3290291ca6f5SmrgAC_DEFUN([XORG_INSTALL], [
3291291ca6f5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292291ca6f5Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293291ca6f5SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294291ca6f5Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295291ca6f5Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296291ca6f5Smrgtouch \$(top_srcdir)/INSTALL; \
3297291ca6f5Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298291ca6f5SmrgAC_SUBST([INSTALL_CMD])
3299291ca6f5Smrg]) # XORG_INSTALL
3300291ca6f5Smrgdnl Copyright 2005 Red Hat, Inc
3301291ca6f5Smrgdnl
3302291ca6f5Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303291ca6f5Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304291ca6f5Smrgdnl the above copyright notice appear in all copies and that both that
3305291ca6f5Smrgdnl copyright notice and this permission notice appear in supporting
3306291ca6f5Smrgdnl documentation.
3307291ca6f5Smrgdnl
3308291ca6f5Smrgdnl The above copyright notice and this permission notice shall be included
3309291ca6f5Smrgdnl in all copies or substantial portions of the Software.
3310291ca6f5Smrgdnl
3311291ca6f5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312291ca6f5Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313291ca6f5Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314291ca6f5Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315291ca6f5Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316291ca6f5Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317291ca6f5Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318291ca6f5Smrgdnl
3319291ca6f5Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320291ca6f5Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321291ca6f5Smrgdnl other dealings in this Software without prior written authorization
3322291ca6f5Smrgdnl from the copyright holders.
3323291ca6f5Smrgdnl
332427935385Smrg
3325291ca6f5Smrg# XORG_RELEASE_VERSION
3326291ca6f5Smrg# --------------------
3327291ca6f5Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332827935385Smrg
3329291ca6f5SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330291ca6f5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331291ca6f5Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332291ca6f5Smrg		[Major version of this package])
3333291ca6f5Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334291ca6f5Smrg	if test "x$PVM" = "x"; then
3335291ca6f5Smrg		PVM="0"
3336291ca6f5Smrg	fi
3337291ca6f5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338291ca6f5Smrg		[$PVM],
3339291ca6f5Smrg		[Minor version of this package])
3340291ca6f5Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341291ca6f5Smrg	if test "x$PVP" = "x"; then
3342291ca6f5Smrg		PVP="0"
3343291ca6f5Smrg	fi
3344291ca6f5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345291ca6f5Smrg		[$PVP],
3346291ca6f5Smrg		[Patch version of this package])
3347291ca6f5Smrg])
334827935385Smrg
3349291ca6f5Smrg# XORG_CHANGELOG()
3350291ca6f5Smrg# ----------------
3351291ca6f5Smrg# Minimum version: 1.2.0
3352291ca6f5Smrg#
3353291ca6f5Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354291ca6f5Smrg# ChangeLog from git.
3355291ca6f5Smrg#
3356291ca6f5Smrg#
3357291ca6f5SmrgAC_DEFUN([XORG_CHANGELOG], [
3358291ca6f5SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359291ca6f5Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360291ca6f5Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361291ca6f5Smrgtouch \$(top_srcdir)/ChangeLog; \
3362291ca6f5Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363291ca6f5SmrgAC_SUBST([CHANGELOG_CMD])
3364291ca6f5Smrg]) # XORG_CHANGELOG
33655715adc0Smrg
3366