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