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