1a7e741d5Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
23e6c936aSmrg
3a7e741d5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
44456fccdSmrg
54456fccdSmrg# This file is free software; the Free Software Foundation
64456fccdSmrg# gives unlimited permission to copy and/or distribute it,
74456fccdSmrg# with or without modifications, as long as this notice is preserved.
84456fccdSmrg
94456fccdSmrg# This program is distributed in the hope that it will be useful,
104456fccdSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
114456fccdSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
124456fccdSmrg# PARTICULAR PURPOSE.
134456fccdSmrg
143e6c936aSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1542d69509Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1642d69509Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17a7e741d5Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18a7e741d5Smrg[m4_warning([this file was generated for autoconf 2.71.
1942d69509SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2042d69509SmrgIf you have problems, you may need to regenerate the build system entirely.
213e6c936aSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
224456fccdSmrg
23a7e741d5Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2442d69509Smrg#
25a7e741d5Smrg# This file is free software; the Free Software Foundation
26a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
27a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
280f1ac3bcSmrg
29a7e741d5Smrg# AM_AUTOMAKE_VERSION(VERSION)
30a7e741d5Smrg# ----------------------------
31a7e741d5Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32a7e741d5Smrg# generated from the m4 files accompanying Automake X.Y.
33a7e741d5Smrg# (This private macro should not be called outside this file.)
34a7e741d5SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35a7e741d5Smrg[am__api_version='1.16'
36a7e741d5Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37a7e741d5Smrgdnl require some minimum version.  Point them to the right macro.
38a7e741d5Smrgm4_if([$1], [1.16.5], [],
39a7e741d5Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4042d69509Smrg])
414456fccdSmrg
42a7e741d5Smrg# _AM_AUTOCONF_VERSION(VERSION)
430f1ac3bcSmrg# -----------------------------
44a7e741d5Smrg# aclocal traces this macro to find the Autoconf version.
45a7e741d5Smrg# This is a private macro too.  Using m4_define simplifies
46a7e741d5Smrg# the logic in aclocal, which can simply ignore this definition.
47a7e741d5Smrgm4_define([_AM_AUTOCONF_VERSION], [])
484456fccdSmrg
49a7e741d5Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50a7e741d5Smrg# -------------------------------
51a7e741d5Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52a7e741d5Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53a7e741d5SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54a7e741d5Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55a7e741d5Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56a7e741d5Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57a7e741d5Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
584456fccdSmrg
59a7e741d5Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
603e6c936aSmrg
61a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62a7e741d5Smrg#
63a7e741d5Smrg# This file is free software; the Free Software Foundation
64a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
65a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
660f1ac3bcSmrg
67a7e741d5Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68a7e741d5Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69a7e741d5Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70a7e741d5Smrg#
71a7e741d5Smrg# Of course, Automake must honor this variable whenever it calls a
72a7e741d5Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73a7e741d5Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74a7e741d5Smrg# depending on how configure is run.  This is pretty annoying, since
75a7e741d5Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76a7e741d5Smrg# source directory, any form will work fine, but in subdirectories a
77a7e741d5Smrg# relative path needs to be adjusted first.
78a7e741d5Smrg#
79a7e741d5Smrg# $ac_aux_dir/missing
80a7e741d5Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81a7e741d5Smrg# $top_srcdir/$ac_aux_dir/missing
82a7e741d5Smrg#    fails if $ac_aux_dir is absolute,
83a7e741d5Smrg#    fails when called from a subdirectory in a VPATH build with
84a7e741d5Smrg#          a relative $ac_aux_dir
85a7e741d5Smrg#
86a7e741d5Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87a7e741d5Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88a7e741d5Smrg# harmless because $srcdir is '.', but things will broke when you
89a7e741d5Smrg# start a VPATH build or use an absolute $srcdir.
90a7e741d5Smrg#
91a7e741d5Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92a7e741d5Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93a7e741d5Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94a7e741d5Smrg# and then we would define $MISSING as
95a7e741d5Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96a7e741d5Smrg# This will work as long as MISSING is not called from configure, because
97a7e741d5Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98a7e741d5Smrg# However there are other variables, like CC, which are often used in
99a7e741d5Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100a7e741d5Smrg#
101a7e741d5Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102a7e741d5Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103a7e741d5Smrg# configured tree to be moved without reconfiguration.
1040f1ac3bcSmrg
105a7e741d5SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106a7e741d5Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107a7e741d5Smrg# Expand $ac_aux_dir to an absolute path.
108a7e741d5Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1093e6c936aSmrg])
1104456fccdSmrg
111a7e741d5Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1124456fccdSmrg
113a7e741d5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114a7e741d5Smrg#
115a7e741d5Smrg# This file is free software; the Free Software Foundation
116a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
117a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
1180f1ac3bcSmrg
119a7e741d5Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120a7e741d5Smrg# -------------------------------------
121a7e741d5Smrg# Define a conditional.
122a7e741d5SmrgAC_DEFUN([AM_CONDITIONAL],
123a7e741d5Smrg[AC_PREREQ([2.52])dnl
124a7e741d5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125a7e741d5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126a7e741d5SmrgAC_SUBST([$1_TRUE])dnl
127a7e741d5SmrgAC_SUBST([$1_FALSE])dnl
128a7e741d5Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129a7e741d5Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130a7e741d5Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131a7e741d5Smrgif $2; then
132a7e741d5Smrg  $1_TRUE=
133a7e741d5Smrg  $1_FALSE='#'
134a7e741d5Smrgelse
135a7e741d5Smrg  $1_TRUE='#'
136a7e741d5Smrg  $1_FALSE=
137a7e741d5Smrgfi
138a7e741d5SmrgAC_CONFIG_COMMANDS_PRE(
139a7e741d5Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140a7e741d5Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141a7e741d5SmrgUsually this means the macro was only invoked conditionally.]])
142a7e741d5Smrgfi])])
1430f1ac3bcSmrg
144a7e741d5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145a7e741d5Smrg#
146a7e741d5Smrg# This file is free software; the Free Software Foundation
147a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
148a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
1494456fccdSmrg
1504456fccdSmrg
151a7e741d5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152a7e741d5Smrg# written in clear, in which case automake, when reading aclocal.m4,
153a7e741d5Smrg# will think it sees a *use*, and therefore will trigger all it's
154a7e741d5Smrg# C support machinery.  Also note that it means that autoscan, seeing
155a7e741d5Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156ff63a143Smrg
1574456fccdSmrg
158a7e741d5Smrg# _AM_DEPENDENCIES(NAME)
159a7e741d5Smrg# ----------------------
160a7e741d5Smrg# See how the compiler implements dependency checking.
161a7e741d5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162a7e741d5Smrg# We try a few techniques and use that to set a single cache variable.
1630f1ac3bcSmrg#
164a7e741d5Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165a7e741d5Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166a7e741d5Smrg# dependency, and given that the user is not expected to run this macro,
167a7e741d5Smrg# just rely on AC_PROG_CC.
168a7e741d5SmrgAC_DEFUN([_AM_DEPENDENCIES],
169a7e741d5Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170a7e741d5SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171a7e741d5SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172a7e741d5SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1734456fccdSmrg
174a7e741d5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175a7e741d5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176a7e741d5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177a7e741d5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178a7e741d5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179a7e741d5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180a7e741d5Smrg                    [depcc="$$1"   am_compiler_list=])
1814456fccdSmrg
182a7e741d5SmrgAC_CACHE_CHECK([dependency style of $depcc],
183a7e741d5Smrg               [am_cv_$1_dependencies_compiler_type],
184a7e741d5Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185a7e741d5Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186a7e741d5Smrg  # making bogus files that we don't know about and never remove.  For
187a7e741d5Smrg  # instance it was reported that on HP-UX the gcc test will end up
188a7e741d5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189a7e741d5Smrg  # in D".
190a7e741d5Smrg  rm -rf conftest.dir
191a7e741d5Smrg  mkdir conftest.dir
192a7e741d5Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193a7e741d5Smrg  # using a relative directory.
194a7e741d5Smrg  cp "$am_depcomp" conftest.dir
195a7e741d5Smrg  cd conftest.dir
196a7e741d5Smrg  # We will build objects and dependencies in a subdirectory because
197a7e741d5Smrg  # it helps to detect inapplicable dependency modes.  For instance
198a7e741d5Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199a7e741d5Smrg  # side effect of compilation, but ICC will put the dependencies in
200a7e741d5Smrg  # the current directory while Tru64 will put them in the object
201a7e741d5Smrg  # directory.
202a7e741d5Smrg  mkdir sub
2034456fccdSmrg
204a7e741d5Smrg  am_cv_$1_dependencies_compiler_type=none
205a7e741d5Smrg  if test "$am_compiler_list" = ""; then
206a7e741d5Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207a7e741d5Smrg  fi
208a7e741d5Smrg  am__universal=false
209a7e741d5Smrg  m4_case([$1], [CC],
210a7e741d5Smrg    [case " $depcc " in #(
211a7e741d5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212a7e741d5Smrg     esac],
213a7e741d5Smrg    [CXX],
214a7e741d5Smrg    [case " $depcc " in #(
215a7e741d5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216a7e741d5Smrg     esac])
2173e6c936aSmrg
218a7e741d5Smrg  for depmode in $am_compiler_list; do
219a7e741d5Smrg    # Setup a source with many dependencies, because some compilers
220a7e741d5Smrg    # like to wrap large dependency lists on column 80 (with \), and
221a7e741d5Smrg    # we should not choose a depcomp mode which is confused by this.
222a7e741d5Smrg    #
223a7e741d5Smrg    # We need to recreate these files for each test, as the compiler may
224a7e741d5Smrg    # overwrite some of them when testing with obscure command lines.
225a7e741d5Smrg    # This happens at least with the AIX C compiler.
226a7e741d5Smrg    : > sub/conftest.c
227a7e741d5Smrg    for i in 1 2 3 4 5 6; do
228a7e741d5Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229a7e741d5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230a7e741d5Smrg      # Solaris 10 /bin/sh.
231a7e741d5Smrg      echo '/* dummy */' > sub/conftst$i.h
232a7e741d5Smrg    done
233a7e741d5Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2344456fccdSmrg
235a7e741d5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236a7e741d5Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237a7e741d5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238a7e741d5Smrg    # versions had trouble with output in subdirs.
239a7e741d5Smrg    am__obj=sub/conftest.${OBJEXT-o}
240a7e741d5Smrg    am__minus_obj="-o $am__obj"
241a7e741d5Smrg    case $depmode in
242a7e741d5Smrg    gcc)
243a7e741d5Smrg      # This depmode causes a compiler race in universal mode.
244a7e741d5Smrg      test "$am__universal" = false || continue
2450f1ac3bcSmrg      ;;
246a7e741d5Smrg    nosideeffect)
247a7e741d5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248a7e741d5Smrg      # only be used when explicitly requested.
249a7e741d5Smrg      if test "x$enable_dependency_tracking" = xyes; then
250a7e741d5Smrg	continue
251a7e741d5Smrg      else
252a7e741d5Smrg	break
253a7e741d5Smrg      fi
2540f1ac3bcSmrg      ;;
255a7e741d5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256a7e741d5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257a7e741d5Smrg      # not run yet.  These depmodes are late enough in the game, and
258a7e741d5Smrg      # so weak that their functioning should not be impacted.
259a7e741d5Smrg      am__obj=conftest.${OBJEXT-o}
260a7e741d5Smrg      am__minus_obj=
2610f1ac3bcSmrg      ;;
262a7e741d5Smrg    none) break ;;
2630f1ac3bcSmrg    esac
264a7e741d5Smrg    if depmode=$depmode \
265a7e741d5Smrg       source=sub/conftest.c object=$am__obj \
266a7e741d5Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267a7e741d5Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268a7e741d5Smrg         >/dev/null 2>conftest.err &&
269a7e741d5Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270a7e741d5Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271a7e741d5Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272a7e741d5Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273a7e741d5Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274a7e741d5Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275a7e741d5Smrg      # that says an option was ignored or not supported.
276a7e741d5Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277a7e741d5Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278a7e741d5Smrg      # The diagnosis changed in icc 8.0:
279a7e741d5Smrg      #   icc: Command line remark: option '-MP' not supported
280a7e741d5Smrg      if (grep 'ignoring option' conftest.err ||
281a7e741d5Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282a7e741d5Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283a7e741d5Smrg        break
284a7e741d5Smrg      fi
285a7e741d5Smrg    fi
286a7e741d5Smrg  done
2874456fccdSmrg
288a7e741d5Smrg  cd ..
289a7e741d5Smrg  rm -rf conftest.dir
290a7e741d5Smrgelse
291a7e741d5Smrg  am_cv_$1_dependencies_compiler_type=none
292a7e741d5Smrgfi
293a7e741d5Smrg])
294a7e741d5SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295a7e741d5SmrgAM_CONDITIONAL([am__fastdep$1], [
296a7e741d5Smrg  test "x$enable_dependency_tracking" != xno \
297a7e741d5Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2983e6c936aSmrg])
2994456fccdSmrg
3004456fccdSmrg
301a7e741d5Smrg# AM_SET_DEPDIR
302a7e741d5Smrg# -------------
303a7e741d5Smrg# Choose a directory name for dependency files.
304a7e741d5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305a7e741d5SmrgAC_DEFUN([AM_SET_DEPDIR],
306a7e741d5Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307a7e741d5SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308a7e741d5Smrg])
3094456fccdSmrg
310b0a0317aSmrg
311a7e741d5Smrg# AM_DEP_TRACK
312a7e741d5Smrg# ------------
313a7e741d5SmrgAC_DEFUN([AM_DEP_TRACK],
314a7e741d5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315a7e741d5SmrgAS_HELP_STRING(
316a7e741d5Smrg  [--enable-dependency-tracking],
317a7e741d5Smrg  [do not reject slow dependency extractors])
318a7e741d5SmrgAS_HELP_STRING(
319a7e741d5Smrg  [--disable-dependency-tracking],
320a7e741d5Smrg  [speeds up one-time build])])
321a7e741d5Smrgif test "x$enable_dependency_tracking" != xno; then
322a7e741d5Smrg  am_depcomp="$ac_aux_dir/depcomp"
323a7e741d5Smrg  AMDEPBACKSLASH='\'
324a7e741d5Smrg  am__nodep='_no'
325a7e741d5Smrgfi
326a7e741d5SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327a7e741d5SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328a7e741d5Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329a7e741d5SmrgAC_SUBST([am__nodep])dnl
330a7e741d5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331a7e741d5Smrg])
332b0a0317aSmrg
333a7e741d5Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3344456fccdSmrg
335a7e741d5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336a7e741d5Smrg#
337a7e741d5Smrg# This file is free software; the Free Software Foundation
338a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
339a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
340b0a0317aSmrg
341a7e741d5Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342a7e741d5Smrg# ------------------------------
343a7e741d5SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344a7e741d5Smrg[{
345a7e741d5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346a7e741d5Smrg  # are listed without --file.  Let's play safe and only enable the eval
347a7e741d5Smrg  # if we detect the quoting.
348a7e741d5Smrg  # TODO: see whether this extra hack can be removed once we start
349a7e741d5Smrg  # requiring Autoconf 2.70 or later.
350a7e741d5Smrg  AS_CASE([$CONFIG_FILES],
351a7e741d5Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352a7e741d5Smrg          [*], [set x $CONFIG_FILES])
353a7e741d5Smrg  shift
354a7e741d5Smrg  # Used to flag and report bootstrapping failures.
355a7e741d5Smrg  am_rc=0
356a7e741d5Smrg  for am_mf
357a7e741d5Smrg  do
358a7e741d5Smrg    # Strip MF so we end up with the name of the file.
359a7e741d5Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360a7e741d5Smrg    # Check whether this is an Automake generated Makefile which includes
361a7e741d5Smrg    # dependency-tracking related rules and includes.
362a7e741d5Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363a7e741d5Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364a7e741d5Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365a7e741d5Smrg      || continue
366a7e741d5Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367a7e741d5Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368a7e741d5Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369a7e741d5Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370a7e741d5Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371a7e741d5Smrg  done
372a7e741d5Smrg  if test $am_rc -ne 0; then
373a7e741d5Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374a7e741d5Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375a7e741d5Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376a7e741d5Smrg    necessary).  You can also try re-running configure with the
377a7e741d5Smrg    '--disable-dependency-tracking' option to at least be able to build
378a7e741d5Smrg    the package (albeit without support for automatic dependency tracking).])
379a7e741d5Smrg  fi
380a7e741d5Smrg  AS_UNSET([am_dirpart])
381a7e741d5Smrg  AS_UNSET([am_filepart])
382a7e741d5Smrg  AS_UNSET([am_mf])
383a7e741d5Smrg  AS_UNSET([am_rc])
384a7e741d5Smrg  rm -f conftest-deps.mk
385a7e741d5Smrg}
386a7e741d5Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3874456fccdSmrg
388b0a0317aSmrg
389a7e741d5Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390a7e741d5Smrg# -----------------------------
391a7e741d5Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392a7e741d5Smrg#
393a7e741d5Smrg# This code is only required when automatic dependency tracking is enabled.
394a7e741d5Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395a7e741d5Smrg# order to bootstrap the dependency handling code.
396a7e741d5SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397a7e741d5Smrg[AC_CONFIG_COMMANDS([depfiles],
398a7e741d5Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399a7e741d5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400b0a0317aSmrg
401a7e741d5Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402b0a0317aSmrg
403a7e741d5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404a7e741d5Smrg#
405a7e741d5Smrg# This file is free software; the Free Software Foundation
406a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
407a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
408b0a0317aSmrg
409a7e741d5Smrg# This macro actually does too much.  Some checks are only needed if
410a7e741d5Smrg# your package does certain things.  But this isn't really a big deal.
411b0a0317aSmrg
412a7e741d5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413a7e741d5Smrgm4_define([AC_PROG_CC],
414a7e741d5Smrgm4_defn([AC_PROG_CC])
415a7e741d5Smrg[_AM_PROG_CC_C_O
416a7e741d5Smrg])
4174456fccdSmrg
418a7e741d5Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419a7e741d5Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420a7e741d5Smrg# -----------------------------------------------
421a7e741d5Smrg# The call with PACKAGE and VERSION arguments is the old style
422a7e741d5Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423a7e741d5Smrg# and VERSION should now be passed to AC_INIT and removed from
424a7e741d5Smrg# the call to AM_INIT_AUTOMAKE.
425a7e741d5Smrg# We support both call styles for the transition.  After
426a7e741d5Smrg# the next Automake release, Autoconf can make the AC_INIT
427a7e741d5Smrg# arguments mandatory, and then we can depend on a new Autoconf
428a7e741d5Smrg# release and drop the old call support.
429a7e741d5SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430a7e741d5Smrg[AC_PREREQ([2.65])dnl
431a7e741d5Smrgm4_ifdef([_$0_ALREADY_INIT],
432a7e741d5Smrg  [m4_fatal([$0 expanded multiple times
433a7e741d5Smrg]m4_defn([_$0_ALREADY_INIT]))],
434a7e741d5Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435a7e741d5Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436a7e741d5Smrgdnl the ones we care about.
437a7e741d5Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438a7e741d5SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439a7e741d5SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440a7e741d5Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441a7e741d5Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442a7e741d5Smrg  # is not polluted with repeated "-I."
443a7e741d5Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444a7e741d5Smrg  # test to see if srcdir already configured
445a7e741d5Smrg  if test -f $srcdir/config.status; then
446a7e741d5Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447a7e741d5Smrg  fi
4480f1ac3bcSmrgfi
449521070a0Smrg
450a7e741d5Smrg# test whether we have cygpath
451a7e741d5Smrgif test -z "$CYGPATH_W"; then
452a7e741d5Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453a7e741d5Smrg    CYGPATH_W='cygpath -w'
454a7e741d5Smrg  else
455a7e741d5Smrg    CYGPATH_W=echo
4560f1ac3bcSmrg  fi
4570f1ac3bcSmrgfi
458a7e741d5SmrgAC_SUBST([CYGPATH_W])
4593e6c936aSmrg
460a7e741d5Smrg# Define the identity of the package.
461a7e741d5Smrgdnl Distinguish between old-style and new-style calls.
462a7e741d5Smrgm4_ifval([$2],
463a7e741d5Smrg[AC_DIAGNOSE([obsolete],
464a7e741d5Smrg             [$0: two- and three-arguments forms are deprecated.])
465a7e741d5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466a7e741d5Smrg AC_SUBST([PACKAGE], [$1])dnl
467a7e741d5Smrg AC_SUBST([VERSION], [$2])],
468a7e741d5Smrg[_AM_SET_OPTIONS([$1])dnl
469a7e741d5Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470a7e741d5Smrgm4_if(
471a7e741d5Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472a7e741d5Smrg  [ok:ok],,
473a7e741d5Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474a7e741d5Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475a7e741d5Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4764456fccdSmrg
477a7e741d5Smrg_AM_IF_OPTION([no-define],,
478a7e741d5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479a7e741d5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4804456fccdSmrg
481a7e741d5Smrg# Some tools Automake needs.
482a7e741d5SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483a7e741d5SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484a7e741d5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485a7e741d5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486a7e741d5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487a7e741d5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488a7e741d5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489a7e741d5SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490a7e741d5SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491a7e741d5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492a7e741d5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493a7e741d5Smrg# dies out for good.  For more background, see:
494a7e741d5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495a7e741d5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496a7e741d5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497a7e741d5Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498a7e741d5Smrg# system "awk" is bad on some platforms.
499a7e741d5SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500a7e741d5SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501a7e741d5SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502a7e741d5Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503a7e741d5Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504a7e741d5Smrg			     [_AM_PROG_TAR([v7])])])
505a7e741d5Smrg_AM_IF_OPTION([no-dependencies],,
506a7e741d5Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507a7e741d5Smrg		  [_AM_DEPENDENCIES([CC])],
508a7e741d5Smrg		  [m4_define([AC_PROG_CC],
509a7e741d5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510a7e741d5SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511a7e741d5Smrg		  [_AM_DEPENDENCIES([CXX])],
512a7e741d5Smrg		  [m4_define([AC_PROG_CXX],
513a7e741d5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514a7e741d5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515a7e741d5Smrg		  [_AM_DEPENDENCIES([OBJC])],
516a7e741d5Smrg		  [m4_define([AC_PROG_OBJC],
517a7e741d5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518a7e741d5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519a7e741d5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520a7e741d5Smrg		  [m4_define([AC_PROG_OBJCXX],
521a7e741d5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522a7e741d5Smrg])
523a7e741d5Smrg# Variables for tags utilities; see am/tags.am
524a7e741d5Smrgif test -z "$CTAGS"; then
525a7e741d5Smrg  CTAGS=ctags
526a7e741d5Smrgfi
527a7e741d5SmrgAC_SUBST([CTAGS])
528a7e741d5Smrgif test -z "$ETAGS"; then
529a7e741d5Smrg  ETAGS=etags
530a7e741d5Smrgfi
531a7e741d5SmrgAC_SUBST([ETAGS])
532a7e741d5Smrgif test -z "$CSCOPE"; then
533a7e741d5Smrg  CSCOPE=cscope
534a7e741d5Smrgfi
535a7e741d5SmrgAC_SUBST([CSCOPE])
53642d69509Smrg
537a7e741d5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538a7e741d5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539a7e741d5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540a7e741d5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541a7e741d5SmrgAC_CONFIG_COMMANDS_PRE(dnl
542a7e741d5Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543a7e741d5Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5444456fccdSmrg
545a7e741d5Smrg# POSIX will say in a future version that running "rm -f" with no argument
546a7e741d5Smrg# is OK; and we want to be able to make that assumption in our Makefile
547a7e741d5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548a7e741d5Smrg# actually supported "in the wild" to an acceptable degree.
549a7e741d5Smrg# See automake bug#10828.
550a7e741d5Smrg# To make any issue more visible, cause the running configure to be aborted
551a7e741d5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552a7e741d5Smrg# user can still override this though.
553a7e741d5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554a7e741d5Smrg  cat >&2 <<'END'
555a7e741d5SmrgOops!
556521070a0Smrg
557a7e741d5SmrgYour 'rm' program seems unable to run without file operands specified
558a7e741d5Smrgon the command line, even when the '-f' option is present.  This is contrary
559a7e741d5Smrgto the behaviour of most rm programs out there, and not conforming with
560a7e741d5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5614456fccdSmrg
562a7e741d5SmrgPlease tell bug-automake@gnu.org about your system, including the value
563a7e741d5Smrgof your $PATH and any error possibly output before this message.  This
564a7e741d5Smrgcan help us improve future automake versions.
5654456fccdSmrg
566a7e741d5SmrgEND
567a7e741d5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568a7e741d5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569a7e741d5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570a7e741d5Smrg    echo >&2
571a7e741d5Smrg  else
572a7e741d5Smrg    cat >&2 <<'END'
573a7e741d5SmrgAborting the configuration process, to ensure you take notice of the issue.
5744456fccdSmrg
575a7e741d5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576a7e741d5Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5774456fccdSmrg
578a7e741d5SmrgIf you want to complete the configuration process using your problematic
579a7e741d5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580a7e741d5Smrgto "yes", and re-run configure.
5814456fccdSmrg
582a7e741d5SmrgEND
583a7e741d5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5840f1ac3bcSmrg  fi
585a7e741d5Smrgfi
586a7e741d5Smrgdnl The trailing newline in this macro's definition is deliberate, for
587a7e741d5Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588a7e741d5Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589ff63a143Smrg])
590521070a0Smrg
591a7e741d5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592a7e741d5Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593a7e741d5Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594a7e741d5Smrgm4_define([_AC_COMPILER_EXEEXT],
595a7e741d5Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596521070a0Smrg
597a7e741d5Smrg# When config.status generates a header, we must update the stamp-h file.
598a7e741d5Smrg# This file resides in the same directory as the config header
599a7e741d5Smrg# that is generated.  The stamp files are numbered to have different names.
600521070a0Smrg
601a7e741d5Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602a7e741d5Smrg# loop where config.status creates the headers, so we can generate
603a7e741d5Smrg# our stamp files there.
604a7e741d5SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605a7e741d5Smrg[# Compute $1's index in $config_headers.
606a7e741d5Smrg_am_arg=$1
607a7e741d5Smrg_am_stamp_count=1
608a7e741d5Smrgfor _am_header in $config_headers :; do
609a7e741d5Smrg  case $_am_header in
610a7e741d5Smrg    $_am_arg | $_am_arg:* )
611a7e741d5Smrg      break ;;
612a7e741d5Smrg    * )
613a7e741d5Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614a7e741d5Smrg  esac
615a7e741d5Smrgdone
616a7e741d5Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617a7e741d5Smrg
618a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619a7e741d5Smrg#
620a7e741d5Smrg# This file is free software; the Free Software Foundation
621a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
622a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
623521070a0Smrg
624a7e741d5Smrg# AM_PROG_INSTALL_SH
625a7e741d5Smrg# ------------------
626a7e741d5Smrg# Define $install_sh.
627a7e741d5SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628a7e741d5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629a7e741d5Smrgif test x"${install_sh+set}" != xset; then
630a7e741d5Smrg  case $am_aux_dir in
631a7e741d5Smrg  *\ * | *\	*)
632a7e741d5Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633a7e741d5Smrg  *)
634a7e741d5Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635a7e741d5Smrg  esac
636a7e741d5Smrgfi
637a7e741d5SmrgAC_SUBST([install_sh])])
638521070a0Smrg
639a7e741d5Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640a7e741d5Smrg#
641a7e741d5Smrg# This file is free software; the Free Software Foundation
642a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
643a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
644521070a0Smrg
645a7e741d5Smrg# Check whether the underlying file-system supports filenames
646a7e741d5Smrg# with a leading dot.  For instance MS-DOS doesn't.
647a7e741d5SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648a7e741d5Smrg[rm -rf .tst 2>/dev/null
649a7e741d5Smrgmkdir .tst 2>/dev/null
650a7e741d5Smrgif test -d .tst; then
651a7e741d5Smrg  am__leading_dot=.
6520f1ac3bcSmrgelse
653a7e741d5Smrg  am__leading_dot=_
6540f1ac3bcSmrgfi
655a7e741d5Smrgrmdir .tst 2>/dev/null
656a7e741d5SmrgAC_SUBST([am__leading_dot])])
657521070a0Smrg
658a7e741d5Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659521070a0Smrg
660a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661a7e741d5Smrg#
662a7e741d5Smrg# This file is free software; the Free Software Foundation
663a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
664a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
665521070a0Smrg
666a7e741d5Smrg# AM_MAKE_INCLUDE()
667a7e741d5Smrg# -----------------
668a7e741d5Smrg# Check whether make has an 'include' directive that can support all
669a7e741d5Smrg# the idioms we need for our automatic dependency tracking code.
670a7e741d5SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671a7e741d5Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672a7e741d5Smrgcat > confinc.mk << 'END'
673a7e741d5Smrgam__doit:
674a7e741d5Smrg	@echo this is the am__doit target >confinc.out
675a7e741d5Smrg.PHONY: am__doit
676a7e741d5SmrgEND
677a7e741d5Smrgam__include="#"
678a7e741d5Smrgam__quote=
679a7e741d5Smrg# BSD make does it like this.
680a7e741d5Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681a7e741d5Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682a7e741d5Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683a7e741d5Smrg_am_result=no
684a7e741d5Smrgfor s in GNU BSD; do
685a7e741d5Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686a7e741d5Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687a7e741d5Smrg      ['0:this is the am__doit target'],
688a7e741d5Smrg      [AS_CASE([$s],
689a7e741d5Smrg          [BSD], [am__include='.include' am__quote='"'],
690a7e741d5Smrg          [am__include='include' am__quote=''])])
691a7e741d5Smrg  if test "$am__include" != "#"; then
692a7e741d5Smrg    _am_result="yes ($s style)"
693a7e741d5Smrg    break
694a7e741d5Smrg  fi
695a7e741d5Smrgdone
696a7e741d5Smrgrm -f confinc.* confmf.*
697a7e741d5SmrgAC_MSG_RESULT([${_am_result}])
698a7e741d5SmrgAC_SUBST([am__include])])
699a7e741d5SmrgAC_SUBST([am__quote])])
700521070a0Smrg
701a7e741d5Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702521070a0Smrg
703a7e741d5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704a7e741d5Smrg#
705a7e741d5Smrg# This file is free software; the Free Software Foundation
706a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
707a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
708521070a0Smrg
709a7e741d5Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710a7e741d5Smrg# ------------------------------
711a7e741d5SmrgAC_DEFUN([AM_MISSING_PROG],
712a7e741d5Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713a7e741d5Smrg$1=${$1-"${am_missing_run}$2"}
714a7e741d5SmrgAC_SUBST($1)])
7153e6c936aSmrg
716a7e741d5Smrg# AM_MISSING_HAS_RUN
717a7e741d5Smrg# ------------------
718a7e741d5Smrg# Define MISSING if not defined so far and test if it is modern enough.
719a7e741d5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720a7e741d5SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721a7e741d5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722a7e741d5SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723a7e741d5Smrgif test x"${MISSING+set}" != xset; then
724a7e741d5Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725a7e741d5Smrgfi
726a7e741d5Smrg# Use eval to expand $SHELL
727a7e741d5Smrgif eval "$MISSING --is-lightweight"; then
728a7e741d5Smrg  am_missing_run="$MISSING "
729a7e741d5Smrgelse
730a7e741d5Smrg  am_missing_run=
731a7e741d5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732a7e741d5Smrgfi
733a7e741d5Smrg])
7343e6c936aSmrg
735a7e741d5Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736521070a0Smrg
737a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738a7e741d5Smrg#
739a7e741d5Smrg# This file is free software; the Free Software Foundation
740a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
741a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
74242d69509Smrg
743a7e741d5Smrg# _AM_MANGLE_OPTION(NAME)
744a7e741d5Smrg# -----------------------
745a7e741d5SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746a7e741d5Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7474456fccdSmrg
748a7e741d5Smrg# _AM_SET_OPTION(NAME)
749a7e741d5Smrg# --------------------
750a7e741d5Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751a7e741d5SmrgAC_DEFUN([_AM_SET_OPTION],
752a7e741d5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7534456fccdSmrg
754a7e741d5Smrg# _AM_SET_OPTIONS(OPTIONS)
755a7e741d5Smrg# ------------------------
756a7e741d5Smrg# OPTIONS is a space-separated list of Automake options.
757a7e741d5SmrgAC_DEFUN([_AM_SET_OPTIONS],
758a7e741d5Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7594456fccdSmrg
760a7e741d5Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761a7e741d5Smrg# -------------------------------------------
762a7e741d5Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763a7e741d5SmrgAC_DEFUN([_AM_IF_OPTION],
764a7e741d5Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7654456fccdSmrg
766a7e741d5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767a7e741d5Smrg#
768a7e741d5Smrg# This file is free software; the Free Software Foundation
769a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
770a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
7714456fccdSmrg
772a7e741d5Smrg# _AM_PROG_CC_C_O
773a7e741d5Smrg# ---------------
774a7e741d5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775a7e741d5Smrg# to automatically call this.
776a7e741d5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777a7e741d5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778a7e741d5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779a7e741d5SmrgAC_LANG_PUSH([C])dnl
780a7e741d5SmrgAC_CACHE_CHECK(
781a7e741d5Smrg  [whether $CC understands -c and -o together],
782a7e741d5Smrg  [am_cv_prog_cc_c_o],
783a7e741d5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784a7e741d5Smrg  # Make sure it works both with $CC and with simple cc.
785a7e741d5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786a7e741d5Smrg  # compilers refuse to overwrite an existing .o file with -o,
787a7e741d5Smrg  # though they will create one.
788a7e741d5Smrg  am_cv_prog_cc_c_o=yes
789a7e741d5Smrg  for am_i in 1 2; do
790a7e741d5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791a7e741d5Smrg         && test -f conftest2.$ac_objext; then
792a7e741d5Smrg      : OK
7930f1ac3bcSmrg    else
794a7e741d5Smrg      am_cv_prog_cc_c_o=no
795a7e741d5Smrg      break
7960f1ac3bcSmrg    fi
797a7e741d5Smrg  done
798a7e741d5Smrg  rm -f core conftest*
799a7e741d5Smrg  unset am_i])
800a7e741d5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801a7e741d5Smrg   # Losing compiler, so override with the script.
802a7e741d5Smrg   # FIXME: It is wrong to rewrite CC.
803a7e741d5Smrg   # But if we don't then we get into trouble of one sort or another.
804a7e741d5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805a7e741d5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806a7e741d5Smrg   CC="$am_aux_dir/compile $CC"
8070f1ac3bcSmrgfi
808a7e741d5SmrgAC_LANG_POP([C])])
809521070a0Smrg
810a7e741d5Smrg# For backward compatibility.
811a7e741d5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812521070a0Smrg
813a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814a7e741d5Smrg#
815a7e741d5Smrg# This file is free software; the Free Software Foundation
816a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
817a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
818521070a0Smrg
819a7e741d5Smrg# AM_RUN_LOG(COMMAND)
820a7e741d5Smrg# -------------------
821a7e741d5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822a7e741d5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823a7e741d5SmrgAC_DEFUN([AM_RUN_LOG],
824a7e741d5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825a7e741d5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826a7e741d5Smrg   ac_status=$?
827a7e741d5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828a7e741d5Smrg   (exit $ac_status); }])
829521070a0Smrg
830a7e741d5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831521070a0Smrg
832a7e741d5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833a7e741d5Smrg#
834a7e741d5Smrg# This file is free software; the Free Software Foundation
835a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
836a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
837521070a0Smrg
838a7e741d5Smrg# AM_SANITY_CHECK
839a7e741d5Smrg# ---------------
840a7e741d5SmrgAC_DEFUN([AM_SANITY_CHECK],
841a7e741d5Smrg[AC_MSG_CHECKING([whether build environment is sane])
842a7e741d5Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843a7e741d5Smrg# name.  Accept space and tab only in the latter.
844a7e741d5Smrgam_lf='
845a7e741d5Smrg'
846a7e741d5Smrgcase `pwd` in
847a7e741d5Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848a7e741d5Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849a7e741d5Smrgesac
850a7e741d5Smrgcase $srcdir in
851a7e741d5Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852a7e741d5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853a7e741d5Smrgesac
854521070a0Smrg
855a7e741d5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856a7e741d5Smrg# arguments.  Must try -L first in case configure is actually a
857a7e741d5Smrg# symlink; some systems play weird games with the mod time of symlinks
858a7e741d5Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859a7e741d5Smrg# directory).
860a7e741d5Smrgif (
861a7e741d5Smrg   am_has_slept=no
862a7e741d5Smrg   for am_try in 1 2; do
863a7e741d5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864a7e741d5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865a7e741d5Smrg     if test "$[*]" = "X"; then
866a7e741d5Smrg	# -L didn't work.
867a7e741d5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8680f1ac3bcSmrg     fi
869a7e741d5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870a7e741d5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871521070a0Smrg
872a7e741d5Smrg	# If neither matched, then we have a broken ls.  This can happen
873a7e741d5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874a7e741d5Smrg	# broken ls alias from the environment.  This has actually
875a7e741d5Smrg	# happened.  Such a system could not be considered "sane".
876a7e741d5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877a7e741d5Smrg  alias in your environment])
878a7e741d5Smrg     fi
879a7e741d5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880a7e741d5Smrg       break
881a7e741d5Smrg     fi
882a7e741d5Smrg     # Just in case.
883a7e741d5Smrg     sleep 1
884a7e741d5Smrg     am_has_slept=yes
885a7e741d5Smrg   done
886a7e741d5Smrg   test "$[2]" = conftest.file
887a7e741d5Smrg   )
888a7e741d5Smrgthen
889a7e741d5Smrg   # Ok.
890a7e741d5Smrg   :
8910f1ac3bcSmrgelse
892a7e741d5Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893a7e741d5SmrgCheck your system clock])
8940f1ac3bcSmrgfi
895a7e741d5SmrgAC_MSG_RESULT([yes])
896a7e741d5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897a7e741d5Smrg# generated files are strictly newer.
898a7e741d5Smrgam_sleep_pid=
899a7e741d5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900a7e741d5Smrg  ( sleep 1 ) &
901a7e741d5Smrg  am_sleep_pid=$!
9020f1ac3bcSmrgfi
903a7e741d5SmrgAC_CONFIG_COMMANDS_PRE(
904a7e741d5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905a7e741d5Smrg   if test -n "$am_sleep_pid"; then
906a7e741d5Smrg     # Hide warnings about reused PIDs.
907a7e741d5Smrg     wait $am_sleep_pid 2>/dev/null
908a7e741d5Smrg   fi
909a7e741d5Smrg   AC_MSG_RESULT([done])])
910a7e741d5Smrgrm -f conftest.file
911a7e741d5Smrg])
912521070a0Smrg
913a7e741d5Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914a7e741d5Smrg#
915a7e741d5Smrg# This file is free software; the Free Software Foundation
916a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
917a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
918a7e741d5Smrg
919a7e741d5Smrg# AM_SILENT_RULES([DEFAULT])
920a7e741d5Smrg# --------------------------
921a7e741d5Smrg# Enable less verbose build rules; with the default set to DEFAULT
922a7e741d5Smrg# ("yes" being less verbose, "no" or empty being verbose).
923a7e741d5SmrgAC_DEFUN([AM_SILENT_RULES],
924a7e741d5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925a7e741d5SmrgAS_HELP_STRING(
926a7e741d5Smrg  [--enable-silent-rules],
927a7e741d5Smrg  [less verbose build output (undo: "make V=1")])
928a7e741d5SmrgAS_HELP_STRING(
929a7e741d5Smrg  [--disable-silent-rules],
930a7e741d5Smrg  [verbose build output (undo: "make V=0")])dnl
931a7e741d5Smrg])
932a7e741d5Smrgcase $enable_silent_rules in @%:@ (((
933a7e741d5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934a7e741d5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935a7e741d5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936a7e741d5Smrgesac
937a7e741d5Smrgdnl
938a7e741d5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939a7e741d5Smrgdnl do not support nested variable expansions.
940a7e741d5Smrgdnl See automake bug#9928 and bug#10237.
941a7e741d5Smrgam_make=${MAKE-make}
942a7e741d5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943a7e741d5Smrg   [am_cv_make_support_nested_variables],
944a7e741d5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945a7e741d5SmrgBAR0=false
946a7e741d5SmrgBAR1=true
947a7e741d5SmrgV=1
948a7e741d5Smrgam__doit:
949a7e741d5Smrg	@$(TRUE)
950a7e741d5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951a7e741d5Smrg  am_cv_make_support_nested_variables=yes
9520f1ac3bcSmrgelse
953a7e741d5Smrg  am_cv_make_support_nested_variables=no
954a7e741d5Smrgfi])
955a7e741d5Smrgif test $am_cv_make_support_nested_variables = yes; then
956a7e741d5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957a7e741d5Smrg  AM_V='$(V)'
958a7e741d5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959a7e741d5Smrgelse
960a7e741d5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961a7e741d5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962a7e741d5Smrgfi
963a7e741d5SmrgAC_SUBST([AM_V])dnl
964a7e741d5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965a7e741d5SmrgAC_SUBST([AM_DEFAULT_V])dnl
966a7e741d5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967a7e741d5SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968a7e741d5SmrgAM_BACKSLASH='\'
969a7e741d5SmrgAC_SUBST([AM_BACKSLASH])dnl
970a7e741d5Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971a7e741d5Smrg])
972a7e741d5Smrg
973a7e741d5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974a7e741d5Smrg#
975a7e741d5Smrg# This file is free software; the Free Software Foundation
976a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
977a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
978a7e741d5Smrg
979a7e741d5Smrg# AM_PROG_INSTALL_STRIP
980a7e741d5Smrg# ---------------------
981a7e741d5Smrg# One issue with vendor 'install' (even GNU) is that you can't
982a7e741d5Smrg# specify the program used to strip binaries.  This is especially
983a7e741d5Smrg# annoying in cross-compiling environments, where the build's strip
984a7e741d5Smrg# is unlikely to handle the host's binaries.
985a7e741d5Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986a7e741d5Smrg# always use install-sh in "make install-strip", and initialize
987a7e741d5Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988a7e741d5SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989a7e741d5Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990a7e741d5Smrg# Installed binaries are usually stripped using 'strip' when the user
991a7e741d5Smrg# run "make install-strip".  However 'strip' might not be the right
992a7e741d5Smrg# tool to use in cross-compilation environments, therefore Automake
993a7e741d5Smrg# will honor the 'STRIP' environment variable to overrule this program.
994a7e741d5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995a7e741d5Smrgif test "$cross_compiling" != no; then
996a7e741d5Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9973e6c936aSmrgfi
998a7e741d5SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999a7e741d5SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10003e6c936aSmrg
1001a7e741d5Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002a7e741d5Smrg#
1003a7e741d5Smrg# This file is free software; the Free Software Foundation
1004a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
1005a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
10063e6c936aSmrg
1007a7e741d5Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008b0a0317aSmrg# ---------------------------
1009a7e741d5Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010a7e741d5Smrg# This macro is traced by Automake.
1011a7e741d5SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012b0a0317aSmrg
1013a7e741d5Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014a7e741d5Smrg# --------------------------
1015a7e741d5Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016a7e741d5SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017b0a0317aSmrg
1018a7e741d5Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019b0a0317aSmrg
1020a7e741d5Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021a7e741d5Smrg#
1022a7e741d5Smrg# This file is free software; the Free Software Foundation
1023a7e741d5Smrg# gives unlimited permission to copy and/or distribute it,
1024a7e741d5Smrg# with or without modifications, as long as this notice is preserved.
1025a7e741d5Smrg
1026a7e741d5Smrg# _AM_PROG_TAR(FORMAT)
1027a7e741d5Smrg# --------------------
1028a7e741d5Smrg# Check how to create a tarball in format FORMAT.
1029a7e741d5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030a7e741d5Smrg#
1031a7e741d5Smrg# Substitute a variable $(am__tar) that is a command
1032a7e741d5Smrg# writing to stdout a FORMAT-tarball containing the directory
1033a7e741d5Smrg# $tardir.
1034a7e741d5Smrg#     tardir=directory && $(am__tar) > result.tar
1035a7e741d5Smrg#
1036a7e741d5Smrg# Substitute a variable $(am__untar) that extract such
1037a7e741d5Smrg# a tarball read from stdin.
1038a7e741d5Smrg#     $(am__untar) < result.tar
1039a7e741d5Smrg#
1040a7e741d5SmrgAC_DEFUN([_AM_PROG_TAR],
1041a7e741d5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042a7e741d5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043a7e741d5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044a7e741d5Smrg
1045a7e741d5Smrg# We'll loop over all known methods to create a tar archive until one works.
1046a7e741d5Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047a7e741d5Smrg
1048a7e741d5Smrgm4_if([$1], [v7],
1049a7e741d5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050a7e741d5Smrg
1051a7e741d5Smrg  [m4_case([$1],
1052a7e741d5Smrg    [ustar],
1053a7e741d5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054a7e741d5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055a7e741d5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056a7e741d5Smrg      # and bug#13588).
1057a7e741d5Smrg      am_max_uid=2097151 # 2^21 - 1
1058a7e741d5Smrg      am_max_gid=$am_max_uid
1059a7e741d5Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060a7e741d5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061a7e741d5Smrg      # below are definitely unexpected, so allow the users to see them
1062a7e741d5Smrg      # (that is, avoid stderr redirection).
1063a7e741d5Smrg      am_uid=`id -u || echo unknown`
1064a7e741d5Smrg      am_gid=`id -g || echo unknown`
1065a7e741d5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066a7e741d5Smrg      if test $am_uid -le $am_max_uid; then
1067a7e741d5Smrg         AC_MSG_RESULT([yes])
10680f1ac3bcSmrg      else
1069a7e741d5Smrg         AC_MSG_RESULT([no])
1070a7e741d5Smrg         _am_tools=none
10710f1ac3bcSmrg      fi
1072a7e741d5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073a7e741d5Smrg      if test $am_gid -le $am_max_gid; then
1074a7e741d5Smrg         AC_MSG_RESULT([yes])
1075a7e741d5Smrg      else
1076a7e741d5Smrg        AC_MSG_RESULT([no])
1077a7e741d5Smrg        _am_tools=none
1078a7e741d5Smrg      fi],
1079a7e741d5Smrg
1080a7e741d5Smrg  [pax],
1081a7e741d5Smrg    [],
1082a7e741d5Smrg
1083a7e741d5Smrg  [m4_fatal([Unknown tar format])])
1084a7e741d5Smrg
1085a7e741d5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086a7e741d5Smrg
1087a7e741d5Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088a7e741d5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089a7e741d5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090a7e741d5Smrg
1091a7e741d5Smrg  for _am_tool in $_am_tools; do
1092a7e741d5Smrg    case $_am_tool in
1093a7e741d5Smrg    gnutar)
1094a7e741d5Smrg      for _am_tar in tar gnutar gtar; do
1095a7e741d5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096a7e741d5Smrg      done
1097a7e741d5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098a7e741d5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099a7e741d5Smrg      am__untar="$_am_tar -xf -"
11000f1ac3bcSmrg      ;;
1101a7e741d5Smrg    plaintar)
1102a7e741d5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103a7e741d5Smrg      # ustar tarball either.
1104a7e741d5Smrg      (tar --version) >/dev/null 2>&1 && continue
1105a7e741d5Smrg      am__tar='tar chf - "$$tardir"'
1106a7e741d5Smrg      am__tar_='tar chf - "$tardir"'
1107a7e741d5Smrg      am__untar='tar xf -'
11080f1ac3bcSmrg      ;;
1109a7e741d5Smrg    pax)
1110a7e741d5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111a7e741d5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112a7e741d5Smrg      am__untar='pax -r'
11130f1ac3bcSmrg      ;;
1114a7e741d5Smrg    cpio)
1115a7e741d5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116a7e741d5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117a7e741d5Smrg      am__untar='cpio -i -H $1 -d'
11180f1ac3bcSmrg      ;;
1119a7e741d5Smrg    none)
1120a7e741d5Smrg      am__tar=false
1121a7e741d5Smrg      am__tar_=false
1122a7e741d5Smrg      am__untar=false
11230f1ac3bcSmrg      ;;
11240f1ac3bcSmrg    esac
11254456fccdSmrg
1126a7e741d5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127a7e741d5Smrg    # and am__untar set.
1128a7e741d5Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129ff63a143Smrg
1130a7e741d5Smrg    # tar/untar a dummy directory, and stop if the command works.
1131a7e741d5Smrg    rm -rf conftest.dir
1132a7e741d5Smrg    mkdir conftest.dir
1133a7e741d5Smrg    echo GrepMe > conftest.dir/file
1134a7e741d5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135a7e741d5Smrg    rm -rf conftest.dir
1136a7e741d5Smrg    if test -s conftest.tar; then
1137a7e741d5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138a7e741d5Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139a7e741d5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11400f1ac3bcSmrg    fi
11410f1ac3bcSmrg  done
1142a7e741d5Smrg  rm -rf conftest.dir
11434456fccdSmrg
1144a7e741d5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145a7e741d5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114642d69509Smrg
1147a7e741d5SmrgAC_SUBST([am__tar])
1148a7e741d5SmrgAC_SUBST([am__untar])
1149a7e741d5Smrg]) # _AM_PROG_TAR
11504456fccdSmrg
1151a7e741d5Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152a7e741d5Smrgdnl serial 11 (pkg-config-0.29)
1153a7e741d5Smrgdnl
1154a7e741d5Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155a7e741d5Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156a7e741d5Smrgdnl
1157a7e741d5Smrgdnl This program is free software; you can redistribute it and/or modify
1158a7e741d5Smrgdnl it under the terms of the GNU General Public License as published by
1159a7e741d5Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160a7e741d5Smrgdnl (at your option) any later version.
1161a7e741d5Smrgdnl
1162a7e741d5Smrgdnl This program is distributed in the hope that it will be useful, but
1163a7e741d5Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164a7e741d5Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165a7e741d5Smrgdnl General Public License for more details.
1166a7e741d5Smrgdnl
1167a7e741d5Smrgdnl You should have received a copy of the GNU General Public License
1168a7e741d5Smrgdnl along with this program; if not, write to the Free Software
1169a7e741d5Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170a7e741d5Smrgdnl 02111-1307, USA.
1171a7e741d5Smrgdnl
1172a7e741d5Smrgdnl As a special exception to the GNU General Public License, if you
1173a7e741d5Smrgdnl distribute this file as part of a program that contains a
1174a7e741d5Smrgdnl configuration script generated by Autoconf, you may include it under
1175a7e741d5Smrgdnl the same distribution terms that you use for the rest of that
1176a7e741d5Smrgdnl program.
117742d69509Smrg
1178a7e741d5Smrgdnl PKG_PREREQ(MIN-VERSION)
1179a7e741d5Smrgdnl -----------------------
1180a7e741d5Smrgdnl Since: 0.29
1181a7e741d5Smrgdnl
1182a7e741d5Smrgdnl Verify that the version of the pkg-config macros are at least
1183a7e741d5Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184a7e741d5Smrgdnl installed version of pkg-config, this checks the developer's version
1185a7e741d5Smrgdnl of pkg.m4 when generating configure.
1186a7e741d5Smrgdnl
1187a7e741d5Smrgdnl To ensure that this macro is defined, also add:
1188a7e741d5Smrgdnl m4_ifndef([PKG_PREREQ],
1189a7e741d5Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190a7e741d5Smrgdnl
1191a7e741d5Smrgdnl See the "Since" comment for each macro you use to see what version
1192a7e741d5Smrgdnl of the macros you require.
1193a7e741d5Smrgm4_defun([PKG_PREREQ],
1194a7e741d5Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195a7e741d5Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196a7e741d5Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197a7e741d5Smrg])dnl PKG_PREREQ
11984456fccdSmrg
1199a7e741d5Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200a7e741d5Smrgdnl ----------------------------------
1201a7e741d5Smrgdnl Since: 0.16
1202a7e741d5Smrgdnl
1203a7e741d5Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204a7e741d5Smrgdnl first found in the path. Checks that the version of pkg-config found
1205a7e741d5Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206a7e741d5Smrgdnl used since that's the first version where most current features of
1207a7e741d5Smrgdnl pkg-config existed.
1208a7e741d5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209a7e741d5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210a7e741d5Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211a7e741d5Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212a7e741d5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213a7e741d5SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214a7e741d5SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12150f1ac3bcSmrg
1216a7e741d5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217a7e741d5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12180f1ac3bcSmrgfi
1219a7e741d5Smrgif test -n "$PKG_CONFIG"; then
1220a7e741d5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221a7e741d5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222a7e741d5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223a7e741d5Smrg		AC_MSG_RESULT([yes])
1224a7e741d5Smrg	else
1225a7e741d5Smrg		AC_MSG_RESULT([no])
1226a7e741d5Smrg		PKG_CONFIG=""
1227a7e741d5Smrg	fi
1228a7e741d5Smrgfi[]dnl
1229a7e741d5Smrg])dnl PKG_PROG_PKG_CONFIG
123042d69509Smrg
1231a7e741d5Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232a7e741d5Smrgdnl -------------------------------------------------------------------
1233a7e741d5Smrgdnl Since: 0.18
1234a7e741d5Smrgdnl
1235a7e741d5Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236a7e741d5Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237a7e741d5Smrgdnl
1238a7e741d5Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239a7e741d5Smrgdnl only at the first occurence in configure.ac, so if the first place
1240a7e741d5Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241a7e741d5Smrgdnl have to call PKG_CHECK_EXISTS manually
1242a7e741d5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243a7e741d5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244a7e741d5Smrgif test -n "$PKG_CONFIG" && \
1245a7e741d5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246a7e741d5Smrg  m4_default([$2], [:])
1247a7e741d5Smrgm4_ifvaln([$3], [else
1248a7e741d5Smrg  $3])dnl
12493e6c936aSmrgfi])
12504456fccdSmrg
1251a7e741d5Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252a7e741d5Smrgdnl ---------------------------------------------
1253a7e741d5Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254a7e741d5Smrgdnl pkg_failed based on the result.
1255a7e741d5Smrgm4_define([_PKG_CONFIG],
1256a7e741d5Smrg[if test -n "$$1"; then
1257a7e741d5Smrg    pkg_cv_[]$1="$$1"
1258a7e741d5Smrg elif test -n "$PKG_CONFIG"; then
1259a7e741d5Smrg    PKG_CHECK_EXISTS([$3],
1260a7e741d5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261a7e741d5Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262a7e741d5Smrg		     [pkg_failed=yes])
1263a7e741d5Smrg else
1264a7e741d5Smrg    pkg_failed=untried
1265a7e741d5Smrgfi[]dnl
1266a7e741d5Smrg])dnl _PKG_CONFIG
12674456fccdSmrg
1268a7e741d5Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269a7e741d5Smrgdnl ---------------------------
1270a7e741d5Smrgdnl Internal check to see if pkg-config supports short errors.
1271a7e741d5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272a7e741d5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273a7e741d5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274a7e741d5Smrg        _pkg_short_errors_supported=yes
1275a7e741d5Smrgelse
1276a7e741d5Smrg        _pkg_short_errors_supported=no
1277a7e741d5Smrgfi[]dnl
1278a7e741d5Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12794456fccdSmrg
12804456fccdSmrg
1281a7e741d5Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282a7e741d5Smrgdnl   [ACTION-IF-NOT-FOUND])
1283a7e741d5Smrgdnl --------------------------------------------------------------
1284a7e741d5Smrgdnl Since: 0.4.0
1285a7e741d5Smrgdnl
1286a7e741d5Smrgdnl Note that if there is a possibility the first call to
1287a7e741d5Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288a7e741d5Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289a7e741d5SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290a7e741d5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291a7e741d5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292a7e741d5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12934456fccdSmrg
1294a7e741d5Smrgpkg_failed=no
1295a7e741d5SmrgAC_MSG_CHECKING([for $1])
12964456fccdSmrg
1297a7e741d5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298a7e741d5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12993e6c936aSmrg
1300a7e741d5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301a7e741d5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302a7e741d5SmrgSee the pkg-config man page for more details.])
13034456fccdSmrg
1304a7e741d5Smrgif test $pkg_failed = yes; then
1305a7e741d5Smrg   	AC_MSG_RESULT([no])
1306a7e741d5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307a7e741d5Smrg        if test $_pkg_short_errors_supported = yes; then
1308a7e741d5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309a7e741d5Smrg        else 
1310a7e741d5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311a7e741d5Smrg        fi
1312a7e741d5Smrg	# Put the nasty error message in config.log where it belongs
1313a7e741d5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13143e6c936aSmrg
1315a7e741d5Smrg	m4_default([$4], [AC_MSG_ERROR(
1316a7e741d5Smrg[Package requirements ($2) were not met:
13173e6c936aSmrg
1318a7e741d5Smrg$$1_PKG_ERRORS
13190f1ac3bcSmrg
1320a7e741d5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321a7e741d5Smrginstalled software in a non-standard prefix.
13220f1ac3bcSmrg
1323a7e741d5Smrg_PKG_TEXT])[]dnl
1324a7e741d5Smrg        ])
1325a7e741d5Smrgelif test $pkg_failed = untried; then
1326a7e741d5Smrg     	AC_MSG_RESULT([no])
1327a7e741d5Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328a7e741d5Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329a7e741d5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330a7e741d5Smrgpath to pkg-config.
13314456fccdSmrg
1332a7e741d5Smrg_PKG_TEXT
13334456fccdSmrg
1334a7e741d5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335a7e741d5Smrg        ])
1336a7e741d5Smrgelse
1337a7e741d5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338a7e741d5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339a7e741d5Smrg        AC_MSG_RESULT([yes])
1340a7e741d5Smrg	$3
1341a7e741d5Smrgfi[]dnl
1342a7e741d5Smrg])dnl PKG_CHECK_MODULES
13433e6c936aSmrg
13443e6c936aSmrg
1345a7e741d5Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346a7e741d5Smrgdnl   [ACTION-IF-NOT-FOUND])
1347a7e741d5Smrgdnl ---------------------------------------------------------------------
1348a7e741d5Smrgdnl Since: 0.29
1349a7e741d5Smrgdnl
1350a7e741d5Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351a7e741d5Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352a7e741d5Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353a7e741d5Smrgdnl
1354a7e741d5Smrgdnl Note that if there is a possibility the first call to
1355a7e741d5Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356a7e741d5Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357a7e741d5Smrgdnl configure.ac.
1358a7e741d5SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359a7e741d5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360a7e741d5Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361a7e741d5SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362a7e741d5SmrgPKG_CHECK_MODULES($@)
1363a7e741d5SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364a7e741d5Smrg])dnl PKG_CHECK_MODULES_STATIC
13653e6c936aSmrg
13663e6c936aSmrg
1367a7e741d5Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368a7e741d5Smrgdnl -------------------------
1369a7e741d5Smrgdnl Since: 0.27
1370a7e741d5Smrgdnl
1371a7e741d5Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372a7e741d5Smrgdnl should install pkg-config .pc files. By default the directory is
1373a7e741d5Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374a7e741d5Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375a7e741d5Smrgdnl parameter.
1376a7e741d5SmrgAC_DEFUN([PKG_INSTALLDIR],
1377a7e741d5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378a7e741d5Smrgm4_pushdef([pkg_description],
1379a7e741d5Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380a7e741d5SmrgAC_ARG_WITH([pkgconfigdir],
1381a7e741d5Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382a7e741d5Smrg    [with_pkgconfigdir=]pkg_default)
1383a7e741d5SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384a7e741d5Smrgm4_popdef([pkg_default])
1385a7e741d5Smrgm4_popdef([pkg_description])
1386a7e741d5Smrg])dnl PKG_INSTALLDIR
13873e6c936aSmrg
13883e6c936aSmrg
1389a7e741d5Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390a7e741d5Smrgdnl --------------------------------
1391a7e741d5Smrgdnl Since: 0.27
1392a7e741d5Smrgdnl
1393a7e741d5Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394a7e741d5Smrgdnl module should install arch-independent pkg-config .pc files. By
1395a7e741d5Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396a7e741d5Smrgdnl changed by passing DIRECTORY. The user can override through the
1397a7e741d5Smrgdnl --with-noarch-pkgconfigdir parameter.
1398a7e741d5SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399a7e741d5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400a7e741d5Smrgm4_pushdef([pkg_description],
1401a7e741d5Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402a7e741d5SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403a7e741d5Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404a7e741d5Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405a7e741d5SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406a7e741d5Smrgm4_popdef([pkg_default])
1407a7e741d5Smrgm4_popdef([pkg_description])
1408a7e741d5Smrg])dnl PKG_NOARCH_INSTALLDIR
14093e6c936aSmrg
14103e6c936aSmrg
1411a7e741d5Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412a7e741d5Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413a7e741d5Smrgdnl -------------------------------------------
1414a7e741d5Smrgdnl Since: 0.28
1415a7e741d5Smrgdnl
1416a7e741d5Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417a7e741d5SmrgAC_DEFUN([PKG_CHECK_VAR],
1418a7e741d5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419a7e741d5SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14200f1ac3bcSmrg
1421a7e741d5Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422a7e741d5SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14230f1ac3bcSmrg
1424a7e741d5SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425a7e741d5Smrg])dnl PKG_CHECK_VAR
14264456fccdSmrg
14273e6c936aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14283e6c936aSmrgdnl
1429a7e741d5Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14300f1ac3bcSmrgdnl
14313e6c936aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14323e6c936aSmrgdnl copy of this software and associated documentation files (the "Software"),
14333e6c936aSmrgdnl to deal in the Software without restriction, including without limitation
14343e6c936aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14353e6c936aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14363e6c936aSmrgdnl Software is furnished to do so, subject to the following conditions:
14373e6c936aSmrgdnl
14383e6c936aSmrgdnl The above copyright notice and this permission notice (including the next
14393e6c936aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14403e6c936aSmrgdnl Software.
14413e6c936aSmrgdnl
14423e6c936aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14433e6c936aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14443e6c936aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14453e6c936aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14463e6c936aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14473e6c936aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14483e6c936aSmrgdnl DEALINGS IN THE SOFTWARE.
14494456fccdSmrg
14503e6c936aSmrg# XORG_MACROS_VERSION(required-version)
14513e6c936aSmrg# -------------------------------------
1452ff63a143Smrg# Minimum version: 1.1.0
1453ff63a143Smrg#
14543e6c936aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14553e6c936aSmrg# your configure.ac with the minimum required version, such as:
14563e6c936aSmrg# XORG_MACROS_VERSION(1.1)
1457ff63a143Smrg#
14583e6c936aSmrg# To ensure that this macro is defined, also add:
14593e6c936aSmrg# m4_ifndef([XORG_MACROS_VERSION],
14603e6c936aSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461ff63a143Smrg#
1462ff63a143Smrg#
14630f1ac3bcSmrg# See the "minimum version" comment for each macro you use to see what
14643e6c936aSmrg# version you require.
14653e6c936aSmrgm4_defun([XORG_MACROS_VERSION],[
1466a7e741d5Smrgm4_define([vers_have], [1.20.0])
14673e6c936aSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14683e6c936aSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14693e6c936aSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14703e6c936aSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14713e6c936aSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14723e6c936aSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14733e6c936aSmrgm4_undefine([vers_have])
14743e6c936aSmrgm4_undefine([maj_have])
14753e6c936aSmrgm4_undefine([maj_needed])
14763e6c936aSmrg]) # XORG_MACROS_VERSION
14774456fccdSmrg
14783e6c936aSmrg# XORG_PROG_RAWCPP()
14793e6c936aSmrg# ------------------
14803e6c936aSmrg# Minimum version: 1.0.0
14813e6c936aSmrg#
14823e6c936aSmrg# Find cpp program and necessary flags for use in pre-processing text files
14833e6c936aSmrg# such as man pages and config files
14843e6c936aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14853e6c936aSmrgAC_REQUIRE([AC_PROG_CPP])
1486b0a0317aSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14873e6c936aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14884456fccdSmrg
14893e6c936aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14903e6c936aSmrg# which is not the best choice for supporting other OS'es, but covers most
14913e6c936aSmrg# of the ones we need for now.
14923e6c936aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14933e6c936aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14943e6c936aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14953e6c936aSmrg	AC_MSG_RESULT([no])
1496ff63a143Smrgelse
14973e6c936aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14983e6c936aSmrg		RAWCPPFLAGS=-undef
14993e6c936aSmrg		AC_MSG_RESULT([yes])
15003e6c936aSmrg	# under Cygwin unix is still defined even with -undef
15013e6c936aSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15023e6c936aSmrg		RAWCPPFLAGS="-undef -ansi"
15033e6c936aSmrg		AC_MSG_RESULT([yes, with -ansi])
15043e6c936aSmrg	else
15053e6c936aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15063e6c936aSmrg	fi
1507ff63a143Smrgfi
15083e6c936aSmrgrm -f conftest.$ac_ext
15094456fccdSmrg
15103e6c936aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15113e6c936aSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15123e6c936aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15133e6c936aSmrg	AC_MSG_RESULT([no])
15143e6c936aSmrgelse
15153e6c936aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15160f1ac3bcSmrg		TRADITIONALCPPFLAGS="-traditional"
15173e6c936aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15183e6c936aSmrg		AC_MSG_RESULT([yes])
15193e6c936aSmrg	else
15203e6c936aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15213e6c936aSmrg	fi
1522ff63a143Smrgfi
15233e6c936aSmrgrm -f conftest.$ac_ext
15243e6c936aSmrgAC_SUBST(RAWCPPFLAGS)
15250f1ac3bcSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15263e6c936aSmrg]) # XORG_PROG_RAWCPP
15274456fccdSmrg
15283e6c936aSmrg# XORG_MANPAGE_SECTIONS()
15293e6c936aSmrg# -----------------------
15303e6c936aSmrg# Minimum version: 1.0.0
1531ff63a143Smrg#
15323e6c936aSmrg# Determine which sections man pages go in for the different man page types
15333e6c936aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15343e6c936aSmrg# Not sure if there's any better way than just hardcoding by OS name.
15353e6c936aSmrg# Override default settings by setting environment variables
15363e6c936aSmrg# Added MAN_SUBSTS in version 1.8
15373e6c936aSmrg# Added AC_PROG_SED in version 1.8
15384456fccdSmrg
15393e6c936aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15403e6c936aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15413e6c936aSmrgAC_REQUIRE([AC_PROG_SED])
15424456fccdSmrg
1543b0a0317aSmrgcase $host_os in
1544b0a0317aSmrg    solaris*)
1545b0a0317aSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546b0a0317aSmrg        # check for a man page file found in later versions that use
1547b0a0317aSmrg        # traditional section numbers instead
1548b0a0317aSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549b0a0317aSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550b0a0317aSmrg        ;;
1551b0a0317aSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552b0a0317aSmrgesac
1553b0a0317aSmrg
15543e6c936aSmrgif test x$APP_MAN_SUFFIX = x    ; then
15553e6c936aSmrg    APP_MAN_SUFFIX=1
15563e6c936aSmrgfi
15573e6c936aSmrgif test x$APP_MAN_DIR = x    ; then
15583e6c936aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559ff63a143Smrgfi
156042d69509Smrg
15613e6c936aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15623e6c936aSmrg    LIB_MAN_SUFFIX=3
15633e6c936aSmrgfi
15643e6c936aSmrgif test x$LIB_MAN_DIR = x    ; then
15653e6c936aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15663e6c936aSmrgfi
15674456fccdSmrg
15683e6c936aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1569b0a0317aSmrg    case $SYSV_MAN_SECTIONS in
1570b0a0317aSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15710f1ac3bcSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15723e6c936aSmrg    esac
15733e6c936aSmrgfi
15743e6c936aSmrgif test x$FILE_MAN_DIR = x    ; then
15753e6c936aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15763e6c936aSmrgfi
157742d69509Smrg
15783e6c936aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1579b0a0317aSmrg    case $SYSV_MAN_SECTIONS in
1580b0a0317aSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15810f1ac3bcSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1582ff63a143Smrg    esac
1583ff63a143Smrgfi
15843e6c936aSmrgif test x$MISC_MAN_DIR = x    ; then
15853e6c936aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15863e6c936aSmrgfi
15874456fccdSmrg
15883e6c936aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589b0a0317aSmrg    case $SYSV_MAN_SECTIONS in
1590b0a0317aSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15910f1ac3bcSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15923e6c936aSmrg    esac
15933e6c936aSmrgfi
15943e6c936aSmrgif test x$DRIVER_MAN_DIR = x    ; then
15953e6c936aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15963e6c936aSmrgfi
15974456fccdSmrg
15983e6c936aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599b0a0317aSmrg    case $SYSV_MAN_SECTIONS in
1600b0a0317aSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16010f1ac3bcSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16023e6c936aSmrg    esac
16033e6c936aSmrgfi
16043e6c936aSmrgif test x$ADMIN_MAN_DIR = x    ; then
16053e6c936aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606ff63a143Smrgfi
16074456fccdSmrg
16084456fccdSmrg
16093e6c936aSmrgAC_SUBST([APP_MAN_SUFFIX])
16103e6c936aSmrgAC_SUBST([LIB_MAN_SUFFIX])
16113e6c936aSmrgAC_SUBST([FILE_MAN_SUFFIX])
16123e6c936aSmrgAC_SUBST([MISC_MAN_SUFFIX])
16133e6c936aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16143e6c936aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16153e6c936aSmrgAC_SUBST([APP_MAN_DIR])
16163e6c936aSmrgAC_SUBST([LIB_MAN_DIR])
16173e6c936aSmrgAC_SUBST([FILE_MAN_DIR])
16183e6c936aSmrgAC_SUBST([MISC_MAN_DIR])
16193e6c936aSmrgAC_SUBST([DRIVER_MAN_DIR])
16203e6c936aSmrgAC_SUBST([ADMIN_MAN_DIR])
16213e6c936aSmrg
16223e6c936aSmrgXORG_MAN_PAGE="X Version 11"
16233e6c936aSmrgAC_SUBST([XORG_MAN_PAGE])
16243e6c936aSmrgMAN_SUBSTS="\
16253e6c936aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16263e6c936aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16273e6c936aSmrg	-e 's|__xservername__|Xorg|g' \
16283e6c936aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16293e6c936aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16303e6c936aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16313e6c936aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16323e6c936aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16333e6c936aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16343e6c936aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16353e6c936aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16363e6c936aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16373e6c936aSmrgAC_SUBST([MAN_SUBSTS])
16383e6c936aSmrg
16393e6c936aSmrg]) # XORG_MANPAGE_SECTIONS
16403e6c936aSmrg
16413e6c936aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16423e6c936aSmrg# ------------------------
16433e6c936aSmrg# Minimum version: 1.7.0
1644ff63a143Smrg#
16453e6c936aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16463e6c936aSmrg# provided by xorg-sgml-doctools, if installed.
16473e6c936aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16483e6c936aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16493e6c936aSmrgXORG_SGML_PATH=
16503e6c936aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16513e6c936aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16523e6c936aSmrg    [m4_ifval([$1],[:],
16533e6c936aSmrg        [if test x"$cross_compiling" != x"yes" ; then
16543e6c936aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16553e6c936aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16563e6c936aSmrg         fi])
16573e6c936aSmrg    ])
16584456fccdSmrg
16593e6c936aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16603e6c936aSmrg# the path and the name of the doc stylesheet
16613e6c936aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16623e6c936aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16633e6c936aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16643e6c936aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16653e6c936aSmrgelse
16663e6c936aSmrg   AC_MSG_RESULT([no])
16673e6c936aSmrgfi
16683e6c936aSmrg
16693e6c936aSmrgAC_SUBST(XORG_SGML_PATH)
16703e6c936aSmrgAC_SUBST(STYLESHEET_SRCDIR)
16713e6c936aSmrgAC_SUBST(XSL_STYLESHEET)
16723e6c936aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16733e6c936aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16744456fccdSmrg
16753e6c936aSmrg# XORG_CHECK_LINUXDOC
16763e6c936aSmrg# -------------------
16773e6c936aSmrg# Minimum version: 1.0.0
1678ff63a143Smrg#
16793e6c936aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16803e6c936aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16813e6c936aSmrg# Whether or not the necessary tools and files are found can be checked
16823e6c936aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16833e6c936aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16843e6c936aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16853e6c936aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686521070a0Smrg
16873e6c936aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688521070a0Smrg
16893e6c936aSmrgAC_MSG_CHECKING([whether to build documentation])
1690521070a0Smrg
16913e6c936aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16923e6c936aSmrg   BUILDDOC=yes
16933e6c936aSmrgelse
16943e6c936aSmrg   BUILDDOC=no
16953e6c936aSmrgfi
1696521070a0Smrg
16973e6c936aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698521070a0Smrg
16993e6c936aSmrgAC_MSG_RESULT([$BUILDDOC])
17003e6c936aSmrg
17013e6c936aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17023e6c936aSmrg
17033e6c936aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17043e6c936aSmrg   BUILDPDFDOC=yes
17053e6c936aSmrgelse
17063e6c936aSmrg   BUILDPDFDOC=no
17073e6c936aSmrgfi
17083e6c936aSmrg
17093e6c936aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17103e6c936aSmrg
17113e6c936aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17123e6c936aSmrg
17133e6c936aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17143e6c936aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17153e6c936aSmrgMAKE_PDF="$PS2PDF"
17163e6c936aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17173e6c936aSmrg
17183e6c936aSmrgAC_SUBST(MAKE_TEXT)
17193e6c936aSmrgAC_SUBST(MAKE_PS)
17203e6c936aSmrgAC_SUBST(MAKE_PDF)
17213e6c936aSmrgAC_SUBST(MAKE_HTML)
17223e6c936aSmrg]) # XORG_CHECK_LINUXDOC
1723521070a0Smrg
17243e6c936aSmrg# XORG_CHECK_DOCBOOK
17253e6c936aSmrg# -------------------
17263e6c936aSmrg# Minimum version: 1.0.0
1727ff63a143Smrg#
17283e6c936aSmrg# Checks for the ability to build output formats from SGML DocBook source.
17293e6c936aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17303e6c936aSmrg# indicates whether the necessary tools and files are found and, if set,
17313e6c936aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17323e6c936aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17333e6c936aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734521070a0Smrg
17353e6c936aSmrgBUILDTXTDOC=no
17363e6c936aSmrgBUILDPDFDOC=no
17373e6c936aSmrgBUILDPSDOC=no
17383e6c936aSmrgBUILDHTMLDOC=no
17393e6c936aSmrg
17403e6c936aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17413e6c936aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17423e6c936aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17433e6c936aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17443e6c936aSmrg
17453e6c936aSmrgAC_MSG_CHECKING([whether to build text documentation])
17463e6c936aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17473e6c936aSmrg   test x$BUILD_TXTDOC != xno; then
17483e6c936aSmrg	BUILDTXTDOC=yes
17493e6c936aSmrgfi
17503e6c936aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17513e6c936aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17523e6c936aSmrg
17533e6c936aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17543e6c936aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17553e6c936aSmrg   test x$BUILD_PDFDOC != xno; then
17563e6c936aSmrg	BUILDPDFDOC=yes
17573e6c936aSmrgfi
17583e6c936aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17593e6c936aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17603e6c936aSmrg
17613e6c936aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17623e6c936aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17633e6c936aSmrg   test x$BUILD_PSDOC != xno; then
17643e6c936aSmrg	BUILDPSDOC=yes
17653e6c936aSmrgfi
17663e6c936aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17673e6c936aSmrgAC_MSG_RESULT([$BUILDPSDOC])
17683e6c936aSmrg
17693e6c936aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17703e6c936aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17713e6c936aSmrg   test x$BUILD_HTMLDOC != xno; then
17723e6c936aSmrg	BUILDHTMLDOC=yes
17733e6c936aSmrgfi
17743e6c936aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17753e6c936aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17763e6c936aSmrg
17773e6c936aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17783e6c936aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17793e6c936aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17803e6c936aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17813e6c936aSmrg
17823e6c936aSmrgAC_SUBST(MAKE_TEXT)
17833e6c936aSmrgAC_SUBST(MAKE_PS)
17843e6c936aSmrgAC_SUBST(MAKE_PDF)
17853e6c936aSmrgAC_SUBST(MAKE_HTML)
17863e6c936aSmrg]) # XORG_CHECK_DOCBOOK
17873e6c936aSmrg
17883e6c936aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17893e6c936aSmrg# ----------------
17903e6c936aSmrg# Minimum version: 1.5.0
17913e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1792ff63a143Smrg#
17933e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
17943e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
17953e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796a7e741d5Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17973e6c936aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17983e6c936aSmrg# --with-xmlto assumes 'auto'.
1799ff63a143Smrg#
18003e6c936aSmrg# Interface to module:
18013e6c936aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18023e6c936aSmrg# XMLTO:	returns the path of the xmlto program found
18033e6c936aSmrg#		returns the path set by the user in the environment
18043e6c936aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18053e6c936aSmrg#		'no' user instructs the module not to use xmlto
1806ff63a143Smrg#
18073e6c936aSmrg# Added in version 1.10.0
18083e6c936aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18093e6c936aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810ff63a143Smrg#
18113e6c936aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812ff63a143Smrg#
18133e6c936aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18143e6c936aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18153e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18163e6c936aSmrgAC_ARG_WITH(xmlto,
18173e6c936aSmrg	AS_HELP_STRING([--with-xmlto],
18183e6c936aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18193e6c936aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18203e6c936aSmrgm4_undefine([_defopt])
1821521070a0Smrg
18223e6c936aSmrgif test "x$use_xmlto" = x"auto"; then
18233e6c936aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18243e6c936aSmrg   if test "x$XMLTO" = "x"; then
18253e6c936aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18263e6c936aSmrg	have_xmlto=no
18273e6c936aSmrg   else
18283e6c936aSmrg        have_xmlto=yes
18293e6c936aSmrg   fi
18303e6c936aSmrgelif test "x$use_xmlto" = x"yes" ; then
18313e6c936aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18323e6c936aSmrg   if test "x$XMLTO" = "x"; then
18333e6c936aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18343e6c936aSmrg   fi
18353e6c936aSmrg   have_xmlto=yes
18363e6c936aSmrgelif test "x$use_xmlto" = x"no" ; then
18373e6c936aSmrg   if test "x$XMLTO" != "x"; then
18383e6c936aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18393e6c936aSmrg   fi
18403e6c936aSmrg   have_xmlto=no
18413e6c936aSmrgelse
18423e6c936aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18433e6c936aSmrgfi
18444456fccdSmrg
18453e6c936aSmrg# Test for a minimum version of xmlto, if provided.
18463e6c936aSmrgm4_ifval([$1],
18473e6c936aSmrg[if test "$have_xmlto" = yes; then
18483e6c936aSmrg    # scrape the xmlto version
18493e6c936aSmrg    AC_MSG_CHECKING([the xmlto version])
18503e6c936aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18513e6c936aSmrg    AC_MSG_RESULT([$xmlto_version])
18523e6c936aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18533e6c936aSmrg        [if test "x$use_xmlto" = xauto; then
18543e6c936aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18553e6c936aSmrg            have_xmlto=no
18563e6c936aSmrg        else
18573e6c936aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18583e6c936aSmrg        fi])
18593e6c936aSmrgfi])
18603e6c936aSmrg
18613e6c936aSmrg# Test for the ability of xmlto to generate a text target
18620f1ac3bcSmrg#
18630f1ac3bcSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18640f1ac3bcSmrg# following test for empty XML docbook files.
18650f1ac3bcSmrg# For compatibility reasons use the following empty XML docbook file and if
18660f1ac3bcSmrg# it fails try it again with a non-empty XML file.
18673e6c936aSmrghave_xmlto_text=no
18683e6c936aSmrgcat > conftest.xml << "EOF"
18693e6c936aSmrgEOF
18703e6c936aSmrgAS_IF([test "$have_xmlto" = yes],
18713e6c936aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18723e6c936aSmrg             [have_xmlto_text=yes],
18730f1ac3bcSmrg             [# Try it again with a non-empty XML file.
18740f1ac3bcSmrg              cat > conftest.xml << "EOF"
18750f1ac3bcSmrg<x></x>
18760f1ac3bcSmrgEOF
18770f1ac3bcSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18780f1ac3bcSmrg                    [have_xmlto_text=yes],
18790f1ac3bcSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18803e6c936aSmrgrm -f conftest.xml
18813e6c936aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18823e6c936aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18833e6c936aSmrg]) # XORG_WITH_XMLTO
18844456fccdSmrg
18853e6c936aSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18863e6c936aSmrg# --------------------------------------------
18873e6c936aSmrg# Minimum version: 1.12.0
18883e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1889ff63a143Smrg#
18903e6c936aSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18913e6c936aSmrg# XML-based language used for the transformation of XML documents.
18923e6c936aSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18933e6c936aSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18943e6c936aSmrg# The XSLT processor is often used as a standalone tool for transformations.
18953e6c936aSmrg# It should not be assumed that this tool is used only to work with documnetation.
18963e6c936aSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18973e6c936aSmrg#
18983e6c936aSmrg# Interface to module:
18993e6c936aSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19003e6c936aSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19013e6c936aSmrg#		 returns the path set by the user in the environment
19023e6c936aSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19033e6c936aSmrg#		  'no' user instructs the module not to use xsltproc
19043e6c936aSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19053e6c936aSmrg#
19063e6c936aSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19073e6c936aSmrg#
19083e6c936aSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19093e6c936aSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19103e6c936aSmrg# Preserves the interface, should it be implemented later
19113e6c936aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19123e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19133e6c936aSmrgAC_ARG_WITH(xsltproc,
19143e6c936aSmrg	AS_HELP_STRING([--with-xsltproc],
19153e6c936aSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19163e6c936aSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19173e6c936aSmrgm4_undefine([_defopt])
19183e6c936aSmrg
19193e6c936aSmrgif test "x$use_xsltproc" = x"auto"; then
19203e6c936aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19213e6c936aSmrg   if test "x$XSLTPROC" = "x"; then
19223e6c936aSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19233e6c936aSmrg	have_xsltproc=no
19243e6c936aSmrg   else
19253e6c936aSmrg        have_xsltproc=yes
19263e6c936aSmrg   fi
19273e6c936aSmrgelif test "x$use_xsltproc" = x"yes" ; then
19283e6c936aSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19293e6c936aSmrg   if test "x$XSLTPROC" = "x"; then
19303e6c936aSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19313e6c936aSmrg   fi
19323e6c936aSmrg   have_xsltproc=yes
19333e6c936aSmrgelif test "x$use_xsltproc" = x"no" ; then
19343e6c936aSmrg   if test "x$XSLTPROC" != "x"; then
19353e6c936aSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19363e6c936aSmrg   fi
19373e6c936aSmrg   have_xsltproc=no
1938ff63a143Smrgelse
19393e6c936aSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940ff63a143Smrgfi
19414456fccdSmrg
19423e6c936aSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19433e6c936aSmrg]) # XORG_WITH_XSLTPROC
19444456fccdSmrg
19453e6c936aSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19463e6c936aSmrg# ----------------------------------------
19473e6c936aSmrg# Minimum version: 1.15.0
1948ff63a143Smrg#
19493e6c936aSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19503e6c936aSmrg# scanning arbitrary text files, extracting information from those text files,
19513e6c936aSmrg# and printing reports based on that information.
19523e6c936aSmrg#
19533e6c936aSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19543e6c936aSmrg#
19553e6c936aSmrg# Interface to module:
19563e6c936aSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19573e6c936aSmrg# PERL:	     returns the path of the perl program found
19583e6c936aSmrg#	     returns the path set by the user in the environment
19593e6c936aSmrg# --with-perl: 'yes' user instructs the module to use perl
19603e6c936aSmrg#	       'no' user instructs the module not to use perl
19613e6c936aSmrg# have_perl: returns yes if perl found in PATH or no
19623e6c936aSmrg#
19633e6c936aSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19643e6c936aSmrg#
19653e6c936aSmrgAC_DEFUN([XORG_WITH_PERL],[
19663e6c936aSmrgAC_ARG_VAR([PERL], [Path to perl command])
19673e6c936aSmrg# Preserves the interface, should it be implemented later
19683e6c936aSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19693e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19703e6c936aSmrgAC_ARG_WITH(perl,
19713e6c936aSmrg	AS_HELP_STRING([--with-perl],
19723e6c936aSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19733e6c936aSmrg	   [use_perl=$withval], [use_perl=]_defopt)
19743e6c936aSmrgm4_undefine([_defopt])
19753e6c936aSmrg
19763e6c936aSmrgif test "x$use_perl" = x"auto"; then
19773e6c936aSmrg   AC_PATH_PROG([PERL], [perl])
19783e6c936aSmrg   if test "x$PERL" = "x"; then
19793e6c936aSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19803e6c936aSmrg	have_perl=no
19813e6c936aSmrg   else
19823e6c936aSmrg        have_perl=yes
19833e6c936aSmrg   fi
19843e6c936aSmrgelif test "x$use_perl" = x"yes" ; then
19853e6c936aSmrg   AC_PATH_PROG([PERL], [perl])
19863e6c936aSmrg   if test "x$PERL" = "x"; then
19873e6c936aSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19883e6c936aSmrg   fi
19893e6c936aSmrg   have_perl=yes
19903e6c936aSmrgelif test "x$use_perl" = x"no" ; then
19913e6c936aSmrg   if test "x$PERL" != "x"; then
19923e6c936aSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19933e6c936aSmrg   fi
19943e6c936aSmrg   have_perl=no
19953e6c936aSmrgelse
19963e6c936aSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19973e6c936aSmrgfi
19984456fccdSmrg
19993e6c936aSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20003e6c936aSmrg]) # XORG_WITH_PERL
20014456fccdSmrg
20023e6c936aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20033e6c936aSmrg# ----------------
20043e6c936aSmrg# Minimum version: 1.5.0
20053e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20063e6c936aSmrg#
20073e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
20083e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
20093e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010a7e741d5Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20113e6c936aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20123e6c936aSmrg# --with-asciidoc assumes 'auto'.
20133e6c936aSmrg#
20143e6c936aSmrg# Interface to module:
20153e6c936aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20163e6c936aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20173e6c936aSmrg#		 returns the path set by the user in the environment
20183e6c936aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20193e6c936aSmrg#		  'no' user instructs the module not to use asciidoc
20203e6c936aSmrg#
20213e6c936aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20223e6c936aSmrg#
20233e6c936aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20243e6c936aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20253e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
20263e6c936aSmrgAC_ARG_WITH(asciidoc,
20273e6c936aSmrg	AS_HELP_STRING([--with-asciidoc],
20283e6c936aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20293e6c936aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20303e6c936aSmrgm4_undefine([_defopt])
20314456fccdSmrg
20323e6c936aSmrgif test "x$use_asciidoc" = x"auto"; then
20333e6c936aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20343e6c936aSmrg   if test "x$ASCIIDOC" = "x"; then
20353e6c936aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20363e6c936aSmrg	have_asciidoc=no
20373e6c936aSmrg   else
20383e6c936aSmrg        have_asciidoc=yes
20393e6c936aSmrg   fi
20403e6c936aSmrgelif test "x$use_asciidoc" = x"yes" ; then
20413e6c936aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20423e6c936aSmrg   if test "x$ASCIIDOC" = "x"; then
20433e6c936aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20443e6c936aSmrg   fi
20453e6c936aSmrg   have_asciidoc=yes
20463e6c936aSmrgelif test "x$use_asciidoc" = x"no" ; then
20473e6c936aSmrg   if test "x$ASCIIDOC" != "x"; then
20483e6c936aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20493e6c936aSmrg   fi
20503e6c936aSmrg   have_asciidoc=no
20513e6c936aSmrgelse
20523e6c936aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20533e6c936aSmrgfi
20543e6c936aSmrgm4_ifval([$1],
20553e6c936aSmrg[if test "$have_asciidoc" = yes; then
20563e6c936aSmrg    # scrape the asciidoc version
20573e6c936aSmrg    AC_MSG_CHECKING([the asciidoc version])
20583e6c936aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20593e6c936aSmrg    AC_MSG_RESULT([$asciidoc_version])
20603e6c936aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20613e6c936aSmrg        [if test "x$use_asciidoc" = xauto; then
20623e6c936aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20633e6c936aSmrg            have_asciidoc=no
20643e6c936aSmrg        else
20653e6c936aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20663e6c936aSmrg        fi])
20673e6c936aSmrgfi])
20683e6c936aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20693e6c936aSmrg]) # XORG_WITH_ASCIIDOC
20704456fccdSmrg
20713e6c936aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20720f1ac3bcSmrg# -------------------------------------------
20733e6c936aSmrg# Minimum version: 1.5.0
20743e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20750f1ac3bcSmrg# Minimum version for optional DOT checking: 1.18.0
20763e6c936aSmrg#
20773e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
20783e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
20793e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080a7e741d5Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20813e6c936aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20823e6c936aSmrg# --with-doxygen assumes 'auto'.
20833e6c936aSmrg#
20843e6c936aSmrg# Interface to module:
20853e6c936aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20863e6c936aSmrg# DOXYGEN:	 returns the path of the doxygen program found
20873e6c936aSmrg#		 returns the path set by the user in the environment
20883e6c936aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20893e6c936aSmrg#		  'no' user instructs the module not to use doxygen
20903e6c936aSmrg#
20913e6c936aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20923e6c936aSmrg#
20933e6c936aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20943e6c936aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20950f1ac3bcSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20963e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
20973e6c936aSmrgAC_ARG_WITH(doxygen,
20983e6c936aSmrg	AS_HELP_STRING([--with-doxygen],
20993e6c936aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21003e6c936aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21013e6c936aSmrgm4_undefine([_defopt])
21024456fccdSmrg
21033e6c936aSmrgif test "x$use_doxygen" = x"auto"; then
21043e6c936aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21053e6c936aSmrg   if test "x$DOXYGEN" = "x"; then
21063e6c936aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21073e6c936aSmrg	have_doxygen=no
21083e6c936aSmrg   else
21093e6c936aSmrg        have_doxygen=yes
21103e6c936aSmrg   fi
21113e6c936aSmrgelif test "x$use_doxygen" = x"yes" ; then
21123e6c936aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21133e6c936aSmrg   if test "x$DOXYGEN" = "x"; then
21143e6c936aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21153e6c936aSmrg   fi
21163e6c936aSmrg   have_doxygen=yes
21173e6c936aSmrgelif test "x$use_doxygen" = x"no" ; then
21183e6c936aSmrg   if test "x$DOXYGEN" != "x"; then
21193e6c936aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21203e6c936aSmrg   fi
21213e6c936aSmrg   have_doxygen=no
2122ff63a143Smrgelse
21233e6c936aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124ff63a143Smrgfi
21253e6c936aSmrgm4_ifval([$1],
21263e6c936aSmrg[if test "$have_doxygen" = yes; then
21273e6c936aSmrg    # scrape the doxygen version
21283e6c936aSmrg    AC_MSG_CHECKING([the doxygen version])
21293e6c936aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21303e6c936aSmrg    AC_MSG_RESULT([$doxygen_version])
21313e6c936aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21323e6c936aSmrg        [if test "x$use_doxygen" = xauto; then
21333e6c936aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21343e6c936aSmrg            have_doxygen=no
21353e6c936aSmrg        else
21363e6c936aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21373e6c936aSmrg        fi])
21383e6c936aSmrgfi])
21390f1ac3bcSmrg
21400f1ac3bcSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21410f1ac3bcSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21420f1ac3bcSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21430f1ac3bcSmrgHAVE_DOT=no
21440f1ac3bcSmrgif test "x$have_doxygen" = "xyes"; then
21450f1ac3bcSmrg  AC_PATH_PROG([DOT], [dot])
21460f1ac3bcSmrg    if test "x$DOT" != "x"; then
21470f1ac3bcSmrg      HAVE_DOT=yes
21480f1ac3bcSmrg    fi
21490f1ac3bcSmrgfi
21500f1ac3bcSmrg
21510f1ac3bcSmrgAC_SUBST([HAVE_DOT])
21520f1ac3bcSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21533e6c936aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21543e6c936aSmrg]) # XORG_WITH_DOXYGEN
21554456fccdSmrg
21563e6c936aSmrg# XORG_WITH_GROFF([DEFAULT])
21573e6c936aSmrg# ----------------
21583e6c936aSmrg# Minimum version: 1.6.0
21593e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21603e6c936aSmrg#
21613e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
21623e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
21633e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164a7e741d5Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21653e6c936aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21663e6c936aSmrg# --with-groff assumes 'auto'.
21673e6c936aSmrg#
21683e6c936aSmrg# Interface to module:
21693e6c936aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21703e6c936aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21713e6c936aSmrg# HAVE_GROFF_MS: the -ms macros package
21723e6c936aSmrg# GROFF:	 returns the path of the groff program found
21733e6c936aSmrg#		 returns the path set by the user in the environment
21743e6c936aSmrg# --with-groff:	 'yes' user instructs the module to use groff
21753e6c936aSmrg#		 'no' user instructs the module not to use groff
21763e6c936aSmrg#
21773e6c936aSmrg# Added in version 1.9.0:
21783e6c936aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21793e6c936aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21803e6c936aSmrg#		   psselect from the psutils package.
21813e6c936aSmrg#		   the ghostcript package. Refer to the grohtml man pages
21823e6c936aSmrg#
21833e6c936aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21843e6c936aSmrg#
21853e6c936aSmrg# OS and distros often splits groff in a basic and full package, the former
21863e6c936aSmrg# having the groff program and the later having devices, fonts and macros
21873e6c936aSmrg# Checking for the groff executable is not enough.
21883e6c936aSmrg#
21893e6c936aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21903e6c936aSmrg# unset HAVE_GROFF or GROFF env variables.
21913e6c936aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21923e6c936aSmrg#
21933e6c936aSmrgAC_DEFUN([XORG_WITH_GROFF],[
21943e6c936aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21953e6c936aSmrgm4_define([_defopt], m4_default([$1], [auto]))
21963e6c936aSmrgAC_ARG_WITH(groff,
21973e6c936aSmrg	AS_HELP_STRING([--with-groff],
21983e6c936aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21993e6c936aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22003e6c936aSmrgm4_undefine([_defopt])
22014456fccdSmrg
22023e6c936aSmrgif test "x$use_groff" = x"auto"; then
22033e6c936aSmrg   AC_PATH_PROG([GROFF], [groff])
22043e6c936aSmrg   if test "x$GROFF" = "x"; then
22053e6c936aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22063e6c936aSmrg	have_groff=no
22073e6c936aSmrg   else
22083e6c936aSmrg        have_groff=yes
22093e6c936aSmrg   fi
22103e6c936aSmrgelif test "x$use_groff" = x"yes" ; then
22113e6c936aSmrg   AC_PATH_PROG([GROFF], [groff])
22123e6c936aSmrg   if test "x$GROFF" = "x"; then
22133e6c936aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22143e6c936aSmrg   fi
22153e6c936aSmrg   have_groff=yes
22163e6c936aSmrgelif test "x$use_groff" = x"no" ; then
22173e6c936aSmrg   if test "x$GROFF" != "x"; then
22183e6c936aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22193e6c936aSmrg   fi
22203e6c936aSmrg   have_groff=no
22213e6c936aSmrgelse
22223e6c936aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22233e6c936aSmrgfi
22244456fccdSmrg
22253e6c936aSmrg# We have groff, test for the presence of the macro packages
22263e6c936aSmrgif test "x$have_groff" = x"yes"; then
22273e6c936aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22283e6c936aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22293e6c936aSmrg        groff_ms_works=yes
22303e6c936aSmrg    else
22313e6c936aSmrg        groff_ms_works=no
22323e6c936aSmrg    fi
22333e6c936aSmrg    AC_MSG_RESULT([$groff_ms_works])
22343e6c936aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22353e6c936aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22363e6c936aSmrg        groff_mm_works=yes
22373e6c936aSmrg    else
22383e6c936aSmrg        groff_mm_works=no
22393e6c936aSmrg    fi
22403e6c936aSmrg    AC_MSG_RESULT([$groff_mm_works])
22413e6c936aSmrgfi
22424456fccdSmrg
22433e6c936aSmrg# We have groff, test for HTML dependencies, one command per package
22443e6c936aSmrgif test "x$have_groff" = x"yes"; then
22453e6c936aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22463e6c936aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22473e6c936aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22483e6c936aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22493e6c936aSmrg      have_groff_html=yes
22503e6c936aSmrg   else
22513e6c936aSmrg      have_groff_html=no
22523e6c936aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22533e6c936aSmrg   fi
2254ff63a143Smrgfi
22554456fccdSmrg
22563e6c936aSmrg# Set Automake conditionals for Makefiles
22573e6c936aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22583e6c936aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22593e6c936aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22603e6c936aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22613e6c936aSmrg]) # XORG_WITH_GROFF
22624456fccdSmrg
22633e6c936aSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22643e6c936aSmrg# ---------------------------------------
22653e6c936aSmrg# Minimum version: 1.6.0
22663e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22673e6c936aSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268ff63a143Smrg#
22693e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
22703e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
22713e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272a7e741d5Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22733e6c936aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22743e6c936aSmrg# --with-fop assumes 'auto'.
22753e6c936aSmrg#
22763e6c936aSmrg# Interface to module:
22773e6c936aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22783e6c936aSmrg# FOP:	 	returns the path of the fop program found
22793e6c936aSmrg#		returns the path set by the user in the environment
22803e6c936aSmrg# --with-fop: 	'yes' user instructs the module to use fop
22813e6c936aSmrg#		'no' user instructs the module not to use fop
22823e6c936aSmrg#
22833e6c936aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22843e6c936aSmrg#
22853e6c936aSmrgAC_DEFUN([XORG_WITH_FOP],[
22863e6c936aSmrgAC_ARG_VAR([FOP], [Path to fop command])
22873e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
22883e6c936aSmrgAC_ARG_WITH(fop,
22893e6c936aSmrg	AS_HELP_STRING([--with-fop],
22903e6c936aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22913e6c936aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22923e6c936aSmrgm4_undefine([_defopt])
22934456fccdSmrg
22943e6c936aSmrgif test "x$use_fop" = x"auto"; then
22953e6c936aSmrg   AC_PATH_PROG([FOP], [fop])
22963e6c936aSmrg   if test "x$FOP" = "x"; then
22973e6c936aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22983e6c936aSmrg	have_fop=no
22993e6c936aSmrg   else
23003e6c936aSmrg        have_fop=yes
23013e6c936aSmrg   fi
23023e6c936aSmrgelif test "x$use_fop" = x"yes" ; then
23033e6c936aSmrg   AC_PATH_PROG([FOP], [fop])
23043e6c936aSmrg   if test "x$FOP" = "x"; then
23053e6c936aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23063e6c936aSmrg   fi
23073e6c936aSmrg   have_fop=yes
23083e6c936aSmrgelif test "x$use_fop" = x"no" ; then
23093e6c936aSmrg   if test "x$FOP" != "x"; then
23103e6c936aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23113e6c936aSmrg   fi
23123e6c936aSmrg   have_fop=no
23133e6c936aSmrgelse
23143e6c936aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23153e6c936aSmrgfi
23164456fccdSmrg
23173e6c936aSmrg# Test for a minimum version of fop, if provided.
23183e6c936aSmrgm4_ifval([$1],
23193e6c936aSmrg[if test "$have_fop" = yes; then
23203e6c936aSmrg    # scrape the fop version
23213e6c936aSmrg    AC_MSG_CHECKING([for fop minimum version])
23223e6c936aSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23233e6c936aSmrg    AC_MSG_RESULT([$fop_version])
23243e6c936aSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23253e6c936aSmrg        [if test "x$use_fop" = xauto; then
23263e6c936aSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23273e6c936aSmrg            have_fop=no
23283e6c936aSmrg        else
23293e6c936aSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23303e6c936aSmrg        fi])
23313e6c936aSmrgfi])
23323e6c936aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23333e6c936aSmrg]) # XORG_WITH_FOP
23344456fccdSmrg
23350f1ac3bcSmrg# XORG_WITH_M4([MIN-VERSION])
23360f1ac3bcSmrg# ---------------------------
23370f1ac3bcSmrg# Minimum version: 1.19.0
23380f1ac3bcSmrg#
23390f1ac3bcSmrg# This macro attempts to locate an m4 macro processor which supports
23400f1ac3bcSmrg# -I option and is only useful for modules relying on M4 in order to
23410f1ac3bcSmrg# expand macros in source code files.
23420f1ac3bcSmrg#
23430f1ac3bcSmrg# Interface to module:
23440f1ac3bcSmrg# M4:	 	returns the path of the m4 program found
23450f1ac3bcSmrg#		returns the path set by the user in the environment
23460f1ac3bcSmrg#
23470f1ac3bcSmrgAC_DEFUN([XORG_WITH_M4], [
23480f1ac3bcSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23490f1ac3bcSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23500f1ac3bcSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23510f1ac3bcSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23520f1ac3bcSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23530f1ac3bcSmrg   [$PATH:/usr/gnu/bin])])
23540f1ac3bcSmrg
23550f1ac3bcSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23560f1ac3bcSmrg]) # XORG_WITH_M4
23570f1ac3bcSmrg
23583e6c936aSmrg# XORG_WITH_PS2PDF([DEFAULT])
23593e6c936aSmrg# ----------------
23603e6c936aSmrg# Minimum version: 1.6.0
23613e6c936aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23623e6c936aSmrg#
23633e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
23643e6c936aSmrg# not at the appropriate level. This macro enables a module to test for the
23653e6c936aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366a7e741d5Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23673e6c936aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23683e6c936aSmrg# --with-ps2pdf assumes 'auto'.
23693e6c936aSmrg#
23703e6c936aSmrg# Interface to module:
23713e6c936aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23723e6c936aSmrg# PS2PDF:	returns the path of the ps2pdf program found
23733e6c936aSmrg#		returns the path set by the user in the environment
23743e6c936aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23753e6c936aSmrg#		 'no' user instructs the module not to use ps2pdf
2376ff63a143Smrg#
23773e6c936aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23783e6c936aSmrg#
23793e6c936aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23803e6c936aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23813e6c936aSmrgm4_define([_defopt], m4_default([$1], [auto]))
23823e6c936aSmrgAC_ARG_WITH(ps2pdf,
23833e6c936aSmrg	AS_HELP_STRING([--with-ps2pdf],
23843e6c936aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23853e6c936aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23863e6c936aSmrgm4_undefine([_defopt])
23874456fccdSmrg
23883e6c936aSmrgif test "x$use_ps2pdf" = x"auto"; then
23893e6c936aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23903e6c936aSmrg   if test "x$PS2PDF" = "x"; then
23913e6c936aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23923e6c936aSmrg	have_ps2pdf=no
23933e6c936aSmrg   else
23943e6c936aSmrg        have_ps2pdf=yes
23953e6c936aSmrg   fi
23963e6c936aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23973e6c936aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23983e6c936aSmrg   if test "x$PS2PDF" = "x"; then
23993e6c936aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24003e6c936aSmrg   fi
24013e6c936aSmrg   have_ps2pdf=yes
24023e6c936aSmrgelif test "x$use_ps2pdf" = x"no" ; then
24033e6c936aSmrg   if test "x$PS2PDF" != "x"; then
24043e6c936aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24053e6c936aSmrg   fi
24063e6c936aSmrg   have_ps2pdf=no
24073e6c936aSmrgelse
24083e6c936aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24093e6c936aSmrgfi
24103e6c936aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24113e6c936aSmrg]) # XORG_WITH_PS2PDF
2412521070a0Smrg
24133e6c936aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24143e6c936aSmrg# ----------------
24153e6c936aSmrg# Minimum version: 1.6.0
2416ff63a143Smrg#
24173e6c936aSmrg# Documentation tools are not always available on all platforms and sometimes
24183e6c936aSmrg# not at the appropriate level. This macro enables a builder to skip all
24193e6c936aSmrg# documentation targets except traditional man pages.
24203e6c936aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421a7e741d5Smrg# maximum flexibility in controlling documentation building.
24223e6c936aSmrg# Refer to:
24233e6c936aSmrg# XORG_WITH_XMLTO         --with-xmlto
24243e6c936aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24253e6c936aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24263e6c936aSmrg# XORG_WITH_FOP           --with-fop
24273e6c936aSmrg# XORG_WITH_GROFF         --with-groff
24283e6c936aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24293e6c936aSmrg#
24303e6c936aSmrg# Interface to module:
24313e6c936aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24323e6c936aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24333e6c936aSmrg#		 'no' user instructs the module not to generate docs
24343e6c936aSmrg# parm1:	specify the default value, yes or no.
24353e6c936aSmrg#
24363e6c936aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24373e6c936aSmrgm4_define([docs_default], m4_default([$1], [yes]))
24383e6c936aSmrgAC_ARG_ENABLE(docs,
24393e6c936aSmrg	AS_HELP_STRING([--enable-docs],
24403e6c936aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24413e6c936aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24423e6c936aSmrgm4_undefine([docs_default])
24433e6c936aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24443e6c936aSmrgAC_MSG_CHECKING([whether to build documentation])
24453e6c936aSmrgAC_MSG_RESULT([$build_docs])
24463e6c936aSmrg]) # XORG_ENABLE_DOCS
24474456fccdSmrg
24483e6c936aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24493e6c936aSmrg# ----------------
24503e6c936aSmrg# Minimum version: 1.6.0
24513e6c936aSmrg#
24523e6c936aSmrg# This macro enables a builder to skip all developer documentation.
24533e6c936aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454a7e741d5Smrg# maximum flexibility in controlling documentation building.
24553e6c936aSmrg# Refer to:
24563e6c936aSmrg# XORG_WITH_XMLTO         --with-xmlto
24573e6c936aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24583e6c936aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24593e6c936aSmrg# XORG_WITH_FOP           --with-fop
24603e6c936aSmrg# XORG_WITH_GROFF         --with-groff
24613e6c936aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24623e6c936aSmrg#
24633e6c936aSmrg# Interface to module:
24643e6c936aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24653e6c936aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24663e6c936aSmrg#			'no' user instructs the module not to generate developer docs
24673e6c936aSmrg# parm1:		specify the default value, yes or no.
24683e6c936aSmrg#
24693e6c936aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24703e6c936aSmrgm4_define([devel_default], m4_default([$1], [yes]))
24713e6c936aSmrgAC_ARG_ENABLE(devel-docs,
24723e6c936aSmrg	AS_HELP_STRING([--enable-devel-docs],
24733e6c936aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24743e6c936aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24753e6c936aSmrgm4_undefine([devel_default])
24763e6c936aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24773e6c936aSmrgAC_MSG_CHECKING([whether to build developer documentation])
24783e6c936aSmrgAC_MSG_RESULT([$build_devel_docs])
24793e6c936aSmrg]) # XORG_ENABLE_DEVEL_DOCS
24804456fccdSmrg
24813e6c936aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24823e6c936aSmrg# ----------------
24833e6c936aSmrg# Minimum version: 1.6.0
24843e6c936aSmrg#
24853e6c936aSmrg# This macro enables a builder to skip all functional specification targets.
24863e6c936aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487a7e741d5Smrg# maximum flexibility in controlling documentation building.
24883e6c936aSmrg# Refer to:
24893e6c936aSmrg# XORG_WITH_XMLTO         --with-xmlto
24903e6c936aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24913e6c936aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24923e6c936aSmrg# XORG_WITH_FOP           --with-fop
24933e6c936aSmrg# XORG_WITH_GROFF         --with-groff
24943e6c936aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24953e6c936aSmrg#
24963e6c936aSmrg# Interface to module:
24973e6c936aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24983e6c936aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24993e6c936aSmrg#			'no' user instructs the module not to generate specs
25003e6c936aSmrg# parm1:		specify the default value, yes or no.
25013e6c936aSmrg#
25023e6c936aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25033e6c936aSmrgm4_define([spec_default], m4_default([$1], [yes]))
25043e6c936aSmrgAC_ARG_ENABLE(specs,
25053e6c936aSmrg	AS_HELP_STRING([--enable-specs],
25063e6c936aSmrg	   [Enable building the specs (default: ]spec_default[)]),
25073e6c936aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25083e6c936aSmrgm4_undefine([spec_default])
25093e6c936aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25103e6c936aSmrgAC_MSG_CHECKING([whether to build functional specifications])
25113e6c936aSmrgAC_MSG_RESULT([$build_specs])
25123e6c936aSmrg]) # XORG_ENABLE_SPECS
25134456fccdSmrg
25143e6c936aSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25153e6c936aSmrg# ----------------------------------------------
25163e6c936aSmrg# Minimum version: 1.13.0
25173e6c936aSmrg#
25183e6c936aSmrg# This macro enables a builder to enable/disable unit testing
25193e6c936aSmrg# It makes no assumption about the test cases implementation
25203e6c936aSmrg# Test cases may or may not use Automake "Support for test suites"
25213e6c936aSmrg# They may or may not use the software utility library GLib
25223e6c936aSmrg#
25233e6c936aSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25243e6c936aSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25253e6c936aSmrg# The variable enable_unit_tests is used by other macros in this file.
25263e6c936aSmrg#
25273e6c936aSmrg# Interface to module:
25283e6c936aSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25293e6c936aSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25303e6c936aSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25313e6c936aSmrg#			'no' user instructs the module not to build tests
25323e6c936aSmrg# parm1:		specify the default value, yes or no.
25333e6c936aSmrg#
25343e6c936aSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25353e6c936aSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25363e6c936aSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25373e6c936aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25383e6c936aSmrgm4_define([_defopt], m4_default([$1], [auto]))
25393e6c936aSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25403e6c936aSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25413e6c936aSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25423e6c936aSmrgm4_undefine([_defopt])
25433e6c936aSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25443e6c936aSmrgAC_MSG_CHECKING([whether to build unit test cases])
25453e6c936aSmrgAC_MSG_RESULT([$enable_unit_tests])
25463e6c936aSmrg]) # XORG_ENABLE_UNIT_TESTS
25473e6c936aSmrg
25483e6c936aSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25493e6c936aSmrg# ------------------------------------------------------
25503e6c936aSmrg# Minimum version: 1.17.0
25513e6c936aSmrg#
25523e6c936aSmrg# This macro enables a builder to enable/disable integration testing
25533e6c936aSmrg# It makes no assumption about the test cases' implementation
25543e6c936aSmrg# Test cases may or may not use Automake "Support for test suites"
25553e6c936aSmrg#
25563e6c936aSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25573e6c936aSmrg# usually requires less dependencies and may be built and run under less
25583e6c936aSmrg# stringent environments than integration tests.
25593e6c936aSmrg#
25603e6c936aSmrg# Interface to module:
25613e6c936aSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25623e6c936aSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25633e6c936aSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25643e6c936aSmrg#                             'no' user instructs the module not to build tests
25653e6c936aSmrg# parm1:                      specify the default value, yes or no.
25663e6c936aSmrg#
25673e6c936aSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25683e6c936aSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25693e6c936aSmrgm4_define([_defopt], m4_default([$1], [auto]))
25703e6c936aSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25713e6c936aSmrg	[Enable building integration test cases (default: ]_defopt[)]),
25723e6c936aSmrg	[enable_integration_tests=$enableval],
25733e6c936aSmrg	[enable_integration_tests=]_defopt)
25743e6c936aSmrgm4_undefine([_defopt])
25753e6c936aSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25763e6c936aSmrg	[test "x$enable_integration_tests" != xno])
25773e6c936aSmrgAC_MSG_CHECKING([whether to build unit test cases])
25783e6c936aSmrgAC_MSG_RESULT([$enable_integration_tests])
25793e6c936aSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
25803e6c936aSmrg
25813e6c936aSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25823e6c936aSmrg# ----------------------------------------
25833e6c936aSmrg# Minimum version: 1.13.0
25843e6c936aSmrg#
25853e6c936aSmrg# GLib is a library which provides advanced data structures and functions.
25863e6c936aSmrg# This macro enables a module to test for the presence of Glib.
25873e6c936aSmrg#
25883e6c936aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25893e6c936aSmrg# Otherwise the value of $enable_unit_tests is blank.
25903e6c936aSmrg#
25913e6c936aSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25923e6c936aSmrg# test support usually requires less dependencies and may be built and run under
25933e6c936aSmrg# less stringent environments than integration tests.
25943e6c936aSmrg#
25953e6c936aSmrg# Interface to module:
25963e6c936aSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
25973e6c936aSmrg# with_glib: used in configure.ac to know if GLib has been found
25983e6c936aSmrg# --with-glib:	'yes' user instructs the module to use glib
25993e6c936aSmrg#		'no' user instructs the module not to use glib
26003e6c936aSmrg#
26013e6c936aSmrgAC_DEFUN([XORG_WITH_GLIB],[
26023e6c936aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26033e6c936aSmrgm4_define([_defopt], m4_default([$2], [auto]))
26043e6c936aSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26053e6c936aSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26063e6c936aSmrg	[with_glib=$withval], [with_glib=]_defopt)
26073e6c936aSmrgm4_undefine([_defopt])
26083e6c936aSmrg
26093e6c936aSmrghave_glib=no
26103e6c936aSmrg# Do not probe GLib if user explicitly disabled unit testing
26113e6c936aSmrgif test "x$enable_unit_tests" != x"no"; then
26123e6c936aSmrg  # Do not probe GLib if user explicitly disabled it
26133e6c936aSmrg  if test "x$with_glib" != x"no"; then
26143e6c936aSmrg    m4_ifval(
26153e6c936aSmrg      [$1],
26163e6c936aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26173e6c936aSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26183e6c936aSmrg    )
2619ff63a143Smrg  fi
2620ff63a143Smrgfi
26214456fccdSmrg
26223e6c936aSmrg# Not having GLib when unit testing has been explicitly requested is an error
26233e6c936aSmrgif test "x$enable_unit_tests" = x"yes"; then
26243e6c936aSmrg  if test "x$have_glib" = x"no"; then
26253e6c936aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626ff63a143Smrg  fi
2627ff63a143Smrgfi
26283e6c936aSmrg
26293e6c936aSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26303e6c936aSmrgif test "x$enable_unit_tests" = x"no"; then
26313e6c936aSmrg  if test "x$with_glib" = x"yes"; then
26323e6c936aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26333e6c936aSmrg  fi
2634ff63a143Smrgfi
2635521070a0Smrg
26363e6c936aSmrg# Not having GLib when it has been explicitly requested is an error
26373e6c936aSmrgif test "x$with_glib" = x"yes"; then
26383e6c936aSmrg  if test "x$have_glib" = x"no"; then
26393e6c936aSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26403e6c936aSmrg  fi
26413e6c936aSmrgfi
26424456fccdSmrg
26433e6c936aSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26443e6c936aSmrg]) # XORG_WITH_GLIB
26454456fccdSmrg
26463e6c936aSmrg# XORG_LD_WRAP([required|optional])
26473e6c936aSmrg# ---------------------------------
26483e6c936aSmrg# Minimum version: 1.13.0
26493e6c936aSmrg#
26503e6c936aSmrg# Check if linker supports -wrap, passed via compiler flags
26513e6c936aSmrg#
26523e6c936aSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26533e6c936aSmrg# Otherwise the value of $enable_unit_tests is blank.
26543e6c936aSmrg#
26553e6c936aSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26563e6c936aSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26573e6c936aSmrg# available, an argument of "optional" allows use when some unit tests require
26583e6c936aSmrg# ld -wrap and others do not.
26593e6c936aSmrg#
26603e6c936aSmrgAC_DEFUN([XORG_LD_WRAP],[
26613e6c936aSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26623e6c936aSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26633e6c936aSmrg                      void __wrap_exit(int status) { return; }],
26643e6c936aSmrg                     [exit(0);])])
26653e6c936aSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
26663e6c936aSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26673e6c936aSmrg  if test "x$have_ld_wrap" = x"no"; then
26683e6c936aSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26693e6c936aSmrg  fi
2670ff63a143Smrgfi
26713e6c936aSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26723e6c936aSmrg#
26733e6c936aSmrg]) # XORG_LD_WRAP
26744456fccdSmrg
26753e6c936aSmrg# XORG_CHECK_LINKER_FLAGS
26763e6c936aSmrg# -----------------------
26773e6c936aSmrg# SYNOPSIS
26783e6c936aSmrg#
26793e6c936aSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26803e6c936aSmrg#
26813e6c936aSmrg# DESCRIPTION
26823e6c936aSmrg#
26833e6c936aSmrg#   Check whether the given linker FLAGS work with the current language's
26843e6c936aSmrg#   linker, or whether they give an error.
26853e6c936aSmrg#
26863e6c936aSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26873e6c936aSmrg#   success/failure.
26883e6c936aSmrg#
26893e6c936aSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
26903e6c936aSmrg#
26913e6c936aSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26923e6c936aSmrg#
26933e6c936aSmrg# LICENSE
26943e6c936aSmrg#
26953e6c936aSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26963e6c936aSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26973e6c936aSmrg#   Copyright (c) 2009 Matteo Frigo
26983e6c936aSmrg#
26993e6c936aSmrg#   This program is free software: you can redistribute it and/or modify it
27003e6c936aSmrg#   under the terms of the GNU General Public License as published by the
27013e6c936aSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27023e6c936aSmrg#   option) any later version.
27033e6c936aSmrg#
27043e6c936aSmrg#   This program is distributed in the hope that it will be useful, but
27053e6c936aSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27063e6c936aSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27073e6c936aSmrg#   Public License for more details.
27083e6c936aSmrg#
27093e6c936aSmrg#   You should have received a copy of the GNU General Public License along
27103e6c936aSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27113e6c936aSmrg#
27123e6c936aSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27133e6c936aSmrg#   gives unlimited permission to copy, distribute and modify the configure
27143e6c936aSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27153e6c936aSmrg#   need not follow the terms of the GNU General Public License when using
27163e6c936aSmrg#   or distributing such scripts, even though portions of the text of the
27173e6c936aSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27183e6c936aSmrg#   all other use of the material that constitutes the Autoconf Macro.
27193e6c936aSmrg#
27203e6c936aSmrg#   This special exception to the GPL applies to versions of the Autoconf
27213e6c936aSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27223e6c936aSmrg#   modified version of the Autoconf Macro, you may extend this special
27233e6c936aSmrg#   exception to the GPL to apply to your modified version as well.#
27243e6c936aSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27253e6c936aSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27263e6c936aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27273e6c936aSmrgAS_LITERAL_IF([$1],
27283e6c936aSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27293e6c936aSmrg      ax_save_FLAGS=$LDFLAGS
27303e6c936aSmrg      LDFLAGS="$1"
27313e6c936aSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27323e6c936aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27333e6c936aSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27343e6c936aSmrg      LDFLAGS=$ax_save_FLAGS])],
27353e6c936aSmrg  [ax_save_FLAGS=$LDFLAGS
27363e6c936aSmrg   LDFLAGS="$1"
27373e6c936aSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27383e6c936aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27393e6c936aSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27403e6c936aSmrg   LDFLAGS=$ax_save_FLAGS])
27413e6c936aSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27423e6c936aSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27433e6c936aSmrgif test "x$xorg_check_linker_flags" = xyes; then
27443e6c936aSmrg	m4_default([$2], :)
27453e6c936aSmrgelse
27463e6c936aSmrg	m4_default([$3], :)
27473e6c936aSmrgfi
27483e6c936aSmrg]) # XORG_CHECK_LINKER_FLAGS
27494456fccdSmrg
27503e6c936aSmrg# XORG_MEMORY_CHECK_FLAGS
27513e6c936aSmrg# -----------------------
27523e6c936aSmrg# Minimum version: 1.16.0
2753ff63a143Smrg#
27543e6c936aSmrg# This macro attempts to find appropriate memory checking functionality
27553e6c936aSmrg# for various platforms which unit testing code may use to catch various
27563e6c936aSmrg# forms of memory allocation and access errors in testing.
27573e6c936aSmrg#
27583e6c936aSmrg# Interface to module:
27593e6c936aSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27603e6c936aSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27613e6c936aSmrg#
27623e6c936aSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27633e6c936aSmrg#
27643e6c936aSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27654456fccdSmrg
27663e6c936aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
27673e6c936aSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27683e6c936aSmrg           [Environment variables to enable memory checking in tests])
27694456fccdSmrg
27703e6c936aSmrg# Check for different types of support on different platforms
27713e6c936aSmrgcase $host_os in
27723e6c936aSmrg    solaris*)
27733e6c936aSmrg        AC_CHECK_LIB([umem], [umem_alloc],
27743e6c936aSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27753e6c936aSmrg        ;;
27763e6c936aSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27773e6c936aSmrg        # both directly and inverted, so should not be 0 or 255.
27783e6c936aSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
27793e6c936aSmrg        ;;
27803e6c936aSmrg    darwin*)
27813e6c936aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27823e6c936aSmrg        ;;
27833e6c936aSmrg    *bsd*)
27843e6c936aSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27853e6c936aSmrg        ;;
27863e6c936aSmrgesac
278742d69509Smrg
27883e6c936aSmrg# User supplied flags override default flags
27893e6c936aSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27903e6c936aSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27913e6c936aSmrgfi
2792521070a0Smrg
27933e6c936aSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27943e6c936aSmrg]) # XORG_WITH_LINT
2795521070a0Smrg
27963e6c936aSmrg# XORG_CHECK_MALLOC_ZERO
27973e6c936aSmrg# ----------------------
27983e6c936aSmrg# Minimum version: 1.0.0
2799ff63a143Smrg#
28003e6c936aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28013e6c936aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28023e6c936aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28033e6c936aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28043e6c936aSmrgAC_ARG_ENABLE(malloc0returnsnull,
28053e6c936aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28063e6c936aSmrg		       [malloc(0) returns NULL (default: auto)]),
28073e6c936aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28083e6c936aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809ff63a143Smrg
28103e6c936aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28113e6c936aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28120f1ac3bcSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28130f1ac3bcSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28143e6c936aSmrg#include <stdlib.h>
28153e6c936aSmrg],[
28163e6c936aSmrg    char *m0, *r0, *c0, *p;
28173e6c936aSmrg    m0 = malloc(0);
28183e6c936aSmrg    p = malloc(10);
28193e6c936aSmrg    r0 = realloc(p,0);
28203e6c936aSmrg    c0 = calloc(0,10);
28213e6c936aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28223e6c936aSmrg])],
28230f1ac3bcSmrg		[xorg_cv_malloc0_returns_null=yes],
28240f1ac3bcSmrg		[xorg_cv_malloc0_returns_null=no])])
28250f1ac3bcSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28263e6c936aSmrgfi
28273e6c936aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828ff63a143Smrg
28293e6c936aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28303e6c936aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28313e6c936aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28323e6c936aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28333e6c936aSmrgelse
28343e6c936aSmrg	MALLOC_ZERO_CFLAGS=""
28353e6c936aSmrg	XMALLOC_ZERO_CFLAGS=""
28363e6c936aSmrg	XTMALLOC_ZERO_CFLAGS=""
2837ff63a143Smrgfi
28384456fccdSmrg
28393e6c936aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28403e6c936aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28413e6c936aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28423e6c936aSmrg]) # XORG_CHECK_MALLOC_ZERO
2843521070a0Smrg
28443e6c936aSmrg# XORG_WITH_LINT()
28453e6c936aSmrg# ----------------
28463e6c936aSmrg# Minimum version: 1.1.0
284742d69509Smrg#
28483e6c936aSmrg# This macro enables the use of a tool that flags some suspicious and
28493e6c936aSmrg# non-portable constructs (likely to be bugs) in C language source code.
28503e6c936aSmrg# It will attempt to locate the tool and use appropriate options.
28513e6c936aSmrg# There are various lint type tools on different platforms.
28523e6c936aSmrg#
28533e6c936aSmrg# Interface to module:
28543e6c936aSmrg# LINT:		returns the path to the tool found on the platform
28553e6c936aSmrg#		or the value set to LINT on the configure cmd line
28563e6c936aSmrg#		also an Automake conditional
28573e6c936aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28583e6c936aSmrg#
28593e6c936aSmrg# --with-lint:	'yes' user instructs the module to use lint
28603e6c936aSmrg#		'no' user instructs the module not to use lint (default)
28613e6c936aSmrg#
28623e6c936aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28633e6c936aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28643e6c936aSmrg#
28653e6c936aSmrgAC_DEFUN([XORG_WITH_LINT],[
28664456fccdSmrg
28673e6c936aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28683e6c936aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28693e6c936aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28703e6c936aSmrg		[Use a lint-style source code checker (default: disabled)])],
28713e6c936aSmrg		[use_lint=$withval], [use_lint=no])
28724456fccdSmrg
28733e6c936aSmrg# Obtain platform specific info like program name and options
28743e6c936aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28753e6c936aSmrgcase $host_os in
28763e6c936aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28773e6c936aSmrg	lint_name=splint
28783e6c936aSmrg	lint_options="-badflag"
28793e6c936aSmrg	;;
28803e6c936aSmrg  *freebsd* | *netbsd*)
28813e6c936aSmrg	lint_name=lint
28823e6c936aSmrg	lint_options="-u -b"
28833e6c936aSmrg	;;
28843e6c936aSmrg  *solaris*)
28853e6c936aSmrg	lint_name=lint
28863e6c936aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28873e6c936aSmrg	;;
28883e6c936aSmrgesac
2889521070a0Smrg
28903e6c936aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28913e6c936aSmrgif test "x$use_lint" = x"yes" ; then
28923e6c936aSmrg   AC_PATH_PROG([LINT], [$lint_name])
28933e6c936aSmrg   if test "x$LINT" = "x"; then
28943e6c936aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28953e6c936aSmrg   fi
28963e6c936aSmrgelif test "x$use_lint" = x"no" ; then
28973e6c936aSmrg   if test "x$LINT" != "x"; then
28983e6c936aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28993e6c936aSmrg   fi
2900ff63a143Smrgelse
29013e6c936aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902ff63a143Smrgfi
2903521070a0Smrg
29043e6c936aSmrg# User supplied flags override default flags
29053e6c936aSmrgif test "x$LINT_FLAGS" != "x"; then
29063e6c936aSmrg   lint_options=$LINT_FLAGS
29073e6c936aSmrgfi
2908521070a0Smrg
29093e6c936aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29103e6c936aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911521070a0Smrg
29123e6c936aSmrg]) # XORG_WITH_LINT
2913521070a0Smrg
29143e6c936aSmrg# XORG_LINT_LIBRARY(LIBNAME)
29153e6c936aSmrg# --------------------------
29163e6c936aSmrg# Minimum version: 1.1.0
2917521070a0Smrg#
29183e6c936aSmrg# Sets up flags for building lint libraries for checking programs that call
29193e6c936aSmrg# functions in the library.
29203e6c936aSmrg#
29213e6c936aSmrg# Interface to module:
29223e6c936aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29233e6c936aSmrg# MAKE_LINT_LIB		- Automake conditional
29243e6c936aSmrg#
29253e6c936aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29263e6c936aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927521070a0Smrg
29283e6c936aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29293e6c936aSmrgAC_REQUIRE([XORG_WITH_LINT])
29303e6c936aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29313e6c936aSmrg	[Create lint library (default: disabled)])],
29323e6c936aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933521070a0Smrg
29343e6c936aSmrgif test "x$make_lint_lib" = x"yes" ; then
29353e6c936aSmrg   LINTLIB=llib-l$1.ln
29363e6c936aSmrg   if test "x$LINT" = "x"; then
29373e6c936aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29383e6c936aSmrg   fi
29393e6c936aSmrgelif test "x$make_lint_lib" != x"no" ; then
29403e6c936aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29413e6c936aSmrgfi
2942521070a0Smrg
29433e6c936aSmrgAC_SUBST(LINTLIB)
29443e6c936aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945521070a0Smrg
29463e6c936aSmrg]) # XORG_LINT_LIBRARY
2947521070a0Smrg
29483e6c936aSmrg# XORG_COMPILER_BRAND
29493e6c936aSmrg# -------------------
29503e6c936aSmrg# Minimum version: 1.14.0
29513e6c936aSmrg#
29523e6c936aSmrg# Checks for various brands of compilers and sets flags as appropriate:
29533e6c936aSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29543e6c936aSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29553e6c936aSmrg#   clang compiler - sets CLANGCC to "yes"
29563e6c936aSmrg#   Intel compiler - sets INTELCC to "yes"
29573e6c936aSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29583e6c936aSmrg#
29593e6c936aSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29603e6c936aSmrgAC_LANG_CASE(
29613e6c936aSmrg	[C], [
2962a7e741d5Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963a7e741d5Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964a7e741d5Smrg		m4_version_prereq([2.70],
2965a7e741d5Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966a7e741d5Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29673e6c936aSmrg	],
29683e6c936aSmrg	[C++], [
29693e6c936aSmrg		AC_REQUIRE([AC_PROG_CXX])
29703e6c936aSmrg	]
29713e6c936aSmrg)
29723e6c936aSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29733e6c936aSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29743e6c936aSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29753e6c936aSmrg]) # XORG_COMPILER_BRAND
29764456fccdSmrg
29773e6c936aSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29783e6c936aSmrg# ---------------
29793e6c936aSmrg# Minimum version: 1.16.0
29803e6c936aSmrg#
29813e6c936aSmrg# Test if the compiler works when passed the given flag as a command line argument.
2982a7e741d5Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29833e6c936aSmrg# next flag in the list until there are no more options.
29843e6c936aSmrg#
29853e6c936aSmrg# Note that this does not guarantee that the compiler supports the flag as some
29863e6c936aSmrg# compilers will simply ignore arguments that they do not understand, but we do
29873e6c936aSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29883e6c936aSmrg# -Werror=unused-command-line-argument
29893e6c936aSmrg#
29903e6c936aSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29913e6c936aSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29923e6c936aSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29933e6c936aSmrg
29943e6c936aSmrgAC_LANG_COMPILER_REQUIRE
29953e6c936aSmrg
29963e6c936aSmrgAC_LANG_CASE(
29973e6c936aSmrg	[C], [
2998a7e741d5Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999a7e741d5Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000a7e741d5Smrg		m4_version_prereq([2.70],
3001a7e741d5Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002a7e741d5Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30033e6c936aSmrg		define([PREFIX], [C])
30043e6c936aSmrg		define([CACHE_PREFIX], [cc])
30053e6c936aSmrg		define([COMPILER], [$CC])
30063e6c936aSmrg	],
30073e6c936aSmrg	[C++], [
30083e6c936aSmrg		define([PREFIX], [CXX])
30093e6c936aSmrg		define([CACHE_PREFIX], [cxx])
30103e6c936aSmrg		define([COMPILER], [$CXX])
30113e6c936aSmrg	]
30123e6c936aSmrg)
30134456fccdSmrg
30143e6c936aSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30153e6c936aSmrg
30163e6c936aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30173e6c936aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30183e6c936aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30193e6c936aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30203e6c936aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30213e6c936aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30223e6c936aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30233e6c936aSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30243e6c936aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30253e6c936aSmrgfi
30264456fccdSmrg
30273e6c936aSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30283e6c936aSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30293e6c936aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30303e6c936aSmrg	fi
30313e6c936aSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30323e6c936aSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30333e6c936aSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30343e6c936aSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30353e6c936aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30363e6c936aSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30373e6c936aSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30383e6c936aSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30393e6c936aSmrgfi
30404456fccdSmrg
30413e6c936aSmrgfound="no"
30423e6c936aSmrgm4_foreach([flag], m4_cdr($@), [
30433e6c936aSmrg	if test $found = "no" ; then
30440f1ac3bcSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30453e6c936aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30463e6c936aSmrg		fi
30473e6c936aSmrg
30480f1ac3bcSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30493e6c936aSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30503e6c936aSmrg		fi
30513e6c936aSmrg
30523e6c936aSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30533e6c936aSmrg
30543e6c936aSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30553e6c936aSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30563e6c936aSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30573e6c936aSmrg		AC_CACHE_VAL($cacheid,
30583e6c936aSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30593e6c936aSmrg					     [eval $cacheid=yes],
30603e6c936aSmrg					     [eval $cacheid=no])])
30613e6c936aSmrg
30623e6c936aSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30633e6c936aSmrg
30643e6c936aSmrg		eval supported=\$$cacheid
30653e6c936aSmrg		AC_MSG_RESULT([$supported])
30663e6c936aSmrg		if test "$supported" = "yes" ; then
30673e6c936aSmrg			$1="$$1 ]flag["
30683e6c936aSmrg			found="yes"
30693e6c936aSmrg		fi
30703e6c936aSmrg	fi
30713e6c936aSmrg])
30723e6c936aSmrg]) # XORG_TESTSET_CFLAG
30734456fccdSmrg
30743e6c936aSmrg# XORG_COMPILER_FLAGS
30753e6c936aSmrg# ---------------
30763e6c936aSmrg# Minimum version: 1.16.0
30773e6c936aSmrg#
30783e6c936aSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30793e6c936aSmrg# arguments supported by the selected compiler which do NOT alter the generated
30803e6c936aSmrg# code.  These arguments will cause the compiler to print various warnings
30813e6c936aSmrg# during compilation AND turn a conservative set of warnings into errors.
30823e6c936aSmrg#
30833e6c936aSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30843e6c936aSmrg# future versions of util-macros as options are added to new compilers.
30853e6c936aSmrg#
30863e6c936aSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30873e6c936aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30883e6c936aSmrg
30893e6c936aSmrgAC_ARG_ENABLE(selective-werror,
30903e6c936aSmrg              AS_HELP_STRING([--disable-selective-werror],
30913e6c936aSmrg                             [Turn off selective compiler errors. (default: enabled)]),
30923e6c936aSmrg              [SELECTIVE_WERROR=$enableval],
30933e6c936aSmrg              [SELECTIVE_WERROR=yes])
30943e6c936aSmrg
30953e6c936aSmrgAC_LANG_CASE(
30963e6c936aSmrg        [C], [
30973e6c936aSmrg                define([PREFIX], [C])
30983e6c936aSmrg        ],
30993e6c936aSmrg        [C++], [
31003e6c936aSmrg                define([PREFIX], [CXX])
31013e6c936aSmrg        ]
31023e6c936aSmrg)
31033e6c936aSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31043e6c936aSmrgif test "x$SUNCC" = "xyes"; then
31053e6c936aSmrg    [BASE_]PREFIX[FLAGS]="-v"
3106ff63a143Smrgelse
31073e6c936aSmrg    [BASE_]PREFIX[FLAGS]=""
3108ff63a143Smrgfi
31094456fccdSmrg
31103e6c936aSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31113e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31123e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31133e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31143e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31153e6c936aSmrg
31163e6c936aSmrgAC_LANG_CASE(
31173e6c936aSmrg	[C], [
31183e6c936aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31193e6c936aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31203e6c936aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31213e6c936aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31220f1ac3bcSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31233e6c936aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31243e6c936aSmrg	]
31253e6c936aSmrg)
31264456fccdSmrg
31273e6c936aSmrg# This chunk adds additional warnings that could catch undesired effects.
31283e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31293e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31303e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31313e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31323e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31333e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31340f1ac3bcSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31353e6c936aSmrg
31363e6c936aSmrg# These are currently disabled because they are noisy.  They will be enabled
31373e6c936aSmrg# in the future once the codebase is sufficiently modernized to silence
31383e6c936aSmrg# them.  For now, I don't want them to drown out the other warnings.
31393e6c936aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31403e6c936aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31410f1ac3bcSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31423e6c936aSmrg
3143a7e741d5Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31443e6c936aSmrg# when there are problems that should be fixed.
31453e6c936aSmrg
31463e6c936aSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31473e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31483e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31493e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31503e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31513e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31523e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31533e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31543e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31553e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31563e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31573e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31583e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31593e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31603e6c936aSmrgelse
31613e6c936aSmrgAC_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])
31623e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31633e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31643e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31653e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31663e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31673e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31683e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31693e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31703e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31713e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31723e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31733e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31743e6c936aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31753e6c936aSmrgfi
3176ff63a143Smrg
31773e6c936aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31783e6c936aSmrg]) # XORG_COMPILER_FLAGS
31794456fccdSmrg
31803e6c936aSmrg# XORG_CWARNFLAGS
31813e6c936aSmrg# ---------------
31823e6c936aSmrg# Minimum version: 1.2.0
31833e6c936aSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184521070a0Smrg#
31853e6c936aSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3186521070a0Smrg#
31873e6c936aSmrg# This function is deprecated because it defines -fno-strict-aliasing
31883e6c936aSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31893e6c936aSmrg# is needed, then it should be added explicitly in the module when
31903e6c936aSmrg# it is updated to use BASE_CFLAGS.
31913e6c936aSmrg#
31923e6c936aSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31933e6c936aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31943e6c936aSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31953e6c936aSmrgAC_LANG_CASE(
31963e6c936aSmrg	[C], [
31973e6c936aSmrg		CWARNFLAGS="$BASE_CFLAGS"
31983e6c936aSmrg		if  test "x$GCC" = xyes ; then
31993e6c936aSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32003e6c936aSmrg		fi
32013e6c936aSmrg		AC_SUBST(CWARNFLAGS)
32023e6c936aSmrg	]
32033e6c936aSmrg)
32043e6c936aSmrg]) # XORG_CWARNFLAGS
32054456fccdSmrg
32063e6c936aSmrg# XORG_STRICT_OPTION
32073e6c936aSmrg# -----------------------
32083e6c936aSmrg# Minimum version: 1.3.0
32093e6c936aSmrg#
32103e6c936aSmrg# Add configure option to enable strict compilation flags, such as treating
32113e6c936aSmrg# warnings as fatal errors.
32123e6c936aSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32133e6c936aSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32143e6c936aSmrg#
32153e6c936aSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32163e6c936aSmrg# when strict compilation is unconditionally desired.
32173e6c936aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32183e6c936aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32193e6c936aSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32204456fccdSmrg
32213e6c936aSmrgAC_ARG_ENABLE(strict-compilation,
32223e6c936aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32233e6c936aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32243e6c936aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32254456fccdSmrg
32263e6c936aSmrgAC_LANG_CASE(
32273e6c936aSmrg        [C], [
32283e6c936aSmrg                define([PREFIX], [C])
32293e6c936aSmrg        ],
32303e6c936aSmrg        [C++], [
32313e6c936aSmrg                define([PREFIX], [CXX])
32323e6c936aSmrg        ]
32333e6c936aSmrg)
3234521070a0Smrg
32353e6c936aSmrg[STRICT_]PREFIX[FLAGS]=""
32363e6c936aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32373e6c936aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238521070a0Smrg
32393e6c936aSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32403e6c936aSmrg# activate it with -Werror, so we add it here explicitly.
32413e6c936aSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242521070a0Smrg
32433e6c936aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32443e6c936aSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32453e6c936aSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32463e6c936aSmrgfi
32473e6c936aSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32483e6c936aSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32493e6c936aSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32503e6c936aSmrg]) # XORG_STRICT_OPTION
3251521070a0Smrg
3252a7e741d5Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253a7e741d5Smrg# ---------------------------
3254a7e741d5Smrg# Minimum version: 1.20.0
3255a7e741d5Smrg#
3256a7e741d5Smrg# Defines default options for X.Org modules which don't compile code,
3257a7e741d5Smrg# such as fonts, bitmaps, cursors, and docs.
3258a7e741d5Smrg#
3259a7e741d5SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260a7e741d5SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261a7e741d5SmrgXORG_RELEASE_VERSION
3262a7e741d5SmrgXORG_CHANGELOG
3263a7e741d5SmrgXORG_INSTALL
3264a7e741d5SmrgXORG_MANPAGE_SECTIONS
3265a7e741d5Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266a7e741d5Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267a7e741d5Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268a7e741d5Smrg
32693e6c936aSmrg# XORG_DEFAULT_OPTIONS
3270ff63a143Smrg# --------------------
32713e6c936aSmrg# Minimum version: 1.3.0
3272521070a0Smrg#
3273a7e741d5Smrg# Defines default options for X.Org modules which compile code.
3274521070a0Smrg#
32753e6c936aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32763e6c936aSmrgAC_REQUIRE([AC_PROG_INSTALL])
32773e6c936aSmrgXORG_COMPILER_FLAGS
32783e6c936aSmrgXORG_CWARNFLAGS
32793e6c936aSmrgXORG_STRICT_OPTION
3280a7e741d5SmrgXORG_DEFAULT_NOCODE_OPTIONS
32813e6c936aSmrg]) # XORG_DEFAULT_OPTIONS
3282521070a0Smrg
32833e6c936aSmrg# XORG_INSTALL()
32843e6c936aSmrg# ----------------
32853e6c936aSmrg# Minimum version: 1.4.0
32863e6c936aSmrg#
32873e6c936aSmrg# Defines the variable INSTALL_CMD as the command to copy
32883e6c936aSmrg# INSTALL from $prefix/share/util-macros.
32893e6c936aSmrg#
32903e6c936aSmrgAC_DEFUN([XORG_INSTALL], [
32913e6c936aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32923e6c936aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32933e6c936aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32943e6c936aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295b0a0317aSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296b0a0317aSmrgtouch \$(top_srcdir)/INSTALL; \
3297b0a0317aSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32983e6c936aSmrgAC_SUBST([INSTALL_CMD])
32993e6c936aSmrg]) # XORG_INSTALL
33003e6c936aSmrgdnl Copyright 2005 Red Hat, Inc
33013e6c936aSmrgdnl
33023e6c936aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33033e6c936aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
33043e6c936aSmrgdnl the above copyright notice appear in all copies and that both that
33053e6c936aSmrgdnl copyright notice and this permission notice appear in supporting
33063e6c936aSmrgdnl documentation.
33073e6c936aSmrgdnl
33083e6c936aSmrgdnl The above copyright notice and this permission notice shall be included
33093e6c936aSmrgdnl in all copies or substantial portions of the Software.
33103e6c936aSmrgdnl
33113e6c936aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33123e6c936aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33133e6c936aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33143e6c936aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33153e6c936aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33163e6c936aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33173e6c936aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
33183e6c936aSmrgdnl
33193e6c936aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33203e6c936aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33213e6c936aSmrgdnl other dealings in this Software without prior written authorization
33223e6c936aSmrgdnl from the copyright holders.
33233e6c936aSmrgdnl
3324521070a0Smrg
33253e6c936aSmrg# XORG_RELEASE_VERSION
33263e6c936aSmrg# --------------------
33273e6c936aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33280f1ac3bcSmrg
33293e6c936aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33303e6c936aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33313e6c936aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33323e6c936aSmrg		[Major version of this package])
33333e6c936aSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33343e6c936aSmrg	if test "x$PVM" = "x"; then
33353e6c936aSmrg		PVM="0"
33363e6c936aSmrg	fi
33373e6c936aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33383e6c936aSmrg		[$PVM],
33393e6c936aSmrg		[Minor version of this package])
33403e6c936aSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33413e6c936aSmrg	if test "x$PVP" = "x"; then
33423e6c936aSmrg		PVP="0"
33433e6c936aSmrg	fi
33443e6c936aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33453e6c936aSmrg		[$PVP],
33463e6c936aSmrg		[Patch version of this package])
33473e6c936aSmrg])
3348ff63a143Smrg
33493e6c936aSmrg# XORG_CHANGELOG()
33503e6c936aSmrg# ----------------
33513e6c936aSmrg# Minimum version: 1.2.0
33523e6c936aSmrg#
33533e6c936aSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33543e6c936aSmrg# ChangeLog from git.
33553e6c936aSmrg#
33563e6c936aSmrg#
33573e6c936aSmrgAC_DEFUN([XORG_CHANGELOG], [
3358b0a0317aSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33593e6c936aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360b0a0317aSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361b0a0317aSmrgtouch \$(top_srcdir)/ChangeLog; \
3362b0a0317aSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33633e6c936aSmrgAC_SUBST([CHANGELOG_CMD])
33643e6c936aSmrg]) # XORG_CHANGELOG
33654456fccdSmrg
3366a7e741d5Smrgm4_include([m4/libtool.m4])
3367a7e741d5Smrgm4_include([m4/ltoptions.m4])
3368a7e741d5Smrgm4_include([m4/ltsugar.m4])
3369a7e741d5Smrgm4_include([m4/ltversion.m4])
3370a7e741d5Smrgm4_include([m4/lt~obsolete.m4])
3371