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