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