1515ec619Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2fc544a13Smrg
3515ec619Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4ff559fabSmrg
5ff559fabSmrg# This file is free software; the Free Software Foundation
6ff559fabSmrg# gives unlimited permission to copy and/or distribute it,
7ff559fabSmrg# with or without modifications, as long as this notice is preserved.
8ff559fabSmrg
9ff559fabSmrg# This program is distributed in the hope that it will be useful,
10ff559fabSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11ff559fabSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12ff559fabSmrg# PARTICULAR PURPOSE.
13ff559fabSmrg
14fc544a13Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a3b38f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a3b38f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e08b657dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18e08b657dSmrg[m4_warning([this file was generated for autoconf 2.72.
197a3b38f7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a3b38f7SmrgIf you have problems, you may need to regenerate the build system entirely.
21fc544a13SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22ff559fabSmrg
23515ec619Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
246fc0178dSmrg#
25515ec619Smrg# This file is free software; the Free Software Foundation
26515ec619Smrg# gives unlimited permission to copy and/or distribute it,
27515ec619Smrg# with or without modifications, as long as this notice is preserved.
2844dda7b2Smrg
29515ec619Smrg# AM_AUTOMAKE_VERSION(VERSION)
30515ec619Smrg# ----------------------------
31515ec619Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32515ec619Smrg# generated from the m4 files accompanying Automake X.Y.
33515ec619Smrg# (This private macro should not be called outside this file.)
34515ec619SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35515ec619Smrg[am__api_version='1.16'
36515ec619Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37515ec619Smrgdnl require some minimum version.  Point them to the right macro.
38515ec619Smrgm4_if([$1], [1.16.5], [],
39515ec619Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
406fc0178dSmrg])
4144dda7b2Smrg
42515ec619Smrg# _AM_AUTOCONF_VERSION(VERSION)
43515ec619Smrg# -----------------------------
44515ec619Smrg# aclocal traces this macro to find the Autoconf version.
45515ec619Smrg# This is a private macro too.  Using m4_define simplifies
46515ec619Smrg# the logic in aclocal, which can simply ignore this definition.
47515ec619Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4844dda7b2Smrg
49515ec619Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50515ec619Smrg# -------------------------------
51515ec619Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52515ec619Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53515ec619SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54515ec619Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55515ec619Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56515ec619Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57515ec619Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5844dda7b2Smrg
59515ec619Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
607a3b38f7Smrg
61515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62515ec619Smrg#
63515ec619Smrg# This file is free software; the Free Software Foundation
64515ec619Smrg# gives unlimited permission to copy and/or distribute it,
65515ec619Smrg# with or without modifications, as long as this notice is preserved.
66ff559fabSmrg
67515ec619Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68515ec619Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69515ec619Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70515ec619Smrg#
71515ec619Smrg# Of course, Automake must honor this variable whenever it calls a
72515ec619Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73515ec619Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74515ec619Smrg# depending on how configure is run.  This is pretty annoying, since
75515ec619Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76515ec619Smrg# source directory, any form will work fine, but in subdirectories a
77515ec619Smrg# relative path needs to be adjusted first.
78515ec619Smrg#
79515ec619Smrg# $ac_aux_dir/missing
80515ec619Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81515ec619Smrg# $top_srcdir/$ac_aux_dir/missing
82515ec619Smrg#    fails if $ac_aux_dir is absolute,
83515ec619Smrg#    fails when called from a subdirectory in a VPATH build with
84515ec619Smrg#          a relative $ac_aux_dir
85515ec619Smrg#
86515ec619Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87515ec619Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88515ec619Smrg# harmless because $srcdir is '.', but things will broke when you
89515ec619Smrg# start a VPATH build or use an absolute $srcdir.
90515ec619Smrg#
91515ec619Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92515ec619Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93515ec619Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94515ec619Smrg# and then we would define $MISSING as
95515ec619Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96515ec619Smrg# This will work as long as MISSING is not called from configure, because
97515ec619Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98515ec619Smrg# However there are other variables, like CC, which are often used in
99515ec619Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100515ec619Smrg#
101515ec619Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102515ec619Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103515ec619Smrg# configured tree to be moved without reconfiguration.
104515ec619Smrg
105515ec619SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106515ec619Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107515ec619Smrg# Expand $ac_aux_dir to an absolute path.
108515ec619Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1097a3b38f7Smrg])
110ff559fabSmrg
111515ec619Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112ff559fabSmrg
113515ec619Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114515ec619Smrg#
115515ec619Smrg# This file is free software; the Free Software Foundation
116515ec619Smrg# gives unlimited permission to copy and/or distribute it,
117515ec619Smrg# with or without modifications, as long as this notice is preserved.
118ff559fabSmrg
119515ec619Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120515ec619Smrg# -------------------------------------
121515ec619Smrg# Define a conditional.
122515ec619SmrgAC_DEFUN([AM_CONDITIONAL],
123515ec619Smrg[AC_PREREQ([2.52])dnl
124515ec619Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125515ec619Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126515ec619SmrgAC_SUBST([$1_TRUE])dnl
127515ec619SmrgAC_SUBST([$1_FALSE])dnl
128515ec619Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129515ec619Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130515ec619Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131515ec619Smrgif $2; then
132515ec619Smrg  $1_TRUE=
133515ec619Smrg  $1_FALSE='#'
134515ec619Smrgelse
135515ec619Smrg  $1_TRUE='#'
136515ec619Smrg  $1_FALSE=
137515ec619Smrgfi
138515ec619SmrgAC_CONFIG_COMMANDS_PRE(
139515ec619Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140515ec619Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141515ec619SmrgUsually this means the macro was only invoked conditionally.]])
142515ec619Smrgfi])])
143ff559fabSmrg
144515ec619Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145515ec619Smrg#
146515ec619Smrg# This file is free software; the Free Software Foundation
147515ec619Smrg# gives unlimited permission to copy and/or distribute it,
148515ec619Smrg# with or without modifications, as long as this notice is preserved.
149ff559fabSmrg
150ff559fabSmrg
151515ec619Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152515ec619Smrg# written in clear, in which case automake, when reading aclocal.m4,
153515ec619Smrg# will think it sees a *use*, and therefore will trigger all it's
154515ec619Smrg# C support machinery.  Also note that it means that autoscan, seeing
155515ec619Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156ff559fabSmrg
157ff559fabSmrg
158515ec619Smrg# _AM_DEPENDENCIES(NAME)
159515ec619Smrg# ----------------------
160515ec619Smrg# See how the compiler implements dependency checking.
161515ec619Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162515ec619Smrg# We try a few techniques and use that to set a single cache variable.
163515ec619Smrg#
164515ec619Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165515ec619Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166515ec619Smrg# dependency, and given that the user is not expected to run this macro,
167515ec619Smrg# just rely on AC_PROG_CC.
168515ec619SmrgAC_DEFUN([_AM_DEPENDENCIES],
169515ec619Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170515ec619SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171515ec619SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172515ec619SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1737a3b38f7Smrg
174515ec619Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175515ec619Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176515ec619Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177515ec619Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178515ec619Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179515ec619Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180515ec619Smrg                    [depcc="$$1"   am_compiler_list=])
1817a3b38f7Smrg
182515ec619SmrgAC_CACHE_CHECK([dependency style of $depcc],
183515ec619Smrg               [am_cv_$1_dependencies_compiler_type],
184515ec619Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185515ec619Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186515ec619Smrg  # making bogus files that we don't know about and never remove.  For
187515ec619Smrg  # instance it was reported that on HP-UX the gcc test will end up
188515ec619Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189515ec619Smrg  # in D".
190515ec619Smrg  rm -rf conftest.dir
191515ec619Smrg  mkdir conftest.dir
192515ec619Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193515ec619Smrg  # using a relative directory.
194515ec619Smrg  cp "$am_depcomp" conftest.dir
195515ec619Smrg  cd conftest.dir
196515ec619Smrg  # We will build objects and dependencies in a subdirectory because
197515ec619Smrg  # it helps to detect inapplicable dependency modes.  For instance
198515ec619Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199515ec619Smrg  # side effect of compilation, but ICC will put the dependencies in
200515ec619Smrg  # the current directory while Tru64 will put them in the object
201515ec619Smrg  # directory.
202515ec619Smrg  mkdir sub
203ff559fabSmrg
204515ec619Smrg  am_cv_$1_dependencies_compiler_type=none
205515ec619Smrg  if test "$am_compiler_list" = ""; then
206515ec619Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207515ec619Smrg  fi
208515ec619Smrg  am__universal=false
209515ec619Smrg  m4_case([$1], [CC],
210515ec619Smrg    [case " $depcc " in #(
211515ec619Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212515ec619Smrg     esac],
213515ec619Smrg    [CXX],
214515ec619Smrg    [case " $depcc " in #(
215515ec619Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216515ec619Smrg     esac])
217ff559fabSmrg
218515ec619Smrg  for depmode in $am_compiler_list; do
219515ec619Smrg    # Setup a source with many dependencies, because some compilers
220515ec619Smrg    # like to wrap large dependency lists on column 80 (with \), and
221515ec619Smrg    # we should not choose a depcomp mode which is confused by this.
222515ec619Smrg    #
223515ec619Smrg    # We need to recreate these files for each test, as the compiler may
224515ec619Smrg    # overwrite some of them when testing with obscure command lines.
225515ec619Smrg    # This happens at least with the AIX C compiler.
226515ec619Smrg    : > sub/conftest.c
227515ec619Smrg    for i in 1 2 3 4 5 6; do
228515ec619Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229515ec619Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230515ec619Smrg      # Solaris 10 /bin/sh.
231515ec619Smrg      echo '/* dummy */' > sub/conftst$i.h
23244dda7b2Smrg    done
233515ec619Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234ff559fabSmrg
235515ec619Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236515ec619Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237515ec619Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238515ec619Smrg    # versions had trouble with output in subdirs.
239515ec619Smrg    am__obj=sub/conftest.${OBJEXT-o}
240515ec619Smrg    am__minus_obj="-o $am__obj"
241515ec619Smrg    case $depmode in
242515ec619Smrg    gcc)
243515ec619Smrg      # This depmode causes a compiler race in universal mode.
244515ec619Smrg      test "$am__universal" = false || continue
245515ec619Smrg      ;;
246515ec619Smrg    nosideeffect)
247515ec619Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248515ec619Smrg      # only be used when explicitly requested.
249515ec619Smrg      if test "x$enable_dependency_tracking" = xyes; then
250515ec619Smrg	continue
251515ec619Smrg      else
252515ec619Smrg	break
253515ec619Smrg      fi
254515ec619Smrg      ;;
255515ec619Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256515ec619Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257515ec619Smrg      # not run yet.  These depmodes are late enough in the game, and
258515ec619Smrg      # so weak that their functioning should not be impacted.
259515ec619Smrg      am__obj=conftest.${OBJEXT-o}
260515ec619Smrg      am__minus_obj=
261515ec619Smrg      ;;
262515ec619Smrg    none) break ;;
263515ec619Smrg    esac
264515ec619Smrg    if depmode=$depmode \
265515ec619Smrg       source=sub/conftest.c object=$am__obj \
266515ec619Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267515ec619Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268515ec619Smrg         >/dev/null 2>conftest.err &&
269515ec619Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270515ec619Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271515ec619Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272515ec619Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273515ec619Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274515ec619Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275515ec619Smrg      # that says an option was ignored or not supported.
276515ec619Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277515ec619Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278515ec619Smrg      # The diagnosis changed in icc 8.0:
279515ec619Smrg      #   icc: Command line remark: option '-MP' not supported
280515ec619Smrg      if (grep 'ignoring option' conftest.err ||
281515ec619Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282515ec619Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283515ec619Smrg        break
284515ec619Smrg      fi
285515ec619Smrg    fi
286515ec619Smrg  done
2877a3b38f7Smrg
288515ec619Smrg  cd ..
289515ec619Smrg  rm -rf conftest.dir
290515ec619Smrgelse
291515ec619Smrg  am_cv_$1_dependencies_compiler_type=none
292515ec619Smrgfi
293515ec619Smrg])
294515ec619SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295515ec619SmrgAM_CONDITIONAL([am__fastdep$1], [
296515ec619Smrg  test "x$enable_dependency_tracking" != xno \
297515ec619Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29844dda7b2Smrg])
299ff559fabSmrg
300ff559fabSmrg
301515ec619Smrg# AM_SET_DEPDIR
302515ec619Smrg# -------------
303515ec619Smrg# Choose a directory name for dependency files.
304515ec619Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305515ec619SmrgAC_DEFUN([AM_SET_DEPDIR],
306515ec619Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307515ec619SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308515ec619Smrg])
3096fc0178dSmrg
3106fc0178dSmrg
311515ec619Smrg# AM_DEP_TRACK
312515ec619Smrg# ------------
313515ec619SmrgAC_DEFUN([AM_DEP_TRACK],
314515ec619Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315515ec619SmrgAS_HELP_STRING(
316515ec619Smrg  [--enable-dependency-tracking],
317515ec619Smrg  [do not reject slow dependency extractors])
318515ec619SmrgAS_HELP_STRING(
319515ec619Smrg  [--disable-dependency-tracking],
320515ec619Smrg  [speeds up one-time build])])
321515ec619Smrgif test "x$enable_dependency_tracking" != xno; then
322515ec619Smrg  am_depcomp="$ac_aux_dir/depcomp"
323515ec619Smrg  AMDEPBACKSLASH='\'
324515ec619Smrg  am__nodep='_no'
32544dda7b2Smrgfi
326515ec619SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327515ec619SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328515ec619Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329515ec619SmrgAC_SUBST([am__nodep])dnl
330515ec619Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33144dda7b2Smrg])
3327a3b38f7Smrg
333515ec619Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3347a3b38f7Smrg
335515ec619Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336515ec619Smrg#
337515ec619Smrg# This file is free software; the Free Software Foundation
338515ec619Smrg# gives unlimited permission to copy and/or distribute it,
339515ec619Smrg# with or without modifications, as long as this notice is preserved.
3407a3b38f7Smrg
341515ec619Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342515ec619Smrg# ------------------------------
343515ec619SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344515ec619Smrg[{
345515ec619Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346515ec619Smrg  # are listed without --file.  Let's play safe and only enable the eval
347515ec619Smrg  # if we detect the quoting.
348515ec619Smrg  # TODO: see whether this extra hack can be removed once we start
349515ec619Smrg  # requiring Autoconf 2.70 or later.
350515ec619Smrg  AS_CASE([$CONFIG_FILES],
351515ec619Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352515ec619Smrg          [*], [set x $CONFIG_FILES])
353515ec619Smrg  shift
354515ec619Smrg  # Used to flag and report bootstrapping failures.
355515ec619Smrg  am_rc=0
356515ec619Smrg  for am_mf
357515ec619Smrg  do
358515ec619Smrg    # Strip MF so we end up with the name of the file.
359515ec619Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360515ec619Smrg    # Check whether this is an Automake generated Makefile which includes
361515ec619Smrg    # dependency-tracking related rules and includes.
362515ec619Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363515ec619Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364515ec619Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365515ec619Smrg      || continue
366515ec619Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367515ec619Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368515ec619Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369515ec619Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370515ec619Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371515ec619Smrg  done
372515ec619Smrg  if test $am_rc -ne 0; then
373515ec619Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374515ec619Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375515ec619Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376515ec619Smrg    necessary).  You can also try re-running configure with the
377515ec619Smrg    '--disable-dependency-tracking' option to at least be able to build
378515ec619Smrg    the package (albeit without support for automatic dependency tracking).])
3796fc0178dSmrg  fi
380515ec619Smrg  AS_UNSET([am_dirpart])
381515ec619Smrg  AS_UNSET([am_filepart])
382515ec619Smrg  AS_UNSET([am_mf])
383515ec619Smrg  AS_UNSET([am_rc])
384515ec619Smrg  rm -f conftest-deps.mk
385515ec619Smrg}
386515ec619Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3877a3b38f7Smrg
3887a3b38f7Smrg
389515ec619Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390515ec619Smrg# -----------------------------
391515ec619Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392515ec619Smrg#
393515ec619Smrg# This code is only required when automatic dependency tracking is enabled.
394515ec619Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395515ec619Smrg# order to bootstrap the dependency handling code.
396515ec619SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397515ec619Smrg[AC_CONFIG_COMMANDS([depfiles],
398515ec619Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399515ec619Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4007a3b38f7Smrg
401515ec619Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4027a3b38f7Smrg
403515ec619Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404515ec619Smrg#
405515ec619Smrg# This file is free software; the Free Software Foundation
406515ec619Smrg# gives unlimited permission to copy and/or distribute it,
407515ec619Smrg# with or without modifications, as long as this notice is preserved.
4087a3b38f7Smrg
409515ec619Smrg# This macro actually does too much.  Some checks are only needed if
410515ec619Smrg# your package does certain things.  But this isn't really a big deal.
411fc544a13Smrg
412515ec619Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413515ec619Smrgm4_define([AC_PROG_CC],
414515ec619Smrgm4_defn([AC_PROG_CC])
415515ec619Smrg[_AM_PROG_CC_C_O
416515ec619Smrg])
417ff559fabSmrg
418515ec619Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419515ec619Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420515ec619Smrg# -----------------------------------------------
421515ec619Smrg# The call with PACKAGE and VERSION arguments is the old style
422515ec619Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423515ec619Smrg# and VERSION should now be passed to AC_INIT and removed from
424515ec619Smrg# the call to AM_INIT_AUTOMAKE.
425515ec619Smrg# We support both call styles for the transition.  After
426515ec619Smrg# the next Automake release, Autoconf can make the AC_INIT
427515ec619Smrg# arguments mandatory, and then we can depend on a new Autoconf
428515ec619Smrg# release and drop the old call support.
429515ec619SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430515ec619Smrg[AC_PREREQ([2.65])dnl
431515ec619Smrgm4_ifdef([_$0_ALREADY_INIT],
432515ec619Smrg  [m4_fatal([$0 expanded multiple times
433515ec619Smrg]m4_defn([_$0_ALREADY_INIT]))],
434515ec619Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435515ec619Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436515ec619Smrgdnl the ones we care about.
437515ec619Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438515ec619SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439515ec619SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440515ec619Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441515ec619Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442515ec619Smrg  # is not polluted with repeated "-I."
443515ec619Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444515ec619Smrg  # test to see if srcdir already configured
445515ec619Smrg  if test -f $srcdir/config.status; then
446515ec619Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447515ec619Smrg  fi
448515ec619Smrgfi
449ff559fabSmrg
450515ec619Smrg# test whether we have cygpath
451515ec619Smrgif test -z "$CYGPATH_W"; then
452515ec619Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453515ec619Smrg    CYGPATH_W='cygpath -w'
454515ec619Smrg  else
455515ec619Smrg    CYGPATH_W=echo
456515ec619Smrg  fi
457515ec619Smrgfi
458515ec619SmrgAC_SUBST([CYGPATH_W])
459fc544a13Smrg
460515ec619Smrg# Define the identity of the package.
461515ec619Smrgdnl Distinguish between old-style and new-style calls.
462515ec619Smrgm4_ifval([$2],
463515ec619Smrg[AC_DIAGNOSE([obsolete],
464515ec619Smrg             [$0: two- and three-arguments forms are deprecated.])
465515ec619Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466515ec619Smrg AC_SUBST([PACKAGE], [$1])dnl
467515ec619Smrg AC_SUBST([VERSION], [$2])],
468515ec619Smrg[_AM_SET_OPTIONS([$1])dnl
469515ec619Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470515ec619Smrgm4_if(
471515ec619Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472515ec619Smrg  [ok:ok],,
473515ec619Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474515ec619Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475515ec619Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476fc544a13Smrg
477515ec619Smrg_AM_IF_OPTION([no-define],,
478515ec619Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479515ec619Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480fc544a13Smrg
481515ec619Smrg# Some tools Automake needs.
482515ec619SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483515ec619SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484515ec619SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485515ec619SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486515ec619SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487515ec619SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488515ec619SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489515ec619SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490515ec619SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491515ec619SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492515ec619Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493515ec619Smrg# dies out for good.  For more background, see:
494515ec619Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495515ec619Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496515ec619SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497515ec619Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498515ec619Smrg# system "awk" is bad on some platforms.
499515ec619SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500515ec619SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501515ec619SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502515ec619Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503515ec619Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504515ec619Smrg			     [_AM_PROG_TAR([v7])])])
505515ec619Smrg_AM_IF_OPTION([no-dependencies],,
506515ec619Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507515ec619Smrg		  [_AM_DEPENDENCIES([CC])],
508515ec619Smrg		  [m4_define([AC_PROG_CC],
509515ec619Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510515ec619SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511515ec619Smrg		  [_AM_DEPENDENCIES([CXX])],
512515ec619Smrg		  [m4_define([AC_PROG_CXX],
513515ec619Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514515ec619SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515515ec619Smrg		  [_AM_DEPENDENCIES([OBJC])],
516515ec619Smrg		  [m4_define([AC_PROG_OBJC],
517515ec619Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518515ec619SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519515ec619Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520515ec619Smrg		  [m4_define([AC_PROG_OBJCXX],
521515ec619Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5226fc0178dSmrg])
523515ec619Smrg# Variables for tags utilities; see am/tags.am
524515ec619Smrgif test -z "$CTAGS"; then
525515ec619Smrg  CTAGS=ctags
526515ec619Smrgfi
527515ec619SmrgAC_SUBST([CTAGS])
528515ec619Smrgif test -z "$ETAGS"; then
529515ec619Smrg  ETAGS=etags
530515ec619Smrgfi
531515ec619SmrgAC_SUBST([ETAGS])
532515ec619Smrgif test -z "$CSCOPE"; then
533515ec619Smrg  CSCOPE=cscope
534515ec619Smrgfi
535515ec619SmrgAC_SUBST([CSCOPE])
536fc544a13Smrg
537515ec619SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538515ec619Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539515ec619Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540515ec619Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541515ec619SmrgAC_CONFIG_COMMANDS_PRE(dnl
542515ec619Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543515ec619Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544ff559fabSmrg
545515ec619Smrg# POSIX will say in a future version that running "rm -f" with no argument
546515ec619Smrg# is OK; and we want to be able to make that assumption in our Makefile
547515ec619Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548515ec619Smrg# actually supported "in the wild" to an acceptable degree.
549515ec619Smrg# See automake bug#10828.
550515ec619Smrg# To make any issue more visible, cause the running configure to be aborted
551515ec619Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552515ec619Smrg# user can still override this though.
553515ec619Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554515ec619Smrg  cat >&2 <<'END'
555515ec619SmrgOops!
556ff559fabSmrg
557515ec619SmrgYour 'rm' program seems unable to run without file operands specified
558515ec619Smrgon the command line, even when the '-f' option is present.  This is contrary
559515ec619Smrgto the behaviour of most rm programs out there, and not conforming with
560515ec619Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561ff559fabSmrg
562515ec619SmrgPlease tell bug-automake@gnu.org about your system, including the value
563515ec619Smrgof your $PATH and any error possibly output before this message.  This
564515ec619Smrgcan help us improve future automake versions.
565ff559fabSmrg
566515ec619SmrgEND
567515ec619Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568515ec619Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569515ec619Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570515ec619Smrg    echo >&2
571515ec619Smrg  else
572515ec619Smrg    cat >&2 <<'END'
573515ec619SmrgAborting the configuration process, to ensure you take notice of the issue.
574ff559fabSmrg
575515ec619SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576515ec619Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577ff559fabSmrg
578515ec619SmrgIf you want to complete the configuration process using your problematic
579515ec619Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580515ec619Smrgto "yes", and re-run configure.
5817a3b38f7Smrg
582515ec619SmrgEND
583515ec619Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584515ec619Smrg  fi
585515ec619Smrgfi
586515ec619Smrgdnl The trailing newline in this macro's definition is deliberate, for
587515ec619Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588515ec619Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5896fc0178dSmrg])
59044dda7b2Smrg
591515ec619Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592515ec619Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593515ec619Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594515ec619Smrgm4_define([_AC_COMPILER_EXEEXT],
595515ec619Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596ff559fabSmrg
597515ec619Smrg# When config.status generates a header, we must update the stamp-h file.
598515ec619Smrg# This file resides in the same directory as the config header
599515ec619Smrg# that is generated.  The stamp files are numbered to have different names.
6007a3b38f7Smrg
601515ec619Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602515ec619Smrg# loop where config.status creates the headers, so we can generate
603515ec619Smrg# our stamp files there.
604515ec619SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605515ec619Smrg[# Compute $1's index in $config_headers.
606515ec619Smrg_am_arg=$1
607515ec619Smrg_am_stamp_count=1
608515ec619Smrgfor _am_header in $config_headers :; do
609515ec619Smrg  case $_am_header in
610515ec619Smrg    $_am_arg | $_am_arg:* )
611515ec619Smrg      break ;;
612515ec619Smrg    * )
613515ec619Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614515ec619Smrg  esac
615515ec619Smrgdone
616515ec619Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6177a3b38f7Smrg
618515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619515ec619Smrg#
620515ec619Smrg# This file is free software; the Free Software Foundation
621515ec619Smrg# gives unlimited permission to copy and/or distribute it,
622515ec619Smrg# with or without modifications, as long as this notice is preserved.
6236fc0178dSmrg
624515ec619Smrg# AM_PROG_INSTALL_SH
625515ec619Smrg# ------------------
626515ec619Smrg# Define $install_sh.
627515ec619SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628515ec619Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629515ec619Smrgif test x"${install_sh+set}" != xset; then
630515ec619Smrg  case $am_aux_dir in
631515ec619Smrg  *\ * | *\	*)
632515ec619Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633515ec619Smrg  *)
634515ec619Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635515ec619Smrg  esac
636515ec619Smrgfi
637515ec619SmrgAC_SUBST([install_sh])])
638ff559fabSmrg
639515ec619Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640515ec619Smrg#
641515ec619Smrg# This file is free software; the Free Software Foundation
642515ec619Smrg# gives unlimited permission to copy and/or distribute it,
643515ec619Smrg# with or without modifications, as long as this notice is preserved.
644ff559fabSmrg
645515ec619Smrg# Check whether the underlying file-system supports filenames
646515ec619Smrg# with a leading dot.  For instance MS-DOS doesn't.
647515ec619SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648515ec619Smrg[rm -rf .tst 2>/dev/null
649515ec619Smrgmkdir .tst 2>/dev/null
650515ec619Smrgif test -d .tst; then
651515ec619Smrg  am__leading_dot=.
652515ec619Smrgelse
653515ec619Smrg  am__leading_dot=_
654515ec619Smrgfi
655515ec619Smrgrmdir .tst 2>/dev/null
656515ec619SmrgAC_SUBST([am__leading_dot])])
6577a3b38f7Smrg
658515ec619Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659ff559fabSmrg
660515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661515ec619Smrg#
662515ec619Smrg# This file is free software; the Free Software Foundation
663515ec619Smrg# gives unlimited permission to copy and/or distribute it,
664515ec619Smrg# with or without modifications, as long as this notice is preserved.
665ff559fabSmrg
666515ec619Smrg# AM_MAKE_INCLUDE()
667515ec619Smrg# -----------------
668515ec619Smrg# Check whether make has an 'include' directive that can support all
669515ec619Smrg# the idioms we need for our automatic dependency tracking code.
670515ec619SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671515ec619Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672515ec619Smrgcat > confinc.mk << 'END'
673515ec619Smrgam__doit:
674515ec619Smrg	@echo this is the am__doit target >confinc.out
675515ec619Smrg.PHONY: am__doit
676515ec619SmrgEND
677515ec619Smrgam__include="#"
678515ec619Smrgam__quote=
679515ec619Smrg# BSD make does it like this.
680515ec619Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681515ec619Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682515ec619Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683515ec619Smrg_am_result=no
684515ec619Smrgfor s in GNU BSD; do
685515ec619Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686515ec619Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687515ec619Smrg      ['0:this is the am__doit target'],
688515ec619Smrg      [AS_CASE([$s],
689515ec619Smrg          [BSD], [am__include='.include' am__quote='"'],
690515ec619Smrg          [am__include='include' am__quote=''])])
691515ec619Smrg  if test "$am__include" != "#"; then
692515ec619Smrg    _am_result="yes ($s style)"
693515ec619Smrg    break
694515ec619Smrg  fi
695515ec619Smrgdone
696515ec619Smrgrm -f confinc.* confmf.*
697515ec619SmrgAC_MSG_RESULT([${_am_result}])
698515ec619SmrgAC_SUBST([am__include])])
699515ec619SmrgAC_SUBST([am__quote])])
700ff559fabSmrg
701515ec619Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702ff559fabSmrg
703515ec619Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704515ec619Smrg#
705515ec619Smrg# This file is free software; the Free Software Foundation
706515ec619Smrg# gives unlimited permission to copy and/or distribute it,
707515ec619Smrg# with or without modifications, as long as this notice is preserved.
708fc544a13Smrg
709515ec619Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710515ec619Smrg# ------------------------------
711515ec619SmrgAC_DEFUN([AM_MISSING_PROG],
712515ec619Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713515ec619Smrg$1=${$1-"${am_missing_run}$2"}
714515ec619SmrgAC_SUBST($1)])
715515ec619Smrg
716515ec619Smrg# AM_MISSING_HAS_RUN
717515ec619Smrg# ------------------
718515ec619Smrg# Define MISSING if not defined so far and test if it is modern enough.
719515ec619Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720515ec619SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721515ec619Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722515ec619SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723515ec619Smrgif test x"${MISSING+set}" != xset; then
724515ec619Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725515ec619Smrgfi
726515ec619Smrg# Use eval to expand $SHELL
727515ec619Smrgif eval "$MISSING --is-lightweight"; then
728515ec619Smrg  am_missing_run="$MISSING "
729515ec619Smrgelse
730515ec619Smrg  am_missing_run=
731515ec619Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732515ec619Smrgfi
733515ec619Smrg])
734ff559fabSmrg
735515ec619Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736fc544a13Smrg
737515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738515ec619Smrg#
739515ec619Smrg# This file is free software; the Free Software Foundation
740515ec619Smrg# gives unlimited permission to copy and/or distribute it,
741515ec619Smrg# with or without modifications, as long as this notice is preserved.
742ff559fabSmrg
743515ec619Smrg# _AM_MANGLE_OPTION(NAME)
744515ec619Smrg# -----------------------
745515ec619SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746515ec619Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747fc544a13Smrg
748515ec619Smrg# _AM_SET_OPTION(NAME)
749515ec619Smrg# --------------------
750515ec619Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751515ec619SmrgAC_DEFUN([_AM_SET_OPTION],
752515ec619Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753fc544a13Smrg
754515ec619Smrg# _AM_SET_OPTIONS(OPTIONS)
755515ec619Smrg# ------------------------
756515ec619Smrg# OPTIONS is a space-separated list of Automake options.
757515ec619SmrgAC_DEFUN([_AM_SET_OPTIONS],
758515ec619Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759ff559fabSmrg
760515ec619Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761515ec619Smrg# -------------------------------------------
762515ec619Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763515ec619SmrgAC_DEFUN([_AM_IF_OPTION],
764515ec619Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7657a3b38f7Smrg
766515ec619Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767515ec619Smrg#
768515ec619Smrg# This file is free software; the Free Software Foundation
769515ec619Smrg# gives unlimited permission to copy and/or distribute it,
770515ec619Smrg# with or without modifications, as long as this notice is preserved.
771fc544a13Smrg
772515ec619Smrg# _AM_PROG_CC_C_O
773515ec619Smrg# ---------------
774515ec619Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775515ec619Smrg# to automatically call this.
776515ec619SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777515ec619Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778515ec619SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779515ec619SmrgAC_LANG_PUSH([C])dnl
780515ec619SmrgAC_CACHE_CHECK(
781515ec619Smrg  [whether $CC understands -c and -o together],
782515ec619Smrg  [am_cv_prog_cc_c_o],
783515ec619Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784515ec619Smrg  # Make sure it works both with $CC and with simple cc.
785515ec619Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786515ec619Smrg  # compilers refuse to overwrite an existing .o file with -o,
787515ec619Smrg  # though they will create one.
788515ec619Smrg  am_cv_prog_cc_c_o=yes
789515ec619Smrg  for am_i in 1 2; do
790515ec619Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791515ec619Smrg         && test -f conftest2.$ac_objext; then
792515ec619Smrg      : OK
793515ec619Smrg    else
794515ec619Smrg      am_cv_prog_cc_c_o=no
795515ec619Smrg      break
796515ec619Smrg    fi
797515ec619Smrg  done
798515ec619Smrg  rm -f core conftest*
799515ec619Smrg  unset am_i])
800515ec619Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801515ec619Smrg   # Losing compiler, so override with the script.
802515ec619Smrg   # FIXME: It is wrong to rewrite CC.
803515ec619Smrg   # But if we don't then we get into trouble of one sort or another.
804515ec619Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805515ec619Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806515ec619Smrg   CC="$am_aux_dir/compile $CC"
807515ec619Smrgfi
808515ec619SmrgAC_LANG_POP([C])])
8097a3b38f7Smrg
810515ec619Smrg# For backward compatibility.
811515ec619SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8126fc0178dSmrg
813515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81444dda7b2Smrg#
815515ec619Smrg# This file is free software; the Free Software Foundation
816515ec619Smrg# gives unlimited permission to copy and/or distribute it,
817515ec619Smrg# with or without modifications, as long as this notice is preserved.
8186fc0178dSmrg
819515ec619Smrg# AM_RUN_LOG(COMMAND)
820515ec619Smrg# -------------------
821515ec619Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822515ec619Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823515ec619SmrgAC_DEFUN([AM_RUN_LOG],
824515ec619Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825515ec619Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826515ec619Smrg   ac_status=$?
827515ec619Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828515ec619Smrg   (exit $ac_status); }])
8297a3b38f7Smrg
830515ec619Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8316fc0178dSmrg
832515ec619Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833ff559fabSmrg#
834515ec619Smrg# This file is free software; the Free Software Foundation
835515ec619Smrg# gives unlimited permission to copy and/or distribute it,
836515ec619Smrg# with or without modifications, as long as this notice is preserved.
837ff559fabSmrg
838515ec619Smrg# AM_SANITY_CHECK
839515ec619Smrg# ---------------
840515ec619SmrgAC_DEFUN([AM_SANITY_CHECK],
841515ec619Smrg[AC_MSG_CHECKING([whether build environment is sane])
842515ec619Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843515ec619Smrg# name.  Accept space and tab only in the latter.
844515ec619Smrgam_lf='
845515ec619Smrg'
846515ec619Smrgcase `pwd` in
847515ec619Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848515ec619Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849515ec619Smrgesac
850515ec619Smrgcase $srcdir in
851515ec619Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852515ec619Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853515ec619Smrgesac
854ff559fabSmrg
855515ec619Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856515ec619Smrg# arguments.  Must try -L first in case configure is actually a
857515ec619Smrg# symlink; some systems play weird games with the mod time of symlinks
858515ec619Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859515ec619Smrg# directory).
860515ec619Smrgif (
861515ec619Smrg   am_has_slept=no
862515ec619Smrg   for am_try in 1 2; do
863515ec619Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864515ec619Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865515ec619Smrg     if test "$[*]" = "X"; then
866515ec619Smrg	# -L didn't work.
867515ec619Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868515ec619Smrg     fi
869515ec619Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870515ec619Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871ff559fabSmrg
872515ec619Smrg	# If neither matched, then we have a broken ls.  This can happen
873515ec619Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874515ec619Smrg	# broken ls alias from the environment.  This has actually
875515ec619Smrg	# happened.  Such a system could not be considered "sane".
876515ec619Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877515ec619Smrg  alias in your environment])
878515ec619Smrg     fi
879515ec619Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880515ec619Smrg       break
881515ec619Smrg     fi
882515ec619Smrg     # Just in case.
883515ec619Smrg     sleep 1
884515ec619Smrg     am_has_slept=yes
885515ec619Smrg   done
886515ec619Smrg   test "$[2]" = conftest.file
887515ec619Smrg   )
888515ec619Smrgthen
889515ec619Smrg   # Ok.
890515ec619Smrg   :
891515ec619Smrgelse
892515ec619Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893515ec619SmrgCheck your system clock])
894515ec619Smrgfi
895515ec619SmrgAC_MSG_RESULT([yes])
896515ec619Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897515ec619Smrg# generated files are strictly newer.
898515ec619Smrgam_sleep_pid=
899515ec619Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900515ec619Smrg  ( sleep 1 ) &
901515ec619Smrg  am_sleep_pid=$!
902515ec619Smrgfi
903515ec619SmrgAC_CONFIG_COMMANDS_PRE(
904515ec619Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905515ec619Smrg   if test -n "$am_sleep_pid"; then
906515ec619Smrg     # Hide warnings about reused PIDs.
907515ec619Smrg     wait $am_sleep_pid 2>/dev/null
908515ec619Smrg   fi
909515ec619Smrg   AC_MSG_RESULT([done])])
910515ec619Smrgrm -f conftest.file
911515ec619Smrg])
912ff559fabSmrg
913515ec619Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914515ec619Smrg#
915515ec619Smrg# This file is free software; the Free Software Foundation
916515ec619Smrg# gives unlimited permission to copy and/or distribute it,
917515ec619Smrg# with or without modifications, as long as this notice is preserved.
918ff559fabSmrg
919515ec619Smrg# AM_SILENT_RULES([DEFAULT])
920515ec619Smrg# --------------------------
921515ec619Smrg# Enable less verbose build rules; with the default set to DEFAULT
922515ec619Smrg# ("yes" being less verbose, "no" or empty being verbose).
923515ec619SmrgAC_DEFUN([AM_SILENT_RULES],
924515ec619Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925515ec619SmrgAS_HELP_STRING(
926515ec619Smrg  [--enable-silent-rules],
927515ec619Smrg  [less verbose build output (undo: "make V=1")])
928515ec619SmrgAS_HELP_STRING(
929515ec619Smrg  [--disable-silent-rules],
930515ec619Smrg  [verbose build output (undo: "make V=0")])dnl
931515ec619Smrg])
932515ec619Smrgcase $enable_silent_rules in @%:@ (((
933515ec619Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934515ec619Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935515ec619Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936515ec619Smrgesac
937515ec619Smrgdnl
938515ec619Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939515ec619Smrgdnl do not support nested variable expansions.
940515ec619Smrgdnl See automake bug#9928 and bug#10237.
941515ec619Smrgam_make=${MAKE-make}
942515ec619SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943515ec619Smrg   [am_cv_make_support_nested_variables],
944515ec619Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945515ec619SmrgBAR0=false
946515ec619SmrgBAR1=true
947515ec619SmrgV=1
948515ec619Smrgam__doit:
949515ec619Smrg	@$(TRUE)
950515ec619Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951515ec619Smrg  am_cv_make_support_nested_variables=yes
952515ec619Smrgelse
953515ec619Smrg  am_cv_make_support_nested_variables=no
954515ec619Smrgfi])
955515ec619Smrgif test $am_cv_make_support_nested_variables = yes; then
956515ec619Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957515ec619Smrg  AM_V='$(V)'
958515ec619Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959515ec619Smrgelse
960515ec619Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961515ec619Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962515ec619Smrgfi
963515ec619SmrgAC_SUBST([AM_V])dnl
964515ec619SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965515ec619SmrgAC_SUBST([AM_DEFAULT_V])dnl
966515ec619SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967515ec619SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968515ec619SmrgAM_BACKSLASH='\'
969515ec619SmrgAC_SUBST([AM_BACKSLASH])dnl
970515ec619Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971515ec619Smrg])
972ff559fabSmrg
973515ec619Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974515ec619Smrg#
975515ec619Smrg# This file is free software; the Free Software Foundation
976515ec619Smrg# gives unlimited permission to copy and/or distribute it,
977515ec619Smrg# with or without modifications, as long as this notice is preserved.
978fc544a13Smrg
979515ec619Smrg# AM_PROG_INSTALL_STRIP
980515ec619Smrg# ---------------------
981515ec619Smrg# One issue with vendor 'install' (even GNU) is that you can't
982515ec619Smrg# specify the program used to strip binaries.  This is especially
983515ec619Smrg# annoying in cross-compiling environments, where the build's strip
984515ec619Smrg# is unlikely to handle the host's binaries.
985515ec619Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986515ec619Smrg# always use install-sh in "make install-strip", and initialize
987515ec619Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988515ec619SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989515ec619Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990515ec619Smrg# Installed binaries are usually stripped using 'strip' when the user
991515ec619Smrg# run "make install-strip".  However 'strip' might not be the right
992515ec619Smrg# tool to use in cross-compilation environments, therefore Automake
993515ec619Smrg# will honor the 'STRIP' environment variable to overrule this program.
994515ec619Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995515ec619Smrgif test "$cross_compiling" != no; then
996515ec619Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997515ec619Smrgfi
998515ec619SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999515ec619SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000ff559fabSmrg
1001515ec619Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002515ec619Smrg#
1003515ec619Smrg# This file is free software; the Free Software Foundation
1004515ec619Smrg# gives unlimited permission to copy and/or distribute it,
1005515ec619Smrg# with or without modifications, as long as this notice is preserved.
1006ff559fabSmrg
1007515ec619Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008515ec619Smrg# ---------------------------
1009515ec619Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010515ec619Smrg# This macro is traced by Automake.
1011515ec619SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012ff559fabSmrg
1013515ec619Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014515ec619Smrg# --------------------------
1015515ec619Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016515ec619SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017ff559fabSmrg
1018515ec619Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101944dda7b2Smrg
1020515ec619Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021515ec619Smrg#
1022515ec619Smrg# This file is free software; the Free Software Foundation
1023515ec619Smrg# gives unlimited permission to copy and/or distribute it,
1024515ec619Smrg# with or without modifications, as long as this notice is preserved.
10256fc0178dSmrg
1026515ec619Smrg# _AM_PROG_TAR(FORMAT)
1027515ec619Smrg# --------------------
1028515ec619Smrg# Check how to create a tarball in format FORMAT.
1029515ec619Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030515ec619Smrg#
1031515ec619Smrg# Substitute a variable $(am__tar) that is a command
1032515ec619Smrg# writing to stdout a FORMAT-tarball containing the directory
1033515ec619Smrg# $tardir.
1034515ec619Smrg#     tardir=directory && $(am__tar) > result.tar
1035515ec619Smrg#
1036515ec619Smrg# Substitute a variable $(am__untar) that extract such
1037515ec619Smrg# a tarball read from stdin.
1038515ec619Smrg#     $(am__untar) < result.tar
1039515ec619Smrg#
1040515ec619SmrgAC_DEFUN([_AM_PROG_TAR],
1041515ec619Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042515ec619Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043515ec619SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044862f5301Smrg
1045515ec619Smrg# We'll loop over all known methods to create a tar archive until one works.
1046515ec619Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047862f5301Smrg
1048515ec619Smrgm4_if([$1], [v7],
1049515ec619Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050ff559fabSmrg
1051515ec619Smrg  [m4_case([$1],
1052515ec619Smrg    [ustar],
1053515ec619Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054515ec619Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055515ec619Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056515ec619Smrg      # and bug#13588).
1057515ec619Smrg      am_max_uid=2097151 # 2^21 - 1
1058515ec619Smrg      am_max_gid=$am_max_uid
1059515ec619Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060515ec619Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061515ec619Smrg      # below are definitely unexpected, so allow the users to see them
1062515ec619Smrg      # (that is, avoid stderr redirection).
1063515ec619Smrg      am_uid=`id -u || echo unknown`
1064515ec619Smrg      am_gid=`id -g || echo unknown`
1065515ec619Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066515ec619Smrg      if test $am_uid -le $am_max_uid; then
1067515ec619Smrg         AC_MSG_RESULT([yes])
1068515ec619Smrg      else
1069515ec619Smrg         AC_MSG_RESULT([no])
1070515ec619Smrg         _am_tools=none
1071515ec619Smrg      fi
1072515ec619Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073515ec619Smrg      if test $am_gid -le $am_max_gid; then
1074515ec619Smrg         AC_MSG_RESULT([yes])
1075515ec619Smrg      else
1076515ec619Smrg        AC_MSG_RESULT([no])
1077515ec619Smrg        _am_tools=none
1078515ec619Smrg      fi],
1079ff559fabSmrg
1080515ec619Smrg  [pax],
1081515ec619Smrg    [],
10827a3b38f7Smrg
1083515ec619Smrg  [m4_fatal([Unknown tar format])])
1084ff559fabSmrg
1085515ec619Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086ff559fabSmrg
1087515ec619Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088515ec619Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089515ec619Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090ff559fabSmrg
1091515ec619Smrg  for _am_tool in $_am_tools; do
1092515ec619Smrg    case $_am_tool in
1093515ec619Smrg    gnutar)
1094515ec619Smrg      for _am_tar in tar gnutar gtar; do
1095515ec619Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096515ec619Smrg      done
1097515ec619Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098515ec619Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099515ec619Smrg      am__untar="$_am_tar -xf -"
1100515ec619Smrg      ;;
1101515ec619Smrg    plaintar)
1102515ec619Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103515ec619Smrg      # ustar tarball either.
1104515ec619Smrg      (tar --version) >/dev/null 2>&1 && continue
1105515ec619Smrg      am__tar='tar chf - "$$tardir"'
1106515ec619Smrg      am__tar_='tar chf - "$tardir"'
1107515ec619Smrg      am__untar='tar xf -'
1108515ec619Smrg      ;;
1109515ec619Smrg    pax)
1110515ec619Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111515ec619Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112515ec619Smrg      am__untar='pax -r'
1113515ec619Smrg      ;;
1114515ec619Smrg    cpio)
1115515ec619Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116515ec619Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117515ec619Smrg      am__untar='cpio -i -H $1 -d'
1118515ec619Smrg      ;;
1119515ec619Smrg    none)
1120515ec619Smrg      am__tar=false
1121515ec619Smrg      am__tar_=false
1122515ec619Smrg      am__untar=false
1123515ec619Smrg      ;;
1124515ec619Smrg    esac
1125ff559fabSmrg
1126515ec619Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127515ec619Smrg    # and am__untar set.
1128515ec619Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129ff559fabSmrg
1130515ec619Smrg    # tar/untar a dummy directory, and stop if the command works.
1131515ec619Smrg    rm -rf conftest.dir
1132515ec619Smrg    mkdir conftest.dir
1133515ec619Smrg    echo GrepMe > conftest.dir/file
1134515ec619Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135515ec619Smrg    rm -rf conftest.dir
1136515ec619Smrg    if test -s conftest.tar; then
1137515ec619Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138515ec619Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139515ec619Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140515ec619Smrg    fi
1141515ec619Smrg  done
1142515ec619Smrg  rm -rf conftest.dir
1143ff559fabSmrg
1144515ec619Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145515ec619Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146ff559fabSmrg
1147515ec619SmrgAC_SUBST([am__tar])
1148515ec619SmrgAC_SUBST([am__untar])
1149515ec619Smrg]) # _AM_PROG_TAR
1150ff559fabSmrg
1151515ec619Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152515ec619Smrgdnl serial 11 (pkg-config-0.29)
1153515ec619Smrgdnl
1154515ec619Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155515ec619Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156515ec619Smrgdnl
1157515ec619Smrgdnl This program is free software; you can redistribute it and/or modify
1158515ec619Smrgdnl it under the terms of the GNU General Public License as published by
1159515ec619Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160515ec619Smrgdnl (at your option) any later version.
1161515ec619Smrgdnl
1162515ec619Smrgdnl This program is distributed in the hope that it will be useful, but
1163515ec619Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164515ec619Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165515ec619Smrgdnl General Public License for more details.
1166515ec619Smrgdnl
1167515ec619Smrgdnl You should have received a copy of the GNU General Public License
1168515ec619Smrgdnl along with this program; if not, write to the Free Software
1169515ec619Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170515ec619Smrgdnl 02111-1307, USA.
1171515ec619Smrgdnl
1172515ec619Smrgdnl As a special exception to the GNU General Public License, if you
1173515ec619Smrgdnl distribute this file as part of a program that contains a
1174515ec619Smrgdnl configuration script generated by Autoconf, you may include it under
1175515ec619Smrgdnl the same distribution terms that you use for the rest of that
1176515ec619Smrgdnl program.
1177ff559fabSmrg
1178515ec619Smrgdnl PKG_PREREQ(MIN-VERSION)
1179515ec619Smrgdnl -----------------------
1180515ec619Smrgdnl Since: 0.29
1181515ec619Smrgdnl
1182515ec619Smrgdnl Verify that the version of the pkg-config macros are at least
1183515ec619Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184515ec619Smrgdnl installed version of pkg-config, this checks the developer's version
1185515ec619Smrgdnl of pkg.m4 when generating configure.
1186515ec619Smrgdnl
1187515ec619Smrgdnl To ensure that this macro is defined, also add:
1188515ec619Smrgdnl m4_ifndef([PKG_PREREQ],
1189515ec619Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190515ec619Smrgdnl
1191515ec619Smrgdnl See the "Since" comment for each macro you use to see what version
1192515ec619Smrgdnl of the macros you require.
1193515ec619Smrgm4_defun([PKG_PREREQ],
1194515ec619Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195515ec619Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196515ec619Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197515ec619Smrg])dnl PKG_PREREQ
1198ff559fabSmrg
1199515ec619Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200515ec619Smrgdnl ----------------------------------
1201515ec619Smrgdnl Since: 0.16
1202515ec619Smrgdnl
1203515ec619Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204515ec619Smrgdnl first found in the path. Checks that the version of pkg-config found
1205515ec619Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206515ec619Smrgdnl used since that's the first version where most current features of
1207515ec619Smrgdnl pkg-config existed.
1208515ec619SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209515ec619Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210515ec619Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211515ec619Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212515ec619SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213515ec619SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214515ec619SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215ff559fabSmrg
1216515ec619Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217515ec619Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218515ec619Smrgfi
1219515ec619Smrgif test -n "$PKG_CONFIG"; then
1220515ec619Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221515ec619Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222515ec619Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223515ec619Smrg		AC_MSG_RESULT([yes])
1224515ec619Smrg	else
1225515ec619Smrg		AC_MSG_RESULT([no])
1226515ec619Smrg		PKG_CONFIG=""
1227515ec619Smrg	fi
1228515ec619Smrgfi[]dnl
1229515ec619Smrg])dnl PKG_PROG_PKG_CONFIG
123044dda7b2Smrg
1231515ec619Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232515ec619Smrgdnl -------------------------------------------------------------------
1233515ec619Smrgdnl Since: 0.18
1234515ec619Smrgdnl
1235515ec619Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236515ec619Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237515ec619Smrgdnl
1238515ec619Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239515ec619Smrgdnl only at the first occurence in configure.ac, so if the first place
1240515ec619Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241515ec619Smrgdnl have to call PKG_CHECK_EXISTS manually
1242515ec619SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243515ec619Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244515ec619Smrgif test -n "$PKG_CONFIG" && \
1245515ec619Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246515ec619Smrg  m4_default([$2], [:])
1247515ec619Smrgm4_ifvaln([$3], [else
1248515ec619Smrg  $3])dnl
1249515ec619Smrgfi])
1250862f5301Smrg
1251515ec619Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252515ec619Smrgdnl ---------------------------------------------
1253515ec619Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254515ec619Smrgdnl pkg_failed based on the result.
1255515ec619Smrgm4_define([_PKG_CONFIG],
1256515ec619Smrg[if test -n "$$1"; then
1257515ec619Smrg    pkg_cv_[]$1="$$1"
1258515ec619Smrg elif test -n "$PKG_CONFIG"; then
1259515ec619Smrg    PKG_CHECK_EXISTS([$3],
1260515ec619Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261515ec619Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262515ec619Smrg		     [pkg_failed=yes])
1263515ec619Smrg else
1264515ec619Smrg    pkg_failed=untried
1265515ec619Smrgfi[]dnl
1266515ec619Smrg])dnl _PKG_CONFIG
1267ff559fabSmrg
1268515ec619Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269515ec619Smrgdnl ---------------------------
1270515ec619Smrgdnl Internal check to see if pkg-config supports short errors.
1271515ec619SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272515ec619Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273515ec619Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274515ec619Smrg        _pkg_short_errors_supported=yes
1275515ec619Smrgelse
1276515ec619Smrg        _pkg_short_errors_supported=no
1277515ec619Smrgfi[]dnl
1278515ec619Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279ff559fabSmrg
128044dda7b2Smrg
1281515ec619Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282515ec619Smrgdnl   [ACTION-IF-NOT-FOUND])
1283515ec619Smrgdnl --------------------------------------------------------------
1284515ec619Smrgdnl Since: 0.4.0
1285515ec619Smrgdnl
1286515ec619Smrgdnl Note that if there is a possibility the first call to
1287515ec619Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288515ec619Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289515ec619SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290515ec619Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291515ec619SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292515ec619SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129344dda7b2Smrg
1294515ec619Smrgpkg_failed=no
1295515ec619SmrgAC_MSG_CHECKING([for $1])
1296ff559fabSmrg
1297515ec619Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298515ec619Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129944dda7b2Smrg
1300515ec619Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301515ec619Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302515ec619SmrgSee the pkg-config man page for more details.])
1303ff559fabSmrg
1304515ec619Smrgif test $pkg_failed = yes; then
1305515ec619Smrg   	AC_MSG_RESULT([no])
1306515ec619Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307515ec619Smrg        if test $_pkg_short_errors_supported = yes; then
1308515ec619Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309515ec619Smrg        else 
1310515ec619Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311515ec619Smrg        fi
1312515ec619Smrg	# Put the nasty error message in config.log where it belongs
1313515ec619Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131444dda7b2Smrg
1315515ec619Smrg	m4_default([$4], [AC_MSG_ERROR(
1316515ec619Smrg[Package requirements ($2) were not met:
1317ff559fabSmrg
1318515ec619Smrg$$1_PKG_ERRORS
1319ff559fabSmrg
1320515ec619SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321515ec619Smrginstalled software in a non-standard prefix.
1322ff559fabSmrg
1323515ec619Smrg_PKG_TEXT])[]dnl
1324515ec619Smrg        ])
1325515ec619Smrgelif test $pkg_failed = untried; then
1326515ec619Smrg     	AC_MSG_RESULT([no])
1327515ec619Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328515ec619Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329515ec619Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330515ec619Smrgpath to pkg-config.
1331ff559fabSmrg
1332515ec619Smrg_PKG_TEXT
133344dda7b2Smrg
1334515ec619SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335515ec619Smrg        ])
1336515ec619Smrgelse
1337515ec619Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338515ec619Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339515ec619Smrg        AC_MSG_RESULT([yes])
1340515ec619Smrg	$3
1341515ec619Smrgfi[]dnl
1342515ec619Smrg])dnl PKG_CHECK_MODULES
1343ff559fabSmrg
134444dda7b2Smrg
1345515ec619Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346515ec619Smrgdnl   [ACTION-IF-NOT-FOUND])
1347515ec619Smrgdnl ---------------------------------------------------------------------
1348515ec619Smrgdnl Since: 0.29
1349515ec619Smrgdnl
1350515ec619Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351515ec619Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352515ec619Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353515ec619Smrgdnl
1354515ec619Smrgdnl Note that if there is a possibility the first call to
1355515ec619Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356515ec619Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357515ec619Smrgdnl configure.ac.
1358515ec619SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359515ec619Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360515ec619Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361515ec619SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362515ec619SmrgPKG_CHECK_MODULES($@)
1363515ec619SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364515ec619Smrg])dnl PKG_CHECK_MODULES_STATIC
1365ff559fabSmrg
136644dda7b2Smrg
1367515ec619Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368515ec619Smrgdnl -------------------------
1369515ec619Smrgdnl Since: 0.27
1370515ec619Smrgdnl
1371515ec619Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372515ec619Smrgdnl should install pkg-config .pc files. By default the directory is
1373515ec619Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374515ec619Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375515ec619Smrgdnl parameter.
1376515ec619SmrgAC_DEFUN([PKG_INSTALLDIR],
1377515ec619Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378515ec619Smrgm4_pushdef([pkg_description],
1379515ec619Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380515ec619SmrgAC_ARG_WITH([pkgconfigdir],
1381515ec619Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382515ec619Smrg    [with_pkgconfigdir=]pkg_default)
1383515ec619SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384515ec619Smrgm4_popdef([pkg_default])
1385515ec619Smrgm4_popdef([pkg_description])
1386515ec619Smrg])dnl PKG_INSTALLDIR
1387ff559fabSmrg
1388ff559fabSmrg
1389515ec619Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390515ec619Smrgdnl --------------------------------
1391515ec619Smrgdnl Since: 0.27
1392515ec619Smrgdnl
1393515ec619Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394515ec619Smrgdnl module should install arch-independent pkg-config .pc files. By
1395515ec619Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396515ec619Smrgdnl changed by passing DIRECTORY. The user can override through the
1397515ec619Smrgdnl --with-noarch-pkgconfigdir parameter.
1398515ec619SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399515ec619Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400515ec619Smrgm4_pushdef([pkg_description],
1401515ec619Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402515ec619SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403515ec619Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404515ec619Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405515ec619SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406515ec619Smrgm4_popdef([pkg_default])
1407515ec619Smrgm4_popdef([pkg_description])
1408515ec619Smrg])dnl PKG_NOARCH_INSTALLDIR
1409ff559fabSmrg
1410ff559fabSmrg
1411515ec619Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412515ec619Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413515ec619Smrgdnl -------------------------------------------
1414515ec619Smrgdnl Since: 0.28
1415515ec619Smrgdnl
1416515ec619Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417515ec619SmrgAC_DEFUN([PKG_CHECK_VAR],
1418515ec619Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419515ec619SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420ff559fabSmrg
1421515ec619Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422515ec619SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423ff559fabSmrg
1424515ec619SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425515ec619Smrg])dnl PKG_CHECK_VAR
1426ff559fabSmrg
1427515ec619Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428515ec619Smrgdnl
1429e08b657dSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430515ec619Smrgdnl
1431515ec619Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432515ec619Smrgdnl copy of this software and associated documentation files (the "Software"),
1433515ec619Smrgdnl to deal in the Software without restriction, including without limitation
1434515ec619Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435515ec619Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436515ec619Smrgdnl Software is furnished to do so, subject to the following conditions:
1437515ec619Smrgdnl
1438515ec619Smrgdnl The above copyright notice and this permission notice (including the next
1439515ec619Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440515ec619Smrgdnl Software.
1441515ec619Smrgdnl
1442515ec619Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443515ec619Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444515ec619Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445515ec619Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446515ec619Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447515ec619Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448515ec619Smrgdnl DEALINGS IN THE SOFTWARE.
1449ff559fabSmrg
1450515ec619Smrg# XORG_MACROS_VERSION(required-version)
1451515ec619Smrg# -------------------------------------
1452515ec619Smrg# Minimum version: 1.1.0
1453515ec619Smrg#
1454515ec619Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455515ec619Smrg# your configure.ac with the minimum required version, such as:
1456515ec619Smrg# XORG_MACROS_VERSION(1.1)
1457515ec619Smrg#
1458515ec619Smrg# To ensure that this macro is defined, also add:
1459515ec619Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460515ec619Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461515ec619Smrg#
1462515ec619Smrg#
1463515ec619Smrg# See the "minimum version" comment for each macro you use to see what
1464515ec619Smrg# version you require.
1465515ec619Smrgm4_defun([XORG_MACROS_VERSION],[
1466e08b657dSmrgm4_define([vers_have], [1.20.0])
1467515ec619Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468515ec619Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469515ec619Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470515ec619Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471515ec619Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472515ec619Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473515ec619Smrgm4_undefine([vers_have])
1474515ec619Smrgm4_undefine([maj_have])
1475515ec619Smrgm4_undefine([maj_needed])
1476515ec619Smrg]) # XORG_MACROS_VERSION
1477ff559fabSmrg
1478515ec619Smrg# XORG_PROG_RAWCPP()
1479515ec619Smrg# ------------------
1480515ec619Smrg# Minimum version: 1.0.0
1481515ec619Smrg#
1482515ec619Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483515ec619Smrg# such as man pages and config files
1484515ec619SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485515ec619SmrgAC_REQUIRE([AC_PROG_CPP])
1486515ec619SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487515ec619Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488ff559fabSmrg
1489515ec619Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490515ec619Smrg# which is not the best choice for supporting other OS'es, but covers most
1491515ec619Smrg# of the ones we need for now.
1492515ec619SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493515ec619SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494515ec619Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495515ec619Smrg	AC_MSG_RESULT([no])
1496515ec619Smrgelse
1497515ec619Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498515ec619Smrg		RAWCPPFLAGS=-undef
1499515ec619Smrg		AC_MSG_RESULT([yes])
1500515ec619Smrg	# under Cygwin unix is still defined even with -undef
1501515ec619Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502515ec619Smrg		RAWCPPFLAGS="-undef -ansi"
1503515ec619Smrg		AC_MSG_RESULT([yes, with -ansi])
1504515ec619Smrg	else
1505515ec619Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506515ec619Smrg	fi
1507515ec619Smrgfi
1508515ec619Smrgrm -f conftest.$ac_ext
1509ff559fabSmrg
1510515ec619SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511515ec619SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512e08b657dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513515ec619Smrg	AC_MSG_RESULT([no])
1514515ec619Smrgelse
1515e08b657dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516515ec619Smrg		TRADITIONALCPPFLAGS="-traditional"
1517515ec619Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518515ec619Smrg		AC_MSG_RESULT([yes])
1519515ec619Smrg	else
1520515ec619Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521515ec619Smrg	fi
1522515ec619Smrgfi
1523515ec619Smrgrm -f conftest.$ac_ext
1524515ec619SmrgAC_SUBST(RAWCPPFLAGS)
1525515ec619SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526515ec619Smrg]) # XORG_PROG_RAWCPP
1527ff559fabSmrg
1528515ec619Smrg# XORG_MANPAGE_SECTIONS()
1529515ec619Smrg# -----------------------
1530515ec619Smrg# Minimum version: 1.0.0
1531515ec619Smrg#
1532515ec619Smrg# Determine which sections man pages go in for the different man page types
1533515ec619Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534515ec619Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535515ec619Smrg# Override default settings by setting environment variables
1536515ec619Smrg# Added MAN_SUBSTS in version 1.8
1537515ec619Smrg# Added AC_PROG_SED in version 1.8
1538ff559fabSmrg
1539515ec619SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540515ec619SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541515ec619SmrgAC_REQUIRE([AC_PROG_SED])
1542ff559fabSmrg
1543515ec619Smrgcase $host_os in
1544515ec619Smrg    solaris*)
1545515ec619Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546515ec619Smrg        # check for a man page file found in later versions that use
1547515ec619Smrg        # traditional section numbers instead
1548515ec619Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549515ec619Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550515ec619Smrg        ;;
1551515ec619Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552515ec619Smrgesac
1553ff559fabSmrg
1554515ec619Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555515ec619Smrg    APP_MAN_SUFFIX=1
1556515ec619Smrgfi
1557515ec619Smrgif test x$APP_MAN_DIR = x    ; then
1558515ec619Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559515ec619Smrgfi
1560ff559fabSmrg
1561515ec619Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562515ec619Smrg    LIB_MAN_SUFFIX=3
1563515ec619Smrgfi
1564515ec619Smrgif test x$LIB_MAN_DIR = x    ; then
1565515ec619Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566515ec619Smrgfi
1567ff559fabSmrg
1568515ec619Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569515ec619Smrg    case $SYSV_MAN_SECTIONS in
1570515ec619Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571515ec619Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572515ec619Smrg    esac
1573515ec619Smrgfi
1574515ec619Smrgif test x$FILE_MAN_DIR = x    ; then
1575515ec619Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576515ec619Smrgfi
1577ff559fabSmrg
1578515ec619Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579515ec619Smrg    case $SYSV_MAN_SECTIONS in
1580515ec619Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581515ec619Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582515ec619Smrg    esac
1583515ec619Smrgfi
1584515ec619Smrgif test x$MISC_MAN_DIR = x    ; then
1585515ec619Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586515ec619Smrgfi
1587ff559fabSmrg
1588515ec619Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589515ec619Smrg    case $SYSV_MAN_SECTIONS in
1590515ec619Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591515ec619Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592515ec619Smrg    esac
1593515ec619Smrgfi
1594515ec619Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595515ec619Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596515ec619Smrgfi
1597ff559fabSmrg
1598515ec619Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599515ec619Smrg    case $SYSV_MAN_SECTIONS in
1600515ec619Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601515ec619Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602515ec619Smrg    esac
1603515ec619Smrgfi
1604515ec619Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605515ec619Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606515ec619Smrgfi
1607ff559fabSmrg
1608ff559fabSmrg
1609515ec619SmrgAC_SUBST([APP_MAN_SUFFIX])
1610515ec619SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611515ec619SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612515ec619SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613515ec619SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614515ec619SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615515ec619SmrgAC_SUBST([APP_MAN_DIR])
1616515ec619SmrgAC_SUBST([LIB_MAN_DIR])
1617515ec619SmrgAC_SUBST([FILE_MAN_DIR])
1618515ec619SmrgAC_SUBST([MISC_MAN_DIR])
1619515ec619SmrgAC_SUBST([DRIVER_MAN_DIR])
1620515ec619SmrgAC_SUBST([ADMIN_MAN_DIR])
1621862f5301Smrg
1622515ec619SmrgXORG_MAN_PAGE="X Version 11"
1623515ec619SmrgAC_SUBST([XORG_MAN_PAGE])
1624515ec619SmrgMAN_SUBSTS="\
1625515ec619Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626515ec619Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627515ec619Smrg	-e 's|__xservername__|Xorg|g' \
1628515ec619Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629515ec619Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630515ec619Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631515ec619Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632515ec619Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633515ec619Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634515ec619Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635515ec619Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636515ec619Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637515ec619SmrgAC_SUBST([MAN_SUBSTS])
1638862f5301Smrg
1639515ec619Smrg]) # XORG_MANPAGE_SECTIONS
16406fc0178dSmrg
1641515ec619Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642515ec619Smrg# ------------------------
1643515ec619Smrg# Minimum version: 1.7.0
1644515ec619Smrg#
1645515ec619Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646515ec619Smrg# provided by xorg-sgml-doctools, if installed.
1647515ec619SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648515ec619SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649515ec619SmrgXORG_SGML_PATH=
1650515ec619SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651515ec619Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652515ec619Smrg    [m4_ifval([$1],[:],
1653515ec619Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654515ec619Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655515ec619Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656515ec619Smrg         fi])
16576fc0178dSmrg    ])
1658ff559fabSmrg
1659515ec619Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660515ec619Smrg# the path and the name of the doc stylesheet
1661515ec619Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662515ec619Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663515ec619Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664515ec619Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665515ec619Smrgelse
1666515ec619Smrg   AC_MSG_RESULT([no])
1667515ec619Smrgfi
1668ff559fabSmrg
1669515ec619SmrgAC_SUBST(XORG_SGML_PATH)
1670515ec619SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671515ec619SmrgAC_SUBST(XSL_STYLESHEET)
1672515ec619SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673515ec619Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16747a3b38f7Smrg
1675515ec619Smrg# XORG_CHECK_LINUXDOC
1676515ec619Smrg# -------------------
1677515ec619Smrg# Minimum version: 1.0.0
1678515ec619Smrg#
1679515ec619Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680515ec619Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681515ec619Smrg# Whether or not the necessary tools and files are found can be checked
1682515ec619Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683515ec619SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684515ec619SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685515ec619SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686ff559fabSmrg
1687515ec619SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688ff559fabSmrg
1689515ec619SmrgAC_MSG_CHECKING([whether to build documentation])
1690ff559fabSmrg
1691515ec619Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692515ec619Smrg   BUILDDOC=yes
1693515ec619Smrgelse
1694515ec619Smrg   BUILDDOC=no
1695515ec619Smrgfi
16967a3b38f7Smrg
1697515ec619SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16987a3b38f7Smrg
1699515ec619SmrgAC_MSG_RESULT([$BUILDDOC])
17007a3b38f7Smrg
1701515ec619SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702515ec619Smrg
1703515ec619Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704515ec619Smrg   BUILDPDFDOC=yes
17056fc0178dSmrgelse
1706515ec619Smrg   BUILDPDFDOC=no
17076fc0178dSmrgfi
17087a3b38f7Smrg
1709515ec619SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710ff559fabSmrg
1711515ec619SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17127a3b38f7Smrg
1713515ec619SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714515ec619SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715515ec619SmrgMAKE_PDF="$PS2PDF"
1716515ec619SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17177a3b38f7Smrg
1718515ec619SmrgAC_SUBST(MAKE_TEXT)
1719515ec619SmrgAC_SUBST(MAKE_PS)
1720515ec619SmrgAC_SUBST(MAKE_PDF)
1721515ec619SmrgAC_SUBST(MAKE_HTML)
1722515ec619Smrg]) # XORG_CHECK_LINUXDOC
172344dda7b2Smrg
1724515ec619Smrg# XORG_CHECK_DOCBOOK
1725515ec619Smrg# -------------------
1726515ec619Smrg# Minimum version: 1.0.0
1727515ec619Smrg#
1728515ec619Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729515ec619Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730515ec619Smrg# indicates whether the necessary tools and files are found and, if set,
1731515ec619Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732515ec619SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733515ec619SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17346fc0178dSmrg
1735515ec619SmrgBUILDTXTDOC=no
1736515ec619SmrgBUILDPDFDOC=no
1737515ec619SmrgBUILDPSDOC=no
1738515ec619SmrgBUILDHTMLDOC=no
1739ff559fabSmrg
1740515ec619SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741515ec619SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742515ec619SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743515ec619SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744ff559fabSmrg
1745515ec619SmrgAC_MSG_CHECKING([whether to build text documentation])
1746515ec619Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747515ec619Smrg   test x$BUILD_TXTDOC != xno; then
1748515ec619Smrg	BUILDTXTDOC=yes
1749515ec619Smrgfi
1750515ec619SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751515ec619SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752ff559fabSmrg
1753515ec619SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754515ec619Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755515ec619Smrg   test x$BUILD_PDFDOC != xno; then
1756515ec619Smrg	BUILDPDFDOC=yes
1757515ec619Smrgfi
1758515ec619SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759515ec619SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760ff559fabSmrg
1761515ec619SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762515ec619Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763515ec619Smrg   test x$BUILD_PSDOC != xno; then
1764515ec619Smrg	BUILDPSDOC=yes
1765515ec619Smrgfi
1766515ec619SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767515ec619SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768ff559fabSmrg
1769515ec619SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770515ec619Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771515ec619Smrg   test x$BUILD_HTMLDOC != xno; then
1772515ec619Smrg	BUILDHTMLDOC=yes
1773515ec619Smrgfi
1774515ec619SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775515ec619SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776ff559fabSmrg
1777515ec619SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778515ec619SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779515ec619SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780515ec619SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781ff559fabSmrg
1782515ec619SmrgAC_SUBST(MAKE_TEXT)
1783515ec619SmrgAC_SUBST(MAKE_PS)
1784515ec619SmrgAC_SUBST(MAKE_PDF)
1785515ec619SmrgAC_SUBST(MAKE_HTML)
1786515ec619Smrg]) # XORG_CHECK_DOCBOOK
1787ff559fabSmrg
1788515ec619Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789515ec619Smrg# ----------------
1790515ec619Smrg# Minimum version: 1.5.0
1791515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792515ec619Smrg#
1793515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
1794515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
1795515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796e08b657dSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797515ec619Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798515ec619Smrg# --with-xmlto assumes 'auto'.
1799515ec619Smrg#
1800515ec619Smrg# Interface to module:
1801515ec619Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802515ec619Smrg# XMLTO:	returns the path of the xmlto program found
1803515ec619Smrg#		returns the path set by the user in the environment
1804515ec619Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805515ec619Smrg#		'no' user instructs the module not to use xmlto
1806515ec619Smrg#
1807515ec619Smrg# Added in version 1.10.0
1808515ec619Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809515ec619Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810515ec619Smrg#
1811515ec619Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812515ec619Smrg#
1813515ec619SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814515ec619SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816515ec619SmrgAC_ARG_WITH(xmlto,
1817515ec619Smrg	AS_HELP_STRING([--with-xmlto],
1818515ec619Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819515ec619Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820515ec619Smrgm4_undefine([_defopt])
1821ff559fabSmrg
1822515ec619Smrgif test "x$use_xmlto" = x"auto"; then
1823515ec619Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824515ec619Smrg   if test "x$XMLTO" = "x"; then
1825515ec619Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826515ec619Smrg	have_xmlto=no
1827515ec619Smrg   else
1828515ec619Smrg        have_xmlto=yes
1829515ec619Smrg   fi
1830515ec619Smrgelif test "x$use_xmlto" = x"yes" ; then
1831515ec619Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832515ec619Smrg   if test "x$XMLTO" = "x"; then
1833515ec619Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834515ec619Smrg   fi
1835515ec619Smrg   have_xmlto=yes
1836515ec619Smrgelif test "x$use_xmlto" = x"no" ; then
1837515ec619Smrg   if test "x$XMLTO" != "x"; then
1838515ec619Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839515ec619Smrg   fi
1840515ec619Smrg   have_xmlto=no
18416fc0178dSmrgelse
1842515ec619Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18436fc0178dSmrgfi
184444dda7b2Smrg
1845515ec619Smrg# Test for a minimum version of xmlto, if provided.
1846515ec619Smrgm4_ifval([$1],
1847515ec619Smrg[if test "$have_xmlto" = yes; then
1848515ec619Smrg    # scrape the xmlto version
1849515ec619Smrg    AC_MSG_CHECKING([the xmlto version])
1850515ec619Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851515ec619Smrg    AC_MSG_RESULT([$xmlto_version])
1852515ec619Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853515ec619Smrg        [if test "x$use_xmlto" = xauto; then
1854515ec619Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855515ec619Smrg            have_xmlto=no
1856515ec619Smrg        else
1857515ec619Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858515ec619Smrg        fi])
1859515ec619Smrgfi])
1860ff559fabSmrg
1861515ec619Smrg# Test for the ability of xmlto to generate a text target
1862515ec619Smrg#
1863515ec619Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864515ec619Smrg# following test for empty XML docbook files.
1865515ec619Smrg# For compatibility reasons use the following empty XML docbook file and if
1866515ec619Smrg# it fails try it again with a non-empty XML file.
1867515ec619Smrghave_xmlto_text=no
1868515ec619Smrgcat > conftest.xml << "EOF"
1869515ec619SmrgEOF
1870515ec619SmrgAS_IF([test "$have_xmlto" = yes],
1871515ec619Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872515ec619Smrg             [have_xmlto_text=yes],
1873515ec619Smrg             [# Try it again with a non-empty XML file.
1874515ec619Smrg              cat > conftest.xml << "EOF"
1875515ec619Smrg<x></x>
1876515ec619SmrgEOF
1877515ec619Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878515ec619Smrg                    [have_xmlto_text=yes],
1879515ec619Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880515ec619Smrgrm -f conftest.xml
1881515ec619SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882515ec619SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883515ec619Smrg]) # XORG_WITH_XMLTO
18847a3b38f7Smrg
1885515ec619Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886515ec619Smrg# --------------------------------------------
1887515ec619Smrg# Minimum version: 1.12.0
1888515ec619Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889515ec619Smrg#
1890515ec619Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891515ec619Smrg# XML-based language used for the transformation of XML documents.
1892515ec619Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893515ec619Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894515ec619Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895515ec619Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896515ec619Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897515ec619Smrg#
1898515ec619Smrg# Interface to module:
1899515ec619Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900515ec619Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901515ec619Smrg#		 returns the path set by the user in the environment
1902515ec619Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903515ec619Smrg#		  'no' user instructs the module not to use xsltproc
1904515ec619Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905515ec619Smrg#
1906515ec619Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907515ec619Smrg#
1908515ec619SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909515ec619SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910515ec619Smrg# Preserves the interface, should it be implemented later
1911515ec619Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913515ec619SmrgAC_ARG_WITH(xsltproc,
1914515ec619Smrg	AS_HELP_STRING([--with-xsltproc],
1915515ec619Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916515ec619Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917515ec619Smrgm4_undefine([_defopt])
19187a3b38f7Smrg
1919515ec619Smrgif test "x$use_xsltproc" = x"auto"; then
1920515ec619Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921515ec619Smrg   if test "x$XSLTPROC" = "x"; then
1922515ec619Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923515ec619Smrg	have_xsltproc=no
1924515ec619Smrg   else
1925515ec619Smrg        have_xsltproc=yes
1926515ec619Smrg   fi
1927515ec619Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928515ec619Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929515ec619Smrg   if test "x$XSLTPROC" = "x"; then
1930515ec619Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931515ec619Smrg   fi
1932515ec619Smrg   have_xsltproc=yes
1933515ec619Smrgelif test "x$use_xsltproc" = x"no" ; then
1934515ec619Smrg   if test "x$XSLTPROC" != "x"; then
1935515ec619Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936515ec619Smrg   fi
1937515ec619Smrg   have_xsltproc=no
1938515ec619Smrgelse
1939515ec619Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19406fc0178dSmrgfi
1941ff559fabSmrg
1942515ec619SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943515ec619Smrg]) # XORG_WITH_XSLTPROC
1944ff559fabSmrg
1945515ec619Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946515ec619Smrg# ----------------------------------------
1947515ec619Smrg# Minimum version: 1.15.0
1948515ec619Smrg#
1949515ec619Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950515ec619Smrg# scanning arbitrary text files, extracting information from those text files,
1951515ec619Smrg# and printing reports based on that information.
1952515ec619Smrg#
1953515ec619Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954515ec619Smrg#
1955515ec619Smrg# Interface to module:
1956515ec619Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957515ec619Smrg# PERL:	     returns the path of the perl program found
1958515ec619Smrg#	     returns the path set by the user in the environment
1959515ec619Smrg# --with-perl: 'yes' user instructs the module to use perl
1960515ec619Smrg#	       'no' user instructs the module not to use perl
1961515ec619Smrg# have_perl: returns yes if perl found in PATH or no
1962515ec619Smrg#
1963515ec619Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964515ec619Smrg#
1965515ec619SmrgAC_DEFUN([XORG_WITH_PERL],[
1966515ec619SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967515ec619Smrg# Preserves the interface, should it be implemented later
1968515ec619Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970515ec619SmrgAC_ARG_WITH(perl,
1971515ec619Smrg	AS_HELP_STRING([--with-perl],
1972515ec619Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973515ec619Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974515ec619Smrgm4_undefine([_defopt])
1975ff559fabSmrg
1976515ec619Smrgif test "x$use_perl" = x"auto"; then
1977515ec619Smrg   AC_PATH_PROG([PERL], [perl])
1978515ec619Smrg   if test "x$PERL" = "x"; then
1979515ec619Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980515ec619Smrg	have_perl=no
1981515ec619Smrg   else
1982515ec619Smrg        have_perl=yes
19836fc0178dSmrg   fi
1984515ec619Smrgelif test "x$use_perl" = x"yes" ; then
1985515ec619Smrg   AC_PATH_PROG([PERL], [perl])
1986515ec619Smrg   if test "x$PERL" = "x"; then
1987515ec619Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988515ec619Smrg   fi
1989515ec619Smrg   have_perl=yes
1990515ec619Smrgelif test "x$use_perl" = x"no" ; then
1991515ec619Smrg   if test "x$PERL" != "x"; then
1992515ec619Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993515ec619Smrg   fi
1994515ec619Smrg   have_perl=no
19956fc0178dSmrgelse
1996515ec619Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19976fc0178dSmrgfi
1998ff559fabSmrg
1999515ec619SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000515ec619Smrg]) # XORG_WITH_PERL
2001ff559fabSmrg
2002515ec619Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003515ec619Smrg# ----------------
2004515ec619Smrg# Minimum version: 1.5.0
2005515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006515ec619Smrg#
2007515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2008515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
2009515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010e08b657dSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011515ec619Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012515ec619Smrg# --with-asciidoc assumes 'auto'.
2013515ec619Smrg#
2014515ec619Smrg# Interface to module:
2015515ec619Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016515ec619Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017515ec619Smrg#		 returns the path set by the user in the environment
2018515ec619Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019515ec619Smrg#		  'no' user instructs the module not to use asciidoc
2020515ec619Smrg#
2021515ec619Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022515ec619Smrg#
2023515ec619SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024515ec619SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026515ec619SmrgAC_ARG_WITH(asciidoc,
2027515ec619Smrg	AS_HELP_STRING([--with-asciidoc],
2028515ec619Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029515ec619Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030515ec619Smrgm4_undefine([_defopt])
2031ff559fabSmrg
2032515ec619Smrgif test "x$use_asciidoc" = x"auto"; then
2033515ec619Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034515ec619Smrg   if test "x$ASCIIDOC" = "x"; then
2035515ec619Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036515ec619Smrg	have_asciidoc=no
2037515ec619Smrg   else
2038515ec619Smrg        have_asciidoc=yes
2039515ec619Smrg   fi
2040515ec619Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041515ec619Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042515ec619Smrg   if test "x$ASCIIDOC" = "x"; then
2043515ec619Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044515ec619Smrg   fi
2045515ec619Smrg   have_asciidoc=yes
2046515ec619Smrgelif test "x$use_asciidoc" = x"no" ; then
2047515ec619Smrg   if test "x$ASCIIDOC" != "x"; then
2048515ec619Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049515ec619Smrg   fi
2050515ec619Smrg   have_asciidoc=no
20516fc0178dSmrgelse
2052515ec619Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20536fc0178dSmrgfi
2054515ec619Smrgm4_ifval([$1],
2055515ec619Smrg[if test "$have_asciidoc" = yes; then
2056515ec619Smrg    # scrape the asciidoc version
2057515ec619Smrg    AC_MSG_CHECKING([the asciidoc version])
2058515ec619Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059515ec619Smrg    AC_MSG_RESULT([$asciidoc_version])
2060515ec619Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061515ec619Smrg        [if test "x$use_asciidoc" = xauto; then
2062515ec619Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063515ec619Smrg            have_asciidoc=no
2064515ec619Smrg        else
2065515ec619Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066515ec619Smrg        fi])
2067515ec619Smrgfi])
2068515ec619SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069515ec619Smrg]) # XORG_WITH_ASCIIDOC
2070ff559fabSmrg
2071515ec619Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072515ec619Smrg# -------------------------------------------
2073515ec619Smrg# Minimum version: 1.5.0
2074515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075515ec619Smrg# Minimum version for optional DOT checking: 1.18.0
2076515ec619Smrg#
2077515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2078515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
2079515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080e08b657dSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081515ec619Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082515ec619Smrg# --with-doxygen assumes 'auto'.
2083515ec619Smrg#
2084515ec619Smrg# Interface to module:
2085515ec619Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086515ec619Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087515ec619Smrg#		 returns the path set by the user in the environment
2088515ec619Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089515ec619Smrg#		  'no' user instructs the module not to use doxygen
2090515ec619Smrg#
2091515ec619Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092515ec619Smrg#
2093515ec619SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094515ec619SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095515ec619SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097515ec619SmrgAC_ARG_WITH(doxygen,
2098515ec619Smrg	AS_HELP_STRING([--with-doxygen],
2099515ec619Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100515ec619Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101515ec619Smrgm4_undefine([_defopt])
2102ff559fabSmrg
2103515ec619Smrgif test "x$use_doxygen" = x"auto"; then
2104515ec619Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105515ec619Smrg   if test "x$DOXYGEN" = "x"; then
2106515ec619Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107515ec619Smrg	have_doxygen=no
2108515ec619Smrg   else
2109515ec619Smrg        have_doxygen=yes
2110515ec619Smrg   fi
2111515ec619Smrgelif test "x$use_doxygen" = x"yes" ; then
2112515ec619Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113515ec619Smrg   if test "x$DOXYGEN" = "x"; then
2114515ec619Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115515ec619Smrg   fi
2116515ec619Smrg   have_doxygen=yes
2117515ec619Smrgelif test "x$use_doxygen" = x"no" ; then
2118515ec619Smrg   if test "x$DOXYGEN" != "x"; then
2119515ec619Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120515ec619Smrg   fi
2121515ec619Smrg   have_doxygen=no
2122515ec619Smrgelse
2123515ec619Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124515ec619Smrgfi
2125515ec619Smrgm4_ifval([$1],
2126515ec619Smrg[if test "$have_doxygen" = yes; then
2127515ec619Smrg    # scrape the doxygen version
2128515ec619Smrg    AC_MSG_CHECKING([the doxygen version])
2129515ec619Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130515ec619Smrg    AC_MSG_RESULT([$doxygen_version])
2131515ec619Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132515ec619Smrg        [if test "x$use_doxygen" = xauto; then
2133515ec619Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134515ec619Smrg            have_doxygen=no
2135515ec619Smrg        else
2136515ec619Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137515ec619Smrg        fi])
2138515ec619Smrgfi])
21397a3b38f7Smrg
2140515ec619Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141515ec619Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142515ec619Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143515ec619SmrgHAVE_DOT=no
2144515ec619Smrgif test "x$have_doxygen" = "xyes"; then
2145515ec619Smrg  AC_PATH_PROG([DOT], [dot])
2146515ec619Smrg    if test "x$DOT" != "x"; then
2147515ec619Smrg      HAVE_DOT=yes
21486fc0178dSmrg    fi
2149515ec619Smrgfi
2150ff559fabSmrg
2151515ec619SmrgAC_SUBST([HAVE_DOT])
2152515ec619SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153515ec619SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154515ec619Smrg]) # XORG_WITH_DOXYGEN
2155ff559fabSmrg
2156515ec619Smrg# XORG_WITH_GROFF([DEFAULT])
2157515ec619Smrg# ----------------
2158515ec619Smrg# Minimum version: 1.6.0
2159515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160515ec619Smrg#
2161515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2162515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
2163515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164e08b657dSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2165515ec619Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166515ec619Smrg# --with-groff assumes 'auto'.
2167515ec619Smrg#
2168515ec619Smrg# Interface to module:
2169515ec619Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170515ec619Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171515ec619Smrg# HAVE_GROFF_MS: the -ms macros package
2172515ec619Smrg# GROFF:	 returns the path of the groff program found
2173515ec619Smrg#		 returns the path set by the user in the environment
2174515ec619Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175515ec619Smrg#		 'no' user instructs the module not to use groff
2176515ec619Smrg#
2177515ec619Smrg# Added in version 1.9.0:
2178515ec619Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179515ec619Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180515ec619Smrg#		   psselect from the psutils package.
2181515ec619Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182515ec619Smrg#
2183515ec619Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184515ec619Smrg#
2185515ec619Smrg# OS and distros often splits groff in a basic and full package, the former
2186515ec619Smrg# having the groff program and the later having devices, fonts and macros
2187515ec619Smrg# Checking for the groff executable is not enough.
2188515ec619Smrg#
2189515ec619Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190515ec619Smrg# unset HAVE_GROFF or GROFF env variables.
2191515ec619Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192515ec619Smrg#
2193515ec619SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194515ec619SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195515ec619Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196515ec619SmrgAC_ARG_WITH(groff,
2197515ec619Smrg	AS_HELP_STRING([--with-groff],
2198515ec619Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199515ec619Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200515ec619Smrgm4_undefine([_defopt])
2201515ec619Smrg
2202515ec619Smrgif test "x$use_groff" = x"auto"; then
2203515ec619Smrg   AC_PATH_PROG([GROFF], [groff])
2204515ec619Smrg   if test "x$GROFF" = "x"; then
2205515ec619Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206515ec619Smrg	have_groff=no
2207515ec619Smrg   else
2208515ec619Smrg        have_groff=yes
2209515ec619Smrg   fi
2210515ec619Smrgelif test "x$use_groff" = x"yes" ; then
2211515ec619Smrg   AC_PATH_PROG([GROFF], [groff])
2212515ec619Smrg   if test "x$GROFF" = "x"; then
2213515ec619Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214515ec619Smrg   fi
2215515ec619Smrg   have_groff=yes
2216515ec619Smrgelif test "x$use_groff" = x"no" ; then
2217515ec619Smrg   if test "x$GROFF" != "x"; then
2218515ec619Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219515ec619Smrg   fi
2220515ec619Smrg   have_groff=no
22216fc0178dSmrgelse
2222515ec619Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22236fc0178dSmrgfi
2224ff559fabSmrg
2225515ec619Smrg# We have groff, test for the presence of the macro packages
2226515ec619Smrgif test "x$have_groff" = x"yes"; then
2227515ec619Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228515ec619Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229515ec619Smrg        groff_ms_works=yes
2230515ec619Smrg    else
2231515ec619Smrg        groff_ms_works=no
2232515ec619Smrg    fi
2233515ec619Smrg    AC_MSG_RESULT([$groff_ms_works])
2234515ec619Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235515ec619Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236515ec619Smrg        groff_mm_works=yes
2237515ec619Smrg    else
2238515ec619Smrg        groff_mm_works=no
2239515ec619Smrg    fi
2240515ec619Smrg    AC_MSG_RESULT([$groff_mm_works])
2241515ec619Smrgfi
2242ff559fabSmrg
2243515ec619Smrg# We have groff, test for HTML dependencies, one command per package
2244515ec619Smrgif test "x$have_groff" = x"yes"; then
2245515ec619Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246515ec619Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247515ec619Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248515ec619Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249515ec619Smrg      have_groff_html=yes
2250515ec619Smrg   else
2251515ec619Smrg      have_groff_html=no
2252515ec619Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253515ec619Smrg   fi
2254515ec619Smrgfi
2255ff559fabSmrg
2256515ec619Smrg# Set Automake conditionals for Makefiles
2257515ec619SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258515ec619SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259515ec619SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260515ec619SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261515ec619Smrg]) # XORG_WITH_GROFF
2262ff559fabSmrg
2263515ec619Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264515ec619Smrg# ---------------------------------------
2265515ec619Smrg# Minimum version: 1.6.0
2266515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267515ec619Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268515ec619Smrg#
2269515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2270515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
2271515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272e08b657dSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2273515ec619Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274515ec619Smrg# --with-fop assumes 'auto'.
2275515ec619Smrg#
2276515ec619Smrg# Interface to module:
2277515ec619Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278515ec619Smrg# FOP:	 	returns the path of the fop program found
2279515ec619Smrg#		returns the path set by the user in the environment
2280515ec619Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281515ec619Smrg#		'no' user instructs the module not to use fop
2282515ec619Smrg#
2283515ec619Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284515ec619Smrg#
2285515ec619SmrgAC_DEFUN([XORG_WITH_FOP],[
2286515ec619SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288515ec619SmrgAC_ARG_WITH(fop,
2289515ec619Smrg	AS_HELP_STRING([--with-fop],
2290515ec619Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291515ec619Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292515ec619Smrgm4_undefine([_defopt])
2293ff559fabSmrg
2294515ec619Smrgif test "x$use_fop" = x"auto"; then
2295515ec619Smrg   AC_PATH_PROG([FOP], [fop])
2296515ec619Smrg   if test "x$FOP" = "x"; then
2297515ec619Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298515ec619Smrg	have_fop=no
2299515ec619Smrg   else
2300515ec619Smrg        have_fop=yes
2301515ec619Smrg   fi
2302515ec619Smrgelif test "x$use_fop" = x"yes" ; then
2303515ec619Smrg   AC_PATH_PROG([FOP], [fop])
2304515ec619Smrg   if test "x$FOP" = "x"; then
2305515ec619Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306515ec619Smrg   fi
2307515ec619Smrg   have_fop=yes
2308515ec619Smrgelif test "x$use_fop" = x"no" ; then
2309515ec619Smrg   if test "x$FOP" != "x"; then
2310515ec619Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311515ec619Smrg   fi
2312515ec619Smrg   have_fop=no
23136fc0178dSmrgelse
2314515ec619Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315515ec619Smrgfi
2316ff559fabSmrg
2317515ec619Smrg# Test for a minimum version of fop, if provided.
2318515ec619Smrgm4_ifval([$1],
2319515ec619Smrg[if test "$have_fop" = yes; then
2320515ec619Smrg    # scrape the fop version
2321515ec619Smrg    AC_MSG_CHECKING([for fop minimum version])
2322515ec619Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323515ec619Smrg    AC_MSG_RESULT([$fop_version])
2324515ec619Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325515ec619Smrg        [if test "x$use_fop" = xauto; then
2326515ec619Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327515ec619Smrg            have_fop=no
2328515ec619Smrg        else
2329515ec619Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330515ec619Smrg        fi])
2331515ec619Smrgfi])
2332515ec619SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333515ec619Smrg]) # XORG_WITH_FOP
2334ff559fabSmrg
2335515ec619Smrg# XORG_WITH_M4([MIN-VERSION])
2336515ec619Smrg# ---------------------------
2337515ec619Smrg# Minimum version: 1.19.0
2338515ec619Smrg#
2339515ec619Smrg# This macro attempts to locate an m4 macro processor which supports
2340515ec619Smrg# -I option and is only useful for modules relying on M4 in order to
2341515ec619Smrg# expand macros in source code files.
2342515ec619Smrg#
2343515ec619Smrg# Interface to module:
2344515ec619Smrg# M4:	 	returns the path of the m4 program found
2345515ec619Smrg#		returns the path set by the user in the environment
2346515ec619Smrg#
2347515ec619SmrgAC_DEFUN([XORG_WITH_M4], [
2348515ec619SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349515ec619Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350515ec619Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351515ec619Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352515ec619Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353515ec619Smrg   [$PATH:/usr/gnu/bin])])
2354ff559fabSmrg
2355515ec619SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356515ec619Smrg]) # XORG_WITH_M4
2357fc544a13Smrg
2358515ec619Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359515ec619Smrg# ----------------
2360515ec619Smrg# Minimum version: 1.6.0
2361515ec619Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362515ec619Smrg#
2363515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2364515ec619Smrg# not at the appropriate level. This macro enables a module to test for the
2365515ec619Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366e08b657dSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367515ec619Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368515ec619Smrg# --with-ps2pdf assumes 'auto'.
2369515ec619Smrg#
2370515ec619Smrg# Interface to module:
2371515ec619Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372515ec619Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373515ec619Smrg#		returns the path set by the user in the environment
2374515ec619Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375515ec619Smrg#		 'no' user instructs the module not to use ps2pdf
2376515ec619Smrg#
2377515ec619Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378515ec619Smrg#
2379515ec619SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380515ec619SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381515ec619Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382515ec619SmrgAC_ARG_WITH(ps2pdf,
2383515ec619Smrg	AS_HELP_STRING([--with-ps2pdf],
2384515ec619Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385515ec619Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386515ec619Smrgm4_undefine([_defopt])
2387fc544a13Smrg
2388515ec619Smrgif test "x$use_ps2pdf" = x"auto"; then
2389515ec619Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390515ec619Smrg   if test "x$PS2PDF" = "x"; then
2391515ec619Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392515ec619Smrg	have_ps2pdf=no
2393515ec619Smrg   else
2394515ec619Smrg        have_ps2pdf=yes
2395515ec619Smrg   fi
2396515ec619Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397515ec619Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398515ec619Smrg   if test "x$PS2PDF" = "x"; then
2399515ec619Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400515ec619Smrg   fi
2401515ec619Smrg   have_ps2pdf=yes
2402515ec619Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403515ec619Smrg   if test "x$PS2PDF" != "x"; then
2404515ec619Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405515ec619Smrg   fi
2406515ec619Smrg   have_ps2pdf=no
24076fc0178dSmrgelse
2408515ec619Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409515ec619Smrgfi
2410515ec619SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411515ec619Smrg]) # XORG_WITH_PS2PDF
24127a3b38f7Smrg
2413515ec619Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414515ec619Smrg# ----------------
2415515ec619Smrg# Minimum version: 1.6.0
2416515ec619Smrg#
2417515ec619Smrg# Documentation tools are not always available on all platforms and sometimes
2418515ec619Smrg# not at the appropriate level. This macro enables a builder to skip all
2419515ec619Smrg# documentation targets except traditional man pages.
2420515ec619Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421e08b657dSmrg# maximum flexibility in controlling documentation building.
2422515ec619Smrg# Refer to:
2423515ec619Smrg# XORG_WITH_XMLTO         --with-xmlto
2424515ec619Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425515ec619Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426515ec619Smrg# XORG_WITH_FOP           --with-fop
2427515ec619Smrg# XORG_WITH_GROFF         --with-groff
2428515ec619Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429515ec619Smrg#
2430515ec619Smrg# Interface to module:
2431515ec619Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432515ec619Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433515ec619Smrg#		 'no' user instructs the module not to generate docs
2434515ec619Smrg# parm1:	specify the default value, yes or no.
2435515ec619Smrg#
2436515ec619SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437515ec619Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438515ec619SmrgAC_ARG_ENABLE(docs,
2439515ec619Smrg	AS_HELP_STRING([--enable-docs],
2440515ec619Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441515ec619Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442515ec619Smrgm4_undefine([docs_default])
2443515ec619SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444515ec619SmrgAC_MSG_CHECKING([whether to build documentation])
2445515ec619SmrgAC_MSG_RESULT([$build_docs])
2446515ec619Smrg]) # XORG_ENABLE_DOCS
24477a3b38f7Smrg
2448515ec619Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449515ec619Smrg# ----------------
2450515ec619Smrg# Minimum version: 1.6.0
2451515ec619Smrg#
2452515ec619Smrg# This macro enables a builder to skip all developer documentation.
2453515ec619Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454e08b657dSmrg# maximum flexibility in controlling documentation building.
2455515ec619Smrg# Refer to:
2456515ec619Smrg# XORG_WITH_XMLTO         --with-xmlto
2457515ec619Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458515ec619Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459515ec619Smrg# XORG_WITH_FOP           --with-fop
2460515ec619Smrg# XORG_WITH_GROFF         --with-groff
2461515ec619Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462515ec619Smrg#
2463515ec619Smrg# Interface to module:
2464515ec619Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465515ec619Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466515ec619Smrg#			'no' user instructs the module not to generate developer docs
2467515ec619Smrg# parm1:		specify the default value, yes or no.
2468515ec619Smrg#
2469515ec619SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470515ec619Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471515ec619SmrgAC_ARG_ENABLE(devel-docs,
2472515ec619Smrg	AS_HELP_STRING([--enable-devel-docs],
2473515ec619Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474515ec619Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475515ec619Smrgm4_undefine([devel_default])
2476515ec619SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477515ec619SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478515ec619SmrgAC_MSG_RESULT([$build_devel_docs])
2479515ec619Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480ff559fabSmrg
2481515ec619Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482515ec619Smrg# ----------------
2483515ec619Smrg# Minimum version: 1.6.0
2484515ec619Smrg#
2485515ec619Smrg# This macro enables a builder to skip all functional specification targets.
2486515ec619Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487e08b657dSmrg# maximum flexibility in controlling documentation building.
2488515ec619Smrg# Refer to:
2489515ec619Smrg# XORG_WITH_XMLTO         --with-xmlto
2490515ec619Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491515ec619Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492515ec619Smrg# XORG_WITH_FOP           --with-fop
2493515ec619Smrg# XORG_WITH_GROFF         --with-groff
2494515ec619Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495515ec619Smrg#
2496515ec619Smrg# Interface to module:
2497515ec619Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498515ec619Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499515ec619Smrg#			'no' user instructs the module not to generate specs
2500515ec619Smrg# parm1:		specify the default value, yes or no.
2501515ec619Smrg#
2502515ec619SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503515ec619Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504515ec619SmrgAC_ARG_ENABLE(specs,
2505515ec619Smrg	AS_HELP_STRING([--enable-specs],
2506515ec619Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507515ec619Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508515ec619Smrgm4_undefine([spec_default])
2509515ec619SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510515ec619SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511515ec619SmrgAC_MSG_RESULT([$build_specs])
2512515ec619Smrg]) # XORG_ENABLE_SPECS
2513fc544a13Smrg
2514515ec619Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515515ec619Smrg# ----------------------------------------------
2516515ec619Smrg# Minimum version: 1.13.0
2517515ec619Smrg#
2518515ec619Smrg# This macro enables a builder to enable/disable unit testing
2519515ec619Smrg# It makes no assumption about the test cases implementation
2520515ec619Smrg# Test cases may or may not use Automake "Support for test suites"
2521515ec619Smrg# They may or may not use the software utility library GLib
2522515ec619Smrg#
2523515ec619Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524515ec619Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525515ec619Smrg# The variable enable_unit_tests is used by other macros in this file.
2526515ec619Smrg#
2527515ec619Smrg# Interface to module:
2528515ec619Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529515ec619Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530515ec619Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531515ec619Smrg#			'no' user instructs the module not to build tests
2532515ec619Smrg# parm1:		specify the default value, yes or no.
2533515ec619Smrg#
2534515ec619SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535515ec619SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536515ec619SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537515ec619SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538515ec619Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539515ec619SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540515ec619Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541515ec619Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542515ec619Smrgm4_undefine([_defopt])
2543515ec619SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544515ec619SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545515ec619SmrgAC_MSG_RESULT([$enable_unit_tests])
2546515ec619Smrg]) # XORG_ENABLE_UNIT_TESTS
2547ff559fabSmrg
2548515ec619Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549515ec619Smrg# ------------------------------------------------------
2550515ec619Smrg# Minimum version: 1.17.0
2551515ec619Smrg#
2552515ec619Smrg# This macro enables a builder to enable/disable integration testing
2553515ec619Smrg# It makes no assumption about the test cases' implementation
2554515ec619Smrg# Test cases may or may not use Automake "Support for test suites"
2555515ec619Smrg#
2556515ec619Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557515ec619Smrg# usually requires less dependencies and may be built and run under less
2558515ec619Smrg# stringent environments than integration tests.
2559515ec619Smrg#
2560515ec619Smrg# Interface to module:
2561515ec619Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562515ec619Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563515ec619Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564515ec619Smrg#                             'no' user instructs the module not to build tests
2565515ec619Smrg# parm1:                      specify the default value, yes or no.
2566515ec619Smrg#
2567515ec619SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568515ec619SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569515ec619Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570515ec619SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571515ec619Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572515ec619Smrg	[enable_integration_tests=$enableval],
2573515ec619Smrg	[enable_integration_tests=]_defopt)
2574515ec619Smrgm4_undefine([_defopt])
2575515ec619SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576515ec619Smrg	[test "x$enable_integration_tests" != xno])
2577515ec619SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578515ec619SmrgAC_MSG_RESULT([$enable_integration_tests])
2579515ec619Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580ff559fabSmrg
2581515ec619Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582515ec619Smrg# ----------------------------------------
2583515ec619Smrg# Minimum version: 1.13.0
2584515ec619Smrg#
2585515ec619Smrg# GLib is a library which provides advanced data structures and functions.
2586515ec619Smrg# This macro enables a module to test for the presence of Glib.
2587515ec619Smrg#
2588515ec619Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589515ec619Smrg# Otherwise the value of $enable_unit_tests is blank.
2590515ec619Smrg#
2591515ec619Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592515ec619Smrg# test support usually requires less dependencies and may be built and run under
2593515ec619Smrg# less stringent environments than integration tests.
2594515ec619Smrg#
2595515ec619Smrg# Interface to module:
2596515ec619Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597515ec619Smrg# with_glib: used in configure.ac to know if GLib has been found
2598515ec619Smrg# --with-glib:	'yes' user instructs the module to use glib
2599515ec619Smrg#		'no' user instructs the module not to use glib
2600515ec619Smrg#
2601515ec619SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602515ec619SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603515ec619Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604515ec619SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605515ec619Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606515ec619Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607515ec619Smrgm4_undefine([_defopt])
2608ff559fabSmrg
2609515ec619Smrghave_glib=no
2610515ec619Smrg# Do not probe GLib if user explicitly disabled unit testing
2611515ec619Smrgif test "x$enable_unit_tests" != x"no"; then
2612515ec619Smrg  # Do not probe GLib if user explicitly disabled it
2613515ec619Smrg  if test "x$with_glib" != x"no"; then
2614515ec619Smrg    m4_ifval(
2615515ec619Smrg      [$1],
2616515ec619Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617515ec619Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618515ec619Smrg    )
2619515ec619Smrg  fi
2620515ec619Smrgfi
2621ff559fabSmrg
2622515ec619Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623515ec619Smrgif test "x$enable_unit_tests" = x"yes"; then
2624515ec619Smrg  if test "x$have_glib" = x"no"; then
2625515ec619Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626515ec619Smrg  fi
2627515ec619Smrgfi
2628ff559fabSmrg
2629515ec619Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630515ec619Smrgif test "x$enable_unit_tests" = x"no"; then
2631515ec619Smrg  if test "x$with_glib" = x"yes"; then
2632515ec619Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633515ec619Smrg  fi
26346fc0178dSmrgfi
2635ff559fabSmrg
2636515ec619Smrg# Not having GLib when it has been explicitly requested is an error
2637515ec619Smrgif test "x$with_glib" = x"yes"; then
2638515ec619Smrg  if test "x$have_glib" = x"no"; then
2639515ec619Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640515ec619Smrg  fi
2641515ec619Smrgfi
26426fc0178dSmrg
2643515ec619SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644515ec619Smrg]) # XORG_WITH_GLIB
26456fc0178dSmrg
2646515ec619Smrg# XORG_LD_WRAP([required|optional])
2647515ec619Smrg# ---------------------------------
2648515ec619Smrg# Minimum version: 1.13.0
2649515ec619Smrg#
2650515ec619Smrg# Check if linker supports -wrap, passed via compiler flags
2651515ec619Smrg#
2652515ec619Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653515ec619Smrg# Otherwise the value of $enable_unit_tests is blank.
2654515ec619Smrg#
2655515ec619Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656515ec619Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657515ec619Smrg# available, an argument of "optional" allows use when some unit tests require
2658515ec619Smrg# ld -wrap and others do not.
2659515ec619Smrg#
2660515ec619SmrgAC_DEFUN([XORG_LD_WRAP],[
2661515ec619SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662515ec619Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663515ec619Smrg                      void __wrap_exit(int status) { return; }],
2664515ec619Smrg                     [exit(0);])])
2665515ec619Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666515ec619Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667515ec619Smrg  if test "x$have_ld_wrap" = x"no"; then
2668515ec619Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669515ec619Smrg  fi
2670515ec619Smrgfi
2671515ec619SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672515ec619Smrg#
2673515ec619Smrg]) # XORG_LD_WRAP
2674ff559fabSmrg
2675515ec619Smrg# XORG_CHECK_LINKER_FLAGS
2676515ec619Smrg# -----------------------
2677515ec619Smrg# SYNOPSIS
2678515ec619Smrg#
2679515ec619Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680515ec619Smrg#
2681515ec619Smrg# DESCRIPTION
2682515ec619Smrg#
2683515ec619Smrg#   Check whether the given linker FLAGS work with the current language's
2684515ec619Smrg#   linker, or whether they give an error.
2685515ec619Smrg#
2686515ec619Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687515ec619Smrg#   success/failure.
2688515ec619Smrg#
2689515ec619Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690515ec619Smrg#
2691515ec619Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692515ec619Smrg#
2693515ec619Smrg# LICENSE
2694515ec619Smrg#
2695515ec619Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696515ec619Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697515ec619Smrg#   Copyright (c) 2009 Matteo Frigo
2698515ec619Smrg#
2699515ec619Smrg#   This program is free software: you can redistribute it and/or modify it
2700515ec619Smrg#   under the terms of the GNU General Public License as published by the
2701515ec619Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702515ec619Smrg#   option) any later version.
2703515ec619Smrg#
2704515ec619Smrg#   This program is distributed in the hope that it will be useful, but
2705515ec619Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706515ec619Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707515ec619Smrg#   Public License for more details.
2708515ec619Smrg#
2709515ec619Smrg#   You should have received a copy of the GNU General Public License along
2710515ec619Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711515ec619Smrg#
2712515ec619Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713515ec619Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714515ec619Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715515ec619Smrg#   need not follow the terms of the GNU General Public License when using
2716515ec619Smrg#   or distributing such scripts, even though portions of the text of the
2717515ec619Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718515ec619Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719515ec619Smrg#
2720515ec619Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721515ec619Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722515ec619Smrg#   modified version of the Autoconf Macro, you may extend this special
2723515ec619Smrg#   exception to the GPL to apply to your modified version as well.#
2724515ec619SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725515ec619Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726515ec619Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727515ec619SmrgAS_LITERAL_IF([$1],
2728515ec619Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729515ec619Smrg      ax_save_FLAGS=$LDFLAGS
2730515ec619Smrg      LDFLAGS="$1"
2731515ec619Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732515ec619Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733515ec619Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734515ec619Smrg      LDFLAGS=$ax_save_FLAGS])],
2735515ec619Smrg  [ax_save_FLAGS=$LDFLAGS
2736515ec619Smrg   LDFLAGS="$1"
2737515ec619Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738515ec619Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739515ec619Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740515ec619Smrg   LDFLAGS=$ax_save_FLAGS])
2741515ec619Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742515ec619SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743515ec619Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744515ec619Smrg	m4_default([$2], :)
27456fc0178dSmrgelse
2746515ec619Smrg	m4_default([$3], :)
2747862f5301Smrgfi
2748515ec619Smrg]) # XORG_CHECK_LINKER_FLAGS
2749515ec619Smrg
2750515ec619Smrg# XORG_MEMORY_CHECK_FLAGS
2751515ec619Smrg# -----------------------
2752515ec619Smrg# Minimum version: 1.16.0
2753515ec619Smrg#
2754515ec619Smrg# This macro attempts to find appropriate memory checking functionality
2755515ec619Smrg# for various platforms which unit testing code may use to catch various
2756515ec619Smrg# forms of memory allocation and access errors in testing.
2757515ec619Smrg#
2758515ec619Smrg# Interface to module:
2759515ec619Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760515ec619Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761515ec619Smrg#
2762515ec619Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763515ec619Smrg#
2764515ec619SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765ff559fabSmrg
2766515ec619SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767515ec619SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768515ec619Smrg           [Environment variables to enable memory checking in tests])
2769ff559fabSmrg
2770515ec619Smrg# Check for different types of support on different platforms
2771515ec619Smrgcase $host_os in
2772515ec619Smrg    solaris*)
2773515ec619Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774515ec619Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775515ec619Smrg        ;;
2776515ec619Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777515ec619Smrg        # both directly and inverted, so should not be 0 or 255.
2778515ec619Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779515ec619Smrg        ;;
2780515ec619Smrg    darwin*)
2781515ec619Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782515ec619Smrg        ;;
2783515ec619Smrg    *bsd*)
2784515ec619Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785515ec619Smrg        ;;
2786515ec619Smrgesac
2787515ec619Smrg
2788515ec619Smrg# User supplied flags override default flags
2789515ec619Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790515ec619Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27916fc0178dSmrgfi
27927a3b38f7Smrg
2793515ec619SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794515ec619Smrg]) # XORG_WITH_LINT
2795ff559fabSmrg
2796515ec619Smrg# XORG_CHECK_MALLOC_ZERO
2797515ec619Smrg# ----------------------
2798515ec619Smrg# Minimum version: 1.0.0
2799515ec619Smrg#
2800515ec619Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801515ec619Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802515ec619Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803515ec619SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804515ec619SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805515ec619Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806515ec619Smrg		       [malloc(0) returns NULL (default: auto)]),
2807515ec619Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808515ec619Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809ff559fabSmrg
2810515ec619SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811515ec619Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812515ec619SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813515ec619Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814515ec619Smrg#include <stdlib.h>
2815515ec619Smrg],[
2816515ec619Smrg    char *m0, *r0, *c0, *p;
2817515ec619Smrg    m0 = malloc(0);
2818515ec619Smrg    p = malloc(10);
2819515ec619Smrg    r0 = realloc(p,0);
2820515ec619Smrg    c0 = calloc(0,10);
2821515ec619Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822515ec619Smrg])],
2823515ec619Smrg		[xorg_cv_malloc0_returns_null=yes],
2824515ec619Smrg		[xorg_cv_malloc0_returns_null=no])])
2825515ec619SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826515ec619Smrgfi
2827515ec619SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828515ec619Smrg
2829515ec619Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830515ec619Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831515ec619Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832515ec619Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28336fc0178dSmrgelse
2834515ec619Smrg	MALLOC_ZERO_CFLAGS=""
2835515ec619Smrg	XMALLOC_ZERO_CFLAGS=""
2836515ec619Smrg	XTMALLOC_ZERO_CFLAGS=""
28376fc0178dSmrgfi
28386fc0178dSmrg
2839515ec619SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840515ec619SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841515ec619SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842515ec619Smrg]) # XORG_CHECK_MALLOC_ZERO
28436fc0178dSmrg
2844515ec619Smrg# XORG_WITH_LINT()
28456fc0178dSmrg# ----------------
2846515ec619Smrg# Minimum version: 1.1.0
2847515ec619Smrg#
2848515ec619Smrg# This macro enables the use of a tool that flags some suspicious and
2849515ec619Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850515ec619Smrg# It will attempt to locate the tool and use appropriate options.
2851515ec619Smrg# There are various lint type tools on different platforms.
2852515ec619Smrg#
2853515ec619Smrg# Interface to module:
2854515ec619Smrg# LINT:		returns the path to the tool found on the platform
2855515ec619Smrg#		or the value set to LINT on the configure cmd line
2856515ec619Smrg#		also an Automake conditional
2857515ec619Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858515ec619Smrg#
2859515ec619Smrg# --with-lint:	'yes' user instructs the module to use lint
2860515ec619Smrg#		'no' user instructs the module not to use lint (default)
2861515ec619Smrg#
2862515ec619Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863515ec619Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864515ec619Smrg#
2865515ec619SmrgAC_DEFUN([XORG_WITH_LINT],[
28666fc0178dSmrg
2867515ec619SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868515ec619SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869515ec619SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870515ec619Smrg		[Use a lint-style source code checker (default: disabled)])],
2871515ec619Smrg		[use_lint=$withval], [use_lint=no])
2872ff559fabSmrg
2873515ec619Smrg# Obtain platform specific info like program name and options
2874515ec619Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875515ec619Smrgcase $host_os in
2876515ec619Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877515ec619Smrg	lint_name=splint
2878515ec619Smrg	lint_options="-badflag"
2879515ec619Smrg	;;
2880515ec619Smrg  *freebsd* | *netbsd*)
2881515ec619Smrg	lint_name=lint
2882515ec619Smrg	lint_options="-u -b"
2883515ec619Smrg	;;
2884515ec619Smrg  *solaris*)
2885515ec619Smrg	lint_name=lint
2886515ec619Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887515ec619Smrg	;;
2888515ec619Smrgesac
2889ff559fabSmrg
2890515ec619Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891515ec619Smrgif test "x$use_lint" = x"yes" ; then
2892515ec619Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893515ec619Smrg   if test "x$LINT" = "x"; then
2894515ec619Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895515ec619Smrg   fi
2896515ec619Smrgelif test "x$use_lint" = x"no" ; then
2897515ec619Smrg   if test "x$LINT" != "x"; then
2898515ec619Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899515ec619Smrg   fi
29006fc0178dSmrgelse
2901515ec619Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902515ec619Smrgfi
2903862f5301Smrg
2904515ec619Smrg# User supplied flags override default flags
2905515ec619Smrgif test "x$LINT_FLAGS" != "x"; then
2906515ec619Smrg   lint_options=$LINT_FLAGS
2907515ec619Smrgfi
2908ff559fabSmrg
2909515ec619SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910515ec619SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911ff559fabSmrg
2912515ec619Smrg]) # XORG_WITH_LINT
2913ff559fabSmrg
2914515ec619Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915515ec619Smrg# --------------------------
2916515ec619Smrg# Minimum version: 1.1.0
2917515ec619Smrg#
2918515ec619Smrg# Sets up flags for building lint libraries for checking programs that call
2919515ec619Smrg# functions in the library.
2920515ec619Smrg#
2921515ec619Smrg# Interface to module:
2922515ec619Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923515ec619Smrg# MAKE_LINT_LIB		- Automake conditional
2924515ec619Smrg#
2925515ec619Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926515ec619Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29276fc0178dSmrg
2928515ec619SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929515ec619SmrgAC_REQUIRE([XORG_WITH_LINT])
2930515ec619SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931515ec619Smrg	[Create lint library (default: disabled)])],
2932515ec619Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933ff559fabSmrg
2934515ec619Smrgif test "x$make_lint_lib" = x"yes" ; then
2935515ec619Smrg   LINTLIB=llib-l$1.ln
2936515ec619Smrg   if test "x$LINT" = "x"; then
2937515ec619Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938515ec619Smrg   fi
2939515ec619Smrgelif test "x$make_lint_lib" != x"no" ; then
2940515ec619Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941515ec619Smrgfi
29426fc0178dSmrg
2943515ec619SmrgAC_SUBST(LINTLIB)
2944515ec619SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945ff559fabSmrg
2946515ec619Smrg]) # XORG_LINT_LIBRARY
2947ff559fabSmrg
2948515ec619Smrg# XORG_COMPILER_BRAND
2949515ec619Smrg# -------------------
2950515ec619Smrg# Minimum version: 1.14.0
2951515ec619Smrg#
2952515ec619Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953515ec619Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954515ec619Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955515ec619Smrg#   clang compiler - sets CLANGCC to "yes"
2956515ec619Smrg#   Intel compiler - sets INTELCC to "yes"
2957515ec619Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958515ec619Smrg#
2959515ec619SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960515ec619SmrgAC_LANG_CASE(
2961515ec619Smrg	[C], [
2962e08b657dSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963e08b657dSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964e08b657dSmrg		m4_version_prereq([2.70],
2965e08b657dSmrg			[AC_REQUIRE([AC_PROG_CC])],
2966e08b657dSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967515ec619Smrg	],
2968515ec619Smrg	[C++], [
2969515ec619Smrg		AC_REQUIRE([AC_PROG_CXX])
2970515ec619Smrg	]
2971515ec619Smrg)
2972515ec619SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973515ec619SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974515ec619SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975515ec619Smrg]) # XORG_COMPILER_BRAND
2976ff559fabSmrg
2977515ec619Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978515ec619Smrg# ---------------
2979515ec619Smrg# Minimum version: 1.16.0
2980515ec619Smrg#
2981515ec619Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982e08b657dSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983515ec619Smrg# next flag in the list until there are no more options.
2984515ec619Smrg#
2985515ec619Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986515ec619Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987515ec619Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988515ec619Smrg# -Werror=unused-command-line-argument
2989515ec619Smrg#
2990515ec619SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991515ec619Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992515ec619Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993862f5301Smrg
2994515ec619SmrgAC_LANG_COMPILER_REQUIRE
2995ff559fabSmrg
2996515ec619SmrgAC_LANG_CASE(
2997515ec619Smrg	[C], [
2998e08b657dSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999e08b657dSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000e08b657dSmrg		m4_version_prereq([2.70],
3001e08b657dSmrg			[AC_REQUIRE([AC_PROG_CC])],
3002e08b657dSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003515ec619Smrg		define([PREFIX], [C])
3004515ec619Smrg		define([CACHE_PREFIX], [cc])
3005515ec619Smrg		define([COMPILER], [$CC])
3006515ec619Smrg	],
3007515ec619Smrg	[C++], [
3008515ec619Smrg		define([PREFIX], [CXX])
3009515ec619Smrg		define([CACHE_PREFIX], [cxx])
3010515ec619Smrg		define([COMPILER], [$CXX])
3011515ec619Smrg	]
3012515ec619Smrg)
3013ff559fabSmrg
3014515ec619Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015ff559fabSmrg
3016515ec619Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017515ec619Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018515ec619Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019515ec619Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020515ec619Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021515ec619Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022515ec619Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023515ec619Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024515ec619Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025515ec619Smrgfi
3026ff559fabSmrg
3027515ec619Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028515ec619Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029515ec619Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030515ec619Smrg	fi
3031515ec619Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032515ec619Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033515ec619Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034515ec619Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035515ec619Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036515ec619Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037515ec619Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038515ec619Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3039515ec619Smrgfi
3040ff559fabSmrg
3041515ec619Smrgfound="no"
3042515ec619Smrgm4_foreach([flag], m4_cdr($@), [
3043515ec619Smrg	if test $found = "no" ; then
3044515ec619Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045515ec619Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046515ec619Smrg		fi
3047ff559fabSmrg
3048515ec619Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049515ec619Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050515ec619Smrg		fi
3051ff559fabSmrg
3052515ec619Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053ff559fabSmrg
3054515ec619Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055515ec619Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056515ec619Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057515ec619Smrg		AC_CACHE_VAL($cacheid,
3058515ec619Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059515ec619Smrg					     [eval $cacheid=yes],
3060515ec619Smrg					     [eval $cacheid=no])])
30616fc0178dSmrg
3062515ec619Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063ff559fabSmrg
3064515ec619Smrg		eval supported=\$$cacheid
3065515ec619Smrg		AC_MSG_RESULT([$supported])
3066515ec619Smrg		if test "$supported" = "yes" ; then
3067515ec619Smrg			$1="$$1 ]flag["
3068515ec619Smrg			found="yes"
3069515ec619Smrg		fi
3070515ec619Smrg	fi
3071515ec619Smrg])
3072515ec619Smrg]) # XORG_TESTSET_CFLAG
3073ff559fabSmrg
3074515ec619Smrg# XORG_COMPILER_FLAGS
3075515ec619Smrg# ---------------
3076515ec619Smrg# Minimum version: 1.16.0
3077515ec619Smrg#
3078515ec619Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079515ec619Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080515ec619Smrg# code.  These arguments will cause the compiler to print various warnings
3081515ec619Smrg# during compilation AND turn a conservative set of warnings into errors.
3082515ec619Smrg#
3083515ec619Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084515ec619Smrg# future versions of util-macros as options are added to new compilers.
3085515ec619Smrg#
3086515ec619SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087515ec619SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088ff559fabSmrg
3089515ec619SmrgAC_ARG_ENABLE(selective-werror,
3090515ec619Smrg              AS_HELP_STRING([--disable-selective-werror],
3091515ec619Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092515ec619Smrg              [SELECTIVE_WERROR=$enableval],
3093515ec619Smrg              [SELECTIVE_WERROR=yes])
3094ff559fabSmrg
3095515ec619SmrgAC_LANG_CASE(
3096515ec619Smrg        [C], [
3097515ec619Smrg                define([PREFIX], [C])
3098515ec619Smrg        ],
3099515ec619Smrg        [C++], [
3100515ec619Smrg                define([PREFIX], [CXX])
3101515ec619Smrg        ]
3102515ec619Smrg)
3103515ec619Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104515ec619Smrgif test "x$SUNCC" = "xyes"; then
3105515ec619Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106515ec619Smrgelse
3107515ec619Smrg    [BASE_]PREFIX[FLAGS]=""
3108515ec619Smrgfi
3109ff559fabSmrg
3110515ec619Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115ff559fabSmrg
3116515ec619SmrgAC_LANG_CASE(
3117515ec619Smrg	[C], [
3118515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123515ec619Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124515ec619Smrg	]
3125515ec619Smrg)
3126ff559fabSmrg
3127515ec619Smrg# This chunk adds additional warnings that could catch undesired effects.
3128515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135ff559fabSmrg
3136515ec619Smrg# These are currently disabled because they are noisy.  They will be enabled
3137515ec619Smrg# in the future once the codebase is sufficiently modernized to silence
3138515ec619Smrg# them.  For now, I don't want them to drown out the other warnings.
3139515ec619Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140515ec619Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141515ec619Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142ff559fabSmrg
3143e08b657dSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144515ec619Smrg# when there are problems that should be fixed.
3145ff559fabSmrg
3146515ec619Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160515ec619Smrgelse
3161515ec619SmrgAC_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])
3162515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174515ec619SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175515ec619Smrgfi
3176ff559fabSmrg
3177515ec619SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178515ec619Smrg]) # XORG_COMPILER_FLAGS
3179ff559fabSmrg
3180515ec619Smrg# XORG_CWARNFLAGS
3181515ec619Smrg# ---------------
3182515ec619Smrg# Minimum version: 1.2.0
3183515ec619Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184515ec619Smrg#
3185515ec619Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186515ec619Smrg#
3187515ec619Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188515ec619Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189515ec619Smrg# is needed, then it should be added explicitly in the module when
3190515ec619Smrg# it is updated to use BASE_CFLAGS.
3191515ec619Smrg#
3192515ec619SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193515ec619SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194515ec619SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195515ec619SmrgAC_LANG_CASE(
3196515ec619Smrg	[C], [
3197515ec619Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198515ec619Smrg		if  test "x$GCC" = xyes ; then
3199515ec619Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200515ec619Smrg		fi
3201515ec619Smrg		AC_SUBST(CWARNFLAGS)
3202515ec619Smrg	]
3203515ec619Smrg)
3204515ec619Smrg]) # XORG_CWARNFLAGS
320544dda7b2Smrg
3206515ec619Smrg# XORG_STRICT_OPTION
3207515ec619Smrg# -----------------------
3208515ec619Smrg# Minimum version: 1.3.0
3209515ec619Smrg#
3210515ec619Smrg# Add configure option to enable strict compilation flags, such as treating
3211515ec619Smrg# warnings as fatal errors.
3212515ec619Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213515ec619Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214515ec619Smrg#
3215515ec619Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216515ec619Smrg# when strict compilation is unconditionally desired.
3217515ec619SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218515ec619SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219515ec619SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322044dda7b2Smrg
3221515ec619SmrgAC_ARG_ENABLE(strict-compilation,
3222515ec619Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223515ec619Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224515ec619Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
322544dda7b2Smrg
3226515ec619SmrgAC_LANG_CASE(
3227515ec619Smrg        [C], [
3228515ec619Smrg                define([PREFIX], [C])
3229515ec619Smrg        ],
3230515ec619Smrg        [C++], [
3231515ec619Smrg                define([PREFIX], [CXX])
3232515ec619Smrg        ]
3233515ec619Smrg)
323444dda7b2Smrg
3235515ec619Smrg[STRICT_]PREFIX[FLAGS]=""
3236515ec619SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237515ec619SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323844dda7b2Smrg
3239515ec619Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240515ec619Smrg# activate it with -Werror, so we add it here explicitly.
3241515ec619SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242fc544a13Smrg
3243515ec619Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244515ec619Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245515ec619Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246515ec619Smrgfi
3247515ec619SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248515ec619SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249515ec619SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250515ec619Smrg]) # XORG_STRICT_OPTION
325144dda7b2Smrg
3252e08b657dSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3253e08b657dSmrg# ---------------------------
3254e08b657dSmrg# Minimum version: 1.20.0
3255e08b657dSmrg#
3256e08b657dSmrg# Defines default options for X.Org modules which don't compile code,
3257e08b657dSmrg# such as fonts, bitmaps, cursors, and docs.
3258e08b657dSmrg#
3259e08b657dSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260e08b657dSmrgAC_REQUIRE([AC_PROG_INSTALL])
3261e08b657dSmrgXORG_RELEASE_VERSION
3262e08b657dSmrgXORG_CHANGELOG
3263e08b657dSmrgXORG_INSTALL
3264e08b657dSmrgXORG_MANPAGE_SECTIONS
3265e08b657dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266e08b657dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267e08b657dSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268e08b657dSmrg
3269515ec619Smrg# XORG_DEFAULT_OPTIONS
3270515ec619Smrg# --------------------
3271515ec619Smrg# Minimum version: 1.3.0
3272515ec619Smrg#
3273e08b657dSmrg# Defines default options for X.Org modules which compile code.
3274515ec619Smrg#
3275515ec619SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276515ec619SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277515ec619SmrgXORG_COMPILER_FLAGS
3278515ec619SmrgXORG_CWARNFLAGS
3279515ec619SmrgXORG_STRICT_OPTION
3280e08b657dSmrgXORG_DEFAULT_NOCODE_OPTIONS
3281515ec619Smrg]) # XORG_DEFAULT_OPTIONS
328244dda7b2Smrg
3283515ec619Smrg# XORG_INSTALL()
3284515ec619Smrg# ----------------
3285515ec619Smrg# Minimum version: 1.4.0
3286515ec619Smrg#
3287515ec619Smrg# Defines the variable INSTALL_CMD as the command to copy
3288515ec619Smrg# INSTALL from $prefix/share/util-macros.
3289515ec619Smrg#
3290515ec619SmrgAC_DEFUN([XORG_INSTALL], [
3291515ec619SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292515ec619Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293515ec619SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294515ec619Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295515ec619Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296515ec619Smrgtouch \$(top_srcdir)/INSTALL; \
3297515ec619Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298515ec619SmrgAC_SUBST([INSTALL_CMD])
3299515ec619Smrg]) # XORG_INSTALL
3300515ec619Smrgdnl Copyright 2005 Red Hat, Inc
3301515ec619Smrgdnl
3302515ec619Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303515ec619Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304515ec619Smrgdnl the above copyright notice appear in all copies and that both that
3305515ec619Smrgdnl copyright notice and this permission notice appear in supporting
3306515ec619Smrgdnl documentation.
3307515ec619Smrgdnl
3308515ec619Smrgdnl The above copyright notice and this permission notice shall be included
3309515ec619Smrgdnl in all copies or substantial portions of the Software.
3310515ec619Smrgdnl
3311515ec619Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312515ec619Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313515ec619Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314515ec619Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315515ec619Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316515ec619Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317515ec619Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318515ec619Smrgdnl
3319515ec619Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320515ec619Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321515ec619Smrgdnl other dealings in this Software without prior written authorization
3322515ec619Smrgdnl from the copyright holders.
3323515ec619Smrgdnl
3324862f5301Smrg
3325515ec619Smrg# XORG_RELEASE_VERSION
3326515ec619Smrg# --------------------
3327515ec619Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332844dda7b2Smrg
3329515ec619SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330515ec619Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331515ec619Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332515ec619Smrg		[Major version of this package])
3333515ec619Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334515ec619Smrg	if test "x$PVM" = "x"; then
3335515ec619Smrg		PVM="0"
3336515ec619Smrg	fi
3337515ec619Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338515ec619Smrg		[$PVM],
3339515ec619Smrg		[Minor version of this package])
3340515ec619Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341515ec619Smrg	if test "x$PVP" = "x"; then
3342515ec619Smrg		PVP="0"
3343515ec619Smrg	fi
3344515ec619Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345515ec619Smrg		[$PVP],
3346515ec619Smrg		[Patch version of this package])
3347515ec619Smrg])
334844dda7b2Smrg
3349515ec619Smrg# XORG_CHANGELOG()
3350515ec619Smrg# ----------------
3351515ec619Smrg# Minimum version: 1.2.0
3352515ec619Smrg#
3353515ec619Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354515ec619Smrg# ChangeLog from git.
3355515ec619Smrg#
3356515ec619Smrg#
3357515ec619SmrgAC_DEFUN([XORG_CHANGELOG], [
3358515ec619SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359515ec619Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360515ec619Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361515ec619Smrgtouch \$(top_srcdir)/ChangeLog; \
3362515ec619Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363515ec619SmrgAC_SUBST([CHANGELOG_CMD])
3364515ec619Smrg]) # XORG_CHANGELOG
336544dda7b2Smrg
3366e08b657dSmrgm4_include([m4/libtool.m4])
3367e08b657dSmrgm4_include([m4/ltoptions.m4])
3368e08b657dSmrgm4_include([m4/ltsugar.m4])
3369e08b657dSmrgm4_include([m4/ltversion.m4])
3370e08b657dSmrgm4_include([m4/lt~obsolete.m4])
3371