1e53c48bfSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2a9ba4257Smrg
3e53c48bfSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4fd7d9bd3Smrg
5fd7d9bd3Smrg# This file is free software; the Free Software Foundation
6fd7d9bd3Smrg# gives unlimited permission to copy and/or distribute it,
7fd7d9bd3Smrg# with or without modifications, as long as this notice is preserved.
8fd7d9bd3Smrg
9fd7d9bd3Smrg# This program is distributed in the hope that it will be useful,
10fd7d9bd3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11fd7d9bd3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12fd7d9bd3Smrg# PARTICULAR PURPOSE.
13fd7d9bd3Smrg
14a9ba4257Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15350952b9Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16350952b9Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e53c48bfSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18e53c48bfSmrg[m4_warning([this file was generated for autoconf 2.71.
19350952b9SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20350952b9SmrgIf you have problems, you may need to regenerate the build system entirely.
21a9ba4257SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22fd7d9bd3Smrg
23e53c48bfSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24350952b9Smrg#
25350952b9Smrg# This file is free software; the Free Software Foundation
26350952b9Smrg# gives unlimited permission to copy and/or distribute it,
27350952b9Smrg# with or without modifications, as long as this notice is preserved.
28fd7d9bd3Smrg
29fd7d9bd3Smrg# AM_AUTOMAKE_VERSION(VERSION)
30fd7d9bd3Smrg# ----------------------------
31fd7d9bd3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32fd7d9bd3Smrg# generated from the m4 files accompanying Automake X.Y.
33350952b9Smrg# (This private macro should not be called outside this file.)
34350952b9SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35e53c48bfSmrg[am__api_version='1.16'
36350952b9Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37350952b9Smrgdnl require some minimum version.  Point them to the right macro.
38e53c48bfSmrgm4_if([$1], [1.16.5], [],
39350952b9Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40350952b9Smrg])
41350952b9Smrg
42350952b9Smrg# _AM_AUTOCONF_VERSION(VERSION)
43350952b9Smrg# -----------------------------
44350952b9Smrg# aclocal traces this macro to find the Autoconf version.
45350952b9Smrg# This is a private macro too.  Using m4_define simplifies
46350952b9Smrg# the logic in aclocal, which can simply ignore this definition.
47350952b9Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48fd7d9bd3Smrg
49fd7d9bd3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50fd7d9bd3Smrg# -------------------------------
51350952b9Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52350952b9Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53fd7d9bd3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54e53c48bfSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55350952b9Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56350952b9Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57350952b9Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58fd7d9bd3Smrg
59350952b9Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60fd7d9bd3Smrg
61e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62fd7d9bd3Smrg#
63350952b9Smrg# This file is free software; the Free Software Foundation
64350952b9Smrg# gives unlimited permission to copy and/or distribute it,
65350952b9Smrg# with or without modifications, as long as this notice is preserved.
66fd7d9bd3Smrg
67fd7d9bd3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68a9ba4257Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69a9ba4257Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70fd7d9bd3Smrg#
71fd7d9bd3Smrg# Of course, Automake must honor this variable whenever it calls a
72fd7d9bd3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73fd7d9bd3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74fd7d9bd3Smrg# depending on how configure is run.  This is pretty annoying, since
75fd7d9bd3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76fd7d9bd3Smrg# source directory, any form will work fine, but in subdirectories a
77fd7d9bd3Smrg# relative path needs to be adjusted first.
78fd7d9bd3Smrg#
79fd7d9bd3Smrg# $ac_aux_dir/missing
80fd7d9bd3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81fd7d9bd3Smrg# $top_srcdir/$ac_aux_dir/missing
82fd7d9bd3Smrg#    fails if $ac_aux_dir is absolute,
83fd7d9bd3Smrg#    fails when called from a subdirectory in a VPATH build with
84fd7d9bd3Smrg#          a relative $ac_aux_dir
85fd7d9bd3Smrg#
86fd7d9bd3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87fd7d9bd3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88a9ba4257Smrg# harmless because $srcdir is '.', but things will broke when you
89fd7d9bd3Smrg# start a VPATH build or use an absolute $srcdir.
90fd7d9bd3Smrg#
91fd7d9bd3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92fd7d9bd3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93fd7d9bd3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94fd7d9bd3Smrg# and then we would define $MISSING as
95fd7d9bd3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96fd7d9bd3Smrg# This will work as long as MISSING is not called from configure, because
97fd7d9bd3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98fd7d9bd3Smrg# However there are other variables, like CC, which are often used in
99fd7d9bd3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100fd7d9bd3Smrg#
101fd7d9bd3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102fd7d9bd3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103fd7d9bd3Smrg# configured tree to be moved without reconfiguration.
104fd7d9bd3Smrg
105350952b9SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106a9ba4257Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107a9ba4257Smrg# Expand $ac_aux_dir to an absolute path.
108a9ba4257Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109fd7d9bd3Smrg])
110fd7d9bd3Smrg
111350952b9Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112fd7d9bd3Smrg
113e53c48bfSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114350952b9Smrg#
115350952b9Smrg# This file is free software; the Free Software Foundation
116350952b9Smrg# gives unlimited permission to copy and/or distribute it,
117350952b9Smrg# with or without modifications, as long as this notice is preserved.
118fd7d9bd3Smrg
119350952b9Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120350952b9Smrg# -------------------------------------
121350952b9Smrg# Define a conditional.
122350952b9SmrgAC_DEFUN([AM_CONDITIONAL],
123a9ba4257Smrg[AC_PREREQ([2.52])dnl
124a9ba4257Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125a9ba4257Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126350952b9SmrgAC_SUBST([$1_TRUE])dnl
127350952b9SmrgAC_SUBST([$1_FALSE])dnl
128350952b9Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129350952b9Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130350952b9Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131350952b9Smrgif $2; then
132350952b9Smrg  $1_TRUE=
133350952b9Smrg  $1_FALSE='#'
134fd7d9bd3Smrgelse
135350952b9Smrg  $1_TRUE='#'
136350952b9Smrg  $1_FALSE=
137fd7d9bd3Smrgfi
138350952b9SmrgAC_CONFIG_COMMANDS_PRE(
139350952b9Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140350952b9Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141350952b9SmrgUsually this means the macro was only invoked conditionally.]])
142350952b9Smrgfi])])
143fd7d9bd3Smrg
144e53c48bfSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145350952b9Smrg#
146350952b9Smrg# This file is free software; the Free Software Foundation
147350952b9Smrg# gives unlimited permission to copy and/or distribute it,
148350952b9Smrg# with or without modifications, as long as this notice is preserved.
149fd7d9bd3Smrg
150fd7d9bd3Smrg
151a9ba4257Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152fd7d9bd3Smrg# written in clear, in which case automake, when reading aclocal.m4,
153fd7d9bd3Smrg# will think it sees a *use*, and therefore will trigger all it's
154fd7d9bd3Smrg# C support machinery.  Also note that it means that autoscan, seeing
155fd7d9bd3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156fd7d9bd3Smrg
157fd7d9bd3Smrg
158fd7d9bd3Smrg# _AM_DEPENDENCIES(NAME)
159fd7d9bd3Smrg# ----------------------
160fd7d9bd3Smrg# See how the compiler implements dependency checking.
161a9ba4257Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162fd7d9bd3Smrg# We try a few techniques and use that to set a single cache variable.
163fd7d9bd3Smrg#
164fd7d9bd3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165fd7d9bd3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166fd7d9bd3Smrg# dependency, and given that the user is not expected to run this macro,
167fd7d9bd3Smrg# just rely on AC_PROG_CC.
168fd7d9bd3SmrgAC_DEFUN([_AM_DEPENDENCIES],
169fd7d9bd3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170fd7d9bd3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171fd7d9bd3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172fd7d9bd3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173fd7d9bd3Smrg
174a9ba4257Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175a9ba4257Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176a9ba4257Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177a9ba4257Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178a9ba4257Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179a9ba4257Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180a9ba4257Smrg                    [depcc="$$1"   am_compiler_list=])
181fd7d9bd3Smrg
182fd7d9bd3SmrgAC_CACHE_CHECK([dependency style of $depcc],
183fd7d9bd3Smrg               [am_cv_$1_dependencies_compiler_type],
184fd7d9bd3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185fd7d9bd3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186fd7d9bd3Smrg  # making bogus files that we don't know about and never remove.  For
187fd7d9bd3Smrg  # instance it was reported that on HP-UX the gcc test will end up
188a9ba4257Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189a9ba4257Smrg  # in D".
190a85aecdfSmrg  rm -rf conftest.dir
191fd7d9bd3Smrg  mkdir conftest.dir
192fd7d9bd3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193fd7d9bd3Smrg  # using a relative directory.
194fd7d9bd3Smrg  cp "$am_depcomp" conftest.dir
195fd7d9bd3Smrg  cd conftest.dir
196fd7d9bd3Smrg  # We will build objects and dependencies in a subdirectory because
197fd7d9bd3Smrg  # it helps to detect inapplicable dependency modes.  For instance
198fd7d9bd3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199fd7d9bd3Smrg  # side effect of compilation, but ICC will put the dependencies in
200fd7d9bd3Smrg  # the current directory while Tru64 will put them in the object
201fd7d9bd3Smrg  # directory.
202fd7d9bd3Smrg  mkdir sub
203fd7d9bd3Smrg
204fd7d9bd3Smrg  am_cv_$1_dependencies_compiler_type=none
205fd7d9bd3Smrg  if test "$am_compiler_list" = ""; then
206fd7d9bd3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207fd7d9bd3Smrg  fi
208350952b9Smrg  am__universal=false
209350952b9Smrg  m4_case([$1], [CC],
210350952b9Smrg    [case " $depcc " in #(
211350952b9Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212350952b9Smrg     esac],
213350952b9Smrg    [CXX],
214350952b9Smrg    [case " $depcc " in #(
215350952b9Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216350952b9Smrg     esac])
217350952b9Smrg
218fd7d9bd3Smrg  for depmode in $am_compiler_list; do
219fd7d9bd3Smrg    # Setup a source with many dependencies, because some compilers
220fd7d9bd3Smrg    # like to wrap large dependency lists on column 80 (with \), and
221fd7d9bd3Smrg    # we should not choose a depcomp mode which is confused by this.
222fd7d9bd3Smrg    #
223fd7d9bd3Smrg    # We need to recreate these files for each test, as the compiler may
224fd7d9bd3Smrg    # overwrite some of them when testing with obscure command lines.
225fd7d9bd3Smrg    # This happens at least with the AIX C compiler.
226fd7d9bd3Smrg    : > sub/conftest.c
227fd7d9bd3Smrg    for i in 1 2 3 4 5 6; do
228fd7d9bd3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229a9ba4257Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230a9ba4257Smrg      # Solaris 10 /bin/sh.
231a9ba4257Smrg      echo '/* dummy */' > sub/conftst$i.h
232fd7d9bd3Smrg    done
233fd7d9bd3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234fd7d9bd3Smrg
235a9ba4257Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236350952b9Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237a9ba4257Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238a9ba4257Smrg    # versions had trouble with output in subdirs.
239350952b9Smrg    am__obj=sub/conftest.${OBJEXT-o}
240350952b9Smrg    am__minus_obj="-o $am__obj"
241fd7d9bd3Smrg    case $depmode in
242350952b9Smrg    gcc)
243350952b9Smrg      # This depmode causes a compiler race in universal mode.
244350952b9Smrg      test "$am__universal" = false || continue
245350952b9Smrg      ;;
246fd7d9bd3Smrg    nosideeffect)
247a9ba4257Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248a9ba4257Smrg      # only be used when explicitly requested.
249fd7d9bd3Smrg      if test "x$enable_dependency_tracking" = xyes; then
250fd7d9bd3Smrg	continue
251fd7d9bd3Smrg      else
252fd7d9bd3Smrg	break
253fd7d9bd3Smrg      fi
254fd7d9bd3Smrg      ;;
255a85aecdfSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256a9ba4257Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257350952b9Smrg      # not run yet.  These depmodes are late enough in the game, and
258350952b9Smrg      # so weak that their functioning should not be impacted.
259350952b9Smrg      am__obj=conftest.${OBJEXT-o}
260350952b9Smrg      am__minus_obj=
261350952b9Smrg      ;;
262fd7d9bd3Smrg    none) break ;;
263fd7d9bd3Smrg    esac
264fd7d9bd3Smrg    if depmode=$depmode \
265350952b9Smrg       source=sub/conftest.c object=$am__obj \
266fd7d9bd3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267350952b9Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268fd7d9bd3Smrg         >/dev/null 2>conftest.err &&
269350952b9Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270fd7d9bd3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271350952b9Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272fd7d9bd3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273fd7d9bd3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274350952b9Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275350952b9Smrg      # that says an option was ignored or not supported.
276350952b9Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277350952b9Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278350952b9Smrg      # The diagnosis changed in icc 8.0:
279350952b9Smrg      #   icc: Command line remark: option '-MP' not supported
280350952b9Smrg      if (grep 'ignoring option' conftest.err ||
281350952b9Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282fd7d9bd3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283fd7d9bd3Smrg        break
284fd7d9bd3Smrg      fi
285fd7d9bd3Smrg    fi
286fd7d9bd3Smrg  done
287fd7d9bd3Smrg
288fd7d9bd3Smrg  cd ..
289fd7d9bd3Smrg  rm -rf conftest.dir
290fd7d9bd3Smrgelse
291fd7d9bd3Smrg  am_cv_$1_dependencies_compiler_type=none
292fd7d9bd3Smrgfi
293fd7d9bd3Smrg])
294fd7d9bd3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295fd7d9bd3SmrgAM_CONDITIONAL([am__fastdep$1], [
296fd7d9bd3Smrg  test "x$enable_dependency_tracking" != xno \
297fd7d9bd3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298fd7d9bd3Smrg])
299fd7d9bd3Smrg
300fd7d9bd3Smrg
301fd7d9bd3Smrg# AM_SET_DEPDIR
302fd7d9bd3Smrg# -------------
303fd7d9bd3Smrg# Choose a directory name for dependency files.
304a9ba4257Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305fd7d9bd3SmrgAC_DEFUN([AM_SET_DEPDIR],
306fd7d9bd3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307fd7d9bd3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308fd7d9bd3Smrg])
309fd7d9bd3Smrg
310fd7d9bd3Smrg
311fd7d9bd3Smrg# AM_DEP_TRACK
312fd7d9bd3Smrg# ------------
313fd7d9bd3SmrgAC_DEFUN([AM_DEP_TRACK],
314a9ba4257Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315a9ba4257SmrgAS_HELP_STRING(
316a9ba4257Smrg  [--enable-dependency-tracking],
317a9ba4257Smrg  [do not reject slow dependency extractors])
318a9ba4257SmrgAS_HELP_STRING(
319a9ba4257Smrg  [--disable-dependency-tracking],
320a9ba4257Smrg  [speeds up one-time build])])
321fd7d9bd3Smrgif test "x$enable_dependency_tracking" != xno; then
322fd7d9bd3Smrg  am_depcomp="$ac_aux_dir/depcomp"
323fd7d9bd3Smrg  AMDEPBACKSLASH='\'
324a85aecdfSmrg  am__nodep='_no'
325fd7d9bd3Smrgfi
326fd7d9bd3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327350952b9SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328350952b9Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329a85aecdfSmrgAC_SUBST([am__nodep])dnl
330a85aecdfSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331fd7d9bd3Smrg])
332fd7d9bd3Smrg
333350952b9Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334fd7d9bd3Smrg
335e53c48bfSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336350952b9Smrg#
337350952b9Smrg# This file is free software; the Free Software Foundation
338350952b9Smrg# gives unlimited permission to copy and/or distribute it,
339350952b9Smrg# with or without modifications, as long as this notice is preserved.
340fd7d9bd3Smrg
341fd7d9bd3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342fd7d9bd3Smrg# ------------------------------
343fd7d9bd3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344350952b9Smrg[{
345a9ba4257Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346350952b9Smrg  # are listed without --file.  Let's play safe and only enable the eval
347350952b9Smrg  # if we detect the quoting.
348e53c48bfSmrg  # TODO: see whether this extra hack can be removed once we start
349e53c48bfSmrg  # requiring Autoconf 2.70 or later.
350e53c48bfSmrg  AS_CASE([$CONFIG_FILES],
351e53c48bfSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352e53c48bfSmrg          [*], [set x $CONFIG_FILES])
353350952b9Smrg  shift
354e53c48bfSmrg  # Used to flag and report bootstrapping failures.
355e53c48bfSmrg  am_rc=0
356e53c48bfSmrg  for am_mf
357350952b9Smrg  do
358350952b9Smrg    # Strip MF so we end up with the name of the file.
359e53c48bfSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360e53c48bfSmrg    # Check whether this is an Automake generated Makefile which includes
361e53c48bfSmrg    # dependency-tracking related rules and includes.
362e53c48bfSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363350952b9Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364e53c48bfSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365e53c48bfSmrg      || continue
366e53c48bfSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367e53c48bfSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368e53c48bfSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369e53c48bfSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370e53c48bfSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371fd7d9bd3Smrg  done
372e53c48bfSmrg  if test $am_rc -ne 0; then
373e53c48bfSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374e53c48bfSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375e53c48bfSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376e53c48bfSmrg    necessary).  You can also try re-running configure with the
377e53c48bfSmrg    '--disable-dependency-tracking' option to at least be able to build
378e53c48bfSmrg    the package (albeit without support for automatic dependency tracking).])
379e53c48bfSmrg  fi
380e53c48bfSmrg  AS_UNSET([am_dirpart])
381e53c48bfSmrg  AS_UNSET([am_filepart])
382e53c48bfSmrg  AS_UNSET([am_mf])
383e53c48bfSmrg  AS_UNSET([am_rc])
384e53c48bfSmrg  rm -f conftest-deps.mk
385350952b9Smrg}
386fd7d9bd3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387fd7d9bd3Smrg
388fd7d9bd3Smrg
389fd7d9bd3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390fd7d9bd3Smrg# -----------------------------
391fd7d9bd3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392fd7d9bd3Smrg#
393e53c48bfSmrg# This code is only required when automatic dependency tracking is enabled.
394e53c48bfSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395e53c48bfSmrg# order to bootstrap the dependency handling code.
396fd7d9bd3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397fd7d9bd3Smrg[AC_CONFIG_COMMANDS([depfiles],
398fd7d9bd3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399e53c48bfSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400fd7d9bd3Smrg
401350952b9Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402fd7d9bd3Smrg
403e53c48bfSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404350952b9Smrg#
405350952b9Smrg# This file is free software; the Free Software Foundation
406350952b9Smrg# gives unlimited permission to copy and/or distribute it,
407350952b9Smrg# with or without modifications, as long as this notice is preserved.
408fd7d9bd3Smrg
409350952b9Smrg# This macro actually does too much.  Some checks are only needed if
410350952b9Smrg# your package does certain things.  But this isn't really a big deal.
411350952b9Smrg
412a9ba4257Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413a9ba4257Smrgm4_define([AC_PROG_CC],
414a9ba4257Smrgm4_defn([AC_PROG_CC])
415a9ba4257Smrg[_AM_PROG_CC_C_O
416a9ba4257Smrg])
417a9ba4257Smrg
418350952b9Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419350952b9Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420350952b9Smrg# -----------------------------------------------
421350952b9Smrg# The call with PACKAGE and VERSION arguments is the old style
422350952b9Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423350952b9Smrg# and VERSION should now be passed to AC_INIT and removed from
424350952b9Smrg# the call to AM_INIT_AUTOMAKE.
425350952b9Smrg# We support both call styles for the transition.  After
426350952b9Smrg# the next Automake release, Autoconf can make the AC_INIT
427350952b9Smrg# arguments mandatory, and then we can depend on a new Autoconf
428350952b9Smrg# release and drop the old call support.
429350952b9SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430a9ba4257Smrg[AC_PREREQ([2.65])dnl
431e53c48bfSmrgm4_ifdef([_$0_ALREADY_INIT],
432e53c48bfSmrg  [m4_fatal([$0 expanded multiple times
433e53c48bfSmrg]m4_defn([_$0_ALREADY_INIT]))],
434e53c48bfSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435350952b9Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436350952b9Smrgdnl the ones we care about.
437350952b9Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438350952b9SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439350952b9SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440350952b9Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441350952b9Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442350952b9Smrg  # is not polluted with repeated "-I."
443350952b9Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444350952b9Smrg  # test to see if srcdir already configured
445350952b9Smrg  if test -f $srcdir/config.status; then
446350952b9Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447350952b9Smrg  fi
448fd7d9bd3Smrgfi
449350952b9Smrg
450350952b9Smrg# test whether we have cygpath
451350952b9Smrgif test -z "$CYGPATH_W"; then
452350952b9Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453350952b9Smrg    CYGPATH_W='cygpath -w'
454350952b9Smrg  else
455350952b9Smrg    CYGPATH_W=echo
456350952b9Smrg  fi
457fd7d9bd3Smrgfi
458350952b9SmrgAC_SUBST([CYGPATH_W])
459fd7d9bd3Smrg
460350952b9Smrg# Define the identity of the package.
461350952b9Smrgdnl Distinguish between old-style and new-style calls.
462350952b9Smrgm4_ifval([$2],
463a9ba4257Smrg[AC_DIAGNOSE([obsolete],
464a9ba4257Smrg             [$0: two- and three-arguments forms are deprecated.])
465a9ba4257Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466350952b9Smrg AC_SUBST([PACKAGE], [$1])dnl
467350952b9Smrg AC_SUBST([VERSION], [$2])],
468350952b9Smrg[_AM_SET_OPTIONS([$1])dnl
469350952b9Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470a9ba4257Smrgm4_if(
471e53c48bfSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472a9ba4257Smrg  [ok:ok],,
473350952b9Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474350952b9Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475350952b9Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476fd7d9bd3Smrg
477350952b9Smrg_AM_IF_OPTION([no-define],,
478a9ba4257Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479a9ba4257Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480fd7d9bd3Smrg
481350952b9Smrg# Some tools Automake needs.
482350952b9SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483350952b9SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484a9ba4257SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485a9ba4257SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486a9ba4257SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487a9ba4257SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488a9ba4257SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489350952b9SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490350952b9SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491a9ba4257SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492a9ba4257Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493a9ba4257Smrg# dies out for good.  For more background, see:
494e53c48bfSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495e53c48bfSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496a9ba4257SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497a9ba4257Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498a9ba4257Smrg# system "awk" is bad on some platforms.
499350952b9SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500350952b9SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501350952b9SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502350952b9Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503350952b9Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504350952b9Smrg			     [_AM_PROG_TAR([v7])])])
505350952b9Smrg_AM_IF_OPTION([no-dependencies],,
506350952b9Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507a9ba4257Smrg		  [_AM_DEPENDENCIES([CC])],
508a9ba4257Smrg		  [m4_define([AC_PROG_CC],
509a9ba4257Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510350952b9SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511a9ba4257Smrg		  [_AM_DEPENDENCIES([CXX])],
512a9ba4257Smrg		  [m4_define([AC_PROG_CXX],
513a9ba4257Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514350952b9SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515a9ba4257Smrg		  [_AM_DEPENDENCIES([OBJC])],
516a9ba4257Smrg		  [m4_define([AC_PROG_OBJC],
517a9ba4257Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518a9ba4257SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519a9ba4257Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520a9ba4257Smrg		  [m4_define([AC_PROG_OBJCXX],
521a9ba4257Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522350952b9Smrg])
523e53c48bfSmrg# Variables for tags utilities; see am/tags.am
524e53c48bfSmrgif test -z "$CTAGS"; then
525e53c48bfSmrg  CTAGS=ctags
526e53c48bfSmrgfi
527e53c48bfSmrgAC_SUBST([CTAGS])
528e53c48bfSmrgif test -z "$ETAGS"; then
529e53c48bfSmrg  ETAGS=etags
530e53c48bfSmrgfi
531e53c48bfSmrgAC_SUBST([ETAGS])
532e53c48bfSmrgif test -z "$CSCOPE"; then
533e53c48bfSmrg  CSCOPE=cscope
534e53c48bfSmrgfi
535e53c48bfSmrgAC_SUBST([CSCOPE])
536e53c48bfSmrg
537a9ba4257SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538a9ba4257Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539a9ba4257Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540a9ba4257Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541350952b9SmrgAC_CONFIG_COMMANDS_PRE(dnl
542350952b9Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543350952b9Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544a9ba4257Smrg
545a9ba4257Smrg# POSIX will say in a future version that running "rm -f" with no argument
546a9ba4257Smrg# is OK; and we want to be able to make that assumption in our Makefile
547a9ba4257Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548a9ba4257Smrg# actually supported "in the wild" to an acceptable degree.
549a9ba4257Smrg# See automake bug#10828.
550a9ba4257Smrg# To make any issue more visible, cause the running configure to be aborted
551a9ba4257Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552a9ba4257Smrg# user can still override this though.
553a9ba4257Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554a9ba4257Smrg  cat >&2 <<'END'
555a9ba4257SmrgOops!
556a9ba4257Smrg
557a9ba4257SmrgYour 'rm' program seems unable to run without file operands specified
558a9ba4257Smrgon the command line, even when the '-f' option is present.  This is contrary
559a9ba4257Smrgto the behaviour of most rm programs out there, and not conforming with
560a9ba4257Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561a9ba4257Smrg
562a9ba4257SmrgPlease tell bug-automake@gnu.org about your system, including the value
563a9ba4257Smrgof your $PATH and any error possibly output before this message.  This
564a9ba4257Smrgcan help us improve future automake versions.
565a9ba4257Smrg
566a9ba4257SmrgEND
567a9ba4257Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568a9ba4257Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569a9ba4257Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570a9ba4257Smrg    echo >&2
571a9ba4257Smrg  else
572a9ba4257Smrg    cat >&2 <<'END'
573a9ba4257SmrgAborting the configuration process, to ensure you take notice of the issue.
574a9ba4257Smrg
575a9ba4257SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576e53c48bfSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577a9ba4257Smrg
578a9ba4257SmrgIf you want to complete the configuration process using your problematic
579a9ba4257Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580a9ba4257Smrgto "yes", and re-run configure.
581a9ba4257Smrg
582a9ba4257SmrgEND
583a9ba4257Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584a9ba4257Smrg  fi
585a9ba4257Smrgfi
586a9ba4257Smrgdnl The trailing newline in this macro's definition is deliberate, for
587a9ba4257Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588a9ba4257Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589350952b9Smrg])
590fd7d9bd3Smrg
591a9ba4257Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592350952b9Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593350952b9Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594350952b9Smrgm4_define([_AC_COMPILER_EXEEXT],
595350952b9Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596fd7d9bd3Smrg
597350952b9Smrg# When config.status generates a header, we must update the stamp-h file.
598350952b9Smrg# This file resides in the same directory as the config header
599350952b9Smrg# that is generated.  The stamp files are numbered to have different names.
600350952b9Smrg
601350952b9Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602350952b9Smrg# loop where config.status creates the headers, so we can generate
603350952b9Smrg# our stamp files there.
604350952b9SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605350952b9Smrg[# Compute $1's index in $config_headers.
606350952b9Smrg_am_arg=$1
607350952b9Smrg_am_stamp_count=1
608350952b9Smrgfor _am_header in $config_headers :; do
609350952b9Smrg  case $_am_header in
610350952b9Smrg    $_am_arg | $_am_arg:* )
611350952b9Smrg      break ;;
612350952b9Smrg    * )
613350952b9Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614350952b9Smrg  esac
615350952b9Smrgdone
616350952b9Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617fd7d9bd3Smrg
618e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619350952b9Smrg#
620350952b9Smrg# This file is free software; the Free Software Foundation
621350952b9Smrg# gives unlimited permission to copy and/or distribute it,
622350952b9Smrg# with or without modifications, as long as this notice is preserved.
623fd7d9bd3Smrg
624350952b9Smrg# AM_PROG_INSTALL_SH
625350952b9Smrg# ------------------
626350952b9Smrg# Define $install_sh.
627350952b9SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628350952b9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629a9ba4257Smrgif test x"${install_sh+set}" != xset; then
630350952b9Smrg  case $am_aux_dir in
631350952b9Smrg  *\ * | *\	*)
632350952b9Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633350952b9Smrg  *)
634350952b9Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635350952b9Smrg  esac
636fd7d9bd3Smrgfi
637a9ba4257SmrgAC_SUBST([install_sh])])
638fd7d9bd3Smrg
639e53c48bfSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640350952b9Smrg#
641350952b9Smrg# This file is free software; the Free Software Foundation
642350952b9Smrg# gives unlimited permission to copy and/or distribute it,
643350952b9Smrg# with or without modifications, as long as this notice is preserved.
644fd7d9bd3Smrg
645350952b9Smrg# Check whether the underlying file-system supports filenames
646350952b9Smrg# with a leading dot.  For instance MS-DOS doesn't.
647350952b9SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648350952b9Smrg[rm -rf .tst 2>/dev/null
649350952b9Smrgmkdir .tst 2>/dev/null
650350952b9Smrgif test -d .tst; then
651350952b9Smrg  am__leading_dot=.
652350952b9Smrgelse
653350952b9Smrg  am__leading_dot=_
654350952b9Smrgfi
655350952b9Smrgrmdir .tst 2>/dev/null
656350952b9SmrgAC_SUBST([am__leading_dot])])
657fd7d9bd3Smrg
658350952b9Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659fd7d9bd3Smrg
660e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661350952b9Smrg#
662350952b9Smrg# This file is free software; the Free Software Foundation
663350952b9Smrg# gives unlimited permission to copy and/or distribute it,
664350952b9Smrg# with or without modifications, as long as this notice is preserved.
665fd7d9bd3Smrg
666350952b9Smrg# AM_MAKE_INCLUDE()
667350952b9Smrg# -----------------
668e53c48bfSmrg# Check whether make has an 'include' directive that can support all
669e53c48bfSmrg# the idioms we need for our automatic dependency tracking code.
670350952b9SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671e53c48bfSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672e53c48bfSmrgcat > confinc.mk << 'END'
673350952b9Smrgam__doit:
674e53c48bfSmrg	@echo this is the am__doit target >confinc.out
675350952b9Smrg.PHONY: am__doit
676350952b9SmrgEND
677350952b9Smrgam__include="#"
678350952b9Smrgam__quote=
679e53c48bfSmrg# BSD make does it like this.
680e53c48bfSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681e53c48bfSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682e53c48bfSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683e53c48bfSmrg_am_result=no
684e53c48bfSmrgfor s in GNU BSD; do
685e53c48bfSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686e53c48bfSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687e53c48bfSmrg      ['0:this is the am__doit target'],
688e53c48bfSmrg      [AS_CASE([$s],
689e53c48bfSmrg          [BSD], [am__include='.include' am__quote='"'],
690e53c48bfSmrg          [am__include='include' am__quote=''])])
691e53c48bfSmrg  if test "$am__include" != "#"; then
692e53c48bfSmrg    _am_result="yes ($s style)"
693e53c48bfSmrg    break
694e53c48bfSmrg  fi
695e53c48bfSmrgdone
696e53c48bfSmrgrm -f confinc.* confmf.*
697e53c48bfSmrgAC_MSG_RESULT([${_am_result}])
698e53c48bfSmrgAC_SUBST([am__include])])
699e53c48bfSmrgAC_SUBST([am__quote])])
700fd7d9bd3Smrg
701350952b9Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702fd7d9bd3Smrg
703e53c48bfSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704350952b9Smrg#
705350952b9Smrg# This file is free software; the Free Software Foundation
706350952b9Smrg# gives unlimited permission to copy and/or distribute it,
707350952b9Smrg# with or without modifications, as long as this notice is preserved.
708fd7d9bd3Smrg
709350952b9Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710350952b9Smrg# ------------------------------
711350952b9SmrgAC_DEFUN([AM_MISSING_PROG],
712350952b9Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713350952b9Smrg$1=${$1-"${am_missing_run}$2"}
714350952b9SmrgAC_SUBST($1)])
715fd7d9bd3Smrg
716350952b9Smrg# AM_MISSING_HAS_RUN
717350952b9Smrg# ------------------
718a9ba4257Smrg# Define MISSING if not defined so far and test if it is modern enough.
719a9ba4257Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720350952b9SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721350952b9Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722350952b9SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723350952b9Smrgif test x"${MISSING+set}" != xset; then
724e53c48bfSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725350952b9Smrgfi
726350952b9Smrg# Use eval to expand $SHELL
727a9ba4257Smrgif eval "$MISSING --is-lightweight"; then
728a9ba4257Smrg  am_missing_run="$MISSING "
729350952b9Smrgelse
730350952b9Smrg  am_missing_run=
731a9ba4257Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732350952b9Smrgfi
733350952b9Smrg])
734fd7d9bd3Smrg
735350952b9Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736350952b9Smrg
737e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738fd7d9bd3Smrg#
739350952b9Smrg# This file is free software; the Free Software Foundation
740350952b9Smrg# gives unlimited permission to copy and/or distribute it,
741350952b9Smrg# with or without modifications, as long as this notice is preserved.
742fd7d9bd3Smrg
743350952b9Smrg# _AM_MANGLE_OPTION(NAME)
744350952b9Smrg# -----------------------
745350952b9SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746350952b9Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747350952b9Smrg
748350952b9Smrg# _AM_SET_OPTION(NAME)
749a85aecdfSmrg# --------------------
750350952b9Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751350952b9SmrgAC_DEFUN([_AM_SET_OPTION],
752a9ba4257Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753350952b9Smrg
754350952b9Smrg# _AM_SET_OPTIONS(OPTIONS)
755a85aecdfSmrg# ------------------------
756350952b9Smrg# OPTIONS is a space-separated list of Automake options.
757350952b9SmrgAC_DEFUN([_AM_SET_OPTIONS],
758350952b9Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759fd7d9bd3Smrg
760350952b9Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761350952b9Smrg# -------------------------------------------
762350952b9Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763350952b9SmrgAC_DEFUN([_AM_IF_OPTION],
764350952b9Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765350952b9Smrg
766e53c48bfSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767a9ba4257Smrg#
768a9ba4257Smrg# This file is free software; the Free Software Foundation
769a9ba4257Smrg# gives unlimited permission to copy and/or distribute it,
770a9ba4257Smrg# with or without modifications, as long as this notice is preserved.
771350952b9Smrg
772a9ba4257Smrg# _AM_PROG_CC_C_O
773a9ba4257Smrg# ---------------
774a9ba4257Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775a9ba4257Smrg# to automatically call this.
776a9ba4257SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777a9ba4257Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778a9ba4257SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779a9ba4257SmrgAC_LANG_PUSH([C])dnl
780a9ba4257SmrgAC_CACHE_CHECK(
781a9ba4257Smrg  [whether $CC understands -c and -o together],
782a9ba4257Smrg  [am_cv_prog_cc_c_o],
783a9ba4257Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784a9ba4257Smrg  # Make sure it works both with $CC and with simple cc.
785a9ba4257Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786a9ba4257Smrg  # compilers refuse to overwrite an existing .o file with -o,
787a9ba4257Smrg  # though they will create one.
788a9ba4257Smrg  am_cv_prog_cc_c_o=yes
789a9ba4257Smrg  for am_i in 1 2; do
790a9ba4257Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791a9ba4257Smrg         && test -f conftest2.$ac_objext; then
792a9ba4257Smrg      : OK
793a9ba4257Smrg    else
794a9ba4257Smrg      am_cv_prog_cc_c_o=no
795a9ba4257Smrg      break
796a9ba4257Smrg    fi
797a9ba4257Smrg  done
798a9ba4257Smrg  rm -f core conftest*
799a9ba4257Smrg  unset am_i])
800a9ba4257Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801a9ba4257Smrg   # Losing compiler, so override with the script.
802a9ba4257Smrg   # FIXME: It is wrong to rewrite CC.
803a9ba4257Smrg   # But if we don't then we get into trouble of one sort or another.
804a9ba4257Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805a9ba4257Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806a9ba4257Smrg   CC="$am_aux_dir/compile $CC"
807a9ba4257Smrgfi
808a9ba4257SmrgAC_LANG_POP([C])])
809a9ba4257Smrg
810a9ba4257Smrg# For backward compatibility.
811a9ba4257SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812a9ba4257Smrg
813e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814fd7d9bd3Smrg#
815350952b9Smrg# This file is free software; the Free Software Foundation
816350952b9Smrg# gives unlimited permission to copy and/or distribute it,
817350952b9Smrg# with or without modifications, as long as this notice is preserved.
818fd7d9bd3Smrg
819a9ba4257Smrg# AM_RUN_LOG(COMMAND)
820a9ba4257Smrg# -------------------
821a9ba4257Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822a9ba4257Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823a9ba4257SmrgAC_DEFUN([AM_RUN_LOG],
824a9ba4257Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825a9ba4257Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826a9ba4257Smrg   ac_status=$?
827a9ba4257Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828a9ba4257Smrg   (exit $ac_status); }])
829a9ba4257Smrg
830a9ba4257Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831a9ba4257Smrg
832e53c48bfSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833a9ba4257Smrg#
834a9ba4257Smrg# This file is free software; the Free Software Foundation
835a9ba4257Smrg# gives unlimited permission to copy and/or distribute it,
836a9ba4257Smrg# with or without modifications, as long as this notice is preserved.
837fd7d9bd3Smrg
838350952b9Smrg# AM_SANITY_CHECK
839350952b9Smrg# ---------------
840350952b9SmrgAC_DEFUN([AM_SANITY_CHECK],
841350952b9Smrg[AC_MSG_CHECKING([whether build environment is sane])
842350952b9Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843350952b9Smrg# name.  Accept space and tab only in the latter.
844350952b9Smrgam_lf='
845350952b9Smrg'
846350952b9Smrgcase `pwd` in
847350952b9Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848350952b9Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849350952b9Smrgesac
850350952b9Smrgcase $srcdir in
851350952b9Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852a9ba4257Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853350952b9Smrgesac
854fd7d9bd3Smrg
855a9ba4257Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856350952b9Smrg# arguments.  Must try -L first in case configure is actually a
857350952b9Smrg# symlink; some systems play weird games with the mod time of symlinks
858350952b9Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859350952b9Smrg# directory).
860350952b9Smrgif (
861a9ba4257Smrg   am_has_slept=no
862a9ba4257Smrg   for am_try in 1 2; do
863a9ba4257Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864a9ba4257Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865a9ba4257Smrg     if test "$[*]" = "X"; then
866a9ba4257Smrg	# -L didn't work.
867a9ba4257Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868a9ba4257Smrg     fi
869a9ba4257Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870a9ba4257Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871a9ba4257Smrg
872a9ba4257Smrg	# If neither matched, then we have a broken ls.  This can happen
873a9ba4257Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874a9ba4257Smrg	# broken ls alias from the environment.  This has actually
875a9ba4257Smrg	# happened.  Such a system could not be considered "sane".
876a9ba4257Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877a9ba4257Smrg  alias in your environment])
878a9ba4257Smrg     fi
879a9ba4257Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880a9ba4257Smrg       break
881a9ba4257Smrg     fi
882a9ba4257Smrg     # Just in case.
883a9ba4257Smrg     sleep 1
884a9ba4257Smrg     am_has_slept=yes
885a9ba4257Smrg   done
886350952b9Smrg   test "$[2]" = conftest.file
887350952b9Smrg   )
888350952b9Smrgthen
889350952b9Smrg   # Ok.
890350952b9Smrg   :
891350952b9Smrgelse
892350952b9Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893350952b9SmrgCheck your system clock])
894350952b9Smrgfi
895a9ba4257SmrgAC_MSG_RESULT([yes])
896a9ba4257Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897a9ba4257Smrg# generated files are strictly newer.
898a9ba4257Smrgam_sleep_pid=
899a9ba4257Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900a9ba4257Smrg  ( sleep 1 ) &
901a9ba4257Smrg  am_sleep_pid=$!
902a9ba4257Smrgfi
903a9ba4257SmrgAC_CONFIG_COMMANDS_PRE(
904a9ba4257Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905a9ba4257Smrg   if test -n "$am_sleep_pid"; then
906a9ba4257Smrg     # Hide warnings about reused PIDs.
907a9ba4257Smrg     wait $am_sleep_pid 2>/dev/null
908a9ba4257Smrg   fi
909a9ba4257Smrg   AC_MSG_RESULT([done])])
910a9ba4257Smrgrm -f conftest.file
911a9ba4257Smrg])
912350952b9Smrg
913e53c48bfSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914fd7d9bd3Smrg#
915350952b9Smrg# This file is free software; the Free Software Foundation
916350952b9Smrg# gives unlimited permission to copy and/or distribute it,
917350952b9Smrg# with or without modifications, as long as this notice is preserved.
918350952b9Smrg
919350952b9Smrg# AM_SILENT_RULES([DEFAULT])
920350952b9Smrg# --------------------------
921350952b9Smrg# Enable less verbose build rules; with the default set to DEFAULT
922a9ba4257Smrg# ("yes" being less verbose, "no" or empty being verbose).
923350952b9SmrgAC_DEFUN([AM_SILENT_RULES],
924a9ba4257Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925a9ba4257SmrgAS_HELP_STRING(
926a9ba4257Smrg  [--enable-silent-rules],
927a9ba4257Smrg  [less verbose build output (undo: "make V=1")])
928a9ba4257SmrgAS_HELP_STRING(
929a9ba4257Smrg  [--disable-silent-rules],
930a9ba4257Smrg  [verbose build output (undo: "make V=0")])dnl
931a9ba4257Smrg])
932a9ba4257Smrgcase $enable_silent_rules in @%:@ (((
933a9ba4257Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934a9ba4257Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935a9ba4257Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936350952b9Smrgesac
937a9ba4257Smrgdnl
938a9ba4257Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939a9ba4257Smrgdnl do not support nested variable expansions.
940a9ba4257Smrgdnl See automake bug#9928 and bug#10237.
941a9ba4257Smrgam_make=${MAKE-make}
942a9ba4257SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943a9ba4257Smrg   [am_cv_make_support_nested_variables],
944a9ba4257Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945a9ba4257SmrgBAR0=false
946a9ba4257SmrgBAR1=true
947a9ba4257SmrgV=1
948a9ba4257Smrgam__doit:
949a9ba4257Smrg	@$(TRUE)
950a9ba4257Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951a9ba4257Smrg  am_cv_make_support_nested_variables=yes
952a9ba4257Smrgelse
953a9ba4257Smrg  am_cv_make_support_nested_variables=no
954a9ba4257Smrgfi])
955a9ba4257Smrgif test $am_cv_make_support_nested_variables = yes; then
956a9ba4257Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957a9ba4257Smrg  AM_V='$(V)'
958a9ba4257Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959a9ba4257Smrgelse
960a9ba4257Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961a9ba4257Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962a9ba4257Smrgfi
963a9ba4257SmrgAC_SUBST([AM_V])dnl
964a9ba4257SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965a9ba4257SmrgAC_SUBST([AM_DEFAULT_V])dnl
966a9ba4257SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967350952b9SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968350952b9SmrgAM_BACKSLASH='\'
969350952b9SmrgAC_SUBST([AM_BACKSLASH])dnl
970350952b9Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971350952b9Smrg])
972350952b9Smrg
973e53c48bfSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974fd7d9bd3Smrg#
975350952b9Smrg# This file is free software; the Free Software Foundation
976350952b9Smrg# gives unlimited permission to copy and/or distribute it,
977350952b9Smrg# with or without modifications, as long as this notice is preserved.
978fd7d9bd3Smrg
979350952b9Smrg# AM_PROG_INSTALL_STRIP
980350952b9Smrg# ---------------------
981a9ba4257Smrg# One issue with vendor 'install' (even GNU) is that you can't
982350952b9Smrg# specify the program used to strip binaries.  This is especially
983350952b9Smrg# annoying in cross-compiling environments, where the build's strip
984350952b9Smrg# is unlikely to handle the host's binaries.
985350952b9Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986a9ba4257Smrg# always use install-sh in "make install-strip", and initialize
987350952b9Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988350952b9SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989350952b9Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990a9ba4257Smrg# Installed binaries are usually stripped using 'strip' when the user
991a9ba4257Smrg# run "make install-strip".  However 'strip' might not be the right
992350952b9Smrg# tool to use in cross-compilation environments, therefore Automake
993a9ba4257Smrg# will honor the 'STRIP' environment variable to overrule this program.
994a9ba4257Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995350952b9Smrgif test "$cross_compiling" != no; then
996350952b9Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997350952b9Smrgfi
998350952b9SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999350952b9SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000fd7d9bd3Smrg
1001e53c48bfSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002350952b9Smrg#
1003350952b9Smrg# This file is free software; the Free Software Foundation
1004350952b9Smrg# gives unlimited permission to copy and/or distribute it,
1005350952b9Smrg# with or without modifications, as long as this notice is preserved.
1006fd7d9bd3Smrg
1007350952b9Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008350952b9Smrg# ---------------------------
1009350952b9Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010350952b9Smrg# This macro is traced by Automake.
1011350952b9SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012fd7d9bd3Smrg
1013350952b9Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014a85aecdfSmrg# --------------------------
1015350952b9Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016350952b9SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017fd7d9bd3Smrg
1018350952b9Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019fd7d9bd3Smrg
1020e53c48bfSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021350952b9Smrg#
1022350952b9Smrg# This file is free software; the Free Software Foundation
1023350952b9Smrg# gives unlimited permission to copy and/or distribute it,
1024350952b9Smrg# with or without modifications, as long as this notice is preserved.
1025fd7d9bd3Smrg
1026350952b9Smrg# _AM_PROG_TAR(FORMAT)
1027350952b9Smrg# --------------------
1028350952b9Smrg# Check how to create a tarball in format FORMAT.
1029a9ba4257Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030350952b9Smrg#
1031350952b9Smrg# Substitute a variable $(am__tar) that is a command
1032350952b9Smrg# writing to stdout a FORMAT-tarball containing the directory
1033350952b9Smrg# $tardir.
1034350952b9Smrg#     tardir=directory && $(am__tar) > result.tar
1035350952b9Smrg#
1036350952b9Smrg# Substitute a variable $(am__untar) that extract such
1037350952b9Smrg# a tarball read from stdin.
1038350952b9Smrg#     $(am__untar) < result.tar
1039a9ba4257Smrg#
1040350952b9SmrgAC_DEFUN([_AM_PROG_TAR],
1041a9ba4257Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042a9ba4257Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043a9ba4257SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044a9ba4257Smrg
1045a9ba4257Smrg# We'll loop over all known methods to create a tar archive until one works.
1046350952b9Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047fd7d9bd3Smrg
1048a9ba4257Smrgm4_if([$1], [v7],
1049a9ba4257Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050a9ba4257Smrg
1051a9ba4257Smrg  [m4_case([$1],
1052a9ba4257Smrg    [ustar],
1053a9ba4257Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054a9ba4257Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055a9ba4257Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056a9ba4257Smrg      # and bug#13588).
1057a9ba4257Smrg      am_max_uid=2097151 # 2^21 - 1
1058a9ba4257Smrg      am_max_gid=$am_max_uid
1059a9ba4257Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060a9ba4257Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061a9ba4257Smrg      # below are definitely unexpected, so allow the users to see them
1062a9ba4257Smrg      # (that is, avoid stderr redirection).
1063a9ba4257Smrg      am_uid=`id -u || echo unknown`
1064a9ba4257Smrg      am_gid=`id -g || echo unknown`
1065a9ba4257Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066a9ba4257Smrg      if test $am_uid -le $am_max_uid; then
1067a9ba4257Smrg         AC_MSG_RESULT([yes])
1068a9ba4257Smrg      else
1069a9ba4257Smrg         AC_MSG_RESULT([no])
1070a9ba4257Smrg         _am_tools=none
1071a9ba4257Smrg      fi
1072a9ba4257Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073a9ba4257Smrg      if test $am_gid -le $am_max_gid; then
1074a9ba4257Smrg         AC_MSG_RESULT([yes])
1075a9ba4257Smrg      else
1076a9ba4257Smrg        AC_MSG_RESULT([no])
1077a9ba4257Smrg        _am_tools=none
1078a9ba4257Smrg      fi],
1079a9ba4257Smrg
1080a9ba4257Smrg  [pax],
1081a9ba4257Smrg    [],
1082a9ba4257Smrg
1083a9ba4257Smrg  [m4_fatal([Unknown tar format])])
1084a9ba4257Smrg
1085a9ba4257Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086a9ba4257Smrg
1087a9ba4257Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088a9ba4257Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089a9ba4257Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090a9ba4257Smrg
1091a9ba4257Smrg  for _am_tool in $_am_tools; do
1092a9ba4257Smrg    case $_am_tool in
1093a9ba4257Smrg    gnutar)
1094a9ba4257Smrg      for _am_tar in tar gnutar gtar; do
1095a9ba4257Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096a9ba4257Smrg      done
1097a9ba4257Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098a9ba4257Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099a9ba4257Smrg      am__untar="$_am_tar -xf -"
1100a9ba4257Smrg      ;;
1101a9ba4257Smrg    plaintar)
1102a9ba4257Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103a9ba4257Smrg      # ustar tarball either.
1104a9ba4257Smrg      (tar --version) >/dev/null 2>&1 && continue
1105a9ba4257Smrg      am__tar='tar chf - "$$tardir"'
1106a9ba4257Smrg      am__tar_='tar chf - "$tardir"'
1107a9ba4257Smrg      am__untar='tar xf -'
1108a9ba4257Smrg      ;;
1109a9ba4257Smrg    pax)
1110a9ba4257Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111a9ba4257Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112a9ba4257Smrg      am__untar='pax -r'
1113a9ba4257Smrg      ;;
1114a9ba4257Smrg    cpio)
1115a9ba4257Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116a9ba4257Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117a9ba4257Smrg      am__untar='cpio -i -H $1 -d'
1118a9ba4257Smrg      ;;
1119a9ba4257Smrg    none)
1120a9ba4257Smrg      am__tar=false
1121a9ba4257Smrg      am__tar_=false
1122a9ba4257Smrg      am__untar=false
1123a9ba4257Smrg      ;;
1124a9ba4257Smrg    esac
1125350952b9Smrg
1126a9ba4257Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127a9ba4257Smrg    # and am__untar set.
1128a9ba4257Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129a9ba4257Smrg
1130a9ba4257Smrg    # tar/untar a dummy directory, and stop if the command works.
1131a9ba4257Smrg    rm -rf conftest.dir
1132a9ba4257Smrg    mkdir conftest.dir
1133a9ba4257Smrg    echo GrepMe > conftest.dir/file
1134a9ba4257Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135a9ba4257Smrg    rm -rf conftest.dir
1136a9ba4257Smrg    if test -s conftest.tar; then
1137a9ba4257Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138a9ba4257Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139a9ba4257Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140a9ba4257Smrg    fi
1141a9ba4257Smrg  done
1142350952b9Smrg  rm -rf conftest.dir
1143350952b9Smrg
1144a9ba4257Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145a9ba4257Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146a9ba4257Smrg
1147350952b9SmrgAC_SUBST([am__tar])
1148350952b9SmrgAC_SUBST([am__untar])
1149350952b9Smrg]) # _AM_PROG_TAR
1150fd7d9bd3Smrg
1151e53c48bfSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152e53c48bfSmrgdnl serial 11 (pkg-config-0.29)
1153e53c48bfSmrgdnl
1154e53c48bfSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155e53c48bfSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156e53c48bfSmrgdnl
1157e53c48bfSmrgdnl This program is free software; you can redistribute it and/or modify
1158e53c48bfSmrgdnl it under the terms of the GNU General Public License as published by
1159e53c48bfSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160e53c48bfSmrgdnl (at your option) any later version.
1161e53c48bfSmrgdnl
1162e53c48bfSmrgdnl This program is distributed in the hope that it will be useful, but
1163e53c48bfSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164e53c48bfSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165e53c48bfSmrgdnl General Public License for more details.
1166e53c48bfSmrgdnl
1167e53c48bfSmrgdnl You should have received a copy of the GNU General Public License
1168e53c48bfSmrgdnl along with this program; if not, write to the Free Software
1169e53c48bfSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170e53c48bfSmrgdnl 02111-1307, USA.
1171e53c48bfSmrgdnl
1172e53c48bfSmrgdnl As a special exception to the GNU General Public License, if you
1173e53c48bfSmrgdnl distribute this file as part of a program that contains a
1174e53c48bfSmrgdnl configuration script generated by Autoconf, you may include it under
1175e53c48bfSmrgdnl the same distribution terms that you use for the rest of that
1176e53c48bfSmrgdnl program.
1177e53c48bfSmrg
1178e53c48bfSmrgdnl PKG_PREREQ(MIN-VERSION)
1179e53c48bfSmrgdnl -----------------------
1180e53c48bfSmrgdnl Since: 0.29
1181e53c48bfSmrgdnl
1182e53c48bfSmrgdnl Verify that the version of the pkg-config macros are at least
1183e53c48bfSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184e53c48bfSmrgdnl installed version of pkg-config, this checks the developer's version
1185e53c48bfSmrgdnl of pkg.m4 when generating configure.
1186e53c48bfSmrgdnl
1187e53c48bfSmrgdnl To ensure that this macro is defined, also add:
1188e53c48bfSmrgdnl m4_ifndef([PKG_PREREQ],
1189e53c48bfSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190e53c48bfSmrgdnl
1191e53c48bfSmrgdnl See the "Since" comment for each macro you use to see what version
1192e53c48bfSmrgdnl of the macros you require.
1193e53c48bfSmrgm4_defun([PKG_PREREQ],
1194e53c48bfSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195e53c48bfSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196e53c48bfSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197e53c48bfSmrg])dnl PKG_PREREQ
1198e53c48bfSmrg
1199e53c48bfSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200e53c48bfSmrgdnl ----------------------------------
1201e53c48bfSmrgdnl Since: 0.16
1202e53c48bfSmrgdnl
1203e53c48bfSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204e53c48bfSmrgdnl first found in the path. Checks that the version of pkg-config found
1205e53c48bfSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206e53c48bfSmrgdnl used since that's the first version where most current features of
1207e53c48bfSmrgdnl pkg-config existed.
1208a85aecdfSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209a85aecdfSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210e53c48bfSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211e53c48bfSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212e53c48bfSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213e53c48bfSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214e53c48bfSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215e53c48bfSmrg
1216a85aecdfSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217a85aecdfSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218a85aecdfSmrgfi
1219a85aecdfSmrgif test -n "$PKG_CONFIG"; then
1220a85aecdfSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221a85aecdfSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222a85aecdfSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223a85aecdfSmrg		AC_MSG_RESULT([yes])
1224a85aecdfSmrg	else
1225a85aecdfSmrg		AC_MSG_RESULT([no])
1226a85aecdfSmrg		PKG_CONFIG=""
1227a85aecdfSmrg	fi
1228a85aecdfSmrgfi[]dnl
1229e53c48bfSmrg])dnl PKG_PROG_PKG_CONFIG
1230a85aecdfSmrg
1231e53c48bfSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232e53c48bfSmrgdnl -------------------------------------------------------------------
1233e53c48bfSmrgdnl Since: 0.18
1234e53c48bfSmrgdnl
1235e53c48bfSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236e53c48bfSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237e53c48bfSmrgdnl
1238e53c48bfSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239e53c48bfSmrgdnl only at the first occurence in configure.ac, so if the first place
1240e53c48bfSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241e53c48bfSmrgdnl have to call PKG_CHECK_EXISTS manually
1242a85aecdfSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244a85aecdfSmrgif test -n "$PKG_CONFIG" && \
1245a85aecdfSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246e53c48bfSmrg  m4_default([$2], [:])
1247a85aecdfSmrgm4_ifvaln([$3], [else
1248a85aecdfSmrg  $3])dnl
1249a85aecdfSmrgfi])
1250a85aecdfSmrg
1251e53c48bfSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252e53c48bfSmrgdnl ---------------------------------------------
1253e53c48bfSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254e53c48bfSmrgdnl pkg_failed based on the result.
1255a85aecdfSmrgm4_define([_PKG_CONFIG],
1256a85aecdfSmrg[if test -n "$$1"; then
1257a85aecdfSmrg    pkg_cv_[]$1="$$1"
1258a85aecdfSmrg elif test -n "$PKG_CONFIG"; then
1259a85aecdfSmrg    PKG_CHECK_EXISTS([$3],
1260e53c48bfSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261e53c48bfSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262a85aecdfSmrg		     [pkg_failed=yes])
1263a85aecdfSmrg else
1264a85aecdfSmrg    pkg_failed=untried
1265a85aecdfSmrgfi[]dnl
1266e53c48bfSmrg])dnl _PKG_CONFIG
1267a85aecdfSmrg
1268e53c48bfSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269e53c48bfSmrgdnl ---------------------------
1270e53c48bfSmrgdnl Internal check to see if pkg-config supports short errors.
1271a85aecdfSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273a85aecdfSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274a85aecdfSmrg        _pkg_short_errors_supported=yes
1275a85aecdfSmrgelse
1276a85aecdfSmrg        _pkg_short_errors_supported=no
1277a85aecdfSmrgfi[]dnl
1278e53c48bfSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279a85aecdfSmrg
1280a85aecdfSmrg
1281e53c48bfSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282e53c48bfSmrgdnl   [ACTION-IF-NOT-FOUND])
1283e53c48bfSmrgdnl --------------------------------------------------------------
1284e53c48bfSmrgdnl Since: 0.4.0
1285e53c48bfSmrgdnl
1286e53c48bfSmrgdnl Note that if there is a possibility the first call to
1287e53c48bfSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288e53c48bfSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289a85aecdfSmrgAC_DEFUN([PKG_CHECK_MODULES],
1290a85aecdfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291a85aecdfSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292a85aecdfSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293a85aecdfSmrg
1294a85aecdfSmrgpkg_failed=no
1295a85aecdfSmrgAC_MSG_CHECKING([for $1])
1296a85aecdfSmrg
1297a85aecdfSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298a85aecdfSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299a85aecdfSmrg
1300a85aecdfSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301a85aecdfSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1302a85aecdfSmrgSee the pkg-config man page for more details.])
1303a85aecdfSmrg
1304a85aecdfSmrgif test $pkg_failed = yes; then
1305e53c48bfSmrg   	AC_MSG_RESULT([no])
1306a85aecdfSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1307a85aecdfSmrg        if test $_pkg_short_errors_supported = yes; then
1308e53c48bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309a85aecdfSmrg        else 
1310e53c48bfSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311a85aecdfSmrg        fi
1312a85aecdfSmrg	# Put the nasty error message in config.log where it belongs
1313a85aecdfSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314a85aecdfSmrg
1315e53c48bfSmrg	m4_default([$4], [AC_MSG_ERROR(
1316a85aecdfSmrg[Package requirements ($2) were not met:
1317a85aecdfSmrg
1318a85aecdfSmrg$$1_PKG_ERRORS
1319a85aecdfSmrg
1320a85aecdfSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321a85aecdfSmrginstalled software in a non-standard prefix.
1322a85aecdfSmrg
1323e53c48bfSmrg_PKG_TEXT])[]dnl
1324e53c48bfSmrg        ])
1325a85aecdfSmrgelif test $pkg_failed = untried; then
1326e53c48bfSmrg     	AC_MSG_RESULT([no])
1327e53c48bfSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328a85aecdfSmrg[The pkg-config script could not be found or is too old.  Make sure it
1329a85aecdfSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330a85aecdfSmrgpath to pkg-config.
1331a85aecdfSmrg
1332a85aecdfSmrg_PKG_TEXT
1333a85aecdfSmrg
1334e53c48bfSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335e53c48bfSmrg        ])
1336a85aecdfSmrgelse
1337a85aecdfSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338a85aecdfSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339a85aecdfSmrg        AC_MSG_RESULT([yes])
1340e53c48bfSmrg	$3
1341a85aecdfSmrgfi[]dnl
1342e53c48bfSmrg])dnl PKG_CHECK_MODULES
1343e53c48bfSmrg
1344e53c48bfSmrg
1345e53c48bfSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346e53c48bfSmrgdnl   [ACTION-IF-NOT-FOUND])
1347e53c48bfSmrgdnl ---------------------------------------------------------------------
1348e53c48bfSmrgdnl Since: 0.29
1349e53c48bfSmrgdnl
1350e53c48bfSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351e53c48bfSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352e53c48bfSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353e53c48bfSmrgdnl
1354e53c48bfSmrgdnl Note that if there is a possibility the first call to
1355e53c48bfSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356e53c48bfSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357e53c48bfSmrgdnl configure.ac.
1358e53c48bfSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359e53c48bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360e53c48bfSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361e53c48bfSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362e53c48bfSmrgPKG_CHECK_MODULES($@)
1363e53c48bfSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364e53c48bfSmrg])dnl PKG_CHECK_MODULES_STATIC
1365e53c48bfSmrg
1366e53c48bfSmrg
1367e53c48bfSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368e53c48bfSmrgdnl -------------------------
1369e53c48bfSmrgdnl Since: 0.27
1370e53c48bfSmrgdnl
1371e53c48bfSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372e53c48bfSmrgdnl should install pkg-config .pc files. By default the directory is
1373e53c48bfSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374e53c48bfSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375e53c48bfSmrgdnl parameter.
1376e53c48bfSmrgAC_DEFUN([PKG_INSTALLDIR],
1377e53c48bfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378e53c48bfSmrgm4_pushdef([pkg_description],
1379e53c48bfSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380e53c48bfSmrgAC_ARG_WITH([pkgconfigdir],
1381e53c48bfSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382e53c48bfSmrg    [with_pkgconfigdir=]pkg_default)
1383e53c48bfSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384e53c48bfSmrgm4_popdef([pkg_default])
1385e53c48bfSmrgm4_popdef([pkg_description])
1386e53c48bfSmrg])dnl PKG_INSTALLDIR
1387e53c48bfSmrg
1388e53c48bfSmrg
1389e53c48bfSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390e53c48bfSmrgdnl --------------------------------
1391e53c48bfSmrgdnl Since: 0.27
1392e53c48bfSmrgdnl
1393e53c48bfSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394e53c48bfSmrgdnl module should install arch-independent pkg-config .pc files. By
1395e53c48bfSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396e53c48bfSmrgdnl changed by passing DIRECTORY. The user can override through the
1397e53c48bfSmrgdnl --with-noarch-pkgconfigdir parameter.
1398e53c48bfSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399e53c48bfSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400e53c48bfSmrgm4_pushdef([pkg_description],
1401e53c48bfSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402e53c48bfSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403e53c48bfSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404e53c48bfSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405e53c48bfSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406e53c48bfSmrgm4_popdef([pkg_default])
1407e53c48bfSmrgm4_popdef([pkg_description])
1408e53c48bfSmrg])dnl PKG_NOARCH_INSTALLDIR
1409e53c48bfSmrg
1410e53c48bfSmrg
1411e53c48bfSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412e53c48bfSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413e53c48bfSmrgdnl -------------------------------------------
1414e53c48bfSmrgdnl Since: 0.28
1415e53c48bfSmrgdnl
1416e53c48bfSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417e53c48bfSmrgAC_DEFUN([PKG_CHECK_VAR],
1418e53c48bfSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419e53c48bfSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420e53c48bfSmrg
1421e53c48bfSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422e53c48bfSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423e53c48bfSmrg
1424e53c48bfSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425e53c48bfSmrg])dnl PKG_CHECK_VAR
1426a85aecdfSmrg
1427350952b9Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428fd7d9bd3Smrgdnl
1429e53c48bfSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1430a9ba4257Smrgdnl
1431350952b9Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14329aa2a2b5Smrgdnl copy of this software and associated documentation files (the "Software"),
14339aa2a2b5Smrgdnl to deal in the Software without restriction, including without limitation
14349aa2a2b5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14359aa2a2b5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14369aa2a2b5Smrgdnl Software is furnished to do so, subject to the following conditions:
1437350952b9Smrgdnl
14389aa2a2b5Smrgdnl The above copyright notice and this permission notice (including the next
14399aa2a2b5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14409aa2a2b5Smrgdnl Software.
1441350952b9Smrgdnl
14429aa2a2b5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14439aa2a2b5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14449aa2a2b5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14459aa2a2b5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14469aa2a2b5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14479aa2a2b5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14489aa2a2b5Smrgdnl DEALINGS IN THE SOFTWARE.
1449350952b9Smrg
1450350952b9Smrg# XORG_MACROS_VERSION(required-version)
1451350952b9Smrg# -------------------------------------
1452350952b9Smrg# Minimum version: 1.1.0
1453350952b9Smrg#
1454350952b9Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455350952b9Smrg# your configure.ac with the minimum required version, such as:
1456350952b9Smrg# XORG_MACROS_VERSION(1.1)
1457350952b9Smrg#
1458350952b9Smrg# To ensure that this macro is defined, also add:
1459350952b9Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460350952b9Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461350952b9Smrg#
1462350952b9Smrg#
1463a9ba4257Smrg# See the "minimum version" comment for each macro you use to see what
1464350952b9Smrg# version you require.
1465350952b9Smrgm4_defun([XORG_MACROS_VERSION],[
1466e53c48bfSmrgm4_define([vers_have], [1.19.3])
1467350952b9Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468350952b9Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469350952b9Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470350952b9Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471350952b9Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472350952b9Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473350952b9Smrgm4_undefine([vers_have])
1474350952b9Smrgm4_undefine([maj_have])
1475350952b9Smrgm4_undefine([maj_needed])
1476350952b9Smrg]) # XORG_MACROS_VERSION
1477fd7d9bd3Smrg
1478fd7d9bd3Smrg# XORG_PROG_RAWCPP()
1479fd7d9bd3Smrg# ------------------
1480350952b9Smrg# Minimum version: 1.0.0
1481350952b9Smrg#
1482fd7d9bd3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483fd7d9bd3Smrg# such as man pages and config files
1484fd7d9bd3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485fd7d9bd3SmrgAC_REQUIRE([AC_PROG_CPP])
1486e53c48bfSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487fd7d9bd3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488fd7d9bd3Smrg
1489fd7d9bd3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490fd7d9bd3Smrg# which is not the best choice for supporting other OS'es, but covers most
1491fd7d9bd3Smrg# of the ones we need for now.
1492fd7d9bd3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493a85aecdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494fd7d9bd3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495fd7d9bd3Smrg	AC_MSG_RESULT([no])
1496fd7d9bd3Smrgelse
1497fd7d9bd3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498fd7d9bd3Smrg		RAWCPPFLAGS=-undef
1499fd7d9bd3Smrg		AC_MSG_RESULT([yes])
1500350952b9Smrg	# under Cygwin unix is still defined even with -undef
1501350952b9Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502350952b9Smrg		RAWCPPFLAGS="-undef -ansi"
1503350952b9Smrg		AC_MSG_RESULT([yes, with -ansi])
1504fd7d9bd3Smrg	else
1505fd7d9bd3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506fd7d9bd3Smrg	fi
1507fd7d9bd3Smrgfi
1508fd7d9bd3Smrgrm -f conftest.$ac_ext
1509fd7d9bd3Smrg
1510fd7d9bd3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511a85aecdfSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512fd7d9bd3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1513fd7d9bd3Smrg	AC_MSG_RESULT([no])
1514fd7d9bd3Smrgelse
1515fd7d9bd3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1516a9ba4257Smrg		TRADITIONALCPPFLAGS="-traditional"
1517fd7d9bd3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518fd7d9bd3Smrg		AC_MSG_RESULT([yes])
1519fd7d9bd3Smrg	else
1520fd7d9bd3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521fd7d9bd3Smrg	fi
1522fd7d9bd3Smrgfi
1523fd7d9bd3Smrgrm -f conftest.$ac_ext
1524fd7d9bd3SmrgAC_SUBST(RAWCPPFLAGS)
1525a9ba4257SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526fd7d9bd3Smrg]) # XORG_PROG_RAWCPP
1527fd7d9bd3Smrg
1528fd7d9bd3Smrg# XORG_MANPAGE_SECTIONS()
1529fd7d9bd3Smrg# -----------------------
1530350952b9Smrg# Minimum version: 1.0.0
1531350952b9Smrg#
1532fd7d9bd3Smrg# Determine which sections man pages go in for the different man page types
1533fd7d9bd3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534fd7d9bd3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535fd7d9bd3Smrg# Override default settings by setting environment variables
15369aa2a2b5Smrg# Added MAN_SUBSTS in version 1.8
15379aa2a2b5Smrg# Added AC_PROG_SED in version 1.8
1538fd7d9bd3Smrg
1539fd7d9bd3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540fd7d9bd3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15419aa2a2b5SmrgAC_REQUIRE([AC_PROG_SED])
1542fd7d9bd3Smrg
1543e53c48bfSmrgcase $host_os in
1544e53c48bfSmrg    solaris*)
1545e53c48bfSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546e53c48bfSmrg        # check for a man page file found in later versions that use
1547e53c48bfSmrg        # traditional section numbers instead
1548e53c48bfSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549e53c48bfSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550e53c48bfSmrg        ;;
1551e53c48bfSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552e53c48bfSmrgesac
1553e53c48bfSmrg
1554fd7d9bd3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555350952b9Smrg    APP_MAN_SUFFIX=1
1556fd7d9bd3Smrgfi
1557fd7d9bd3Smrgif test x$APP_MAN_DIR = x    ; then
1558350952b9Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559fd7d9bd3Smrgfi
1560fd7d9bd3Smrg
1561fd7d9bd3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562350952b9Smrg    LIB_MAN_SUFFIX=3
1563fd7d9bd3Smrgfi
1564fd7d9bd3Smrgif test x$LIB_MAN_DIR = x    ; then
1565350952b9Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566fd7d9bd3Smrgfi
1567fd7d9bd3Smrg
1568fd7d9bd3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569e53c48bfSmrg    case $SYSV_MAN_SECTIONS in
1570e53c48bfSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1571e53c48bfSmrg	*)				FILE_MAN_SUFFIX=5  ;;
1572fd7d9bd3Smrg    esac
1573fd7d9bd3Smrgfi
1574fd7d9bd3Smrgif test x$FILE_MAN_DIR = x    ; then
1575350952b9Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576fd7d9bd3Smrgfi
1577fd7d9bd3Smrg
1578fd7d9bd3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579e53c48bfSmrg    case $SYSV_MAN_SECTIONS in
1580e53c48bfSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1581e53c48bfSmrg	*)				MISC_MAN_SUFFIX=7  ;;
1582fd7d9bd3Smrg    esac
1583fd7d9bd3Smrgfi
1584fd7d9bd3Smrgif test x$MISC_MAN_DIR = x    ; then
1585350952b9Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586fd7d9bd3Smrgfi
1587fd7d9bd3Smrg
1588fd7d9bd3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589e53c48bfSmrg    case $SYSV_MAN_SECTIONS in
1590e53c48bfSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591e53c48bfSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592fd7d9bd3Smrg    esac
1593fd7d9bd3Smrgfi
1594fd7d9bd3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595350952b9Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596fd7d9bd3Smrgfi
1597fd7d9bd3Smrg
1598fd7d9bd3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599e53c48bfSmrg    case $SYSV_MAN_SECTIONS in
1600e53c48bfSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601e53c48bfSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602fd7d9bd3Smrg    esac
1603fd7d9bd3Smrgfi
1604fd7d9bd3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605fd7d9bd3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1606fd7d9bd3Smrgfi
1607fd7d9bd3Smrg
1608fd7d9bd3Smrg
1609fd7d9bd3SmrgAC_SUBST([APP_MAN_SUFFIX])
1610fd7d9bd3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611fd7d9bd3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612fd7d9bd3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613fd7d9bd3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614fd7d9bd3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615fd7d9bd3SmrgAC_SUBST([APP_MAN_DIR])
1616fd7d9bd3SmrgAC_SUBST([LIB_MAN_DIR])
1617fd7d9bd3SmrgAC_SUBST([FILE_MAN_DIR])
1618fd7d9bd3SmrgAC_SUBST([MISC_MAN_DIR])
1619fd7d9bd3SmrgAC_SUBST([DRIVER_MAN_DIR])
1620fd7d9bd3SmrgAC_SUBST([ADMIN_MAN_DIR])
16219aa2a2b5Smrg
16229aa2a2b5SmrgXORG_MAN_PAGE="X Version 11"
16239aa2a2b5SmrgAC_SUBST([XORG_MAN_PAGE])
16249aa2a2b5SmrgMAN_SUBSTS="\
16259aa2a2b5Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16269aa2a2b5Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16279aa2a2b5Smrg	-e 's|__xservername__|Xorg|g' \
16289aa2a2b5Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16299aa2a2b5Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16309aa2a2b5Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16319aa2a2b5Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16329aa2a2b5Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16339aa2a2b5Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16349aa2a2b5Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16359aa2a2b5Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16369aa2a2b5Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16379aa2a2b5SmrgAC_SUBST([MAN_SUBSTS])
16389aa2a2b5Smrg
1639fd7d9bd3Smrg]) # XORG_MANPAGE_SECTIONS
1640fd7d9bd3Smrg
16419aa2a2b5Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16429aa2a2b5Smrg# ------------------------
16439aa2a2b5Smrg# Minimum version: 1.7.0
16449aa2a2b5Smrg#
16459aa2a2b5Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16469aa2a2b5Smrg# provided by xorg-sgml-doctools, if installed.
16479aa2a2b5SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16489aa2a2b5SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16499aa2a2b5SmrgXORG_SGML_PATH=
16509aa2a2b5SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16519aa2a2b5Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16529aa2a2b5Smrg    [m4_ifval([$1],[:],
16539aa2a2b5Smrg        [if test x"$cross_compiling" != x"yes" ; then
16549aa2a2b5Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16559aa2a2b5Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16569aa2a2b5Smrg         fi])
16579aa2a2b5Smrg    ])
16589aa2a2b5Smrg
16599aa2a2b5Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16609aa2a2b5Smrg# the path and the name of the doc stylesheet
16619aa2a2b5Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16629aa2a2b5Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16639aa2a2b5Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16649aa2a2b5Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16659aa2a2b5Smrgelse
16669aa2a2b5Smrg   AC_MSG_RESULT([no])
16679aa2a2b5Smrgfi
16689aa2a2b5Smrg
16699aa2a2b5SmrgAC_SUBST(XORG_SGML_PATH)
16709aa2a2b5SmrgAC_SUBST(STYLESHEET_SRCDIR)
16719aa2a2b5SmrgAC_SUBST(XSL_STYLESHEET)
16729aa2a2b5SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16739aa2a2b5Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16749aa2a2b5Smrg
1675fd7d9bd3Smrg# XORG_CHECK_LINUXDOC
1676fd7d9bd3Smrg# -------------------
1677350952b9Smrg# Minimum version: 1.0.0
1678350952b9Smrg#
1679fd7d9bd3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680fd7d9bd3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681fd7d9bd3Smrg# Whether or not the necessary tools and files are found can be checked
1682fd7d9bd3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683fd7d9bd3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16849aa2a2b5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16859aa2a2b5SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686fd7d9bd3Smrg
1687fd7d9bd3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688fd7d9bd3Smrg
16899aa2a2b5SmrgAC_MSG_CHECKING([whether to build documentation])
1690fd7d9bd3Smrg
16919aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692fd7d9bd3Smrg   BUILDDOC=yes
1693fd7d9bd3Smrgelse
1694fd7d9bd3Smrg   BUILDDOC=no
1695fd7d9bd3Smrgfi
1696fd7d9bd3Smrg
1697fd7d9bd3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698fd7d9bd3Smrg
1699fd7d9bd3SmrgAC_MSG_RESULT([$BUILDDOC])
1700fd7d9bd3Smrg
17019aa2a2b5SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702fd7d9bd3Smrg
17039aa2a2b5Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704fd7d9bd3Smrg   BUILDPDFDOC=yes
1705fd7d9bd3Smrgelse
1706fd7d9bd3Smrg   BUILDPDFDOC=no
1707fd7d9bd3Smrgfi
1708fd7d9bd3Smrg
1709fd7d9bd3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710fd7d9bd3Smrg
1711fd7d9bd3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712fd7d9bd3Smrg
17139aa2a2b5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714350952b9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715fd7d9bd3SmrgMAKE_PDF="$PS2PDF"
1716350952b9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717fd7d9bd3Smrg
1718fd7d9bd3SmrgAC_SUBST(MAKE_TEXT)
1719fd7d9bd3SmrgAC_SUBST(MAKE_PS)
1720fd7d9bd3SmrgAC_SUBST(MAKE_PDF)
1721fd7d9bd3SmrgAC_SUBST(MAKE_HTML)
1722fd7d9bd3Smrg]) # XORG_CHECK_LINUXDOC
1723fd7d9bd3Smrg
1724350952b9Smrg# XORG_CHECK_DOCBOOK
1725350952b9Smrg# -------------------
1726350952b9Smrg# Minimum version: 1.0.0
1727350952b9Smrg#
1728350952b9Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729350952b9Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730350952b9Smrg# indicates whether the necessary tools and files are found and, if set,
1731350952b9Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732350952b9SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17339aa2a2b5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17349aa2a2b5Smrg
1735350952b9SmrgBUILDTXTDOC=no
1736350952b9SmrgBUILDPDFDOC=no
1737350952b9SmrgBUILDPSDOC=no
1738350952b9SmrgBUILDHTMLDOC=no
1739350952b9Smrg
1740350952b9SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741350952b9SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742350952b9SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743350952b9SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744350952b9Smrg
17459aa2a2b5SmrgAC_MSG_CHECKING([whether to build text documentation])
17469aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747350952b9Smrg   test x$BUILD_TXTDOC != xno; then
1748350952b9Smrg	BUILDTXTDOC=yes
1749350952b9Smrgfi
1750350952b9SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751350952b9SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752350952b9Smrg
17539aa2a2b5SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17549aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755350952b9Smrg   test x$BUILD_PDFDOC != xno; then
1756350952b9Smrg	BUILDPDFDOC=yes
1757350952b9Smrgfi
1758350952b9SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759350952b9SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760350952b9Smrg
17619aa2a2b5SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17629aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763350952b9Smrg   test x$BUILD_PSDOC != xno; then
1764350952b9Smrg	BUILDPSDOC=yes
1765350952b9Smrgfi
1766350952b9SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767350952b9SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768350952b9Smrg
17699aa2a2b5SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17709aa2a2b5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771350952b9Smrg   test x$BUILD_HTMLDOC != xno; then
1772350952b9Smrg	BUILDHTMLDOC=yes
1773350952b9Smrgfi
1774350952b9SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775350952b9SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776350952b9Smrg
1777350952b9SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778350952b9SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779350952b9SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780350952b9SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781350952b9Smrg
1782350952b9SmrgAC_SUBST(MAKE_TEXT)
1783350952b9SmrgAC_SUBST(MAKE_PS)
1784350952b9SmrgAC_SUBST(MAKE_PDF)
1785350952b9SmrgAC_SUBST(MAKE_HTML)
1786350952b9Smrg]) # XORG_CHECK_DOCBOOK
1787350952b9Smrg
17889aa2a2b5Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17899aa2a2b5Smrg# ----------------
17909aa2a2b5Smrg# Minimum version: 1.5.0
17919aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17929aa2a2b5Smrg#
17939aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
17949aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
17959aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17969aa2a2b5Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17979aa2a2b5Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17989aa2a2b5Smrg# --with-xmlto assumes 'auto'.
17999aa2a2b5Smrg#
18009aa2a2b5Smrg# Interface to module:
18019aa2a2b5Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18029aa2a2b5Smrg# XMLTO:	returns the path of the xmlto program found
18039aa2a2b5Smrg#		returns the path set by the user in the environment
18049aa2a2b5Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18059aa2a2b5Smrg#		'no' user instructs the module not to use xmlto
18069aa2a2b5Smrg#
18079aa2a2b5Smrg# Added in version 1.10.0
18089aa2a2b5Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18099aa2a2b5Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18109aa2a2b5Smrg#
18119aa2a2b5Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18129aa2a2b5Smrg#
18139aa2a2b5SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18149aa2a2b5SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18159aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
18169aa2a2b5SmrgAC_ARG_WITH(xmlto,
18179aa2a2b5Smrg	AS_HELP_STRING([--with-xmlto],
18189aa2a2b5Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18199aa2a2b5Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18209aa2a2b5Smrgm4_undefine([_defopt])
18219aa2a2b5Smrg
18229aa2a2b5Smrgif test "x$use_xmlto" = x"auto"; then
18239aa2a2b5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18249aa2a2b5Smrg   if test "x$XMLTO" = "x"; then
18259aa2a2b5Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18269aa2a2b5Smrg	have_xmlto=no
18279aa2a2b5Smrg   else
18289aa2a2b5Smrg        have_xmlto=yes
18299aa2a2b5Smrg   fi
18309aa2a2b5Smrgelif test "x$use_xmlto" = x"yes" ; then
18319aa2a2b5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18329aa2a2b5Smrg   if test "x$XMLTO" = "x"; then
18339aa2a2b5Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18349aa2a2b5Smrg   fi
18359aa2a2b5Smrg   have_xmlto=yes
18369aa2a2b5Smrgelif test "x$use_xmlto" = x"no" ; then
18379aa2a2b5Smrg   if test "x$XMLTO" != "x"; then
18389aa2a2b5Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18399aa2a2b5Smrg   fi
18409aa2a2b5Smrg   have_xmlto=no
18419aa2a2b5Smrgelse
18429aa2a2b5Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18439aa2a2b5Smrgfi
18449aa2a2b5Smrg
18459aa2a2b5Smrg# Test for a minimum version of xmlto, if provided.
18469aa2a2b5Smrgm4_ifval([$1],
18479aa2a2b5Smrg[if test "$have_xmlto" = yes; then
18489aa2a2b5Smrg    # scrape the xmlto version
18499aa2a2b5Smrg    AC_MSG_CHECKING([the xmlto version])
18509aa2a2b5Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18519aa2a2b5Smrg    AC_MSG_RESULT([$xmlto_version])
18529aa2a2b5Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18539aa2a2b5Smrg        [if test "x$use_xmlto" = xauto; then
18549aa2a2b5Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18559aa2a2b5Smrg            have_xmlto=no
18569aa2a2b5Smrg        else
18579aa2a2b5Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18589aa2a2b5Smrg        fi])
18599aa2a2b5Smrgfi])
18609aa2a2b5Smrg
18619aa2a2b5Smrg# Test for the ability of xmlto to generate a text target
1862e53c48bfSmrg#
1863e53c48bfSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864e53c48bfSmrg# following test for empty XML docbook files.
1865e53c48bfSmrg# For compatibility reasons use the following empty XML docbook file and if
1866e53c48bfSmrg# it fails try it again with a non-empty XML file.
18679aa2a2b5Smrghave_xmlto_text=no
18689aa2a2b5Smrgcat > conftest.xml << "EOF"
18699aa2a2b5SmrgEOF
18709aa2a2b5SmrgAS_IF([test "$have_xmlto" = yes],
18719aa2a2b5Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18729aa2a2b5Smrg             [have_xmlto_text=yes],
1873e53c48bfSmrg             [# Try it again with a non-empty XML file.
1874e53c48bfSmrg              cat > conftest.xml << "EOF"
1875e53c48bfSmrg<x></x>
1876e53c48bfSmrgEOF
1877e53c48bfSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878e53c48bfSmrg                    [have_xmlto_text=yes],
1879e53c48bfSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18809aa2a2b5Smrgrm -f conftest.xml
18819aa2a2b5SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18829aa2a2b5SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18839aa2a2b5Smrg]) # XORG_WITH_XMLTO
18849aa2a2b5Smrg
1885a85aecdfSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886a85aecdfSmrg# --------------------------------------------
1887a85aecdfSmrg# Minimum version: 1.12.0
1888a85aecdfSmrg# Minimum version for optional DEFAULT argument: 1.12.0
1889a85aecdfSmrg#
1890a85aecdfSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891a85aecdfSmrg# XML-based language used for the transformation of XML documents.
1892a85aecdfSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893a85aecdfSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894a85aecdfSmrg# The XSLT processor is often used as a standalone tool for transformations.
1895a85aecdfSmrg# It should not be assumed that this tool is used only to work with documnetation.
1896a85aecdfSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897a85aecdfSmrg#
1898a85aecdfSmrg# Interface to module:
1899a85aecdfSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900a85aecdfSmrg# XSLTPROC:	 returns the path of the xsltproc program found
1901a85aecdfSmrg#		 returns the path set by the user in the environment
1902a85aecdfSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903a85aecdfSmrg#		  'no' user instructs the module not to use xsltproc
1904a85aecdfSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905a85aecdfSmrg#
1906a85aecdfSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907a85aecdfSmrg#
1908a85aecdfSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909a85aecdfSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910a85aecdfSmrg# Preserves the interface, should it be implemented later
1911a85aecdfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1913a85aecdfSmrgAC_ARG_WITH(xsltproc,
1914a85aecdfSmrg	AS_HELP_STRING([--with-xsltproc],
1915a85aecdfSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916a85aecdfSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917a85aecdfSmrgm4_undefine([_defopt])
1918a85aecdfSmrg
1919a85aecdfSmrgif test "x$use_xsltproc" = x"auto"; then
1920a85aecdfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921a85aecdfSmrg   if test "x$XSLTPROC" = "x"; then
1922a85aecdfSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923a85aecdfSmrg	have_xsltproc=no
1924a85aecdfSmrg   else
1925a85aecdfSmrg        have_xsltproc=yes
1926a85aecdfSmrg   fi
1927a85aecdfSmrgelif test "x$use_xsltproc" = x"yes" ; then
1928a85aecdfSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929a85aecdfSmrg   if test "x$XSLTPROC" = "x"; then
1930a85aecdfSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931a85aecdfSmrg   fi
1932a85aecdfSmrg   have_xsltproc=yes
1933a85aecdfSmrgelif test "x$use_xsltproc" = x"no" ; then
1934a85aecdfSmrg   if test "x$XSLTPROC" != "x"; then
1935a85aecdfSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936a85aecdfSmrg   fi
1937a85aecdfSmrg   have_xsltproc=no
1938a85aecdfSmrgelse
1939a85aecdfSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940a85aecdfSmrgfi
1941a85aecdfSmrg
1942a85aecdfSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943a85aecdfSmrg]) # XORG_WITH_XSLTPROC
1944a85aecdfSmrg
1945a85aecdfSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946a85aecdfSmrg# ----------------------------------------
1947a85aecdfSmrg# Minimum version: 1.15.0
1948a85aecdfSmrg#
1949a85aecdfSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950a85aecdfSmrg# scanning arbitrary text files, extracting information from those text files,
1951a85aecdfSmrg# and printing reports based on that information.
1952a85aecdfSmrg#
1953a85aecdfSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954a85aecdfSmrg#
1955a85aecdfSmrg# Interface to module:
1956a85aecdfSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957a85aecdfSmrg# PERL:	     returns the path of the perl program found
1958a85aecdfSmrg#	     returns the path set by the user in the environment
1959a85aecdfSmrg# --with-perl: 'yes' user instructs the module to use perl
1960a85aecdfSmrg#	       'no' user instructs the module not to use perl
1961a85aecdfSmrg# have_perl: returns yes if perl found in PATH or no
1962a85aecdfSmrg#
1963a85aecdfSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964a85aecdfSmrg#
1965a85aecdfSmrgAC_DEFUN([XORG_WITH_PERL],[
1966a85aecdfSmrgAC_ARG_VAR([PERL], [Path to perl command])
1967a85aecdfSmrg# Preserves the interface, should it be implemented later
1968a85aecdfSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
1970a85aecdfSmrgAC_ARG_WITH(perl,
1971a85aecdfSmrg	AS_HELP_STRING([--with-perl],
1972a85aecdfSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973a85aecdfSmrg	   [use_perl=$withval], [use_perl=]_defopt)
1974a85aecdfSmrgm4_undefine([_defopt])
1975a85aecdfSmrg
1976a85aecdfSmrgif test "x$use_perl" = x"auto"; then
1977a85aecdfSmrg   AC_PATH_PROG([PERL], [perl])
1978a85aecdfSmrg   if test "x$PERL" = "x"; then
1979a85aecdfSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980a85aecdfSmrg	have_perl=no
1981a85aecdfSmrg   else
1982a85aecdfSmrg        have_perl=yes
1983a85aecdfSmrg   fi
1984a85aecdfSmrgelif test "x$use_perl" = x"yes" ; then
1985a85aecdfSmrg   AC_PATH_PROG([PERL], [perl])
1986a85aecdfSmrg   if test "x$PERL" = "x"; then
1987a85aecdfSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988a85aecdfSmrg   fi
1989a85aecdfSmrg   have_perl=yes
1990a85aecdfSmrgelif test "x$use_perl" = x"no" ; then
1991a85aecdfSmrg   if test "x$PERL" != "x"; then
1992a85aecdfSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993a85aecdfSmrg   fi
1994a85aecdfSmrg   have_perl=no
1995a85aecdfSmrgelse
1996a85aecdfSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997a85aecdfSmrgfi
1998a85aecdfSmrg
1999a85aecdfSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000a85aecdfSmrg]) # XORG_WITH_PERL
2001a85aecdfSmrg
20029aa2a2b5Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20039aa2a2b5Smrg# ----------------
20049aa2a2b5Smrg# Minimum version: 1.5.0
20059aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20069aa2a2b5Smrg#
20079aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
20089aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
20099aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20109aa2a2b5Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20119aa2a2b5Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20129aa2a2b5Smrg# --with-asciidoc assumes 'auto'.
20139aa2a2b5Smrg#
20149aa2a2b5Smrg# Interface to module:
20159aa2a2b5Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20169aa2a2b5Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20179aa2a2b5Smrg#		 returns the path set by the user in the environment
20189aa2a2b5Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20199aa2a2b5Smrg#		  'no' user instructs the module not to use asciidoc
20209aa2a2b5Smrg#
20219aa2a2b5Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20229aa2a2b5Smrg#
20239aa2a2b5SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20249aa2a2b5SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20259aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
20269aa2a2b5SmrgAC_ARG_WITH(asciidoc,
20279aa2a2b5Smrg	AS_HELP_STRING([--with-asciidoc],
20289aa2a2b5Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20299aa2a2b5Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20309aa2a2b5Smrgm4_undefine([_defopt])
20319aa2a2b5Smrg
20329aa2a2b5Smrgif test "x$use_asciidoc" = x"auto"; then
20339aa2a2b5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20349aa2a2b5Smrg   if test "x$ASCIIDOC" = "x"; then
20359aa2a2b5Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20369aa2a2b5Smrg	have_asciidoc=no
20379aa2a2b5Smrg   else
20389aa2a2b5Smrg        have_asciidoc=yes
20399aa2a2b5Smrg   fi
20409aa2a2b5Smrgelif test "x$use_asciidoc" = x"yes" ; then
20419aa2a2b5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20429aa2a2b5Smrg   if test "x$ASCIIDOC" = "x"; then
20439aa2a2b5Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20449aa2a2b5Smrg   fi
20459aa2a2b5Smrg   have_asciidoc=yes
20469aa2a2b5Smrgelif test "x$use_asciidoc" = x"no" ; then
20479aa2a2b5Smrg   if test "x$ASCIIDOC" != "x"; then
20489aa2a2b5Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20499aa2a2b5Smrg   fi
20509aa2a2b5Smrg   have_asciidoc=no
20519aa2a2b5Smrgelse
20529aa2a2b5Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20539aa2a2b5Smrgfi
20549aa2a2b5Smrgm4_ifval([$1],
20559aa2a2b5Smrg[if test "$have_asciidoc" = yes; then
20569aa2a2b5Smrg    # scrape the asciidoc version
20579aa2a2b5Smrg    AC_MSG_CHECKING([the asciidoc version])
20589aa2a2b5Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20599aa2a2b5Smrg    AC_MSG_RESULT([$asciidoc_version])
20609aa2a2b5Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20619aa2a2b5Smrg        [if test "x$use_asciidoc" = xauto; then
20629aa2a2b5Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20639aa2a2b5Smrg            have_asciidoc=no
20649aa2a2b5Smrg        else
20659aa2a2b5Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20669aa2a2b5Smrg        fi])
20679aa2a2b5Smrgfi])
20689aa2a2b5SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20699aa2a2b5Smrg]) # XORG_WITH_ASCIIDOC
20709aa2a2b5Smrg
20719aa2a2b5Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072a9ba4257Smrg# -------------------------------------------
20739aa2a2b5Smrg# Minimum version: 1.5.0
20749aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075a9ba4257Smrg# Minimum version for optional DOT checking: 1.18.0
20769aa2a2b5Smrg#
20779aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
20789aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
20799aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20809aa2a2b5Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20819aa2a2b5Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20829aa2a2b5Smrg# --with-doxygen assumes 'auto'.
20839aa2a2b5Smrg#
20849aa2a2b5Smrg# Interface to module:
20859aa2a2b5Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20869aa2a2b5Smrg# DOXYGEN:	 returns the path of the doxygen program found
20879aa2a2b5Smrg#		 returns the path set by the user in the environment
20889aa2a2b5Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20899aa2a2b5Smrg#		  'no' user instructs the module not to use doxygen
20909aa2a2b5Smrg#
20919aa2a2b5Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20929aa2a2b5Smrg#
20939aa2a2b5SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20949aa2a2b5SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095a9ba4257SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20969aa2a2b5Smrgm4_define([_defopt], m4_default([$2], [auto]))
20979aa2a2b5SmrgAC_ARG_WITH(doxygen,
20989aa2a2b5Smrg	AS_HELP_STRING([--with-doxygen],
20999aa2a2b5Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21009aa2a2b5Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21019aa2a2b5Smrgm4_undefine([_defopt])
21029aa2a2b5Smrg
21039aa2a2b5Smrgif test "x$use_doxygen" = x"auto"; then
21049aa2a2b5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21059aa2a2b5Smrg   if test "x$DOXYGEN" = "x"; then
21069aa2a2b5Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21079aa2a2b5Smrg	have_doxygen=no
21089aa2a2b5Smrg   else
21099aa2a2b5Smrg        have_doxygen=yes
21109aa2a2b5Smrg   fi
21119aa2a2b5Smrgelif test "x$use_doxygen" = x"yes" ; then
21129aa2a2b5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21139aa2a2b5Smrg   if test "x$DOXYGEN" = "x"; then
21149aa2a2b5Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21159aa2a2b5Smrg   fi
21169aa2a2b5Smrg   have_doxygen=yes
21179aa2a2b5Smrgelif test "x$use_doxygen" = x"no" ; then
21189aa2a2b5Smrg   if test "x$DOXYGEN" != "x"; then
21199aa2a2b5Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21209aa2a2b5Smrg   fi
21219aa2a2b5Smrg   have_doxygen=no
21229aa2a2b5Smrgelse
21239aa2a2b5Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21249aa2a2b5Smrgfi
21259aa2a2b5Smrgm4_ifval([$1],
21269aa2a2b5Smrg[if test "$have_doxygen" = yes; then
21279aa2a2b5Smrg    # scrape the doxygen version
21289aa2a2b5Smrg    AC_MSG_CHECKING([the doxygen version])
21299aa2a2b5Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21309aa2a2b5Smrg    AC_MSG_RESULT([$doxygen_version])
21319aa2a2b5Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21329aa2a2b5Smrg        [if test "x$use_doxygen" = xauto; then
21339aa2a2b5Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21349aa2a2b5Smrg            have_doxygen=no
21359aa2a2b5Smrg        else
21369aa2a2b5Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21379aa2a2b5Smrg        fi])
21389aa2a2b5Smrgfi])
2139a9ba4257Smrg
2140a9ba4257Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141a9ba4257Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142a9ba4257Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143a9ba4257SmrgHAVE_DOT=no
2144a9ba4257Smrgif test "x$have_doxygen" = "xyes"; then
2145a9ba4257Smrg  AC_PATH_PROG([DOT], [dot])
2146a9ba4257Smrg    if test "x$DOT" != "x"; then
2147a9ba4257Smrg      HAVE_DOT=yes
2148a9ba4257Smrg    fi
2149a9ba4257Smrgfi
2150a9ba4257Smrg
2151a9ba4257SmrgAC_SUBST([HAVE_DOT])
2152a9ba4257SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21539aa2a2b5SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21549aa2a2b5Smrg]) # XORG_WITH_DOXYGEN
21559aa2a2b5Smrg
21569aa2a2b5Smrg# XORG_WITH_GROFF([DEFAULT])
21579aa2a2b5Smrg# ----------------
21589aa2a2b5Smrg# Minimum version: 1.6.0
21599aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21609aa2a2b5Smrg#
21619aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
21629aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
21639aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21649aa2a2b5Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
21659aa2a2b5Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21669aa2a2b5Smrg# --with-groff assumes 'auto'.
21679aa2a2b5Smrg#
21689aa2a2b5Smrg# Interface to module:
21699aa2a2b5Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21709aa2a2b5Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21719aa2a2b5Smrg# HAVE_GROFF_MS: the -ms macros package
21729aa2a2b5Smrg# GROFF:	 returns the path of the groff program found
21739aa2a2b5Smrg#		 returns the path set by the user in the environment
21749aa2a2b5Smrg# --with-groff:	 'yes' user instructs the module to use groff
21759aa2a2b5Smrg#		 'no' user instructs the module not to use groff
21769aa2a2b5Smrg#
21779aa2a2b5Smrg# Added in version 1.9.0:
21789aa2a2b5Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21799aa2a2b5Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21809aa2a2b5Smrg#		   psselect from the psutils package.
21819aa2a2b5Smrg#		   the ghostcript package. Refer to the grohtml man pages
21829aa2a2b5Smrg#
21839aa2a2b5Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21849aa2a2b5Smrg#
21859aa2a2b5Smrg# OS and distros often splits groff in a basic and full package, the former
21869aa2a2b5Smrg# having the groff program and the later having devices, fonts and macros
21879aa2a2b5Smrg# Checking for the groff executable is not enough.
21889aa2a2b5Smrg#
21899aa2a2b5Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21909aa2a2b5Smrg# unset HAVE_GROFF or GROFF env variables.
21919aa2a2b5Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21929aa2a2b5Smrg#
21939aa2a2b5SmrgAC_DEFUN([XORG_WITH_GROFF],[
21949aa2a2b5SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21959aa2a2b5Smrgm4_define([_defopt], m4_default([$1], [auto]))
21969aa2a2b5SmrgAC_ARG_WITH(groff,
21979aa2a2b5Smrg	AS_HELP_STRING([--with-groff],
21989aa2a2b5Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21999aa2a2b5Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22009aa2a2b5Smrgm4_undefine([_defopt])
22019aa2a2b5Smrg
22029aa2a2b5Smrgif test "x$use_groff" = x"auto"; then
22039aa2a2b5Smrg   AC_PATH_PROG([GROFF], [groff])
22049aa2a2b5Smrg   if test "x$GROFF" = "x"; then
22059aa2a2b5Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22069aa2a2b5Smrg	have_groff=no
22079aa2a2b5Smrg   else
22089aa2a2b5Smrg        have_groff=yes
22099aa2a2b5Smrg   fi
22109aa2a2b5Smrgelif test "x$use_groff" = x"yes" ; then
22119aa2a2b5Smrg   AC_PATH_PROG([GROFF], [groff])
22129aa2a2b5Smrg   if test "x$GROFF" = "x"; then
22139aa2a2b5Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22149aa2a2b5Smrg   fi
22159aa2a2b5Smrg   have_groff=yes
22169aa2a2b5Smrgelif test "x$use_groff" = x"no" ; then
22179aa2a2b5Smrg   if test "x$GROFF" != "x"; then
22189aa2a2b5Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22199aa2a2b5Smrg   fi
22209aa2a2b5Smrg   have_groff=no
22219aa2a2b5Smrgelse
22229aa2a2b5Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22239aa2a2b5Smrgfi
22249aa2a2b5Smrg
22259aa2a2b5Smrg# We have groff, test for the presence of the macro packages
22269aa2a2b5Smrgif test "x$have_groff" = x"yes"; then
22279aa2a2b5Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22289aa2a2b5Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22299aa2a2b5Smrg        groff_ms_works=yes
22309aa2a2b5Smrg    else
22319aa2a2b5Smrg        groff_ms_works=no
22329aa2a2b5Smrg    fi
22339aa2a2b5Smrg    AC_MSG_RESULT([$groff_ms_works])
22349aa2a2b5Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22359aa2a2b5Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22369aa2a2b5Smrg        groff_mm_works=yes
22379aa2a2b5Smrg    else
22389aa2a2b5Smrg        groff_mm_works=no
22399aa2a2b5Smrg    fi
22409aa2a2b5Smrg    AC_MSG_RESULT([$groff_mm_works])
22419aa2a2b5Smrgfi
22429aa2a2b5Smrg
22439aa2a2b5Smrg# We have groff, test for HTML dependencies, one command per package
22449aa2a2b5Smrgif test "x$have_groff" = x"yes"; then
22459aa2a2b5Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22469aa2a2b5Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22479aa2a2b5Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22489aa2a2b5Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22499aa2a2b5Smrg      have_groff_html=yes
22509aa2a2b5Smrg   else
22519aa2a2b5Smrg      have_groff_html=no
22529aa2a2b5Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22539aa2a2b5Smrg   fi
22549aa2a2b5Smrgfi
22559aa2a2b5Smrg
22569aa2a2b5Smrg# Set Automake conditionals for Makefiles
22579aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22589aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22599aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22609aa2a2b5SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22619aa2a2b5Smrg]) # XORG_WITH_GROFF
22629aa2a2b5Smrg
2263a85aecdfSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264a85aecdfSmrg# ---------------------------------------
22659aa2a2b5Smrg# Minimum version: 1.6.0
22669aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267a85aecdfSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22689aa2a2b5Smrg#
22699aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
22709aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
22719aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22729aa2a2b5Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
22739aa2a2b5Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22749aa2a2b5Smrg# --with-fop assumes 'auto'.
22759aa2a2b5Smrg#
22769aa2a2b5Smrg# Interface to module:
22779aa2a2b5Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22789aa2a2b5Smrg# FOP:	 	returns the path of the fop program found
22799aa2a2b5Smrg#		returns the path set by the user in the environment
22809aa2a2b5Smrg# --with-fop: 	'yes' user instructs the module to use fop
22819aa2a2b5Smrg#		'no' user instructs the module not to use fop
22829aa2a2b5Smrg#
22839aa2a2b5Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22849aa2a2b5Smrg#
22859aa2a2b5SmrgAC_DEFUN([XORG_WITH_FOP],[
22869aa2a2b5SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
22889aa2a2b5SmrgAC_ARG_WITH(fop,
22899aa2a2b5Smrg	AS_HELP_STRING([--with-fop],
22909aa2a2b5Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22919aa2a2b5Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22929aa2a2b5Smrgm4_undefine([_defopt])
22939aa2a2b5Smrg
22949aa2a2b5Smrgif test "x$use_fop" = x"auto"; then
22959aa2a2b5Smrg   AC_PATH_PROG([FOP], [fop])
22969aa2a2b5Smrg   if test "x$FOP" = "x"; then
22979aa2a2b5Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22989aa2a2b5Smrg	have_fop=no
22999aa2a2b5Smrg   else
23009aa2a2b5Smrg        have_fop=yes
23019aa2a2b5Smrg   fi
23029aa2a2b5Smrgelif test "x$use_fop" = x"yes" ; then
23039aa2a2b5Smrg   AC_PATH_PROG([FOP], [fop])
23049aa2a2b5Smrg   if test "x$FOP" = "x"; then
23059aa2a2b5Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23069aa2a2b5Smrg   fi
23079aa2a2b5Smrg   have_fop=yes
23089aa2a2b5Smrgelif test "x$use_fop" = x"no" ; then
23099aa2a2b5Smrg   if test "x$FOP" != "x"; then
23109aa2a2b5Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23119aa2a2b5Smrg   fi
23129aa2a2b5Smrg   have_fop=no
23139aa2a2b5Smrgelse
23149aa2a2b5Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23159aa2a2b5Smrgfi
2316a85aecdfSmrg
2317a85aecdfSmrg# Test for a minimum version of fop, if provided.
2318a85aecdfSmrgm4_ifval([$1],
2319a85aecdfSmrg[if test "$have_fop" = yes; then
2320a85aecdfSmrg    # scrape the fop version
2321a85aecdfSmrg    AC_MSG_CHECKING([for fop minimum version])
2322a85aecdfSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323a85aecdfSmrg    AC_MSG_RESULT([$fop_version])
2324a85aecdfSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325a85aecdfSmrg        [if test "x$use_fop" = xauto; then
2326a85aecdfSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327a85aecdfSmrg            have_fop=no
2328a85aecdfSmrg        else
2329a85aecdfSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330a85aecdfSmrg        fi])
2331a85aecdfSmrgfi])
23329aa2a2b5SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23339aa2a2b5Smrg]) # XORG_WITH_FOP
23349aa2a2b5Smrg
2335a9ba4257Smrg# XORG_WITH_M4([MIN-VERSION])
2336a9ba4257Smrg# ---------------------------
2337a9ba4257Smrg# Minimum version: 1.19.0
2338a9ba4257Smrg#
2339a9ba4257Smrg# This macro attempts to locate an m4 macro processor which supports
2340a9ba4257Smrg# -I option and is only useful for modules relying on M4 in order to
2341a9ba4257Smrg# expand macros in source code files.
2342a9ba4257Smrg#
2343a9ba4257Smrg# Interface to module:
2344a9ba4257Smrg# M4:	 	returns the path of the m4 program found
2345a9ba4257Smrg#		returns the path set by the user in the environment
2346a9ba4257Smrg#
2347a9ba4257SmrgAC_DEFUN([XORG_WITH_M4], [
2348a9ba4257SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349a9ba4257Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350a9ba4257Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351a9ba4257Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352a9ba4257Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353a9ba4257Smrg   [$PATH:/usr/gnu/bin])])
2354a9ba4257Smrg
2355a9ba4257SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356a9ba4257Smrg]) # XORG_WITH_M4
2357a9ba4257Smrg
23589aa2a2b5Smrg# XORG_WITH_PS2PDF([DEFAULT])
23599aa2a2b5Smrg# ----------------
23609aa2a2b5Smrg# Minimum version: 1.6.0
23619aa2a2b5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23629aa2a2b5Smrg#
23639aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
23649aa2a2b5Smrg# not at the appropriate level. This macro enables a module to test for the
23659aa2a2b5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23669aa2a2b5Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23679aa2a2b5Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23689aa2a2b5Smrg# --with-ps2pdf assumes 'auto'.
23699aa2a2b5Smrg#
23709aa2a2b5Smrg# Interface to module:
23719aa2a2b5Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23729aa2a2b5Smrg# PS2PDF:	returns the path of the ps2pdf program found
23739aa2a2b5Smrg#		returns the path set by the user in the environment
23749aa2a2b5Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23759aa2a2b5Smrg#		 'no' user instructs the module not to use ps2pdf
23769aa2a2b5Smrg#
23779aa2a2b5Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23789aa2a2b5Smrg#
23799aa2a2b5SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23809aa2a2b5SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23819aa2a2b5Smrgm4_define([_defopt], m4_default([$1], [auto]))
23829aa2a2b5SmrgAC_ARG_WITH(ps2pdf,
23839aa2a2b5Smrg	AS_HELP_STRING([--with-ps2pdf],
23849aa2a2b5Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23859aa2a2b5Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23869aa2a2b5Smrgm4_undefine([_defopt])
23879aa2a2b5Smrg
23889aa2a2b5Smrgif test "x$use_ps2pdf" = x"auto"; then
23899aa2a2b5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23909aa2a2b5Smrg   if test "x$PS2PDF" = "x"; then
23919aa2a2b5Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23929aa2a2b5Smrg	have_ps2pdf=no
23939aa2a2b5Smrg   else
23949aa2a2b5Smrg        have_ps2pdf=yes
23959aa2a2b5Smrg   fi
23969aa2a2b5Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23979aa2a2b5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23989aa2a2b5Smrg   if test "x$PS2PDF" = "x"; then
23999aa2a2b5Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24009aa2a2b5Smrg   fi
24019aa2a2b5Smrg   have_ps2pdf=yes
24029aa2a2b5Smrgelif test "x$use_ps2pdf" = x"no" ; then
24039aa2a2b5Smrg   if test "x$PS2PDF" != "x"; then
24049aa2a2b5Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24059aa2a2b5Smrg   fi
24069aa2a2b5Smrg   have_ps2pdf=no
24079aa2a2b5Smrgelse
24089aa2a2b5Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24099aa2a2b5Smrgfi
24109aa2a2b5SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24119aa2a2b5Smrg]) # XORG_WITH_PS2PDF
24129aa2a2b5Smrg
24139aa2a2b5Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24149aa2a2b5Smrg# ----------------
24159aa2a2b5Smrg# Minimum version: 1.6.0
24169aa2a2b5Smrg#
24179aa2a2b5Smrg# Documentation tools are not always available on all platforms and sometimes
24189aa2a2b5Smrg# not at the appropriate level. This macro enables a builder to skip all
24199aa2a2b5Smrg# documentation targets except traditional man pages.
24209aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24219aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
24229aa2a2b5Smrg# Refer to:
24239aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
24249aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24259aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24269aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
24279aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
24289aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24299aa2a2b5Smrg#
24309aa2a2b5Smrg# Interface to module:
24319aa2a2b5Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24329aa2a2b5Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24339aa2a2b5Smrg#		 'no' user instructs the module not to generate docs
24349aa2a2b5Smrg# parm1:	specify the default value, yes or no.
24359aa2a2b5Smrg#
24369aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437a85aecdfSmrgm4_define([docs_default], m4_default([$1], [yes]))
24389aa2a2b5SmrgAC_ARG_ENABLE(docs,
24399aa2a2b5Smrg	AS_HELP_STRING([--enable-docs],
2440a85aecdfSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2441a85aecdfSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442a85aecdfSmrgm4_undefine([docs_default])
24439aa2a2b5SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24449aa2a2b5SmrgAC_MSG_CHECKING([whether to build documentation])
24459aa2a2b5SmrgAC_MSG_RESULT([$build_docs])
24469aa2a2b5Smrg]) # XORG_ENABLE_DOCS
24479aa2a2b5Smrg
24489aa2a2b5Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24499aa2a2b5Smrg# ----------------
24509aa2a2b5Smrg# Minimum version: 1.6.0
24519aa2a2b5Smrg#
24529aa2a2b5Smrg# This macro enables a builder to skip all developer documentation.
24539aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24549aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
24559aa2a2b5Smrg# Refer to:
24569aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
24579aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24589aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24599aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
24609aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
24619aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24629aa2a2b5Smrg#
24639aa2a2b5Smrg# Interface to module:
24649aa2a2b5Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24659aa2a2b5Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24669aa2a2b5Smrg#			'no' user instructs the module not to generate developer docs
24679aa2a2b5Smrg# parm1:		specify the default value, yes or no.
24689aa2a2b5Smrg#
24699aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24709aa2a2b5Smrgm4_define([devel_default], m4_default([$1], [yes]))
24719aa2a2b5SmrgAC_ARG_ENABLE(devel-docs,
24729aa2a2b5Smrg	AS_HELP_STRING([--enable-devel-docs],
24739aa2a2b5Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24749aa2a2b5Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24759aa2a2b5Smrgm4_undefine([devel_default])
24769aa2a2b5SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24779aa2a2b5SmrgAC_MSG_CHECKING([whether to build developer documentation])
24789aa2a2b5SmrgAC_MSG_RESULT([$build_devel_docs])
24799aa2a2b5Smrg]) # XORG_ENABLE_DEVEL_DOCS
24809aa2a2b5Smrg
24819aa2a2b5Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24829aa2a2b5Smrg# ----------------
24839aa2a2b5Smrg# Minimum version: 1.6.0
24849aa2a2b5Smrg#
24859aa2a2b5Smrg# This macro enables a builder to skip all functional specification targets.
24869aa2a2b5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24879aa2a2b5Smrg# maximum flexibilty in controlling documentation building.
24889aa2a2b5Smrg# Refer to:
24899aa2a2b5Smrg# XORG_WITH_XMLTO         --with-xmlto
24909aa2a2b5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24919aa2a2b5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24929aa2a2b5Smrg# XORG_WITH_FOP           --with-fop
24939aa2a2b5Smrg# XORG_WITH_GROFF         --with-groff
24949aa2a2b5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24959aa2a2b5Smrg#
24969aa2a2b5Smrg# Interface to module:
24979aa2a2b5Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24989aa2a2b5Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24999aa2a2b5Smrg#			'no' user instructs the module not to generate specs
25009aa2a2b5Smrg# parm1:		specify the default value, yes or no.
25019aa2a2b5Smrg#
25029aa2a2b5SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25039aa2a2b5Smrgm4_define([spec_default], m4_default([$1], [yes]))
25049aa2a2b5SmrgAC_ARG_ENABLE(specs,
25059aa2a2b5Smrg	AS_HELP_STRING([--enable-specs],
25069aa2a2b5Smrg	   [Enable building the specs (default: ]spec_default[)]),
25079aa2a2b5Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25089aa2a2b5Smrgm4_undefine([spec_default])
25099aa2a2b5SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25109aa2a2b5SmrgAC_MSG_CHECKING([whether to build functional specifications])
25119aa2a2b5SmrgAC_MSG_RESULT([$build_specs])
25129aa2a2b5Smrg]) # XORG_ENABLE_SPECS
25139aa2a2b5Smrg
2514a85aecdfSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515a85aecdfSmrg# ----------------------------------------------
2516a85aecdfSmrg# Minimum version: 1.13.0
2517a85aecdfSmrg#
2518a85aecdfSmrg# This macro enables a builder to enable/disable unit testing
2519a85aecdfSmrg# It makes no assumption about the test cases implementation
2520a85aecdfSmrg# Test cases may or may not use Automake "Support for test suites"
2521a85aecdfSmrg# They may or may not use the software utility library GLib
2522a85aecdfSmrg#
2523a85aecdfSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524a85aecdfSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525a85aecdfSmrg# The variable enable_unit_tests is used by other macros in this file.
2526a85aecdfSmrg#
2527a85aecdfSmrg# Interface to module:
2528a85aecdfSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529a85aecdfSmrg# enable_unit_tests:    used in configure.ac for additional configuration
2530a85aecdfSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531a85aecdfSmrg#			'no' user instructs the module not to build tests
2532a85aecdfSmrg# parm1:		specify the default value, yes or no.
2533a85aecdfSmrg#
2534a85aecdfSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535a85aecdfSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536a85aecdfSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537a85aecdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538a85aecdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2539a85aecdfSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540a85aecdfSmrg	[Enable building unit test cases (default: ]_defopt[)]),
2541a85aecdfSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542a85aecdfSmrgm4_undefine([_defopt])
2543a85aecdfSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544a85aecdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2545a85aecdfSmrgAC_MSG_RESULT([$enable_unit_tests])
2546a85aecdfSmrg]) # XORG_ENABLE_UNIT_TESTS
2547a85aecdfSmrg
2548a85aecdfSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549a85aecdfSmrg# ------------------------------------------------------
2550a85aecdfSmrg# Minimum version: 1.17.0
2551a85aecdfSmrg#
2552a85aecdfSmrg# This macro enables a builder to enable/disable integration testing
2553a85aecdfSmrg# It makes no assumption about the test cases' implementation
2554a85aecdfSmrg# Test cases may or may not use Automake "Support for test suites"
2555a85aecdfSmrg#
2556a85aecdfSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557a85aecdfSmrg# usually requires less dependencies and may be built and run under less
2558a85aecdfSmrg# stringent environments than integration tests.
2559a85aecdfSmrg#
2560a85aecdfSmrg# Interface to module:
2561a85aecdfSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562a85aecdfSmrg# enable_integration_tests:   used in configure.ac for additional configuration
2563a85aecdfSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564a85aecdfSmrg#                             'no' user instructs the module not to build tests
2565a85aecdfSmrg# parm1:                      specify the default value, yes or no.
2566a85aecdfSmrg#
2567a85aecdfSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568a85aecdfSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569a85aecdfSmrgm4_define([_defopt], m4_default([$1], [auto]))
2570a85aecdfSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571a85aecdfSmrg	[Enable building integration test cases (default: ]_defopt[)]),
2572a85aecdfSmrg	[enable_integration_tests=$enableval],
2573a85aecdfSmrg	[enable_integration_tests=]_defopt)
2574a85aecdfSmrgm4_undefine([_defopt])
2575a85aecdfSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576a85aecdfSmrg	[test "x$enable_integration_tests" != xno])
2577a85aecdfSmrgAC_MSG_CHECKING([whether to build unit test cases])
2578a85aecdfSmrgAC_MSG_RESULT([$enable_integration_tests])
2579a85aecdfSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580a85aecdfSmrg
2581a85aecdfSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582a85aecdfSmrg# ----------------------------------------
2583a85aecdfSmrg# Minimum version: 1.13.0
2584a85aecdfSmrg#
2585a85aecdfSmrg# GLib is a library which provides advanced data structures and functions.
2586a85aecdfSmrg# This macro enables a module to test for the presence of Glib.
2587a85aecdfSmrg#
2588a85aecdfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589a85aecdfSmrg# Otherwise the value of $enable_unit_tests is blank.
2590a85aecdfSmrg#
2591a85aecdfSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592a85aecdfSmrg# test support usually requires less dependencies and may be built and run under
2593a85aecdfSmrg# less stringent environments than integration tests.
2594a85aecdfSmrg#
2595a85aecdfSmrg# Interface to module:
2596a85aecdfSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597a85aecdfSmrg# with_glib: used in configure.ac to know if GLib has been found
2598a85aecdfSmrg# --with-glib:	'yes' user instructs the module to use glib
2599a85aecdfSmrg#		'no' user instructs the module not to use glib
2600a85aecdfSmrg#
2601a85aecdfSmrgAC_DEFUN([XORG_WITH_GLIB],[
2602a85aecdfSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603a85aecdfSmrgm4_define([_defopt], m4_default([$2], [auto]))
2604a85aecdfSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605a85aecdfSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606a85aecdfSmrg	[with_glib=$withval], [with_glib=]_defopt)
2607a85aecdfSmrgm4_undefine([_defopt])
2608a85aecdfSmrg
2609a85aecdfSmrghave_glib=no
2610a85aecdfSmrg# Do not probe GLib if user explicitly disabled unit testing
2611a85aecdfSmrgif test "x$enable_unit_tests" != x"no"; then
2612a85aecdfSmrg  # Do not probe GLib if user explicitly disabled it
2613a85aecdfSmrg  if test "x$with_glib" != x"no"; then
2614a85aecdfSmrg    m4_ifval(
2615a85aecdfSmrg      [$1],
2616a85aecdfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617a85aecdfSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618a85aecdfSmrg    )
2619a85aecdfSmrg  fi
2620a85aecdfSmrgfi
2621a85aecdfSmrg
2622a85aecdfSmrg# Not having GLib when unit testing has been explicitly requested is an error
2623a85aecdfSmrgif test "x$enable_unit_tests" = x"yes"; then
2624a85aecdfSmrg  if test "x$have_glib" = x"no"; then
2625a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626a85aecdfSmrg  fi
2627a85aecdfSmrgfi
2628a85aecdfSmrg
2629a85aecdfSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630a85aecdfSmrgif test "x$enable_unit_tests" = x"no"; then
2631a85aecdfSmrg  if test "x$with_glib" = x"yes"; then
2632a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633a85aecdfSmrg  fi
2634a85aecdfSmrgfi
2635a85aecdfSmrg
2636a85aecdfSmrg# Not having GLib when it has been explicitly requested is an error
2637a85aecdfSmrgif test "x$with_glib" = x"yes"; then
2638a85aecdfSmrg  if test "x$have_glib" = x"no"; then
2639a85aecdfSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640a85aecdfSmrg  fi
2641a85aecdfSmrgfi
2642a85aecdfSmrg
2643a85aecdfSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644a85aecdfSmrg]) # XORG_WITH_GLIB
2645a85aecdfSmrg
2646a85aecdfSmrg# XORG_LD_WRAP([required|optional])
2647a85aecdfSmrg# ---------------------------------
2648a85aecdfSmrg# Minimum version: 1.13.0
2649a85aecdfSmrg#
2650a85aecdfSmrg# Check if linker supports -wrap, passed via compiler flags
2651a85aecdfSmrg#
2652a85aecdfSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653a85aecdfSmrg# Otherwise the value of $enable_unit_tests is blank.
2654a85aecdfSmrg#
2655a85aecdfSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656a85aecdfSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657a85aecdfSmrg# available, an argument of "optional" allows use when some unit tests require
2658a85aecdfSmrg# ld -wrap and others do not.
2659a85aecdfSmrg#
2660a85aecdfSmrgAC_DEFUN([XORG_LD_WRAP],[
2661a85aecdfSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662a85aecdfSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663a85aecdfSmrg                      void __wrap_exit(int status) { return; }],
2664a85aecdfSmrg                     [exit(0);])])
2665a85aecdfSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666a85aecdfSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667a85aecdfSmrg  if test "x$have_ld_wrap" = x"no"; then
2668a85aecdfSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669a85aecdfSmrg  fi
2670a85aecdfSmrgfi
2671a85aecdfSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672a85aecdfSmrg#
2673a85aecdfSmrg]) # XORG_LD_WRAP
2674a85aecdfSmrg
2675a85aecdfSmrg# XORG_CHECK_LINKER_FLAGS
2676a85aecdfSmrg# -----------------------
2677a85aecdfSmrg# SYNOPSIS
2678a85aecdfSmrg#
2679a85aecdfSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680a85aecdfSmrg#
2681a85aecdfSmrg# DESCRIPTION
2682a85aecdfSmrg#
2683a85aecdfSmrg#   Check whether the given linker FLAGS work with the current language's
2684a85aecdfSmrg#   linker, or whether they give an error.
2685a85aecdfSmrg#
2686a85aecdfSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687a85aecdfSmrg#   success/failure.
2688a85aecdfSmrg#
2689a85aecdfSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690a85aecdfSmrg#
2691a85aecdfSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692a85aecdfSmrg#
2693a85aecdfSmrg# LICENSE
2694a85aecdfSmrg#
2695a85aecdfSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696a85aecdfSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697a85aecdfSmrg#   Copyright (c) 2009 Matteo Frigo
2698a85aecdfSmrg#
2699a85aecdfSmrg#   This program is free software: you can redistribute it and/or modify it
2700a85aecdfSmrg#   under the terms of the GNU General Public License as published by the
2701a85aecdfSmrg#   Free Software Foundation, either version 3 of the License, or (at your
2702a85aecdfSmrg#   option) any later version.
2703a85aecdfSmrg#
2704a85aecdfSmrg#   This program is distributed in the hope that it will be useful, but
2705a85aecdfSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706a85aecdfSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707a85aecdfSmrg#   Public License for more details.
2708a85aecdfSmrg#
2709a85aecdfSmrg#   You should have received a copy of the GNU General Public License along
2710a85aecdfSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711a85aecdfSmrg#
2712a85aecdfSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713a85aecdfSmrg#   gives unlimited permission to copy, distribute and modify the configure
2714a85aecdfSmrg#   scripts that are the output of Autoconf when processing the Macro. You
2715a85aecdfSmrg#   need not follow the terms of the GNU General Public License when using
2716a85aecdfSmrg#   or distributing such scripts, even though portions of the text of the
2717a85aecdfSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718a85aecdfSmrg#   all other use of the material that constitutes the Autoconf Macro.
2719a85aecdfSmrg#
2720a85aecdfSmrg#   This special exception to the GPL applies to versions of the Autoconf
2721a85aecdfSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722a85aecdfSmrg#   modified version of the Autoconf Macro, you may extend this special
2723a85aecdfSmrg#   exception to the GPL to apply to your modified version as well.#
2724a85aecdfSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725a85aecdfSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726a85aecdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727a85aecdfSmrgAS_LITERAL_IF([$1],
2728a85aecdfSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729a85aecdfSmrg      ax_save_FLAGS=$LDFLAGS
2730a85aecdfSmrg      LDFLAGS="$1"
2731a85aecdfSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732a85aecdfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733a85aecdfSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734a85aecdfSmrg      LDFLAGS=$ax_save_FLAGS])],
2735a85aecdfSmrg  [ax_save_FLAGS=$LDFLAGS
2736a85aecdfSmrg   LDFLAGS="$1"
2737a85aecdfSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738a85aecdfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739a85aecdfSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740a85aecdfSmrg   LDFLAGS=$ax_save_FLAGS])
2741a85aecdfSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742a85aecdfSmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743a85aecdfSmrgif test "x$xorg_check_linker_flags" = xyes; then
2744a85aecdfSmrg	m4_default([$2], :)
2745a85aecdfSmrgelse
2746a85aecdfSmrg	m4_default([$3], :)
2747a85aecdfSmrgfi
2748a85aecdfSmrg]) # XORG_CHECK_LINKER_FLAGS
2749a85aecdfSmrg
2750a85aecdfSmrg# XORG_MEMORY_CHECK_FLAGS
2751a85aecdfSmrg# -----------------------
2752a85aecdfSmrg# Minimum version: 1.16.0
2753a85aecdfSmrg#
2754a85aecdfSmrg# This macro attempts to find appropriate memory checking functionality
2755a85aecdfSmrg# for various platforms which unit testing code may use to catch various
2756a85aecdfSmrg# forms of memory allocation and access errors in testing.
2757a85aecdfSmrg#
2758a85aecdfSmrg# Interface to module:
2759a85aecdfSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760a85aecdfSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761a85aecdfSmrg#
2762a85aecdfSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763a85aecdfSmrg#
2764a85aecdfSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765a85aecdfSmrg
2766a85aecdfSmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767a85aecdfSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768a85aecdfSmrg           [Environment variables to enable memory checking in tests])
2769a85aecdfSmrg
2770a85aecdfSmrg# Check for different types of support on different platforms
2771a85aecdfSmrgcase $host_os in
2772a85aecdfSmrg    solaris*)
2773a85aecdfSmrg        AC_CHECK_LIB([umem], [umem_alloc],
2774a85aecdfSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775a85aecdfSmrg        ;;
2776a85aecdfSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777a85aecdfSmrg        # both directly and inverted, so should not be 0 or 255.
2778a85aecdfSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779a85aecdfSmrg        ;;
2780a85aecdfSmrg    darwin*)
2781a85aecdfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782a85aecdfSmrg        ;;
2783a85aecdfSmrg    *bsd*)
2784a85aecdfSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785a85aecdfSmrg        ;;
2786a85aecdfSmrgesac
2787a85aecdfSmrg
2788a85aecdfSmrg# User supplied flags override default flags
2789a85aecdfSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790a85aecdfSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791a85aecdfSmrgfi
2792a85aecdfSmrg
2793a85aecdfSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794a85aecdfSmrg]) # XORG_WITH_LINT
2795a85aecdfSmrg
2796fd7d9bd3Smrg# XORG_CHECK_MALLOC_ZERO
2797fd7d9bd3Smrg# ----------------------
2798350952b9Smrg# Minimum version: 1.0.0
2799350952b9Smrg#
2800fd7d9bd3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801fd7d9bd3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802fd7d9bd3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803fd7d9bd3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804fd7d9bd3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805350952b9Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806fd7d9bd3Smrg		       [malloc(0) returns NULL (default: auto)]),
2807fd7d9bd3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808fd7d9bd3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809fd7d9bd3Smrg
2810fd7d9bd3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811fd7d9bd3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812a9ba4257SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813a9ba4257Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814a85aecdfSmrg#include <stdlib.h>
2815a85aecdfSmrg],[
2816fd7d9bd3Smrg    char *m0, *r0, *c0, *p;
2817fd7d9bd3Smrg    m0 = malloc(0);
2818fd7d9bd3Smrg    p = malloc(10);
2819fd7d9bd3Smrg    r0 = realloc(p,0);
2820a85aecdfSmrg    c0 = calloc(0,10);
2821a85aecdfSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822a85aecdfSmrg])],
2823a9ba4257Smrg		[xorg_cv_malloc0_returns_null=yes],
2824a9ba4257Smrg		[xorg_cv_malloc0_returns_null=no])])
2825a9ba4257SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826fd7d9bd3Smrgfi
2827fd7d9bd3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828fd7d9bd3Smrg
2829fd7d9bd3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830fd7d9bd3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831fd7d9bd3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832fd7d9bd3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833fd7d9bd3Smrgelse
2834fd7d9bd3Smrg	MALLOC_ZERO_CFLAGS=""
2835fd7d9bd3Smrg	XMALLOC_ZERO_CFLAGS=""
2836fd7d9bd3Smrg	XTMALLOC_ZERO_CFLAGS=""
2837fd7d9bd3Smrgfi
2838fd7d9bd3Smrg
2839fd7d9bd3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840fd7d9bd3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841fd7d9bd3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842fd7d9bd3Smrg]) # XORG_CHECK_MALLOC_ZERO
2843fd7d9bd3Smrg
2844350952b9Smrg# XORG_WITH_LINT()
2845350952b9Smrg# ----------------
2846350952b9Smrg# Minimum version: 1.1.0
2847350952b9Smrg#
28489aa2a2b5Smrg# This macro enables the use of a tool that flags some suspicious and
28499aa2a2b5Smrg# non-portable constructs (likely to be bugs) in C language source code.
28509aa2a2b5Smrg# It will attempt to locate the tool and use appropriate options.
28519aa2a2b5Smrg# There are various lint type tools on different platforms.
28529aa2a2b5Smrg#
28539aa2a2b5Smrg# Interface to module:
28549aa2a2b5Smrg# LINT:		returns the path to the tool found on the platform
28559aa2a2b5Smrg#		or the value set to LINT on the configure cmd line
28569aa2a2b5Smrg#		also an Automake conditional
28579aa2a2b5Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28589aa2a2b5Smrg#
28599aa2a2b5Smrg# --with-lint:	'yes' user instructs the module to use lint
28609aa2a2b5Smrg#		'no' user instructs the module not to use lint (default)
28619aa2a2b5Smrg#
28629aa2a2b5Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28639aa2a2b5Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864350952b9Smrg#
2865350952b9SmrgAC_DEFUN([XORG_WITH_LINT],[
2866350952b9Smrg
28679aa2a2b5SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28689aa2a2b5SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869350952b9SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870350952b9Smrg		[Use a lint-style source code checker (default: disabled)])],
2871350952b9Smrg		[use_lint=$withval], [use_lint=no])
28729aa2a2b5Smrg
28739aa2a2b5Smrg# Obtain platform specific info like program name and options
28749aa2a2b5Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28759aa2a2b5Smrgcase $host_os in
28769aa2a2b5Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28779aa2a2b5Smrg	lint_name=splint
28789aa2a2b5Smrg	lint_options="-badflag"
28799aa2a2b5Smrg	;;
28809aa2a2b5Smrg  *freebsd* | *netbsd*)
28819aa2a2b5Smrg	lint_name=lint
28829aa2a2b5Smrg	lint_options="-u -b"
28839aa2a2b5Smrg	;;
28849aa2a2b5Smrg  *solaris*)
28859aa2a2b5Smrg	lint_name=lint
28869aa2a2b5Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28879aa2a2b5Smrg	;;
28889aa2a2b5Smrgesac
28899aa2a2b5Smrg
28909aa2a2b5Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28919aa2a2b5Smrgif test "x$use_lint" = x"yes" ; then
28929aa2a2b5Smrg   AC_PATH_PROG([LINT], [$lint_name])
28939aa2a2b5Smrg   if test "x$LINT" = "x"; then
28949aa2a2b5Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28959aa2a2b5Smrg   fi
28969aa2a2b5Smrgelif test "x$use_lint" = x"no" ; then
28979aa2a2b5Smrg   if test "x$LINT" != "x"; then
28989aa2a2b5Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28999aa2a2b5Smrg   fi
2900350952b9Smrgelse
29019aa2a2b5Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902350952b9Smrgfi
29039aa2a2b5Smrg
29049aa2a2b5Smrg# User supplied flags override default flags
29059aa2a2b5Smrgif test "x$LINT_FLAGS" != "x"; then
29069aa2a2b5Smrg   lint_options=$LINT_FLAGS
2907350952b9Smrgfi
2908350952b9Smrg
29099aa2a2b5SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29109aa2a2b5SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911350952b9Smrg
2912350952b9Smrg]) # XORG_WITH_LINT
2913350952b9Smrg
2914350952b9Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915350952b9Smrg# --------------------------
2916350952b9Smrg# Minimum version: 1.1.0
2917350952b9Smrg#
2918350952b9Smrg# Sets up flags for building lint libraries for checking programs that call
2919350952b9Smrg# functions in the library.
2920350952b9Smrg#
29219aa2a2b5Smrg# Interface to module:
29229aa2a2b5Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29239aa2a2b5Smrg# MAKE_LINT_LIB		- Automake conditional
29249aa2a2b5Smrg#
29259aa2a2b5Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29269aa2a2b5Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927350952b9Smrg
2928350952b9SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929350952b9SmrgAC_REQUIRE([XORG_WITH_LINT])
2930350952b9SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931350952b9Smrg	[Create lint library (default: disabled)])],
2932350952b9Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29339aa2a2b5Smrg
29349aa2a2b5Smrgif test "x$make_lint_lib" = x"yes" ; then
29359aa2a2b5Smrg   LINTLIB=llib-l$1.ln
29369aa2a2b5Smrg   if test "x$LINT" = "x"; then
29379aa2a2b5Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29389aa2a2b5Smrg   fi
29399aa2a2b5Smrgelif test "x$make_lint_lib" != x"no" ; then
29409aa2a2b5Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941350952b9Smrgfi
29429aa2a2b5Smrg
2943350952b9SmrgAC_SUBST(LINTLIB)
2944350952b9SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945350952b9Smrg
2946350952b9Smrg]) # XORG_LINT_LIBRARY
2947350952b9Smrg
2948a85aecdfSmrg# XORG_COMPILER_BRAND
2949a85aecdfSmrg# -------------------
2950a85aecdfSmrg# Minimum version: 1.14.0
2951a85aecdfSmrg#
2952a85aecdfSmrg# Checks for various brands of compilers and sets flags as appropriate:
2953a85aecdfSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954a85aecdfSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955a85aecdfSmrg#   clang compiler - sets CLANGCC to "yes"
2956a85aecdfSmrg#   Intel compiler - sets INTELCC to "yes"
2957a85aecdfSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958a85aecdfSmrg#
2959a85aecdfSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960a85aecdfSmrgAC_LANG_CASE(
2961a85aecdfSmrg	[C], [
2962a85aecdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2963a85aecdfSmrg	],
2964a85aecdfSmrg	[C++], [
2965a85aecdfSmrg		AC_REQUIRE([AC_PROG_CXX])
2966a85aecdfSmrg	]
2967a85aecdfSmrg)
2968a85aecdfSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2969a85aecdfSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2970a85aecdfSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2971a85aecdfSmrg]) # XORG_COMPILER_BRAND
2972a85aecdfSmrg
2973a85aecdfSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974a85aecdfSmrg# ---------------
2975a85aecdfSmrg# Minimum version: 1.16.0
2976a85aecdfSmrg#
2977a85aecdfSmrg# Test if the compiler works when passed the given flag as a command line argument.
2978a85aecdfSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2979a85aecdfSmrg# next flag in the list until there are no more options.
2980a85aecdfSmrg#
2981a85aecdfSmrg# Note that this does not guarantee that the compiler supports the flag as some
2982a85aecdfSmrg# compilers will simply ignore arguments that they do not understand, but we do
2983a85aecdfSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2984a85aecdfSmrg# -Werror=unused-command-line-argument
2985a85aecdfSmrg#
2986a85aecdfSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2987a85aecdfSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2988a85aecdfSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989a85aecdfSmrg
2990a85aecdfSmrgAC_LANG_COMPILER_REQUIRE
2991a85aecdfSmrg
2992a85aecdfSmrgAC_LANG_CASE(
2993a85aecdfSmrg	[C], [
2994a85aecdfSmrg		AC_REQUIRE([AC_PROG_CC_C99])
2995a85aecdfSmrg		define([PREFIX], [C])
2996a85aecdfSmrg		define([CACHE_PREFIX], [cc])
2997a85aecdfSmrg		define([COMPILER], [$CC])
2998a85aecdfSmrg	],
2999a85aecdfSmrg	[C++], [
3000a85aecdfSmrg		define([PREFIX], [CXX])
3001a85aecdfSmrg		define([CACHE_PREFIX], [cxx])
3002a85aecdfSmrg		define([COMPILER], [$CXX])
3003a85aecdfSmrg	]
3004a85aecdfSmrg)
3005a85aecdfSmrg
3006a85aecdfSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3007a85aecdfSmrg
3008a85aecdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3009a85aecdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3010a85aecdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3011a85aecdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3012a85aecdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3013a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3014a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3015a85aecdfSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3016a85aecdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017a85aecdfSmrgfi
3018a85aecdfSmrg
3019a85aecdfSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3020a85aecdfSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3021a85aecdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3022a85aecdfSmrg	fi
3023a85aecdfSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3024a85aecdfSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3025a85aecdfSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3026a85aecdfSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3027a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3028a85aecdfSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3029a85aecdfSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3030a85aecdfSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3031a85aecdfSmrgfi
3032a85aecdfSmrg
3033a85aecdfSmrgfound="no"
3034a85aecdfSmrgm4_foreach([flag], m4_cdr($@), [
3035a85aecdfSmrg	if test $found = "no" ; then
3036a9ba4257Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3037a85aecdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3038a85aecdfSmrg		fi
3039a85aecdfSmrg
3040a9ba4257Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3041a85aecdfSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3042a85aecdfSmrg		fi
3043a85aecdfSmrg
3044a85aecdfSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3045a85aecdfSmrg
3046a85aecdfSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3047a85aecdfSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3048a85aecdfSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3049a85aecdfSmrg		AC_CACHE_VAL($cacheid,
3050a85aecdfSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3051a85aecdfSmrg					     [eval $cacheid=yes],
3052a85aecdfSmrg					     [eval $cacheid=no])])
3053a85aecdfSmrg
3054a85aecdfSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3055a85aecdfSmrg
3056a85aecdfSmrg		eval supported=\$$cacheid
3057a85aecdfSmrg		AC_MSG_RESULT([$supported])
3058a85aecdfSmrg		if test "$supported" = "yes" ; then
3059a85aecdfSmrg			$1="$$1 ]flag["
3060a85aecdfSmrg			found="yes"
3061a85aecdfSmrg		fi
3062a85aecdfSmrg	fi
3063a85aecdfSmrg])
3064a85aecdfSmrg]) # XORG_TESTSET_CFLAG
3065a85aecdfSmrg
3066a85aecdfSmrg# XORG_COMPILER_FLAGS
3067a85aecdfSmrg# ---------------
3068a85aecdfSmrg# Minimum version: 1.16.0
3069a85aecdfSmrg#
3070a85aecdfSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3071a85aecdfSmrg# arguments supported by the selected compiler which do NOT alter the generated
3072a85aecdfSmrg# code.  These arguments will cause the compiler to print various warnings
3073a85aecdfSmrg# during compilation AND turn a conservative set of warnings into errors.
3074a85aecdfSmrg#
3075a85aecdfSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3076a85aecdfSmrg# future versions of util-macros as options are added to new compilers.
3077a85aecdfSmrg#
3078a85aecdfSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3079a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080a85aecdfSmrg
3081a85aecdfSmrgAC_ARG_ENABLE(selective-werror,
3082a85aecdfSmrg              AS_HELP_STRING([--disable-selective-werror],
3083a85aecdfSmrg                             [Turn off selective compiler errors. (default: enabled)]),
3084a85aecdfSmrg              [SELECTIVE_WERROR=$enableval],
3085a85aecdfSmrg              [SELECTIVE_WERROR=yes])
3086a85aecdfSmrg
3087a85aecdfSmrgAC_LANG_CASE(
3088a85aecdfSmrg        [C], [
3089a85aecdfSmrg                define([PREFIX], [C])
3090a85aecdfSmrg        ],
3091a85aecdfSmrg        [C++], [
3092a85aecdfSmrg                define([PREFIX], [CXX])
3093a85aecdfSmrg        ]
3094a85aecdfSmrg)
3095a85aecdfSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3096a85aecdfSmrgif test "x$SUNCC" = "xyes"; then
3097a85aecdfSmrg    [BASE_]PREFIX[FLAGS]="-v"
3098a85aecdfSmrgelse
3099a85aecdfSmrg    [BASE_]PREFIX[FLAGS]=""
3100a85aecdfSmrgfi
3101a85aecdfSmrg
3102a85aecdfSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3103a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3104a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3105a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3106a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107a85aecdfSmrg
3108a85aecdfSmrgAC_LANG_CASE(
3109a85aecdfSmrg	[C], [
3110a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3111a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3112a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3113a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3114a9ba4257Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3115a85aecdfSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3116a85aecdfSmrg	]
3117a85aecdfSmrg)
3118a85aecdfSmrg
3119a85aecdfSmrg# This chunk adds additional warnings that could catch undesired effects.
3120a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3121a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3122a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3123a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3124a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3125a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3126a9ba4257SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127a85aecdfSmrg
3128a85aecdfSmrg# These are currently disabled because they are noisy.  They will be enabled
3129a85aecdfSmrg# in the future once the codebase is sufficiently modernized to silence
3130a85aecdfSmrg# them.  For now, I don't want them to drown out the other warnings.
3131a85aecdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3132a85aecdfSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3133a9ba4257Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134a85aecdfSmrg
3135a85aecdfSmrg# Turn some warnings into errors, so we don't accidently get successful builds
3136a85aecdfSmrg# when there are problems that should be fixed.
3137a85aecdfSmrg
3138a85aecdfSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3139a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3140a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3141a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3142a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3143a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3144a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3145a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3146a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3147a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3148a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3149a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3150a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3151a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3152a85aecdfSmrgelse
3153a85aecdfSmrgAC_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])
3154a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3155a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3156a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3157a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3158a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3159a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3160a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3161a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3162a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3163a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3164a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3165a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3166a85aecdfSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3167a85aecdfSmrgfi
3168a85aecdfSmrg
3169a85aecdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3170a85aecdfSmrg]) # XORG_COMPILER_FLAGS
3171a85aecdfSmrg
3172350952b9Smrg# XORG_CWARNFLAGS
3173350952b9Smrg# ---------------
3174350952b9Smrg# Minimum version: 1.2.0
3175a85aecdfSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176350952b9Smrg#
3177350952b9Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3178350952b9Smrg#
3179a85aecdfSmrg# This function is deprecated because it defines -fno-strict-aliasing
3180a85aecdfSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3181a85aecdfSmrg# is needed, then it should be added explicitly in the module when
3182a85aecdfSmrg# it is updated to use BASE_CFLAGS.
3183a85aecdfSmrg#
3184350952b9SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3185a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3186a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3187a85aecdfSmrgAC_LANG_CASE(
3188a85aecdfSmrg	[C], [
3189a85aecdfSmrg		CWARNFLAGS="$BASE_CFLAGS"
3190a85aecdfSmrg		if  test "x$GCC" = xyes ; then
3191a85aecdfSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3192a85aecdfSmrg		fi
3193a85aecdfSmrg		AC_SUBST(CWARNFLAGS)
3194a85aecdfSmrg	]
3195a85aecdfSmrg)
3196350952b9Smrg]) # XORG_CWARNFLAGS
3197350952b9Smrg
3198350952b9Smrg# XORG_STRICT_OPTION
3199350952b9Smrg# -----------------------
3200350952b9Smrg# Minimum version: 1.3.0
3201350952b9Smrg#
3202a85aecdfSmrg# Add configure option to enable strict compilation flags, such as treating
3203a85aecdfSmrg# warnings as fatal errors.
3204a85aecdfSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3205a85aecdfSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3206a85aecdfSmrg#
3207a85aecdfSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3208a85aecdfSmrg# when strict compilation is unconditionally desired.
3209350952b9SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3210350952b9SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3211a85aecdfSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212350952b9Smrg
3213350952b9SmrgAC_ARG_ENABLE(strict-compilation,
3214350952b9Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3215350952b9Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3216350952b9Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217a85aecdfSmrg
3218a85aecdfSmrgAC_LANG_CASE(
3219a85aecdfSmrg        [C], [
3220a85aecdfSmrg                define([PREFIX], [C])
3221a85aecdfSmrg        ],
3222a85aecdfSmrg        [C++], [
3223a85aecdfSmrg                define([PREFIX], [CXX])
3224a85aecdfSmrg        ]
3225a85aecdfSmrg)
3226a85aecdfSmrg
3227a85aecdfSmrg[STRICT_]PREFIX[FLAGS]=""
3228a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3229a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230a85aecdfSmrg
3231a85aecdfSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3232a85aecdfSmrg# activate it with -Werror, so we add it here explicitly.
3233a85aecdfSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234a85aecdfSmrg
3235350952b9Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3236a85aecdfSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3237a85aecdfSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3238350952b9Smrgfi
3239a85aecdfSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3240a85aecdfSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3241a85aecdfSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3242350952b9Smrg]) # XORG_STRICT_OPTION
3243350952b9Smrg
3244350952b9Smrg# XORG_DEFAULT_OPTIONS
3245350952b9Smrg# --------------------
3246350952b9Smrg# Minimum version: 1.3.0
3247350952b9Smrg#
3248350952b9Smrg# Defines default options for X.Org modules.
3249350952b9Smrg#
3250350952b9SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32519aa2a2b5SmrgAC_REQUIRE([AC_PROG_INSTALL])
3252a85aecdfSmrgXORG_COMPILER_FLAGS
3253350952b9SmrgXORG_CWARNFLAGS
3254350952b9SmrgXORG_STRICT_OPTION
3255350952b9SmrgXORG_RELEASE_VERSION
3256350952b9SmrgXORG_CHANGELOG
32579aa2a2b5SmrgXORG_INSTALL
3258350952b9SmrgXORG_MANPAGE_SECTIONS
32599aa2a2b5Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32609aa2a2b5Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3261350952b9Smrg]) # XORG_DEFAULT_OPTIONS
32629aa2a2b5Smrg
32639aa2a2b5Smrg# XORG_INSTALL()
32649aa2a2b5Smrg# ----------------
32659aa2a2b5Smrg# Minimum version: 1.4.0
32669aa2a2b5Smrg#
32679aa2a2b5Smrg# Defines the variable INSTALL_CMD as the command to copy
32689aa2a2b5Smrg# INSTALL from $prefix/share/util-macros.
32699aa2a2b5Smrg#
32709aa2a2b5SmrgAC_DEFUN([XORG_INSTALL], [
32719aa2a2b5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32729aa2a2b5Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32739aa2a2b5SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32749aa2a2b5Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3275e53c48bfSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3276e53c48bfSmrgtouch \$(top_srcdir)/INSTALL; \
3277e53c48bfSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32789aa2a2b5SmrgAC_SUBST([INSTALL_CMD])
32799aa2a2b5Smrg]) # XORG_INSTALL
3280fd7d9bd3Smrgdnl Copyright 2005 Red Hat, Inc
3281fd7d9bd3Smrgdnl
3282fd7d9bd3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3283fd7d9bd3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3284fd7d9bd3Smrgdnl the above copyright notice appear in all copies and that both that
3285fd7d9bd3Smrgdnl copyright notice and this permission notice appear in supporting
3286fd7d9bd3Smrgdnl documentation.
3287fd7d9bd3Smrgdnl
3288fd7d9bd3Smrgdnl The above copyright notice and this permission notice shall be included
3289fd7d9bd3Smrgdnl in all copies or substantial portions of the Software.
3290fd7d9bd3Smrgdnl
3291fd7d9bd3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3292fd7d9bd3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3293fd7d9bd3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3294fd7d9bd3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3295fd7d9bd3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3296fd7d9bd3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3297fd7d9bd3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3298fd7d9bd3Smrgdnl
3299fd7d9bd3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3300fd7d9bd3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3301fd7d9bd3Smrgdnl other dealings in this Software without prior written authorization
3302fd7d9bd3Smrgdnl from the copyright holders.
3303fd7d9bd3Smrgdnl
3304fd7d9bd3Smrg
3305fd7d9bd3Smrg# XORG_RELEASE_VERSION
3306fd7d9bd3Smrg# --------------------
33079aa2a2b5Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308a9ba4257Smrg
3309fd7d9bd3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3310350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3311350952b9Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3312350952b9Smrg		[Major version of this package])
3313350952b9Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3314350952b9Smrg	if test "x$PVM" = "x"; then
3315350952b9Smrg		PVM="0"
3316350952b9Smrg	fi
3317350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3318350952b9Smrg		[$PVM],
3319350952b9Smrg		[Minor version of this package])
3320350952b9Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3321350952b9Smrg	if test "x$PVP" = "x"; then
3322350952b9Smrg		PVP="0"
3323350952b9Smrg	fi
3324350952b9Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3325350952b9Smrg		[$PVP],
3326350952b9Smrg		[Patch version of this package])
3327fd7d9bd3Smrg])
3328fd7d9bd3Smrg
3329350952b9Smrg# XORG_CHANGELOG()
3330350952b9Smrg# ----------------
3331350952b9Smrg# Minimum version: 1.2.0
3332350952b9Smrg#
3333350952b9Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3334350952b9Smrg# ChangeLog from git.
3335350952b9Smrg#
3336350952b9Smrg#
3337350952b9SmrgAC_DEFUN([XORG_CHANGELOG], [
3338e53c48bfSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33399aa2a2b5Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3340e53c48bfSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3341e53c48bfSmrgtouch \$(top_srcdir)/ChangeLog; \
3342e53c48bfSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3343350952b9SmrgAC_SUBST([CHANGELOG_CMD])
3344350952b9Smrg]) # XORG_CHANGELOG
3345350952b9Smrg
3346