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