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