12a53b785Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e1c0d025Smrg
32a53b785Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
43da084b3Smrg
53da084b3Smrg# This file is free software; the Free Software Foundation
63da084b3Smrg# gives unlimited permission to copy and/or distribute it,
73da084b3Smrg# with or without modifications, as long as this notice is preserved.
83da084b3Smrg
93da084b3Smrg# This program is distributed in the hope that it will be useful,
103da084b3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
113da084b3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
123da084b3Smrg# PARTICULAR PURPOSE.
133da084b3Smrg
14e1c0d025Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15d63fdb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16d63fdb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17da2777aaSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18da2777aaSmrg[m4_warning([this file was generated for autoconf 2.72.
19d63fdb69SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20d63fdb69SmrgIf you have problems, you may need to regenerate the build system entirely.
21e1c0d025SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22d63fdb69Smrg
23da2777aaSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2443d802faSmrg#
25da2777aaSmrg# This file is free software; the Free Software Foundation
26da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
27da2777aaSmrg# with or without modifications, as long as this notice is preserved.
2855acc8fcSmrg
29da2777aaSmrg# AM_AUTOMAKE_VERSION(VERSION)
30da2777aaSmrg# ----------------------------
31da2777aaSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32da2777aaSmrg# generated from the m4 files accompanying Automake X.Y.
33da2777aaSmrg# (This private macro should not be called outside this file.)
34da2777aaSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35da2777aaSmrg[am__api_version='1.16'
36da2777aaSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37da2777aaSmrgdnl require some minimum version.  Point them to the right macro.
38da2777aaSmrgm4_if([$1], [1.16.5], [],
39da2777aaSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40da2777aaSmrg])
4155acc8fcSmrg
42da2777aaSmrg# _AM_AUTOCONF_VERSION(VERSION)
43da2777aaSmrg# -----------------------------
44da2777aaSmrg# aclocal traces this macro to find the Autoconf version.
45da2777aaSmrg# This is a private macro too.  Using m4_define simplifies
46da2777aaSmrg# the logic in aclocal, which can simply ignore this definition.
47da2777aaSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48d63fdb69Smrg
49da2777aaSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50da2777aaSmrg# -------------------------------
51da2777aaSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52da2777aaSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53da2777aaSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54da2777aaSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55da2777aaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
56da2777aaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57da2777aaSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5852fd71cdSmrg
59da2777aaSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60d63fdb69Smrg
61da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62da2777aaSmrg#
63da2777aaSmrg# This file is free software; the Free Software Foundation
64da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
65da2777aaSmrg# with or without modifications, as long as this notice is preserved.
6643d802faSmrg
67da2777aaSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68da2777aaSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69da2777aaSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7052fd71cdSmrg#
71da2777aaSmrg# Of course, Automake must honor this variable whenever it calls a
72da2777aaSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73da2777aaSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74da2777aaSmrg# depending on how configure is run.  This is pretty annoying, since
75da2777aaSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76da2777aaSmrg# source directory, any form will work fine, but in subdirectories a
77da2777aaSmrg# relative path needs to be adjusted first.
7852fd71cdSmrg#
79da2777aaSmrg# $ac_aux_dir/missing
80da2777aaSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81da2777aaSmrg# $top_srcdir/$ac_aux_dir/missing
82da2777aaSmrg#    fails if $ac_aux_dir is absolute,
83da2777aaSmrg#    fails when called from a subdirectory in a VPATH build with
84da2777aaSmrg#          a relative $ac_aux_dir
8552fd71cdSmrg#
86da2777aaSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87da2777aaSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
88da2777aaSmrg# harmless because $srcdir is '.', but things will broke when you
89da2777aaSmrg# start a VPATH build or use an absolute $srcdir.
9052fd71cdSmrg#
91da2777aaSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92da2777aaSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93da2777aaSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94da2777aaSmrg# and then we would define $MISSING as
95da2777aaSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96da2777aaSmrg# This will work as long as MISSING is not called from configure, because
97da2777aaSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98da2777aaSmrg# However there are other variables, like CC, which are often used in
99da2777aaSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10052fd71cdSmrg#
101da2777aaSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102da2777aaSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103da2777aaSmrg# configured tree to be moved without reconfiguration.
104da2777aaSmrg
105da2777aaSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106da2777aaSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107da2777aaSmrg# Expand $ac_aux_dir to an absolute path.
108da2777aaSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10943d802faSmrg])
11052fd71cdSmrg
111da2777aaSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11252fd71cdSmrg
113da2777aaSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114da2777aaSmrg#
115da2777aaSmrg# This file is free software; the Free Software Foundation
116da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
117da2777aaSmrg# with or without modifications, as long as this notice is preserved.
11852fd71cdSmrg
119da2777aaSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120da2777aaSmrg# -------------------------------------
121da2777aaSmrg# Define a conditional.
122da2777aaSmrgAC_DEFUN([AM_CONDITIONAL],
123da2777aaSmrg[AC_PREREQ([2.52])dnl
124da2777aaSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125da2777aaSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126da2777aaSmrgAC_SUBST([$1_TRUE])dnl
127da2777aaSmrgAC_SUBST([$1_FALSE])dnl
128da2777aaSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129da2777aaSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130da2777aaSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131da2777aaSmrgif $2; then
132da2777aaSmrg  $1_TRUE=
133da2777aaSmrg  $1_FALSE='#'
134da2777aaSmrgelse
135da2777aaSmrg  $1_TRUE='#'
136da2777aaSmrg  $1_FALSE=
137da2777aaSmrgfi
138da2777aaSmrgAC_CONFIG_COMMANDS_PRE(
139da2777aaSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140da2777aaSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141da2777aaSmrgUsually this means the macro was only invoked conditionally.]])
142da2777aaSmrgfi])])
14352fd71cdSmrg
144da2777aaSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14543d802faSmrg#
146da2777aaSmrg# This file is free software; the Free Software Foundation
147da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
148da2777aaSmrg# with or without modifications, as long as this notice is preserved.
14952fd71cdSmrg
1503da084b3Smrg
151da2777aaSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152da2777aaSmrg# written in clear, in which case automake, when reading aclocal.m4,
153da2777aaSmrg# will think it sees a *use*, and therefore will trigger all it's
154da2777aaSmrg# C support machinery.  Also note that it means that autoscan, seeing
155da2777aaSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156d63fdb69Smrg
157e1c0d025Smrg
158da2777aaSmrg# _AM_DEPENDENCIES(NAME)
159da2777aaSmrg# ----------------------
160da2777aaSmrg# See how the compiler implements dependency checking.
161da2777aaSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162da2777aaSmrg# We try a few techniques and use that to set a single cache variable.
16343d802faSmrg#
164da2777aaSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165da2777aaSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166da2777aaSmrg# dependency, and given that the user is not expected to run this macro,
167da2777aaSmrg# just rely on AC_PROG_CC.
168da2777aaSmrgAC_DEFUN([_AM_DEPENDENCIES],
169da2777aaSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170da2777aaSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171da2777aaSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172da2777aaSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1733da084b3Smrg
174da2777aaSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175da2777aaSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176da2777aaSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177da2777aaSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178da2777aaSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179da2777aaSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180da2777aaSmrg                    [depcc="$$1"   am_compiler_list=])
1813da084b3Smrg
182da2777aaSmrgAC_CACHE_CHECK([dependency style of $depcc],
183da2777aaSmrg               [am_cv_$1_dependencies_compiler_type],
184da2777aaSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185da2777aaSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
186da2777aaSmrg  # making bogus files that we don't know about and never remove.  For
187da2777aaSmrg  # instance it was reported that on HP-UX the gcc test will end up
188da2777aaSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189da2777aaSmrg  # in D".
190da2777aaSmrg  rm -rf conftest.dir
191da2777aaSmrg  mkdir conftest.dir
192da2777aaSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193da2777aaSmrg  # using a relative directory.
194da2777aaSmrg  cp "$am_depcomp" conftest.dir
195da2777aaSmrg  cd conftest.dir
196da2777aaSmrg  # We will build objects and dependencies in a subdirectory because
197da2777aaSmrg  # it helps to detect inapplicable dependency modes.  For instance
198da2777aaSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199da2777aaSmrg  # side effect of compilation, but ICC will put the dependencies in
200da2777aaSmrg  # the current directory while Tru64 will put them in the object
201da2777aaSmrg  # directory.
202da2777aaSmrg  mkdir sub
203e1c0d025Smrg
204da2777aaSmrg  am_cv_$1_dependencies_compiler_type=none
205da2777aaSmrg  if test "$am_compiler_list" = ""; then
206da2777aaSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207da2777aaSmrg  fi
208da2777aaSmrg  am__universal=false
209da2777aaSmrg  m4_case([$1], [CC],
210da2777aaSmrg    [case " $depcc " in #(
211da2777aaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212da2777aaSmrg     esac],
213da2777aaSmrg    [CXX],
214da2777aaSmrg    [case " $depcc " in #(
215da2777aaSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216da2777aaSmrg     esac])
217e1c0d025Smrg
218da2777aaSmrg  for depmode in $am_compiler_list; do
219da2777aaSmrg    # Setup a source with many dependencies, because some compilers
220da2777aaSmrg    # like to wrap large dependency lists on column 80 (with \), and
221da2777aaSmrg    # we should not choose a depcomp mode which is confused by this.
222da2777aaSmrg    #
223da2777aaSmrg    # We need to recreate these files for each test, as the compiler may
224da2777aaSmrg    # overwrite some of them when testing with obscure command lines.
225da2777aaSmrg    # This happens at least with the AIX C compiler.
226da2777aaSmrg    : > sub/conftest.c
227da2777aaSmrg    for i in 1 2 3 4 5 6; do
228da2777aaSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229da2777aaSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230da2777aaSmrg      # Solaris 10 /bin/sh.
231da2777aaSmrg      echo '/* dummy */' > sub/conftst$i.h
232da2777aaSmrg    done
233da2777aaSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2343da084b3Smrg
235da2777aaSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236da2777aaSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237da2777aaSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238da2777aaSmrg    # versions had trouble with output in subdirs.
239da2777aaSmrg    am__obj=sub/conftest.${OBJEXT-o}
240da2777aaSmrg    am__minus_obj="-o $am__obj"
241da2777aaSmrg    case $depmode in
242da2777aaSmrg    gcc)
243da2777aaSmrg      # This depmode causes a compiler race in universal mode.
244da2777aaSmrg      test "$am__universal" = false || continue
245da2777aaSmrg      ;;
246da2777aaSmrg    nosideeffect)
247da2777aaSmrg      # After this tag, mechanisms are not by side-effect, so they'll
248da2777aaSmrg      # only be used when explicitly requested.
249da2777aaSmrg      if test "x$enable_dependency_tracking" = xyes; then
250da2777aaSmrg	continue
251da2777aaSmrg      else
252da2777aaSmrg	break
253da2777aaSmrg      fi
254da2777aaSmrg      ;;
255da2777aaSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256da2777aaSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
257da2777aaSmrg      # not run yet.  These depmodes are late enough in the game, and
258da2777aaSmrg      # so weak that their functioning should not be impacted.
259da2777aaSmrg      am__obj=conftest.${OBJEXT-o}
260da2777aaSmrg      am__minus_obj=
261da2777aaSmrg      ;;
262da2777aaSmrg    none) break ;;
263da2777aaSmrg    esac
264da2777aaSmrg    if depmode=$depmode \
265da2777aaSmrg       source=sub/conftest.c object=$am__obj \
266da2777aaSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267da2777aaSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268da2777aaSmrg         >/dev/null 2>conftest.err &&
269da2777aaSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270da2777aaSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271da2777aaSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272da2777aaSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273da2777aaSmrg      # icc doesn't choke on unknown options, it will just issue warnings
274da2777aaSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
275da2777aaSmrg      # that says an option was ignored or not supported.
276da2777aaSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277da2777aaSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278da2777aaSmrg      # The diagnosis changed in icc 8.0:
279da2777aaSmrg      #   icc: Command line remark: option '-MP' not supported
280da2777aaSmrg      if (grep 'ignoring option' conftest.err ||
281da2777aaSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282da2777aaSmrg        am_cv_$1_dependencies_compiler_type=$depmode
283da2777aaSmrg        break
284da2777aaSmrg      fi
285da2777aaSmrg    fi
286da2777aaSmrg  done
2873da084b3Smrg
288da2777aaSmrg  cd ..
289da2777aaSmrg  rm -rf conftest.dir
290da2777aaSmrgelse
291da2777aaSmrg  am_cv_$1_dependencies_compiler_type=none
292da2777aaSmrgfi
293da2777aaSmrg])
294da2777aaSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295da2777aaSmrgAM_CONDITIONAL([am__fastdep$1], [
296da2777aaSmrg  test "x$enable_dependency_tracking" != xno \
297da2777aaSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298da2777aaSmrg])
29943d802faSmrg
30043d802faSmrg
301da2777aaSmrg# AM_SET_DEPDIR
302da2777aaSmrg# -------------
303da2777aaSmrg# Choose a directory name for dependency files.
304da2777aaSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305da2777aaSmrgAC_DEFUN([AM_SET_DEPDIR],
306da2777aaSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307da2777aaSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30852fd71cdSmrg])
3093da084b3Smrg
3103da084b3Smrg
311da2777aaSmrg# AM_DEP_TRACK
312da2777aaSmrg# ------------
313da2777aaSmrgAC_DEFUN([AM_DEP_TRACK],
314da2777aaSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315da2777aaSmrgAS_HELP_STRING(
316da2777aaSmrg  [--enable-dependency-tracking],
317da2777aaSmrg  [do not reject slow dependency extractors])
318da2777aaSmrgAS_HELP_STRING(
319da2777aaSmrg  [--disable-dependency-tracking],
320da2777aaSmrg  [speeds up one-time build])])
321da2777aaSmrgif test "x$enable_dependency_tracking" != xno; then
322da2777aaSmrg  am_depcomp="$ac_aux_dir/depcomp"
323da2777aaSmrg  AMDEPBACKSLASH='\'
324da2777aaSmrg  am__nodep='_no'
325da2777aaSmrgfi
326da2777aaSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327da2777aaSmrgAC_SUBST([AMDEPBACKSLASH])dnl
328da2777aaSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329da2777aaSmrgAC_SUBST([am__nodep])dnl
330da2777aaSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3312a53b785Smrg])
332d63fdb69Smrg
333da2777aaSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334d63fdb69Smrg
335da2777aaSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33643d802faSmrg#
337da2777aaSmrg# This file is free software; the Free Software Foundation
338da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
339da2777aaSmrg# with or without modifications, as long as this notice is preserved.
340d63fdb69Smrg
341da2777aaSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342da2777aaSmrg# ------------------------------
343da2777aaSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344da2777aaSmrg[{
345da2777aaSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
346da2777aaSmrg  # are listed without --file.  Let's play safe and only enable the eval
347da2777aaSmrg  # if we detect the quoting.
348da2777aaSmrg  # TODO: see whether this extra hack can be removed once we start
349da2777aaSmrg  # requiring Autoconf 2.70 or later.
350da2777aaSmrg  AS_CASE([$CONFIG_FILES],
351da2777aaSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352da2777aaSmrg          [*], [set x $CONFIG_FILES])
353da2777aaSmrg  shift
354da2777aaSmrg  # Used to flag and report bootstrapping failures.
355da2777aaSmrg  am_rc=0
356da2777aaSmrg  for am_mf
357da2777aaSmrg  do
358da2777aaSmrg    # Strip MF so we end up with the name of the file.
359da2777aaSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360da2777aaSmrg    # Check whether this is an Automake generated Makefile which includes
361da2777aaSmrg    # dependency-tracking related rules and includes.
362da2777aaSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363da2777aaSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364da2777aaSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365da2777aaSmrg      || continue
366da2777aaSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367da2777aaSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368da2777aaSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369da2777aaSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370da2777aaSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371da2777aaSmrg  done
372da2777aaSmrg  if test $am_rc -ne 0; then
373da2777aaSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374da2777aaSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375da2777aaSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376da2777aaSmrg    necessary).  You can also try re-running configure with the
377da2777aaSmrg    '--disable-dependency-tracking' option to at least be able to build
378da2777aaSmrg    the package (albeit without support for automatic dependency tracking).])
379da2777aaSmrg  fi
380da2777aaSmrg  AS_UNSET([am_dirpart])
381da2777aaSmrg  AS_UNSET([am_filepart])
382da2777aaSmrg  AS_UNSET([am_mf])
383da2777aaSmrg  AS_UNSET([am_rc])
384da2777aaSmrg  rm -f conftest-deps.mk
385da2777aaSmrg}
386da2777aaSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3873da084b3Smrg
3883da084b3Smrg
389da2777aaSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390da2777aaSmrg# -----------------------------
391da2777aaSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39243d802faSmrg#
393da2777aaSmrg# This code is only required when automatic dependency tracking is enabled.
394da2777aaSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395da2777aaSmrg# order to bootstrap the dependency handling code.
396da2777aaSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397da2777aaSmrg[AC_CONFIG_COMMANDS([depfiles],
398da2777aaSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399da2777aaSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4002a53b785Smrg
401da2777aaSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4022a53b785Smrg
403da2777aaSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404da2777aaSmrg#
405da2777aaSmrg# This file is free software; the Free Software Foundation
406da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
407da2777aaSmrg# with or without modifications, as long as this notice is preserved.
4083da084b3Smrg
409da2777aaSmrg# This macro actually does too much.  Some checks are only needed if
410da2777aaSmrg# your package does certain things.  But this isn't really a big deal.
4113da084b3Smrg
412da2777aaSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413da2777aaSmrgm4_define([AC_PROG_CC],
414da2777aaSmrgm4_defn([AC_PROG_CC])
415da2777aaSmrg[_AM_PROG_CC_C_O
41643d802faSmrg])
4173da084b3Smrg
418da2777aaSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419da2777aaSmrg# AM_INIT_AUTOMAKE([OPTIONS])
420da2777aaSmrg# -----------------------------------------------
421da2777aaSmrg# The call with PACKAGE and VERSION arguments is the old style
422da2777aaSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423da2777aaSmrg# and VERSION should now be passed to AC_INIT and removed from
424da2777aaSmrg# the call to AM_INIT_AUTOMAKE.
425da2777aaSmrg# We support both call styles for the transition.  After
426da2777aaSmrg# the next Automake release, Autoconf can make the AC_INIT
427da2777aaSmrg# arguments mandatory, and then we can depend on a new Autoconf
428da2777aaSmrg# release and drop the old call support.
429da2777aaSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430da2777aaSmrg[AC_PREREQ([2.65])dnl
431da2777aaSmrgm4_ifdef([_$0_ALREADY_INIT],
432da2777aaSmrg  [m4_fatal([$0 expanded multiple times
433da2777aaSmrg]m4_defn([_$0_ALREADY_INIT]))],
434da2777aaSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435da2777aaSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436da2777aaSmrgdnl the ones we care about.
437da2777aaSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438da2777aaSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439da2777aaSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440da2777aaSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441da2777aaSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442da2777aaSmrg  # is not polluted with repeated "-I."
443da2777aaSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444da2777aaSmrg  # test to see if srcdir already configured
445da2777aaSmrg  if test -f $srcdir/config.status; then
446da2777aaSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447da2777aaSmrg  fi
44843d802faSmrgfi
449e1c0d025Smrg
450da2777aaSmrg# test whether we have cygpath
451da2777aaSmrgif test -z "$CYGPATH_W"; then
452da2777aaSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453da2777aaSmrg    CYGPATH_W='cygpath -w'
454da2777aaSmrg  else
455da2777aaSmrg    CYGPATH_W=echo
45643d802faSmrg  fi
457da2777aaSmrgfi
458da2777aaSmrgAC_SUBST([CYGPATH_W])
45955acc8fcSmrg
460da2777aaSmrg# Define the identity of the package.
461da2777aaSmrgdnl Distinguish between old-style and new-style calls.
462da2777aaSmrgm4_ifval([$2],
463da2777aaSmrg[AC_DIAGNOSE([obsolete],
464da2777aaSmrg             [$0: two- and three-arguments forms are deprecated.])
465da2777aaSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466da2777aaSmrg AC_SUBST([PACKAGE], [$1])dnl
467da2777aaSmrg AC_SUBST([VERSION], [$2])],
468da2777aaSmrg[_AM_SET_OPTIONS([$1])dnl
469da2777aaSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470da2777aaSmrgm4_if(
471da2777aaSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472da2777aaSmrg  [ok:ok],,
473da2777aaSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474da2777aaSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475da2777aaSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4763da084b3Smrg
477da2777aaSmrg_AM_IF_OPTION([no-define],,
478da2777aaSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479da2777aaSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4803da084b3Smrg
481da2777aaSmrg# Some tools Automake needs.
482da2777aaSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483da2777aaSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484da2777aaSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485da2777aaSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486da2777aaSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487da2777aaSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488da2777aaSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489da2777aaSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490da2777aaSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491da2777aaSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492da2777aaSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
493da2777aaSmrg# dies out for good.  For more background, see:
494da2777aaSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495da2777aaSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496da2777aaSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497da2777aaSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498da2777aaSmrg# system "awk" is bad on some platforms.
499da2777aaSmrgAC_REQUIRE([AC_PROG_AWK])dnl
500da2777aaSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501da2777aaSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502da2777aaSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503da2777aaSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504da2777aaSmrg			     [_AM_PROG_TAR([v7])])])
505da2777aaSmrg_AM_IF_OPTION([no-dependencies],,
506da2777aaSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507da2777aaSmrg		  [_AM_DEPENDENCIES([CC])],
508da2777aaSmrg		  [m4_define([AC_PROG_CC],
509da2777aaSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510da2777aaSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511da2777aaSmrg		  [_AM_DEPENDENCIES([CXX])],
512da2777aaSmrg		  [m4_define([AC_PROG_CXX],
513da2777aaSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514da2777aaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515da2777aaSmrg		  [_AM_DEPENDENCIES([OBJC])],
516da2777aaSmrg		  [m4_define([AC_PROG_OBJC],
517da2777aaSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518da2777aaSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519da2777aaSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
520da2777aaSmrg		  [m4_define([AC_PROG_OBJCXX],
521da2777aaSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52243d802faSmrg])
523da2777aaSmrg# Variables for tags utilities; see am/tags.am
524da2777aaSmrgif test -z "$CTAGS"; then
525da2777aaSmrg  CTAGS=ctags
526da2777aaSmrgfi
527da2777aaSmrgAC_SUBST([CTAGS])
528da2777aaSmrgif test -z "$ETAGS"; then
529da2777aaSmrg  ETAGS=etags
530da2777aaSmrgfi
531da2777aaSmrgAC_SUBST([ETAGS])
532da2777aaSmrgif test -z "$CSCOPE"; then
533da2777aaSmrg  CSCOPE=cscope
534da2777aaSmrgfi
535da2777aaSmrgAC_SUBST([CSCOPE])
5363da084b3Smrg
537da2777aaSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538da2777aaSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
539da2777aaSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540da2777aaSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541da2777aaSmrgAC_CONFIG_COMMANDS_PRE(dnl
542da2777aaSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543da2777aaSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544d63fdb69Smrg
545da2777aaSmrg# POSIX will say in a future version that running "rm -f" with no argument
546da2777aaSmrg# is OK; and we want to be able to make that assumption in our Makefile
547da2777aaSmrg# recipes.  So use an aggressive probe to check that the usage we want is
548da2777aaSmrg# actually supported "in the wild" to an acceptable degree.
549da2777aaSmrg# See automake bug#10828.
550da2777aaSmrg# To make any issue more visible, cause the running configure to be aborted
551da2777aaSmrg# by default if the 'rm' program in use doesn't match our expectations; the
552da2777aaSmrg# user can still override this though.
553da2777aaSmrgif rm -f && rm -fr && rm -rf; then : OK; else
554da2777aaSmrg  cat >&2 <<'END'
555da2777aaSmrgOops!
55648c85eb7Smrg
557da2777aaSmrgYour 'rm' program seems unable to run without file operands specified
558da2777aaSmrgon the command line, even when the '-f' option is present.  This is contrary
559da2777aaSmrgto the behaviour of most rm programs out there, and not conforming with
560da2777aaSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56148c85eb7Smrg
562da2777aaSmrgPlease tell bug-automake@gnu.org about your system, including the value
563da2777aaSmrgof your $PATH and any error possibly output before this message.  This
564da2777aaSmrgcan help us improve future automake versions.
56548c85eb7Smrg
566da2777aaSmrgEND
567da2777aaSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568da2777aaSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569da2777aaSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570da2777aaSmrg    echo >&2
571da2777aaSmrg  else
572da2777aaSmrg    cat >&2 <<'END'
573da2777aaSmrgAborting the configuration process, to ensure you take notice of the issue.
5743da084b3Smrg
575da2777aaSmrgYou can download and install GNU coreutils to get an 'rm' implementation
576da2777aaSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5773da084b3Smrg
578da2777aaSmrgIf you want to complete the configuration process using your problematic
579da2777aaSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580da2777aaSmrgto "yes", and re-run configure.
58155acc8fcSmrg
582da2777aaSmrgEND
583da2777aaSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584da2777aaSmrg  fi
585da2777aaSmrgfi
586da2777aaSmrgdnl The trailing newline in this macro's definition is deliberate, for
587da2777aaSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588da2777aaSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58943d802faSmrg])
5903da084b3Smrg
591da2777aaSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592da2777aaSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593da2777aaSmrgdnl mangled by Autoconf and run in a shell conditional statement.
594da2777aaSmrgm4_define([_AC_COMPILER_EXEEXT],
595da2777aaSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5963da084b3Smrg
597da2777aaSmrg# When config.status generates a header, we must update the stamp-h file.
598da2777aaSmrg# This file resides in the same directory as the config header
599da2777aaSmrg# that is generated.  The stamp files are numbered to have different names.
60055acc8fcSmrg
601da2777aaSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602da2777aaSmrg# loop where config.status creates the headers, so we can generate
603da2777aaSmrg# our stamp files there.
604da2777aaSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605da2777aaSmrg[# Compute $1's index in $config_headers.
606da2777aaSmrg_am_arg=$1
607da2777aaSmrg_am_stamp_count=1
608da2777aaSmrgfor _am_header in $config_headers :; do
609da2777aaSmrg  case $_am_header in
610da2777aaSmrg    $_am_arg | $_am_arg:* )
611da2777aaSmrg      break ;;
612da2777aaSmrg    * )
613da2777aaSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614da2777aaSmrg  esac
615da2777aaSmrgdone
616da2777aaSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6173da084b3Smrg
618da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619da2777aaSmrg#
620da2777aaSmrg# This file is free software; the Free Software Foundation
621da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
622da2777aaSmrg# with or without modifications, as long as this notice is preserved.
62355acc8fcSmrg
624da2777aaSmrg# AM_PROG_INSTALL_SH
625da2777aaSmrg# ------------------
626da2777aaSmrg# Define $install_sh.
627da2777aaSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628da2777aaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629da2777aaSmrgif test x"${install_sh+set}" != xset; then
630da2777aaSmrg  case $am_aux_dir in
631da2777aaSmrg  *\ * | *\	*)
632da2777aaSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633da2777aaSmrg  *)
634da2777aaSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635da2777aaSmrg  esac
636da2777aaSmrgfi
637da2777aaSmrgAC_SUBST([install_sh])])
6383da084b3Smrg
639da2777aaSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640da2777aaSmrg#
641da2777aaSmrg# This file is free software; the Free Software Foundation
642da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
643da2777aaSmrg# with or without modifications, as long as this notice is preserved.
64455acc8fcSmrg
645da2777aaSmrg# Check whether the underlying file-system supports filenames
646da2777aaSmrg# with a leading dot.  For instance MS-DOS doesn't.
647da2777aaSmrgAC_DEFUN([AM_SET_LEADING_DOT],
648da2777aaSmrg[rm -rf .tst 2>/dev/null
649da2777aaSmrgmkdir .tst 2>/dev/null
650da2777aaSmrgif test -d .tst; then
651da2777aaSmrg  am__leading_dot=.
652da2777aaSmrgelse
653da2777aaSmrg  am__leading_dot=_
654da2777aaSmrgfi
655da2777aaSmrgrmdir .tst 2>/dev/null
656da2777aaSmrgAC_SUBST([am__leading_dot])])
65755acc8fcSmrg
658da2777aaSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6593da084b3Smrg
660da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661da2777aaSmrg#
662da2777aaSmrg# This file is free software; the Free Software Foundation
663da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
664da2777aaSmrg# with or without modifications, as long as this notice is preserved.
6653da084b3Smrg
666da2777aaSmrg# AM_MAKE_INCLUDE()
667da2777aaSmrg# -----------------
668da2777aaSmrg# Check whether make has an 'include' directive that can support all
669da2777aaSmrg# the idioms we need for our automatic dependency tracking code.
670da2777aaSmrgAC_DEFUN([AM_MAKE_INCLUDE],
671da2777aaSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672da2777aaSmrgcat > confinc.mk << 'END'
673da2777aaSmrgam__doit:
674da2777aaSmrg	@echo this is the am__doit target >confinc.out
675da2777aaSmrg.PHONY: am__doit
676da2777aaSmrgEND
677da2777aaSmrgam__include="#"
678da2777aaSmrgam__quote=
679da2777aaSmrg# BSD make does it like this.
680da2777aaSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681da2777aaSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682da2777aaSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683da2777aaSmrg_am_result=no
684da2777aaSmrgfor s in GNU BSD; do
685da2777aaSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686da2777aaSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687da2777aaSmrg      ['0:this is the am__doit target'],
688da2777aaSmrg      [AS_CASE([$s],
689da2777aaSmrg          [BSD], [am__include='.include' am__quote='"'],
690da2777aaSmrg          [am__include='include' am__quote=''])])
691da2777aaSmrg  if test "$am__include" != "#"; then
692da2777aaSmrg    _am_result="yes ($s style)"
693da2777aaSmrg    break
694da2777aaSmrg  fi
695da2777aaSmrgdone
696da2777aaSmrgrm -f confinc.* confmf.*
697da2777aaSmrgAC_MSG_RESULT([${_am_result}])
698da2777aaSmrgAC_SUBST([am__include])])
699da2777aaSmrgAC_SUBST([am__quote])])
7003da084b3Smrg
701da2777aaSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7023da084b3Smrg
703da2777aaSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704da2777aaSmrg#
705da2777aaSmrg# This file is free software; the Free Software Foundation
706da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
707da2777aaSmrg# with or without modifications, as long as this notice is preserved.
7083da084b3Smrg
709da2777aaSmrg# AM_MISSING_PROG(NAME, PROGRAM)
710da2777aaSmrg# ------------------------------
711da2777aaSmrgAC_DEFUN([AM_MISSING_PROG],
712da2777aaSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713da2777aaSmrg$1=${$1-"${am_missing_run}$2"}
714da2777aaSmrgAC_SUBST($1)])
7153da084b3Smrg
716da2777aaSmrg# AM_MISSING_HAS_RUN
717da2777aaSmrg# ------------------
718da2777aaSmrg# Define MISSING if not defined so far and test if it is modern enough.
719da2777aaSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720da2777aaSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721da2777aaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722da2777aaSmrgAC_REQUIRE_AUX_FILE([missing])dnl
723da2777aaSmrgif test x"${MISSING+set}" != xset; then
724da2777aaSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725da2777aaSmrgfi
726da2777aaSmrg# Use eval to expand $SHELL
727da2777aaSmrgif eval "$MISSING --is-lightweight"; then
728da2777aaSmrg  am_missing_run="$MISSING "
729da2777aaSmrgelse
730da2777aaSmrg  am_missing_run=
731da2777aaSmrg  AC_MSG_WARN(['missing' script is too old or missing])
732da2777aaSmrgfi
73343d802faSmrg])
7343da084b3Smrg
735da2777aaSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7363da084b3Smrg
737da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73843d802faSmrg#
739da2777aaSmrg# This file is free software; the Free Software Foundation
740da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
741da2777aaSmrg# with or without modifications, as long as this notice is preserved.
7423da084b3Smrg
743da2777aaSmrg# _AM_MANGLE_OPTION(NAME)
74443d802faSmrg# -----------------------
745da2777aaSmrgAC_DEFUN([_AM_MANGLE_OPTION],
746da2777aaSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7473da084b3Smrg
748da2777aaSmrg# _AM_SET_OPTION(NAME)
749da2777aaSmrg# --------------------
750da2777aaSmrg# Set option NAME.  Presently that only means defining a flag for this option.
751da2777aaSmrgAC_DEFUN([_AM_SET_OPTION],
752da2777aaSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7532a53b785Smrg
754da2777aaSmrg# _AM_SET_OPTIONS(OPTIONS)
755da2777aaSmrg# ------------------------
756da2777aaSmrg# OPTIONS is a space-separated list of Automake options.
757da2777aaSmrgAC_DEFUN([_AM_SET_OPTIONS],
758da2777aaSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7593da084b3Smrg
760da2777aaSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761da2777aaSmrg# -------------------------------------------
762da2777aaSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763da2777aaSmrgAC_DEFUN([_AM_IF_OPTION],
764da2777aaSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765d63fdb69Smrg
766da2777aaSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767da2777aaSmrg#
768da2777aaSmrg# This file is free software; the Free Software Foundation
769da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
770da2777aaSmrg# with or without modifications, as long as this notice is preserved.
7713da084b3Smrg
772da2777aaSmrg# _AM_PROG_CC_C_O
77343d802faSmrg# ---------------
774da2777aaSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775da2777aaSmrg# to automatically call this.
776da2777aaSmrgAC_DEFUN([_AM_PROG_CC_C_O],
777da2777aaSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778da2777aaSmrgAC_REQUIRE_AUX_FILE([compile])dnl
779da2777aaSmrgAC_LANG_PUSH([C])dnl
780da2777aaSmrgAC_CACHE_CHECK(
781da2777aaSmrg  [whether $CC understands -c and -o together],
782da2777aaSmrg  [am_cv_prog_cc_c_o],
783da2777aaSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784da2777aaSmrg  # Make sure it works both with $CC and with simple cc.
785da2777aaSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786da2777aaSmrg  # compilers refuse to overwrite an existing .o file with -o,
787da2777aaSmrg  # though they will create one.
788da2777aaSmrg  am_cv_prog_cc_c_o=yes
789da2777aaSmrg  for am_i in 1 2; do
790da2777aaSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791da2777aaSmrg         && test -f conftest2.$ac_objext; then
792da2777aaSmrg      : OK
793da2777aaSmrg    else
794da2777aaSmrg      am_cv_prog_cc_c_o=no
795da2777aaSmrg      break
79643d802faSmrg    fi
797da2777aaSmrg  done
798da2777aaSmrg  rm -f core conftest*
799da2777aaSmrg  unset am_i])
800da2777aaSmrgif test "$am_cv_prog_cc_c_o" != yes; then
801da2777aaSmrg   # Losing compiler, so override with the script.
802da2777aaSmrg   # FIXME: It is wrong to rewrite CC.
803da2777aaSmrg   # But if we don't then we get into trouble of one sort or another.
804da2777aaSmrg   # A longer-term fix would be to have automake use am__CC in this case,
805da2777aaSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806da2777aaSmrg   CC="$am_aux_dir/compile $CC"
807da2777aaSmrgfi
808da2777aaSmrgAC_LANG_POP([C])])
8093da084b3Smrg
810da2777aaSmrg# For backward compatibility.
811da2777aaSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8123da084b3Smrg
813da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814da2777aaSmrg#
815da2777aaSmrg# This file is free software; the Free Software Foundation
816da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
817da2777aaSmrg# with or without modifications, as long as this notice is preserved.
8183da084b3Smrg
819da2777aaSmrg# AM_RUN_LOG(COMMAND)
820da2777aaSmrg# -------------------
821da2777aaSmrg# Run COMMAND, save the exit status in ac_status, and log it.
822da2777aaSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823da2777aaSmrgAC_DEFUN([AM_RUN_LOG],
824da2777aaSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825da2777aaSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826da2777aaSmrg   ac_status=$?
827da2777aaSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828da2777aaSmrg   (exit $ac_status); }])
8293da084b3Smrg
830da2777aaSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8313da084b3Smrg
832da2777aaSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833da2777aaSmrg#
834da2777aaSmrg# This file is free software; the Free Software Foundation
835da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
836da2777aaSmrg# with or without modifications, as long as this notice is preserved.
8373da084b3Smrg
838da2777aaSmrg# AM_SANITY_CHECK
839da2777aaSmrg# ---------------
840da2777aaSmrgAC_DEFUN([AM_SANITY_CHECK],
841da2777aaSmrg[AC_MSG_CHECKING([whether build environment is sane])
842da2777aaSmrg# Reject unsafe characters in $srcdir or the absolute working directory
843da2777aaSmrg# name.  Accept space and tab only in the latter.
844da2777aaSmrgam_lf='
845da2777aaSmrg'
846da2777aaSmrgcase `pwd` in
847da2777aaSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848da2777aaSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849da2777aaSmrgesac
850da2777aaSmrgcase $srcdir in
851da2777aaSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852da2777aaSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853da2777aaSmrgesac
8543da084b3Smrg
855da2777aaSmrg# Do 'set' in a subshell so we don't clobber the current shell's
856da2777aaSmrg# arguments.  Must try -L first in case configure is actually a
857da2777aaSmrg# symlink; some systems play weird games with the mod time of symlinks
858da2777aaSmrg# (eg FreeBSD returns the mod time of the symlink's containing
859da2777aaSmrg# directory).
860da2777aaSmrgif (
861da2777aaSmrg   am_has_slept=no
862da2777aaSmrg   for am_try in 1 2; do
863da2777aaSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864da2777aaSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865da2777aaSmrg     if test "$[*]" = "X"; then
866da2777aaSmrg	# -L didn't work.
867da2777aaSmrg	set X `ls -t "$srcdir/configure" conftest.file`
868da2777aaSmrg     fi
869da2777aaSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870da2777aaSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871d63fdb69Smrg
872da2777aaSmrg	# If neither matched, then we have a broken ls.  This can happen
873da2777aaSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874da2777aaSmrg	# broken ls alias from the environment.  This has actually
875da2777aaSmrg	# happened.  Such a system could not be considered "sane".
876da2777aaSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877da2777aaSmrg  alias in your environment])
878da2777aaSmrg     fi
879da2777aaSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880da2777aaSmrg       break
881da2777aaSmrg     fi
882da2777aaSmrg     # Just in case.
883da2777aaSmrg     sleep 1
884da2777aaSmrg     am_has_slept=yes
885da2777aaSmrg   done
886da2777aaSmrg   test "$[2]" = conftest.file
887da2777aaSmrg   )
888da2777aaSmrgthen
889da2777aaSmrg   # Ok.
890da2777aaSmrg   :
891da2777aaSmrgelse
892da2777aaSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
893da2777aaSmrgCheck your system clock])
89443d802faSmrgfi
895da2777aaSmrgAC_MSG_RESULT([yes])
896da2777aaSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897da2777aaSmrg# generated files are strictly newer.
898da2777aaSmrgam_sleep_pid=
899da2777aaSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900da2777aaSmrg  ( sleep 1 ) &
901da2777aaSmrg  am_sleep_pid=$!
90248c85eb7Smrgfi
903da2777aaSmrgAC_CONFIG_COMMANDS_PRE(
904da2777aaSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905da2777aaSmrg   if test -n "$am_sleep_pid"; then
906da2777aaSmrg     # Hide warnings about reused PIDs.
907da2777aaSmrg     wait $am_sleep_pid 2>/dev/null
908da2777aaSmrg   fi
909da2777aaSmrg   AC_MSG_RESULT([done])])
910da2777aaSmrgrm -f conftest.file
91143d802faSmrg])
9123da084b3Smrg
913da2777aaSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914da2777aaSmrg#
915da2777aaSmrg# This file is free software; the Free Software Foundation
916da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
917da2777aaSmrg# with or without modifications, as long as this notice is preserved.
9183da084b3Smrg
919da2777aaSmrg# AM_SILENT_RULES([DEFAULT])
920da2777aaSmrg# --------------------------
921da2777aaSmrg# Enable less verbose build rules; with the default set to DEFAULT
922da2777aaSmrg# ("yes" being less verbose, "no" or empty being verbose).
923da2777aaSmrgAC_DEFUN([AM_SILENT_RULES],
924da2777aaSmrg[AC_ARG_ENABLE([silent-rules], [dnl
925da2777aaSmrgAS_HELP_STRING(
926da2777aaSmrg  [--enable-silent-rules],
927da2777aaSmrg  [less verbose build output (undo: "make V=1")])
928da2777aaSmrgAS_HELP_STRING(
929da2777aaSmrg  [--disable-silent-rules],
930da2777aaSmrg  [verbose build output (undo: "make V=0")])dnl
93143d802faSmrg])
932da2777aaSmrgcase $enable_silent_rules in @%:@ (((
933da2777aaSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
934da2777aaSmrg   no) AM_DEFAULT_VERBOSITY=1;;
935da2777aaSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936da2777aaSmrgesac
937da2777aaSmrgdnl
938da2777aaSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939da2777aaSmrgdnl do not support nested variable expansions.
940da2777aaSmrgdnl See automake bug#9928 and bug#10237.
941da2777aaSmrgam_make=${MAKE-make}
942da2777aaSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943da2777aaSmrg   [am_cv_make_support_nested_variables],
944da2777aaSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945da2777aaSmrgBAR0=false
946da2777aaSmrgBAR1=true
947da2777aaSmrgV=1
948da2777aaSmrgam__doit:
949da2777aaSmrg	@$(TRUE)
950da2777aaSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951da2777aaSmrg  am_cv_make_support_nested_variables=yes
9522a53b785Smrgelse
953da2777aaSmrg  am_cv_make_support_nested_variables=no
954da2777aaSmrgfi])
955da2777aaSmrgif test $am_cv_make_support_nested_variables = yes; then
956da2777aaSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957da2777aaSmrg  AM_V='$(V)'
958da2777aaSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959da2777aaSmrgelse
960da2777aaSmrg  AM_V=$AM_DEFAULT_VERBOSITY
961da2777aaSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9622a53b785Smrgfi
963da2777aaSmrgAC_SUBST([AM_V])dnl
964da2777aaSmrgAM_SUBST_NOTMAKE([AM_V])dnl
965da2777aaSmrgAC_SUBST([AM_DEFAULT_V])dnl
966da2777aaSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967da2777aaSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968da2777aaSmrgAM_BACKSLASH='\'
969da2777aaSmrgAC_SUBST([AM_BACKSLASH])dnl
970da2777aaSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971da2777aaSmrg])
9723da084b3Smrg
973da2777aaSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974da2777aaSmrg#
975da2777aaSmrg# This file is free software; the Free Software Foundation
976da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
977da2777aaSmrg# with or without modifications, as long as this notice is preserved.
97843d802faSmrg
979da2777aaSmrg# AM_PROG_INSTALL_STRIP
980da2777aaSmrg# ---------------------
981da2777aaSmrg# One issue with vendor 'install' (even GNU) is that you can't
982da2777aaSmrg# specify the program used to strip binaries.  This is especially
983da2777aaSmrg# annoying in cross-compiling environments, where the build's strip
984da2777aaSmrg# is unlikely to handle the host's binaries.
985da2777aaSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986da2777aaSmrg# always use install-sh in "make install-strip", and initialize
987da2777aaSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
988da2777aaSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989da2777aaSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990da2777aaSmrg# Installed binaries are usually stripped using 'strip' when the user
991da2777aaSmrg# run "make install-strip".  However 'strip' might not be the right
992da2777aaSmrg# tool to use in cross-compilation environments, therefore Automake
993da2777aaSmrg# will honor the 'STRIP' environment variable to overrule this program.
994da2777aaSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995da2777aaSmrgif test "$cross_compiling" != no; then
996da2777aaSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9972a53b785Smrgfi
998da2777aaSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999da2777aaSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10003da084b3Smrg
1001da2777aaSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002da2777aaSmrg#
1003da2777aaSmrg# This file is free software; the Free Software Foundation
1004da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
1005da2777aaSmrg# with or without modifications, as long as this notice is preserved.
10063da084b3Smrg
1007da2777aaSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008da2777aaSmrg# ---------------------------
1009da2777aaSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010da2777aaSmrg# This macro is traced by Automake.
1011da2777aaSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10123da084b3Smrg
1013da2777aaSmrg# AM_SUBST_NOTMAKE(VARIABLE)
1014da2777aaSmrg# --------------------------
1015da2777aaSmrg# Public sister of _AM_SUBST_NOTMAKE.
1016da2777aaSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10173da084b3Smrg
1018da2777aaSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10193da084b3Smrg
1020da2777aaSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021da2777aaSmrg#
1022da2777aaSmrg# This file is free software; the Free Software Foundation
1023da2777aaSmrg# gives unlimited permission to copy and/or distribute it,
1024da2777aaSmrg# with or without modifications, as long as this notice is preserved.
10253da084b3Smrg
1026da2777aaSmrg# _AM_PROG_TAR(FORMAT)
1027da2777aaSmrg# --------------------
1028da2777aaSmrg# Check how to create a tarball in format FORMAT.
1029da2777aaSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030da2777aaSmrg#
1031da2777aaSmrg# Substitute a variable $(am__tar) that is a command
1032da2777aaSmrg# writing to stdout a FORMAT-tarball containing the directory
1033da2777aaSmrg# $tardir.
1034da2777aaSmrg#     tardir=directory && $(am__tar) > result.tar
1035da2777aaSmrg#
1036da2777aaSmrg# Substitute a variable $(am__untar) that extract such
1037da2777aaSmrg# a tarball read from stdin.
1038da2777aaSmrg#     $(am__untar) < result.tar
1039da2777aaSmrg#
1040da2777aaSmrgAC_DEFUN([_AM_PROG_TAR],
1041da2777aaSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042da2777aaSmrg# in the wild :-(  We should find a proper way to deprecate it ...
1043da2777aaSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104448c85eb7Smrg
1045da2777aaSmrg# We'll loop over all known methods to create a tar archive until one works.
1046da2777aaSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104755acc8fcSmrg
1048da2777aaSmrgm4_if([$1], [v7],
1049da2777aaSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10502a53b785Smrg
1051da2777aaSmrg  [m4_case([$1],
1052da2777aaSmrg    [ustar],
1053da2777aaSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054da2777aaSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055da2777aaSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056da2777aaSmrg      # and bug#13588).
1057da2777aaSmrg      am_max_uid=2097151 # 2^21 - 1
1058da2777aaSmrg      am_max_gid=$am_max_uid
1059da2777aaSmrg      # The $UID and $GID variables are not portable, so we need to resort
1060da2777aaSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061da2777aaSmrg      # below are definitely unexpected, so allow the users to see them
1062da2777aaSmrg      # (that is, avoid stderr redirection).
1063da2777aaSmrg      am_uid=`id -u || echo unknown`
1064da2777aaSmrg      am_gid=`id -g || echo unknown`
1065da2777aaSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066da2777aaSmrg      if test $am_uid -le $am_max_uid; then
1067da2777aaSmrg         AC_MSG_RESULT([yes])
1068da2777aaSmrg      else
1069da2777aaSmrg         AC_MSG_RESULT([no])
1070da2777aaSmrg         _am_tools=none
107143d802faSmrg      fi
1072da2777aaSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073da2777aaSmrg      if test $am_gid -le $am_max_gid; then
1074da2777aaSmrg         AC_MSG_RESULT([yes])
1075da2777aaSmrg      else
1076da2777aaSmrg        AC_MSG_RESULT([no])
1077da2777aaSmrg        _am_tools=none
1078da2777aaSmrg      fi],
107955acc8fcSmrg
1080da2777aaSmrg  [pax],
1081da2777aaSmrg    [],
108255acc8fcSmrg
1083da2777aaSmrg  [m4_fatal([Unknown tar format])])
108452fd71cdSmrg
1085da2777aaSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108655acc8fcSmrg
1087da2777aaSmrg  # Go ahead even if we have the value already cached.  We do so because we
1088da2777aaSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089da2777aaSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109043d802faSmrg
1091da2777aaSmrg  for _am_tool in $_am_tools; do
1092da2777aaSmrg    case $_am_tool in
1093da2777aaSmrg    gnutar)
1094da2777aaSmrg      for _am_tar in tar gnutar gtar; do
1095da2777aaSmrg        AM_RUN_LOG([$_am_tar --version]) && break
109643d802faSmrg      done
1097da2777aaSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098da2777aaSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099da2777aaSmrg      am__untar="$_am_tar -xf -"
1100da2777aaSmrg      ;;
1101da2777aaSmrg    plaintar)
1102da2777aaSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103da2777aaSmrg      # ustar tarball either.
1104da2777aaSmrg      (tar --version) >/dev/null 2>&1 && continue
1105da2777aaSmrg      am__tar='tar chf - "$$tardir"'
1106da2777aaSmrg      am__tar_='tar chf - "$tardir"'
1107da2777aaSmrg      am__untar='tar xf -'
1108da2777aaSmrg      ;;
1109da2777aaSmrg    pax)
1110da2777aaSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111da2777aaSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112da2777aaSmrg      am__untar='pax -r'
1113da2777aaSmrg      ;;
1114da2777aaSmrg    cpio)
1115da2777aaSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116da2777aaSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117da2777aaSmrg      am__untar='cpio -i -H $1 -d'
1118da2777aaSmrg      ;;
1119da2777aaSmrg    none)
1120da2777aaSmrg      am__tar=false
1121da2777aaSmrg      am__tar_=false
1122da2777aaSmrg      am__untar=false
1123da2777aaSmrg      ;;
1124da2777aaSmrg    esac
11253da084b3Smrg
1126da2777aaSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127da2777aaSmrg    # and am__untar set.
1128da2777aaSmrg    test -n "${am_cv_prog_tar_$1}" && break
11293da084b3Smrg
1130da2777aaSmrg    # tar/untar a dummy directory, and stop if the command works.
1131da2777aaSmrg    rm -rf conftest.dir
1132da2777aaSmrg    mkdir conftest.dir
1133da2777aaSmrg    echo GrepMe > conftest.dir/file
1134da2777aaSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135da2777aaSmrg    rm -rf conftest.dir
1136da2777aaSmrg    if test -s conftest.tar; then
1137da2777aaSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138da2777aaSmrg      AM_RUN_LOG([cat conftest.dir/file])
1139da2777aaSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140da2777aaSmrg    fi
1141da2777aaSmrg  done
1142da2777aaSmrg  rm -rf conftest.dir
11433da084b3Smrg
1144da2777aaSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145da2777aaSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11463da084b3Smrg
1147da2777aaSmrgAC_SUBST([am__tar])
1148da2777aaSmrgAC_SUBST([am__untar])
1149da2777aaSmrg]) # _AM_PROG_TAR
11503da084b3Smrg
1151da2777aaSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152da2777aaSmrgdnl serial 11 (pkg-config-0.29)
1153da2777aaSmrgdnl
1154da2777aaSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155da2777aaSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156da2777aaSmrgdnl
1157da2777aaSmrgdnl This program is free software; you can redistribute it and/or modify
1158da2777aaSmrgdnl it under the terms of the GNU General Public License as published by
1159da2777aaSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160da2777aaSmrgdnl (at your option) any later version.
1161da2777aaSmrgdnl
1162da2777aaSmrgdnl This program is distributed in the hope that it will be useful, but
1163da2777aaSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164da2777aaSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165da2777aaSmrgdnl General Public License for more details.
1166da2777aaSmrgdnl
1167da2777aaSmrgdnl You should have received a copy of the GNU General Public License
1168da2777aaSmrgdnl along with this program; if not, write to the Free Software
1169da2777aaSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170da2777aaSmrgdnl 02111-1307, USA.
1171da2777aaSmrgdnl
1172da2777aaSmrgdnl As a special exception to the GNU General Public License, if you
1173da2777aaSmrgdnl distribute this file as part of a program that contains a
1174da2777aaSmrgdnl configuration script generated by Autoconf, you may include it under
1175da2777aaSmrgdnl the same distribution terms that you use for the rest of that
1176da2777aaSmrgdnl program.
11773da084b3Smrg
1178da2777aaSmrgdnl PKG_PREREQ(MIN-VERSION)
1179da2777aaSmrgdnl -----------------------
1180da2777aaSmrgdnl Since: 0.29
1181da2777aaSmrgdnl
1182da2777aaSmrgdnl Verify that the version of the pkg-config macros are at least
1183da2777aaSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184da2777aaSmrgdnl installed version of pkg-config, this checks the developer's version
1185da2777aaSmrgdnl of pkg.m4 when generating configure.
1186da2777aaSmrgdnl
1187da2777aaSmrgdnl To ensure that this macro is defined, also add:
1188da2777aaSmrgdnl m4_ifndef([PKG_PREREQ],
1189da2777aaSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190da2777aaSmrgdnl
1191da2777aaSmrgdnl See the "Since" comment for each macro you use to see what version
1192da2777aaSmrgdnl of the macros you require.
1193da2777aaSmrgm4_defun([PKG_PREREQ],
1194da2777aaSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195da2777aaSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196da2777aaSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197da2777aaSmrg])dnl PKG_PREREQ
11983da084b3Smrg
1199da2777aaSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200da2777aaSmrgdnl ----------------------------------
1201da2777aaSmrgdnl Since: 0.16
1202da2777aaSmrgdnl
1203da2777aaSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204da2777aaSmrgdnl first found in the path. Checks that the version of pkg-config found
1205da2777aaSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206da2777aaSmrgdnl used since that's the first version where most current features of
1207da2777aaSmrgdnl pkg-config existed.
1208da2777aaSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209da2777aaSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210da2777aaSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211da2777aaSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212da2777aaSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213da2777aaSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214da2777aaSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12153da084b3Smrg
1216da2777aaSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217da2777aaSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121843d802faSmrgfi
1219da2777aaSmrgif test -n "$PKG_CONFIG"; then
1220da2777aaSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221da2777aaSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222da2777aaSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223da2777aaSmrg		AC_MSG_RESULT([yes])
1224da2777aaSmrg	else
1225da2777aaSmrg		AC_MSG_RESULT([no])
1226da2777aaSmrg		PKG_CONFIG=""
1227da2777aaSmrg	fi
1228da2777aaSmrgfi[]dnl
1229da2777aaSmrg])dnl PKG_PROG_PKG_CONFIG
12303da084b3Smrg
1231da2777aaSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232da2777aaSmrgdnl -------------------------------------------------------------------
1233da2777aaSmrgdnl Since: 0.18
1234da2777aaSmrgdnl
1235da2777aaSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236da2777aaSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237da2777aaSmrgdnl
1238da2777aaSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239da2777aaSmrgdnl only at the first occurence in configure.ac, so if the first place
1240da2777aaSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241da2777aaSmrgdnl have to call PKG_CHECK_EXISTS manually
1242da2777aaSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243da2777aaSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244da2777aaSmrgif test -n "$PKG_CONFIG" && \
1245da2777aaSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246da2777aaSmrg  m4_default([$2], [:])
1247da2777aaSmrgm4_ifvaln([$3], [else
1248da2777aaSmrg  $3])dnl
1249da2777aaSmrgfi])
12503da084b3Smrg
1251da2777aaSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252da2777aaSmrgdnl ---------------------------------------------
1253da2777aaSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254da2777aaSmrgdnl pkg_failed based on the result.
1255da2777aaSmrgm4_define([_PKG_CONFIG],
1256da2777aaSmrg[if test -n "$$1"; then
1257da2777aaSmrg    pkg_cv_[]$1="$$1"
1258da2777aaSmrg elif test -n "$PKG_CONFIG"; then
1259da2777aaSmrg    PKG_CHECK_EXISTS([$3],
1260da2777aaSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261da2777aaSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262da2777aaSmrg		     [pkg_failed=yes])
1263da2777aaSmrg else
1264da2777aaSmrg    pkg_failed=untried
1265da2777aaSmrgfi[]dnl
1266da2777aaSmrg])dnl _PKG_CONFIG
12673da084b3Smrg
1268da2777aaSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269da2777aaSmrgdnl ---------------------------
1270da2777aaSmrgdnl Internal check to see if pkg-config supports short errors.
1271da2777aaSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272da2777aaSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273da2777aaSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274da2777aaSmrg        _pkg_short_errors_supported=yes
1275da2777aaSmrgelse
1276da2777aaSmrg        _pkg_short_errors_supported=no
1277da2777aaSmrgfi[]dnl
1278da2777aaSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127952fd71cdSmrg
128052fd71cdSmrg
1281da2777aaSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282da2777aaSmrgdnl   [ACTION-IF-NOT-FOUND])
1283da2777aaSmrgdnl --------------------------------------------------------------
1284da2777aaSmrgdnl Since: 0.4.0
1285da2777aaSmrgdnl
1286da2777aaSmrgdnl Note that if there is a possibility the first call to
1287da2777aaSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288da2777aaSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289da2777aaSmrgAC_DEFUN([PKG_CHECK_MODULES],
1290da2777aaSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291da2777aaSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292da2777aaSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129352fd71cdSmrg
1294da2777aaSmrgpkg_failed=no
1295da2777aaSmrgAC_MSG_CHECKING([for $1])
129652fd71cdSmrg
1297da2777aaSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298da2777aaSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12993da084b3Smrg
1300da2777aaSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301da2777aaSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1302da2777aaSmrgSee the pkg-config man page for more details.])
13033da084b3Smrg
1304da2777aaSmrgif test $pkg_failed = yes; then
1305da2777aaSmrg   	AC_MSG_RESULT([no])
1306da2777aaSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1307da2777aaSmrg        if test $_pkg_short_errors_supported = yes; then
1308da2777aaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309da2777aaSmrg        else 
1310da2777aaSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311da2777aaSmrg        fi
1312da2777aaSmrg	# Put the nasty error message in config.log where it belongs
1313da2777aaSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131455acc8fcSmrg
1315da2777aaSmrg	m4_default([$4], [AC_MSG_ERROR(
1316da2777aaSmrg[Package requirements ($2) were not met:
131755acc8fcSmrg
1318da2777aaSmrg$$1_PKG_ERRORS
131948c85eb7Smrg
1320da2777aaSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321da2777aaSmrginstalled software in a non-standard prefix.
13223da084b3Smrg
1323da2777aaSmrg_PKG_TEXT])[]dnl
1324da2777aaSmrg        ])
1325da2777aaSmrgelif test $pkg_failed = untried; then
1326da2777aaSmrg     	AC_MSG_RESULT([no])
1327da2777aaSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328da2777aaSmrg[The pkg-config script could not be found or is too old.  Make sure it
1329da2777aaSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330da2777aaSmrgpath to pkg-config.
13313da084b3Smrg
1332da2777aaSmrg_PKG_TEXT
13333da084b3Smrg
1334da2777aaSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335da2777aaSmrg        ])
133643d802faSmrgelse
1337da2777aaSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338da2777aaSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339da2777aaSmrg        AC_MSG_RESULT([yes])
1340da2777aaSmrg	$3
1341da2777aaSmrgfi[]dnl
1342da2777aaSmrg])dnl PKG_CHECK_MODULES
134348c85eb7Smrg
134448c85eb7Smrg
1345da2777aaSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346da2777aaSmrgdnl   [ACTION-IF-NOT-FOUND])
1347da2777aaSmrgdnl ---------------------------------------------------------------------
1348da2777aaSmrgdnl Since: 0.29
1349da2777aaSmrgdnl
1350da2777aaSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351da2777aaSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352da2777aaSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353da2777aaSmrgdnl
1354da2777aaSmrgdnl Note that if there is a possibility the first call to
1355da2777aaSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356da2777aaSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357da2777aaSmrgdnl configure.ac.
1358da2777aaSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359da2777aaSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360da2777aaSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361da2777aaSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362da2777aaSmrgPKG_CHECK_MODULES($@)
1363da2777aaSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364da2777aaSmrg])dnl PKG_CHECK_MODULES_STATIC
136548c85eb7Smrg
136648c85eb7Smrg
1367da2777aaSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368da2777aaSmrgdnl -------------------------
1369da2777aaSmrgdnl Since: 0.27
1370da2777aaSmrgdnl
1371da2777aaSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372da2777aaSmrgdnl should install pkg-config .pc files. By default the directory is
1373da2777aaSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374da2777aaSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375da2777aaSmrgdnl parameter.
1376da2777aaSmrgAC_DEFUN([PKG_INSTALLDIR],
1377da2777aaSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378da2777aaSmrgm4_pushdef([pkg_description],
1379da2777aaSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380da2777aaSmrgAC_ARG_WITH([pkgconfigdir],
1381da2777aaSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382da2777aaSmrg    [with_pkgconfigdir=]pkg_default)
1383da2777aaSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384da2777aaSmrgm4_popdef([pkg_default])
1385da2777aaSmrgm4_popdef([pkg_description])
1386da2777aaSmrg])dnl PKG_INSTALLDIR
13872a53b785Smrg
13882a53b785Smrg
1389da2777aaSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390da2777aaSmrgdnl --------------------------------
1391da2777aaSmrgdnl Since: 0.27
1392da2777aaSmrgdnl
1393da2777aaSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394da2777aaSmrgdnl module should install arch-independent pkg-config .pc files. By
1395da2777aaSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396da2777aaSmrgdnl changed by passing DIRECTORY. The user can override through the
1397da2777aaSmrgdnl --with-noarch-pkgconfigdir parameter.
1398da2777aaSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399da2777aaSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400da2777aaSmrgm4_pushdef([pkg_description],
1401da2777aaSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402da2777aaSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403da2777aaSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404da2777aaSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405da2777aaSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406da2777aaSmrgm4_popdef([pkg_default])
1407da2777aaSmrgm4_popdef([pkg_description])
1408da2777aaSmrg])dnl PKG_NOARCH_INSTALLDIR
140943d802faSmrg
141043d802faSmrg
1411da2777aaSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412da2777aaSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413da2777aaSmrgdnl -------------------------------------------
1414da2777aaSmrgdnl Since: 0.28
1415da2777aaSmrgdnl
1416da2777aaSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417da2777aaSmrgAC_DEFUN([PKG_CHECK_VAR],
1418da2777aaSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419da2777aaSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
142048c85eb7Smrg
1421da2777aaSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422da2777aaSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
142348c85eb7Smrg
1424da2777aaSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425da2777aaSmrg])dnl PKG_CHECK_VAR
14263da084b3Smrg
1427da2777aaSmrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1428da2777aaSmrgdnl
1429da2777aaSmrgdnl This file comes from X.Org's font-util 1.4.1
1430da2777aaSmrgdnl
1431da2777aaSmrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
1432da2777aaSmrgdnl
1433da2777aaSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1434da2777aaSmrgdnl copy of this software and associated documentation files (the "Software"),
1435da2777aaSmrgdnl to deal in the Software without restriction, including without limitation
1436da2777aaSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1437da2777aaSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1438da2777aaSmrgdnl Software is furnished to do so, subject to the following conditions:
1439da2777aaSmrgdnl
1440da2777aaSmrgdnl The above copyright notice and this permission notice (including the next
1441da2777aaSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1442da2777aaSmrgdnl Software.
1443da2777aaSmrgdnl
1444da2777aaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1445da2777aaSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1446da2777aaSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1447da2777aaSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1448da2777aaSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1449da2777aaSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1450da2777aaSmrgdnl DEALINGS IN THE SOFTWARE.
1451da2777aaSmrgdnl
1452da2777aaSmrgdnl --------------------------------------------------------------------
1453da2777aaSmrgdnl
1454da2777aaSmrgdnl Copyright 2005 Red Hat, Inc
1455da2777aaSmrgdnl
1456da2777aaSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
1457da2777aaSmrgdnl documentation for any purpose is hereby granted without fee, provided that
1458da2777aaSmrgdnl the above copyright notice appear in all copies and that both that
1459da2777aaSmrgdnl copyright notice and this permission notice appear in supporting
1460da2777aaSmrgdnl documentation.
1461da2777aaSmrgdnl
1462da2777aaSmrgdnl The above copyright notice and this permission notice shall be included
1463da2777aaSmrgdnl in all copies or substantial portions of the Software.
1464da2777aaSmrgdnl
1465da2777aaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1466da2777aaSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1467da2777aaSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1468da2777aaSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1469da2777aaSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1470da2777aaSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1471da2777aaSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
1472da2777aaSmrgdnl
1473da2777aaSmrgdnl Except as contained in this notice, the name of the copyright holders shall
1474da2777aaSmrgdnl not be used in advertising or otherwise to promote the sale, use or
1475da2777aaSmrgdnl other dealings in this Software without prior written authorization
1476da2777aaSmrgdnl from the copyright holders.
14772a53b785Smrg
1478da2777aaSmrg# XORG_FONT_MACROS_VERSION(required-version)
1479da2777aaSmrg# ------------------------------------------
1480da2777aaSmrg# Minimum version: 1.1.0
1481da2777aaSmrg#
1482da2777aaSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1483da2777aaSmrg# your configure.ac with the minimum required version, such as:
1484da2777aaSmrg# XORG_FONT_MACROS_VERSION(1.1)
1485da2777aaSmrg#
1486da2777aaSmrg# To ensure that this macro is defined, also add:
1487da2777aaSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
1488da2777aaSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1489da2777aaSmrg#
1490da2777aaSmrg#
1491da2777aaSmrg# See the "minimum version" comment for each macro you use to see what
1492da2777aaSmrg# version you require.
1493da2777aaSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
1494da2777aaSmrgm4_define([vers_have], [1.4.1])
1495da2777aaSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1496da2777aaSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1497da2777aaSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1498da2777aaSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1499da2777aaSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1500da2777aaSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1501da2777aaSmrgm4_undefine([vers_have])
1502da2777aaSmrgm4_undefine([maj_have])
1503da2777aaSmrgm4_undefine([maj_needed])
1504da2777aaSmrg]) # XORG_FONT_MACROS_VERSION
15053da084b3Smrg
1506da2777aaSmrg# XORG_FONT_CHECK_{maps}()
1507da2777aaSmrg# ------------------------
1508da2777aaSmrg# Minimum version: 1.0.0
1509da2777aaSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1510da2777aaSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
151143d802faSmrg
1512da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1513da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1514da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1515da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1516da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1517da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1518da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1519da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1520da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1521da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1522da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1523da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1524da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1525da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1526da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1527da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1528da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1529da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
153043d802faSmrg
1531da2777aaSmrg# XORG_FONT_CHECK_ENCODING(encoding)
1532da2777aaSmrg# ----------------------------------
1533da2777aaSmrg# Minimum version: 1.1.0
1534da2777aaSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
1535da2777aaSmrg# It replaced individual copies of this code in the above macros in 1.1.
1536da2777aaSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
1537da2777aaSmrg# calls if this is not true in the future.
153843d802faSmrg
1539da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1540da2777aaSmrg	AC_ARG_ENABLE(m4_tolower($1),
1541da2777aaSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1542da2777aaSmrg				[Build $1 fonts (default: yes)]),
1543da2777aaSmrg		[AS_TR_SH($1)=$enableval])
1544da2777aaSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
1545da2777aaSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
1546da2777aaSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1547da2777aaSmrg]) # XORG_FONT_CHECK_ENCODING
154843d802faSmrg
1549da2777aaSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1550da2777aaSmrg# -----------------------------------------------------
1551da2777aaSmrg# Minimum version: 1.1.0
1552da2777aaSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1553da2777aaSmrg# Add a shorthand --enable/disable-all-encodings option.
155443d802faSmrg
1555da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1556da2777aaSmrg	AC_ARG_ENABLE([all-encodings],
1557da2777aaSmrg		AS_HELP_STRING([--disable-all-encodings],
1558da2777aaSmrg				[Disable building of all font encodings]),
1559da2777aaSmrg		[m4_foreach_w([enc], [$1], [
1560da2777aaSmrg			AS_TR_SH(enc)=$enableval
1561da2777aaSmrg		])],
1562da2777aaSmrg		[m4_foreach_w([enc], [$1], [
1563da2777aaSmrg			AS_TR_SH(enc)=yes
1564da2777aaSmrg		])])
1565da2777aaSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1566da2777aaSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
156748c85eb7Smrg
1568da2777aaSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1569da2777aaSmrg# ------------------------------------------
1570da2777aaSmrg# Minimum version: 1.1.0
1571da2777aaSmrg#
1572da2777aaSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1573da2777aaSmrg#
15743da084b3Smrg
1575da2777aaSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1576da2777aaSmrg	AC_PATH_PROG($1, $2)
1577da2777aaSmrg	if test x"$$1" = x; then
1578da2777aaSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1579da2777aaSmrg	fi
1580da2777aaSmrg])
15813da084b3Smrg
15823da084b3Smrg
1583da2777aaSmrg# XORG_FONT_FCCACHE()
1584da2777aaSmrg# -------------------
1585da2777aaSmrg# Minimum version: 1.1.0
1586da2777aaSmrg#
1587da2777aaSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1588da2777aaSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1589da2777aaSmrg# to run fc-cache if found and not installing to $DESTDIR and not
1590da2777aaSmrg# cross-compiling
1591da2777aaSmrg#
1592da2777aaSmrg# fc-cache is optional, not required, and should be skipped when making
1593da2777aaSmrg# packages (installing to $DESTDIR) or cross-compiling
1594da2777aaSmrg#
1595da2777aaSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1596da2777aaSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1597da2777aaSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1598da2777aaSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1599da2777aaSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1600da2777aaSmrg	else
1601da2777aaSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1602da2777aaSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1603da2777aaSmrg	fi
1604da2777aaSmrg	AC_SUBST([RUN_FCCACHE])
1605da2777aaSmrg])
16062a53b785Smrg
1607da2777aaSmrg# XORG_FONT_MKFONTDIR()
1608da2777aaSmrg# -------------------
1609da2777aaSmrg# Minimum version: 1.3.0
1610da2777aaSmrg#
1611da2777aaSmrg# Set MKFONTDIR to path to mkfontdir.
1612da2777aaSmrg#
1613da2777aaSmrg# If cross-compiling, and if mkdir is not found, use a shell command
1614da2777aaSmrg# which warns mkfontdir needs to be run on the target
1615da2777aaSmrg#
1616da2777aaSmrg# If not cross-compiling, mkfontdir must be found
1617da2777aaSmrg#
1618da2777aaSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
1619da2777aaSmrg	if test x"$cross_compiling" != x"no" ; then
1620da2777aaSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1621da2777aaSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
16222a53b785Smrg
1623da2777aaSmrg		if test x"$MKFONTDIR" = x; then
1624da2777aaSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1625da2777aaSmrg		fi
162643d802faSmrg	else
1627da2777aaSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
162843d802faSmrg	fi
16292a53b785Smrg
1630da2777aaSmrg	AC_SUBST([MKFONTDIR])
16312a53b785Smrg])
1632d63fdb69Smrg
1633da2777aaSmrg# XORG_FONT_COMMON_UTILS()
1634da2777aaSmrg# ------------------------
1635da2777aaSmrg# Minimum version: 1.1.0
1636da2777aaSmrg#
1637da2777aaSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
16383da084b3Smrg
1639da2777aaSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1640da2777aaSmrg	XORG_FONT_FCCACHE
1641da2777aaSmrg	XORG_FONT_MKFONTDIR
1642da2777aaSmrg])
1643d63fdb69Smrg
1644da2777aaSmrg# XORG_FONT_SCALED_UTILS()
1645da2777aaSmrg# ------------------------
1646da2777aaSmrg# Minimum version: 1.1.0
1647da2777aaSmrg#
1648da2777aaSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1649da2777aaSmrg# (TrueType, OpenType, Type1)
165048c85eb7Smrg
1651da2777aaSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1652da2777aaSmrg	XORG_FONT_COMMON_UTILS
1653da2777aaSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1654da2777aaSmrg])
165552fd71cdSmrg
1656da2777aaSmrg# XORG_FONT_BDF_UTILS()
1657da2777aaSmrg# ---------------------
1658da2777aaSmrg# Minimum version: 1.1.0
1659da2777aaSmrg#
1660da2777aaSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1661da2777aaSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1662da2777aaSmrg# PCF output files created by bdftopcf
166348c85eb7Smrg
1664da2777aaSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1665da2777aaSmrg	XORG_FONT_COMMON_UTILS
1666da2777aaSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1667da2777aaSmrg	XORG_FONT_CHECK_COMPRESSION
1668da2777aaSmrg])
1669d63fdb69Smrg
1670da2777aaSmrg# XORG_FONT_CHECK_COMPRESSION()
1671da2777aaSmrg# -----------------------------
1672da2777aaSmrg# Minimum version: 1.1.0
1673da2777aaSmrg#
1674da2777aaSmrg# Offer a --with-compression flag to control what compression method is
1675da2777aaSmrg# used for pcf font files.   Offers all the methods currently supported
1676da2777aaSmrg# by libXfont, including no compression.
1677da2777aaSmrg#
1678da2777aaSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1679da2777aaSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
1680da2777aaSmrg# set COMPRESS_FLAGS to those options.
16812a53b785Smrg
1682da2777aaSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1683da2777aaSmrg	AC_MSG_CHECKING([font compression method])
1684da2777aaSmrg	AC_ARG_WITH(compression,
1685da2777aaSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1686da2777aaSmrg			 [compression method to use on pcf fonts])],
1687da2777aaSmrg         [compression="$withval"], [compression="yes"])
1688da2777aaSmrg	if test x"$compression" = "xyes" ; then
1689da2777aaSmrg		compression="gzip"
1690da2777aaSmrg	fi
1691da2777aaSmrg	AC_MSG_RESULT([${compression}])
1692da2777aaSmrg	case ${compression} in
1693da2777aaSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1694da2777aaSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1695da2777aaSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
1696da2777aaSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1697da2777aaSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1698da2777aaSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
169943d802faSmrg	esac
1700da2777aaSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1701da2777aaSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1702da2777aaSmrg	fi
1703da2777aaSmrg	AC_MSG_CHECKING([options to font compression command])
1704da2777aaSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1705da2777aaSmrg	AC_SUBST([COMPRESS_FLAGS])
1706da2777aaSmrg	AC_SUBST([COMPRESS_SUFFIX])
1707da2777aaSmrg])
170843d802faSmrg
1709da2777aaSmrg# XORG_FONT_UCS2ANY()
1710da2777aaSmrg# -------------------
1711da2777aaSmrg# Minimum version: 1.1.0
1712da2777aaSmrg#
1713da2777aaSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1714da2777aaSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1715da2777aaSmrg# Also call pkg-config to find the directory with the encoding files needed
1716da2777aaSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
171743d802faSmrg
1718da2777aaSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
1719da2777aaSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1720da2777aaSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1721da2777aaSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1722da2777aaSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
1723da2777aaSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1724da2777aaSmrg	AC_SUBST(MAPFILES_PATH)
1725da2777aaSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1726da2777aaSmrg])
172743d802faSmrg
172843d802faSmrg
172943d802faSmrg
1730da2777aaSmrg# XORG_FONT_FC_CONFDIR()
1731da2777aaSmrg# --------------------
1732da2777aaSmrg# Minimum version: 1.2.0
1733da2777aaSmrg#
1734da2777aaSmrg# Sets FC_CONFDIR to the fontconfig config directory
1735da2777aaSmrg# (which should be --with-confdir=... when building fontconfig)
1736da2777aaSmrg# found from:
1737da2777aaSmrg#	--with-fc-confdir=...
1738da2777aaSmrg#	pkg-config --variable=confdir fontconfig
1739da2777aaSmrg#	${sysconfdir}/fonts
174043d802faSmrg
1741da2777aaSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1742da2777aaSmrg	dnl Ensure $PKG_CONFIG is set first
1743da2777aaSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
174443d802faSmrg
1745da2777aaSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1746da2777aaSmrg	AC_ARG_WITH(fc-confdir,
1747da2777aaSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1748da2777aaSmrg			   [Path to fontconfig's configuration directory]),
1749da2777aaSmrg		    [FC_CONFDIR="$withval"])
1750da2777aaSmrg	# if --with-fc-confdir was not specified
1751da2777aaSmrg	if test "x${FC_CONFDIR}" = "x"; then
1752da2777aaSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1753da2777aaSmrg	fi
1754da2777aaSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1755da2777aaSmrg	if test "x${FC_CONFDIR}" = "x"; then
1756da2777aaSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1757da2777aaSmrg	fi
1758da2777aaSmrg	AC_SUBST(FC_CONFDIR)
1759da2777aaSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1760da2777aaSmrg])
1761d63fdb69Smrg
1762d63fdb69Smrg
17633da084b3Smrg
1764da2777aaSmrg# XORG_FONTROOTDIR()
1765da2777aaSmrg# --------------------
1766da2777aaSmrg# Minimum version: 1.1.0
1767da2777aaSmrg#
1768da2777aaSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1769da2777aaSmrg# found from:
1770da2777aaSmrg#	--with-fontrootdir
1771da2777aaSmrg#	pkg-config --variable=fontrootdir fontutil
1772da2777aaSmrg#	${datadir}/fonts/X11
17733da084b3Smrg
1774da2777aaSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1775da2777aaSmrg	dnl Ensure $PKG_CONFIG is set first
1776da2777aaSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
17773da084b3Smrg
1778da2777aaSmrg	AC_MSG_CHECKING([for root directory for font files])
1779da2777aaSmrg	AC_ARG_WITH(fontrootdir,
1780da2777aaSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1781da2777aaSmrg			   [Path to root directory for font files]),
1782da2777aaSmrg		    [FONTROOTDIR="$withval"])
1783da2777aaSmrg	# if --with-fontrootdir not specified...
1784da2777aaSmrg	if test "x${FONTROOTDIR}" = "x"; then
1785da2777aaSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1786da2777aaSmrg	fi
1787da2777aaSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1788da2777aaSmrg	if test "x${FONTROOTDIR}" = "x"; then
1789da2777aaSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1790da2777aaSmrg	fi
1791da2777aaSmrg	AC_SUBST(FONTROOTDIR)
1792da2777aaSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
179343d802faSmrg])
179448c85eb7Smrg
1795da2777aaSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1796da2777aaSmrg# ---------------------------------------
1797da2777aaSmrg# Minimum version: 1.1.0
179843d802faSmrg#
1799da2777aaSmrg# Offer a --with-<flag> flag to control directory for font installation
1800da2777aaSmrg# Default is the specified <subdir> of the font root directory.
1801da2777aaSmrg# Sets <variable> to the selected directory
18023da084b3Smrg
1803da2777aaSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1804da2777aaSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
18053da084b3Smrg
1806da2777aaSmrg	AC_MSG_CHECKING([for directory for $3 files])
1807da2777aaSmrg	AC_ARG_WITH($2,
1808da2777aaSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1809da2777aaSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1810da2777aaSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1811da2777aaSmrg	AC_SUBST($1)
1812da2777aaSmrg	AC_MSG_RESULT([${$1}])
1813da2777aaSmrg]) # XORG_FONTSUBDIR
18143da084b3Smrg
1815da2777aaSmrg# XORG_FONTDIR(subdir)
1816da2777aaSmrg# --------------------
1817da2777aaSmrg# Minimum version: 1.1.0
1818da2777aaSmrg#
1819da2777aaSmrg# Offer a --with-fontdir flag to control directory for font installation
1820da2777aaSmrg# Default is the specified subdir of the font root directory.
1821da2777aaSmrg# Sets FONTDIR to the selected directory
182243d802faSmrg
1823da2777aaSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
182443d802faSmrg
1825da2777aaSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1826da2777aaSmrgdnl
1827da2777aaSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1828da2777aaSmrgdnl
1829da2777aaSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1830da2777aaSmrgdnl copy of this software and associated documentation files (the "Software"),
1831da2777aaSmrgdnl to deal in the Software without restriction, including without limitation
1832da2777aaSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1833da2777aaSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1834da2777aaSmrgdnl Software is furnished to do so, subject to the following conditions:
1835da2777aaSmrgdnl
1836da2777aaSmrgdnl The above copyright notice and this permission notice (including the next
1837da2777aaSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1838da2777aaSmrgdnl Software.
1839da2777aaSmrgdnl
1840da2777aaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1841da2777aaSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1842da2777aaSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1843da2777aaSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1844da2777aaSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1845da2777aaSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1846da2777aaSmrgdnl DEALINGS IN THE SOFTWARE.
184743d802faSmrg
1848da2777aaSmrg# XORG_MACROS_VERSION(required-version)
1849da2777aaSmrg# -------------------------------------
1850da2777aaSmrg# Minimum version: 1.1.0
1851da2777aaSmrg#
1852da2777aaSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1853da2777aaSmrg# your configure.ac with the minimum required version, such as:
1854da2777aaSmrg# XORG_MACROS_VERSION(1.1)
1855da2777aaSmrg#
1856da2777aaSmrg# To ensure that this macro is defined, also add:
1857da2777aaSmrg# m4_ifndef([XORG_MACROS_VERSION],
1858da2777aaSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1859da2777aaSmrg#
1860da2777aaSmrg#
1861da2777aaSmrg# See the "minimum version" comment for each macro you use to see what
1862da2777aaSmrg# version you require.
1863da2777aaSmrgm4_defun([XORG_MACROS_VERSION],[
1864da2777aaSmrgm4_define([vers_have], [1.20.0])
1865da2777aaSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1866da2777aaSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1867da2777aaSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1868da2777aaSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1869da2777aaSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1870da2777aaSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1871da2777aaSmrgm4_undefine([vers_have])
1872da2777aaSmrgm4_undefine([maj_have])
1873da2777aaSmrgm4_undefine([maj_needed])
1874da2777aaSmrg]) # XORG_MACROS_VERSION
187543d802faSmrg
1876da2777aaSmrg# XORG_PROG_RAWCPP()
1877da2777aaSmrg# ------------------
1878da2777aaSmrg# Minimum version: 1.0.0
1879da2777aaSmrg#
1880da2777aaSmrg# Find cpp program and necessary flags for use in pre-processing text files
1881da2777aaSmrg# such as man pages and config files
1882da2777aaSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1883da2777aaSmrgAC_REQUIRE([AC_PROG_CPP])
1884da2777aaSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1885da2777aaSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
18863da084b3Smrg
1887da2777aaSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1888da2777aaSmrg# which is not the best choice for supporting other OS'es, but covers most
1889da2777aaSmrg# of the ones we need for now.
1890da2777aaSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1891da2777aaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1892da2777aaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1893da2777aaSmrg	AC_MSG_RESULT([no])
1894da2777aaSmrgelse
1895da2777aaSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1896da2777aaSmrg		RAWCPPFLAGS=-undef
1897da2777aaSmrg		AC_MSG_RESULT([yes])
1898da2777aaSmrg	# under Cygwin unix is still defined even with -undef
1899da2777aaSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1900da2777aaSmrg		RAWCPPFLAGS="-undef -ansi"
1901da2777aaSmrg		AC_MSG_RESULT([yes, with -ansi])
1902da2777aaSmrg	else
1903da2777aaSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1904da2777aaSmrg	fi
1905da2777aaSmrgfi
1906da2777aaSmrgrm -f conftest.$ac_ext
19073da084b3Smrg
1908da2777aaSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1909da2777aaSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1910da2777aaSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1911da2777aaSmrg	AC_MSG_RESULT([no])
1912da2777aaSmrgelse
1913da2777aaSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1914da2777aaSmrg		TRADITIONALCPPFLAGS="-traditional"
1915da2777aaSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1916da2777aaSmrg		AC_MSG_RESULT([yes])
1917da2777aaSmrg	else
1918da2777aaSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1919da2777aaSmrg	fi
1920da2777aaSmrgfi
1921da2777aaSmrgrm -f conftest.$ac_ext
1922da2777aaSmrgAC_SUBST(RAWCPPFLAGS)
1923da2777aaSmrgAC_SUBST(TRADITIONALCPPFLAGS)
1924da2777aaSmrg]) # XORG_PROG_RAWCPP
19253da084b3Smrg
1926da2777aaSmrg# XORG_MANPAGE_SECTIONS()
1927da2777aaSmrg# -----------------------
1928da2777aaSmrg# Minimum version: 1.0.0
1929da2777aaSmrg#
1930da2777aaSmrg# Determine which sections man pages go in for the different man page types
1931da2777aaSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1932da2777aaSmrg# Not sure if there's any better way than just hardcoding by OS name.
1933da2777aaSmrg# Override default settings by setting environment variables
1934da2777aaSmrg# Added MAN_SUBSTS in version 1.8
1935da2777aaSmrg# Added AC_PROG_SED in version 1.8
19363da084b3Smrg
1937da2777aaSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1938da2777aaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1939da2777aaSmrgAC_REQUIRE([AC_PROG_SED])
194048c85eb7Smrg
1941da2777aaSmrgcase $host_os in
194243d802faSmrg    solaris*)
1943da2777aaSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1944da2777aaSmrg        # check for a man page file found in later versions that use
1945da2777aaSmrg        # traditional section numbers instead
1946da2777aaSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1947da2777aaSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1948da2777aaSmrg        ;;
1949da2777aaSmrg    *) SYSV_MAN_SECTIONS=false ;;
1950da2777aaSmrgesac
195143d802faSmrg
1952da2777aaSmrgif test x$APP_MAN_SUFFIX = x    ; then
1953da2777aaSmrg    APP_MAN_SUFFIX=1
1954da2777aaSmrgfi
1955da2777aaSmrgif test x$APP_MAN_DIR = x    ; then
1956da2777aaSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1957da2777aaSmrgfi
195843d802faSmrg
1959da2777aaSmrgif test x$LIB_MAN_SUFFIX = x    ; then
1960da2777aaSmrg    LIB_MAN_SUFFIX=3
1961da2777aaSmrgfi
1962da2777aaSmrgif test x$LIB_MAN_DIR = x    ; then
1963da2777aaSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1964da2777aaSmrgfi
196543d802faSmrg
1966da2777aaSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1967da2777aaSmrg    case $SYSV_MAN_SECTIONS in
1968da2777aaSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1969da2777aaSmrg	*)				FILE_MAN_SUFFIX=5  ;;
197043d802faSmrg    esac
1971da2777aaSmrgfi
1972da2777aaSmrgif test x$FILE_MAN_DIR = x    ; then
1973da2777aaSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1974da2777aaSmrgfi
197543d802faSmrg
1976da2777aaSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1977da2777aaSmrg    case $SYSV_MAN_SECTIONS in
1978da2777aaSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1979da2777aaSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1980da2777aaSmrg    esac
1981da2777aaSmrgfi
1982da2777aaSmrgif test x$MISC_MAN_DIR = x    ; then
1983da2777aaSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1984da2777aaSmrgfi
198543d802faSmrg
1986da2777aaSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1987da2777aaSmrg    case $SYSV_MAN_SECTIONS in
1988da2777aaSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1989da2777aaSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1990da2777aaSmrg    esac
1991da2777aaSmrgfi
1992da2777aaSmrgif test x$DRIVER_MAN_DIR = x    ; then
1993da2777aaSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1994da2777aaSmrgfi
199543d802faSmrg
1996da2777aaSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1997da2777aaSmrg    case $SYSV_MAN_SECTIONS in
1998da2777aaSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1999da2777aaSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
2000da2777aaSmrg    esac
2001da2777aaSmrgfi
2002da2777aaSmrgif test x$ADMIN_MAN_DIR = x    ; then
2003da2777aaSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
2004da2777aaSmrgfi
200543d802faSmrg
200643d802faSmrg
2007da2777aaSmrgAC_SUBST([APP_MAN_SUFFIX])
2008da2777aaSmrgAC_SUBST([LIB_MAN_SUFFIX])
2009da2777aaSmrgAC_SUBST([FILE_MAN_SUFFIX])
2010da2777aaSmrgAC_SUBST([MISC_MAN_SUFFIX])
2011da2777aaSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
2012da2777aaSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
2013da2777aaSmrgAC_SUBST([APP_MAN_DIR])
2014da2777aaSmrgAC_SUBST([LIB_MAN_DIR])
2015da2777aaSmrgAC_SUBST([FILE_MAN_DIR])
2016da2777aaSmrgAC_SUBST([MISC_MAN_DIR])
2017da2777aaSmrgAC_SUBST([DRIVER_MAN_DIR])
2018da2777aaSmrgAC_SUBST([ADMIN_MAN_DIR])
201943d802faSmrg
2020da2777aaSmrgXORG_MAN_PAGE="X Version 11"
2021da2777aaSmrgAC_SUBST([XORG_MAN_PAGE])
2022da2777aaSmrgMAN_SUBSTS="\
2023da2777aaSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2024da2777aaSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2025da2777aaSmrg	-e 's|__xservername__|Xorg|g' \
2026da2777aaSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
2027da2777aaSmrg	-e 's|__projectroot__|\$(prefix)|g' \
2028da2777aaSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
2029da2777aaSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2030da2777aaSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2031da2777aaSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2032da2777aaSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2033da2777aaSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2034da2777aaSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2035da2777aaSmrgAC_SUBST([MAN_SUBSTS])
203648c85eb7Smrg
2037da2777aaSmrg]) # XORG_MANPAGE_SECTIONS
20382a53b785Smrg
2039da2777aaSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2040da2777aaSmrg# ------------------------
2041da2777aaSmrg# Minimum version: 1.7.0
2042da2777aaSmrg#
2043da2777aaSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2044da2777aaSmrg# provided by xorg-sgml-doctools, if installed.
2045da2777aaSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
2046da2777aaSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
2047da2777aaSmrgXORG_SGML_PATH=
2048da2777aaSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
2049da2777aaSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
2050da2777aaSmrg    [m4_ifval([$1],[:],
2051da2777aaSmrg        [if test x"$cross_compiling" != x"yes" ; then
2052da2777aaSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
2053da2777aaSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
2054da2777aaSmrg         fi])
2055da2777aaSmrg    ])
20563da084b3Smrg
2057da2777aaSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
2058da2777aaSmrg# the path and the name of the doc stylesheet
2059da2777aaSmrgif test "x$XORG_SGML_PATH" != "x" ; then
2060da2777aaSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
2061da2777aaSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
2062da2777aaSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
2063da2777aaSmrgelse
2064da2777aaSmrg   AC_MSG_RESULT([no])
2065da2777aaSmrgfi
20663da084b3Smrg
2067da2777aaSmrgAC_SUBST(XORG_SGML_PATH)
2068da2777aaSmrgAC_SUBST(STYLESHEET_SRCDIR)
2069da2777aaSmrgAC_SUBST(XSL_STYLESHEET)
2070da2777aaSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
2071da2777aaSmrg]) # XORG_CHECK_SGML_DOCTOOLS
20723da084b3Smrg
2073da2777aaSmrg# XORG_CHECK_LINUXDOC
2074da2777aaSmrg# -------------------
2075da2777aaSmrg# Minimum version: 1.0.0
2076da2777aaSmrg#
2077da2777aaSmrg# Defines the variable MAKE_TEXT if the necessary tools and
2078da2777aaSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
2079da2777aaSmrg# Whether or not the necessary tools and files are found can be checked
2080da2777aaSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
2081da2777aaSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
2082da2777aaSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2083da2777aaSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
20843da084b3Smrg
2085da2777aaSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
20863da084b3Smrg
2087da2777aaSmrgAC_MSG_CHECKING([whether to build documentation])
20883da084b3Smrg
2089da2777aaSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
2090da2777aaSmrg   BUILDDOC=yes
2091da2777aaSmrgelse
2092da2777aaSmrg   BUILDDOC=no
2093da2777aaSmrgfi
20943da084b3Smrg
2095da2777aaSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
209652fd71cdSmrg
2097da2777aaSmrgAC_MSG_RESULT([$BUILDDOC])
20983da084b3Smrg
2099da2777aaSmrgAC_MSG_CHECKING([whether to build pdf documentation])
21003da084b3Smrg
2101da2777aaSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
2102da2777aaSmrg   BUILDPDFDOC=yes
2103da2777aaSmrgelse
2104da2777aaSmrg   BUILDPDFDOC=no
2105da2777aaSmrgfi
21063da084b3Smrg
2107da2777aaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
21083da084b3Smrg
2109da2777aaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
21103da084b3Smrg
2111da2777aaSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
2112da2777aaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
2113da2777aaSmrgMAKE_PDF="$PS2PDF"
2114da2777aaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
21153da084b3Smrg
2116da2777aaSmrgAC_SUBST(MAKE_TEXT)
2117da2777aaSmrgAC_SUBST(MAKE_PS)
2118da2777aaSmrgAC_SUBST(MAKE_PDF)
2119da2777aaSmrgAC_SUBST(MAKE_HTML)
2120da2777aaSmrg]) # XORG_CHECK_LINUXDOC
21213da084b3Smrg
2122da2777aaSmrg# XORG_CHECK_DOCBOOK
2123da2777aaSmrg# -------------------
2124da2777aaSmrg# Minimum version: 1.0.0
2125da2777aaSmrg#
2126da2777aaSmrg# Checks for the ability to build output formats from SGML DocBook source.
2127da2777aaSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
2128da2777aaSmrg# indicates whether the necessary tools and files are found and, if set,
2129da2777aaSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
2130da2777aaSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
2131da2777aaSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
21323da084b3Smrg
2133da2777aaSmrgBUILDTXTDOC=no
2134da2777aaSmrgBUILDPDFDOC=no
2135da2777aaSmrgBUILDPSDOC=no
2136da2777aaSmrgBUILDHTMLDOC=no
21373da084b3Smrg
2138da2777aaSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
2139da2777aaSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2140da2777aaSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
2141da2777aaSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
21423da084b3Smrg
2143da2777aaSmrgAC_MSG_CHECKING([whether to build text documentation])
2144da2777aaSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2145da2777aaSmrg   test x$BUILD_TXTDOC != xno; then
2146da2777aaSmrg	BUILDTXTDOC=yes
2147da2777aaSmrgfi
2148da2777aaSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2149da2777aaSmrgAC_MSG_RESULT([$BUILDTXTDOC])
215043d802faSmrg
2151da2777aaSmrgAC_MSG_CHECKING([whether to build PDF documentation])
2152da2777aaSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2153da2777aaSmrg   test x$BUILD_PDFDOC != xno; then
2154da2777aaSmrg	BUILDPDFDOC=yes
2155da2777aaSmrgfi
2156da2777aaSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2157da2777aaSmrgAC_MSG_RESULT([$BUILDPDFDOC])
215843d802faSmrg
2159da2777aaSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
2160da2777aaSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2161da2777aaSmrg   test x$BUILD_PSDOC != xno; then
2162da2777aaSmrg	BUILDPSDOC=yes
2163da2777aaSmrgfi
2164da2777aaSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2165da2777aaSmrgAC_MSG_RESULT([$BUILDPSDOC])
21663da084b3Smrg
2167da2777aaSmrgAC_MSG_CHECKING([whether to build HTML documentation])
2168da2777aaSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2169da2777aaSmrg   test x$BUILD_HTMLDOC != xno; then
2170da2777aaSmrg	BUILDHTMLDOC=yes
2171da2777aaSmrgfi
2172da2777aaSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2173da2777aaSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
21742a53b785Smrg
2175da2777aaSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2176da2777aaSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2177da2777aaSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2178da2777aaSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
217943d802faSmrg
2180da2777aaSmrgAC_SUBST(MAKE_TEXT)
2181da2777aaSmrgAC_SUBST(MAKE_PS)
2182da2777aaSmrgAC_SUBST(MAKE_PDF)
2183da2777aaSmrgAC_SUBST(MAKE_HTML)
2184da2777aaSmrg]) # XORG_CHECK_DOCBOOK
218543d802faSmrg
2186da2777aaSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
2187da2777aaSmrg# ----------------
2188da2777aaSmrg# Minimum version: 1.5.0
2189da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
219043d802faSmrg#
2191da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2192da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2193da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2194da2777aaSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
2195da2777aaSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2196da2777aaSmrg# --with-xmlto assumes 'auto'.
219743d802faSmrg#
2198da2777aaSmrg# Interface to module:
2199da2777aaSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
2200da2777aaSmrg# XMLTO:	returns the path of the xmlto program found
2201da2777aaSmrg#		returns the path set by the user in the environment
2202da2777aaSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
2203da2777aaSmrg#		'no' user instructs the module not to use xmlto
2204da2777aaSmrg#
2205da2777aaSmrg# Added in version 1.10.0
2206da2777aaSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
2207da2777aaSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
2208da2777aaSmrg#
2209da2777aaSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
2210da2777aaSmrg#
2211da2777aaSmrgAC_DEFUN([XORG_WITH_XMLTO],[
2212da2777aaSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2213da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2214da2777aaSmrgAC_ARG_WITH(xmlto,
2215da2777aaSmrg	AS_HELP_STRING([--with-xmlto],
2216da2777aaSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2217da2777aaSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2218da2777aaSmrgm4_undefine([_defopt])
221943d802faSmrg
2220da2777aaSmrgif test "x$use_xmlto" = x"auto"; then
2221da2777aaSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2222da2777aaSmrg   if test "x$XMLTO" = "x"; then
2223da2777aaSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
2224da2777aaSmrg	have_xmlto=no
2225da2777aaSmrg   else
2226da2777aaSmrg        have_xmlto=yes
2227da2777aaSmrg   fi
2228da2777aaSmrgelif test "x$use_xmlto" = x"yes" ; then
2229da2777aaSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2230da2777aaSmrg   if test "x$XMLTO" = "x"; then
2231da2777aaSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
2232da2777aaSmrg   fi
2233da2777aaSmrg   have_xmlto=yes
2234da2777aaSmrgelif test "x$use_xmlto" = x"no" ; then
2235da2777aaSmrg   if test "x$XMLTO" != "x"; then
2236da2777aaSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
2237da2777aaSmrg   fi
2238da2777aaSmrg   have_xmlto=no
22392a53b785Smrgelse
2240da2777aaSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
22412a53b785Smrgfi
22423da084b3Smrg
2243da2777aaSmrg# Test for a minimum version of xmlto, if provided.
2244da2777aaSmrgm4_ifval([$1],
2245da2777aaSmrg[if test "$have_xmlto" = yes; then
2246da2777aaSmrg    # scrape the xmlto version
2247da2777aaSmrg    AC_MSG_CHECKING([the xmlto version])
2248da2777aaSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2249da2777aaSmrg    AC_MSG_RESULT([$xmlto_version])
2250da2777aaSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2251da2777aaSmrg        [if test "x$use_xmlto" = xauto; then
2252da2777aaSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2253da2777aaSmrg            have_xmlto=no
225443d802faSmrg        else
2255da2777aaSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2256da2777aaSmrg        fi])
2257da2777aaSmrgfi])
22583da084b3Smrg
2259da2777aaSmrg# Test for the ability of xmlto to generate a text target
2260da2777aaSmrg#
2261da2777aaSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2262da2777aaSmrg# following test for empty XML docbook files.
2263da2777aaSmrg# For compatibility reasons use the following empty XML docbook file and if
2264da2777aaSmrg# it fails try it again with a non-empty XML file.
2265da2777aaSmrghave_xmlto_text=no
2266da2777aaSmrgcat > conftest.xml << "EOF"
2267da2777aaSmrgEOF
2268da2777aaSmrgAS_IF([test "$have_xmlto" = yes],
2269da2777aaSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2270da2777aaSmrg             [have_xmlto_text=yes],
2271da2777aaSmrg             [# Try it again with a non-empty XML file.
2272da2777aaSmrg              cat > conftest.xml << "EOF"
2273da2777aaSmrg<x></x>
2274da2777aaSmrgEOF
2275da2777aaSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2276da2777aaSmrg                    [have_xmlto_text=yes],
2277da2777aaSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2278da2777aaSmrgrm -f conftest.xml
2279da2777aaSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2280da2777aaSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2281da2777aaSmrg]) # XORG_WITH_XMLTO
22823da084b3Smrg
2283da2777aaSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2284da2777aaSmrg# --------------------------------------------
2285da2777aaSmrg# Minimum version: 1.12.0
2286da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.12.0
2287da2777aaSmrg#
2288da2777aaSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2289da2777aaSmrg# XML-based language used for the transformation of XML documents.
2290da2777aaSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2291da2777aaSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2292da2777aaSmrg# The XSLT processor is often used as a standalone tool for transformations.
2293da2777aaSmrg# It should not be assumed that this tool is used only to work with documnetation.
2294da2777aaSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2295da2777aaSmrg#
2296da2777aaSmrg# Interface to module:
2297da2777aaSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2298da2777aaSmrg# XSLTPROC:	 returns the path of the xsltproc program found
2299da2777aaSmrg#		 returns the path set by the user in the environment
2300da2777aaSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2301da2777aaSmrg#		  'no' user instructs the module not to use xsltproc
2302da2777aaSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2303da2777aaSmrg#
2304da2777aaSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2305da2777aaSmrg#
2306da2777aaSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2307da2777aaSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2308da2777aaSmrg# Preserves the interface, should it be implemented later
2309da2777aaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2310da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2311da2777aaSmrgAC_ARG_WITH(xsltproc,
2312da2777aaSmrg	AS_HELP_STRING([--with-xsltproc],
2313da2777aaSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2314da2777aaSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2315da2777aaSmrgm4_undefine([_defopt])
23163da084b3Smrg
2317da2777aaSmrgif test "x$use_xsltproc" = x"auto"; then
2318da2777aaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2319da2777aaSmrg   if test "x$XSLTPROC" = "x"; then
2320da2777aaSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2321da2777aaSmrg	have_xsltproc=no
2322da2777aaSmrg   else
2323da2777aaSmrg        have_xsltproc=yes
2324da2777aaSmrg   fi
2325da2777aaSmrgelif test "x$use_xsltproc" = x"yes" ; then
2326da2777aaSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2327da2777aaSmrg   if test "x$XSLTPROC" = "x"; then
2328da2777aaSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2329da2777aaSmrg   fi
2330da2777aaSmrg   have_xsltproc=yes
2331da2777aaSmrgelif test "x$use_xsltproc" = x"no" ; then
2332da2777aaSmrg   if test "x$XSLTPROC" != "x"; then
2333da2777aaSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2334da2777aaSmrg   fi
2335da2777aaSmrg   have_xsltproc=no
2336da2777aaSmrgelse
2337da2777aaSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2338da2777aaSmrgfi
23393da084b3Smrg
2340da2777aaSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2341da2777aaSmrg]) # XORG_WITH_XSLTPROC
234248c85eb7Smrg
2343da2777aaSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2344da2777aaSmrg# ----------------------------------------
2345da2777aaSmrg# Minimum version: 1.15.0
2346da2777aaSmrg#
2347da2777aaSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
2348da2777aaSmrg# scanning arbitrary text files, extracting information from those text files,
2349da2777aaSmrg# and printing reports based on that information.
2350da2777aaSmrg#
2351da2777aaSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2352da2777aaSmrg#
2353da2777aaSmrg# Interface to module:
2354da2777aaSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
2355da2777aaSmrg# PERL:	     returns the path of the perl program found
2356da2777aaSmrg#	     returns the path set by the user in the environment
2357da2777aaSmrg# --with-perl: 'yes' user instructs the module to use perl
2358da2777aaSmrg#	       'no' user instructs the module not to use perl
2359da2777aaSmrg# have_perl: returns yes if perl found in PATH or no
2360da2777aaSmrg#
2361da2777aaSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2362da2777aaSmrg#
2363da2777aaSmrgAC_DEFUN([XORG_WITH_PERL],[
2364da2777aaSmrgAC_ARG_VAR([PERL], [Path to perl command])
2365da2777aaSmrg# Preserves the interface, should it be implemented later
2366da2777aaSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2367da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2368da2777aaSmrgAC_ARG_WITH(perl,
2369da2777aaSmrg	AS_HELP_STRING([--with-perl],
2370da2777aaSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2371da2777aaSmrg	   [use_perl=$withval], [use_perl=]_defopt)
2372da2777aaSmrgm4_undefine([_defopt])
237348c85eb7Smrg
2374da2777aaSmrgif test "x$use_perl" = x"auto"; then
2375da2777aaSmrg   AC_PATH_PROG([PERL], [perl])
2376da2777aaSmrg   if test "x$PERL" = "x"; then
2377da2777aaSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2378da2777aaSmrg	have_perl=no
2379da2777aaSmrg   else
2380da2777aaSmrg        have_perl=yes
2381da2777aaSmrg   fi
2382da2777aaSmrgelif test "x$use_perl" = x"yes" ; then
2383da2777aaSmrg   AC_PATH_PROG([PERL], [perl])
2384da2777aaSmrg   if test "x$PERL" = "x"; then
2385da2777aaSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2386da2777aaSmrg   fi
2387da2777aaSmrg   have_perl=yes
2388da2777aaSmrgelif test "x$use_perl" = x"no" ; then
2389da2777aaSmrg   if test "x$PERL" != "x"; then
2390da2777aaSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2391da2777aaSmrg   fi
2392da2777aaSmrg   have_perl=no
2393da2777aaSmrgelse
2394da2777aaSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2395da2777aaSmrgfi
239648c85eb7Smrg
2397da2777aaSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2398da2777aaSmrg]) # XORG_WITH_PERL
239948c85eb7Smrg
2400da2777aaSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2401da2777aaSmrg# ----------------
2402da2777aaSmrg# Minimum version: 1.5.0
2403da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2404da2777aaSmrg#
2405da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2406da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2407da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2408da2777aaSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2409da2777aaSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2410da2777aaSmrg# --with-asciidoc assumes 'auto'.
2411da2777aaSmrg#
2412da2777aaSmrg# Interface to module:
2413da2777aaSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2414da2777aaSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2415da2777aaSmrg#		 returns the path set by the user in the environment
2416da2777aaSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2417da2777aaSmrg#		  'no' user instructs the module not to use asciidoc
2418da2777aaSmrg#
2419da2777aaSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2420da2777aaSmrg#
2421da2777aaSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2422da2777aaSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2423da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2424da2777aaSmrgAC_ARG_WITH(asciidoc,
2425da2777aaSmrg	AS_HELP_STRING([--with-asciidoc],
2426da2777aaSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2427da2777aaSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2428da2777aaSmrgm4_undefine([_defopt])
24293da084b3Smrg
2430da2777aaSmrgif test "x$use_asciidoc" = x"auto"; then
2431da2777aaSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2432da2777aaSmrg   if test "x$ASCIIDOC" = "x"; then
2433da2777aaSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2434da2777aaSmrg	have_asciidoc=no
2435da2777aaSmrg   else
2436da2777aaSmrg        have_asciidoc=yes
2437da2777aaSmrg   fi
2438da2777aaSmrgelif test "x$use_asciidoc" = x"yes" ; then
2439da2777aaSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2440da2777aaSmrg   if test "x$ASCIIDOC" = "x"; then
2441da2777aaSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2442da2777aaSmrg   fi
2443da2777aaSmrg   have_asciidoc=yes
2444da2777aaSmrgelif test "x$use_asciidoc" = x"no" ; then
2445da2777aaSmrg   if test "x$ASCIIDOC" != "x"; then
2446da2777aaSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2447da2777aaSmrg   fi
2448da2777aaSmrg   have_asciidoc=no
244943d802faSmrgelse
2450da2777aaSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
245143d802faSmrgfi
2452da2777aaSmrgm4_ifval([$1],
2453da2777aaSmrg[if test "$have_asciidoc" = yes; then
2454da2777aaSmrg    # scrape the asciidoc version
2455da2777aaSmrg    AC_MSG_CHECKING([the asciidoc version])
2456da2777aaSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2457da2777aaSmrg    AC_MSG_RESULT([$asciidoc_version])
2458da2777aaSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2459da2777aaSmrg        [if test "x$use_asciidoc" = xauto; then
2460da2777aaSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2461da2777aaSmrg            have_asciidoc=no
2462da2777aaSmrg        else
2463da2777aaSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2464da2777aaSmrg        fi])
2465da2777aaSmrgfi])
2466da2777aaSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2467da2777aaSmrg]) # XORG_WITH_ASCIIDOC
2468d63fdb69Smrg
2469da2777aaSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2470da2777aaSmrg# -------------------------------------------
2471da2777aaSmrg# Minimum version: 1.5.0
2472da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2473da2777aaSmrg# Minimum version for optional DOT checking: 1.18.0
2474da2777aaSmrg#
2475da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2476da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2477da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2478da2777aaSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2479da2777aaSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2480da2777aaSmrg# --with-doxygen assumes 'auto'.
2481da2777aaSmrg#
2482da2777aaSmrg# Interface to module:
2483da2777aaSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2484da2777aaSmrg# DOXYGEN:	 returns the path of the doxygen program found
2485da2777aaSmrg#		 returns the path set by the user in the environment
2486da2777aaSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2487da2777aaSmrg#		  'no' user instructs the module not to use doxygen
2488da2777aaSmrg#
2489da2777aaSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2490da2777aaSmrg#
2491da2777aaSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2492da2777aaSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2493da2777aaSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2494da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2495da2777aaSmrgAC_ARG_WITH(doxygen,
2496da2777aaSmrg	AS_HELP_STRING([--with-doxygen],
2497da2777aaSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2498da2777aaSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2499da2777aaSmrgm4_undefine([_defopt])
2500d63fdb69Smrg
2501da2777aaSmrgif test "x$use_doxygen" = x"auto"; then
2502da2777aaSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2503da2777aaSmrg   if test "x$DOXYGEN" = "x"; then
2504da2777aaSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2505da2777aaSmrg	have_doxygen=no
2506da2777aaSmrg   else
2507da2777aaSmrg        have_doxygen=yes
2508da2777aaSmrg   fi
2509da2777aaSmrgelif test "x$use_doxygen" = x"yes" ; then
2510da2777aaSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2511da2777aaSmrg   if test "x$DOXYGEN" = "x"; then
2512da2777aaSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2513da2777aaSmrg   fi
2514da2777aaSmrg   have_doxygen=yes
2515da2777aaSmrgelif test "x$use_doxygen" = x"no" ; then
2516da2777aaSmrg   if test "x$DOXYGEN" != "x"; then
2517da2777aaSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2518da2777aaSmrg   fi
2519da2777aaSmrg   have_doxygen=no
2520da2777aaSmrgelse
2521da2777aaSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
252243d802faSmrgfi
2523da2777aaSmrgm4_ifval([$1],
2524da2777aaSmrg[if test "$have_doxygen" = yes; then
2525da2777aaSmrg    # scrape the doxygen version
2526da2777aaSmrg    AC_MSG_CHECKING([the doxygen version])
2527da2777aaSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2528da2777aaSmrg    AC_MSG_RESULT([$doxygen_version])
2529da2777aaSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2530da2777aaSmrg        [if test "x$use_doxygen" = xauto; then
2531da2777aaSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2532da2777aaSmrg            have_doxygen=no
2533da2777aaSmrg        else
2534da2777aaSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2535da2777aaSmrg        fi])
2536da2777aaSmrgfi])
2537d63fdb69Smrg
2538da2777aaSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2539da2777aaSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2540da2777aaSmrgdnl 	HAVE_DOT = @HAVE_DOT@
2541da2777aaSmrgHAVE_DOT=no
2542da2777aaSmrgif test "x$have_doxygen" = "xyes"; then
2543da2777aaSmrg  AC_PATH_PROG([DOT], [dot])
2544da2777aaSmrg    if test "x$DOT" != "x"; then
2545da2777aaSmrg      HAVE_DOT=yes
2546da2777aaSmrg    fi
254743d802faSmrgfi
254843d802faSmrg
2549da2777aaSmrgAC_SUBST([HAVE_DOT])
2550da2777aaSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2551da2777aaSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2552da2777aaSmrg]) # XORG_WITH_DOXYGEN
2553d63fdb69Smrg
2554da2777aaSmrg# XORG_WITH_GROFF([DEFAULT])
255543d802faSmrg# ----------------
2556da2777aaSmrg# Minimum version: 1.6.0
2557da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
255843d802faSmrg#
2559da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2560da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2561da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2562da2777aaSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2563da2777aaSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2564da2777aaSmrg# --with-groff assumes 'auto'.
256543d802faSmrg#
2566da2777aaSmrg# Interface to module:
2567da2777aaSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2568da2777aaSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2569da2777aaSmrg# HAVE_GROFF_MS: the -ms macros package
2570da2777aaSmrg# GROFF:	 returns the path of the groff program found
2571da2777aaSmrg#		 returns the path set by the user in the environment
2572da2777aaSmrg# --with-groff:	 'yes' user instructs the module to use groff
2573da2777aaSmrg#		 'no' user instructs the module not to use groff
2574da2777aaSmrg#
2575da2777aaSmrg# Added in version 1.9.0:
2576da2777aaSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2577da2777aaSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2578da2777aaSmrg#		   psselect from the psutils package.
2579da2777aaSmrg#		   the ghostcript package. Refer to the grohtml man pages
2580da2777aaSmrg#
2581da2777aaSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2582da2777aaSmrg#
2583da2777aaSmrg# OS and distros often splits groff in a basic and full package, the former
2584da2777aaSmrg# having the groff program and the later having devices, fonts and macros
2585da2777aaSmrg# Checking for the groff executable is not enough.
2586da2777aaSmrg#
2587da2777aaSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2588da2777aaSmrg# unset HAVE_GROFF or GROFF env variables.
2589da2777aaSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2590da2777aaSmrg#
2591da2777aaSmrgAC_DEFUN([XORG_WITH_GROFF],[
2592da2777aaSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2593da2777aaSmrgm4_define([_defopt], m4_default([$1], [auto]))
2594da2777aaSmrgAC_ARG_WITH(groff,
2595da2777aaSmrg	AS_HELP_STRING([--with-groff],
2596da2777aaSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2597da2777aaSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2598da2777aaSmrgm4_undefine([_defopt])
25992a53b785Smrg
2600da2777aaSmrgif test "x$use_groff" = x"auto"; then
2601da2777aaSmrg   AC_PATH_PROG([GROFF], [groff])
2602da2777aaSmrg   if test "x$GROFF" = "x"; then
2603da2777aaSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2604da2777aaSmrg	have_groff=no
2605da2777aaSmrg   else
2606da2777aaSmrg        have_groff=yes
2607da2777aaSmrg   fi
2608da2777aaSmrgelif test "x$use_groff" = x"yes" ; then
2609da2777aaSmrg   AC_PATH_PROG([GROFF], [groff])
2610da2777aaSmrg   if test "x$GROFF" = "x"; then
2611da2777aaSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2612da2777aaSmrg   fi
2613da2777aaSmrg   have_groff=yes
2614da2777aaSmrgelif test "x$use_groff" = x"no" ; then
2615da2777aaSmrg   if test "x$GROFF" != "x"; then
2616da2777aaSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2617da2777aaSmrg   fi
2618da2777aaSmrg   have_groff=no
2619da2777aaSmrgelse
2620da2777aaSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2621da2777aaSmrgfi
26222a53b785Smrg
2623da2777aaSmrg# We have groff, test for the presence of the macro packages
2624da2777aaSmrgif test "x$have_groff" = x"yes"; then
2625da2777aaSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2626da2777aaSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2627da2777aaSmrg        groff_ms_works=yes
262843d802faSmrg    else
2629da2777aaSmrg        groff_ms_works=no
263043d802faSmrg    fi
2631da2777aaSmrg    AC_MSG_RESULT([$groff_ms_works])
2632da2777aaSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2633da2777aaSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2634da2777aaSmrg        groff_mm_works=yes
2635da2777aaSmrg    else
2636da2777aaSmrg        groff_mm_works=no
2637da2777aaSmrg    fi
2638da2777aaSmrg    AC_MSG_RESULT([$groff_mm_works])
2639da2777aaSmrgfi
26403da084b3Smrg
2641da2777aaSmrg# We have groff, test for HTML dependencies, one command per package
2642da2777aaSmrgif test "x$have_groff" = x"yes"; then
2643da2777aaSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2644da2777aaSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2645da2777aaSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2646da2777aaSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2647da2777aaSmrg      have_groff_html=yes
2648da2777aaSmrg   else
2649da2777aaSmrg      have_groff_html=no
2650da2777aaSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2651da2777aaSmrg   fi
2652da2777aaSmrgfi
265355acc8fcSmrg
2654da2777aaSmrg# Set Automake conditionals for Makefiles
2655da2777aaSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2656da2777aaSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2657da2777aaSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2658da2777aaSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2659da2777aaSmrg]) # XORG_WITH_GROFF
266055acc8fcSmrg
2661da2777aaSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2662da2777aaSmrg# ---------------------------------------
2663da2777aaSmrg# Minimum version: 1.6.0
2664da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2665da2777aaSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
266643d802faSmrg#
2667da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2668da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2669da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2670da2777aaSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2671da2777aaSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2672da2777aaSmrg# --with-fop assumes 'auto'.
267343d802faSmrg#
2674da2777aaSmrg# Interface to module:
2675da2777aaSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2676da2777aaSmrg# FOP:	 	returns the path of the fop program found
2677da2777aaSmrg#		returns the path set by the user in the environment
2678da2777aaSmrg# --with-fop: 	'yes' user instructs the module to use fop
2679da2777aaSmrg#		'no' user instructs the module not to use fop
268043d802faSmrg#
2681da2777aaSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
268243d802faSmrg#
2683da2777aaSmrgAC_DEFUN([XORG_WITH_FOP],[
2684da2777aaSmrgAC_ARG_VAR([FOP], [Path to fop command])
2685da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
2686da2777aaSmrgAC_ARG_WITH(fop,
2687da2777aaSmrg	AS_HELP_STRING([--with-fop],
2688da2777aaSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2689da2777aaSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2690da2777aaSmrgm4_undefine([_defopt])
269152fd71cdSmrg
2692da2777aaSmrgif test "x$use_fop" = x"auto"; then
2693da2777aaSmrg   AC_PATH_PROG([FOP], [fop])
2694da2777aaSmrg   if test "x$FOP" = "x"; then
2695da2777aaSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2696da2777aaSmrg	have_fop=no
2697da2777aaSmrg   else
2698da2777aaSmrg        have_fop=yes
2699da2777aaSmrg   fi
2700da2777aaSmrgelif test "x$use_fop" = x"yes" ; then
2701da2777aaSmrg   AC_PATH_PROG([FOP], [fop])
2702da2777aaSmrg   if test "x$FOP" = "x"; then
2703da2777aaSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2704da2777aaSmrg   fi
2705da2777aaSmrg   have_fop=yes
2706da2777aaSmrgelif test "x$use_fop" = x"no" ; then
2707da2777aaSmrg   if test "x$FOP" != "x"; then
2708da2777aaSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2709da2777aaSmrg   fi
2710da2777aaSmrg   have_fop=no
271143d802faSmrgelse
2712da2777aaSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
271343d802faSmrgfi
271452fd71cdSmrg
2715da2777aaSmrg# Test for a minimum version of fop, if provided.
2716da2777aaSmrgm4_ifval([$1],
2717da2777aaSmrg[if test "$have_fop" = yes; then
2718da2777aaSmrg    # scrape the fop version
2719da2777aaSmrg    AC_MSG_CHECKING([for fop minimum version])
2720da2777aaSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2721da2777aaSmrg    AC_MSG_RESULT([$fop_version])
2722da2777aaSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2723da2777aaSmrg        [if test "x$use_fop" = xauto; then
2724da2777aaSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2725da2777aaSmrg            have_fop=no
2726da2777aaSmrg        else
2727da2777aaSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2728da2777aaSmrg        fi])
2729da2777aaSmrgfi])
2730da2777aaSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2731da2777aaSmrg]) # XORG_WITH_FOP
27322a53b785Smrg
2733da2777aaSmrg# XORG_WITH_M4([MIN-VERSION])
2734da2777aaSmrg# ---------------------------
2735da2777aaSmrg# Minimum version: 1.19.0
2736da2777aaSmrg#
2737da2777aaSmrg# This macro attempts to locate an m4 macro processor which supports
2738da2777aaSmrg# -I option and is only useful for modules relying on M4 in order to
2739da2777aaSmrg# expand macros in source code files.
2740da2777aaSmrg#
2741da2777aaSmrg# Interface to module:
2742da2777aaSmrg# M4:	 	returns the path of the m4 program found
2743da2777aaSmrg#		returns the path set by the user in the environment
2744da2777aaSmrg#
2745da2777aaSmrgAC_DEFUN([XORG_WITH_M4], [
2746da2777aaSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2747da2777aaSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2748da2777aaSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2749da2777aaSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2750da2777aaSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2751da2777aaSmrg   [$PATH:/usr/gnu/bin])])
27522a53b785Smrg
2753da2777aaSmrgAC_SUBST([M4], [$ac_cv_path_M4])
2754da2777aaSmrg]) # XORG_WITH_M4
275552fd71cdSmrg
2756da2777aaSmrg# XORG_WITH_PS2PDF([DEFAULT])
2757da2777aaSmrg# ----------------
2758da2777aaSmrg# Minimum version: 1.6.0
2759da2777aaSmrg# Minimum version for optional DEFAULT argument: 1.11.0
276043d802faSmrg#
2761da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2762da2777aaSmrg# not at the appropriate level. This macro enables a module to test for the
2763da2777aaSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2764da2777aaSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2765da2777aaSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2766da2777aaSmrg# --with-ps2pdf assumes 'auto'.
2767da2777aaSmrg#
2768da2777aaSmrg# Interface to module:
2769da2777aaSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2770da2777aaSmrg# PS2PDF:	returns the path of the ps2pdf program found
2771da2777aaSmrg#		returns the path set by the user in the environment
2772da2777aaSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2773da2777aaSmrg#		 'no' user instructs the module not to use ps2pdf
2774da2777aaSmrg#
2775da2777aaSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2776da2777aaSmrg#
2777da2777aaSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2778da2777aaSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2779da2777aaSmrgm4_define([_defopt], m4_default([$1], [auto]))
2780da2777aaSmrgAC_ARG_WITH(ps2pdf,
2781da2777aaSmrg	AS_HELP_STRING([--with-ps2pdf],
2782da2777aaSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2783da2777aaSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2784da2777aaSmrgm4_undefine([_defopt])
278552fd71cdSmrg
2786da2777aaSmrgif test "x$use_ps2pdf" = x"auto"; then
2787da2777aaSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2788da2777aaSmrg   if test "x$PS2PDF" = "x"; then
2789da2777aaSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2790da2777aaSmrg	have_ps2pdf=no
2791da2777aaSmrg   else
2792da2777aaSmrg        have_ps2pdf=yes
2793da2777aaSmrg   fi
2794da2777aaSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2795da2777aaSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2796da2777aaSmrg   if test "x$PS2PDF" = "x"; then
2797da2777aaSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2798da2777aaSmrg   fi
2799da2777aaSmrg   have_ps2pdf=yes
2800da2777aaSmrgelif test "x$use_ps2pdf" = x"no" ; then
2801da2777aaSmrg   if test "x$PS2PDF" != "x"; then
2802da2777aaSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2803da2777aaSmrg   fi
2804da2777aaSmrg   have_ps2pdf=no
2805da2777aaSmrgelse
2806da2777aaSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2807da2777aaSmrgfi
2808da2777aaSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2809da2777aaSmrg]) # XORG_WITH_PS2PDF
281052fd71cdSmrg
2811da2777aaSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2812da2777aaSmrg# ----------------
2813da2777aaSmrg# Minimum version: 1.6.0
2814da2777aaSmrg#
2815da2777aaSmrg# Documentation tools are not always available on all platforms and sometimes
2816da2777aaSmrg# not at the appropriate level. This macro enables a builder to skip all
2817da2777aaSmrg# documentation targets except traditional man pages.
2818da2777aaSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2819da2777aaSmrg# maximum flexibility in controlling documentation building.
2820da2777aaSmrg# Refer to:
2821da2777aaSmrg# XORG_WITH_XMLTO         --with-xmlto
2822da2777aaSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2823da2777aaSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2824da2777aaSmrg# XORG_WITH_FOP           --with-fop
2825da2777aaSmrg# XORG_WITH_GROFF         --with-groff
2826da2777aaSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2827da2777aaSmrg#
2828da2777aaSmrg# Interface to module:
2829da2777aaSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2830da2777aaSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2831da2777aaSmrg#		 'no' user instructs the module not to generate docs
2832da2777aaSmrg# parm1:	specify the default value, yes or no.
2833da2777aaSmrg#
2834da2777aaSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2835da2777aaSmrgm4_define([docs_default], m4_default([$1], [yes]))
2836da2777aaSmrgAC_ARG_ENABLE(docs,
2837da2777aaSmrg	AS_HELP_STRING([--enable-docs],
2838da2777aaSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2839da2777aaSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2840da2777aaSmrgm4_undefine([docs_default])
2841da2777aaSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2842da2777aaSmrgAC_MSG_CHECKING([whether to build documentation])
2843da2777aaSmrgAC_MSG_RESULT([$build_docs])
2844da2777aaSmrg]) # XORG_ENABLE_DOCS
284552fd71cdSmrg
2846da2777aaSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2847da2777aaSmrg# ----------------
2848da2777aaSmrg# Minimum version: 1.6.0
284943d802faSmrg#
2850da2777aaSmrg# This macro enables a builder to skip all developer documentation.
2851da2777aaSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2852da2777aaSmrg# maximum flexibility in controlling documentation building.
2853da2777aaSmrg# Refer to:
2854da2777aaSmrg# XORG_WITH_XMLTO         --with-xmlto
2855da2777aaSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2856da2777aaSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2857da2777aaSmrg# XORG_WITH_FOP           --with-fop
2858da2777aaSmrg# XORG_WITH_GROFF         --with-groff
2859da2777aaSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2860da2777aaSmrg#
2861da2777aaSmrg# Interface to module:
2862da2777aaSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2863da2777aaSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2864da2777aaSmrg#			'no' user instructs the module not to generate developer docs
2865da2777aaSmrg# parm1:		specify the default value, yes or no.
2866da2777aaSmrg#
2867da2777aaSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2868da2777aaSmrgm4_define([devel_default], m4_default([$1], [yes]))
2869da2777aaSmrgAC_ARG_ENABLE(devel-docs,
2870da2777aaSmrg	AS_HELP_STRING([--enable-devel-docs],
2871da2777aaSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2872da2777aaSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2873da2777aaSmrgm4_undefine([devel_default])
2874da2777aaSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2875da2777aaSmrgAC_MSG_CHECKING([whether to build developer documentation])
2876da2777aaSmrgAC_MSG_RESULT([$build_devel_docs])
2877da2777aaSmrg]) # XORG_ENABLE_DEVEL_DOCS
287852fd71cdSmrg
2879da2777aaSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2880da2777aaSmrg# ----------------
2881da2777aaSmrg# Minimum version: 1.6.0
2882da2777aaSmrg#
2883da2777aaSmrg# This macro enables a builder to skip all functional specification targets.
2884da2777aaSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2885da2777aaSmrg# maximum flexibility in controlling documentation building.
2886da2777aaSmrg# Refer to:
2887da2777aaSmrg# XORG_WITH_XMLTO         --with-xmlto
2888da2777aaSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2889da2777aaSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2890da2777aaSmrg# XORG_WITH_FOP           --with-fop
2891da2777aaSmrg# XORG_WITH_GROFF         --with-groff
2892da2777aaSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2893da2777aaSmrg#
2894da2777aaSmrg# Interface to module:
2895da2777aaSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2896da2777aaSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2897da2777aaSmrg#			'no' user instructs the module not to generate specs
2898da2777aaSmrg# parm1:		specify the default value, yes or no.
2899da2777aaSmrg#
2900da2777aaSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2901da2777aaSmrgm4_define([spec_default], m4_default([$1], [yes]))
2902da2777aaSmrgAC_ARG_ENABLE(specs,
2903da2777aaSmrg	AS_HELP_STRING([--enable-specs],
2904da2777aaSmrg	   [Enable building the specs (default: ]spec_default[)]),
2905da2777aaSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2906da2777aaSmrgm4_undefine([spec_default])
2907da2777aaSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2908da2777aaSmrgAC_MSG_CHECKING([whether to build functional specifications])
2909da2777aaSmrgAC_MSG_RESULT([$build_specs])
2910da2777aaSmrg]) # XORG_ENABLE_SPECS
291152fd71cdSmrg
2912da2777aaSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2913da2777aaSmrg# ----------------------------------------------
2914da2777aaSmrg# Minimum version: 1.13.0
291543d802faSmrg#
2916da2777aaSmrg# This macro enables a builder to enable/disable unit testing
2917da2777aaSmrg# It makes no assumption about the test cases implementation
2918da2777aaSmrg# Test cases may or may not use Automake "Support for test suites"
2919da2777aaSmrg# They may or may not use the software utility library GLib
2920da2777aaSmrg#
2921da2777aaSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2922da2777aaSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2923da2777aaSmrg# The variable enable_unit_tests is used by other macros in this file.
2924da2777aaSmrg#
2925da2777aaSmrg# Interface to module:
2926da2777aaSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2927da2777aaSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2928da2777aaSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2929da2777aaSmrg#			'no' user instructs the module not to build tests
2930da2777aaSmrg# parm1:		specify the default value, yes or no.
2931da2777aaSmrg#
2932da2777aaSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2933da2777aaSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2934da2777aaSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2935da2777aaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2936da2777aaSmrgm4_define([_defopt], m4_default([$1], [auto]))
2937da2777aaSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2938da2777aaSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2939da2777aaSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2940da2777aaSmrgm4_undefine([_defopt])
2941da2777aaSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2942da2777aaSmrgAC_MSG_CHECKING([whether to build unit test cases])
2943da2777aaSmrgAC_MSG_RESULT([$enable_unit_tests])
2944da2777aaSmrg]) # XORG_ENABLE_UNIT_TESTS
294552fd71cdSmrg
2946da2777aaSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2947da2777aaSmrg# ------------------------------------------------------
2948da2777aaSmrg# Minimum version: 1.17.0
2949da2777aaSmrg#
2950da2777aaSmrg# This macro enables a builder to enable/disable integration testing
2951da2777aaSmrg# It makes no assumption about the test cases' implementation
2952da2777aaSmrg# Test cases may or may not use Automake "Support for test suites"
2953da2777aaSmrg#
2954da2777aaSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2955da2777aaSmrg# usually requires less dependencies and may be built and run under less
2956da2777aaSmrg# stringent environments than integration tests.
2957da2777aaSmrg#
2958da2777aaSmrg# Interface to module:
2959da2777aaSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2960da2777aaSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2961da2777aaSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2962da2777aaSmrg#                             'no' user instructs the module not to build tests
2963da2777aaSmrg# parm1:                      specify the default value, yes or no.
2964da2777aaSmrg#
2965da2777aaSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2966da2777aaSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2967da2777aaSmrgm4_define([_defopt], m4_default([$1], [auto]))
2968da2777aaSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2969da2777aaSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2970da2777aaSmrg	[enable_integration_tests=$enableval],
2971da2777aaSmrg	[enable_integration_tests=]_defopt)
2972da2777aaSmrgm4_undefine([_defopt])
2973da2777aaSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2974da2777aaSmrg	[test "x$enable_integration_tests" != xno])
2975da2777aaSmrgAC_MSG_CHECKING([whether to build unit test cases])
2976da2777aaSmrgAC_MSG_RESULT([$enable_integration_tests])
2977da2777aaSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
297852fd71cdSmrg
2979da2777aaSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2980da2777aaSmrg# ----------------------------------------
2981da2777aaSmrg# Minimum version: 1.13.0
2982da2777aaSmrg#
2983da2777aaSmrg# GLib is a library which provides advanced data structures and functions.
2984da2777aaSmrg# This macro enables a module to test for the presence of Glib.
2985da2777aaSmrg#
2986da2777aaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2987da2777aaSmrg# Otherwise the value of $enable_unit_tests is blank.
2988da2777aaSmrg#
2989da2777aaSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2990da2777aaSmrg# test support usually requires less dependencies and may be built and run under
2991da2777aaSmrg# less stringent environments than integration tests.
2992da2777aaSmrg#
2993da2777aaSmrg# Interface to module:
2994da2777aaSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2995da2777aaSmrg# with_glib: used in configure.ac to know if GLib has been found
2996da2777aaSmrg# --with-glib:	'yes' user instructs the module to use glib
2997da2777aaSmrg#		'no' user instructs the module not to use glib
2998da2777aaSmrg#
2999da2777aaSmrgAC_DEFUN([XORG_WITH_GLIB],[
3000da2777aaSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3001da2777aaSmrgm4_define([_defopt], m4_default([$2], [auto]))
3002da2777aaSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
3003da2777aaSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
3004da2777aaSmrg	[with_glib=$withval], [with_glib=]_defopt)
3005da2777aaSmrgm4_undefine([_defopt])
300652fd71cdSmrg
3007da2777aaSmrghave_glib=no
3008da2777aaSmrg# Do not probe GLib if user explicitly disabled unit testing
3009da2777aaSmrgif test "x$enable_unit_tests" != x"no"; then
3010da2777aaSmrg  # Do not probe GLib if user explicitly disabled it
3011da2777aaSmrg  if test "x$with_glib" != x"no"; then
3012da2777aaSmrg    m4_ifval(
3013da2777aaSmrg      [$1],
3014da2777aaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
3015da2777aaSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
3016da2777aaSmrg    )
301743d802faSmrg  fi
301843d802faSmrgfi
301952fd71cdSmrg
3020da2777aaSmrg# Not having GLib when unit testing has been explicitly requested is an error
3021da2777aaSmrgif test "x$enable_unit_tests" = x"yes"; then
3022da2777aaSmrg  if test "x$have_glib" = x"no"; then
3023da2777aaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
302443d802faSmrg  fi
302543d802faSmrgfi
302652fd71cdSmrg
3027da2777aaSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
3028da2777aaSmrgif test "x$enable_unit_tests" = x"no"; then
3029da2777aaSmrg  if test "x$with_glib" = x"yes"; then
3030da2777aaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3031da2777aaSmrg  fi
303243d802faSmrgfi
303352fd71cdSmrg
3034da2777aaSmrg# Not having GLib when it has been explicitly requested is an error
3035da2777aaSmrgif test "x$with_glib" = x"yes"; then
3036da2777aaSmrg  if test "x$have_glib" = x"no"; then
3037da2777aaSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
3038da2777aaSmrg  fi
3039da2777aaSmrgfi
304052fd71cdSmrg
3041da2777aaSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
3042da2777aaSmrg]) # XORG_WITH_GLIB
304352fd71cdSmrg
3044da2777aaSmrg# XORG_LD_WRAP([required|optional])
3045da2777aaSmrg# ---------------------------------
3046da2777aaSmrg# Minimum version: 1.13.0
3047da2777aaSmrg#
3048da2777aaSmrg# Check if linker supports -wrap, passed via compiler flags
3049da2777aaSmrg#
3050da2777aaSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
3051da2777aaSmrg# Otherwise the value of $enable_unit_tests is blank.
3052da2777aaSmrg#
3053da2777aaSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
3054da2777aaSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
3055da2777aaSmrg# available, an argument of "optional" allows use when some unit tests require
3056da2777aaSmrg# ld -wrap and others do not.
3057da2777aaSmrg#
3058da2777aaSmrgAC_DEFUN([XORG_LD_WRAP],[
3059da2777aaSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
3060da2777aaSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
3061da2777aaSmrg                      void __wrap_exit(int status) { return; }],
3062da2777aaSmrg                     [exit(0);])])
3063da2777aaSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
3064da2777aaSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
3065da2777aaSmrg  if test "x$have_ld_wrap" = x"no"; then
3066da2777aaSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
3067da2777aaSmrg  fi
3068da2777aaSmrgfi
3069da2777aaSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
3070da2777aaSmrg#
3071da2777aaSmrg]) # XORG_LD_WRAP
307252fd71cdSmrg
3073da2777aaSmrg# XORG_CHECK_LINKER_FLAGS
3074da2777aaSmrg# -----------------------
3075da2777aaSmrg# SYNOPSIS
3076da2777aaSmrg#
3077da2777aaSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
3078da2777aaSmrg#
3079da2777aaSmrg# DESCRIPTION
3080da2777aaSmrg#
3081da2777aaSmrg#   Check whether the given linker FLAGS work with the current language's
3082da2777aaSmrg#   linker, or whether they give an error.
3083da2777aaSmrg#
3084da2777aaSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
3085da2777aaSmrg#   success/failure.
3086da2777aaSmrg#
3087da2777aaSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
3088da2777aaSmrg#
3089da2777aaSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
3090da2777aaSmrg#
3091da2777aaSmrg# LICENSE
3092da2777aaSmrg#
3093da2777aaSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
3094da2777aaSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
3095da2777aaSmrg#   Copyright (c) 2009 Matteo Frigo
3096da2777aaSmrg#
3097da2777aaSmrg#   This program is free software: you can redistribute it and/or modify it
3098da2777aaSmrg#   under the terms of the GNU General Public License as published by the
3099da2777aaSmrg#   Free Software Foundation, either version 3 of the License, or (at your
3100da2777aaSmrg#   option) any later version.
3101da2777aaSmrg#
3102da2777aaSmrg#   This program is distributed in the hope that it will be useful, but
3103da2777aaSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
3104da2777aaSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
3105da2777aaSmrg#   Public License for more details.
3106da2777aaSmrg#
3107da2777aaSmrg#   You should have received a copy of the GNU General Public License along
3108da2777aaSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
3109da2777aaSmrg#
3110da2777aaSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
3111da2777aaSmrg#   gives unlimited permission to copy, distribute and modify the configure
3112da2777aaSmrg#   scripts that are the output of Autoconf when processing the Macro. You
3113da2777aaSmrg#   need not follow the terms of the GNU General Public License when using
3114da2777aaSmrg#   or distributing such scripts, even though portions of the text of the
3115da2777aaSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
3116da2777aaSmrg#   all other use of the material that constitutes the Autoconf Macro.
3117da2777aaSmrg#
3118da2777aaSmrg#   This special exception to the GPL applies to versions of the Autoconf
3119da2777aaSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
3120da2777aaSmrg#   modified version of the Autoconf Macro, you may extend this special
3121da2777aaSmrg#   exception to the GPL to apply to your modified version as well.#
3122da2777aaSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
3123da2777aaSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
3124da2777aaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
3125da2777aaSmrgAS_LITERAL_IF([$1],
3126da2777aaSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
3127da2777aaSmrg      ax_save_FLAGS=$LDFLAGS
3128da2777aaSmrg      LDFLAGS="$1"
3129da2777aaSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
3130da2777aaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3131da2777aaSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3132da2777aaSmrg      LDFLAGS=$ax_save_FLAGS])],
3133da2777aaSmrg  [ax_save_FLAGS=$LDFLAGS
3134da2777aaSmrg   LDFLAGS="$1"
3135da2777aaSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3136da2777aaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3137da2777aaSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3138da2777aaSmrg   LDFLAGS=$ax_save_FLAGS])
3139da2777aaSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3140da2777aaSmrgAC_MSG_RESULT($xorg_check_linker_flags)
3141da2777aaSmrgif test "x$xorg_check_linker_flags" = xyes; then
3142da2777aaSmrg	m4_default([$2], :)
3143da2777aaSmrgelse
3144da2777aaSmrg	m4_default([$3], :)
3145da2777aaSmrgfi
3146da2777aaSmrg]) # XORG_CHECK_LINKER_FLAGS
314752fd71cdSmrg
3148da2777aaSmrg# XORG_MEMORY_CHECK_FLAGS
3149da2777aaSmrg# -----------------------
3150da2777aaSmrg# Minimum version: 1.16.0
3151da2777aaSmrg#
3152da2777aaSmrg# This macro attempts to find appropriate memory checking functionality
3153da2777aaSmrg# for various platforms which unit testing code may use to catch various
3154da2777aaSmrg# forms of memory allocation and access errors in testing.
3155da2777aaSmrg#
3156da2777aaSmrg# Interface to module:
3157da2777aaSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
3158da2777aaSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
3159da2777aaSmrg#
3160da2777aaSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
3161da2777aaSmrg#
3162da2777aaSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
316352fd71cdSmrg
3164da2777aaSmrgAC_REQUIRE([AC_CANONICAL_HOST])
3165da2777aaSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
3166da2777aaSmrg           [Environment variables to enable memory checking in tests])
316752fd71cdSmrg
3168da2777aaSmrg# Check for different types of support on different platforms
3169da2777aaSmrgcase $host_os in
3170da2777aaSmrg    solaris*)
3171da2777aaSmrg        AC_CHECK_LIB([umem], [umem_alloc],
3172da2777aaSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
3173da2777aaSmrg        ;;
3174da2777aaSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
3175da2777aaSmrg        # both directly and inverted, so should not be 0 or 255.
3176da2777aaSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
3177da2777aaSmrg        ;;
3178da2777aaSmrg    darwin*)
3179da2777aaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
3180da2777aaSmrg        ;;
3181da2777aaSmrg    *bsd*)
3182da2777aaSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
3183da2777aaSmrg        ;;
3184da2777aaSmrgesac
318552fd71cdSmrg
3186da2777aaSmrg# User supplied flags override default flags
3187da2777aaSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
3188da2777aaSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
318943d802faSmrgfi
319052fd71cdSmrg
3191da2777aaSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
3192da2777aaSmrg]) # XORG_WITH_LINT
319352fd71cdSmrg
3194da2777aaSmrg# XORG_CHECK_MALLOC_ZERO
3195da2777aaSmrg# ----------------------
3196da2777aaSmrg# Minimum version: 1.0.0
319743d802faSmrg#
3198da2777aaSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3199da2777aaSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
3200da2777aaSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3201da2777aaSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3202da2777aaSmrgAC_ARG_ENABLE(malloc0returnsnull,
3203da2777aaSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
3204da2777aaSmrg		       [malloc(0) returns NULL (default: auto)]),
3205da2777aaSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3206da2777aaSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
320752fd71cdSmrg
3208da2777aaSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
3209da2777aaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3210da2777aaSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
3211da2777aaSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
3212da2777aaSmrg#include <stdlib.h>
3213da2777aaSmrg],[
3214da2777aaSmrg    char *m0, *r0, *c0, *p;
3215da2777aaSmrg    m0 = malloc(0);
3216da2777aaSmrg    p = malloc(10);
3217da2777aaSmrg    r0 = realloc(p,0);
3218da2777aaSmrg    c0 = calloc(0,10);
3219da2777aaSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3220da2777aaSmrg])],
3221da2777aaSmrg		[xorg_cv_malloc0_returns_null=yes],
3222da2777aaSmrg		[xorg_cv_malloc0_returns_null=no])])
3223da2777aaSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
322443d802faSmrgfi
3225da2777aaSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
322652fd71cdSmrg
3227da2777aaSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3228da2777aaSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3229da2777aaSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3230da2777aaSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
323143d802faSmrgelse
3232da2777aaSmrg	MALLOC_ZERO_CFLAGS=""
3233da2777aaSmrg	XMALLOC_ZERO_CFLAGS=""
3234da2777aaSmrg	XTMALLOC_ZERO_CFLAGS=""
323543d802faSmrgfi
323652fd71cdSmrg
3237da2777aaSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
3238da2777aaSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
3239da2777aaSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
3240da2777aaSmrg]) # XORG_CHECK_MALLOC_ZERO
324152fd71cdSmrg
3242da2777aaSmrg# XORG_WITH_LINT()
3243da2777aaSmrg# ----------------
3244da2777aaSmrg# Minimum version: 1.1.0
324543d802faSmrg#
3246da2777aaSmrg# This macro enables the use of a tool that flags some suspicious and
3247da2777aaSmrg# non-portable constructs (likely to be bugs) in C language source code.
3248da2777aaSmrg# It will attempt to locate the tool and use appropriate options.
3249da2777aaSmrg# There are various lint type tools on different platforms.
325043d802faSmrg#
3251da2777aaSmrg# Interface to module:
3252da2777aaSmrg# LINT:		returns the path to the tool found on the platform
3253da2777aaSmrg#		or the value set to LINT on the configure cmd line
3254da2777aaSmrg#		also an Automake conditional
3255da2777aaSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3256da2777aaSmrg#
3257da2777aaSmrg# --with-lint:	'yes' user instructs the module to use lint
3258da2777aaSmrg#		'no' user instructs the module not to use lint (default)
3259da2777aaSmrg#
3260da2777aaSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3261da2777aaSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3262da2777aaSmrg#
3263da2777aaSmrgAC_DEFUN([XORG_WITH_LINT],[
326452fd71cdSmrg
3265da2777aaSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3266da2777aaSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3267da2777aaSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3268da2777aaSmrg		[Use a lint-style source code checker (default: disabled)])],
3269da2777aaSmrg		[use_lint=$withval], [use_lint=no])
32702a53b785Smrg
3271da2777aaSmrg# Obtain platform specific info like program name and options
3272da2777aaSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3273da2777aaSmrgcase $host_os in
3274da2777aaSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3275da2777aaSmrg	lint_name=splint
3276da2777aaSmrg	lint_options="-badflag"
3277da2777aaSmrg	;;
3278da2777aaSmrg  *freebsd* | *netbsd*)
3279da2777aaSmrg	lint_name=lint
3280da2777aaSmrg	lint_options="-u -b"
3281da2777aaSmrg	;;
3282da2777aaSmrg  *solaris*)
3283da2777aaSmrg	lint_name=lint
3284da2777aaSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3285da2777aaSmrg	;;
3286da2777aaSmrgesac
3287da2777aaSmrg
3288da2777aaSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3289da2777aaSmrgif test "x$use_lint" = x"yes" ; then
3290da2777aaSmrg   AC_PATH_PROG([LINT], [$lint_name])
3291da2777aaSmrg   if test "x$LINT" = "x"; then
3292da2777aaSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3293da2777aaSmrg   fi
3294da2777aaSmrgelif test "x$use_lint" = x"no" ; then
3295da2777aaSmrg   if test "x$LINT" != "x"; then
3296da2777aaSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3297da2777aaSmrg   fi
329843d802faSmrgelse
3299da2777aaSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
330043d802faSmrgfi
330152fd71cdSmrg
3302da2777aaSmrg# User supplied flags override default flags
3303da2777aaSmrgif test "x$LINT_FLAGS" != "x"; then
3304da2777aaSmrg   lint_options=$LINT_FLAGS
3305da2777aaSmrgfi
330652fd71cdSmrg
3307da2777aaSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3308da2777aaSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
330952fd71cdSmrg
3310da2777aaSmrg]) # XORG_WITH_LINT
331152fd71cdSmrg
3312da2777aaSmrg# XORG_LINT_LIBRARY(LIBNAME)
3313da2777aaSmrg# --------------------------
3314da2777aaSmrg# Minimum version: 1.1.0
331543d802faSmrg#
3316da2777aaSmrg# Sets up flags for building lint libraries for checking programs that call
3317da2777aaSmrg# functions in the library.
3318da2777aaSmrg#
3319da2777aaSmrg# Interface to module:
3320da2777aaSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3321da2777aaSmrg# MAKE_LINT_LIB		- Automake conditional
3322da2777aaSmrg#
3323da2777aaSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3324da2777aaSmrg#			  - 'no' user instructs the module not to create a lint library (default)
332552fd71cdSmrg
3326da2777aaSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3327da2777aaSmrgAC_REQUIRE([XORG_WITH_LINT])
3328da2777aaSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3329da2777aaSmrg	[Create lint library (default: disabled)])],
3330da2777aaSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3331da2777aaSmrg
3332da2777aaSmrgif test "x$make_lint_lib" = x"yes" ; then
3333da2777aaSmrg   LINTLIB=llib-l$1.ln
3334da2777aaSmrg   if test "x$LINT" = "x"; then
3335da2777aaSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3336da2777aaSmrg   fi
3337da2777aaSmrgelif test "x$make_lint_lib" != x"no" ; then
3338da2777aaSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
333943d802faSmrgfi
33402a53b785Smrg
3341da2777aaSmrgAC_SUBST(LINTLIB)
3342da2777aaSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
334352fd71cdSmrg
3344da2777aaSmrg]) # XORG_LINT_LIBRARY
334552fd71cdSmrg
3346da2777aaSmrg# XORG_COMPILER_BRAND
334743d802faSmrg# -------------------
3348da2777aaSmrg# Minimum version: 1.14.0
334943d802faSmrg#
3350da2777aaSmrg# Checks for various brands of compilers and sets flags as appropriate:
3351da2777aaSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3352da2777aaSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3353da2777aaSmrg#   clang compiler - sets CLANGCC to "yes"
3354da2777aaSmrg#   Intel compiler - sets INTELCC to "yes"
3355da2777aaSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3356da2777aaSmrg#
3357da2777aaSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3358da2777aaSmrgAC_LANG_CASE(
3359da2777aaSmrg	[C], [
3360da2777aaSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3361da2777aaSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3362da2777aaSmrg		m4_version_prereq([2.70],
3363da2777aaSmrg			[AC_REQUIRE([AC_PROG_CC])],
3364da2777aaSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3365da2777aaSmrg	],
3366da2777aaSmrg	[C++], [
3367da2777aaSmrg		AC_REQUIRE([AC_PROG_CXX])
3368da2777aaSmrg	]
3369da2777aaSmrg)
3370da2777aaSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3371da2777aaSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3372da2777aaSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3373da2777aaSmrg]) # XORG_COMPILER_BRAND
33742a53b785Smrg
3375da2777aaSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
337643d802faSmrg# ---------------
3377da2777aaSmrg# Minimum version: 1.16.0
3378da2777aaSmrg#
3379da2777aaSmrg# Test if the compiler works when passed the given flag as a command line argument.
3380da2777aaSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3381da2777aaSmrg# next flag in the list until there are no more options.
3382da2777aaSmrg#
3383da2777aaSmrg# Note that this does not guarantee that the compiler supports the flag as some
3384da2777aaSmrg# compilers will simply ignore arguments that they do not understand, but we do
3385da2777aaSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3386da2777aaSmrg# -Werror=unused-command-line-argument
3387da2777aaSmrg#
3388da2777aaSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3389da2777aaSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3390da2777aaSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
33912a53b785Smrg
3392da2777aaSmrgAC_LANG_COMPILER_REQUIRE
33932a53b785Smrg
3394da2777aaSmrgAC_LANG_CASE(
3395da2777aaSmrg	[C], [
3396da2777aaSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3397da2777aaSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3398da2777aaSmrg		m4_version_prereq([2.70],
3399da2777aaSmrg			[AC_REQUIRE([AC_PROG_CC])],
3400da2777aaSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3401da2777aaSmrg		define([PREFIX], [C])
3402da2777aaSmrg		define([CACHE_PREFIX], [cc])
3403da2777aaSmrg		define([COMPILER], [$CC])
3404da2777aaSmrg	],
3405da2777aaSmrg	[C++], [
3406da2777aaSmrg		define([PREFIX], [CXX])
3407da2777aaSmrg		define([CACHE_PREFIX], [cxx])
3408da2777aaSmrg		define([COMPILER], [$CXX])
3409da2777aaSmrg	]
3410da2777aaSmrg)
3411da2777aaSmrg
3412da2777aaSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3413da2777aaSmrg
3414da2777aaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3415da2777aaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3416da2777aaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3417da2777aaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3418da2777aaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3419da2777aaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3420da2777aaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3421da2777aaSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3422da2777aaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
342343d802faSmrgfi
3424da2777aaSmrg
3425da2777aaSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3426da2777aaSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3427da2777aaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3428da2777aaSmrg	fi
3429da2777aaSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3430da2777aaSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3431da2777aaSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3432da2777aaSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3433da2777aaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3434da2777aaSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3435da2777aaSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3436da2777aaSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
343743d802faSmrgfi
3438da2777aaSmrg
3439da2777aaSmrgfound="no"
3440da2777aaSmrgm4_foreach([flag], m4_cdr($@), [
3441da2777aaSmrg	if test $found = "no" ; then
3442da2777aaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3443da2777aaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3444da2777aaSmrg		fi
3445da2777aaSmrg
3446da2777aaSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3447da2777aaSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3448da2777aaSmrg		fi
3449da2777aaSmrg
3450da2777aaSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3451da2777aaSmrg
3452da2777aaSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3453da2777aaSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3454da2777aaSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3455da2777aaSmrg		AC_CACHE_VAL($cacheid,
3456da2777aaSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3457da2777aaSmrg					     [eval $cacheid=yes],
3458da2777aaSmrg					     [eval $cacheid=no])])
3459da2777aaSmrg
3460da2777aaSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3461da2777aaSmrg
3462da2777aaSmrg		eval supported=\$$cacheid
3463da2777aaSmrg		AC_MSG_RESULT([$supported])
3464da2777aaSmrg		if test "$supported" = "yes" ; then
3465da2777aaSmrg			$1="$$1 ]flag["
3466da2777aaSmrg			found="yes"
3467da2777aaSmrg		fi
3468da2777aaSmrg	fi
346943d802faSmrg])
3470da2777aaSmrg]) # XORG_TESTSET_CFLAG
34712a53b785Smrg
3472da2777aaSmrg# XORG_COMPILER_FLAGS
3473da2777aaSmrg# ---------------
3474da2777aaSmrg# Minimum version: 1.16.0
347543d802faSmrg#
3476da2777aaSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3477da2777aaSmrg# arguments supported by the selected compiler which do NOT alter the generated
3478da2777aaSmrg# code.  These arguments will cause the compiler to print various warnings
3479da2777aaSmrg# during compilation AND turn a conservative set of warnings into errors.
3480da2777aaSmrg#
3481da2777aaSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3482da2777aaSmrg# future versions of util-macros as options are added to new compilers.
3483da2777aaSmrg#
3484da2777aaSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3485da2777aaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
348652fd71cdSmrg
3487da2777aaSmrgAC_ARG_ENABLE(selective-werror,
3488da2777aaSmrg              AS_HELP_STRING([--disable-selective-werror],
3489da2777aaSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3490da2777aaSmrg              [SELECTIVE_WERROR=$enableval],
3491da2777aaSmrg              [SELECTIVE_WERROR=yes])
3492da2777aaSmrg
3493da2777aaSmrgAC_LANG_CASE(
3494da2777aaSmrg        [C], [
3495da2777aaSmrg                define([PREFIX], [C])
3496da2777aaSmrg        ],
3497da2777aaSmrg        [C++], [
3498da2777aaSmrg                define([PREFIX], [CXX])
3499da2777aaSmrg        ]
3500da2777aaSmrg)
3501da2777aaSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3502da2777aaSmrgif test "x$SUNCC" = "xyes"; then
3503da2777aaSmrg    [BASE_]PREFIX[FLAGS]="-v"
350443d802faSmrgelse
3505da2777aaSmrg    [BASE_]PREFIX[FLAGS]=""
350643d802faSmrgfi
3507d63fdb69Smrg
3508da2777aaSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3509da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3510da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3511da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3512da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
351355acc8fcSmrg
3514da2777aaSmrgAC_LANG_CASE(
3515da2777aaSmrg	[C], [
3516da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3517da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3518da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3519da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3520da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3521da2777aaSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3522da2777aaSmrg	]
3523da2777aaSmrg)
352455acc8fcSmrg
3525da2777aaSmrg# This chunk adds additional warnings that could catch undesired effects.
3526da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3527da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3528da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3529da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3530da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3531da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3532da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3533d63fdb69Smrg
3534da2777aaSmrg# These are currently disabled because they are noisy.  They will be enabled
3535da2777aaSmrg# in the future once the codebase is sufficiently modernized to silence
3536da2777aaSmrg# them.  For now, I don't want them to drown out the other warnings.
3537da2777aaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3538da2777aaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3539da2777aaSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3540d63fdb69Smrg
3541da2777aaSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3542da2777aaSmrg# when there are problems that should be fixed.
354355acc8fcSmrg
3544da2777aaSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3545da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3546da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3547da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3548da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3549da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3550da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3551da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3552da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3553da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3554da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3555da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3556da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3557da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3558da2777aaSmrgelse
3559da2777aaSmrgAC_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])
3560da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3561da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3562da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3563da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3564da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3565da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3566da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3567da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3568da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3569da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3570da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3571da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3572da2777aaSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3573da2777aaSmrgfi
3574e1c0d025Smrg
3575da2777aaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3576da2777aaSmrg]) # XORG_COMPILER_FLAGS
3577da2777aaSmrg
3578da2777aaSmrg# XORG_CWARNFLAGS
3579da2777aaSmrg# ---------------
3580da2777aaSmrg# Minimum version: 1.2.0
3581da2777aaSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
358243d802faSmrg#
3583da2777aaSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3584da2777aaSmrg#
3585da2777aaSmrg# This function is deprecated because it defines -fno-strict-aliasing
3586da2777aaSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3587da2777aaSmrg# is needed, then it should be added explicitly in the module when
3588da2777aaSmrg# it is updated to use BASE_CFLAGS.
3589da2777aaSmrg#
3590da2777aaSmrgAC_DEFUN([XORG_CWARNFLAGS], [
3591da2777aaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3592da2777aaSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3593da2777aaSmrgAC_LANG_CASE(
3594da2777aaSmrg	[C], [
3595da2777aaSmrg		CWARNFLAGS="$BASE_CFLAGS"
3596da2777aaSmrg		if  test "x$GCC" = xyes ; then
3597da2777aaSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3598da2777aaSmrg		fi
3599da2777aaSmrg		AC_SUBST(CWARNFLAGS)
3600da2777aaSmrg	]
3601da2777aaSmrg)
3602da2777aaSmrg]) # XORG_CWARNFLAGS
360355acc8fcSmrg
3604da2777aaSmrg# XORG_STRICT_OPTION
3605da2777aaSmrg# -----------------------
3606da2777aaSmrg# Minimum version: 1.3.0
36072a53b785Smrg#
3608da2777aaSmrg# Add configure option to enable strict compilation flags, such as treating
3609da2777aaSmrg# warnings as fatal errors.
3610da2777aaSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3611da2777aaSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
361243d802faSmrg#
3613da2777aaSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3614da2777aaSmrg# when strict compilation is unconditionally desired.
3615da2777aaSmrgAC_DEFUN([XORG_STRICT_OPTION], [
3616da2777aaSmrgAC_REQUIRE([XORG_CWARNFLAGS])
3617da2777aaSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
361852fd71cdSmrg
3619da2777aaSmrgAC_ARG_ENABLE(strict-compilation,
3620da2777aaSmrg			  AS_HELP_STRING([--enable-strict-compilation],
3621da2777aaSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3622da2777aaSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
362352fd71cdSmrg
3624da2777aaSmrgAC_LANG_CASE(
3625da2777aaSmrg        [C], [
3626da2777aaSmrg                define([PREFIX], [C])
3627da2777aaSmrg        ],
3628da2777aaSmrg        [C++], [
3629da2777aaSmrg                define([PREFIX], [CXX])
3630da2777aaSmrg        ]
3631da2777aaSmrg)
363252fd71cdSmrg
3633da2777aaSmrg[STRICT_]PREFIX[FLAGS]=""
3634da2777aaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3635da2777aaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
363652fd71cdSmrg
3637da2777aaSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3638da2777aaSmrg# activate it with -Werror, so we add it here explicitly.
3639da2777aaSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
364052fd71cdSmrg
3641da2777aaSmrgif test "x$STRICT_COMPILE" = "xyes"; then
3642da2777aaSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3643da2777aaSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3644da2777aaSmrgfi
3645da2777aaSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3646da2777aaSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3647da2777aaSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3648da2777aaSmrg]) # XORG_STRICT_OPTION
364952fd71cdSmrg
3650da2777aaSmrg# XORG_DEFAULT_NOCODE_OPTIONS
3651da2777aaSmrg# ---------------------------
3652da2777aaSmrg# Minimum version: 1.20.0
3653da2777aaSmrg#
3654da2777aaSmrg# Defines default options for X.Org modules which don't compile code,
3655da2777aaSmrg# such as fonts, bitmaps, cursors, and docs.
3656da2777aaSmrg#
3657da2777aaSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3658da2777aaSmrgAC_REQUIRE([AC_PROG_INSTALL])
3659da2777aaSmrgXORG_RELEASE_VERSION
3660da2777aaSmrgXORG_CHANGELOG
3661da2777aaSmrgXORG_INSTALL
3662da2777aaSmrgXORG_MANPAGE_SECTIONS
3663da2777aaSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3664da2777aaSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3665da2777aaSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
366652fd71cdSmrg
3667da2777aaSmrg# XORG_DEFAULT_OPTIONS
3668da2777aaSmrg# --------------------
3669da2777aaSmrg# Minimum version: 1.3.0
3670da2777aaSmrg#
3671da2777aaSmrg# Defines default options for X.Org modules which compile code.
3672da2777aaSmrg#
3673da2777aaSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3674da2777aaSmrgAC_REQUIRE([AC_PROG_INSTALL])
3675da2777aaSmrgXORG_COMPILER_FLAGS
3676da2777aaSmrgXORG_CWARNFLAGS
3677da2777aaSmrgXORG_STRICT_OPTION
3678da2777aaSmrgXORG_DEFAULT_NOCODE_OPTIONS
3679da2777aaSmrg]) # XORG_DEFAULT_OPTIONS
368052fd71cdSmrg
3681da2777aaSmrg# XORG_INSTALL()
3682da2777aaSmrg# ----------------
3683da2777aaSmrg# Minimum version: 1.4.0
3684da2777aaSmrg#
3685da2777aaSmrg# Defines the variable INSTALL_CMD as the command to copy
3686da2777aaSmrg# INSTALL from $prefix/share/util-macros.
3687da2777aaSmrg#
3688da2777aaSmrgAC_DEFUN([XORG_INSTALL], [
3689da2777aaSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3690da2777aaSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3691da2777aaSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3692da2777aaSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3693da2777aaSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3694da2777aaSmrgtouch \$(top_srcdir)/INSTALL; \
3695da2777aaSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3696da2777aaSmrgAC_SUBST([INSTALL_CMD])
3697da2777aaSmrg]) # XORG_INSTALL
3698da2777aaSmrgdnl Copyright 2005 Red Hat, Inc
3699da2777aaSmrgdnl
3700da2777aaSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3701da2777aaSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3702da2777aaSmrgdnl the above copyright notice appear in all copies and that both that
3703da2777aaSmrgdnl copyright notice and this permission notice appear in supporting
3704da2777aaSmrgdnl documentation.
3705da2777aaSmrgdnl
3706da2777aaSmrgdnl The above copyright notice and this permission notice shall be included
3707da2777aaSmrgdnl in all copies or substantial portions of the Software.
3708da2777aaSmrgdnl
3709da2777aaSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3710da2777aaSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3711da2777aaSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3712da2777aaSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3713da2777aaSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3714da2777aaSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3715da2777aaSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3716da2777aaSmrgdnl
3717da2777aaSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3718da2777aaSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3719da2777aaSmrgdnl other dealings in this Software without prior written authorization
3720da2777aaSmrgdnl from the copyright holders.
3721da2777aaSmrgdnl
372243d802faSmrg
3723da2777aaSmrg# XORG_RELEASE_VERSION
3724da2777aaSmrg# --------------------
3725da2777aaSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
372643d802faSmrg
3727da2777aaSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3728da2777aaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3729da2777aaSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3730da2777aaSmrg		[Major version of this package])
3731da2777aaSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3732da2777aaSmrg	if test "x$PVM" = "x"; then
3733da2777aaSmrg		PVM="0"
3734da2777aaSmrg	fi
3735da2777aaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3736da2777aaSmrg		[$PVM],
3737da2777aaSmrg		[Minor version of this package])
3738da2777aaSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3739da2777aaSmrg	if test "x$PVP" = "x"; then
3740da2777aaSmrg		PVP="0"
3741da2777aaSmrg	fi
3742da2777aaSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3743da2777aaSmrg		[$PVP],
3744da2777aaSmrg		[Patch version of this package])
3745da2777aaSmrg])
374643d802faSmrg
3747da2777aaSmrg# XORG_CHANGELOG()
3748da2777aaSmrg# ----------------
3749da2777aaSmrg# Minimum version: 1.2.0
3750da2777aaSmrg#
3751da2777aaSmrg# Defines the variable CHANGELOG_CMD as the command to generate
3752da2777aaSmrg# ChangeLog from git.
3753da2777aaSmrg#
3754da2777aaSmrg#
3755da2777aaSmrgAC_DEFUN([XORG_CHANGELOG], [
3756da2777aaSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3757da2777aaSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3758da2777aaSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3759da2777aaSmrgtouch \$(top_srcdir)/ChangeLog; \
3760da2777aaSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3761da2777aaSmrgAC_SUBST([CHANGELOG_CMD])
3762da2777aaSmrg]) # XORG_CHANGELOG
3763d63fdb69Smrg
3764da2777aaSmrgm4_include([m4/libtool.m4])
3765da2777aaSmrgm4_include([m4/ltoptions.m4])
3766da2777aaSmrgm4_include([m4/ltsugar.m4])
3767da2777aaSmrgm4_include([m4/ltversion.m4])
3768da2777aaSmrgm4_include([m4/lt~obsolete.m4])
3769