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