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