aclocal.m4 revision 273c00b8
1765b7306Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
28abc0ccfSmrg
3765b7306Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
47a0395d0Smrg
57a0395d0Smrg# This file is free software; the Free Software Foundation
67a0395d0Smrg# gives unlimited permission to copy and/or distribute it,
77a0395d0Smrg# with or without modifications, as long as this notice is preserved.
87a0395d0Smrg
97a0395d0Smrg# This program is distributed in the hope that it will be useful,
107a0395d0Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117a0395d0Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127a0395d0Smrg# PARTICULAR PURPOSE.
137a0395d0Smrg
149a011757Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
157a0395d0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
167a0395d0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17273c00b8Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18273c00b8Smrg[m4_warning([this file was generated for autoconf 2.72.
197a0395d0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
207a0395d0SmrgIf you have problems, you may need to regenerate the build system entirely.
218abc0ccfSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227a0395d0Smrg
23273c00b8Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24273c00b8Smrg#
25273c00b8Smrg# This file is free software; the Free Software Foundation
26273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
27273c00b8Smrg# with or without modifications, as long as this notice is preserved.
28765b7306Smrg
29273c00b8Smrg# AM_AUTOMAKE_VERSION(VERSION)
30273c00b8Smrg# ----------------------------
31273c00b8Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32273c00b8Smrg# generated from the m4 files accompanying Automake X.Y.
33273c00b8Smrg# (This private macro should not be called outside this file.)
34273c00b8SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35273c00b8Smrg[am__api_version='1.16'
36273c00b8Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37273c00b8Smrgdnl require some minimum version.  Point them to the right macro.
38273c00b8Smrgm4_if([$1], [1.16.5], [],
39273c00b8Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40273c00b8Smrg])
416c3c2bceSmrg
42273c00b8Smrg# _AM_AUTOCONF_VERSION(VERSION)
43273c00b8Smrg# -----------------------------
44273c00b8Smrg# aclocal traces this macro to find the Autoconf version.
45273c00b8Smrg# This is a private macro too.  Using m4_define simplifies
46273c00b8Smrg# the logic in aclocal, which can simply ignore this definition.
47273c00b8Smrgm4_define([_AM_AUTOCONF_VERSION], [])
486c3c2bceSmrg
49273c00b8Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50273c00b8Smrg# -------------------------------
51273c00b8Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52273c00b8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53273c00b8SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54273c00b8Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55273c00b8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56273c00b8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57273c00b8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
587a0395d0Smrg
59273c00b8Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
607a0395d0Smrg
61273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62273c00b8Smrg#
63273c00b8Smrg# This file is free software; the Free Software Foundation
64273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
65273c00b8Smrg# with or without modifications, as long as this notice is preserved.
667a0395d0Smrg
67273c00b8Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68273c00b8Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69273c00b8Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70273c00b8Smrg#
71273c00b8Smrg# Of course, Automake must honor this variable whenever it calls a
72273c00b8Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73273c00b8Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74273c00b8Smrg# depending on how configure is run.  This is pretty annoying, since
75273c00b8Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76273c00b8Smrg# source directory, any form will work fine, but in subdirectories a
77273c00b8Smrg# relative path needs to be adjusted first.
78273c00b8Smrg#
79273c00b8Smrg# $ac_aux_dir/missing
80273c00b8Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81273c00b8Smrg# $top_srcdir/$ac_aux_dir/missing
82273c00b8Smrg#    fails if $ac_aux_dir is absolute,
83273c00b8Smrg#    fails when called from a subdirectory in a VPATH build with
84273c00b8Smrg#          a relative $ac_aux_dir
85273c00b8Smrg#
86273c00b8Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87273c00b8Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88273c00b8Smrg# harmless because $srcdir is '.', but things will broke when you
89273c00b8Smrg# start a VPATH build or use an absolute $srcdir.
90273c00b8Smrg#
91273c00b8Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92273c00b8Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93273c00b8Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94273c00b8Smrg# and then we would define $MISSING as
95273c00b8Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96273c00b8Smrg# This will work as long as MISSING is not called from configure, because
97273c00b8Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98273c00b8Smrg# However there are other variables, like CC, which are often used in
99273c00b8Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100273c00b8Smrg#
101273c00b8Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102273c00b8Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103273c00b8Smrg# configured tree to be moved without reconfiguration.
1047a0395d0Smrg
105273c00b8SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106273c00b8Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107273c00b8Smrg# Expand $ac_aux_dir to an absolute path.
108273c00b8Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109273c00b8Smrg])
1107a0395d0Smrg
111273c00b8Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1128abc0ccfSmrg
113273c00b8Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114273c00b8Smrg#
115273c00b8Smrg# This file is free software; the Free Software Foundation
116273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
117273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1187a0395d0Smrg
119273c00b8Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120273c00b8Smrg# -------------------------------------
121273c00b8Smrg# Define a conditional.
122273c00b8SmrgAC_DEFUN([AM_CONDITIONAL],
123273c00b8Smrg[AC_PREREQ([2.52])dnl
124273c00b8Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125273c00b8Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126273c00b8SmrgAC_SUBST([$1_TRUE])dnl
127273c00b8SmrgAC_SUBST([$1_FALSE])dnl
128273c00b8Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129273c00b8Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130273c00b8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131273c00b8Smrgif $2; then
132273c00b8Smrg  $1_TRUE=
133273c00b8Smrg  $1_FALSE='#'
134273c00b8Smrgelse
135273c00b8Smrg  $1_TRUE='#'
136273c00b8Smrg  $1_FALSE=
137273c00b8Smrgfi
138273c00b8SmrgAC_CONFIG_COMMANDS_PRE(
139273c00b8Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140273c00b8Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141273c00b8SmrgUsually this means the macro was only invoked conditionally.]])
142273c00b8Smrgfi])])
1437a0395d0Smrg
144273c00b8Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145273c00b8Smrg#
146273c00b8Smrg# This file is free software; the Free Software Foundation
147273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
148273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1497a0395d0Smrg
1507a0395d0Smrg
151273c00b8Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152273c00b8Smrg# written in clear, in which case automake, when reading aclocal.m4,
153273c00b8Smrg# will think it sees a *use*, and therefore will trigger all it's
154273c00b8Smrg# C support machinery.  Also note that it means that autoscan, seeing
155273c00b8Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1567a0395d0Smrg
1577a0395d0Smrg
158273c00b8Smrg# _AM_DEPENDENCIES(NAME)
159273c00b8Smrg# ----------------------
160273c00b8Smrg# See how the compiler implements dependency checking.
161273c00b8Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162273c00b8Smrg# We try a few techniques and use that to set a single cache variable.
163273c00b8Smrg#
164273c00b8Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165273c00b8Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166273c00b8Smrg# dependency, and given that the user is not expected to run this macro,
167273c00b8Smrg# just rely on AC_PROG_CC.
168273c00b8SmrgAC_DEFUN([_AM_DEPENDENCIES],
169273c00b8Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170273c00b8SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171273c00b8SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172273c00b8SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1737a0395d0Smrg
174273c00b8Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175273c00b8Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176273c00b8Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177273c00b8Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178273c00b8Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179273c00b8Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180273c00b8Smrg                    [depcc="$$1"   am_compiler_list=])
1817a0395d0Smrg
182273c00b8SmrgAC_CACHE_CHECK([dependency style of $depcc],
183273c00b8Smrg               [am_cv_$1_dependencies_compiler_type],
184273c00b8Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185273c00b8Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186273c00b8Smrg  # making bogus files that we don't know about and never remove.  For
187273c00b8Smrg  # instance it was reported that on HP-UX the gcc test will end up
188273c00b8Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189273c00b8Smrg  # in D".
190273c00b8Smrg  rm -rf conftest.dir
191273c00b8Smrg  mkdir conftest.dir
192273c00b8Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193273c00b8Smrg  # using a relative directory.
194273c00b8Smrg  cp "$am_depcomp" conftest.dir
195273c00b8Smrg  cd conftest.dir
196273c00b8Smrg  # We will build objects and dependencies in a subdirectory because
197273c00b8Smrg  # it helps to detect inapplicable dependency modes.  For instance
198273c00b8Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199273c00b8Smrg  # side effect of compilation, but ICC will put the dependencies in
200273c00b8Smrg  # the current directory while Tru64 will put them in the object
201273c00b8Smrg  # directory.
202273c00b8Smrg  mkdir sub
2037a0395d0Smrg
204273c00b8Smrg  am_cv_$1_dependencies_compiler_type=none
205273c00b8Smrg  if test "$am_compiler_list" = ""; then
206273c00b8Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207273c00b8Smrg  fi
208273c00b8Smrg  am__universal=false
209273c00b8Smrg  m4_case([$1], [CC],
210273c00b8Smrg    [case " $depcc " in #(
211273c00b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212273c00b8Smrg     esac],
213273c00b8Smrg    [CXX],
214273c00b8Smrg    [case " $depcc " in #(
215273c00b8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216273c00b8Smrg     esac])
2177a0395d0Smrg
218273c00b8Smrg  for depmode in $am_compiler_list; do
219273c00b8Smrg    # Setup a source with many dependencies, because some compilers
220273c00b8Smrg    # like to wrap large dependency lists on column 80 (with \), and
221273c00b8Smrg    # we should not choose a depcomp mode which is confused by this.
222273c00b8Smrg    #
223273c00b8Smrg    # We need to recreate these files for each test, as the compiler may
224273c00b8Smrg    # overwrite some of them when testing with obscure command lines.
225273c00b8Smrg    # This happens at least with the AIX C compiler.
226273c00b8Smrg    : > sub/conftest.c
227273c00b8Smrg    for i in 1 2 3 4 5 6; do
228273c00b8Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229273c00b8Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230273c00b8Smrg      # Solaris 10 /bin/sh.
231273c00b8Smrg      echo '/* dummy */' > sub/conftst$i.h
232273c00b8Smrg    done
233273c00b8Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234273c00b8Smrg
235273c00b8Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236273c00b8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237273c00b8Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238273c00b8Smrg    # versions had trouble with output in subdirs.
239273c00b8Smrg    am__obj=sub/conftest.${OBJEXT-o}
240273c00b8Smrg    am__minus_obj="-o $am__obj"
241273c00b8Smrg    case $depmode in
242273c00b8Smrg    gcc)
243273c00b8Smrg      # This depmode causes a compiler race in universal mode.
244273c00b8Smrg      test "$am__universal" = false || continue
245273c00b8Smrg      ;;
246273c00b8Smrg    nosideeffect)
247273c00b8Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248273c00b8Smrg      # only be used when explicitly requested.
249273c00b8Smrg      if test "x$enable_dependency_tracking" = xyes; then
250273c00b8Smrg	continue
251273c00b8Smrg      else
252273c00b8Smrg	break
253273c00b8Smrg      fi
254273c00b8Smrg      ;;
255273c00b8Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256273c00b8Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257273c00b8Smrg      # not run yet.  These depmodes are late enough in the game, and
258273c00b8Smrg      # so weak that their functioning should not be impacted.
259273c00b8Smrg      am__obj=conftest.${OBJEXT-o}
260273c00b8Smrg      am__minus_obj=
261273c00b8Smrg      ;;
262273c00b8Smrg    none) break ;;
263273c00b8Smrg    esac
264273c00b8Smrg    if depmode=$depmode \
265273c00b8Smrg       source=sub/conftest.c object=$am__obj \
266273c00b8Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267273c00b8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268273c00b8Smrg         >/dev/null 2>conftest.err &&
269273c00b8Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270273c00b8Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271273c00b8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272273c00b8Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273273c00b8Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274273c00b8Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275273c00b8Smrg      # that says an option was ignored or not supported.
276273c00b8Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277273c00b8Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278273c00b8Smrg      # The diagnosis changed in icc 8.0:
279273c00b8Smrg      #   icc: Command line remark: option '-MP' not supported
280273c00b8Smrg      if (grep 'ignoring option' conftest.err ||
281273c00b8Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282273c00b8Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283273c00b8Smrg        break
284273c00b8Smrg      fi
285273c00b8Smrg    fi
286273c00b8Smrg  done
287273c00b8Smrg
288273c00b8Smrg  cd ..
289273c00b8Smrg  rm -rf conftest.dir
2908abc0ccfSmrgelse
291273c00b8Smrg  am_cv_$1_dependencies_compiler_type=none
292273c00b8Smrgfi
293273c00b8Smrg])
294273c00b8SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295273c00b8SmrgAM_CONDITIONAL([am__fastdep$1], [
296273c00b8Smrg  test "x$enable_dependency_tracking" != xno \
297273c00b8Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298273c00b8Smrg])
2997a0395d0Smrg
3007a0395d0Smrg
301273c00b8Smrg# AM_SET_DEPDIR
302273c00b8Smrg# -------------
303273c00b8Smrg# Choose a directory name for dependency files.
304273c00b8Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305273c00b8SmrgAC_DEFUN([AM_SET_DEPDIR],
306273c00b8Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307273c00b8SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308273c00b8Smrg])
3096c3c2bceSmrg
3106c3c2bceSmrg
311273c00b8Smrg# AM_DEP_TRACK
312273c00b8Smrg# ------------
313273c00b8SmrgAC_DEFUN([AM_DEP_TRACK],
314273c00b8Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315273c00b8SmrgAS_HELP_STRING(
316273c00b8Smrg  [--enable-dependency-tracking],
317273c00b8Smrg  [do not reject slow dependency extractors])
318273c00b8SmrgAS_HELP_STRING(
319273c00b8Smrg  [--disable-dependency-tracking],
320273c00b8Smrg  [speeds up one-time build])])
321273c00b8Smrgif test "x$enable_dependency_tracking" != xno; then
322273c00b8Smrg  am_depcomp="$ac_aux_dir/depcomp"
323273c00b8Smrg  AMDEPBACKSLASH='\'
324273c00b8Smrg  am__nodep='_no'
325273c00b8Smrgfi
326273c00b8SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327273c00b8SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328273c00b8Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329273c00b8SmrgAC_SUBST([am__nodep])dnl
330273c00b8Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331273c00b8Smrg])
3328abc0ccfSmrg
333273c00b8Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3348abc0ccfSmrg
335273c00b8Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336273c00b8Smrg#
337273c00b8Smrg# This file is free software; the Free Software Foundation
338273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
339273c00b8Smrg# with or without modifications, as long as this notice is preserved.
3409a011757Smrg
341273c00b8Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342273c00b8Smrg# ------------------------------
343273c00b8SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344273c00b8Smrg[{
345273c00b8Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346273c00b8Smrg  # are listed without --file.  Let's play safe and only enable the eval
347273c00b8Smrg  # if we detect the quoting.
348273c00b8Smrg  # TODO: see whether this extra hack can be removed once we start
349273c00b8Smrg  # requiring Autoconf 2.70 or later.
350273c00b8Smrg  AS_CASE([$CONFIG_FILES],
351273c00b8Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352273c00b8Smrg          [*], [set x $CONFIG_FILES])
353273c00b8Smrg  shift
354273c00b8Smrg  # Used to flag and report bootstrapping failures.
355273c00b8Smrg  am_rc=0
356273c00b8Smrg  for am_mf
357273c00b8Smrg  do
358273c00b8Smrg    # Strip MF so we end up with the name of the file.
359273c00b8Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360273c00b8Smrg    # Check whether this is an Automake generated Makefile which includes
361273c00b8Smrg    # dependency-tracking related rules and includes.
362273c00b8Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363273c00b8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364273c00b8Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365273c00b8Smrg      || continue
366273c00b8Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367273c00b8Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368273c00b8Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369273c00b8Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370273c00b8Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371273c00b8Smrg  done
372273c00b8Smrg  if test $am_rc -ne 0; then
373273c00b8Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374273c00b8Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375273c00b8Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376273c00b8Smrg    necessary).  You can also try re-running configure with the
377273c00b8Smrg    '--disable-dependency-tracking' option to at least be able to build
378273c00b8Smrg    the package (albeit without support for automatic dependency tracking).])
379273c00b8Smrg  fi
380273c00b8Smrg  AS_UNSET([am_dirpart])
381273c00b8Smrg  AS_UNSET([am_filepart])
382273c00b8Smrg  AS_UNSET([am_mf])
383273c00b8Smrg  AS_UNSET([am_rc])
384273c00b8Smrg  rm -f conftest-deps.mk
385273c00b8Smrg}
386273c00b8Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3876c3c2bceSmrg
388765b7306Smrg
389273c00b8Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390273c00b8Smrg# -----------------------------
391273c00b8Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392273c00b8Smrg#
393273c00b8Smrg# This code is only required when automatic dependency tracking is enabled.
394273c00b8Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395273c00b8Smrg# order to bootstrap the dependency handling code.
396273c00b8SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397273c00b8Smrg[AC_CONFIG_COMMANDS([depfiles],
398273c00b8Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399273c00b8Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400765b7306Smrg
401273c00b8Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4027a0395d0Smrg
403273c00b8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4048abc0ccfSmrg#
405273c00b8Smrg# This file is free software; the Free Software Foundation
406273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
407273c00b8Smrg# with or without modifications, as long as this notice is preserved.
4087a0395d0Smrg
409273c00b8Smrg# This macro actually does too much.  Some checks are only needed if
410273c00b8Smrg# your package does certain things.  But this isn't really a big deal.
4117a0395d0Smrg
412273c00b8Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413273c00b8Smrgm4_define([AC_PROG_CC],
414273c00b8Smrgm4_defn([AC_PROG_CC])
415273c00b8Smrg[_AM_PROG_CC_C_O
416273c00b8Smrg])
417273c00b8Smrg
418273c00b8Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419273c00b8Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420273c00b8Smrg# -----------------------------------------------
421273c00b8Smrg# The call with PACKAGE and VERSION arguments is the old style
422273c00b8Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423273c00b8Smrg# and VERSION should now be passed to AC_INIT and removed from
424273c00b8Smrg# the call to AM_INIT_AUTOMAKE.
425273c00b8Smrg# We support both call styles for the transition.  After
426273c00b8Smrg# the next Automake release, Autoconf can make the AC_INIT
427273c00b8Smrg# arguments mandatory, and then we can depend on a new Autoconf
428273c00b8Smrg# release and drop the old call support.
429273c00b8SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430273c00b8Smrg[AC_PREREQ([2.65])dnl
431273c00b8Smrgm4_ifdef([_$0_ALREADY_INIT],
432273c00b8Smrg  [m4_fatal([$0 expanded multiple times
433273c00b8Smrg]m4_defn([_$0_ALREADY_INIT]))],
434273c00b8Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435273c00b8Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436273c00b8Smrgdnl the ones we care about.
437273c00b8Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438273c00b8SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440273c00b8Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441273c00b8Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442273c00b8Smrg  # is not polluted with repeated "-I."
443273c00b8Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444273c00b8Smrg  # test to see if srcdir already configured
445273c00b8Smrg  if test -f $srcdir/config.status; then
446273c00b8Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447273c00b8Smrg  fi
4487a0395d0Smrgfi
4497a0395d0Smrg
450273c00b8Smrg# test whether we have cygpath
451273c00b8Smrgif test -z "$CYGPATH_W"; then
452273c00b8Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453273c00b8Smrg    CYGPATH_W='cygpath -w'
454273c00b8Smrg  else
455273c00b8Smrg    CYGPATH_W=echo
456273c00b8Smrg  fi
4578abc0ccfSmrgfi
458273c00b8SmrgAC_SUBST([CYGPATH_W])
4597a0395d0Smrg
460273c00b8Smrg# Define the identity of the package.
461273c00b8Smrgdnl Distinguish between old-style and new-style calls.
462273c00b8Smrgm4_ifval([$2],
463273c00b8Smrg[AC_DIAGNOSE([obsolete],
464273c00b8Smrg             [$0: two- and three-arguments forms are deprecated.])
465273c00b8Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466273c00b8Smrg AC_SUBST([PACKAGE], [$1])dnl
467273c00b8Smrg AC_SUBST([VERSION], [$2])],
468273c00b8Smrg[_AM_SET_OPTIONS([$1])dnl
469273c00b8Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470273c00b8Smrgm4_if(
471273c00b8Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472273c00b8Smrg  [ok:ok],,
473273c00b8Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474273c00b8Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475273c00b8Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4767a0395d0Smrg
477273c00b8Smrg_AM_IF_OPTION([no-define],,
478273c00b8Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479273c00b8Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4807a0395d0Smrg
481273c00b8Smrg# Some tools Automake needs.
482273c00b8SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483273c00b8SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484273c00b8SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485273c00b8SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486273c00b8SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487273c00b8SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488273c00b8SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489273c00b8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490273c00b8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491273c00b8SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492273c00b8Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493273c00b8Smrg# dies out for good.  For more background, see:
494273c00b8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495273c00b8Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496273c00b8SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497273c00b8Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498273c00b8Smrg# system "awk" is bad on some platforms.
499273c00b8SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500273c00b8SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501273c00b8SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502273c00b8Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503273c00b8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504273c00b8Smrg			     [_AM_PROG_TAR([v7])])])
505273c00b8Smrg_AM_IF_OPTION([no-dependencies],,
506273c00b8Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507273c00b8Smrg		  [_AM_DEPENDENCIES([CC])],
508273c00b8Smrg		  [m4_define([AC_PROG_CC],
509273c00b8Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511273c00b8Smrg		  [_AM_DEPENDENCIES([CXX])],
512273c00b8Smrg		  [m4_define([AC_PROG_CXX],
513273c00b8Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515273c00b8Smrg		  [_AM_DEPENDENCIES([OBJC])],
516273c00b8Smrg		  [m4_define([AC_PROG_OBJC],
517273c00b8Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518273c00b8SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519273c00b8Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520273c00b8Smrg		  [m4_define([AC_PROG_OBJCXX],
521273c00b8Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522273c00b8Smrg])
523273c00b8Smrg# Variables for tags utilities; see am/tags.am
524273c00b8Smrgif test -z "$CTAGS"; then
525273c00b8Smrg  CTAGS=ctags
5267a0395d0Smrgfi
527273c00b8SmrgAC_SUBST([CTAGS])
528273c00b8Smrgif test -z "$ETAGS"; then
529273c00b8Smrg  ETAGS=etags
5308abc0ccfSmrgfi
531273c00b8SmrgAC_SUBST([ETAGS])
532273c00b8Smrgif test -z "$CSCOPE"; then
533273c00b8Smrg  CSCOPE=cscope
5348abc0ccfSmrgfi
535273c00b8SmrgAC_SUBST([CSCOPE])
5367a0395d0Smrg
537273c00b8SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
538273c00b8Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539273c00b8Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540273c00b8Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541273c00b8SmrgAC_CONFIG_COMMANDS_PRE(dnl
542273c00b8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543273c00b8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5447a0395d0Smrg
545273c00b8Smrg# POSIX will say in a future version that running "rm -f" with no argument
546273c00b8Smrg# is OK; and we want to be able to make that assumption in our Makefile
547273c00b8Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548273c00b8Smrg# actually supported "in the wild" to an acceptable degree.
549273c00b8Smrg# See automake bug#10828.
550273c00b8Smrg# To make any issue more visible, cause the running configure to be aborted
551273c00b8Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552273c00b8Smrg# user can still override this though.
553273c00b8Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554273c00b8Smrg  cat >&2 <<'END'
555273c00b8SmrgOops!
5567a0395d0Smrg
557273c00b8SmrgYour 'rm' program seems unable to run without file operands specified
558273c00b8Smrgon the command line, even when the '-f' option is present.  This is contrary
559273c00b8Smrgto the behaviour of most rm programs out there, and not conforming with
560273c00b8Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5618abc0ccfSmrg
562273c00b8SmrgPlease tell bug-automake@gnu.org about your system, including the value
563273c00b8Smrgof your $PATH and any error possibly output before this message.  This
564273c00b8Smrgcan help us improve future automake versions.
5657366012aSmrg
566273c00b8SmrgEND
567273c00b8Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568273c00b8Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569273c00b8Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570273c00b8Smrg    echo >&2
571273c00b8Smrg  else
572273c00b8Smrg    cat >&2 <<'END'
573273c00b8SmrgAborting the configuration process, to ensure you take notice of the issue.
5747366012aSmrg
575273c00b8SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576273c00b8Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5778abc0ccfSmrg
578273c00b8SmrgIf you want to complete the configuration process using your problematic
579273c00b8Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580273c00b8Smrgto "yes", and re-run configure.
5818abc0ccfSmrg
582273c00b8SmrgEND
583273c00b8Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584273c00b8Smrg  fi
585273c00b8Smrgfi
586273c00b8Smrgdnl The trailing newline in this macro's definition is deliberate, for
587273c00b8Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588273c00b8Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589273c00b8Smrg])
5908abc0ccfSmrg
591273c00b8Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592273c00b8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593273c00b8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594273c00b8Smrgm4_define([_AC_COMPILER_EXEEXT],
595273c00b8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5967a0395d0Smrg
597273c00b8Smrg# When config.status generates a header, we must update the stamp-h file.
598273c00b8Smrg# This file resides in the same directory as the config header
599273c00b8Smrg# that is generated.  The stamp files are numbered to have different names.
6008abc0ccfSmrg
601273c00b8Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602273c00b8Smrg# loop where config.status creates the headers, so we can generate
603273c00b8Smrg# our stamp files there.
604273c00b8SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605273c00b8Smrg[# Compute $1's index in $config_headers.
606273c00b8Smrg_am_arg=$1
607273c00b8Smrg_am_stamp_count=1
608273c00b8Smrgfor _am_header in $config_headers :; do
609273c00b8Smrg  case $_am_header in
610273c00b8Smrg    $_am_arg | $_am_arg:* )
611273c00b8Smrg      break ;;
612273c00b8Smrg    * )
613273c00b8Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614273c00b8Smrg  esac
615273c00b8Smrgdone
616273c00b8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6177a0395d0Smrg
618273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6197366012aSmrg#
620273c00b8Smrg# This file is free software; the Free Software Foundation
621273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
622273c00b8Smrg# with or without modifications, as long as this notice is preserved.
6237a0395d0Smrg
624273c00b8Smrg# AM_PROG_INSTALL_SH
625273c00b8Smrg# ------------------
626273c00b8Smrg# Define $install_sh.
627273c00b8SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629273c00b8Smrgif test x"${install_sh+set}" != xset; then
630273c00b8Smrg  case $am_aux_dir in
631273c00b8Smrg  *\ * | *\	*)
632273c00b8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633273c00b8Smrg  *)
634273c00b8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635273c00b8Smrg  esac
636273c00b8Smrgfi
637273c00b8SmrgAC_SUBST([install_sh])])
6387a0395d0Smrg
639273c00b8Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640273c00b8Smrg#
641273c00b8Smrg# This file is free software; the Free Software Foundation
642273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
643273c00b8Smrg# with or without modifications, as long as this notice is preserved.
644273c00b8Smrg
645273c00b8Smrg# Check whether the underlying file-system supports filenames
646273c00b8Smrg# with a leading dot.  For instance MS-DOS doesn't.
647273c00b8SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648273c00b8Smrg[rm -rf .tst 2>/dev/null
649273c00b8Smrgmkdir .tst 2>/dev/null
650273c00b8Smrgif test -d .tst; then
651273c00b8Smrg  am__leading_dot=.
6528abc0ccfSmrgelse
653273c00b8Smrg  am__leading_dot=_
6547a0395d0Smrgfi
655273c00b8Smrgrmdir .tst 2>/dev/null
656273c00b8SmrgAC_SUBST([am__leading_dot])])
6577a0395d0Smrg
658273c00b8Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6597a0395d0Smrg
660273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661273c00b8Smrg#
662273c00b8Smrg# This file is free software; the Free Software Foundation
663273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
664273c00b8Smrg# with or without modifications, as long as this notice is preserved.
6657a0395d0Smrg
666273c00b8Smrg# AM_MAKE_INCLUDE()
667273c00b8Smrg# -----------------
668273c00b8Smrg# Check whether make has an 'include' directive that can support all
669273c00b8Smrg# the idioms we need for our automatic dependency tracking code.
670273c00b8SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671273c00b8Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672273c00b8Smrgcat > confinc.mk << 'END'
673273c00b8Smrgam__doit:
674273c00b8Smrg	@echo this is the am__doit target >confinc.out
675273c00b8Smrg.PHONY: am__doit
676273c00b8SmrgEND
677273c00b8Smrgam__include="#"
678273c00b8Smrgam__quote=
679273c00b8Smrg# BSD make does it like this.
680273c00b8Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681273c00b8Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682273c00b8Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683273c00b8Smrg_am_result=no
684273c00b8Smrgfor s in GNU BSD; do
685273c00b8Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686273c00b8Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687273c00b8Smrg      ['0:this is the am__doit target'],
688273c00b8Smrg      [AS_CASE([$s],
689273c00b8Smrg          [BSD], [am__include='.include' am__quote='"'],
690273c00b8Smrg          [am__include='include' am__quote=''])])
691273c00b8Smrg  if test "$am__include" != "#"; then
692273c00b8Smrg    _am_result="yes ($s style)"
693273c00b8Smrg    break
694273c00b8Smrg  fi
695273c00b8Smrgdone
696273c00b8Smrgrm -f confinc.* confmf.*
697273c00b8SmrgAC_MSG_RESULT([${_am_result}])
698273c00b8SmrgAC_SUBST([am__include])])
699273c00b8SmrgAC_SUBST([am__quote])])
7007a0395d0Smrg
701273c00b8Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7027a0395d0Smrg
703273c00b8Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704273c00b8Smrg#
705273c00b8Smrg# This file is free software; the Free Software Foundation
706273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
707273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7087a0395d0Smrg
709273c00b8Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710273c00b8Smrg# ------------------------------
711273c00b8SmrgAC_DEFUN([AM_MISSING_PROG],
712273c00b8Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713273c00b8Smrg$1=${$1-"${am_missing_run}$2"}
714273c00b8SmrgAC_SUBST($1)])
7157a0395d0Smrg
716273c00b8Smrg# AM_MISSING_HAS_RUN
717273c00b8Smrg# ------------------
718273c00b8Smrg# Define MISSING if not defined so far and test if it is modern enough.
719273c00b8Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720273c00b8SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722273c00b8SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723273c00b8Smrgif test x"${MISSING+set}" != xset; then
724273c00b8Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725273c00b8Smrgfi
726273c00b8Smrg# Use eval to expand $SHELL
727273c00b8Smrgif eval "$MISSING --is-lightweight"; then
728273c00b8Smrg  am_missing_run="$MISSING "
729273c00b8Smrgelse
730273c00b8Smrg  am_missing_run=
731273c00b8Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732273c00b8Smrgfi
733273c00b8Smrg])
7347a0395d0Smrg
735273c00b8Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7367a0395d0Smrg
737273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7387366012aSmrg#
739273c00b8Smrg# This file is free software; the Free Software Foundation
740273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
741273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7427a0395d0Smrg
743273c00b8Smrg# _AM_MANGLE_OPTION(NAME)
744273c00b8Smrg# -----------------------
745273c00b8SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746273c00b8Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7477a0395d0Smrg
748273c00b8Smrg# _AM_SET_OPTION(NAME)
749273c00b8Smrg# --------------------
750273c00b8Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751273c00b8SmrgAC_DEFUN([_AM_SET_OPTION],
752273c00b8Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7537a0395d0Smrg
754273c00b8Smrg# _AM_SET_OPTIONS(OPTIONS)
755273c00b8Smrg# ------------------------
756273c00b8Smrg# OPTIONS is a space-separated list of Automake options.
757273c00b8SmrgAC_DEFUN([_AM_SET_OPTIONS],
758273c00b8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7597366012aSmrg
760273c00b8Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761273c00b8Smrg# -------------------------------------------
762273c00b8Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763273c00b8SmrgAC_DEFUN([_AM_IF_OPTION],
764273c00b8Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7657a0395d0Smrg
766273c00b8Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767273c00b8Smrg#
768273c00b8Smrg# This file is free software; the Free Software Foundation
769273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
770273c00b8Smrg# with or without modifications, as long as this notice is preserved.
7717a0395d0Smrg
772273c00b8Smrg# _AM_PROG_CC_C_O
773273c00b8Smrg# ---------------
774273c00b8Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775273c00b8Smrg# to automatically call this.
776273c00b8SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777273c00b8Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778273c00b8SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779273c00b8SmrgAC_LANG_PUSH([C])dnl
780273c00b8SmrgAC_CACHE_CHECK(
781273c00b8Smrg  [whether $CC understands -c and -o together],
782273c00b8Smrg  [am_cv_prog_cc_c_o],
783273c00b8Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784273c00b8Smrg  # Make sure it works both with $CC and with simple cc.
785273c00b8Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786273c00b8Smrg  # compilers refuse to overwrite an existing .o file with -o,
787273c00b8Smrg  # though they will create one.
788273c00b8Smrg  am_cv_prog_cc_c_o=yes
789273c00b8Smrg  for am_i in 1 2; do
790273c00b8Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791273c00b8Smrg         && test -f conftest2.$ac_objext; then
792273c00b8Smrg      : OK
793273c00b8Smrg    else
794273c00b8Smrg      am_cv_prog_cc_c_o=no
795273c00b8Smrg      break
796273c00b8Smrg    fi
797273c00b8Smrg  done
798273c00b8Smrg  rm -f core conftest*
799273c00b8Smrg  unset am_i])
800273c00b8Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801273c00b8Smrg   # Losing compiler, so override with the script.
802273c00b8Smrg   # FIXME: It is wrong to rewrite CC.
803273c00b8Smrg   # But if we don't then we get into trouble of one sort or another.
804273c00b8Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805273c00b8Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806273c00b8Smrg   CC="$am_aux_dir/compile $CC"
8078abc0ccfSmrgfi
808273c00b8SmrgAC_LANG_POP([C])])
8097a0395d0Smrg
810273c00b8Smrg# For backward compatibility.
811273c00b8SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8127366012aSmrg
813273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8147a0395d0Smrg#
815273c00b8Smrg# This file is free software; the Free Software Foundation
816273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
817273c00b8Smrg# with or without modifications, as long as this notice is preserved.
8187366012aSmrg
819273c00b8Smrg# AM_RUN_LOG(COMMAND)
820273c00b8Smrg# -------------------
821273c00b8Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822273c00b8Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823273c00b8SmrgAC_DEFUN([AM_RUN_LOG],
824273c00b8Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825273c00b8Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826273c00b8Smrg   ac_status=$?
827273c00b8Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828273c00b8Smrg   (exit $ac_status); }])
8297a0395d0Smrg
830273c00b8Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8317a0395d0Smrg
832273c00b8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83340c5344fSmrg#
834273c00b8Smrg# This file is free software; the Free Software Foundation
835273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
836273c00b8Smrg# with or without modifications, as long as this notice is preserved.
8377a0395d0Smrg
838273c00b8Smrg# AM_SANITY_CHECK
839273c00b8Smrg# ---------------
840273c00b8SmrgAC_DEFUN([AM_SANITY_CHECK],
841273c00b8Smrg[AC_MSG_CHECKING([whether build environment is sane])
842273c00b8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843273c00b8Smrg# name.  Accept space and tab only in the latter.
844273c00b8Smrgam_lf='
845273c00b8Smrg'
846273c00b8Smrgcase `pwd` in
847273c00b8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848273c00b8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849273c00b8Smrgesac
850273c00b8Smrgcase $srcdir in
851273c00b8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852273c00b8Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853273c00b8Smrgesac
8547366012aSmrg
855273c00b8Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856273c00b8Smrg# arguments.  Must try -L first in case configure is actually a
857273c00b8Smrg# symlink; some systems play weird games with the mod time of symlinks
858273c00b8Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859273c00b8Smrg# directory).
860273c00b8Smrgif (
861273c00b8Smrg   am_has_slept=no
862273c00b8Smrg   for am_try in 1 2; do
863273c00b8Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864273c00b8Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865273c00b8Smrg     if test "$[*]" = "X"; then
866273c00b8Smrg	# -L didn't work.
867273c00b8Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868273c00b8Smrg     fi
869273c00b8Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870273c00b8Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871273c00b8Smrg
872273c00b8Smrg	# If neither matched, then we have a broken ls.  This can happen
873273c00b8Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874273c00b8Smrg	# broken ls alias from the environment.  This has actually
875273c00b8Smrg	# happened.  Such a system could not be considered "sane".
876273c00b8Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877273c00b8Smrg  alias in your environment])
878273c00b8Smrg     fi
879273c00b8Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880273c00b8Smrg       break
881273c00b8Smrg     fi
882273c00b8Smrg     # Just in case.
883273c00b8Smrg     sleep 1
884273c00b8Smrg     am_has_slept=yes
885273c00b8Smrg   done
886273c00b8Smrg   test "$[2]" = conftest.file
887273c00b8Smrg   )
888273c00b8Smrgthen
889273c00b8Smrg   # Ok.
890273c00b8Smrg   :
8917366012aSmrgelse
892273c00b8Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893273c00b8SmrgCheck your system clock])
8947366012aSmrgfi
895273c00b8SmrgAC_MSG_RESULT([yes])
896273c00b8Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897273c00b8Smrg# generated files are strictly newer.
898273c00b8Smrgam_sleep_pid=
899273c00b8Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900273c00b8Smrg  ( sleep 1 ) &
901273c00b8Smrg  am_sleep_pid=$!
902273c00b8Smrgfi
903273c00b8SmrgAC_CONFIG_COMMANDS_PRE(
904273c00b8Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905273c00b8Smrg   if test -n "$am_sleep_pid"; then
906273c00b8Smrg     # Hide warnings about reused PIDs.
907273c00b8Smrg     wait $am_sleep_pid 2>/dev/null
908273c00b8Smrg   fi
909273c00b8Smrg   AC_MSG_RESULT([done])])
910273c00b8Smrgrm -f conftest.file
911273c00b8Smrg])
9127a0395d0Smrg
913273c00b8Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9148abc0ccfSmrg#
915273c00b8Smrg# This file is free software; the Free Software Foundation
916273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
917273c00b8Smrg# with or without modifications, as long as this notice is preserved.
9187a0395d0Smrg
919273c00b8Smrg# AM_SILENT_RULES([DEFAULT])
920273c00b8Smrg# --------------------------
921273c00b8Smrg# Enable less verbose build rules; with the default set to DEFAULT
922273c00b8Smrg# ("yes" being less verbose, "no" or empty being verbose).
923273c00b8SmrgAC_DEFUN([AM_SILENT_RULES],
924273c00b8Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925273c00b8SmrgAS_HELP_STRING(
926273c00b8Smrg  [--enable-silent-rules],
927273c00b8Smrg  [less verbose build output (undo: "make V=1")])
928273c00b8SmrgAS_HELP_STRING(
929273c00b8Smrg  [--disable-silent-rules],
930273c00b8Smrg  [verbose build output (undo: "make V=0")])dnl
931273c00b8Smrg])
932273c00b8Smrgcase $enable_silent_rules in @%:@ (((
933273c00b8Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934273c00b8Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935273c00b8Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936273c00b8Smrgesac
937273c00b8Smrgdnl
938273c00b8Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939273c00b8Smrgdnl do not support nested variable expansions.
940273c00b8Smrgdnl See automake bug#9928 and bug#10237.
941273c00b8Smrgam_make=${MAKE-make}
942273c00b8SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943273c00b8Smrg   [am_cv_make_support_nested_variables],
944273c00b8Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945273c00b8SmrgBAR0=false
946273c00b8SmrgBAR1=true
947273c00b8SmrgV=1
948273c00b8Smrgam__doit:
949273c00b8Smrg	@$(TRUE)
950273c00b8Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951273c00b8Smrg  am_cv_make_support_nested_variables=yes
9528abc0ccfSmrgelse
953273c00b8Smrg  am_cv_make_support_nested_variables=no
954273c00b8Smrgfi])
955273c00b8Smrgif test $am_cv_make_support_nested_variables = yes; then
956273c00b8Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957273c00b8Smrg  AM_V='$(V)'
958273c00b8Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959273c00b8Smrgelse
960273c00b8Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961273c00b8Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9628abc0ccfSmrgfi
963273c00b8SmrgAC_SUBST([AM_V])dnl
964273c00b8SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965273c00b8SmrgAC_SUBST([AM_DEFAULT_V])dnl
966273c00b8SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967273c00b8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968273c00b8SmrgAM_BACKSLASH='\'
969273c00b8SmrgAC_SUBST([AM_BACKSLASH])dnl
970273c00b8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971273c00b8Smrg])
9727366012aSmrg
973273c00b8Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9748abc0ccfSmrg#
975273c00b8Smrg# This file is free software; the Free Software Foundation
976273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
977273c00b8Smrg# with or without modifications, as long as this notice is preserved.
9787366012aSmrg
979273c00b8Smrg# AM_PROG_INSTALL_STRIP
980273c00b8Smrg# ---------------------
981273c00b8Smrg# One issue with vendor 'install' (even GNU) is that you can't
982273c00b8Smrg# specify the program used to strip binaries.  This is especially
983273c00b8Smrg# annoying in cross-compiling environments, where the build's strip
984273c00b8Smrg# is unlikely to handle the host's binaries.
985273c00b8Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986273c00b8Smrg# always use install-sh in "make install-strip", and initialize
987273c00b8Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988273c00b8SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989273c00b8Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990273c00b8Smrg# Installed binaries are usually stripped using 'strip' when the user
991273c00b8Smrg# run "make install-strip".  However 'strip' might not be the right
992273c00b8Smrg# tool to use in cross-compilation environments, therefore Automake
993273c00b8Smrg# will honor the 'STRIP' environment variable to overrule this program.
994273c00b8Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995273c00b8Smrgif test "$cross_compiling" != no; then
996273c00b8Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9978abc0ccfSmrgfi
998273c00b8SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999273c00b8SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10007366012aSmrg
1001273c00b8Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10022852888eSmrg#
1003273c00b8Smrg# This file is free software; the Free Software Foundation
1004273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1005273c00b8Smrg# with or without modifications, as long as this notice is preserved.
10062852888eSmrg
1007273c00b8Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008273c00b8Smrg# ---------------------------
1009273c00b8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010273c00b8Smrg# This macro is traced by Automake.
1011273c00b8SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101240c5344fSmrg
1013273c00b8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014273c00b8Smrg# --------------------------
1015273c00b8Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016273c00b8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101740c5344fSmrg
1018273c00b8Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10192852888eSmrg
1020273c00b8Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10212852888eSmrg#
1022273c00b8Smrg# This file is free software; the Free Software Foundation
1023273c00b8Smrg# gives unlimited permission to copy and/or distribute it,
1024273c00b8Smrg# with or without modifications, as long as this notice is preserved.
1025273c00b8Smrg
1026273c00b8Smrg# _AM_PROG_TAR(FORMAT)
1027273c00b8Smrg# --------------------
1028273c00b8Smrg# Check how to create a tarball in format FORMAT.
1029273c00b8Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10302852888eSmrg#
1031273c00b8Smrg# Substitute a variable $(am__tar) that is a command
1032273c00b8Smrg# writing to stdout a FORMAT-tarball containing the directory
1033273c00b8Smrg# $tardir.
1034273c00b8Smrg#     tardir=directory && $(am__tar) > result.tar
10352852888eSmrg#
1036273c00b8Smrg# Substitute a variable $(am__untar) that extract such
1037273c00b8Smrg# a tarball read from stdin.
1038273c00b8Smrg#     $(am__untar) < result.tar
10392852888eSmrg#
1040273c00b8SmrgAC_DEFUN([_AM_PROG_TAR],
1041273c00b8Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042273c00b8Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043273c00b8SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10442852888eSmrg
1045273c00b8Smrg# We'll loop over all known methods to create a tar archive until one works.
1046273c00b8Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10472852888eSmrg
1048273c00b8Smrgm4_if([$1], [v7],
1049273c00b8Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10507366012aSmrg
1051273c00b8Smrg  [m4_case([$1],
1052273c00b8Smrg    [ustar],
1053273c00b8Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054273c00b8Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055273c00b8Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056273c00b8Smrg      # and bug#13588).
1057273c00b8Smrg      am_max_uid=2097151 # 2^21 - 1
1058273c00b8Smrg      am_max_gid=$am_max_uid
1059273c00b8Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060273c00b8Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061273c00b8Smrg      # below are definitely unexpected, so allow the users to see them
1062273c00b8Smrg      # (that is, avoid stderr redirection).
1063273c00b8Smrg      am_uid=`id -u || echo unknown`
1064273c00b8Smrg      am_gid=`id -g || echo unknown`
1065273c00b8Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066273c00b8Smrg      if test $am_uid -le $am_max_uid; then
1067273c00b8Smrg         AC_MSG_RESULT([yes])
1068273c00b8Smrg      else
1069273c00b8Smrg         AC_MSG_RESULT([no])
1070273c00b8Smrg         _am_tools=none
1071273c00b8Smrg      fi
1072273c00b8Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073273c00b8Smrg      if test $am_gid -le $am_max_gid; then
1074273c00b8Smrg         AC_MSG_RESULT([yes])
1075273c00b8Smrg      else
1076273c00b8Smrg        AC_MSG_RESULT([no])
1077273c00b8Smrg        _am_tools=none
1078273c00b8Smrg      fi],
10797a0395d0Smrg
1080273c00b8Smrg  [pax],
1081273c00b8Smrg    [],
10827a0395d0Smrg
1083273c00b8Smrg  [m4_fatal([Unknown tar format])])
10847a0395d0Smrg
1085273c00b8Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108640c5344fSmrg
1087273c00b8Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088273c00b8Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089273c00b8Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109040c5344fSmrg
1091273c00b8Smrg  for _am_tool in $_am_tools; do
1092273c00b8Smrg    case $_am_tool in
1093273c00b8Smrg    gnutar)
1094273c00b8Smrg      for _am_tar in tar gnutar gtar; do
1095273c00b8Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096273c00b8Smrg      done
1097273c00b8Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098273c00b8Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099273c00b8Smrg      am__untar="$_am_tar -xf -"
1100273c00b8Smrg      ;;
1101273c00b8Smrg    plaintar)
1102273c00b8Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103273c00b8Smrg      # ustar tarball either.
1104273c00b8Smrg      (tar --version) >/dev/null 2>&1 && continue
1105273c00b8Smrg      am__tar='tar chf - "$$tardir"'
1106273c00b8Smrg      am__tar_='tar chf - "$tardir"'
1107273c00b8Smrg      am__untar='tar xf -'
1108273c00b8Smrg      ;;
1109273c00b8Smrg    pax)
1110273c00b8Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111273c00b8Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112273c00b8Smrg      am__untar='pax -r'
1113273c00b8Smrg      ;;
1114273c00b8Smrg    cpio)
1115273c00b8Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116273c00b8Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117273c00b8Smrg      am__untar='cpio -i -H $1 -d'
1118273c00b8Smrg      ;;
1119273c00b8Smrg    none)
1120273c00b8Smrg      am__tar=false
1121273c00b8Smrg      am__tar_=false
1122273c00b8Smrg      am__untar=false
1123273c00b8Smrg      ;;
1124273c00b8Smrg    esac
11252adc0320Smrg
1126273c00b8Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127273c00b8Smrg    # and am__untar set.
1128273c00b8Smrg    test -n "${am_cv_prog_tar_$1}" && break
11298abc0ccfSmrg
1130273c00b8Smrg    # tar/untar a dummy directory, and stop if the command works.
1131273c00b8Smrg    rm -rf conftest.dir
1132273c00b8Smrg    mkdir conftest.dir
1133273c00b8Smrg    echo GrepMe > conftest.dir/file
1134273c00b8Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135273c00b8Smrg    rm -rf conftest.dir
1136273c00b8Smrg    if test -s conftest.tar; then
1137273c00b8Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138273c00b8Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139273c00b8Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140273c00b8Smrg    fi
1141273c00b8Smrg  done
1142273c00b8Smrg  rm -rf conftest.dir
11438abc0ccfSmrg
1144273c00b8Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145273c00b8Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11468abc0ccfSmrg
1147273c00b8SmrgAC_SUBST([am__tar])
1148273c00b8SmrgAC_SUBST([am__untar])
1149273c00b8Smrg]) # _AM_PROG_TAR
11508abc0ccfSmrg
1151273c00b8Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152273c00b8Smrgdnl serial 11 (pkg-config-0.29)
1153273c00b8Smrgdnl
1154273c00b8Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155273c00b8Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156273c00b8Smrgdnl
1157273c00b8Smrgdnl This program is free software; you can redistribute it and/or modify
1158273c00b8Smrgdnl it under the terms of the GNU General Public License as published by
1159273c00b8Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160273c00b8Smrgdnl (at your option) any later version.
1161273c00b8Smrgdnl
1162273c00b8Smrgdnl This program is distributed in the hope that it will be useful, but
1163273c00b8Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164273c00b8Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165273c00b8Smrgdnl General Public License for more details.
1166273c00b8Smrgdnl
1167273c00b8Smrgdnl You should have received a copy of the GNU General Public License
1168273c00b8Smrgdnl along with this program; if not, write to the Free Software
1169273c00b8Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170273c00b8Smrgdnl 02111-1307, USA.
1171273c00b8Smrgdnl
1172273c00b8Smrgdnl As a special exception to the GNU General Public License, if you
1173273c00b8Smrgdnl distribute this file as part of a program that contains a
1174273c00b8Smrgdnl configuration script generated by Autoconf, you may include it under
1175273c00b8Smrgdnl the same distribution terms that you use for the rest of that
1176273c00b8Smrgdnl program.
11778abc0ccfSmrg
1178273c00b8Smrgdnl PKG_PREREQ(MIN-VERSION)
1179273c00b8Smrgdnl -----------------------
1180273c00b8Smrgdnl Since: 0.29
1181273c00b8Smrgdnl
1182273c00b8Smrgdnl Verify that the version of the pkg-config macros are at least
1183273c00b8Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184273c00b8Smrgdnl installed version of pkg-config, this checks the developer's version
1185273c00b8Smrgdnl of pkg.m4 when generating configure.
1186273c00b8Smrgdnl
1187273c00b8Smrgdnl To ensure that this macro is defined, also add:
1188273c00b8Smrgdnl m4_ifndef([PKG_PREREQ],
1189273c00b8Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190273c00b8Smrgdnl
1191273c00b8Smrgdnl See the "Since" comment for each macro you use to see what version
1192273c00b8Smrgdnl of the macros you require.
1193273c00b8Smrgm4_defun([PKG_PREREQ],
1194273c00b8Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195273c00b8Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196273c00b8Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197273c00b8Smrg])dnl PKG_PREREQ
11988abc0ccfSmrg
1199273c00b8Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200273c00b8Smrgdnl ----------------------------------
1201273c00b8Smrgdnl Since: 0.16
1202273c00b8Smrgdnl
1203273c00b8Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204273c00b8Smrgdnl first found in the path. Checks that the version of pkg-config found
1205273c00b8Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206273c00b8Smrgdnl used since that's the first version where most current features of
1207273c00b8Smrgdnl pkg-config existed.
1208273c00b8SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209273c00b8Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210273c00b8Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211273c00b8Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212273c00b8SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213273c00b8SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214273c00b8SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215273c00b8Smrg
1216273c00b8Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217273c00b8Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12188abc0ccfSmrgfi
1219273c00b8Smrgif test -n "$PKG_CONFIG"; then
1220273c00b8Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221273c00b8Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222273c00b8Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223273c00b8Smrg		AC_MSG_RESULT([yes])
1224273c00b8Smrg	else
1225273c00b8Smrg		AC_MSG_RESULT([no])
1226273c00b8Smrg		PKG_CONFIG=""
1227273c00b8Smrg	fi
1228273c00b8Smrgfi[]dnl
1229273c00b8Smrg])dnl PKG_PROG_PKG_CONFIG
12308abc0ccfSmrg
1231273c00b8Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232273c00b8Smrgdnl -------------------------------------------------------------------
1233273c00b8Smrgdnl Since: 0.18
1234273c00b8Smrgdnl
1235273c00b8Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236273c00b8Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237273c00b8Smrgdnl
1238273c00b8Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239273c00b8Smrgdnl only at the first occurence in configure.ac, so if the first place
1240273c00b8Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241273c00b8Smrgdnl have to call PKG_CHECK_EXISTS manually
1242273c00b8SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244273c00b8Smrgif test -n "$PKG_CONFIG" && \
1245273c00b8Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246273c00b8Smrg  m4_default([$2], [:])
1247273c00b8Smrgm4_ifvaln([$3], [else
1248273c00b8Smrg  $3])dnl
1249273c00b8Smrgfi])
1250273c00b8Smrg
1251273c00b8Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252273c00b8Smrgdnl ---------------------------------------------
1253273c00b8Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254273c00b8Smrgdnl pkg_failed based on the result.
1255273c00b8Smrgm4_define([_PKG_CONFIG],
1256273c00b8Smrg[if test -n "$$1"; then
1257273c00b8Smrg    pkg_cv_[]$1="$$1"
1258273c00b8Smrg elif test -n "$PKG_CONFIG"; then
1259273c00b8Smrg    PKG_CHECK_EXISTS([$3],
1260273c00b8Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261273c00b8Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262273c00b8Smrg		     [pkg_failed=yes])
1263273c00b8Smrg else
1264273c00b8Smrg    pkg_failed=untried
1265273c00b8Smrgfi[]dnl
1266273c00b8Smrg])dnl _PKG_CONFIG
1267273c00b8Smrg
1268273c00b8Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269273c00b8Smrgdnl ---------------------------
1270273c00b8Smrgdnl Internal check to see if pkg-config supports short errors.
1271273c00b8SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273273c00b8Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274273c00b8Smrg        _pkg_short_errors_supported=yes
12758abc0ccfSmrgelse
1276273c00b8Smrg        _pkg_short_errors_supported=no
1277273c00b8Smrgfi[]dnl
1278273c00b8Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12798abc0ccfSmrg
12808abc0ccfSmrg
1281273c00b8Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282273c00b8Smrgdnl   [ACTION-IF-NOT-FOUND])
1283273c00b8Smrgdnl --------------------------------------------------------------
1284273c00b8Smrgdnl Since: 0.4.0
1285273c00b8Smrgdnl
1286273c00b8Smrgdnl Note that if there is a possibility the first call to
1287273c00b8Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288273c00b8Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289273c00b8SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291273c00b8SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292273c00b8SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293273c00b8Smrg
1294273c00b8Smrgpkg_failed=no
1295273c00b8SmrgAC_MSG_CHECKING([for $1])
1296273c00b8Smrg
1297273c00b8Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298273c00b8Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299273c00b8Smrg
1300273c00b8Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301273c00b8Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302273c00b8SmrgSee the pkg-config man page for more details.])
1303273c00b8Smrg
1304273c00b8Smrgif test $pkg_failed = yes; then
1305273c00b8Smrg   	AC_MSG_RESULT([no])
1306273c00b8Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307273c00b8Smrg        if test $_pkg_short_errors_supported = yes; then
1308273c00b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309273c00b8Smrg        else 
1310273c00b8Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311273c00b8Smrg        fi
1312273c00b8Smrg	# Put the nasty error message in config.log where it belongs
1313273c00b8Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13148abc0ccfSmrg
1315273c00b8Smrg	m4_default([$4], [AC_MSG_ERROR(
1316273c00b8Smrg[Package requirements ($2) were not met:
13178abc0ccfSmrg
1318273c00b8Smrg$$1_PKG_ERRORS
13198abc0ccfSmrg
1320273c00b8SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321273c00b8Smrginstalled software in a non-standard prefix.
1322273c00b8Smrg
1323273c00b8Smrg_PKG_TEXT])[]dnl
1324273c00b8Smrg        ])
1325273c00b8Smrgelif test $pkg_failed = untried; then
1326273c00b8Smrg     	AC_MSG_RESULT([no])
1327273c00b8Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328273c00b8Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329273c00b8Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330273c00b8Smrgpath to pkg-config.
1331273c00b8Smrg
1332273c00b8Smrg_PKG_TEXT
1333273c00b8Smrg
1334273c00b8SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335273c00b8Smrg        ])
13368abc0ccfSmrgelse
1337273c00b8Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338273c00b8Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339273c00b8Smrg        AC_MSG_RESULT([yes])
1340273c00b8Smrg	$3
1341273c00b8Smrgfi[]dnl
1342273c00b8Smrg])dnl PKG_CHECK_MODULES
13438abc0ccfSmrg
13448abc0ccfSmrg
1345273c00b8Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346273c00b8Smrgdnl   [ACTION-IF-NOT-FOUND])
1347273c00b8Smrgdnl ---------------------------------------------------------------------
1348273c00b8Smrgdnl Since: 0.29
1349273c00b8Smrgdnl
1350273c00b8Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351273c00b8Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352273c00b8Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353273c00b8Smrgdnl
1354273c00b8Smrgdnl Note that if there is a possibility the first call to
1355273c00b8Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356273c00b8Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357273c00b8Smrgdnl configure.ac.
1358273c00b8SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360273c00b8Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361273c00b8SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362273c00b8SmrgPKG_CHECK_MODULES($@)
1363273c00b8SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364273c00b8Smrg])dnl PKG_CHECK_MODULES_STATIC
13658abc0ccfSmrg
13668abc0ccfSmrg
1367273c00b8Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368273c00b8Smrgdnl -------------------------
1369273c00b8Smrgdnl Since: 0.27
1370273c00b8Smrgdnl
1371273c00b8Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372273c00b8Smrgdnl should install pkg-config .pc files. By default the directory is
1373273c00b8Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374273c00b8Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375273c00b8Smrgdnl parameter.
1376273c00b8SmrgAC_DEFUN([PKG_INSTALLDIR],
1377273c00b8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378273c00b8Smrgm4_pushdef([pkg_description],
1379273c00b8Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380273c00b8SmrgAC_ARG_WITH([pkgconfigdir],
1381273c00b8Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382273c00b8Smrg    [with_pkgconfigdir=]pkg_default)
1383273c00b8SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384273c00b8Smrgm4_popdef([pkg_default])
1385273c00b8Smrgm4_popdef([pkg_description])
1386273c00b8Smrg])dnl PKG_INSTALLDIR
13878abc0ccfSmrg
13888abc0ccfSmrg
1389273c00b8Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390273c00b8Smrgdnl --------------------------------
1391273c00b8Smrgdnl Since: 0.27
1392273c00b8Smrgdnl
1393273c00b8Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394273c00b8Smrgdnl module should install arch-independent pkg-config .pc files. By
1395273c00b8Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396273c00b8Smrgdnl changed by passing DIRECTORY. The user can override through the
1397273c00b8Smrgdnl --with-noarch-pkgconfigdir parameter.
1398273c00b8SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399273c00b8Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400273c00b8Smrgm4_pushdef([pkg_description],
1401273c00b8Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402273c00b8SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403273c00b8Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404273c00b8Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405273c00b8SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406273c00b8Smrgm4_popdef([pkg_default])
1407273c00b8Smrgm4_popdef([pkg_description])
1408273c00b8Smrg])dnl PKG_NOARCH_INSTALLDIR
14098abc0ccfSmrg
14108abc0ccfSmrg
1411273c00b8Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412273c00b8Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413273c00b8Smrgdnl -------------------------------------------
1414273c00b8Smrgdnl Since: 0.28
1415273c00b8Smrgdnl
1416273c00b8Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417273c00b8SmrgAC_DEFUN([PKG_CHECK_VAR],
1418273c00b8Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419273c00b8SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14208abc0ccfSmrg
1421273c00b8Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422273c00b8SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14238abc0ccfSmrg
1424273c00b8SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425273c00b8Smrg])dnl PKG_CHECK_VAR
1426273c00b8Smrg
1427273c00b8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428273c00b8Smrgdnl
1429273c00b8Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430273c00b8Smrgdnl
1431273c00b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432273c00b8Smrgdnl copy of this software and associated documentation files (the "Software"),
1433273c00b8Smrgdnl to deal in the Software without restriction, including without limitation
1434273c00b8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435273c00b8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436273c00b8Smrgdnl Software is furnished to do so, subject to the following conditions:
1437273c00b8Smrgdnl
1438273c00b8Smrgdnl The above copyright notice and this permission notice (including the next
1439273c00b8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440273c00b8Smrgdnl Software.
1441273c00b8Smrgdnl
1442273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443273c00b8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444273c00b8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445273c00b8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446273c00b8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447273c00b8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448273c00b8Smrgdnl DEALINGS IN THE SOFTWARE.
1449273c00b8Smrg
1450273c00b8Smrg# XORG_MACROS_VERSION(required-version)
1451273c00b8Smrg# -------------------------------------
1452273c00b8Smrg# Minimum version: 1.1.0
14538abc0ccfSmrg#
1454273c00b8Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455273c00b8Smrg# your configure.ac with the minimum required version, such as:
1456273c00b8Smrg# XORG_MACROS_VERSION(1.1)
14578abc0ccfSmrg#
1458273c00b8Smrg# To ensure that this macro is defined, also add:
1459273c00b8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460273c00b8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14618abc0ccfSmrg#
1462273c00b8Smrg#
1463273c00b8Smrg# See the "minimum version" comment for each macro you use to see what
1464273c00b8Smrg# version you require.
1465273c00b8Smrgm4_defun([XORG_MACROS_VERSION],[
1466273c00b8Smrgm4_define([vers_have], [1.20.0])
1467273c00b8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468273c00b8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469273c00b8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470273c00b8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471273c00b8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472273c00b8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473273c00b8Smrgm4_undefine([vers_have])
1474273c00b8Smrgm4_undefine([maj_have])
1475273c00b8Smrgm4_undefine([maj_needed])
1476273c00b8Smrg]) # XORG_MACROS_VERSION
14778abc0ccfSmrg
1478273c00b8Smrg# XORG_PROG_RAWCPP()
1479273c00b8Smrg# ------------------
1480273c00b8Smrg# Minimum version: 1.0.0
1481273c00b8Smrg#
1482273c00b8Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483273c00b8Smrg# such as man pages and config files
1484273c00b8SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485273c00b8SmrgAC_REQUIRE([AC_PROG_CPP])
1486273c00b8SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487273c00b8Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14888abc0ccfSmrg
1489273c00b8Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490273c00b8Smrg# which is not the best choice for supporting other OS'es, but covers most
1491273c00b8Smrg# of the ones we need for now.
1492273c00b8SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493273c00b8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494273c00b8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495273c00b8Smrg	AC_MSG_RESULT([no])
1496273c00b8Smrgelse
1497273c00b8Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498273c00b8Smrg		RAWCPPFLAGS=-undef
1499273c00b8Smrg		AC_MSG_RESULT([yes])
1500273c00b8Smrg	# under Cygwin unix is still defined even with -undef
1501273c00b8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502273c00b8Smrg		RAWCPPFLAGS="-undef -ansi"
1503273c00b8Smrg		AC_MSG_RESULT([yes, with -ansi])
1504273c00b8Smrg	else
1505273c00b8Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506273c00b8Smrg	fi
15078abc0ccfSmrgfi
1508273c00b8Smrgrm -f conftest.$ac_ext
15098abc0ccfSmrg
1510273c00b8SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511273c00b8SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512273c00b8Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1513273c00b8Smrg	AC_MSG_RESULT([no])
1514273c00b8Smrgelse
1515273c00b8Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1516273c00b8Smrg		TRADITIONALCPPFLAGS="-traditional"
1517273c00b8Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518273c00b8Smrg		AC_MSG_RESULT([yes])
1519273c00b8Smrg	else
1520273c00b8Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15218abc0ccfSmrg	fi
15228abc0ccfSmrgfi
1523273c00b8Smrgrm -f conftest.$ac_ext
1524273c00b8SmrgAC_SUBST(RAWCPPFLAGS)
1525273c00b8SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526273c00b8Smrg]) # XORG_PROG_RAWCPP
15278abc0ccfSmrg
1528273c00b8Smrg# XORG_MANPAGE_SECTIONS()
1529273c00b8Smrg# -----------------------
1530273c00b8Smrg# Minimum version: 1.0.0
1531273c00b8Smrg#
1532273c00b8Smrg# Determine which sections man pages go in for the different man page types
1533273c00b8Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534273c00b8Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535273c00b8Smrg# Override default settings by setting environment variables
1536273c00b8Smrg# Added MAN_SUBSTS in version 1.8
1537273c00b8Smrg# Added AC_PROG_SED in version 1.8
15388abc0ccfSmrg
1539273c00b8SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540273c00b8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541273c00b8SmrgAC_REQUIRE([AC_PROG_SED])
15428abc0ccfSmrg
1543273c00b8Smrgcase $host_os in
1544273c00b8Smrg    solaris*)
1545273c00b8Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546273c00b8Smrg        # check for a man page file found in later versions that use
1547273c00b8Smrg        # traditional section numbers instead
1548273c00b8Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549273c00b8Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550273c00b8Smrg        ;;
1551273c00b8Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552273c00b8Smrgesac
15538abc0ccfSmrg
1554273c00b8Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555273c00b8Smrg    APP_MAN_SUFFIX=1
1556273c00b8Smrgfi
1557273c00b8Smrgif test x$APP_MAN_DIR = x    ; then
1558273c00b8Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559273c00b8Smrgfi
15608abc0ccfSmrg
1561273c00b8Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562273c00b8Smrg    LIB_MAN_SUFFIX=3
1563273c00b8Smrgfi
1564273c00b8Smrgif test x$LIB_MAN_DIR = x    ; then
1565273c00b8Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566273c00b8Smrgfi
15678abc0ccfSmrg
1568273c00b8Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1570273c00b8Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571273c00b8Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572273c00b8Smrg    esac
1573273c00b8Smrgfi
1574273c00b8Smrgif test x$FILE_MAN_DIR = x    ; then
1575273c00b8Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576273c00b8Smrgfi
15778abc0ccfSmrg
1578273c00b8Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1580273c00b8Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581273c00b8Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582273c00b8Smrg    esac
1583273c00b8Smrgfi
1584273c00b8Smrgif test x$MISC_MAN_DIR = x    ; then
1585273c00b8Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586273c00b8Smrgfi
15878abc0ccfSmrg
1588273c00b8Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1590273c00b8Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591273c00b8Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592273c00b8Smrg    esac
1593273c00b8Smrgfi
1594273c00b8Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595273c00b8Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596273c00b8Smrgfi
15978abc0ccfSmrg
1598273c00b8Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599273c00b8Smrg    case $SYSV_MAN_SECTIONS in
1600273c00b8Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601273c00b8Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602273c00b8Smrg    esac
1603273c00b8Smrgfi
1604273c00b8Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605273c00b8Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16068abc0ccfSmrgfi
16078abc0ccfSmrg
16088abc0ccfSmrg
1609273c00b8SmrgAC_SUBST([APP_MAN_SUFFIX])
1610273c00b8SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611273c00b8SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612273c00b8SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613273c00b8SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614273c00b8SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615273c00b8SmrgAC_SUBST([APP_MAN_DIR])
1616273c00b8SmrgAC_SUBST([LIB_MAN_DIR])
1617273c00b8SmrgAC_SUBST([FILE_MAN_DIR])
1618273c00b8SmrgAC_SUBST([MISC_MAN_DIR])
1619273c00b8SmrgAC_SUBST([DRIVER_MAN_DIR])
1620273c00b8SmrgAC_SUBST([ADMIN_MAN_DIR])
16218abc0ccfSmrg
1622273c00b8SmrgXORG_MAN_PAGE="X Version 11"
1623273c00b8SmrgAC_SUBST([XORG_MAN_PAGE])
1624273c00b8SmrgMAN_SUBSTS="\
1625273c00b8Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626273c00b8Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627273c00b8Smrg	-e 's|__xservername__|Xorg|g' \
1628273c00b8Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629273c00b8Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630273c00b8Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631273c00b8Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632273c00b8Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633273c00b8Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634273c00b8Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635273c00b8Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636273c00b8Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637273c00b8SmrgAC_SUBST([MAN_SUBSTS])
16388abc0ccfSmrg
1639273c00b8Smrg]) # XORG_MANPAGE_SECTIONS
16408abc0ccfSmrg
1641273c00b8Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642273c00b8Smrg# ------------------------
1643273c00b8Smrg# Minimum version: 1.7.0
1644273c00b8Smrg#
1645273c00b8Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646273c00b8Smrg# provided by xorg-sgml-doctools, if installed.
1647273c00b8SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648273c00b8SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649273c00b8SmrgXORG_SGML_PATH=
1650273c00b8SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651273c00b8Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652273c00b8Smrg    [m4_ifval([$1],[:],
1653273c00b8Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654273c00b8Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655273c00b8Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656273c00b8Smrg         fi])
1657273c00b8Smrg    ])
16588abc0ccfSmrg
1659273c00b8Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660273c00b8Smrg# the path and the name of the doc stylesheet
1661273c00b8Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662273c00b8Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663273c00b8Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664273c00b8Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16658abc0ccfSmrgelse
1666273c00b8Smrg   AC_MSG_RESULT([no])
16678abc0ccfSmrgfi
16688abc0ccfSmrg
1669273c00b8SmrgAC_SUBST(XORG_SGML_PATH)
1670273c00b8SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671273c00b8SmrgAC_SUBST(XSL_STYLESHEET)
1672273c00b8SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673273c00b8Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16748abc0ccfSmrg
1675273c00b8Smrg# XORG_CHECK_LINUXDOC
1676273c00b8Smrg# -------------------
1677273c00b8Smrg# Minimum version: 1.0.0
16788abc0ccfSmrg#
1679273c00b8Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680273c00b8Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681273c00b8Smrg# Whether or not the necessary tools and files are found can be checked
1682273c00b8Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683273c00b8SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684273c00b8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685273c00b8SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16868abc0ccfSmrg
1687273c00b8SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16888abc0ccfSmrg
1689273c00b8SmrgAC_MSG_CHECKING([whether to build documentation])
16908abc0ccfSmrg
1691273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692273c00b8Smrg   BUILDDOC=yes
1693273c00b8Smrgelse
1694273c00b8Smrg   BUILDDOC=no
1695273c00b8Smrgfi
16968abc0ccfSmrg
1697273c00b8SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16988abc0ccfSmrg
1699273c00b8SmrgAC_MSG_RESULT([$BUILDDOC])
17008abc0ccfSmrg
1701273c00b8SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702273c00b8Smrg
1703273c00b8Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704273c00b8Smrg   BUILDPDFDOC=yes
1705273c00b8Smrgelse
1706273c00b8Smrg   BUILDPDFDOC=no
17078abc0ccfSmrgfi
17088abc0ccfSmrg
1709273c00b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17108abc0ccfSmrg
1711273c00b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17128abc0ccfSmrg
1713273c00b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714273c00b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715273c00b8SmrgMAKE_PDF="$PS2PDF"
1716273c00b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171740c5344fSmrg
1718273c00b8SmrgAC_SUBST(MAKE_TEXT)
1719273c00b8SmrgAC_SUBST(MAKE_PS)
1720273c00b8SmrgAC_SUBST(MAKE_PDF)
1721273c00b8SmrgAC_SUBST(MAKE_HTML)
1722273c00b8Smrg]) # XORG_CHECK_LINUXDOC
17238abc0ccfSmrg
1724273c00b8Smrg# XORG_CHECK_DOCBOOK
1725273c00b8Smrg# -------------------
1726273c00b8Smrg# Minimum version: 1.0.0
17278abc0ccfSmrg#
1728273c00b8Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729273c00b8Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730273c00b8Smrg# indicates whether the necessary tools and files are found and, if set,
1731273c00b8Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732273c00b8SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733273c00b8SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17348abc0ccfSmrg
1735273c00b8SmrgBUILDTXTDOC=no
1736273c00b8SmrgBUILDPDFDOC=no
1737273c00b8SmrgBUILDPSDOC=no
1738273c00b8SmrgBUILDHTMLDOC=no
17398abc0ccfSmrg
1740273c00b8SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741273c00b8SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742273c00b8SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743273c00b8SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17448abc0ccfSmrg
1745273c00b8SmrgAC_MSG_CHECKING([whether to build text documentation])
1746273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747273c00b8Smrg   test x$BUILD_TXTDOC != xno; then
1748273c00b8Smrg	BUILDTXTDOC=yes
1749273c00b8Smrgfi
1750273c00b8SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751273c00b8SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17528abc0ccfSmrg
1753273c00b8SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755273c00b8Smrg   test x$BUILD_PDFDOC != xno; then
1756273c00b8Smrg	BUILDPDFDOC=yes
1757273c00b8Smrgfi
1758273c00b8SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759273c00b8SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17608abc0ccfSmrg
1761273c00b8SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763273c00b8Smrg   test x$BUILD_PSDOC != xno; then
1764273c00b8Smrg	BUILDPSDOC=yes
1765273c00b8Smrgfi
1766273c00b8SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767273c00b8SmrgAC_MSG_RESULT([$BUILDPSDOC])
17688abc0ccfSmrg
1769273c00b8SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770273c00b8Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771273c00b8Smrg   test x$BUILD_HTMLDOC != xno; then
1772273c00b8Smrg	BUILDHTMLDOC=yes
1773273c00b8Smrgfi
1774273c00b8SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775273c00b8SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17769a011757Smrg
1777273c00b8SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778273c00b8SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779273c00b8SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780273c00b8SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17819a011757Smrg
1782273c00b8SmrgAC_SUBST(MAKE_TEXT)
1783273c00b8SmrgAC_SUBST(MAKE_PS)
1784273c00b8SmrgAC_SUBST(MAKE_PDF)
1785273c00b8SmrgAC_SUBST(MAKE_HTML)
1786273c00b8Smrg]) # XORG_CHECK_DOCBOOK
17878abc0ccfSmrg
1788273c00b8Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789273c00b8Smrg# ----------------
1790273c00b8Smrg# Minimum version: 1.5.0
1791273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792273c00b8Smrg#
1793273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
1794273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
1795273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796273c00b8Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797273c00b8Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798273c00b8Smrg# --with-xmlto assumes 'auto'.
1799273c00b8Smrg#
1800273c00b8Smrg# Interface to module:
1801273c00b8Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802273c00b8Smrg# XMLTO:	returns the path of the xmlto program found
1803273c00b8Smrg#		returns the path set by the user in the environment
1804273c00b8Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805273c00b8Smrg#		'no' user instructs the module not to use xmlto
1806273c00b8Smrg#
1807273c00b8Smrg# Added in version 1.10.0
1808273c00b8Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809273c00b8Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810273c00b8Smrg#
1811273c00b8Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812273c00b8Smrg#
1813273c00b8SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814273c00b8SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816273c00b8SmrgAC_ARG_WITH(xmlto,
1817273c00b8Smrg	AS_HELP_STRING([--with-xmlto],
1818273c00b8Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819273c00b8Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820273c00b8Smrgm4_undefine([_defopt])
1821273c00b8Smrg
1822273c00b8Smrgif test "x$use_xmlto" = x"auto"; then
1823273c00b8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824273c00b8Smrg   if test "x$XMLTO" = "x"; then
1825273c00b8Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826273c00b8Smrg	have_xmlto=no
1827273c00b8Smrg   else
1828273c00b8Smrg        have_xmlto=yes
1829273c00b8Smrg   fi
1830273c00b8Smrgelif test "x$use_xmlto" = x"yes" ; then
1831273c00b8Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832273c00b8Smrg   if test "x$XMLTO" = "x"; then
1833273c00b8Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834273c00b8Smrg   fi
1835273c00b8Smrg   have_xmlto=yes
1836273c00b8Smrgelif test "x$use_xmlto" = x"no" ; then
1837273c00b8Smrg   if test "x$XMLTO" != "x"; then
1838273c00b8Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839273c00b8Smrg   fi
1840273c00b8Smrg   have_xmlto=no
1841273c00b8Smrgelse
1842273c00b8Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843273c00b8Smrgfi
1844273c00b8Smrg
1845273c00b8Smrg# Test for a minimum version of xmlto, if provided.
1846273c00b8Smrgm4_ifval([$1],
1847273c00b8Smrg[if test "$have_xmlto" = yes; then
1848273c00b8Smrg    # scrape the xmlto version
1849273c00b8Smrg    AC_MSG_CHECKING([the xmlto version])
1850273c00b8Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851273c00b8Smrg    AC_MSG_RESULT([$xmlto_version])
1852273c00b8Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853273c00b8Smrg        [if test "x$use_xmlto" = xauto; then
1854273c00b8Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855273c00b8Smrg            have_xmlto=no
1856273c00b8Smrg        else
1857273c00b8Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858273c00b8Smrg        fi])
1859273c00b8Smrgfi])
1860273c00b8Smrg
1861273c00b8Smrg# Test for the ability of xmlto to generate a text target
1862273c00b8Smrg#
1863273c00b8Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864273c00b8Smrg# following test for empty XML docbook files.
1865273c00b8Smrg# For compatibility reasons use the following empty XML docbook file and if
1866273c00b8Smrg# it fails try it again with a non-empty XML file.
1867273c00b8Smrghave_xmlto_text=no
1868273c00b8Smrgcat > conftest.xml << "EOF"
1869273c00b8SmrgEOF
1870273c00b8SmrgAS_IF([test "$have_xmlto" = yes],
1871273c00b8Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872273c00b8Smrg             [have_xmlto_text=yes],
1873273c00b8Smrg             [# Try it again with a non-empty XML file.
1874273c00b8Smrg              cat > conftest.xml << "EOF"
1875273c00b8Smrg<x></x>
1876273c00b8SmrgEOF
1877273c00b8Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878273c00b8Smrg                    [have_xmlto_text=yes],
1879273c00b8Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880273c00b8Smrgrm -f conftest.xml
1881273c00b8SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882273c00b8SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883273c00b8Smrg]) # XORG_WITH_XMLTO
18848abc0ccfSmrg
1885273c00b8Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886273c00b8Smrg# --------------------------------------------
1887273c00b8Smrg# Minimum version: 1.12.0
1888273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889273c00b8Smrg#
1890273c00b8Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891273c00b8Smrg# XML-based language used for the transformation of XML documents.
1892273c00b8Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893273c00b8Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894273c00b8Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895273c00b8Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896273c00b8Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897273c00b8Smrg#
1898273c00b8Smrg# Interface to module:
1899273c00b8Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900273c00b8Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901273c00b8Smrg#		 returns the path set by the user in the environment
1902273c00b8Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903273c00b8Smrg#		  'no' user instructs the module not to use xsltproc
1904273c00b8Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905273c00b8Smrg#
1906273c00b8Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907273c00b8Smrg#
1908273c00b8SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909273c00b8SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910273c00b8Smrg# Preserves the interface, should it be implemented later
1911273c00b8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913273c00b8SmrgAC_ARG_WITH(xsltproc,
1914273c00b8Smrg	AS_HELP_STRING([--with-xsltproc],
1915273c00b8Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916273c00b8Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917273c00b8Smrgm4_undefine([_defopt])
19180d22642bSmrg
1919273c00b8Smrgif test "x$use_xsltproc" = x"auto"; then
1920273c00b8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921273c00b8Smrg   if test "x$XSLTPROC" = "x"; then
1922273c00b8Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923273c00b8Smrg	have_xsltproc=no
1924273c00b8Smrg   else
1925273c00b8Smrg        have_xsltproc=yes
1926273c00b8Smrg   fi
1927273c00b8Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928273c00b8Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929273c00b8Smrg   if test "x$XSLTPROC" = "x"; then
1930273c00b8Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931273c00b8Smrg   fi
1932273c00b8Smrg   have_xsltproc=yes
1933273c00b8Smrgelif test "x$use_xsltproc" = x"no" ; then
1934273c00b8Smrg   if test "x$XSLTPROC" != "x"; then
1935273c00b8Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936273c00b8Smrg   fi
1937273c00b8Smrg   have_xsltproc=no
1938273c00b8Smrgelse
1939273c00b8Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940273c00b8Smrgfi
19418abc0ccfSmrg
1942273c00b8SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943273c00b8Smrg]) # XORG_WITH_XSLTPROC
19448abc0ccfSmrg
1945273c00b8Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946273c00b8Smrg# ----------------------------------------
1947273c00b8Smrg# Minimum version: 1.15.0
1948273c00b8Smrg#
1949273c00b8Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950273c00b8Smrg# scanning arbitrary text files, extracting information from those text files,
1951273c00b8Smrg# and printing reports based on that information.
1952273c00b8Smrg#
1953273c00b8Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954273c00b8Smrg#
1955273c00b8Smrg# Interface to module:
1956273c00b8Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957273c00b8Smrg# PERL:	     returns the path of the perl program found
1958273c00b8Smrg#	     returns the path set by the user in the environment
1959273c00b8Smrg# --with-perl: 'yes' user instructs the module to use perl
1960273c00b8Smrg#	       'no' user instructs the module not to use perl
1961273c00b8Smrg# have_perl: returns yes if perl found in PATH or no
1962273c00b8Smrg#
1963273c00b8Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964273c00b8Smrg#
1965273c00b8SmrgAC_DEFUN([XORG_WITH_PERL],[
1966273c00b8SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967273c00b8Smrg# Preserves the interface, should it be implemented later
1968273c00b8Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970273c00b8SmrgAC_ARG_WITH(perl,
1971273c00b8Smrg	AS_HELP_STRING([--with-perl],
1972273c00b8Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973273c00b8Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974273c00b8Smrgm4_undefine([_defopt])
19758abc0ccfSmrg
1976273c00b8Smrgif test "x$use_perl" = x"auto"; then
1977273c00b8Smrg   AC_PATH_PROG([PERL], [perl])
1978273c00b8Smrg   if test "x$PERL" = "x"; then
1979273c00b8Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980273c00b8Smrg	have_perl=no
1981273c00b8Smrg   else
1982273c00b8Smrg        have_perl=yes
1983273c00b8Smrg   fi
1984273c00b8Smrgelif test "x$use_perl" = x"yes" ; then
1985273c00b8Smrg   AC_PATH_PROG([PERL], [perl])
1986273c00b8Smrg   if test "x$PERL" = "x"; then
1987273c00b8Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988273c00b8Smrg   fi
1989273c00b8Smrg   have_perl=yes
1990273c00b8Smrgelif test "x$use_perl" = x"no" ; then
1991273c00b8Smrg   if test "x$PERL" != "x"; then
1992273c00b8Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993273c00b8Smrg   fi
1994273c00b8Smrg   have_perl=no
1995273c00b8Smrgelse
1996273c00b8Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997273c00b8Smrgfi
19988abc0ccfSmrg
1999273c00b8SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000273c00b8Smrg]) # XORG_WITH_PERL
20018abc0ccfSmrg
2002273c00b8Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003273c00b8Smrg# ----------------
2004273c00b8Smrg# Minimum version: 1.5.0
2005273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20068abc0ccfSmrg#
2007273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2008273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2009273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010273c00b8Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011273c00b8Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012273c00b8Smrg# --with-asciidoc assumes 'auto'.
2013273c00b8Smrg#
2014273c00b8Smrg# Interface to module:
2015273c00b8Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016273c00b8Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017273c00b8Smrg#		 returns the path set by the user in the environment
2018273c00b8Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019273c00b8Smrg#		  'no' user instructs the module not to use asciidoc
2020273c00b8Smrg#
2021273c00b8Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022273c00b8Smrg#
2023273c00b8SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024273c00b8SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026273c00b8SmrgAC_ARG_WITH(asciidoc,
2027273c00b8Smrg	AS_HELP_STRING([--with-asciidoc],
2028273c00b8Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029273c00b8Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030273c00b8Smrgm4_undefine([_defopt])
20318abc0ccfSmrg
2032273c00b8Smrgif test "x$use_asciidoc" = x"auto"; then
2033273c00b8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034273c00b8Smrg   if test "x$ASCIIDOC" = "x"; then
2035273c00b8Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036273c00b8Smrg	have_asciidoc=no
2037273c00b8Smrg   else
2038273c00b8Smrg        have_asciidoc=yes
2039273c00b8Smrg   fi
2040273c00b8Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041273c00b8Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042273c00b8Smrg   if test "x$ASCIIDOC" = "x"; then
2043273c00b8Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044273c00b8Smrg   fi
2045273c00b8Smrg   have_asciidoc=yes
2046273c00b8Smrgelif test "x$use_asciidoc" = x"no" ; then
2047273c00b8Smrg   if test "x$ASCIIDOC" != "x"; then
2048273c00b8Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049273c00b8Smrg   fi
2050273c00b8Smrg   have_asciidoc=no
2051273c00b8Smrgelse
2052273c00b8Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053273c00b8Smrgfi
2054273c00b8Smrgm4_ifval([$1],
2055273c00b8Smrg[if test "$have_asciidoc" = yes; then
2056273c00b8Smrg    # scrape the asciidoc version
2057273c00b8Smrg    AC_MSG_CHECKING([the asciidoc version])
2058273c00b8Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059273c00b8Smrg    AC_MSG_RESULT([$asciidoc_version])
2060273c00b8Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061273c00b8Smrg        [if test "x$use_asciidoc" = xauto; then
2062273c00b8Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063273c00b8Smrg            have_asciidoc=no
2064273c00b8Smrg        else
2065273c00b8Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066273c00b8Smrg        fi])
2067273c00b8Smrgfi])
2068273c00b8SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069273c00b8Smrg]) # XORG_WITH_ASCIIDOC
2070273c00b8Smrg
2071273c00b8Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072273c00b8Smrg# -------------------------------------------
2073273c00b8Smrg# Minimum version: 1.5.0
2074273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075273c00b8Smrg# Minimum version for optional DOT checking: 1.18.0
2076273c00b8Smrg#
2077273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2078273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2079273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080273c00b8Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081273c00b8Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082273c00b8Smrg# --with-doxygen assumes 'auto'.
2083273c00b8Smrg#
2084273c00b8Smrg# Interface to module:
2085273c00b8Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086273c00b8Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087273c00b8Smrg#		 returns the path set by the user in the environment
2088273c00b8Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089273c00b8Smrg#		  'no' user instructs the module not to use doxygen
2090273c00b8Smrg#
2091273c00b8Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092273c00b8Smrg#
2093273c00b8SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094273c00b8SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095273c00b8SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097273c00b8SmrgAC_ARG_WITH(doxygen,
2098273c00b8Smrg	AS_HELP_STRING([--with-doxygen],
2099273c00b8Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100273c00b8Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101273c00b8Smrgm4_undefine([_defopt])
21028abc0ccfSmrg
2103273c00b8Smrgif test "x$use_doxygen" = x"auto"; then
2104273c00b8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105273c00b8Smrg   if test "x$DOXYGEN" = "x"; then
2106273c00b8Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107273c00b8Smrg	have_doxygen=no
2108273c00b8Smrg   else
2109273c00b8Smrg        have_doxygen=yes
2110273c00b8Smrg   fi
2111273c00b8Smrgelif test "x$use_doxygen" = x"yes" ; then
2112273c00b8Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113273c00b8Smrg   if test "x$DOXYGEN" = "x"; then
2114273c00b8Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115273c00b8Smrg   fi
2116273c00b8Smrg   have_doxygen=yes
2117273c00b8Smrgelif test "x$use_doxygen" = x"no" ; then
2118273c00b8Smrg   if test "x$DOXYGEN" != "x"; then
2119273c00b8Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120273c00b8Smrg   fi
2121273c00b8Smrg   have_doxygen=no
2122273c00b8Smrgelse
2123273c00b8Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124273c00b8Smrgfi
2125273c00b8Smrgm4_ifval([$1],
2126273c00b8Smrg[if test "$have_doxygen" = yes; then
2127273c00b8Smrg    # scrape the doxygen version
2128273c00b8Smrg    AC_MSG_CHECKING([the doxygen version])
2129273c00b8Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130273c00b8Smrg    AC_MSG_RESULT([$doxygen_version])
2131273c00b8Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132273c00b8Smrg        [if test "x$use_doxygen" = xauto; then
2133273c00b8Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134273c00b8Smrg            have_doxygen=no
2135273c00b8Smrg        else
2136273c00b8Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137273c00b8Smrg        fi])
2138273c00b8Smrgfi])
21398abc0ccfSmrg
2140273c00b8Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141273c00b8Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142273c00b8Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143273c00b8SmrgHAVE_DOT=no
2144273c00b8Smrgif test "x$have_doxygen" = "xyes"; then
2145273c00b8Smrg  AC_PATH_PROG([DOT], [dot])
2146273c00b8Smrg    if test "x$DOT" != "x"; then
2147273c00b8Smrg      HAVE_DOT=yes
2148273c00b8Smrg    fi
2149273c00b8Smrgfi
21508abc0ccfSmrg
2151273c00b8SmrgAC_SUBST([HAVE_DOT])
2152273c00b8SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153273c00b8SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154273c00b8Smrg]) # XORG_WITH_DOXYGEN
21558abc0ccfSmrg
2156273c00b8Smrg# XORG_WITH_GROFF([DEFAULT])
2157273c00b8Smrg# ----------------
2158273c00b8Smrg# Minimum version: 1.6.0
2159273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216096402570Smrg#
2161273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2162273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2163273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164273c00b8Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165273c00b8Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166273c00b8Smrg# --with-groff assumes 'auto'.
21672852888eSmrg#
2168273c00b8Smrg# Interface to module:
2169273c00b8Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170273c00b8Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171273c00b8Smrg# HAVE_GROFF_MS: the -ms macros package
2172273c00b8Smrg# GROFF:	 returns the path of the groff program found
2173273c00b8Smrg#		 returns the path set by the user in the environment
2174273c00b8Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175273c00b8Smrg#		 'no' user instructs the module not to use groff
21762852888eSmrg#
2177273c00b8Smrg# Added in version 1.9.0:
2178273c00b8Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179273c00b8Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180273c00b8Smrg#		   psselect from the psutils package.
2181273c00b8Smrg#		   the ghostcript package. Refer to the grohtml man pages
21822852888eSmrg#
2183273c00b8Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218496402570Smrg#
2185273c00b8Smrg# OS and distros often splits groff in a basic and full package, the former
2186273c00b8Smrg# having the groff program and the later having devices, fonts and macros
2187273c00b8Smrg# Checking for the groff executable is not enough.
21882852888eSmrg#
2189273c00b8Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190273c00b8Smrg# unset HAVE_GROFF or GROFF env variables.
2191273c00b8Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21928abc0ccfSmrg#
2193273c00b8SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194273c00b8SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196273c00b8SmrgAC_ARG_WITH(groff,
2197273c00b8Smrg	AS_HELP_STRING([--with-groff],
2198273c00b8Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199273c00b8Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200273c00b8Smrgm4_undefine([_defopt])
22012852888eSmrg
2202273c00b8Smrgif test "x$use_groff" = x"auto"; then
2203273c00b8Smrg   AC_PATH_PROG([GROFF], [groff])
2204273c00b8Smrg   if test "x$GROFF" = "x"; then
2205273c00b8Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206273c00b8Smrg	have_groff=no
2207273c00b8Smrg   else
2208273c00b8Smrg        have_groff=yes
2209273c00b8Smrg   fi
2210273c00b8Smrgelif test "x$use_groff" = x"yes" ; then
2211273c00b8Smrg   AC_PATH_PROG([GROFF], [groff])
2212273c00b8Smrg   if test "x$GROFF" = "x"; then
2213273c00b8Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214273c00b8Smrg   fi
2215273c00b8Smrg   have_groff=yes
2216273c00b8Smrgelif test "x$use_groff" = x"no" ; then
2217273c00b8Smrg   if test "x$GROFF" != "x"; then
2218273c00b8Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219273c00b8Smrg   fi
2220273c00b8Smrg   have_groff=no
22218abc0ccfSmrgelse
2222273c00b8Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22238abc0ccfSmrgfi
22248abc0ccfSmrg
2225273c00b8Smrg# We have groff, test for the presence of the macro packages
2226273c00b8Smrgif test "x$have_groff" = x"yes"; then
2227273c00b8Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228273c00b8Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229273c00b8Smrg        groff_ms_works=yes
2230273c00b8Smrg    else
2231273c00b8Smrg        groff_ms_works=no
2232273c00b8Smrg    fi
2233273c00b8Smrg    AC_MSG_RESULT([$groff_ms_works])
2234273c00b8Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235273c00b8Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236273c00b8Smrg        groff_mm_works=yes
2237273c00b8Smrg    else
2238273c00b8Smrg        groff_mm_works=no
2239273c00b8Smrg    fi
2240273c00b8Smrg    AC_MSG_RESULT([$groff_mm_works])
2241273c00b8Smrgfi
22428abc0ccfSmrg
2243273c00b8Smrg# We have groff, test for HTML dependencies, one command per package
2244273c00b8Smrgif test "x$have_groff" = x"yes"; then
2245273c00b8Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246273c00b8Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247273c00b8Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248273c00b8Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249273c00b8Smrg      have_groff_html=yes
2250273c00b8Smrg   else
2251273c00b8Smrg      have_groff_html=no
2252273c00b8Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253273c00b8Smrg   fi
2254273c00b8Smrgfi
22558abc0ccfSmrg
2256273c00b8Smrg# Set Automake conditionals for Makefiles
2257273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260273c00b8SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261273c00b8Smrg]) # XORG_WITH_GROFF
22628abc0ccfSmrg
2263273c00b8Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264273c00b8Smrg# ---------------------------------------
2265273c00b8Smrg# Minimum version: 1.6.0
2266273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267273c00b8Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268273c00b8Smrg#
2269273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2270273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2271273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272273c00b8Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273273c00b8Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274273c00b8Smrg# --with-fop assumes 'auto'.
2275273c00b8Smrg#
2276273c00b8Smrg# Interface to module:
2277273c00b8Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278273c00b8Smrg# FOP:	 	returns the path of the fop program found
2279273c00b8Smrg#		returns the path set by the user in the environment
2280273c00b8Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281273c00b8Smrg#		'no' user instructs the module not to use fop
2282273c00b8Smrg#
2283273c00b8Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284273c00b8Smrg#
2285273c00b8SmrgAC_DEFUN([XORG_WITH_FOP],[
2286273c00b8SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288273c00b8SmrgAC_ARG_WITH(fop,
2289273c00b8Smrg	AS_HELP_STRING([--with-fop],
2290273c00b8Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291273c00b8Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292273c00b8Smrgm4_undefine([_defopt])
22932852888eSmrg
2294273c00b8Smrgif test "x$use_fop" = x"auto"; then
2295273c00b8Smrg   AC_PATH_PROG([FOP], [fop])
2296273c00b8Smrg   if test "x$FOP" = "x"; then
2297273c00b8Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298273c00b8Smrg	have_fop=no
2299273c00b8Smrg   else
2300273c00b8Smrg        have_fop=yes
2301273c00b8Smrg   fi
2302273c00b8Smrgelif test "x$use_fop" = x"yes" ; then
2303273c00b8Smrg   AC_PATH_PROG([FOP], [fop])
2304273c00b8Smrg   if test "x$FOP" = "x"; then
2305273c00b8Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306273c00b8Smrg   fi
2307273c00b8Smrg   have_fop=yes
2308273c00b8Smrgelif test "x$use_fop" = x"no" ; then
2309273c00b8Smrg   if test "x$FOP" != "x"; then
2310273c00b8Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311273c00b8Smrg   fi
2312273c00b8Smrg   have_fop=no
23132852888eSmrgelse
2314273c00b8Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23152852888eSmrgfi
23162852888eSmrg
2317273c00b8Smrg# Test for a minimum version of fop, if provided.
2318273c00b8Smrgm4_ifval([$1],
2319273c00b8Smrg[if test "$have_fop" = yes; then
2320273c00b8Smrg    # scrape the fop version
2321273c00b8Smrg    AC_MSG_CHECKING([for fop minimum version])
2322273c00b8Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323273c00b8Smrg    AC_MSG_RESULT([$fop_version])
2324273c00b8Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325273c00b8Smrg        [if test "x$use_fop" = xauto; then
2326273c00b8Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327273c00b8Smrg            have_fop=no
2328273c00b8Smrg        else
2329273c00b8Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330273c00b8Smrg        fi])
2331273c00b8Smrgfi])
2332273c00b8SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333273c00b8Smrg]) # XORG_WITH_FOP
233496402570Smrg
2335273c00b8Smrg# XORG_WITH_M4([MIN-VERSION])
2336273c00b8Smrg# ---------------------------
2337273c00b8Smrg# Minimum version: 1.19.0
2338273c00b8Smrg#
2339273c00b8Smrg# This macro attempts to locate an m4 macro processor which supports
2340273c00b8Smrg# -I option and is only useful for modules relying on M4 in order to
2341273c00b8Smrg# expand macros in source code files.
2342273c00b8Smrg#
2343273c00b8Smrg# Interface to module:
2344273c00b8Smrg# M4:	 	returns the path of the m4 program found
2345273c00b8Smrg#		returns the path set by the user in the environment
2346273c00b8Smrg#
2347273c00b8SmrgAC_DEFUN([XORG_WITH_M4], [
2348273c00b8SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349273c00b8Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350273c00b8Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351273c00b8Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352273c00b8Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353273c00b8Smrg   [$PATH:/usr/gnu/bin])])
2354273c00b8Smrg
2355273c00b8SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356273c00b8Smrg]) # XORG_WITH_M4
235796402570Smrg
2358273c00b8Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359273c00b8Smrg# ----------------
2360273c00b8Smrg# Minimum version: 1.6.0
2361273c00b8Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362273c00b8Smrg#
2363273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2364273c00b8Smrg# not at the appropriate level. This macro enables a module to test for the
2365273c00b8Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366273c00b8Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367273c00b8Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368273c00b8Smrg# --with-ps2pdf assumes 'auto'.
2369273c00b8Smrg#
2370273c00b8Smrg# Interface to module:
2371273c00b8Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372273c00b8Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373273c00b8Smrg#		returns the path set by the user in the environment
2374273c00b8Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375273c00b8Smrg#		 'no' user instructs the module not to use ps2pdf
2376273c00b8Smrg#
2377273c00b8Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378273c00b8Smrg#
2379273c00b8SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380273c00b8SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382273c00b8SmrgAC_ARG_WITH(ps2pdf,
2383273c00b8Smrg	AS_HELP_STRING([--with-ps2pdf],
2384273c00b8Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385273c00b8Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386273c00b8Smrgm4_undefine([_defopt])
238796402570Smrg
2388273c00b8Smrgif test "x$use_ps2pdf" = x"auto"; then
2389273c00b8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390273c00b8Smrg   if test "x$PS2PDF" = "x"; then
2391273c00b8Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392273c00b8Smrg	have_ps2pdf=no
2393273c00b8Smrg   else
2394273c00b8Smrg        have_ps2pdf=yes
2395273c00b8Smrg   fi
2396273c00b8Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397273c00b8Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398273c00b8Smrg   if test "x$PS2PDF" = "x"; then
2399273c00b8Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400273c00b8Smrg   fi
2401273c00b8Smrg   have_ps2pdf=yes
2402273c00b8Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403273c00b8Smrg   if test "x$PS2PDF" != "x"; then
2404273c00b8Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405273c00b8Smrg   fi
2406273c00b8Smrg   have_ps2pdf=no
2407273c00b8Smrgelse
2408273c00b8Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240996402570Smrgfi
2410273c00b8SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411273c00b8Smrg]) # XORG_WITH_PS2PDF
241296402570Smrg
2413273c00b8Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414273c00b8Smrg# ----------------
2415273c00b8Smrg# Minimum version: 1.6.0
2416273c00b8Smrg#
2417273c00b8Smrg# Documentation tools are not always available on all platforms and sometimes
2418273c00b8Smrg# not at the appropriate level. This macro enables a builder to skip all
2419273c00b8Smrg# documentation targets except traditional man pages.
2420273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421273c00b8Smrg# maximum flexibility in controlling documentation building.
2422273c00b8Smrg# Refer to:
2423273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2424273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426273c00b8Smrg# XORG_WITH_FOP           --with-fop
2427273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2428273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429273c00b8Smrg#
2430273c00b8Smrg# Interface to module:
2431273c00b8Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432273c00b8Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433273c00b8Smrg#		 'no' user instructs the module not to generate docs
2434273c00b8Smrg# parm1:	specify the default value, yes or no.
2435273c00b8Smrg#
2436273c00b8SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437273c00b8Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438273c00b8SmrgAC_ARG_ENABLE(docs,
2439273c00b8Smrg	AS_HELP_STRING([--enable-docs],
2440273c00b8Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441273c00b8Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442273c00b8Smrgm4_undefine([docs_default])
2443273c00b8SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444273c00b8SmrgAC_MSG_CHECKING([whether to build documentation])
2445273c00b8SmrgAC_MSG_RESULT([$build_docs])
2446273c00b8Smrg]) # XORG_ENABLE_DOCS
244796402570Smrg
2448273c00b8Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449273c00b8Smrg# ----------------
2450273c00b8Smrg# Minimum version: 1.6.0
24517a0395d0Smrg#
2452273c00b8Smrg# This macro enables a builder to skip all developer documentation.
2453273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454273c00b8Smrg# maximum flexibility in controlling documentation building.
2455273c00b8Smrg# Refer to:
2456273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2457273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459273c00b8Smrg# XORG_WITH_FOP           --with-fop
2460273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2461273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462273c00b8Smrg#
2463273c00b8Smrg# Interface to module:
2464273c00b8Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465273c00b8Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466273c00b8Smrg#			'no' user instructs the module not to generate developer docs
2467273c00b8Smrg# parm1:		specify the default value, yes or no.
2468273c00b8Smrg#
2469273c00b8SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470273c00b8Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471273c00b8SmrgAC_ARG_ENABLE(devel-docs,
2472273c00b8Smrg	AS_HELP_STRING([--enable-devel-docs],
2473273c00b8Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474273c00b8Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475273c00b8Smrgm4_undefine([devel_default])
2476273c00b8SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477273c00b8SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478273c00b8SmrgAC_MSG_RESULT([$build_devel_docs])
2479273c00b8Smrg]) # XORG_ENABLE_DEVEL_DOCS
24807a0395d0Smrg
2481273c00b8Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482273c00b8Smrg# ----------------
2483273c00b8Smrg# Minimum version: 1.6.0
2484273c00b8Smrg#
2485273c00b8Smrg# This macro enables a builder to skip all functional specification targets.
2486273c00b8Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487273c00b8Smrg# maximum flexibility in controlling documentation building.
2488273c00b8Smrg# Refer to:
2489273c00b8Smrg# XORG_WITH_XMLTO         --with-xmlto
2490273c00b8Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491273c00b8Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492273c00b8Smrg# XORG_WITH_FOP           --with-fop
2493273c00b8Smrg# XORG_WITH_GROFF         --with-groff
2494273c00b8Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495273c00b8Smrg#
2496273c00b8Smrg# Interface to module:
2497273c00b8Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498273c00b8Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499273c00b8Smrg#			'no' user instructs the module not to generate specs
2500273c00b8Smrg# parm1:		specify the default value, yes or no.
2501273c00b8Smrg#
2502273c00b8SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503273c00b8Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504273c00b8SmrgAC_ARG_ENABLE(specs,
2505273c00b8Smrg	AS_HELP_STRING([--enable-specs],
2506273c00b8Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507273c00b8Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508273c00b8Smrgm4_undefine([spec_default])
2509273c00b8SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510273c00b8SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511273c00b8SmrgAC_MSG_RESULT([$build_specs])
2512273c00b8Smrg]) # XORG_ENABLE_SPECS
25137a0395d0Smrg
2514273c00b8Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515273c00b8Smrg# ----------------------------------------------
2516273c00b8Smrg# Minimum version: 1.13.0
2517273c00b8Smrg#
2518273c00b8Smrg# This macro enables a builder to enable/disable unit testing
2519273c00b8Smrg# It makes no assumption about the test cases implementation
2520273c00b8Smrg# Test cases may or may not use Automake "Support for test suites"
2521273c00b8Smrg# They may or may not use the software utility library GLib
2522273c00b8Smrg#
2523273c00b8Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524273c00b8Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525273c00b8Smrg# The variable enable_unit_tests is used by other macros in this file.
2526273c00b8Smrg#
2527273c00b8Smrg# Interface to module:
2528273c00b8Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529273c00b8Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530273c00b8Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531273c00b8Smrg#			'no' user instructs the module not to build tests
2532273c00b8Smrg# parm1:		specify the default value, yes or no.
2533273c00b8Smrg#
2534273c00b8SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535273c00b8SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536273c00b8SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537273c00b8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539273c00b8SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540273c00b8Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541273c00b8Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542273c00b8Smrgm4_undefine([_defopt])
2543273c00b8SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544273c00b8SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545273c00b8SmrgAC_MSG_RESULT([$enable_unit_tests])
2546273c00b8Smrg]) # XORG_ENABLE_UNIT_TESTS
25477a0395d0Smrg
2548273c00b8Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549273c00b8Smrg# ------------------------------------------------------
2550273c00b8Smrg# Minimum version: 1.17.0
2551273c00b8Smrg#
2552273c00b8Smrg# This macro enables a builder to enable/disable integration testing
2553273c00b8Smrg# It makes no assumption about the test cases' implementation
2554273c00b8Smrg# Test cases may or may not use Automake "Support for test suites"
2555273c00b8Smrg#
2556273c00b8Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557273c00b8Smrg# usually requires less dependencies and may be built and run under less
2558273c00b8Smrg# stringent environments than integration tests.
2559273c00b8Smrg#
2560273c00b8Smrg# Interface to module:
2561273c00b8Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562273c00b8Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563273c00b8Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564273c00b8Smrg#                             'no' user instructs the module not to build tests
2565273c00b8Smrg# parm1:                      specify the default value, yes or no.
25662adc0320Smrg#
2567273c00b8SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568273c00b8SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569273c00b8Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570273c00b8SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571273c00b8Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572273c00b8Smrg	[enable_integration_tests=$enableval],
2573273c00b8Smrg	[enable_integration_tests=]_defopt)
2574273c00b8Smrgm4_undefine([_defopt])
2575273c00b8SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576273c00b8Smrg	[test "x$enable_integration_tests" != xno])
2577273c00b8SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578273c00b8SmrgAC_MSG_RESULT([$enable_integration_tests])
2579273c00b8Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25808abc0ccfSmrg
2581273c00b8Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582273c00b8Smrg# ----------------------------------------
2583273c00b8Smrg# Minimum version: 1.13.0
25847366012aSmrg#
2585273c00b8Smrg# GLib is a library which provides advanced data structures and functions.
2586273c00b8Smrg# This macro enables a module to test for the presence of Glib.
2587273c00b8Smrg#
2588273c00b8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589273c00b8Smrg# Otherwise the value of $enable_unit_tests is blank.
2590273c00b8Smrg#
2591273c00b8Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592273c00b8Smrg# test support usually requires less dependencies and may be built and run under
2593273c00b8Smrg# less stringent environments than integration tests.
2594273c00b8Smrg#
2595273c00b8Smrg# Interface to module:
2596273c00b8Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597273c00b8Smrg# with_glib: used in configure.ac to know if GLib has been found
2598273c00b8Smrg# --with-glib:	'yes' user instructs the module to use glib
2599273c00b8Smrg#		'no' user instructs the module not to use glib
2600273c00b8Smrg#
2601273c00b8SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602273c00b8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603273c00b8Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604273c00b8SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605273c00b8Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606273c00b8Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607273c00b8Smrgm4_undefine([_defopt])
26082adc0320Smrg
2609273c00b8Smrghave_glib=no
2610273c00b8Smrg# Do not probe GLib if user explicitly disabled unit testing
2611273c00b8Smrgif test "x$enable_unit_tests" != x"no"; then
2612273c00b8Smrg  # Do not probe GLib if user explicitly disabled it
2613273c00b8Smrg  if test "x$with_glib" != x"no"; then
2614273c00b8Smrg    m4_ifval(
2615273c00b8Smrg      [$1],
2616273c00b8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617273c00b8Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618273c00b8Smrg    )
2619273c00b8Smrg  fi
2620273c00b8Smrgfi
262140c5344fSmrg
2622273c00b8Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623273c00b8Smrgif test "x$enable_unit_tests" = x"yes"; then
2624273c00b8Smrg  if test "x$have_glib" = x"no"; then
2625273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26268abc0ccfSmrg  fi
26277366012aSmrgfi
26282adc0320Smrg
2629273c00b8Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630273c00b8Smrgif test "x$enable_unit_tests" = x"no"; then
2631273c00b8Smrg  if test "x$with_glib" = x"yes"; then
2632273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26338abc0ccfSmrg  fi
26347366012aSmrgfi
26357a0395d0Smrg
2636273c00b8Smrg# Not having GLib when it has been explicitly requested is an error
2637273c00b8Smrgif test "x$with_glib" = x"yes"; then
2638273c00b8Smrg  if test "x$have_glib" = x"no"; then
2639273c00b8Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640273c00b8Smrg  fi
2641273c00b8Smrgfi
26422adc0320Smrg
2643273c00b8SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644273c00b8Smrg]) # XORG_WITH_GLIB
26452adc0320Smrg
2646273c00b8Smrg# XORG_LD_WRAP([required|optional])
2647273c00b8Smrg# ---------------------------------
2648273c00b8Smrg# Minimum version: 1.13.0
2649273c00b8Smrg#
2650273c00b8Smrg# Check if linker supports -wrap, passed via compiler flags
2651273c00b8Smrg#
2652273c00b8Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653273c00b8Smrg# Otherwise the value of $enable_unit_tests is blank.
2654273c00b8Smrg#
2655273c00b8Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656273c00b8Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657273c00b8Smrg# available, an argument of "optional" allows use when some unit tests require
2658273c00b8Smrg# ld -wrap and others do not.
2659273c00b8Smrg#
2660273c00b8SmrgAC_DEFUN([XORG_LD_WRAP],[
2661273c00b8SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662273c00b8Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663273c00b8Smrg                      void __wrap_exit(int status) { return; }],
2664273c00b8Smrg                     [exit(0);])])
2665273c00b8Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666273c00b8Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667273c00b8Smrg  if test "x$have_ld_wrap" = x"no"; then
2668273c00b8Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669273c00b8Smrg  fi
2670765b7306Smrgfi
2671273c00b8SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672273c00b8Smrg#
2673273c00b8Smrg]) # XORG_LD_WRAP
2674273c00b8Smrg
2675273c00b8Smrg# XORG_CHECK_LINKER_FLAGS
2676273c00b8Smrg# -----------------------
2677273c00b8Smrg# SYNOPSIS
2678273c00b8Smrg#
2679273c00b8Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680273c00b8Smrg#
2681273c00b8Smrg# DESCRIPTION
2682273c00b8Smrg#
2683273c00b8Smrg#   Check whether the given linker FLAGS work with the current language's
2684273c00b8Smrg#   linker, or whether they give an error.
2685273c00b8Smrg#
2686273c00b8Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687273c00b8Smrg#   success/failure.
2688273c00b8Smrg#
2689273c00b8Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690273c00b8Smrg#
2691273c00b8Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692273c00b8Smrg#
2693273c00b8Smrg# LICENSE
2694273c00b8Smrg#
2695273c00b8Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696273c00b8Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697273c00b8Smrg#   Copyright (c) 2009 Matteo Frigo
2698273c00b8Smrg#
2699273c00b8Smrg#   This program is free software: you can redistribute it and/or modify it
2700273c00b8Smrg#   under the terms of the GNU General Public License as published by the
2701273c00b8Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702273c00b8Smrg#   option) any later version.
2703273c00b8Smrg#
2704273c00b8Smrg#   This program is distributed in the hope that it will be useful, but
2705273c00b8Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706273c00b8Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707273c00b8Smrg#   Public License for more details.
2708273c00b8Smrg#
2709273c00b8Smrg#   You should have received a copy of the GNU General Public License along
2710273c00b8Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711273c00b8Smrg#
2712273c00b8Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713273c00b8Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714273c00b8Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715273c00b8Smrg#   need not follow the terms of the GNU General Public License when using
2716273c00b8Smrg#   or distributing such scripts, even though portions of the text of the
2717273c00b8Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718273c00b8Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719273c00b8Smrg#
2720273c00b8Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721273c00b8Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722273c00b8Smrg#   modified version of the Autoconf Macro, you may extend this special
2723273c00b8Smrg#   exception to the GPL to apply to your modified version as well.#
2724273c00b8SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725273c00b8Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726273c00b8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727273c00b8SmrgAS_LITERAL_IF([$1],
2728273c00b8Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729273c00b8Smrg      ax_save_FLAGS=$LDFLAGS
2730273c00b8Smrg      LDFLAGS="$1"
2731273c00b8Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732273c00b8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733273c00b8Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734273c00b8Smrg      LDFLAGS=$ax_save_FLAGS])],
2735273c00b8Smrg  [ax_save_FLAGS=$LDFLAGS
2736273c00b8Smrg   LDFLAGS="$1"
2737273c00b8Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738273c00b8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739273c00b8Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740273c00b8Smrg   LDFLAGS=$ax_save_FLAGS])
2741273c00b8Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742273c00b8SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743273c00b8Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744273c00b8Smrg	m4_default([$2], :)
2745273c00b8Smrgelse
2746273c00b8Smrg	m4_default([$3], :)
2747765b7306Smrgfi
2748273c00b8Smrg]) # XORG_CHECK_LINKER_FLAGS
274940c5344fSmrg
2750273c00b8Smrg# XORG_MEMORY_CHECK_FLAGS
2751273c00b8Smrg# -----------------------
2752273c00b8Smrg# Minimum version: 1.16.0
2753273c00b8Smrg#
2754273c00b8Smrg# This macro attempts to find appropriate memory checking functionality
2755273c00b8Smrg# for various platforms which unit testing code may use to catch various
2756273c00b8Smrg# forms of memory allocation and access errors in testing.
2757273c00b8Smrg#
2758273c00b8Smrg# Interface to module:
2759273c00b8Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760273c00b8Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761273c00b8Smrg#
2762273c00b8Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763273c00b8Smrg#
2764273c00b8SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276540c5344fSmrg
2766273c00b8SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767273c00b8SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768273c00b8Smrg           [Environment variables to enable memory checking in tests])
276940c5344fSmrg
2770273c00b8Smrg# Check for different types of support on different platforms
2771273c00b8Smrgcase $host_os in
2772273c00b8Smrg    solaris*)
2773273c00b8Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774273c00b8Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775273c00b8Smrg        ;;
2776273c00b8Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777273c00b8Smrg        # both directly and inverted, so should not be 0 or 255.
2778273c00b8Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779273c00b8Smrg        ;;
2780273c00b8Smrg    darwin*)
2781273c00b8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782273c00b8Smrg        ;;
2783273c00b8Smrg    *bsd*)
2784273c00b8Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785273c00b8Smrg        ;;
2786273c00b8Smrgesac
278740c5344fSmrg
2788273c00b8Smrg# User supplied flags override default flags
2789273c00b8Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790273c00b8Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791273c00b8Smrgfi
279240c5344fSmrg
2793273c00b8SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794273c00b8Smrg]) # XORG_WITH_LINT
279540c5344fSmrg
2796273c00b8Smrg# XORG_CHECK_MALLOC_ZERO
2797273c00b8Smrg# ----------------------
2798273c00b8Smrg# Minimum version: 1.0.0
2799273c00b8Smrg#
2800273c00b8Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801273c00b8Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802273c00b8Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803273c00b8SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804273c00b8SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805273c00b8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806273c00b8Smrg		       [malloc(0) returns NULL (default: auto)]),
2807273c00b8Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808273c00b8Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280940c5344fSmrg
2810273c00b8SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811273c00b8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812273c00b8SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813273c00b8Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814273c00b8Smrg#include <stdlib.h>
2815273c00b8Smrg],[
2816273c00b8Smrg    char *m0, *r0, *c0, *p;
2817273c00b8Smrg    m0 = malloc(0);
2818273c00b8Smrg    p = malloc(10);
2819273c00b8Smrg    r0 = realloc(p,0);
2820273c00b8Smrg    c0 = calloc(0,10);
2821273c00b8Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822273c00b8Smrg])],
2823273c00b8Smrg		[xorg_cv_malloc0_returns_null=yes],
2824273c00b8Smrg		[xorg_cv_malloc0_returns_null=no])])
2825273c00b8SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282640c5344fSmrgfi
2827273c00b8SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28287a0395d0Smrg
2829273c00b8Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830273c00b8Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831273c00b8Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832273c00b8Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833273c00b8Smrgelse
2834273c00b8Smrg	MALLOC_ZERO_CFLAGS=""
2835273c00b8Smrg	XMALLOC_ZERO_CFLAGS=""
2836273c00b8Smrg	XTMALLOC_ZERO_CFLAGS=""
2837273c00b8Smrgfi
283896402570Smrg
2839273c00b8SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840273c00b8SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841273c00b8SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842273c00b8Smrg]) # XORG_CHECK_MALLOC_ZERO
284396402570Smrg
2844273c00b8Smrg# XORG_WITH_LINT()
2845273c00b8Smrg# ----------------
2846273c00b8Smrg# Minimum version: 1.1.0
28478abc0ccfSmrg#
2848273c00b8Smrg# This macro enables the use of a tool that flags some suspicious and
2849273c00b8Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850273c00b8Smrg# It will attempt to locate the tool and use appropriate options.
2851273c00b8Smrg# There are various lint type tools on different platforms.
2852273c00b8Smrg#
2853273c00b8Smrg# Interface to module:
2854273c00b8Smrg# LINT:		returns the path to the tool found on the platform
2855273c00b8Smrg#		or the value set to LINT on the configure cmd line
2856273c00b8Smrg#		also an Automake conditional
2857273c00b8Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858273c00b8Smrg#
2859273c00b8Smrg# --with-lint:	'yes' user instructs the module to use lint
2860273c00b8Smrg#		'no' user instructs the module not to use lint (default)
2861273c00b8Smrg#
2862273c00b8Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863273c00b8Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864273c00b8Smrg#
2865273c00b8SmrgAC_DEFUN([XORG_WITH_LINT],[
286696402570Smrg
2867273c00b8SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868273c00b8SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869273c00b8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870273c00b8Smrg		[Use a lint-style source code checker (default: disabled)])],
2871273c00b8Smrg		[use_lint=$withval], [use_lint=no])
287296402570Smrg
2873273c00b8Smrg# Obtain platform specific info like program name and options
2874273c00b8Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875273c00b8Smrgcase $host_os in
2876273c00b8Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877273c00b8Smrg	lint_name=splint
2878273c00b8Smrg	lint_options="-badflag"
2879273c00b8Smrg	;;
2880273c00b8Smrg  *freebsd* | *netbsd*)
2881273c00b8Smrg	lint_name=lint
2882273c00b8Smrg	lint_options="-u -b"
2883273c00b8Smrg	;;
2884273c00b8Smrg  *solaris*)
2885273c00b8Smrg	lint_name=lint
2886273c00b8Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887273c00b8Smrg	;;
2888273c00b8Smrgesac
28898abc0ccfSmrg
2890273c00b8Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891273c00b8Smrgif test "x$use_lint" = x"yes" ; then
2892273c00b8Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893273c00b8Smrg   if test "x$LINT" = "x"; then
2894273c00b8Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895273c00b8Smrg   fi
2896273c00b8Smrgelif test "x$use_lint" = x"no" ; then
2897273c00b8Smrg   if test "x$LINT" != "x"; then
2898273c00b8Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899273c00b8Smrg   fi
29008abc0ccfSmrgelse
2901273c00b8Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290296402570Smrgfi
290396402570Smrg
2904273c00b8Smrg# User supplied flags override default flags
2905273c00b8Smrgif test "x$LINT_FLAGS" != "x"; then
2906273c00b8Smrg   lint_options=$LINT_FLAGS
2907273c00b8Smrgfi
290896402570Smrg
2909273c00b8SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910273c00b8SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291196402570Smrg
2912273c00b8Smrg]) # XORG_WITH_LINT
291396402570Smrg
2914273c00b8Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915273c00b8Smrg# --------------------------
2916273c00b8Smrg# Minimum version: 1.1.0
29178abc0ccfSmrg#
2918273c00b8Smrg# Sets up flags for building lint libraries for checking programs that call
2919273c00b8Smrg# functions in the library.
2920273c00b8Smrg#
2921273c00b8Smrg# Interface to module:
2922273c00b8Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923273c00b8Smrg# MAKE_LINT_LIB		- Automake conditional
2924273c00b8Smrg#
2925273c00b8Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926273c00b8Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292796402570Smrg
2928273c00b8SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929273c00b8SmrgAC_REQUIRE([XORG_WITH_LINT])
2930273c00b8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931273c00b8Smrg	[Create lint library (default: disabled)])],
2932273c00b8Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293396402570Smrg
2934273c00b8Smrgif test "x$make_lint_lib" = x"yes" ; then
2935273c00b8Smrg   LINTLIB=llib-l$1.ln
2936273c00b8Smrg   if test "x$LINT" = "x"; then
2937273c00b8Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938273c00b8Smrg   fi
2939273c00b8Smrgelif test "x$make_lint_lib" != x"no" ; then
2940273c00b8Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294196402570Smrgfi
294296402570Smrg
2943273c00b8SmrgAC_SUBST(LINTLIB)
2944273c00b8SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294596402570Smrg
2946273c00b8Smrg]) # XORG_LINT_LIBRARY
29477366012aSmrg
2948273c00b8Smrg# XORG_COMPILER_BRAND
2949273c00b8Smrg# -------------------
2950273c00b8Smrg# Minimum version: 1.14.0
2951273c00b8Smrg#
2952273c00b8Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953273c00b8Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954273c00b8Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955273c00b8Smrg#   clang compiler - sets CLANGCC to "yes"
2956273c00b8Smrg#   Intel compiler - sets INTELCC to "yes"
2957273c00b8Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958273c00b8Smrg#
2959273c00b8SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960273c00b8SmrgAC_LANG_CASE(
2961273c00b8Smrg	[C], [
2962273c00b8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963273c00b8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964273c00b8Smrg		m4_version_prereq([2.70],
2965273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967273c00b8Smrg	],
2968273c00b8Smrg	[C++], [
2969273c00b8Smrg		AC_REQUIRE([AC_PROG_CXX])
2970273c00b8Smrg	]
2971273c00b8Smrg)
2972273c00b8SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973273c00b8SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974273c00b8SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975273c00b8Smrg]) # XORG_COMPILER_BRAND
29767366012aSmrg
2977273c00b8Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978273c00b8Smrg# ---------------
2979273c00b8Smrg# Minimum version: 1.16.0
2980273c00b8Smrg#
2981273c00b8Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982273c00b8Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983273c00b8Smrg# next flag in the list until there are no more options.
2984273c00b8Smrg#
2985273c00b8Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986273c00b8Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987273c00b8Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988273c00b8Smrg# -Werror=unused-command-line-argument
2989273c00b8Smrg#
2990273c00b8SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991273c00b8Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992273c00b8Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299396402570Smrg
2994273c00b8SmrgAC_LANG_COMPILER_REQUIRE
299596402570Smrg
2996273c00b8SmrgAC_LANG_CASE(
2997273c00b8Smrg	[C], [
2998273c00b8Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999273c00b8Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000273c00b8Smrg		m4_version_prereq([2.70],
3001273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002273c00b8Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003273c00b8Smrg		define([PREFIX], [C])
3004273c00b8Smrg		define([CACHE_PREFIX], [cc])
3005273c00b8Smrg		define([COMPILER], [$CC])
3006273c00b8Smrg	],
3007273c00b8Smrg	[C++], [
3008273c00b8Smrg		define([PREFIX], [CXX])
3009273c00b8Smrg		define([CACHE_PREFIX], [cxx])
3010273c00b8Smrg		define([COMPILER], [$CXX])
3011273c00b8Smrg	]
3012273c00b8Smrg)
301396402570Smrg
3014273c00b8Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301540c5344fSmrg
3016273c00b8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017273c00b8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018273c00b8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019273c00b8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020273c00b8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023273c00b8Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024273c00b8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025273c00b8Smrgfi
3026273c00b8Smrg
3027273c00b8Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028273c00b8Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029273c00b8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030273c00b8Smrg	fi
3031273c00b8Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032273c00b8Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033273c00b8Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034273c00b8Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036273c00b8Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037273c00b8Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038273c00b8Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303940c5344fSmrgfi
304040c5344fSmrg
3041273c00b8Smrgfound="no"
3042273c00b8Smrgm4_foreach([flag], m4_cdr($@), [
3043273c00b8Smrg	if test $found = "no" ; then
3044273c00b8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045273c00b8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046273c00b8Smrg		fi
304740c5344fSmrg
3048273c00b8Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049273c00b8Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050273c00b8Smrg		fi
305140c5344fSmrg
3052273c00b8Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305340c5344fSmrg
3054273c00b8Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055273c00b8Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056273c00b8Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057273c00b8Smrg		AC_CACHE_VAL($cacheid,
3058273c00b8Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059273c00b8Smrg					     [eval $cacheid=yes],
3060273c00b8Smrg					     [eval $cacheid=no])])
306196402570Smrg
3062273c00b8Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30638abc0ccfSmrg
3064273c00b8Smrg		eval supported=\$$cacheid
3065273c00b8Smrg		AC_MSG_RESULT([$supported])
3066273c00b8Smrg		if test "$supported" = "yes" ; then
3067273c00b8Smrg			$1="$$1 ]flag["
3068273c00b8Smrg			found="yes"
3069273c00b8Smrg		fi
3070273c00b8Smrg	fi
3071273c00b8Smrg])
3072273c00b8Smrg]) # XORG_TESTSET_CFLAG
3073273c00b8Smrg
3074273c00b8Smrg# XORG_COMPILER_FLAGS
30758abc0ccfSmrg# ---------------
3076273c00b8Smrg# Minimum version: 1.16.0
3077273c00b8Smrg#
3078273c00b8Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079273c00b8Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080273c00b8Smrg# code.  These arguments will cause the compiler to print various warnings
3081273c00b8Smrg# during compilation AND turn a conservative set of warnings into errors.
3082273c00b8Smrg#
3083273c00b8Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084273c00b8Smrg# future versions of util-macros as options are added to new compilers.
3085273c00b8Smrg#
3086273c00b8SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087273c00b8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30888abc0ccfSmrg
3089273c00b8SmrgAC_ARG_ENABLE(selective-werror,
3090273c00b8Smrg              AS_HELP_STRING([--disable-selective-werror],
3091273c00b8Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092273c00b8Smrg              [SELECTIVE_WERROR=$enableval],
3093273c00b8Smrg              [SELECTIVE_WERROR=yes])
30948abc0ccfSmrg
3095273c00b8SmrgAC_LANG_CASE(
3096273c00b8Smrg        [C], [
3097273c00b8Smrg                define([PREFIX], [C])
3098273c00b8Smrg        ],
3099273c00b8Smrg        [C++], [
3100273c00b8Smrg                define([PREFIX], [CXX])
3101273c00b8Smrg        ]
3102273c00b8Smrg)
3103273c00b8Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104273c00b8Smrgif test "x$SUNCC" = "xyes"; then
3105273c00b8Smrg    [BASE_]PREFIX[FLAGS]="-v"
31068abc0ccfSmrgelse
3107273c00b8Smrg    [BASE_]PREFIX[FLAGS]=""
31087a0395d0Smrgfi
3109273c00b8Smrg
3110273c00b8Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115273c00b8Smrg
3116273c00b8SmrgAC_LANG_CASE(
3117273c00b8Smrg	[C], [
3118273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123273c00b8Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124273c00b8Smrg	]
3125273c00b8Smrg)
3126273c00b8Smrg
3127273c00b8Smrg# This chunk adds additional warnings that could catch undesired effects.
3128273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135273c00b8Smrg
3136273c00b8Smrg# These are currently disabled because they are noisy.  They will be enabled
3137273c00b8Smrg# in the future once the codebase is sufficiently modernized to silence
3138273c00b8Smrg# them.  For now, I don't want them to drown out the other warnings.
3139273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141273c00b8Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142273c00b8Smrg
3143273c00b8Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144273c00b8Smrg# when there are problems that should be fixed.
3145273c00b8Smrg
3146273c00b8Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160273c00b8Smrgelse
3161273c00b8SmrgAC_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])
3162273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174273c00b8SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31758abc0ccfSmrgfi
31767366012aSmrg
3177273c00b8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178273c00b8Smrg]) # XORG_COMPILER_FLAGS
3179273c00b8Smrg
3180273c00b8Smrg# XORG_CWARNFLAGS
3181273c00b8Smrg# ---------------
3182273c00b8Smrg# Minimum version: 1.2.0
3183273c00b8Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184273c00b8Smrg#
3185273c00b8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186273c00b8Smrg#
3187273c00b8Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188273c00b8Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189273c00b8Smrg# is needed, then it should be added explicitly in the module when
3190273c00b8Smrg# it is updated to use BASE_CFLAGS.
3191273c00b8Smrg#
3192273c00b8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193273c00b8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194273c00b8SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195273c00b8SmrgAC_LANG_CASE(
3196273c00b8Smrg	[C], [
3197273c00b8Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198273c00b8Smrg		if  test "x$GCC" = xyes ; then
3199273c00b8Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200273c00b8Smrg		fi
3201273c00b8Smrg		AC_SUBST(CWARNFLAGS)
3202273c00b8Smrg	]
3203273c00b8Smrg)
3204273c00b8Smrg]) # XORG_CWARNFLAGS
3205273c00b8Smrg
3206273c00b8Smrg# XORG_STRICT_OPTION
3207273c00b8Smrg# -----------------------
3208273c00b8Smrg# Minimum version: 1.3.0
32097366012aSmrg#
3210273c00b8Smrg# Add configure option to enable strict compilation flags, such as treating
3211273c00b8Smrg# warnings as fatal errors.
3212273c00b8Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213273c00b8Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3214273c00b8Smrg#
3215273c00b8Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216273c00b8Smrg# when strict compilation is unconditionally desired.
3217273c00b8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218273c00b8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219273c00b8SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32202adc0320Smrg
3221273c00b8SmrgAC_ARG_ENABLE(strict-compilation,
3222273c00b8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223273c00b8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224273c00b8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225273c00b8Smrg
3226273c00b8SmrgAC_LANG_CASE(
3227273c00b8Smrg        [C], [
3228273c00b8Smrg                define([PREFIX], [C])
3229273c00b8Smrg        ],
3230273c00b8Smrg        [C++], [
3231273c00b8Smrg                define([PREFIX], [CXX])
3232273c00b8Smrg        ]
3233273c00b8Smrg)
3234273c00b8Smrg
3235273c00b8Smrg[STRICT_]PREFIX[FLAGS]=""
3236273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238273c00b8Smrg
3239273c00b8Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240273c00b8Smrg# activate it with -Werror, so we add it here explicitly.
3241273c00b8SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242273c00b8Smrg
3243273c00b8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244273c00b8Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245273c00b8Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32468abc0ccfSmrgfi
3247273c00b8SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248273c00b8SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249273c00b8SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250273c00b8Smrg]) # XORG_STRICT_OPTION
32517a0395d0Smrg
3252273c00b8Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253273c00b8Smrg# ---------------------------
3254273c00b8Smrg# Minimum version: 1.20.0
32557366012aSmrg#
3256273c00b8Smrg# Defines default options for X.Org modules which don't compile code,
3257273c00b8Smrg# such as fonts, bitmaps, cursors, and docs.
3258273c00b8Smrg#
3259273c00b8SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261273c00b8SmrgXORG_RELEASE_VERSION
3262273c00b8SmrgXORG_CHANGELOG
3263273c00b8SmrgXORG_INSTALL
3264273c00b8SmrgXORG_MANPAGE_SECTIONS
3265273c00b8Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266273c00b8Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267273c00b8Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32687a0395d0Smrg
3269273c00b8Smrg# XORG_DEFAULT_OPTIONS
3270273c00b8Smrg# --------------------
3271273c00b8Smrg# Minimum version: 1.3.0
3272273c00b8Smrg#
3273273c00b8Smrg# Defines default options for X.Org modules which compile code.
3274273c00b8Smrg#
3275273c00b8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276273c00b8SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277273c00b8SmrgXORG_COMPILER_FLAGS
3278273c00b8SmrgXORG_CWARNFLAGS
3279273c00b8SmrgXORG_STRICT_OPTION
3280273c00b8SmrgXORG_DEFAULT_NOCODE_OPTIONS
3281273c00b8Smrg]) # XORG_DEFAULT_OPTIONS
32827a0395d0Smrg
3283273c00b8Smrg# XORG_INSTALL()
3284273c00b8Smrg# ----------------
3285273c00b8Smrg# Minimum version: 1.4.0
32868abc0ccfSmrg#
3287273c00b8Smrg# Defines the variable INSTALL_CMD as the command to copy
3288273c00b8Smrg# INSTALL from $prefix/share/util-macros.
3289273c00b8Smrg#
3290273c00b8SmrgAC_DEFUN([XORG_INSTALL], [
3291273c00b8SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292273c00b8Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293273c00b8SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294273c00b8Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295273c00b8Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296273c00b8Smrgtouch \$(top_srcdir)/INSTALL; \
3297273c00b8Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298273c00b8SmrgAC_SUBST([INSTALL_CMD])
3299273c00b8Smrg]) # XORG_INSTALL
3300273c00b8Smrgdnl Copyright 2005 Red Hat, Inc
3301273c00b8Smrgdnl
3302273c00b8Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303273c00b8Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304273c00b8Smrgdnl the above copyright notice appear in all copies and that both that
3305273c00b8Smrgdnl copyright notice and this permission notice appear in supporting
3306273c00b8Smrgdnl documentation.
3307273c00b8Smrgdnl
3308273c00b8Smrgdnl The above copyright notice and this permission notice shall be included
3309273c00b8Smrgdnl in all copies or substantial portions of the Software.
3310273c00b8Smrgdnl
3311273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312273c00b8Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313273c00b8Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314273c00b8Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315273c00b8Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316273c00b8Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317273c00b8Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318273c00b8Smrgdnl
3319273c00b8Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320273c00b8Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321273c00b8Smrgdnl other dealings in this Software without prior written authorization
3322273c00b8Smrgdnl from the copyright holders.
3323273c00b8Smrgdnl
33247a0395d0Smrg
3325273c00b8Smrg# XORG_RELEASE_VERSION
3326273c00b8Smrg# --------------------
3327273c00b8Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332896402570Smrg
3329273c00b8SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331273c00b8Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332273c00b8Smrg		[Major version of this package])
3333273c00b8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334273c00b8Smrg	if test "x$PVM" = "x"; then
3335273c00b8Smrg		PVM="0"
3336273c00b8Smrg	fi
3337273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338273c00b8Smrg		[$PVM],
3339273c00b8Smrg		[Minor version of this package])
3340273c00b8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341273c00b8Smrg	if test "x$PVP" = "x"; then
3342273c00b8Smrg		PVP="0"
3343273c00b8Smrg	fi
3344273c00b8Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345273c00b8Smrg		[$PVP],
3346273c00b8Smrg		[Patch version of this package])
3347273c00b8Smrg])
33487a0395d0Smrg
3349273c00b8Smrg# XORG_CHANGELOG()
3350273c00b8Smrg# ----------------
3351273c00b8Smrg# Minimum version: 1.2.0
3352273c00b8Smrg#
3353273c00b8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354273c00b8Smrg# ChangeLog from git.
3355273c00b8Smrg#
3356273c00b8Smrg#
3357273c00b8SmrgAC_DEFUN([XORG_CHANGELOG], [
3358273c00b8SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359273c00b8Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360273c00b8Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361273c00b8Smrgtouch \$(top_srcdir)/ChangeLog; \
3362273c00b8Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363273c00b8SmrgAC_SUBST([CHANGELOG_CMD])
3364273c00b8Smrg]) # XORG_CHANGELOG
3365273c00b8Smrg
3366273c00b8Smrgdnl
3367273c00b8Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates.
3368273c00b8Smrgdnl
3369273c00b8Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3370273c00b8Smrgdnl copy of this software and associated documentation files (the "Software"),
3371273c00b8Smrgdnl to deal in the Software without restriction, including without limitation
3372273c00b8Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3373273c00b8Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3374273c00b8Smrgdnl Software is furnished to do so, subject to the following conditions:
3375273c00b8Smrgdnl
3376273c00b8Smrgdnl The above copyright notice and this permission notice (including the next
3377273c00b8Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3378273c00b8Smrgdnl Software.
3379273c00b8Smrgdnl
3380273c00b8Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3381273c00b8Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3382273c00b8Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3383273c00b8Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3384273c00b8Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3385273c00b8Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3386273c00b8Smrgdnl DEALINGS IN THE SOFTWARE.
3387273c00b8Smrgdnl
338896402570Smrg
3389273c00b8Smrg# XTRANS_TCP_FLAGS()
3390273c00b8Smrg# ------------------
3391273c00b8Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
3392273c00b8SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3393273c00b8Smrg # SVR4 hides these in libraries other than libc
3394273c00b8Smrg AC_SEARCH_LIBS(socket, [socket])
3395273c00b8Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3396273c00b8Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3397273c00b8Smrg   AC_CHECK_LIB([ws2_32],[main])
3398273c00b8Smrg fi
33997a0395d0Smrg
3400273c00b8Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
3401273c00b8Smrg AC_ARG_ENABLE(ipv6,
3402273c00b8Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
3403273c00b8Smrg	[IPV6CONN=$enableval],
3404273c00b8Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
3405273c00b8Smrg AC_MSG_CHECKING([if IPv6 support should be built])
3406273c00b8Smrg if test "$IPV6CONN" = "yes"; then
3407273c00b8Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3408273c00b8Smrg fi
3409273c00b8Smrg AC_MSG_RESULT($IPV6CONN)
34109a011757Smrg
3411273c00b8Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
3412273c00b8Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3413273c00b8Smrg	AC_DEFINE([BSD44SOCKETS],1,
3414273c00b8Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3415273c00b8Smrg#include <sys/types.h>
3416273c00b8Smrg#include <sys/socket.h>
3417273c00b8Smrg#include <netinet/in.h>
3418273c00b8Smrg ])
34197a0395d0Smrg
3420273c00b8Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3421273c00b8Smrg AC_CHECK_TYPES([socklen_t], [], [], [
3422273c00b8SmrgAC_INCLUDES_DEFAULT
3423273c00b8Smrg#include <sys/socket.h>])
34249a011757Smrg
3425273c00b8Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
3426273c00b8Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
3427273c00b8Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
3428273c00b8Smrg                 [
3429273c00b8SmrgAC_INCLUDES_DEFAULT
3430273c00b8Smrg#include <sys/socket.h>
3431273c00b8Smrg                 ])
3432273c00b8Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
3433273c00b8Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3434273c00b8Smrg     unset ac_cv_member_struct_msghdr_msg_control
3435273c00b8Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
3436273c00b8Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3437273c00b8Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
3438273c00b8Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3439273c00b8Smrg                     ], [], [
3440273c00b8Smrg#define _XOPEN_SOURCE 600
3441273c00b8SmrgAC_INCLUDES_DEFAULT
3442273c00b8Smrg#include <sys/socket.h>
3443273c00b8Smrg                     ])
3444273c00b8Smrg fi
3445273c00b8Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
3446273c00b8Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3447273c00b8Smrg     unset ac_cv_member_struct_msghdr_msg_control
3448273c00b8Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
3449273c00b8Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3450273c00b8Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
3451273c00b8Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3452273c00b8Smrg                     ], [], [
3453273c00b8Smrg#define _XOPEN_SOURCE 500
3454273c00b8SmrgAC_INCLUDES_DEFAULT
3455273c00b8Smrg#include <sys/socket.h>
3456273c00b8Smrg                     ])
3457273c00b8Smrg fi
34589a011757Smrg
34599a011757Smrg
3460273c00b8Smrg]) # XTRANS_TCP_FLAGS
34619a011757Smrg
3462273c00b8Smrg# XTRANS_CONNECTION_FLAGS()
3463273c00b8Smrg# -------------------------
3464273c00b8Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
3465273c00b8Smrg# that use Xtrans functions
3466273c00b8SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3467273c00b8Smrg AC_REQUIRE([AC_CANONICAL_HOST])
3468273c00b8Smrg [case $host_os in
3469273c00b8Smrg	mingw*)	unixdef="no"   ;;
3470273c00b8Smrg	*)	unixdef="yes"  ;;
3471273c00b8Smrg esac]
3472273c00b8Smrg AC_ARG_ENABLE(unix-transport,
3473273c00b8Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3474273c00b8Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3475273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3476273c00b8Smrg if test "$UNIXCONN" = "yes"; then
3477273c00b8Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3478273c00b8Smrg fi
3479273c00b8Smrg AC_MSG_RESULT($UNIXCONN)
3480273c00b8Smrg AC_ARG_ENABLE(tcp-transport,
3481273c00b8Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3482273c00b8Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
3483273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3484273c00b8Smrg AC_MSG_RESULT($TCPCONN)
3485273c00b8Smrg if test "$TCPCONN" = "yes"; then
3486273c00b8Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3487273c00b8Smrg	XTRANS_TCP_FLAGS
3488273c00b8Smrg fi
3489273c00b8Smrg [case $host_os in
3490273c00b8Smrg	solaris*)		localdef="yes" ;;
3491273c00b8Smrg	*)			localdef="no"  ;;
3492273c00b8Smrg esac]
3493273c00b8Smrg AC_ARG_ENABLE(local-transport,
3494273c00b8Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3495273c00b8Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3496273c00b8Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3497273c00b8Smrg AC_MSG_RESULT($LOCALCONN)
3498273c00b8Smrg if test "$LOCALCONN" = "yes"; then
3499273c00b8Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3500273c00b8Smrg fi
35019a011757Smrg
3502273c00b8Smrg # Other functions Xtrans may need
3503273c00b8Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
35049a011757Smrg
3505273c00b8Smrg]) # XTRANS_CONNECTION_FLAGS
35068abc0ccfSmrg
35079a011757Smrg
3508273c00b8Smrg# XTRANS_SECURE_RPC_FLAGS()
3509273c00b8Smrg# -------------------------
3510273c00b8Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3511273c00b8Smrg# so that any necessary networking libraries are already found
3512273c00b8SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3513273c00b8Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
3514273c00b8Smrg AC_ARG_ENABLE(secure-rpc,
3515273c00b8Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3516273c00b8Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
35177a0395d0Smrg
3518273c00b8Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3519273c00b8Smrg	FOUND_SECURE_RPC="no"
3520273c00b8Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3521273c00b8Smrg			[FOUND_SECURE_RPC="yes"])
3522273c00b8Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3523273c00b8Smrg		if test "x$SECURE_RPC" = "xyes" ; then
3524273c00b8Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
3525273c00b8Smrg		fi
3526273c00b8Smrg		SECURE_RPC="no"
3527273c00b8Smrg	else
3528273c00b8Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3529273c00b8Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3530273c00b8Smrg		SECURE_RPC="yes"
3531273c00b8Smrg	fi
3532273c00b8Smrg fi
3533273c00b8Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3534273c00b8Smrg if test "x$SECURE_RPC" = "xyes" ; then
3535273c00b8Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3536273c00b8Smrg fi
3537273c00b8Smrg AC_MSG_RESULT($SECURE_RPC)
3538273c00b8Smrg]) # XTRANS_SECURE_RPC_FLAGS
35399a011757Smrg
35407a0395d0Smrg
3541