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