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