11d778f8eSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
2b7d26471Smrg
31d778f8eSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4145b7b3cSmrg
5145b7b3cSmrg# This file is free software; the Free Software Foundation
6145b7b3cSmrg# gives unlimited permission to copy and/or distribute it,
7145b7b3cSmrg# with or without modifications, as long as this notice is preserved.
8145b7b3cSmrg
9145b7b3cSmrg# This program is distributed in the hope that it will be useful,
10145b7b3cSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11145b7b3cSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12145b7b3cSmrg# PARTICULAR PURPOSE.
13145b7b3cSmrg
14b7d26471Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15578741aaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16578741aaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
174901b09eSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
184901b09eSmrg[m4_warning([this file was generated for autoconf 2.72.
19578741aaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20578741aaSmrgIf you have problems, you may need to regenerate the build system entirely.
21b7d26471SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22145b7b3cSmrg
231d778f8eSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24da2e2ef6Smrg#
25da2e2ef6Smrg# This file is free software; the Free Software Foundation
26da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
27da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
28b7d26471Smrg
29da2e2ef6Smrg# AM_AUTOMAKE_VERSION(VERSION)
30da2e2ef6Smrg# ----------------------------
31da2e2ef6Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32da2e2ef6Smrg# generated from the m4 files accompanying Automake X.Y.
33da2e2ef6Smrg# (This private macro should not be called outside this file.)
34da2e2ef6SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
351d778f8eSmrg[am__api_version='1.17'
36da2e2ef6Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37da2e2ef6Smrgdnl require some minimum version.  Point them to the right macro.
381d778f8eSmrgm4_if([$1], [1.17], [],
39da2e2ef6Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40da2e2ef6Smrg])
41b7d26471Smrg
42da2e2ef6Smrg# _AM_AUTOCONF_VERSION(VERSION)
43da2e2ef6Smrg# -----------------------------
44da2e2ef6Smrg# aclocal traces this macro to find the Autoconf version.
45da2e2ef6Smrg# This is a private macro too.  Using m4_define simplifies
46da2e2ef6Smrg# the logic in aclocal, which can simply ignore this definition.
47da2e2ef6Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48145b7b3cSmrg
49da2e2ef6Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50da2e2ef6Smrg# -------------------------------
51da2e2ef6Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52da2e2ef6Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53da2e2ef6SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541d778f8eSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
55da2e2ef6Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56da2e2ef6Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57da2e2ef6Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58145b7b3cSmrg
59da2e2ef6Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60145b7b3cSmrg
611d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62da2e2ef6Smrg#
63da2e2ef6Smrg# This file is free software; the Free Software Foundation
64da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
65da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
66145b7b3cSmrg
67da2e2ef6Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68da2e2ef6Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69da2e2ef6Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70da2e2ef6Smrg#
71da2e2ef6Smrg# Of course, Automake must honor this variable whenever it calls a
72da2e2ef6Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73da2e2ef6Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74da2e2ef6Smrg# depending on how configure is run.  This is pretty annoying, since
75da2e2ef6Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76da2e2ef6Smrg# source directory, any form will work fine, but in subdirectories a
77da2e2ef6Smrg# relative path needs to be adjusted first.
78da2e2ef6Smrg#
79da2e2ef6Smrg# $ac_aux_dir/missing
80da2e2ef6Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81da2e2ef6Smrg# $top_srcdir/$ac_aux_dir/missing
82da2e2ef6Smrg#    fails if $ac_aux_dir is absolute,
83da2e2ef6Smrg#    fails when called from a subdirectory in a VPATH build with
84da2e2ef6Smrg#          a relative $ac_aux_dir
85da2e2ef6Smrg#
86da2e2ef6Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87da2e2ef6Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88da2e2ef6Smrg# harmless because $srcdir is '.', but things will broke when you
89da2e2ef6Smrg# start a VPATH build or use an absolute $srcdir.
90da2e2ef6Smrg#
91da2e2ef6Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92da2e2ef6Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93da2e2ef6Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94da2e2ef6Smrg# and then we would define $MISSING as
95da2e2ef6Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96da2e2ef6Smrg# This will work as long as MISSING is not called from configure, because
97da2e2ef6Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98da2e2ef6Smrg# However there are other variables, like CC, which are often used in
99da2e2ef6Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100da2e2ef6Smrg#
101da2e2ef6Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102da2e2ef6Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103da2e2ef6Smrg# configured tree to be moved without reconfiguration.
104145b7b3cSmrg
105da2e2ef6SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106da2e2ef6Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107da2e2ef6Smrg# Expand $ac_aux_dir to an absolute path.
108da2e2ef6Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109da2e2ef6Smrg])
1105ffd6003Smrg
111da2e2ef6Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112145b7b3cSmrg
1131d778f8eSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114da2e2ef6Smrg#
115da2e2ef6Smrg# This file is free software; the Free Software Foundation
116da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
117da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
118145b7b3cSmrg
119da2e2ef6Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120da2e2ef6Smrg# -------------------------------------
121da2e2ef6Smrg# Define a conditional.
122da2e2ef6SmrgAC_DEFUN([AM_CONDITIONAL],
123da2e2ef6Smrg[AC_PREREQ([2.52])dnl
124da2e2ef6Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125da2e2ef6Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126da2e2ef6SmrgAC_SUBST([$1_TRUE])dnl
127da2e2ef6SmrgAC_SUBST([$1_FALSE])dnl
128da2e2ef6Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129da2e2ef6Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130da2e2ef6Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131da2e2ef6Smrgif $2; then
132da2e2ef6Smrg  $1_TRUE=
133da2e2ef6Smrg  $1_FALSE='#'
134da2e2ef6Smrgelse
135da2e2ef6Smrg  $1_TRUE='#'
136da2e2ef6Smrg  $1_FALSE=
137da2e2ef6Smrgfi
138da2e2ef6SmrgAC_CONFIG_COMMANDS_PRE(
139da2e2ef6Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140da2e2ef6Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141da2e2ef6SmrgUsually this means the macro was only invoked conditionally.]])
142da2e2ef6Smrgfi])])
143145b7b3cSmrg
1441d778f8eSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145da2e2ef6Smrg#
146da2e2ef6Smrg# This file is free software; the Free Software Foundation
147da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
148da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
149145b7b3cSmrg
150145b7b3cSmrg
151da2e2ef6Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152da2e2ef6Smrg# written in clear, in which case automake, when reading aclocal.m4,
153da2e2ef6Smrg# will think it sees a *use*, and therefore will trigger all it's
154da2e2ef6Smrg# C support machinery.  Also note that it means that autoscan, seeing
155da2e2ef6Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156145b7b3cSmrg
157145b7b3cSmrg
158da2e2ef6Smrg# _AM_DEPENDENCIES(NAME)
159da2e2ef6Smrg# ----------------------
160da2e2ef6Smrg# See how the compiler implements dependency checking.
161da2e2ef6Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162da2e2ef6Smrg# We try a few techniques and use that to set a single cache variable.
163da2e2ef6Smrg#
164da2e2ef6Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165da2e2ef6Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166da2e2ef6Smrg# dependency, and given that the user is not expected to run this macro,
167da2e2ef6Smrg# just rely on AC_PROG_CC.
168da2e2ef6SmrgAC_DEFUN([_AM_DEPENDENCIES],
169da2e2ef6Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170da2e2ef6SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171da2e2ef6SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172da2e2ef6SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173145b7b3cSmrg
174da2e2ef6Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175da2e2ef6Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176da2e2ef6Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177da2e2ef6Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178da2e2ef6Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179da2e2ef6Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180da2e2ef6Smrg                    [depcc="$$1"   am_compiler_list=])
181145b7b3cSmrg
182da2e2ef6SmrgAC_CACHE_CHECK([dependency style of $depcc],
183da2e2ef6Smrg               [am_cv_$1_dependencies_compiler_type],
184da2e2ef6Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185da2e2ef6Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186da2e2ef6Smrg  # making bogus files that we don't know about and never remove.  For
187da2e2ef6Smrg  # instance it was reported that on HP-UX the gcc test will end up
188da2e2ef6Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189da2e2ef6Smrg  # in D".
190da2e2ef6Smrg  rm -rf conftest.dir
191da2e2ef6Smrg  mkdir conftest.dir
192da2e2ef6Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193da2e2ef6Smrg  # using a relative directory.
194da2e2ef6Smrg  cp "$am_depcomp" conftest.dir
195da2e2ef6Smrg  cd conftest.dir
196da2e2ef6Smrg  # We will build objects and dependencies in a subdirectory because
197da2e2ef6Smrg  # it helps to detect inapplicable dependency modes.  For instance
198da2e2ef6Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199da2e2ef6Smrg  # side effect of compilation, but ICC will put the dependencies in
200da2e2ef6Smrg  # the current directory while Tru64 will put them in the object
201da2e2ef6Smrg  # directory.
202da2e2ef6Smrg  mkdir sub
203145b7b3cSmrg
204da2e2ef6Smrg  am_cv_$1_dependencies_compiler_type=none
205da2e2ef6Smrg  if test "$am_compiler_list" = ""; then
206da2e2ef6Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207da2e2ef6Smrg  fi
208da2e2ef6Smrg  am__universal=false
209da2e2ef6Smrg  m4_case([$1], [CC],
210da2e2ef6Smrg    [case " $depcc " in #(
211da2e2ef6Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212da2e2ef6Smrg     esac],
213da2e2ef6Smrg    [CXX],
214da2e2ef6Smrg    [case " $depcc " in #(
215da2e2ef6Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216da2e2ef6Smrg     esac])
217145b7b3cSmrg
218da2e2ef6Smrg  for depmode in $am_compiler_list; do
219da2e2ef6Smrg    # Setup a source with many dependencies, because some compilers
220da2e2ef6Smrg    # like to wrap large dependency lists on column 80 (with \), and
221da2e2ef6Smrg    # we should not choose a depcomp mode which is confused by this.
222da2e2ef6Smrg    #
223da2e2ef6Smrg    # We need to recreate these files for each test, as the compiler may
224da2e2ef6Smrg    # overwrite some of them when testing with obscure command lines.
225da2e2ef6Smrg    # This happens at least with the AIX C compiler.
226da2e2ef6Smrg    : > sub/conftest.c
227da2e2ef6Smrg    for i in 1 2 3 4 5 6; do
228da2e2ef6Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229da2e2ef6Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230da2e2ef6Smrg      # Solaris 10 /bin/sh.
231da2e2ef6Smrg      echo '/* dummy */' > sub/conftst$i.h
232da2e2ef6Smrg    done
233da2e2ef6Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234578741aaSmrg
235da2e2ef6Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236da2e2ef6Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237da2e2ef6Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238da2e2ef6Smrg    # versions had trouble with output in subdirs.
239da2e2ef6Smrg    am__obj=sub/conftest.${OBJEXT-o}
240da2e2ef6Smrg    am__minus_obj="-o $am__obj"
241da2e2ef6Smrg    case $depmode in
242da2e2ef6Smrg    gcc)
243da2e2ef6Smrg      # This depmode causes a compiler race in universal mode.
244da2e2ef6Smrg      test "$am__universal" = false || continue
245da2e2ef6Smrg      ;;
246da2e2ef6Smrg    nosideeffect)
247da2e2ef6Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248da2e2ef6Smrg      # only be used when explicitly requested.
249da2e2ef6Smrg      if test "x$enable_dependency_tracking" = xyes; then
250da2e2ef6Smrg	continue
251da2e2ef6Smrg      else
252da2e2ef6Smrg	break
253da2e2ef6Smrg      fi
254da2e2ef6Smrg      ;;
255da2e2ef6Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256da2e2ef6Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257da2e2ef6Smrg      # not run yet.  These depmodes are late enough in the game, and
258da2e2ef6Smrg      # so weak that their functioning should not be impacted.
259da2e2ef6Smrg      am__obj=conftest.${OBJEXT-o}
260da2e2ef6Smrg      am__minus_obj=
261da2e2ef6Smrg      ;;
262da2e2ef6Smrg    none) break ;;
263da2e2ef6Smrg    esac
264da2e2ef6Smrg    if depmode=$depmode \
265da2e2ef6Smrg       source=sub/conftest.c object=$am__obj \
266da2e2ef6Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267da2e2ef6Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268da2e2ef6Smrg         >/dev/null 2>conftest.err &&
269da2e2ef6Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270da2e2ef6Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271da2e2ef6Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272da2e2ef6Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273da2e2ef6Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274da2e2ef6Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275da2e2ef6Smrg      # that says an option was ignored or not supported.
2761d778f8eSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277da2e2ef6Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278da2e2ef6Smrg      # The diagnosis changed in icc 8.0:
279da2e2ef6Smrg      #   icc: Command line remark: option '-MP' not supported
280da2e2ef6Smrg      if (grep 'ignoring option' conftest.err ||
281da2e2ef6Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282da2e2ef6Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283da2e2ef6Smrg        break
284da2e2ef6Smrg      fi
285da2e2ef6Smrg    fi
286da2e2ef6Smrg  done
287145b7b3cSmrg
288da2e2ef6Smrg  cd ..
289da2e2ef6Smrg  rm -rf conftest.dir
290da2e2ef6Smrgelse
291da2e2ef6Smrg  am_cv_$1_dependencies_compiler_type=none
292da2e2ef6Smrgfi
293da2e2ef6Smrg])
294da2e2ef6SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295da2e2ef6SmrgAM_CONDITIONAL([am__fastdep$1], [
296da2e2ef6Smrg  test "x$enable_dependency_tracking" != xno \
297da2e2ef6Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298da2e2ef6Smrg])
299145b7b3cSmrg
300b7d26471Smrg
301da2e2ef6Smrg# AM_SET_DEPDIR
302da2e2ef6Smrg# -------------
303da2e2ef6Smrg# Choose a directory name for dependency files.
304da2e2ef6Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305da2e2ef6SmrgAC_DEFUN([AM_SET_DEPDIR],
306da2e2ef6Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307da2e2ef6SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308da2e2ef6Smrg])
309b7d26471Smrg
310b7d26471Smrg
311da2e2ef6Smrg# AM_DEP_TRACK
312da2e2ef6Smrg# ------------
313da2e2ef6SmrgAC_DEFUN([AM_DEP_TRACK],
314da2e2ef6Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315da2e2ef6SmrgAS_HELP_STRING(
316da2e2ef6Smrg  [--enable-dependency-tracking],
317da2e2ef6Smrg  [do not reject slow dependency extractors])
318da2e2ef6SmrgAS_HELP_STRING(
319da2e2ef6Smrg  [--disable-dependency-tracking],
320da2e2ef6Smrg  [speeds up one-time build])])
321da2e2ef6Smrgif test "x$enable_dependency_tracking" != xno; then
322da2e2ef6Smrg  am_depcomp="$ac_aux_dir/depcomp"
323da2e2ef6Smrg  AMDEPBACKSLASH='\'
324da2e2ef6Smrg  am__nodep='_no'
325da2e2ef6Smrgfi
326da2e2ef6SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327da2e2ef6SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328da2e2ef6Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329da2e2ef6SmrgAC_SUBST([am__nodep])dnl
330da2e2ef6Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331da2e2ef6Smrg])
332b7d26471Smrg
333da2e2ef6Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334145b7b3cSmrg
3351d778f8eSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336b7d26471Smrg#
337da2e2ef6Smrg# This file is free software; the Free Software Foundation
338da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
339da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
340145b7b3cSmrg
341da2e2ef6Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342da2e2ef6Smrg# ------------------------------
343da2e2ef6SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344da2e2ef6Smrg[{
345da2e2ef6Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346da2e2ef6Smrg  # are listed without --file.  Let's play safe and only enable the eval
347da2e2ef6Smrg  # if we detect the quoting.
348da2e2ef6Smrg  # TODO: see whether this extra hack can be removed once we start
349da2e2ef6Smrg  # requiring Autoconf 2.70 or later.
350da2e2ef6Smrg  AS_CASE([$CONFIG_FILES],
351da2e2ef6Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352da2e2ef6Smrg          [*], [set x $CONFIG_FILES])
353da2e2ef6Smrg  shift
354da2e2ef6Smrg  # Used to flag and report bootstrapping failures.
355da2e2ef6Smrg  am_rc=0
356da2e2ef6Smrg  for am_mf
357da2e2ef6Smrg  do
358da2e2ef6Smrg    # Strip MF so we end up with the name of the file.
359da2e2ef6Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360da2e2ef6Smrg    # Check whether this is an Automake generated Makefile which includes
361da2e2ef6Smrg    # dependency-tracking related rules and includes.
362da2e2ef6Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363da2e2ef6Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364da2e2ef6Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365da2e2ef6Smrg      || continue
366da2e2ef6Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367da2e2ef6Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368da2e2ef6Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369da2e2ef6Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370da2e2ef6Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371da2e2ef6Smrg  done
372da2e2ef6Smrg  if test $am_rc -ne 0; then
373da2e2ef6Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374da2e2ef6Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375da2e2ef6Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376da2e2ef6Smrg    necessary).  You can also try re-running configure with the
377da2e2ef6Smrg    '--disable-dependency-tracking' option to at least be able to build
378da2e2ef6Smrg    the package (albeit without support for automatic dependency tracking).])
379da2e2ef6Smrg  fi
380da2e2ef6Smrg  AS_UNSET([am_dirpart])
381da2e2ef6Smrg  AS_UNSET([am_filepart])
382da2e2ef6Smrg  AS_UNSET([am_mf])
383da2e2ef6Smrg  AS_UNSET([am_rc])
384da2e2ef6Smrg  rm -f conftest-deps.mk
385da2e2ef6Smrg}
386da2e2ef6Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387145b7b3cSmrg
388145b7b3cSmrg
389da2e2ef6Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390da2e2ef6Smrg# -----------------------------
391da2e2ef6Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392629baa8cSmrg#
393da2e2ef6Smrg# This code is only required when automatic dependency tracking is enabled.
394da2e2ef6Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395da2e2ef6Smrg# order to bootstrap the dependency handling code.
396da2e2ef6SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397da2e2ef6Smrg[AC_CONFIG_COMMANDS([depfiles],
398da2e2ef6Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399da2e2ef6Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400145b7b3cSmrg
401da2e2ef6Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402145b7b3cSmrg
4031d778f8eSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
404da2e2ef6Smrg#
405da2e2ef6Smrg# This file is free software; the Free Software Foundation
406da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
407da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
408145b7b3cSmrg
409da2e2ef6Smrg# This macro actually does too much.  Some checks are only needed if
410da2e2ef6Smrg# your package does certain things.  But this isn't really a big deal.
4115ffd6003Smrg
412da2e2ef6Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413da2e2ef6Smrgm4_define([AC_PROG_CC],
414da2e2ef6Smrgm4_defn([AC_PROG_CC])
415da2e2ef6Smrg[_AM_PROG_CC_C_O
416da2e2ef6Smrg])
417145b7b3cSmrg
418da2e2ef6Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419da2e2ef6Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420da2e2ef6Smrg# -----------------------------------------------
421da2e2ef6Smrg# The call with PACKAGE and VERSION arguments is the old style
422da2e2ef6Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423da2e2ef6Smrg# and VERSION should now be passed to AC_INIT and removed from
424da2e2ef6Smrg# the call to AM_INIT_AUTOMAKE.
425da2e2ef6Smrg# We support both call styles for the transition.  After
426da2e2ef6Smrg# the next Automake release, Autoconf can make the AC_INIT
427da2e2ef6Smrg# arguments mandatory, and then we can depend on a new Autoconf
428da2e2ef6Smrg# release and drop the old call support.
429da2e2ef6SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430da2e2ef6Smrg[AC_PREREQ([2.65])dnl
431da2e2ef6Smrgm4_ifdef([_$0_ALREADY_INIT],
432da2e2ef6Smrg  [m4_fatal([$0 expanded multiple times
433da2e2ef6Smrg]m4_defn([_$0_ALREADY_INIT]))],
434da2e2ef6Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435da2e2ef6Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436da2e2ef6Smrgdnl the ones we care about.
437da2e2ef6Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438da2e2ef6SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439da2e2ef6SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440da2e2ef6Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441da2e2ef6Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442da2e2ef6Smrg  # is not polluted with repeated "-I."
443da2e2ef6Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444da2e2ef6Smrg  # test to see if srcdir already configured
445da2e2ef6Smrg  if test -f $srcdir/config.status; then
446da2e2ef6Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447da2e2ef6Smrg  fi
448b7d26471Smrgfi
449145b7b3cSmrg
450da2e2ef6Smrg# test whether we have cygpath
451da2e2ef6Smrgif test -z "$CYGPATH_W"; then
452da2e2ef6Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453da2e2ef6Smrg    CYGPATH_W='cygpath -w'
454da2e2ef6Smrg  else
455da2e2ef6Smrg    CYGPATH_W=echo
456da2e2ef6Smrg  fi
457b7d26471Smrgfi
458da2e2ef6SmrgAC_SUBST([CYGPATH_W])
459145b7b3cSmrg
460da2e2ef6Smrg# Define the identity of the package.
461da2e2ef6Smrgdnl Distinguish between old-style and new-style calls.
462da2e2ef6Smrgm4_ifval([$2],
463da2e2ef6Smrg[AC_DIAGNOSE([obsolete],
464da2e2ef6Smrg             [$0: two- and three-arguments forms are deprecated.])
465da2e2ef6Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466da2e2ef6Smrg AC_SUBST([PACKAGE], [$1])dnl
467da2e2ef6Smrg AC_SUBST([VERSION], [$2])],
468da2e2ef6Smrg[_AM_SET_OPTIONS([$1])dnl
469da2e2ef6Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470da2e2ef6Smrgm4_if(
471da2e2ef6Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472da2e2ef6Smrg  [ok:ok],,
473da2e2ef6Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474da2e2ef6Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475da2e2ef6Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476145b7b3cSmrg
477da2e2ef6Smrg_AM_IF_OPTION([no-define],,
478da2e2ef6Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479da2e2ef6Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480145b7b3cSmrg
481da2e2ef6Smrg# Some tools Automake needs.
482da2e2ef6SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483da2e2ef6SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484da2e2ef6SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485da2e2ef6SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486da2e2ef6SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487da2e2ef6SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488da2e2ef6SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489da2e2ef6SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490da2e2ef6SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491da2e2ef6SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492da2e2ef6Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493da2e2ef6Smrg# dies out for good.  For more background, see:
494da2e2ef6Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495da2e2ef6Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496da2e2ef6SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497da2e2ef6Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498da2e2ef6Smrg# system "awk" is bad on some platforms.
499da2e2ef6SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500da2e2ef6SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501da2e2ef6SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502da2e2ef6Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503da2e2ef6Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504da2e2ef6Smrg			     [_AM_PROG_TAR([v7])])])
505da2e2ef6Smrg_AM_IF_OPTION([no-dependencies],,
506da2e2ef6Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507da2e2ef6Smrg		  [_AM_DEPENDENCIES([CC])],
508da2e2ef6Smrg		  [m4_define([AC_PROG_CC],
509da2e2ef6Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510da2e2ef6SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511da2e2ef6Smrg		  [_AM_DEPENDENCIES([CXX])],
512da2e2ef6Smrg		  [m4_define([AC_PROG_CXX],
513da2e2ef6Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514da2e2ef6SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515da2e2ef6Smrg		  [_AM_DEPENDENCIES([OBJC])],
516da2e2ef6Smrg		  [m4_define([AC_PROG_OBJC],
517da2e2ef6Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518da2e2ef6SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519da2e2ef6Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520da2e2ef6Smrg		  [m4_define([AC_PROG_OBJCXX],
521da2e2ef6Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522da2e2ef6Smrg])
523da2e2ef6Smrg# Variables for tags utilities; see am/tags.am
524da2e2ef6Smrgif test -z "$CTAGS"; then
525da2e2ef6Smrg  CTAGS=ctags
526da2e2ef6Smrgfi
527da2e2ef6SmrgAC_SUBST([CTAGS])
528da2e2ef6Smrgif test -z "$ETAGS"; then
529da2e2ef6Smrg  ETAGS=etags
530da2e2ef6Smrgfi
531da2e2ef6SmrgAC_SUBST([ETAGS])
532da2e2ef6Smrgif test -z "$CSCOPE"; then
533da2e2ef6Smrg  CSCOPE=cscope
534da2e2ef6Smrgfi
535da2e2ef6SmrgAC_SUBST([CSCOPE])
536578741aaSmrg
5371d778f8eSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538da2e2ef6Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539da2e2ef6Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540da2e2ef6Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541da2e2ef6SmrgAC_CONFIG_COMMANDS_PRE(dnl
542da2e2ef6Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543da2e2ef6Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544629baa8cSmrg
5451d778f8eSmrgAC_REQUIRE([_AM_PROG_RM_F])
5461d778f8eSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
547b7d26471Smrg
548da2e2ef6Smrgdnl The trailing newline in this macro's definition is deliberate, for
549da2e2ef6Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550da2e2ef6Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551da2e2ef6Smrg])
552145b7b3cSmrg
553da2e2ef6Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554da2e2ef6Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555da2e2ef6Smrgdnl mangled by Autoconf and run in a shell conditional statement.
556da2e2ef6Smrgm4_define([_AC_COMPILER_EXEEXT],
557da2e2ef6Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558145b7b3cSmrg
559da2e2ef6Smrg# When config.status generates a header, we must update the stamp-h file.
560da2e2ef6Smrg# This file resides in the same directory as the config header
561da2e2ef6Smrg# that is generated.  The stamp files are numbered to have different names.
5625ffd6003Smrg
563da2e2ef6Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564da2e2ef6Smrg# loop where config.status creates the headers, so we can generate
565da2e2ef6Smrg# our stamp files there.
566da2e2ef6SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567da2e2ef6Smrg[# Compute $1's index in $config_headers.
568da2e2ef6Smrg_am_arg=$1
569da2e2ef6Smrg_am_stamp_count=1
570da2e2ef6Smrgfor _am_header in $config_headers :; do
571da2e2ef6Smrg  case $_am_header in
572da2e2ef6Smrg    $_am_arg | $_am_arg:* )
573da2e2ef6Smrg      break ;;
574da2e2ef6Smrg    * )
575da2e2ef6Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576da2e2ef6Smrg  esac
577da2e2ef6Smrgdone
578da2e2ef6Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5795ffd6003Smrg
5801d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581da2e2ef6Smrg#
582da2e2ef6Smrg# This file is free software; the Free Software Foundation
583da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
584da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
585da2e2ef6Smrg
586da2e2ef6Smrg# AM_PROG_INSTALL_SH
587da2e2ef6Smrg# ------------------
588da2e2ef6Smrg# Define $install_sh.
589da2e2ef6SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590da2e2ef6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591da2e2ef6Smrgif test x"${install_sh+set}" != xset; then
592da2e2ef6Smrg  case $am_aux_dir in
593da2e2ef6Smrg  *\ * | *\	*)
594da2e2ef6Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595da2e2ef6Smrg  *)
596da2e2ef6Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597da2e2ef6Smrg  esac
598da2e2ef6Smrgfi
599da2e2ef6SmrgAC_SUBST([install_sh])])
600da2e2ef6Smrg
6011d778f8eSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602da2e2ef6Smrg#
603da2e2ef6Smrg# This file is free software; the Free Software Foundation
604da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
605da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
606da2e2ef6Smrg
607da2e2ef6Smrg# Check whether the underlying file-system supports filenames
608da2e2ef6Smrg# with a leading dot.  For instance MS-DOS doesn't.
609da2e2ef6SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610da2e2ef6Smrg[rm -rf .tst 2>/dev/null
611da2e2ef6Smrgmkdir .tst 2>/dev/null
612da2e2ef6Smrgif test -d .tst; then
613da2e2ef6Smrg  am__leading_dot=.
614b7d26471Smrgelse
615da2e2ef6Smrg  am__leading_dot=_
616b7d26471Smrgfi
617da2e2ef6Smrgrmdir .tst 2>/dev/null
618da2e2ef6SmrgAC_SUBST([am__leading_dot])])
619629baa8cSmrg
620da2e2ef6Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6215ffd6003Smrg
6221d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623da2e2ef6Smrg#
624da2e2ef6Smrg# This file is free software; the Free Software Foundation
625da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
626da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
627629baa8cSmrg
628da2e2ef6Smrg# AM_MAKE_INCLUDE()
629da2e2ef6Smrg# -----------------
630da2e2ef6Smrg# Check whether make has an 'include' directive that can support all
631da2e2ef6Smrg# the idioms we need for our automatic dependency tracking code.
632da2e2ef6SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633da2e2ef6Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634da2e2ef6Smrgcat > confinc.mk << 'END'
635da2e2ef6Smrgam__doit:
636da2e2ef6Smrg	@echo this is the am__doit target >confinc.out
637da2e2ef6Smrg.PHONY: am__doit
638da2e2ef6SmrgEND
639da2e2ef6Smrgam__include="#"
640da2e2ef6Smrgam__quote=
641da2e2ef6Smrg# BSD make does it like this.
642da2e2ef6Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643da2e2ef6Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644da2e2ef6Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645da2e2ef6Smrg_am_result=no
646da2e2ef6Smrgfor s in GNU BSD; do
647da2e2ef6Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648da2e2ef6Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649da2e2ef6Smrg      ['0:this is the am__doit target'],
650da2e2ef6Smrg      [AS_CASE([$s],
651da2e2ef6Smrg          [BSD], [am__include='.include' am__quote='"'],
652da2e2ef6Smrg          [am__include='include' am__quote=''])])
653da2e2ef6Smrg  if test "$am__include" != "#"; then
654da2e2ef6Smrg    _am_result="yes ($s style)"
655da2e2ef6Smrg    break
656da2e2ef6Smrg  fi
657da2e2ef6Smrgdone
658da2e2ef6Smrgrm -f confinc.* confmf.*
659da2e2ef6SmrgAC_MSG_RESULT([${_am_result}])
660da2e2ef6SmrgAC_SUBST([am__include])])
661da2e2ef6SmrgAC_SUBST([am__quote])])
662145b7b3cSmrg
663da2e2ef6Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664629baa8cSmrg
6651d778f8eSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6665ffd6003Smrg#
667da2e2ef6Smrg# This file is free software; the Free Software Foundation
668da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
669da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
670145b7b3cSmrg
671da2e2ef6Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672da2e2ef6Smrg# ------------------------------
673da2e2ef6SmrgAC_DEFUN([AM_MISSING_PROG],
674da2e2ef6Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675da2e2ef6Smrg$1=${$1-"${am_missing_run}$2"}
676da2e2ef6SmrgAC_SUBST($1)])
6775ffd6003Smrg
678da2e2ef6Smrg# AM_MISSING_HAS_RUN
679da2e2ef6Smrg# ------------------
680da2e2ef6Smrg# Define MISSING if not defined so far and test if it is modern enough.
681da2e2ef6Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682da2e2ef6SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683da2e2ef6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684da2e2ef6SmrgAC_REQUIRE_AUX_FILE([missing])dnl
685da2e2ef6Smrgif test x"${MISSING+set}" != xset; then
686da2e2ef6Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687b7d26471Smrgfi
688da2e2ef6Smrg# Use eval to expand $SHELL
689da2e2ef6Smrgif eval "$MISSING --is-lightweight"; then
690da2e2ef6Smrg  am_missing_run="$MISSING "
691da2e2ef6Smrgelse
692da2e2ef6Smrg  am_missing_run=
693da2e2ef6Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694629baa8cSmrgfi
695da2e2ef6Smrg])
696b7d26471Smrg
697da2e2ef6Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698145b7b3cSmrg
6991d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700da2e2ef6Smrg#
701da2e2ef6Smrg# This file is free software; the Free Software Foundation
702da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
703da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
704145b7b3cSmrg
705da2e2ef6Smrg# _AM_MANGLE_OPTION(NAME)
706da2e2ef6Smrg# -----------------------
707da2e2ef6SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708da2e2ef6Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709145b7b3cSmrg
710da2e2ef6Smrg# _AM_SET_OPTION(NAME)
711da2e2ef6Smrg# --------------------
712da2e2ef6Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713da2e2ef6SmrgAC_DEFUN([_AM_SET_OPTION],
714da2e2ef6Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715145b7b3cSmrg
716da2e2ef6Smrg# _AM_SET_OPTIONS(OPTIONS)
717da2e2ef6Smrg# ------------------------
718da2e2ef6Smrg# OPTIONS is a space-separated list of Automake options.
719da2e2ef6SmrgAC_DEFUN([_AM_SET_OPTIONS],
720da2e2ef6Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721da2e2ef6Smrg
722da2e2ef6Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723da2e2ef6Smrg# -------------------------------------------
724da2e2ef6Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725da2e2ef6SmrgAC_DEFUN([_AM_IF_OPTION],
726da2e2ef6Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727da2e2ef6Smrg
7281d778f8eSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
729b7d26471Smrg#
730da2e2ef6Smrg# This file is free software; the Free Software Foundation
731da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
732da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
733629baa8cSmrg
734da2e2ef6Smrg# _AM_PROG_CC_C_O
735da2e2ef6Smrg# ---------------
736da2e2ef6Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737da2e2ef6Smrg# to automatically call this.
738da2e2ef6SmrgAC_DEFUN([_AM_PROG_CC_C_O],
739da2e2ef6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740da2e2ef6SmrgAC_REQUIRE_AUX_FILE([compile])dnl
741da2e2ef6SmrgAC_LANG_PUSH([C])dnl
742da2e2ef6SmrgAC_CACHE_CHECK(
743da2e2ef6Smrg  [whether $CC understands -c and -o together],
744da2e2ef6Smrg  [am_cv_prog_cc_c_o],
745da2e2ef6Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746da2e2ef6Smrg  # Make sure it works both with $CC and with simple cc.
747da2e2ef6Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748da2e2ef6Smrg  # compilers refuse to overwrite an existing .o file with -o,
749da2e2ef6Smrg  # though they will create one.
750da2e2ef6Smrg  am_cv_prog_cc_c_o=yes
751da2e2ef6Smrg  for am_i in 1 2; do
752da2e2ef6Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753da2e2ef6Smrg         && test -f conftest2.$ac_objext; then
754da2e2ef6Smrg      : OK
755da2e2ef6Smrg    else
756da2e2ef6Smrg      am_cv_prog_cc_c_o=no
757da2e2ef6Smrg      break
758da2e2ef6Smrg    fi
759da2e2ef6Smrg  done
760da2e2ef6Smrg  rm -f core conftest*
761da2e2ef6Smrg  unset am_i])
762da2e2ef6Smrgif test "$am_cv_prog_cc_c_o" != yes; then
763da2e2ef6Smrg   # Losing compiler, so override with the script.
764da2e2ef6Smrg   # FIXME: It is wrong to rewrite CC.
765da2e2ef6Smrg   # But if we don't then we get into trouble of one sort or another.
766da2e2ef6Smrg   # A longer-term fix would be to have automake use am__CC in this case,
767da2e2ef6Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768da2e2ef6Smrg   CC="$am_aux_dir/compile $CC"
769629baa8cSmrgfi
770da2e2ef6SmrgAC_LANG_POP([C])])
771629baa8cSmrg
772da2e2ef6Smrg# For backward compatibility.
773da2e2ef6SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774629baa8cSmrg
7751d778f8eSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7761d778f8eSmrg#
7771d778f8eSmrg# This file is free software; the Free Software Foundation
7781d778f8eSmrg# gives unlimited permission to copy and/or distribute it,
7791d778f8eSmrg# with or without modifications, as long as this notice is preserved.
7801d778f8eSmrg
7811d778f8eSmrg# _AM_PROG_RM_F
7821d778f8eSmrg# ---------------
7831d778f8eSmrg# Check whether 'rm -f' without any arguments works.
7841d778f8eSmrg# https://bugs.gnu.org/10828
7851d778f8eSmrgAC_DEFUN([_AM_PROG_RM_F],
7861d778f8eSmrg[am__rm_f_notfound=
7871d778f8eSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7881d778f8eSmrgAC_SUBST(am__rm_f_notfound)
7891d778f8eSmrg])
7901d778f8eSmrg
7911d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792629baa8cSmrg#
793da2e2ef6Smrg# This file is free software; the Free Software Foundation
794da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
795da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
796629baa8cSmrg
797da2e2ef6Smrg# AM_RUN_LOG(COMMAND)
798da2e2ef6Smrg# -------------------
799da2e2ef6Smrg# Run COMMAND, save the exit status in ac_status, and log it.
800da2e2ef6Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801da2e2ef6SmrgAC_DEFUN([AM_RUN_LOG],
802da2e2ef6Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803da2e2ef6Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804da2e2ef6Smrg   ac_status=$?
805da2e2ef6Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806da2e2ef6Smrg   (exit $ac_status); }])
807da2e2ef6Smrg
808da2e2ef6Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
809da2e2ef6Smrg
8101d778f8eSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
811629baa8cSmrg#
812da2e2ef6Smrg# This file is free software; the Free Software Foundation
813da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
814da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
815629baa8cSmrg
8161d778f8eSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
8171d778f8eSmrg# ----------------------------
8181d778f8eSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8191d778f8eSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8201d778f8eSmrg               am_cv_sleep_fractional_seconds, [dnl
8211d778f8eSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8221d778f8eSmrg                                 [am_cv_sleep_fractional_seconds=no])
8231d778f8eSmrg])])
8241d778f8eSmrg
8251d778f8eSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8261d778f8eSmrg# -----------------------------------
8271d778f8eSmrg# Determine the filesystem's resolution for file modification
8281d778f8eSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
8291d778f8eSmrg# of only two seconds, even with the most recent "exFAT" extensions.
8301d778f8eSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8311d778f8eSmrg# nanosecond, matching clock_gettime.  However, it is probably not
8321d778f8eSmrg# possible to delay execution of a shell script for less than one
8331d778f8eSmrg# millisecond, due to process creation overhead and scheduling
8341d778f8eSmrg# granularity, so we don't check for anything finer than that. (See below.)
8351d778f8eSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8361d778f8eSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8371d778f8eSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8381d778f8eSmrg               am_cv_filesystem_timestamp_resolution, [dnl
8391d778f8eSmrg# Default to the worst case.
8401d778f8eSmrgam_cv_filesystem_timestamp_resolution=2
8411d778f8eSmrg
8421d778f8eSmrg# Only try to go finer than 1 sec if sleep can do it.
8431d778f8eSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8441d778f8eSmrg# - 1 sec is not much of a win compared to 2 sec, and
8451d778f8eSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
8461d778f8eSmrg# 
8471d778f8eSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
8481d778f8eSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8491d778f8eSmrg# exchange for not incurring the 2s delay for running the test for all
8501d778f8eSmrg# packages.
8511d778f8eSmrg#
8521d778f8eSmrgam_try_resolutions=
8531d778f8eSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8541d778f8eSmrg  # Even a millisecond often causes a bunch of false positives,
8551d778f8eSmrg  # so just try a hundredth of a second. The time saved between .001 and
8561d778f8eSmrg  # .01 is not terribly consequential.
8571d778f8eSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8581d778f8eSmrgfi
8591d778f8eSmrg
8601d778f8eSmrg# In order to catch current-generation FAT out, we must *modify* files
8611d778f8eSmrg# that already exist; the *creation* timestamp is finer.  Use names
8621d778f8eSmrg# that make ls -t sort them differently when they have equal
8631d778f8eSmrg# timestamps than when they have distinct timestamps, keeping
8641d778f8eSmrg# in mind that ls -t prints the *newest* file first.
8651d778f8eSmrgrm -f conftest.ts?
8661d778f8eSmrg: > conftest.ts1
8671d778f8eSmrg: > conftest.ts2
8681d778f8eSmrg: > conftest.ts3
8691d778f8eSmrg
8701d778f8eSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8711d778f8eSmrg# clobber the current shell's arguments. (Outer-level square brackets
8721d778f8eSmrg# are removed by m4; they're present so that m4 does not expand
8731d778f8eSmrg# <dollar><star>; be careful, easy to get confused.)
8741d778f8eSmrgif (
8751d778f8eSmrg     set X `[ls -t conftest.ts[12]]` &&
8761d778f8eSmrg     {
8771d778f8eSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8781d778f8eSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8791d778f8eSmrg     }
8801d778f8eSmrg); then :; else
8811d778f8eSmrg  # If neither matched, then we have a broken ls.  This can happen
8821d778f8eSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8831d778f8eSmrg  # broken ls alias from the environment.  This has actually
8841d778f8eSmrg  # happened.  Such a system could not be considered "sane".
8851d778f8eSmrg  _AS_ECHO_UNQUOTED(
8861d778f8eSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8871d778f8eSmrg    [AS_MESSAGE_LOG_FD])
8881d778f8eSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8891d778f8eSmrgMake sure there is not a broken ls alias in your environment.])
8901d778f8eSmrgfi
8911d778f8eSmrg
8921d778f8eSmrgfor am_try_res in $am_try_resolutions; do
8931d778f8eSmrg  # Any one fine-grained sleep might happen to cross the boundary
8941d778f8eSmrg  # between two values of a coarser actual resolution, but if we do
8951d778f8eSmrg  # two fine-grained sleeps in a row, at least one of them will fall
8961d778f8eSmrg  # entirely within a coarse interval.
8971d778f8eSmrg  echo alpha > conftest.ts1
8981d778f8eSmrg  sleep $am_try_res
8991d778f8eSmrg  echo beta > conftest.ts2
9001d778f8eSmrg  sleep $am_try_res
9011d778f8eSmrg  echo gamma > conftest.ts3
9021d778f8eSmrg
9031d778f8eSmrg  # We assume that 'ls -t' will make use of high-resolution
9041d778f8eSmrg  # timestamps if the operating system supports them at all.
9051d778f8eSmrg  if (set X `ls -t conftest.ts?` &&
9061d778f8eSmrg      test "$[]2" = conftest.ts3 &&
9071d778f8eSmrg      test "$[]3" = conftest.ts2 &&
9081d778f8eSmrg      test "$[]4" = conftest.ts1); then
9091d778f8eSmrg    #
9101d778f8eSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9111d778f8eSmrg    # because we don't need to test make.
9121d778f8eSmrg    make_ok=true
9131d778f8eSmrg    if test $am_try_res != 1; then
9141d778f8eSmrg      # But if we've succeeded so far with a subsecond resolution, we
9151d778f8eSmrg      # have one more thing to check: make. It can happen that
9161d778f8eSmrg      # everything else supports the subsecond mtimes, but make doesn't;
9171d778f8eSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9181d778f8eSmrg      # released under GPLv2). https://bugs.gnu.org/68808
9191d778f8eSmrg      # 
9201d778f8eSmrg      # We test $MAKE if it is defined in the environment, else "make".
9211d778f8eSmrg      # It might get overridden later, but our hope is that in practice
9221d778f8eSmrg      # it does not matter: it is the system "make" which is (by far)
9231d778f8eSmrg      # the most likely to be broken, whereas if the user overrides it,
9241d778f8eSmrg      # probably they did so with a better, or at least not worse, make.
9251d778f8eSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9261d778f8eSmrg      #
9271d778f8eSmrg      # Create a Makefile (real tab character here):
9281d778f8eSmrg      rm -f conftest.mk
9291d778f8eSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9301d778f8eSmrg      echo '	touch conftest.ts2' >>conftest.mk
9311d778f8eSmrg      #
9321d778f8eSmrg      # Now, running
9331d778f8eSmrg      #   touch conftest.ts1; touch conftest.ts2; make
9341d778f8eSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9351d778f8eSmrg      # but most often, it will fail if make's support is insufficient. So
9361d778f8eSmrg      # test for several consecutive successes.
9371d778f8eSmrg      #
9381d778f8eSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
9391d778f8eSmrg      # files, not create new ones, per above.)
9401d778f8eSmrg      n=0
9411d778f8eSmrg      make=${MAKE-make}
9421d778f8eSmrg      until test $n -eq 3; do
9431d778f8eSmrg        echo one > conftest.ts1
9441d778f8eSmrg        sleep $am_try_res
9451d778f8eSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9461d778f8eSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9471d778f8eSmrg          make_ok=false
9481d778f8eSmrg          break # out of $n loop
9491d778f8eSmrg        fi
9501d778f8eSmrg        n=`expr $n + 1`
9511d778f8eSmrg      done
9521d778f8eSmrg    fi
9531d778f8eSmrg    #
9541d778f8eSmrg    if $make_ok; then
9551d778f8eSmrg      # Everything we know to check worked out, so call this resolution good.
9561d778f8eSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9571d778f8eSmrg      break # out of $am_try_res loop
9581d778f8eSmrg    fi
9591d778f8eSmrg    # Otherwise, we'll go on to check the next resolution.
9601d778f8eSmrg  fi
9611d778f8eSmrgdone
9621d778f8eSmrgrm -f conftest.ts?
9631d778f8eSmrg# (end _am_filesystem_timestamp_resolution)
9641d778f8eSmrg])])
9651d778f8eSmrg
966da2e2ef6Smrg# AM_SANITY_CHECK
967da2e2ef6Smrg# ---------------
968da2e2ef6SmrgAC_DEFUN([AM_SANITY_CHECK],
9691d778f8eSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9701d778f8eSmrg# This check should not be cached, as it may vary across builds of
9711d778f8eSmrg# different projects.
9721d778f8eSmrgAC_MSG_CHECKING([whether build environment is sane])
973da2e2ef6Smrg# Reject unsafe characters in $srcdir or the absolute working directory
974da2e2ef6Smrg# name.  Accept space and tab only in the latter.
975da2e2ef6Smrgam_lf='
976da2e2ef6Smrg'
977da2e2ef6Smrgcase `pwd` in
978da2e2ef6Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979da2e2ef6Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980da2e2ef6Smrgesac
981da2e2ef6Smrgcase $srcdir in
982da2e2ef6Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983da2e2ef6Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984da2e2ef6Smrgesac
985da2e2ef6Smrg
986da2e2ef6Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987da2e2ef6Smrg# arguments.  Must try -L first in case configure is actually a
988da2e2ef6Smrg# symlink; some systems play weird games with the mod time of symlinks
989da2e2ef6Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990da2e2ef6Smrg# directory).
9911d778f8eSmrgam_build_env_is_sane=no
9921d778f8eSmrgam_has_slept=no
9931d778f8eSmrgrm -f conftest.file
9941d778f8eSmrgfor am_try in 1 2; do
9951d778f8eSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9961d778f8eSmrg  if (
9971d778f8eSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9981d778f8eSmrg    if test "$[]*" = "X"; then
9991d778f8eSmrg      # -L didn't work.
10001d778f8eSmrg      set X `ls -t "$srcdir/configure" conftest.file`
10011d778f8eSmrg    fi
10021d778f8eSmrg    test "$[]2" = conftest.file
10031d778f8eSmrg  ); then
10041d778f8eSmrg    am_build_env_is_sane=yes
10051d778f8eSmrg    break
10061d778f8eSmrg  fi
10071d778f8eSmrg  # Just in case.
10081d778f8eSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
10091d778f8eSmrg  am_has_slept=yes
10101d778f8eSmrgdone
10111d778f8eSmrg
10121d778f8eSmrgAC_MSG_RESULT([$am_build_env_is_sane])
10131d778f8eSmrgif test "$am_build_env_is_sane" = no; then
10141d778f8eSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015da2e2ef6SmrgCheck your system clock])
1016629baa8cSmrgfi
10171d778f8eSmrg
1018da2e2ef6Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019da2e2ef6Smrg# generated files are strictly newer.
1020da2e2ef6Smrgam_sleep_pid=
10211d778f8eSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10221d778f8eSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023da2e2ef6Smrg  am_sleep_pid=$!
10241d778f8eSmrg])
1025da2e2ef6SmrgAC_CONFIG_COMMANDS_PRE(
1026da2e2ef6Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027da2e2ef6Smrg   if test -n "$am_sleep_pid"; then
1028da2e2ef6Smrg     # Hide warnings about reused PIDs.
1029da2e2ef6Smrg     wait $am_sleep_pid 2>/dev/null
1030da2e2ef6Smrg   fi
1031da2e2ef6Smrg   AC_MSG_RESULT([done])])
1032da2e2ef6Smrgrm -f conftest.file
1033da2e2ef6Smrg])
1034629baa8cSmrg
10351d778f8eSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036b7d26471Smrg#
1037da2e2ef6Smrg# This file is free software; the Free Software Foundation
1038da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
1039da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
1040629baa8cSmrg
10411d778f8eSmrg# _AM_SILENT_RULES
10421d778f8eSmrg# ----------------
10431d778f8eSmrg# Enable less verbose build rules support.
10441d778f8eSmrgAC_DEFUN([_AM_SILENT_RULES],
10451d778f8eSmrg[AM_DEFAULT_VERBOSITY=1
10461d778f8eSmrgAC_ARG_ENABLE([silent-rules], [dnl
1047da2e2ef6SmrgAS_HELP_STRING(
1048da2e2ef6Smrg  [--enable-silent-rules],
1049da2e2ef6Smrg  [less verbose build output (undo: "make V=1")])
1050da2e2ef6SmrgAS_HELP_STRING(
1051da2e2ef6Smrg  [--disable-silent-rules],
1052da2e2ef6Smrg  [verbose build output (undo: "make V=0")])dnl
1053da2e2ef6Smrg])
1054da2e2ef6Smrgdnl
1055da2e2ef6Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056da2e2ef6Smrgdnl do not support nested variable expansions.
1057da2e2ef6Smrgdnl See automake bug#9928 and bug#10237.
1058da2e2ef6Smrgam_make=${MAKE-make}
1059da2e2ef6SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060da2e2ef6Smrg   [am_cv_make_support_nested_variables],
1061da2e2ef6Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062da2e2ef6SmrgBAR0=false
1063da2e2ef6SmrgBAR1=true
1064da2e2ef6SmrgV=1
1065da2e2ef6Smrgam__doit:
1066da2e2ef6Smrg	@$(TRUE)
1067da2e2ef6Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068da2e2ef6Smrg  am_cv_make_support_nested_variables=yes
1069b7d26471Smrgelse
1070da2e2ef6Smrg  am_cv_make_support_nested_variables=no
1071da2e2ef6Smrgfi])
1072da2e2ef6SmrgAC_SUBST([AM_V])dnl
1073da2e2ef6SmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074da2e2ef6SmrgAC_SUBST([AM_DEFAULT_V])dnl
1075da2e2ef6SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076da2e2ef6SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077da2e2ef6SmrgAM_BACKSLASH='\'
1078da2e2ef6SmrgAC_SUBST([AM_BACKSLASH])dnl
1079da2e2ef6Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10801d778f8eSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10811d778f8eSmrgdnl to AM_SILENT_RULES to change the default value.
10821d778f8eSmrgAC_CONFIG_COMMANDS_PRE([dnl
10831d778f8eSmrgcase $enable_silent_rules in @%:@ (((
10841d778f8eSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
10851d778f8eSmrg   no) AM_DEFAULT_VERBOSITY=1;;
10861d778f8eSmrgesac
10871d778f8eSmrgif test $am_cv_make_support_nested_variables = yes; then
10881d778f8eSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10891d778f8eSmrg  AM_V='$(V)'
10901d778f8eSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10911d778f8eSmrgelse
10921d778f8eSmrg  AM_V=$AM_DEFAULT_VERBOSITY
10931d778f8eSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10941d778f8eSmrgfi
10951d778f8eSmrg])dnl
1096da2e2ef6Smrg])
1097629baa8cSmrg
10981d778f8eSmrg# AM_SILENT_RULES([DEFAULT])
10991d778f8eSmrg# --------------------------
11001d778f8eSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11011d778f8eSmrg# empty being verbose).
11021d778f8eSmrgAC_DEFUN([AM_SILENT_RULES],
11031d778f8eSmrg[AC_REQUIRE([_AM_SILENT_RULES])
11041d778f8eSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11051d778f8eSmrg
11061d778f8eSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107b7d26471Smrg#
1108da2e2ef6Smrg# This file is free software; the Free Software Foundation
1109da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
1110da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
1111629baa8cSmrg
1112da2e2ef6Smrg# AM_PROG_INSTALL_STRIP
1113da2e2ef6Smrg# ---------------------
1114da2e2ef6Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115da2e2ef6Smrg# specify the program used to strip binaries.  This is especially
1116da2e2ef6Smrg# annoying in cross-compiling environments, where the build's strip
1117da2e2ef6Smrg# is unlikely to handle the host's binaries.
1118da2e2ef6Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119da2e2ef6Smrg# always use install-sh in "make install-strip", and initialize
1120da2e2ef6Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121da2e2ef6SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122da2e2ef6Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123da2e2ef6Smrg# Installed binaries are usually stripped using 'strip' when the user
1124da2e2ef6Smrg# run "make install-strip".  However 'strip' might not be the right
1125da2e2ef6Smrg# tool to use in cross-compilation environments, therefore Automake
1126da2e2ef6Smrg# will honor the 'STRIP' environment variable to overrule this program.
1127da2e2ef6Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128da2e2ef6Smrgif test "$cross_compiling" != no; then
1129da2e2ef6Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130b7d26471Smrgfi
1131da2e2ef6SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132da2e2ef6SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133629baa8cSmrg
11341d778f8eSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135b7d26471Smrg#
1136da2e2ef6Smrg# This file is free software; the Free Software Foundation
1137da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
1138da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
1139629baa8cSmrg
1140da2e2ef6Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1141da2e2ef6Smrg# ---------------------------
1142da2e2ef6Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143da2e2ef6Smrg# This macro is traced by Automake.
1144da2e2ef6SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1145629baa8cSmrg
1146da2e2ef6Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1147da2e2ef6Smrg# --------------------------
1148da2e2ef6Smrg# Public sister of _AM_SUBST_NOTMAKE.
1149da2e2ef6SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150629baa8cSmrg
1151da2e2ef6Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152629baa8cSmrg
11531d778f8eSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
1154b7d26471Smrg#
1155da2e2ef6Smrg# This file is free software; the Free Software Foundation
1156da2e2ef6Smrg# gives unlimited permission to copy and/or distribute it,
1157da2e2ef6Smrg# with or without modifications, as long as this notice is preserved.
1158da2e2ef6Smrg
1159da2e2ef6Smrg# _AM_PROG_TAR(FORMAT)
1160da2e2ef6Smrg# --------------------
1161da2e2ef6Smrg# Check how to create a tarball in format FORMAT.
1162da2e2ef6Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163b7d26471Smrg#
1164da2e2ef6Smrg# Substitute a variable $(am__tar) that is a command
1165da2e2ef6Smrg# writing to stdout a FORMAT-tarball containing the directory
1166da2e2ef6Smrg# $tardir.
1167da2e2ef6Smrg#     tardir=directory && $(am__tar) > result.tar
1168b7d26471Smrg#
1169da2e2ef6Smrg# Substitute a variable $(am__untar) that extract such
1170da2e2ef6Smrg# a tarball read from stdin.
1171da2e2ef6Smrg#     $(am__untar) < result.tar
1172b7d26471Smrg#
1173da2e2ef6SmrgAC_DEFUN([_AM_PROG_TAR],
1174da2e2ef6Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175da2e2ef6Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1176da2e2ef6SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1177629baa8cSmrg
1178da2e2ef6Smrg# We'll loop over all known methods to create a tar archive until one works.
1179da2e2ef6Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180629baa8cSmrg
1181da2e2ef6Smrgm4_if([$1], [v7],
1182da2e2ef6Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183629baa8cSmrg
1184da2e2ef6Smrg  [m4_case([$1],
1185da2e2ef6Smrg    [ustar],
1186da2e2ef6Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187da2e2ef6Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188da2e2ef6Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189da2e2ef6Smrg      # and bug#13588).
1190da2e2ef6Smrg      am_max_uid=2097151 # 2^21 - 1
1191da2e2ef6Smrg      am_max_gid=$am_max_uid
1192da2e2ef6Smrg      # The $UID and $GID variables are not portable, so we need to resort
1193da2e2ef6Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194da2e2ef6Smrg      # below are definitely unexpected, so allow the users to see them
1195da2e2ef6Smrg      # (that is, avoid stderr redirection).
1196da2e2ef6Smrg      am_uid=`id -u || echo unknown`
1197da2e2ef6Smrg      am_gid=`id -g || echo unknown`
1198da2e2ef6Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11991d778f8eSmrg      if test x$am_uid = xunknown; then
12001d778f8eSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12011d778f8eSmrg      elif test $am_uid -le $am_max_uid; then
12021d778f8eSmrg        AC_MSG_RESULT([yes])
1203da2e2ef6Smrg      else
12041d778f8eSmrg        AC_MSG_RESULT([no])
12051d778f8eSmrg        _am_tools=none
1206da2e2ef6Smrg      fi
1207da2e2ef6Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12081d778f8eSmrg      if test x$gm_gid = xunknown; then
12091d778f8eSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12101d778f8eSmrg      elif test $am_gid -le $am_max_gid; then
12111d778f8eSmrg        AC_MSG_RESULT([yes])
1212da2e2ef6Smrg      else
1213da2e2ef6Smrg        AC_MSG_RESULT([no])
1214da2e2ef6Smrg        _am_tools=none
1215da2e2ef6Smrg      fi],
1216629baa8cSmrg
1217da2e2ef6Smrg  [pax],
1218da2e2ef6Smrg    [],
1219629baa8cSmrg
1220da2e2ef6Smrg  [m4_fatal([Unknown tar format])])
1221629baa8cSmrg
1222da2e2ef6Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223629baa8cSmrg
1224da2e2ef6Smrg  # Go ahead even if we have the value already cached.  We do so because we
1225da2e2ef6Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226da2e2ef6Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227629baa8cSmrg
1228da2e2ef6Smrg  for _am_tool in $_am_tools; do
1229da2e2ef6Smrg    case $_am_tool in
1230da2e2ef6Smrg    gnutar)
1231da2e2ef6Smrg      for _am_tar in tar gnutar gtar; do
1232da2e2ef6Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1233da2e2ef6Smrg      done
1234da2e2ef6Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235da2e2ef6Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236da2e2ef6Smrg      am__untar="$_am_tar -xf -"
1237da2e2ef6Smrg      ;;
1238da2e2ef6Smrg    plaintar)
1239da2e2ef6Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240da2e2ef6Smrg      # ustar tarball either.
1241da2e2ef6Smrg      (tar --version) >/dev/null 2>&1 && continue
1242da2e2ef6Smrg      am__tar='tar chf - "$$tardir"'
1243da2e2ef6Smrg      am__tar_='tar chf - "$tardir"'
1244da2e2ef6Smrg      am__untar='tar xf -'
1245da2e2ef6Smrg      ;;
1246da2e2ef6Smrg    pax)
1247da2e2ef6Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248da2e2ef6Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249da2e2ef6Smrg      am__untar='pax -r'
1250da2e2ef6Smrg      ;;
1251da2e2ef6Smrg    cpio)
1252da2e2ef6Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253da2e2ef6Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254da2e2ef6Smrg      am__untar='cpio -i -H $1 -d'
1255da2e2ef6Smrg      ;;
1256da2e2ef6Smrg    none)
1257da2e2ef6Smrg      am__tar=false
1258da2e2ef6Smrg      am__tar_=false
1259da2e2ef6Smrg      am__untar=false
1260da2e2ef6Smrg      ;;
1261da2e2ef6Smrg    esac
1262629baa8cSmrg
1263da2e2ef6Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264da2e2ef6Smrg    # and am__untar set.
1265da2e2ef6Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266629baa8cSmrg
1267da2e2ef6Smrg    # tar/untar a dummy directory, and stop if the command works.
1268da2e2ef6Smrg    rm -rf conftest.dir
1269da2e2ef6Smrg    mkdir conftest.dir
1270da2e2ef6Smrg    echo GrepMe > conftest.dir/file
1271da2e2ef6Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272da2e2ef6Smrg    rm -rf conftest.dir
1273da2e2ef6Smrg    if test -s conftest.tar; then
1274da2e2ef6Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275da2e2ef6Smrg      AM_RUN_LOG([cat conftest.dir/file])
1276da2e2ef6Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277da2e2ef6Smrg    fi
1278da2e2ef6Smrg  done
1279da2e2ef6Smrg  rm -rf conftest.dir
1280629baa8cSmrg
1281da2e2ef6Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282da2e2ef6Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283629baa8cSmrg
1284da2e2ef6SmrgAC_SUBST([am__tar])
1285da2e2ef6SmrgAC_SUBST([am__untar])
1286da2e2ef6Smrg]) # _AM_PROG_TAR
1287629baa8cSmrg
12881d778f8eSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12891d778f8eSmrg#
12901d778f8eSmrg# This file is free software; the Free Software Foundation
12911d778f8eSmrg# gives unlimited permission to copy and/or distribute it,
12921d778f8eSmrg# with or without modifications, as long as this notice is preserved.
12931d778f8eSmrg
12941d778f8eSmrg# _AM_PROG_XARGS_N
12951d778f8eSmrg# ----------------
12961d778f8eSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12971d778f8eSmrg# is not optimized at all as we never expect to use it.
12981d778f8eSmrgAC_DEFUN([_AM_PROG_XARGS_N],
12991d778f8eSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13001d778f8eSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13011d778f8eSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13021d778f8eSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13031d778f8eSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13041d778f8eSmrg])dnl
13051d778f8eSmrgAC_SUBST(am__xargs_n)
13061d778f8eSmrg])
13071d778f8eSmrg
1308da2e2ef6Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309da2e2ef6Smrgdnl serial 11 (pkg-config-0.29)
1310da2e2ef6Smrgdnl
1311da2e2ef6Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312da2e2ef6Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313da2e2ef6Smrgdnl
1314da2e2ef6Smrgdnl This program is free software; you can redistribute it and/or modify
1315da2e2ef6Smrgdnl it under the terms of the GNU General Public License as published by
1316da2e2ef6Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317da2e2ef6Smrgdnl (at your option) any later version.
1318da2e2ef6Smrgdnl
1319da2e2ef6Smrgdnl This program is distributed in the hope that it will be useful, but
1320da2e2ef6Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321da2e2ef6Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322da2e2ef6Smrgdnl General Public License for more details.
1323da2e2ef6Smrgdnl
1324da2e2ef6Smrgdnl You should have received a copy of the GNU General Public License
1325da2e2ef6Smrgdnl along with this program; if not, write to the Free Software
1326da2e2ef6Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327da2e2ef6Smrgdnl 02111-1307, USA.
1328da2e2ef6Smrgdnl
1329da2e2ef6Smrgdnl As a special exception to the GNU General Public License, if you
1330da2e2ef6Smrgdnl distribute this file as part of a program that contains a
1331da2e2ef6Smrgdnl configuration script generated by Autoconf, you may include it under
1332da2e2ef6Smrgdnl the same distribution terms that you use for the rest of that
1333da2e2ef6Smrgdnl program.
1334629baa8cSmrg
1335da2e2ef6Smrgdnl PKG_PREREQ(MIN-VERSION)
1336da2e2ef6Smrgdnl -----------------------
1337da2e2ef6Smrgdnl Since: 0.29
1338da2e2ef6Smrgdnl
1339da2e2ef6Smrgdnl Verify that the version of the pkg-config macros are at least
1340da2e2ef6Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341da2e2ef6Smrgdnl installed version of pkg-config, this checks the developer's version
1342da2e2ef6Smrgdnl of pkg.m4 when generating configure.
1343da2e2ef6Smrgdnl
1344da2e2ef6Smrgdnl To ensure that this macro is defined, also add:
1345da2e2ef6Smrgdnl m4_ifndef([PKG_PREREQ],
1346da2e2ef6Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347da2e2ef6Smrgdnl
1348da2e2ef6Smrgdnl See the "Since" comment for each macro you use to see what version
1349da2e2ef6Smrgdnl of the macros you require.
1350da2e2ef6Smrgm4_defun([PKG_PREREQ],
1351da2e2ef6Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352da2e2ef6Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353da2e2ef6Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354da2e2ef6Smrg])dnl PKG_PREREQ
1355629baa8cSmrg
1356da2e2ef6Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357da2e2ef6Smrgdnl ----------------------------------
1358da2e2ef6Smrgdnl Since: 0.16
1359da2e2ef6Smrgdnl
1360da2e2ef6Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361da2e2ef6Smrgdnl first found in the path. Checks that the version of pkg-config found
1362da2e2ef6Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363da2e2ef6Smrgdnl used since that's the first version where most current features of
1364da2e2ef6Smrgdnl pkg-config existed.
1365da2e2ef6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366da2e2ef6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367da2e2ef6Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368da2e2ef6Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369da2e2ef6SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370da2e2ef6SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371da2e2ef6SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372629baa8cSmrg
1373da2e2ef6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374da2e2ef6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375b7d26471Smrgfi
1376da2e2ef6Smrgif test -n "$PKG_CONFIG"; then
1377da2e2ef6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378da2e2ef6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379da2e2ef6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380da2e2ef6Smrg		AC_MSG_RESULT([yes])
1381da2e2ef6Smrg	else
1382da2e2ef6Smrg		AC_MSG_RESULT([no])
1383da2e2ef6Smrg		PKG_CONFIG=""
1384da2e2ef6Smrg	fi
1385da2e2ef6Smrgfi[]dnl
1386da2e2ef6Smrg])dnl PKG_PROG_PKG_CONFIG
1387629baa8cSmrg
1388da2e2ef6Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389da2e2ef6Smrgdnl -------------------------------------------------------------------
1390da2e2ef6Smrgdnl Since: 0.18
1391da2e2ef6Smrgdnl
1392da2e2ef6Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393da2e2ef6Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394da2e2ef6Smrgdnl
1395da2e2ef6Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396da2e2ef6Smrgdnl only at the first occurence in configure.ac, so if the first place
1397da2e2ef6Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398da2e2ef6Smrgdnl have to call PKG_CHECK_EXISTS manually
1399da2e2ef6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400da2e2ef6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401da2e2ef6Smrgif test -n "$PKG_CONFIG" && \
1402da2e2ef6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403da2e2ef6Smrg  m4_default([$2], [:])
1404da2e2ef6Smrgm4_ifvaln([$3], [else
1405da2e2ef6Smrg  $3])dnl
1406da2e2ef6Smrgfi])
1407629baa8cSmrg
1408da2e2ef6Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409da2e2ef6Smrgdnl ---------------------------------------------
1410da2e2ef6Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411da2e2ef6Smrgdnl pkg_failed based on the result.
1412da2e2ef6Smrgm4_define([_PKG_CONFIG],
1413da2e2ef6Smrg[if test -n "$$1"; then
1414da2e2ef6Smrg    pkg_cv_[]$1="$$1"
1415da2e2ef6Smrg elif test -n "$PKG_CONFIG"; then
1416da2e2ef6Smrg    PKG_CHECK_EXISTS([$3],
1417da2e2ef6Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418da2e2ef6Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419da2e2ef6Smrg		     [pkg_failed=yes])
1420da2e2ef6Smrg else
1421da2e2ef6Smrg    pkg_failed=untried
1422da2e2ef6Smrgfi[]dnl
1423da2e2ef6Smrg])dnl _PKG_CONFIG
1424629baa8cSmrg
1425da2e2ef6Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426da2e2ef6Smrgdnl ---------------------------
1427da2e2ef6Smrgdnl Internal check to see if pkg-config supports short errors.
1428da2e2ef6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429da2e2ef6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430da2e2ef6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431da2e2ef6Smrg        _pkg_short_errors_supported=yes
1432b7d26471Smrgelse
1433da2e2ef6Smrg        _pkg_short_errors_supported=no
1434da2e2ef6Smrgfi[]dnl
1435da2e2ef6Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436b7d26471Smrg
1437629baa8cSmrg
1438da2e2ef6Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439da2e2ef6Smrgdnl   [ACTION-IF-NOT-FOUND])
1440da2e2ef6Smrgdnl --------------------------------------------------------------
1441da2e2ef6Smrgdnl Since: 0.4.0
1442da2e2ef6Smrgdnl
1443da2e2ef6Smrgdnl Note that if there is a possibility the first call to
1444da2e2ef6Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445da2e2ef6Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446da2e2ef6SmrgAC_DEFUN([PKG_CHECK_MODULES],
1447da2e2ef6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448da2e2ef6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449da2e2ef6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450da2e2ef6Smrg
1451da2e2ef6Smrgpkg_failed=no
1452da2e2ef6SmrgAC_MSG_CHECKING([for $1])
1453629baa8cSmrg
1454da2e2ef6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455da2e2ef6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456629baa8cSmrg
1457da2e2ef6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458da2e2ef6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1459da2e2ef6SmrgSee the pkg-config man page for more details.])
1460629baa8cSmrg
1461da2e2ef6Smrgif test $pkg_failed = yes; then
1462da2e2ef6Smrg   	AC_MSG_RESULT([no])
1463da2e2ef6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1464da2e2ef6Smrg        if test $_pkg_short_errors_supported = yes; then
1465da2e2ef6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466da2e2ef6Smrg        else 
1467da2e2ef6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468da2e2ef6Smrg        fi
1469da2e2ef6Smrg	# Put the nasty error message in config.log where it belongs
1470da2e2ef6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471629baa8cSmrg
1472da2e2ef6Smrg	m4_default([$4], [AC_MSG_ERROR(
1473da2e2ef6Smrg[Package requirements ($2) were not met:
1474b7d26471Smrg
1475da2e2ef6Smrg$$1_PKG_ERRORS
1476b7d26471Smrg
1477da2e2ef6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478da2e2ef6Smrginstalled software in a non-standard prefix.
1479da2e2ef6Smrg
1480da2e2ef6Smrg_PKG_TEXT])[]dnl
1481da2e2ef6Smrg        ])
1482da2e2ef6Smrgelif test $pkg_failed = untried; then
1483da2e2ef6Smrg     	AC_MSG_RESULT([no])
1484da2e2ef6Smrg	m4_default([$4], [AC_MSG_FAILURE(
1485da2e2ef6Smrg[The pkg-config script could not be found or is too old.  Make sure it
1486da2e2ef6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487da2e2ef6Smrgpath to pkg-config.
1488da2e2ef6Smrg
1489da2e2ef6Smrg_PKG_TEXT
1490da2e2ef6Smrg
1491da2e2ef6SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492da2e2ef6Smrg        ])
1493629baa8cSmrgelse
1494da2e2ef6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495da2e2ef6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496da2e2ef6Smrg        AC_MSG_RESULT([yes])
1497da2e2ef6Smrg	$3
1498da2e2ef6Smrgfi[]dnl
1499da2e2ef6Smrg])dnl PKG_CHECK_MODULES
1500629baa8cSmrg
1501629baa8cSmrg
1502da2e2ef6Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503da2e2ef6Smrgdnl   [ACTION-IF-NOT-FOUND])
1504da2e2ef6Smrgdnl ---------------------------------------------------------------------
1505da2e2ef6Smrgdnl Since: 0.29
1506da2e2ef6Smrgdnl
1507da2e2ef6Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508da2e2ef6Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509da2e2ef6Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510da2e2ef6Smrgdnl
1511da2e2ef6Smrgdnl Note that if there is a possibility the first call to
1512da2e2ef6Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513da2e2ef6Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514da2e2ef6Smrgdnl configure.ac.
1515da2e2ef6SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516da2e2ef6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517da2e2ef6Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518da2e2ef6SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519da2e2ef6SmrgPKG_CHECK_MODULES($@)
1520da2e2ef6SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521da2e2ef6Smrg])dnl PKG_CHECK_MODULES_STATIC
1522629baa8cSmrg
1523629baa8cSmrg
1524da2e2ef6Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525da2e2ef6Smrgdnl -------------------------
1526da2e2ef6Smrgdnl Since: 0.27
1527da2e2ef6Smrgdnl
1528da2e2ef6Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529da2e2ef6Smrgdnl should install pkg-config .pc files. By default the directory is
1530da2e2ef6Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531da2e2ef6Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532da2e2ef6Smrgdnl parameter.
1533da2e2ef6SmrgAC_DEFUN([PKG_INSTALLDIR],
1534da2e2ef6Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535da2e2ef6Smrgm4_pushdef([pkg_description],
1536da2e2ef6Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537da2e2ef6SmrgAC_ARG_WITH([pkgconfigdir],
1538da2e2ef6Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539da2e2ef6Smrg    [with_pkgconfigdir=]pkg_default)
1540da2e2ef6SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541da2e2ef6Smrgm4_popdef([pkg_default])
1542da2e2ef6Smrgm4_popdef([pkg_description])
1543da2e2ef6Smrg])dnl PKG_INSTALLDIR
1544629baa8cSmrg
1545629baa8cSmrg
1546da2e2ef6Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547da2e2ef6Smrgdnl --------------------------------
1548da2e2ef6Smrgdnl Since: 0.27
1549da2e2ef6Smrgdnl
1550da2e2ef6Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551da2e2ef6Smrgdnl module should install arch-independent pkg-config .pc files. By
1552da2e2ef6Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553da2e2ef6Smrgdnl changed by passing DIRECTORY. The user can override through the
1554da2e2ef6Smrgdnl --with-noarch-pkgconfigdir parameter.
1555da2e2ef6SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556da2e2ef6Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557da2e2ef6Smrgm4_pushdef([pkg_description],
1558da2e2ef6Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559da2e2ef6SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560da2e2ef6Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561da2e2ef6Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562da2e2ef6SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563da2e2ef6Smrgm4_popdef([pkg_default])
1564da2e2ef6Smrgm4_popdef([pkg_description])
1565da2e2ef6Smrg])dnl PKG_NOARCH_INSTALLDIR
1566629baa8cSmrg
1567629baa8cSmrg
1568da2e2ef6Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569da2e2ef6Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570da2e2ef6Smrgdnl -------------------------------------------
1571da2e2ef6Smrgdnl Since: 0.28
1572da2e2ef6Smrgdnl
1573da2e2ef6Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574da2e2ef6SmrgAC_DEFUN([PKG_CHECK_VAR],
1575da2e2ef6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576da2e2ef6SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577da2e2ef6Smrg
1578da2e2ef6Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579da2e2ef6SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580da2e2ef6Smrg
1581da2e2ef6SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582da2e2ef6Smrg])dnl PKG_CHECK_VAR
1583da2e2ef6Smrg
1584da2e2ef6Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585da2e2ef6Smrgdnl
15864901b09eSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587da2e2ef6Smrgdnl
1588da2e2ef6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589da2e2ef6Smrgdnl copy of this software and associated documentation files (the "Software"),
1590da2e2ef6Smrgdnl to deal in the Software without restriction, including without limitation
1591da2e2ef6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592da2e2ef6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593da2e2ef6Smrgdnl Software is furnished to do so, subject to the following conditions:
1594da2e2ef6Smrgdnl
1595da2e2ef6Smrgdnl The above copyright notice and this permission notice (including the next
1596da2e2ef6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1597da2e2ef6Smrgdnl Software.
1598da2e2ef6Smrgdnl
1599da2e2ef6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600da2e2ef6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601da2e2ef6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602da2e2ef6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603da2e2ef6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604da2e2ef6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605da2e2ef6Smrgdnl DEALINGS IN THE SOFTWARE.
1606629baa8cSmrg
1607da2e2ef6Smrg# XORG_MACROS_VERSION(required-version)
1608da2e2ef6Smrg# -------------------------------------
1609b7d26471Smrg# Minimum version: 1.1.0
1610b7d26471Smrg#
1611da2e2ef6Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612da2e2ef6Smrg# your configure.ac with the minimum required version, such as:
1613da2e2ef6Smrg# XORG_MACROS_VERSION(1.1)
1614b7d26471Smrg#
1615da2e2ef6Smrg# To ensure that this macro is defined, also add:
1616da2e2ef6Smrg# m4_ifndef([XORG_MACROS_VERSION],
1617da2e2ef6Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618b7d26471Smrg#
1619da2e2ef6Smrg#
1620da2e2ef6Smrg# See the "minimum version" comment for each macro you use to see what
1621da2e2ef6Smrg# version you require.
1622da2e2ef6Smrgm4_defun([XORG_MACROS_VERSION],[
16231d778f8eSmrgm4_define([vers_have], [1.20.2])
1624da2e2ef6Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625da2e2ef6Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626da2e2ef6Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627da2e2ef6Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628da2e2ef6Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629da2e2ef6Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630da2e2ef6Smrgm4_undefine([vers_have])
1631da2e2ef6Smrgm4_undefine([maj_have])
1632da2e2ef6Smrgm4_undefine([maj_needed])
1633da2e2ef6Smrg]) # XORG_MACROS_VERSION
1634629baa8cSmrg
1635da2e2ef6Smrg# XORG_PROG_RAWCPP()
1636da2e2ef6Smrg# ------------------
1637da2e2ef6Smrg# Minimum version: 1.0.0
1638da2e2ef6Smrg#
1639da2e2ef6Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640da2e2ef6Smrg# such as man pages and config files
1641da2e2ef6SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642da2e2ef6SmrgAC_REQUIRE([AC_PROG_CPP])
1643da2e2ef6SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644da2e2ef6Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645629baa8cSmrg
1646da2e2ef6Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647da2e2ef6Smrg# which is not the best choice for supporting other OS'es, but covers most
1648da2e2ef6Smrg# of the ones we need for now.
1649da2e2ef6SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650da2e2ef6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651da2e2ef6Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652da2e2ef6Smrg	AC_MSG_RESULT([no])
1653da2e2ef6Smrgelse
1654da2e2ef6Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655da2e2ef6Smrg		RAWCPPFLAGS=-undef
1656da2e2ef6Smrg		AC_MSG_RESULT([yes])
1657da2e2ef6Smrg	# under Cygwin unix is still defined even with -undef
1658da2e2ef6Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659da2e2ef6Smrg		RAWCPPFLAGS="-undef -ansi"
1660da2e2ef6Smrg		AC_MSG_RESULT([yes, with -ansi])
1661da2e2ef6Smrg	else
1662da2e2ef6Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663da2e2ef6Smrg	fi
1664b7d26471Smrgfi
1665da2e2ef6Smrgrm -f conftest.$ac_ext
1666629baa8cSmrg
1667da2e2ef6SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668da2e2ef6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16694901b09eSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670da2e2ef6Smrg	AC_MSG_RESULT([no])
1671da2e2ef6Smrgelse
16724901b09eSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673da2e2ef6Smrg		TRADITIONALCPPFLAGS="-traditional"
1674da2e2ef6Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675da2e2ef6Smrg		AC_MSG_RESULT([yes])
1676da2e2ef6Smrg	else
1677da2e2ef6Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678da2e2ef6Smrg	fi
1679da2e2ef6Smrgfi
1680da2e2ef6Smrgrm -f conftest.$ac_ext
1681da2e2ef6SmrgAC_SUBST(RAWCPPFLAGS)
1682da2e2ef6SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683da2e2ef6Smrg]) # XORG_PROG_RAWCPP
1684629baa8cSmrg
1685da2e2ef6Smrg# XORG_MANPAGE_SECTIONS()
1686da2e2ef6Smrg# -----------------------
1687da2e2ef6Smrg# Minimum version: 1.0.0
1688b7d26471Smrg#
1689da2e2ef6Smrg# Determine which sections man pages go in for the different man page types
1690da2e2ef6Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691da2e2ef6Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692da2e2ef6Smrg# Override default settings by setting environment variables
1693da2e2ef6Smrg# Added MAN_SUBSTS in version 1.8
1694da2e2ef6Smrg# Added AC_PROG_SED in version 1.8
1695629baa8cSmrg
1696da2e2ef6SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697da2e2ef6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698da2e2ef6SmrgAC_REQUIRE([AC_PROG_SED])
1699b7d26471Smrg
1700da2e2ef6Smrgcase $host_os in
1701da2e2ef6Smrg    solaris*)
1702da2e2ef6Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703da2e2ef6Smrg        # check for a man page file found in later versions that use
1704da2e2ef6Smrg        # traditional section numbers instead
1705da2e2ef6Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706da2e2ef6Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707da2e2ef6Smrg        ;;
1708da2e2ef6Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709da2e2ef6Smrgesac
1710b7d26471Smrg
1711da2e2ef6Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712da2e2ef6Smrg    APP_MAN_SUFFIX=1
1713da2e2ef6Smrgfi
1714da2e2ef6Smrgif test x$APP_MAN_DIR = x    ; then
1715da2e2ef6Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716da2e2ef6Smrgfi
1717629baa8cSmrg
1718da2e2ef6Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719da2e2ef6Smrg    LIB_MAN_SUFFIX=3
1720da2e2ef6Smrgfi
1721da2e2ef6Smrgif test x$LIB_MAN_DIR = x    ; then
1722da2e2ef6Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723da2e2ef6Smrgfi
1724629baa8cSmrg
1725da2e2ef6Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726da2e2ef6Smrg    case $SYSV_MAN_SECTIONS in
1727da2e2ef6Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728da2e2ef6Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729da2e2ef6Smrg    esac
1730da2e2ef6Smrgfi
1731da2e2ef6Smrgif test x$FILE_MAN_DIR = x    ; then
1732da2e2ef6Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733b7d26471Smrgfi
1734629baa8cSmrg
1735da2e2ef6Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736da2e2ef6Smrg    case $SYSV_MAN_SECTIONS in
1737da2e2ef6Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738da2e2ef6Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739da2e2ef6Smrg    esac
1740da2e2ef6Smrgfi
1741da2e2ef6Smrgif test x$MISC_MAN_DIR = x    ; then
1742da2e2ef6Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743b7d26471Smrgfi
1744b7d26471Smrg
1745da2e2ef6Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746da2e2ef6Smrg    case $SYSV_MAN_SECTIONS in
1747da2e2ef6Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748da2e2ef6Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749da2e2ef6Smrg    esac
1750da2e2ef6Smrgfi
1751da2e2ef6Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752da2e2ef6Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753da2e2ef6Smrgfi
1754da2e2ef6Smrg
1755da2e2ef6Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756da2e2ef6Smrg    case $SYSV_MAN_SECTIONS in
1757da2e2ef6Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758da2e2ef6Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759da2e2ef6Smrg    esac
1760da2e2ef6Smrgfi
1761da2e2ef6Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762da2e2ef6Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1763da2e2ef6Smrgfi
1764da2e2ef6Smrg
1765da2e2ef6Smrg
1766da2e2ef6SmrgAC_SUBST([APP_MAN_SUFFIX])
1767da2e2ef6SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768da2e2ef6SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769da2e2ef6SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770da2e2ef6SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771da2e2ef6SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772da2e2ef6SmrgAC_SUBST([APP_MAN_DIR])
1773da2e2ef6SmrgAC_SUBST([LIB_MAN_DIR])
1774da2e2ef6SmrgAC_SUBST([FILE_MAN_DIR])
1775da2e2ef6SmrgAC_SUBST([MISC_MAN_DIR])
1776da2e2ef6SmrgAC_SUBST([DRIVER_MAN_DIR])
1777da2e2ef6SmrgAC_SUBST([ADMIN_MAN_DIR])
1778b7d26471Smrg
1779da2e2ef6SmrgXORG_MAN_PAGE="X Version 11"
1780da2e2ef6SmrgAC_SUBST([XORG_MAN_PAGE])
1781da2e2ef6SmrgMAN_SUBSTS="\
1782da2e2ef6Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783da2e2ef6Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784da2e2ef6Smrg	-e 's|__xservername__|Xorg|g' \
1785da2e2ef6Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786da2e2ef6Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787da2e2ef6Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788da2e2ef6Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789da2e2ef6Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790da2e2ef6Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791da2e2ef6Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792da2e2ef6Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793da2e2ef6Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794da2e2ef6SmrgAC_SUBST([MAN_SUBSTS])
1795b7d26471Smrg
1796da2e2ef6Smrg]) # XORG_MANPAGE_SECTIONS
1797b7d26471Smrg
1798da2e2ef6Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799da2e2ef6Smrg# ------------------------
1800da2e2ef6Smrg# Minimum version: 1.7.0
1801da2e2ef6Smrg#
1802da2e2ef6Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803da2e2ef6Smrg# provided by xorg-sgml-doctools, if installed.
1804da2e2ef6SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805da2e2ef6SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806da2e2ef6SmrgXORG_SGML_PATH=
1807da2e2ef6SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808da2e2ef6Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809da2e2ef6Smrg    [m4_ifval([$1],[:],
1810da2e2ef6Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811da2e2ef6Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812da2e2ef6Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813da2e2ef6Smrg         fi])
1814da2e2ef6Smrg    ])
1815b7d26471Smrg
1816da2e2ef6Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817da2e2ef6Smrg# the path and the name of the doc stylesheet
1818da2e2ef6Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819da2e2ef6Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820da2e2ef6Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821da2e2ef6Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822da2e2ef6Smrgelse
1823da2e2ef6Smrg   AC_MSG_RESULT([no])
1824da2e2ef6Smrgfi
1825b7d26471Smrg
1826da2e2ef6SmrgAC_SUBST(XORG_SGML_PATH)
1827da2e2ef6SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828da2e2ef6SmrgAC_SUBST(XSL_STYLESHEET)
1829da2e2ef6SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830da2e2ef6Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831629baa8cSmrg
1832da2e2ef6Smrg# XORG_CHECK_LINUXDOC
1833da2e2ef6Smrg# -------------------
1834da2e2ef6Smrg# Minimum version: 1.0.0
1835b7d26471Smrg#
1836da2e2ef6Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837da2e2ef6Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838da2e2ef6Smrg# Whether or not the necessary tools and files are found can be checked
1839da2e2ef6Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840da2e2ef6SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841da2e2ef6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842da2e2ef6SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843629baa8cSmrg
1844da2e2ef6SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1845b7d26471Smrg
1846da2e2ef6SmrgAC_MSG_CHECKING([whether to build documentation])
1847da2e2ef6Smrg
1848da2e2ef6Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849da2e2ef6Smrg   BUILDDOC=yes
1850b7d26471Smrgelse
1851da2e2ef6Smrg   BUILDDOC=no
1852b7d26471Smrgfi
1853b7d26471Smrg
1854da2e2ef6SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855b7d26471Smrg
1856da2e2ef6SmrgAC_MSG_RESULT([$BUILDDOC])
1857b7d26471Smrg
1858da2e2ef6SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859b7d26471Smrg
1860da2e2ef6Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861da2e2ef6Smrg   BUILDPDFDOC=yes
1862b7d26471Smrgelse
1863da2e2ef6Smrg   BUILDPDFDOC=no
1864b7d26471Smrgfi
1865b7d26471Smrg
1866da2e2ef6SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867629baa8cSmrg
1868da2e2ef6SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869629baa8cSmrg
1870da2e2ef6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871da2e2ef6SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872da2e2ef6SmrgMAKE_PDF="$PS2PDF"
1873da2e2ef6SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874629baa8cSmrg
1875da2e2ef6SmrgAC_SUBST(MAKE_TEXT)
1876da2e2ef6SmrgAC_SUBST(MAKE_PS)
1877da2e2ef6SmrgAC_SUBST(MAKE_PDF)
1878da2e2ef6SmrgAC_SUBST(MAKE_HTML)
1879da2e2ef6Smrg]) # XORG_CHECK_LINUXDOC
1880629baa8cSmrg
1881da2e2ef6Smrg# XORG_CHECK_DOCBOOK
1882da2e2ef6Smrg# -------------------
1883da2e2ef6Smrg# Minimum version: 1.0.0
1884da2e2ef6Smrg#
1885da2e2ef6Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886da2e2ef6Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887da2e2ef6Smrg# indicates whether the necessary tools and files are found and, if set,
1888da2e2ef6Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889da2e2ef6SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890da2e2ef6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891629baa8cSmrg
1892da2e2ef6SmrgBUILDTXTDOC=no
1893da2e2ef6SmrgBUILDPDFDOC=no
1894da2e2ef6SmrgBUILDPSDOC=no
1895da2e2ef6SmrgBUILDHTMLDOC=no
1896629baa8cSmrg
1897da2e2ef6SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898da2e2ef6SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899da2e2ef6SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900da2e2ef6SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901629baa8cSmrg
1902da2e2ef6SmrgAC_MSG_CHECKING([whether to build text documentation])
1903da2e2ef6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904da2e2ef6Smrg   test x$BUILD_TXTDOC != xno; then
1905da2e2ef6Smrg	BUILDTXTDOC=yes
1906b7d26471Smrgfi
1907da2e2ef6SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908da2e2ef6SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909629baa8cSmrg
1910da2e2ef6SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911da2e2ef6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912da2e2ef6Smrg   test x$BUILD_PDFDOC != xno; then
1913da2e2ef6Smrg	BUILDPDFDOC=yes
1914da2e2ef6Smrgfi
1915da2e2ef6SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916da2e2ef6SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917629baa8cSmrg
1918da2e2ef6SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919da2e2ef6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920da2e2ef6Smrg   test x$BUILD_PSDOC != xno; then
1921da2e2ef6Smrg	BUILDPSDOC=yes
1922da2e2ef6Smrgfi
1923da2e2ef6SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924da2e2ef6SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925629baa8cSmrg
1926da2e2ef6SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927da2e2ef6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928da2e2ef6Smrg   test x$BUILD_HTMLDOC != xno; then
1929da2e2ef6Smrg	BUILDHTMLDOC=yes
1930da2e2ef6Smrgfi
1931da2e2ef6SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932da2e2ef6SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933629baa8cSmrg
1934da2e2ef6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935da2e2ef6SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936da2e2ef6SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937da2e2ef6SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938629baa8cSmrg
1939da2e2ef6SmrgAC_SUBST(MAKE_TEXT)
1940da2e2ef6SmrgAC_SUBST(MAKE_PS)
1941da2e2ef6SmrgAC_SUBST(MAKE_PDF)
1942da2e2ef6SmrgAC_SUBST(MAKE_HTML)
1943da2e2ef6Smrg]) # XORG_CHECK_DOCBOOK
1944da2e2ef6Smrg
1945da2e2ef6Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1946b7d26471Smrg# ----------------
1947da2e2ef6Smrg# Minimum version: 1.5.0
1948da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949b7d26471Smrg#
1950da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
1951da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
1952da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19534901b09eSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954da2e2ef6Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955da2e2ef6Smrg# --with-xmlto assumes 'auto'.
1956b7d26471Smrg#
1957da2e2ef6Smrg# Interface to module:
1958da2e2ef6Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959da2e2ef6Smrg# XMLTO:	returns the path of the xmlto program found
1960da2e2ef6Smrg#		returns the path set by the user in the environment
1961da2e2ef6Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962da2e2ef6Smrg#		'no' user instructs the module not to use xmlto
1963b7d26471Smrg#
1964da2e2ef6Smrg# Added in version 1.10.0
1965da2e2ef6Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966da2e2ef6Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967da2e2ef6Smrg#
1968da2e2ef6Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969da2e2ef6Smrg#
1970da2e2ef6SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971da2e2ef6SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973da2e2ef6SmrgAC_ARG_WITH(xmlto,
1974da2e2ef6Smrg	AS_HELP_STRING([--with-xmlto],
1975da2e2ef6Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976da2e2ef6Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977da2e2ef6Smrgm4_undefine([_defopt])
1978629baa8cSmrg
1979da2e2ef6Smrgif test "x$use_xmlto" = x"auto"; then
1980da2e2ef6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981da2e2ef6Smrg   if test "x$XMLTO" = "x"; then
1982da2e2ef6Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983da2e2ef6Smrg	have_xmlto=no
1984da2e2ef6Smrg   else
1985da2e2ef6Smrg        have_xmlto=yes
1986da2e2ef6Smrg   fi
1987da2e2ef6Smrgelif test "x$use_xmlto" = x"yes" ; then
1988da2e2ef6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989da2e2ef6Smrg   if test "x$XMLTO" = "x"; then
1990da2e2ef6Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991da2e2ef6Smrg   fi
1992da2e2ef6Smrg   have_xmlto=yes
1993da2e2ef6Smrgelif test "x$use_xmlto" = x"no" ; then
1994da2e2ef6Smrg   if test "x$XMLTO" != "x"; then
1995da2e2ef6Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996da2e2ef6Smrg   fi
1997da2e2ef6Smrg   have_xmlto=no
1998da2e2ef6Smrgelse
1999da2e2ef6Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000da2e2ef6Smrgfi
2001629baa8cSmrg
2002da2e2ef6Smrg# Test for a minimum version of xmlto, if provided.
2003da2e2ef6Smrgm4_ifval([$1],
2004da2e2ef6Smrg[if test "$have_xmlto" = yes; then
2005da2e2ef6Smrg    # scrape the xmlto version
2006da2e2ef6Smrg    AC_MSG_CHECKING([the xmlto version])
2007da2e2ef6Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008da2e2ef6Smrg    AC_MSG_RESULT([$xmlto_version])
2009da2e2ef6Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010da2e2ef6Smrg        [if test "x$use_xmlto" = xauto; then
2011da2e2ef6Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012da2e2ef6Smrg            have_xmlto=no
2013da2e2ef6Smrg        else
2014da2e2ef6Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015da2e2ef6Smrg        fi])
2016da2e2ef6Smrgfi])
2017629baa8cSmrg
2018da2e2ef6Smrg# Test for the ability of xmlto to generate a text target
2019da2e2ef6Smrg#
2020da2e2ef6Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021da2e2ef6Smrg# following test for empty XML docbook files.
2022da2e2ef6Smrg# For compatibility reasons use the following empty XML docbook file and if
2023da2e2ef6Smrg# it fails try it again with a non-empty XML file.
2024da2e2ef6Smrghave_xmlto_text=no
2025da2e2ef6Smrgcat > conftest.xml << "EOF"
2026da2e2ef6SmrgEOF
2027da2e2ef6SmrgAS_IF([test "$have_xmlto" = yes],
2028da2e2ef6Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029da2e2ef6Smrg             [have_xmlto_text=yes],
2030da2e2ef6Smrg             [# Try it again with a non-empty XML file.
2031da2e2ef6Smrg              cat > conftest.xml << "EOF"
2032da2e2ef6Smrg<x></x>
2033da2e2ef6SmrgEOF
2034da2e2ef6Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035da2e2ef6Smrg                    [have_xmlto_text=yes],
2036da2e2ef6Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037da2e2ef6Smrgrm -f conftest.xml
2038da2e2ef6SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039da2e2ef6SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040da2e2ef6Smrg]) # XORG_WITH_XMLTO
2041629baa8cSmrg
2042da2e2ef6Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043da2e2ef6Smrg# --------------------------------------------
2044da2e2ef6Smrg# Minimum version: 1.12.0
2045da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2046da2e2ef6Smrg#
2047da2e2ef6Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048da2e2ef6Smrg# XML-based language used for the transformation of XML documents.
2049da2e2ef6Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050da2e2ef6Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051da2e2ef6Smrg# The XSLT processor is often used as a standalone tool for transformations.
2052da2e2ef6Smrg# It should not be assumed that this tool is used only to work with documnetation.
2053da2e2ef6Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2054da2e2ef6Smrg#
2055da2e2ef6Smrg# Interface to module:
2056da2e2ef6Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057da2e2ef6Smrg# XSLTPROC:	 returns the path of the xsltproc program found
2058da2e2ef6Smrg#		 returns the path set by the user in the environment
2059da2e2ef6Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060da2e2ef6Smrg#		  'no' user instructs the module not to use xsltproc
2061da2e2ef6Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
2062da2e2ef6Smrg#
2063da2e2ef6Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2064da2e2ef6Smrg#
2065da2e2ef6SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066da2e2ef6SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067da2e2ef6Smrg# Preserves the interface, should it be implemented later
2068da2e2ef6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2070da2e2ef6SmrgAC_ARG_WITH(xsltproc,
2071da2e2ef6Smrg	AS_HELP_STRING([--with-xsltproc],
2072da2e2ef6Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073da2e2ef6Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074da2e2ef6Smrgm4_undefine([_defopt])
2075629baa8cSmrg
2076da2e2ef6Smrgif test "x$use_xsltproc" = x"auto"; then
2077da2e2ef6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078da2e2ef6Smrg   if test "x$XSLTPROC" = "x"; then
2079da2e2ef6Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080da2e2ef6Smrg	have_xsltproc=no
2081da2e2ef6Smrg   else
2082da2e2ef6Smrg        have_xsltproc=yes
2083da2e2ef6Smrg   fi
2084da2e2ef6Smrgelif test "x$use_xsltproc" = x"yes" ; then
2085da2e2ef6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086da2e2ef6Smrg   if test "x$XSLTPROC" = "x"; then
2087da2e2ef6Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088da2e2ef6Smrg   fi
2089da2e2ef6Smrg   have_xsltproc=yes
2090da2e2ef6Smrgelif test "x$use_xsltproc" = x"no" ; then
2091da2e2ef6Smrg   if test "x$XSLTPROC" != "x"; then
2092da2e2ef6Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093da2e2ef6Smrg   fi
2094da2e2ef6Smrg   have_xsltproc=no
2095da2e2ef6Smrgelse
2096da2e2ef6Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097da2e2ef6Smrgfi
2098629baa8cSmrg
2099da2e2ef6SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100da2e2ef6Smrg]) # XORG_WITH_XSLTPROC
2101629baa8cSmrg
2102da2e2ef6Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103da2e2ef6Smrg# ----------------------------------------
2104da2e2ef6Smrg# Minimum version: 1.15.0
2105da2e2ef6Smrg#
2106da2e2ef6Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107da2e2ef6Smrg# scanning arbitrary text files, extracting information from those text files,
2108da2e2ef6Smrg# and printing reports based on that information.
2109da2e2ef6Smrg#
2110da2e2ef6Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111da2e2ef6Smrg#
2112da2e2ef6Smrg# Interface to module:
2113da2e2ef6Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114da2e2ef6Smrg# PERL:	     returns the path of the perl program found
2115da2e2ef6Smrg#	     returns the path set by the user in the environment
2116da2e2ef6Smrg# --with-perl: 'yes' user instructs the module to use perl
2117da2e2ef6Smrg#	       'no' user instructs the module not to use perl
2118da2e2ef6Smrg# have_perl: returns yes if perl found in PATH or no
2119da2e2ef6Smrg#
2120da2e2ef6Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121da2e2ef6Smrg#
2122da2e2ef6SmrgAC_DEFUN([XORG_WITH_PERL],[
2123da2e2ef6SmrgAC_ARG_VAR([PERL], [Path to perl command])
2124da2e2ef6Smrg# Preserves the interface, should it be implemented later
2125da2e2ef6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2127da2e2ef6SmrgAC_ARG_WITH(perl,
2128da2e2ef6Smrg	AS_HELP_STRING([--with-perl],
2129da2e2ef6Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130da2e2ef6Smrg	   [use_perl=$withval], [use_perl=]_defopt)
2131da2e2ef6Smrgm4_undefine([_defopt])
2132629baa8cSmrg
2133da2e2ef6Smrgif test "x$use_perl" = x"auto"; then
2134da2e2ef6Smrg   AC_PATH_PROG([PERL], [perl])
2135da2e2ef6Smrg   if test "x$PERL" = "x"; then
2136da2e2ef6Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137da2e2ef6Smrg	have_perl=no
2138da2e2ef6Smrg   else
2139da2e2ef6Smrg        have_perl=yes
2140da2e2ef6Smrg   fi
2141da2e2ef6Smrgelif test "x$use_perl" = x"yes" ; then
2142da2e2ef6Smrg   AC_PATH_PROG([PERL], [perl])
2143da2e2ef6Smrg   if test "x$PERL" = "x"; then
2144da2e2ef6Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145da2e2ef6Smrg   fi
2146da2e2ef6Smrg   have_perl=yes
2147da2e2ef6Smrgelif test "x$use_perl" = x"no" ; then
2148da2e2ef6Smrg   if test "x$PERL" != "x"; then
2149da2e2ef6Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150da2e2ef6Smrg   fi
2151da2e2ef6Smrg   have_perl=no
2152da2e2ef6Smrgelse
2153da2e2ef6Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154da2e2ef6Smrgfi
2155629baa8cSmrg
2156da2e2ef6SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157da2e2ef6Smrg]) # XORG_WITH_PERL
2158629baa8cSmrg
2159da2e2ef6Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160da2e2ef6Smrg# ----------------
2161da2e2ef6Smrg# Minimum version: 1.5.0
2162da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163da2e2ef6Smrg#
2164da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2165da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
2166da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21674901b09eSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168da2e2ef6Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169da2e2ef6Smrg# --with-asciidoc assumes 'auto'.
2170da2e2ef6Smrg#
2171da2e2ef6Smrg# Interface to module:
2172da2e2ef6Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173da2e2ef6Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174da2e2ef6Smrg#		 returns the path set by the user in the environment
2175da2e2ef6Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176da2e2ef6Smrg#		  'no' user instructs the module not to use asciidoc
2177da2e2ef6Smrg#
2178da2e2ef6Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179da2e2ef6Smrg#
2180da2e2ef6SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181da2e2ef6SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183da2e2ef6SmrgAC_ARG_WITH(asciidoc,
2184da2e2ef6Smrg	AS_HELP_STRING([--with-asciidoc],
2185da2e2ef6Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186da2e2ef6Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187da2e2ef6Smrgm4_undefine([_defopt])
2188629baa8cSmrg
2189da2e2ef6Smrgif test "x$use_asciidoc" = x"auto"; then
2190da2e2ef6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191da2e2ef6Smrg   if test "x$ASCIIDOC" = "x"; then
2192da2e2ef6Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193da2e2ef6Smrg	have_asciidoc=no
2194da2e2ef6Smrg   else
2195da2e2ef6Smrg        have_asciidoc=yes
2196da2e2ef6Smrg   fi
2197da2e2ef6Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198da2e2ef6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199da2e2ef6Smrg   if test "x$ASCIIDOC" = "x"; then
2200da2e2ef6Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201da2e2ef6Smrg   fi
2202da2e2ef6Smrg   have_asciidoc=yes
2203da2e2ef6Smrgelif test "x$use_asciidoc" = x"no" ; then
2204da2e2ef6Smrg   if test "x$ASCIIDOC" != "x"; then
2205da2e2ef6Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206da2e2ef6Smrg   fi
2207da2e2ef6Smrg   have_asciidoc=no
2208da2e2ef6Smrgelse
2209da2e2ef6Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210da2e2ef6Smrgfi
2211da2e2ef6Smrgm4_ifval([$1],
2212da2e2ef6Smrg[if test "$have_asciidoc" = yes; then
2213da2e2ef6Smrg    # scrape the asciidoc version
2214da2e2ef6Smrg    AC_MSG_CHECKING([the asciidoc version])
2215da2e2ef6Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216da2e2ef6Smrg    AC_MSG_RESULT([$asciidoc_version])
2217da2e2ef6Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218da2e2ef6Smrg        [if test "x$use_asciidoc" = xauto; then
2219da2e2ef6Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220da2e2ef6Smrg            have_asciidoc=no
2221da2e2ef6Smrg        else
2222da2e2ef6Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223da2e2ef6Smrg        fi])
2224da2e2ef6Smrgfi])
2225da2e2ef6SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226da2e2ef6Smrg]) # XORG_WITH_ASCIIDOC
2227629baa8cSmrg
2228da2e2ef6Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229da2e2ef6Smrg# -------------------------------------------
2230da2e2ef6Smrg# Minimum version: 1.5.0
2231da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2232da2e2ef6Smrg# Minimum version for optional DOT checking: 1.18.0
2233b7d26471Smrg#
2234da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2235da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
2236da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22374901b09eSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238da2e2ef6Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239da2e2ef6Smrg# --with-doxygen assumes 'auto'.
2240da2e2ef6Smrg#
2241da2e2ef6Smrg# Interface to module:
2242da2e2ef6Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243da2e2ef6Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244da2e2ef6Smrg#		 returns the path set by the user in the environment
2245da2e2ef6Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246da2e2ef6Smrg#		  'no' user instructs the module not to use doxygen
2247da2e2ef6Smrg#
2248da2e2ef6Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249da2e2ef6Smrg#
2250da2e2ef6SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251da2e2ef6SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252da2e2ef6SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254da2e2ef6SmrgAC_ARG_WITH(doxygen,
2255da2e2ef6Smrg	AS_HELP_STRING([--with-doxygen],
2256da2e2ef6Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257da2e2ef6Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258da2e2ef6Smrgm4_undefine([_defopt])
2259629baa8cSmrg
2260da2e2ef6Smrgif test "x$use_doxygen" = x"auto"; then
2261da2e2ef6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262da2e2ef6Smrg   if test "x$DOXYGEN" = "x"; then
2263da2e2ef6Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264da2e2ef6Smrg	have_doxygen=no
2265da2e2ef6Smrg   else
2266da2e2ef6Smrg        have_doxygen=yes
2267da2e2ef6Smrg   fi
2268da2e2ef6Smrgelif test "x$use_doxygen" = x"yes" ; then
2269da2e2ef6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270da2e2ef6Smrg   if test "x$DOXYGEN" = "x"; then
2271da2e2ef6Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272da2e2ef6Smrg   fi
2273da2e2ef6Smrg   have_doxygen=yes
2274da2e2ef6Smrgelif test "x$use_doxygen" = x"no" ; then
2275da2e2ef6Smrg   if test "x$DOXYGEN" != "x"; then
2276da2e2ef6Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277da2e2ef6Smrg   fi
2278da2e2ef6Smrg   have_doxygen=no
2279da2e2ef6Smrgelse
2280da2e2ef6Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281da2e2ef6Smrgfi
2282da2e2ef6Smrgm4_ifval([$1],
2283da2e2ef6Smrg[if test "$have_doxygen" = yes; then
2284da2e2ef6Smrg    # scrape the doxygen version
2285da2e2ef6Smrg    AC_MSG_CHECKING([the doxygen version])
2286da2e2ef6Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287da2e2ef6Smrg    AC_MSG_RESULT([$doxygen_version])
2288da2e2ef6Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289da2e2ef6Smrg        [if test "x$use_doxygen" = xauto; then
2290da2e2ef6Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291da2e2ef6Smrg            have_doxygen=no
2292da2e2ef6Smrg        else
2293da2e2ef6Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294da2e2ef6Smrg        fi])
2295da2e2ef6Smrgfi])
2296629baa8cSmrg
2297da2e2ef6Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298da2e2ef6Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299da2e2ef6Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2300da2e2ef6SmrgHAVE_DOT=no
2301da2e2ef6Smrgif test "x$have_doxygen" = "xyes"; then
2302da2e2ef6Smrg  AC_PATH_PROG([DOT], [dot])
2303da2e2ef6Smrg    if test "x$DOT" != "x"; then
2304da2e2ef6Smrg      HAVE_DOT=yes
2305da2e2ef6Smrg    fi
2306da2e2ef6Smrgfi
2307629baa8cSmrg
2308da2e2ef6SmrgAC_SUBST([HAVE_DOT])
2309da2e2ef6SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310da2e2ef6SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311da2e2ef6Smrg]) # XORG_WITH_DOXYGEN
2312629baa8cSmrg
2313da2e2ef6Smrg# XORG_WITH_GROFF([DEFAULT])
2314da2e2ef6Smrg# ----------------
2315da2e2ef6Smrg# Minimum version: 1.6.0
2316da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2317b7d26471Smrg#
2318da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2319da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
2320da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23214901b09eSmrg# the --with-groff option, it allows maximum flexibility in making decisions
2322da2e2ef6Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323da2e2ef6Smrg# --with-groff assumes 'auto'.
2324b7d26471Smrg#
2325da2e2ef6Smrg# Interface to module:
2326da2e2ef6Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327da2e2ef6Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328da2e2ef6Smrg# HAVE_GROFF_MS: the -ms macros package
2329da2e2ef6Smrg# GROFF:	 returns the path of the groff program found
2330da2e2ef6Smrg#		 returns the path set by the user in the environment
2331da2e2ef6Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332da2e2ef6Smrg#		 'no' user instructs the module not to use groff
2333b7d26471Smrg#
2334da2e2ef6Smrg# Added in version 1.9.0:
2335da2e2ef6Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336da2e2ef6Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337da2e2ef6Smrg#		   psselect from the psutils package.
2338da2e2ef6Smrg#		   the ghostcript package. Refer to the grohtml man pages
2339b7d26471Smrg#
2340da2e2ef6Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341b7d26471Smrg#
2342da2e2ef6Smrg# OS and distros often splits groff in a basic and full package, the former
2343da2e2ef6Smrg# having the groff program and the later having devices, fonts and macros
2344da2e2ef6Smrg# Checking for the groff executable is not enough.
2345b7d26471Smrg#
2346da2e2ef6Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347da2e2ef6Smrg# unset HAVE_GROFF or GROFF env variables.
2348da2e2ef6Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349b7d26471Smrg#
2350da2e2ef6SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351da2e2ef6SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352da2e2ef6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353da2e2ef6SmrgAC_ARG_WITH(groff,
2354da2e2ef6Smrg	AS_HELP_STRING([--with-groff],
2355da2e2ef6Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356da2e2ef6Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2357da2e2ef6Smrgm4_undefine([_defopt])
2358629baa8cSmrg
2359da2e2ef6Smrgif test "x$use_groff" = x"auto"; then
2360da2e2ef6Smrg   AC_PATH_PROG([GROFF], [groff])
2361da2e2ef6Smrg   if test "x$GROFF" = "x"; then
2362da2e2ef6Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363da2e2ef6Smrg	have_groff=no
2364da2e2ef6Smrg   else
2365da2e2ef6Smrg        have_groff=yes
2366da2e2ef6Smrg   fi
2367da2e2ef6Smrgelif test "x$use_groff" = x"yes" ; then
2368da2e2ef6Smrg   AC_PATH_PROG([GROFF], [groff])
2369da2e2ef6Smrg   if test "x$GROFF" = "x"; then
2370da2e2ef6Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371da2e2ef6Smrg   fi
2372da2e2ef6Smrg   have_groff=yes
2373da2e2ef6Smrgelif test "x$use_groff" = x"no" ; then
2374da2e2ef6Smrg   if test "x$GROFF" != "x"; then
2375da2e2ef6Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376da2e2ef6Smrg   fi
2377da2e2ef6Smrg   have_groff=no
2378b7d26471Smrgelse
2379da2e2ef6Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2380629baa8cSmrgfi
2381629baa8cSmrg
2382da2e2ef6Smrg# We have groff, test for the presence of the macro packages
2383da2e2ef6Smrgif test "x$have_groff" = x"yes"; then
2384da2e2ef6Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385da2e2ef6Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386da2e2ef6Smrg        groff_ms_works=yes
2387da2e2ef6Smrg    else
2388da2e2ef6Smrg        groff_ms_works=no
2389da2e2ef6Smrg    fi
2390da2e2ef6Smrg    AC_MSG_RESULT([$groff_ms_works])
2391da2e2ef6Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392da2e2ef6Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393da2e2ef6Smrg        groff_mm_works=yes
2394da2e2ef6Smrg    else
2395da2e2ef6Smrg        groff_mm_works=no
2396da2e2ef6Smrg    fi
2397da2e2ef6Smrg    AC_MSG_RESULT([$groff_mm_works])
2398da2e2ef6Smrgfi
2399629baa8cSmrg
2400da2e2ef6Smrg# We have groff, test for HTML dependencies, one command per package
2401da2e2ef6Smrgif test "x$have_groff" = x"yes"; then
2402da2e2ef6Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403da2e2ef6Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404da2e2ef6Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405da2e2ef6Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406da2e2ef6Smrg      have_groff_html=yes
2407da2e2ef6Smrg   else
2408da2e2ef6Smrg      have_groff_html=no
2409da2e2ef6Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410da2e2ef6Smrg   fi
2411da2e2ef6Smrgfi
2412629baa8cSmrg
2413da2e2ef6Smrg# Set Automake conditionals for Makefiles
2414da2e2ef6SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415da2e2ef6SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416da2e2ef6SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417da2e2ef6SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418da2e2ef6Smrg]) # XORG_WITH_GROFF
2419629baa8cSmrg
2420da2e2ef6Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421da2e2ef6Smrg# ---------------------------------------
2422da2e2ef6Smrg# Minimum version: 1.6.0
2423da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2424da2e2ef6Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425b7d26471Smrg#
2426da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2427da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
2428da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24294901b09eSmrg# the --with-fop option, it allows maximum flexibility in making decisions
2430da2e2ef6Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431da2e2ef6Smrg# --with-fop assumes 'auto'.
2432da2e2ef6Smrg#
2433da2e2ef6Smrg# Interface to module:
2434da2e2ef6Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435da2e2ef6Smrg# FOP:	 	returns the path of the fop program found
2436da2e2ef6Smrg#		returns the path set by the user in the environment
2437da2e2ef6Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438da2e2ef6Smrg#		'no' user instructs the module not to use fop
2439da2e2ef6Smrg#
2440da2e2ef6Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441da2e2ef6Smrg#
2442da2e2ef6SmrgAC_DEFUN([XORG_WITH_FOP],[
2443da2e2ef6SmrgAC_ARG_VAR([FOP], [Path to fop command])
2444da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2445da2e2ef6SmrgAC_ARG_WITH(fop,
2446da2e2ef6Smrg	AS_HELP_STRING([--with-fop],
2447da2e2ef6Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448da2e2ef6Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2449da2e2ef6Smrgm4_undefine([_defopt])
2450629baa8cSmrg
2451da2e2ef6Smrgif test "x$use_fop" = x"auto"; then
2452da2e2ef6Smrg   AC_PATH_PROG([FOP], [fop])
2453da2e2ef6Smrg   if test "x$FOP" = "x"; then
2454da2e2ef6Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455da2e2ef6Smrg	have_fop=no
2456da2e2ef6Smrg   else
2457da2e2ef6Smrg        have_fop=yes
2458da2e2ef6Smrg   fi
2459da2e2ef6Smrgelif test "x$use_fop" = x"yes" ; then
2460da2e2ef6Smrg   AC_PATH_PROG([FOP], [fop])
2461da2e2ef6Smrg   if test "x$FOP" = "x"; then
2462da2e2ef6Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463da2e2ef6Smrg   fi
2464da2e2ef6Smrg   have_fop=yes
2465da2e2ef6Smrgelif test "x$use_fop" = x"no" ; then
2466da2e2ef6Smrg   if test "x$FOP" != "x"; then
2467da2e2ef6Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468da2e2ef6Smrg   fi
2469da2e2ef6Smrg   have_fop=no
2470629baa8cSmrgelse
2471da2e2ef6Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472629baa8cSmrgfi
2473629baa8cSmrg
2474da2e2ef6Smrg# Test for a minimum version of fop, if provided.
2475da2e2ef6Smrgm4_ifval([$1],
2476da2e2ef6Smrg[if test "$have_fop" = yes; then
2477da2e2ef6Smrg    # scrape the fop version
2478da2e2ef6Smrg    AC_MSG_CHECKING([for fop minimum version])
2479da2e2ef6Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480da2e2ef6Smrg    AC_MSG_RESULT([$fop_version])
2481da2e2ef6Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482da2e2ef6Smrg        [if test "x$use_fop" = xauto; then
2483da2e2ef6Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484da2e2ef6Smrg            have_fop=no
2485da2e2ef6Smrg        else
2486da2e2ef6Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487da2e2ef6Smrg        fi])
2488da2e2ef6Smrgfi])
2489da2e2ef6SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490da2e2ef6Smrg]) # XORG_WITH_FOP
2491629baa8cSmrg
2492da2e2ef6Smrg# XORG_WITH_M4([MIN-VERSION])
2493da2e2ef6Smrg# ---------------------------
2494da2e2ef6Smrg# Minimum version: 1.19.0
2495da2e2ef6Smrg#
2496da2e2ef6Smrg# This macro attempts to locate an m4 macro processor which supports
2497da2e2ef6Smrg# -I option and is only useful for modules relying on M4 in order to
2498da2e2ef6Smrg# expand macros in source code files.
2499da2e2ef6Smrg#
2500da2e2ef6Smrg# Interface to module:
2501da2e2ef6Smrg# M4:	 	returns the path of the m4 program found
2502da2e2ef6Smrg#		returns the path set by the user in the environment
2503da2e2ef6Smrg#
2504da2e2ef6SmrgAC_DEFUN([XORG_WITH_M4], [
2505da2e2ef6SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506da2e2ef6Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507da2e2ef6Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508da2e2ef6Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509da2e2ef6Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510da2e2ef6Smrg   [$PATH:/usr/gnu/bin])])
2511629baa8cSmrg
2512da2e2ef6SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513da2e2ef6Smrg]) # XORG_WITH_M4
2514629baa8cSmrg
2515da2e2ef6Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516da2e2ef6Smrg# ----------------
2517da2e2ef6Smrg# Minimum version: 1.6.0
2518da2e2ef6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519da2e2ef6Smrg#
2520da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2521da2e2ef6Smrg# not at the appropriate level. This macro enables a module to test for the
2522da2e2ef6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25234901b09eSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524da2e2ef6Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525da2e2ef6Smrg# --with-ps2pdf assumes 'auto'.
2526da2e2ef6Smrg#
2527da2e2ef6Smrg# Interface to module:
2528da2e2ef6Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529da2e2ef6Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530da2e2ef6Smrg#		returns the path set by the user in the environment
2531da2e2ef6Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532da2e2ef6Smrg#		 'no' user instructs the module not to use ps2pdf
2533da2e2ef6Smrg#
2534da2e2ef6Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535da2e2ef6Smrg#
2536da2e2ef6SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537da2e2ef6SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538da2e2ef6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539da2e2ef6SmrgAC_ARG_WITH(ps2pdf,
2540da2e2ef6Smrg	AS_HELP_STRING([--with-ps2pdf],
2541da2e2ef6Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542da2e2ef6Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543da2e2ef6Smrgm4_undefine([_defopt])
2544629baa8cSmrg
2545da2e2ef6Smrgif test "x$use_ps2pdf" = x"auto"; then
2546da2e2ef6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547da2e2ef6Smrg   if test "x$PS2PDF" = "x"; then
2548da2e2ef6Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549da2e2ef6Smrg	have_ps2pdf=no
2550da2e2ef6Smrg   else
2551da2e2ef6Smrg        have_ps2pdf=yes
2552da2e2ef6Smrg   fi
2553da2e2ef6Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554da2e2ef6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555da2e2ef6Smrg   if test "x$PS2PDF" = "x"; then
2556da2e2ef6Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557da2e2ef6Smrg   fi
2558da2e2ef6Smrg   have_ps2pdf=yes
2559da2e2ef6Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560da2e2ef6Smrg   if test "x$PS2PDF" != "x"; then
2561da2e2ef6Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562da2e2ef6Smrg   fi
2563da2e2ef6Smrg   have_ps2pdf=no
2564da2e2ef6Smrgelse
2565da2e2ef6Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566da2e2ef6Smrgfi
2567da2e2ef6SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568da2e2ef6Smrg]) # XORG_WITH_PS2PDF
2569629baa8cSmrg
2570da2e2ef6Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571da2e2ef6Smrg# ----------------
2572da2e2ef6Smrg# Minimum version: 1.6.0
2573b7d26471Smrg#
2574da2e2ef6Smrg# Documentation tools are not always available on all platforms and sometimes
2575da2e2ef6Smrg# not at the appropriate level. This macro enables a builder to skip all
2576da2e2ef6Smrg# documentation targets except traditional man pages.
2577da2e2ef6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25784901b09eSmrg# maximum flexibility in controlling documentation building.
2579da2e2ef6Smrg# Refer to:
2580da2e2ef6Smrg# XORG_WITH_XMLTO         --with-xmlto
2581da2e2ef6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582da2e2ef6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583da2e2ef6Smrg# XORG_WITH_FOP           --with-fop
2584da2e2ef6Smrg# XORG_WITH_GROFF         --with-groff
2585da2e2ef6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586da2e2ef6Smrg#
2587da2e2ef6Smrg# Interface to module:
2588da2e2ef6Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589da2e2ef6Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590da2e2ef6Smrg#		 'no' user instructs the module not to generate docs
2591da2e2ef6Smrg# parm1:	specify the default value, yes or no.
2592da2e2ef6Smrg#
2593da2e2ef6SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594da2e2ef6Smrgm4_define([docs_default], m4_default([$1], [yes]))
2595da2e2ef6SmrgAC_ARG_ENABLE(docs,
2596da2e2ef6Smrg	AS_HELP_STRING([--enable-docs],
2597da2e2ef6Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2598da2e2ef6Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599da2e2ef6Smrgm4_undefine([docs_default])
2600da2e2ef6SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601da2e2ef6SmrgAC_MSG_CHECKING([whether to build documentation])
2602da2e2ef6SmrgAC_MSG_RESULT([$build_docs])
2603da2e2ef6Smrg]) # XORG_ENABLE_DOCS
2604629baa8cSmrg
2605da2e2ef6Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606da2e2ef6Smrg# ----------------
2607da2e2ef6Smrg# Minimum version: 1.6.0
2608da2e2ef6Smrg#
2609da2e2ef6Smrg# This macro enables a builder to skip all developer documentation.
2610da2e2ef6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26114901b09eSmrg# maximum flexibility in controlling documentation building.
2612da2e2ef6Smrg# Refer to:
2613da2e2ef6Smrg# XORG_WITH_XMLTO         --with-xmlto
2614da2e2ef6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615da2e2ef6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616da2e2ef6Smrg# XORG_WITH_FOP           --with-fop
2617da2e2ef6Smrg# XORG_WITH_GROFF         --with-groff
2618da2e2ef6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619da2e2ef6Smrg#
2620da2e2ef6Smrg# Interface to module:
2621da2e2ef6Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622da2e2ef6Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623da2e2ef6Smrg#			'no' user instructs the module not to generate developer docs
2624da2e2ef6Smrg# parm1:		specify the default value, yes or no.
2625da2e2ef6Smrg#
2626da2e2ef6SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627da2e2ef6Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628da2e2ef6SmrgAC_ARG_ENABLE(devel-docs,
2629da2e2ef6Smrg	AS_HELP_STRING([--enable-devel-docs],
2630da2e2ef6Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631da2e2ef6Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632da2e2ef6Smrgm4_undefine([devel_default])
2633da2e2ef6SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634da2e2ef6SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635da2e2ef6SmrgAC_MSG_RESULT([$build_devel_docs])
2636da2e2ef6Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637629baa8cSmrg
2638da2e2ef6Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639da2e2ef6Smrg# ----------------
2640da2e2ef6Smrg# Minimum version: 1.6.0
2641da2e2ef6Smrg#
2642da2e2ef6Smrg# This macro enables a builder to skip all functional specification targets.
2643da2e2ef6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26444901b09eSmrg# maximum flexibility in controlling documentation building.
2645da2e2ef6Smrg# Refer to:
2646da2e2ef6Smrg# XORG_WITH_XMLTO         --with-xmlto
2647da2e2ef6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648da2e2ef6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649da2e2ef6Smrg# XORG_WITH_FOP           --with-fop
2650da2e2ef6Smrg# XORG_WITH_GROFF         --with-groff
2651da2e2ef6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652da2e2ef6Smrg#
2653da2e2ef6Smrg# Interface to module:
2654da2e2ef6Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655da2e2ef6Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656da2e2ef6Smrg#			'no' user instructs the module not to generate specs
2657da2e2ef6Smrg# parm1:		specify the default value, yes or no.
2658da2e2ef6Smrg#
2659da2e2ef6SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660da2e2ef6Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661da2e2ef6SmrgAC_ARG_ENABLE(specs,
2662da2e2ef6Smrg	AS_HELP_STRING([--enable-specs],
2663da2e2ef6Smrg	   [Enable building the specs (default: ]spec_default[)]),
2664da2e2ef6Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665da2e2ef6Smrgm4_undefine([spec_default])
2666da2e2ef6SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667da2e2ef6SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668da2e2ef6SmrgAC_MSG_RESULT([$build_specs])
2669da2e2ef6Smrg]) # XORG_ENABLE_SPECS
2670629baa8cSmrg
2671da2e2ef6Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672da2e2ef6Smrg# ----------------------------------------------
2673da2e2ef6Smrg# Minimum version: 1.13.0
2674b7d26471Smrg#
2675da2e2ef6Smrg# This macro enables a builder to enable/disable unit testing
2676da2e2ef6Smrg# It makes no assumption about the test cases implementation
2677da2e2ef6Smrg# Test cases may or may not use Automake "Support for test suites"
2678da2e2ef6Smrg# They may or may not use the software utility library GLib
2679b7d26471Smrg#
2680da2e2ef6Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681da2e2ef6Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682da2e2ef6Smrg# The variable enable_unit_tests is used by other macros in this file.
2683da2e2ef6Smrg#
2684da2e2ef6Smrg# Interface to module:
2685da2e2ef6Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686da2e2ef6Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2687da2e2ef6Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688da2e2ef6Smrg#			'no' user instructs the module not to build tests
2689da2e2ef6Smrg# parm1:		specify the default value, yes or no.
2690da2e2ef6Smrg#
2691da2e2ef6SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692da2e2ef6SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693da2e2ef6SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694da2e2ef6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695da2e2ef6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2696da2e2ef6SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697da2e2ef6Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2698da2e2ef6Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699da2e2ef6Smrgm4_undefine([_defopt])
2700da2e2ef6SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701da2e2ef6SmrgAC_MSG_CHECKING([whether to build unit test cases])
2702da2e2ef6SmrgAC_MSG_RESULT([$enable_unit_tests])
2703da2e2ef6Smrg]) # XORG_ENABLE_UNIT_TESTS
2704629baa8cSmrg
2705da2e2ef6Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706da2e2ef6Smrg# ------------------------------------------------------
2707da2e2ef6Smrg# Minimum version: 1.17.0
2708da2e2ef6Smrg#
2709da2e2ef6Smrg# This macro enables a builder to enable/disable integration testing
2710da2e2ef6Smrg# It makes no assumption about the test cases' implementation
2711da2e2ef6Smrg# Test cases may or may not use Automake "Support for test suites"
2712da2e2ef6Smrg#
2713da2e2ef6Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714da2e2ef6Smrg# usually requires less dependencies and may be built and run under less
2715da2e2ef6Smrg# stringent environments than integration tests.
2716da2e2ef6Smrg#
2717da2e2ef6Smrg# Interface to module:
2718da2e2ef6Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719da2e2ef6Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2720da2e2ef6Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721da2e2ef6Smrg#                             'no' user instructs the module not to build tests
2722da2e2ef6Smrg# parm1:                      specify the default value, yes or no.
2723da2e2ef6Smrg#
2724da2e2ef6SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725da2e2ef6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726da2e2ef6Smrgm4_define([_defopt], m4_default([$1], [auto]))
2727da2e2ef6SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728da2e2ef6Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2729da2e2ef6Smrg	[enable_integration_tests=$enableval],
2730da2e2ef6Smrg	[enable_integration_tests=]_defopt)
2731da2e2ef6Smrgm4_undefine([_defopt])
2732da2e2ef6SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733da2e2ef6Smrg	[test "x$enable_integration_tests" != xno])
2734da2e2ef6SmrgAC_MSG_CHECKING([whether to build unit test cases])
2735da2e2ef6SmrgAC_MSG_RESULT([$enable_integration_tests])
2736da2e2ef6Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737629baa8cSmrg
2738da2e2ef6Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739da2e2ef6Smrg# ----------------------------------------
2740da2e2ef6Smrg# Minimum version: 1.13.0
2741da2e2ef6Smrg#
2742da2e2ef6Smrg# GLib is a library which provides advanced data structures and functions.
2743da2e2ef6Smrg# This macro enables a module to test for the presence of Glib.
2744da2e2ef6Smrg#
2745da2e2ef6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746da2e2ef6Smrg# Otherwise the value of $enable_unit_tests is blank.
2747da2e2ef6Smrg#
2748da2e2ef6Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749da2e2ef6Smrg# test support usually requires less dependencies and may be built and run under
2750da2e2ef6Smrg# less stringent environments than integration tests.
2751da2e2ef6Smrg#
2752da2e2ef6Smrg# Interface to module:
2753da2e2ef6Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754da2e2ef6Smrg# with_glib: used in configure.ac to know if GLib has been found
2755da2e2ef6Smrg# --with-glib:	'yes' user instructs the module to use glib
2756da2e2ef6Smrg#		'no' user instructs the module not to use glib
2757da2e2ef6Smrg#
2758da2e2ef6SmrgAC_DEFUN([XORG_WITH_GLIB],[
2759da2e2ef6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760da2e2ef6Smrgm4_define([_defopt], m4_default([$2], [auto]))
2761da2e2ef6SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762da2e2ef6Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763da2e2ef6Smrg	[with_glib=$withval], [with_glib=]_defopt)
2764da2e2ef6Smrgm4_undefine([_defopt])
2765629baa8cSmrg
2766da2e2ef6Smrghave_glib=no
2767da2e2ef6Smrg# Do not probe GLib if user explicitly disabled unit testing
2768da2e2ef6Smrgif test "x$enable_unit_tests" != x"no"; then
2769da2e2ef6Smrg  # Do not probe GLib if user explicitly disabled it
2770da2e2ef6Smrg  if test "x$with_glib" != x"no"; then
2771da2e2ef6Smrg    m4_ifval(
2772da2e2ef6Smrg      [$1],
2773da2e2ef6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774da2e2ef6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775da2e2ef6Smrg    )
2776629baa8cSmrg  fi
2777629baa8cSmrgfi
2778145b7b3cSmrg
2779da2e2ef6Smrg# Not having GLib when unit testing has been explicitly requested is an error
2780da2e2ef6Smrgif test "x$enable_unit_tests" = x"yes"; then
2781da2e2ef6Smrg  if test "x$have_glib" = x"no"; then
2782da2e2ef6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783da2e2ef6Smrg  fi
2784da2e2ef6Smrgfi
2785b7d26471Smrg
2786da2e2ef6Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787da2e2ef6Smrgif test "x$enable_unit_tests" = x"no"; then
2788da2e2ef6Smrg  if test "x$with_glib" = x"yes"; then
2789da2e2ef6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790da2e2ef6Smrg  fi
2791da2e2ef6Smrgfi
2792b7d26471Smrg
2793da2e2ef6Smrg# Not having GLib when it has been explicitly requested is an error
2794da2e2ef6Smrgif test "x$with_glib" = x"yes"; then
2795da2e2ef6Smrg  if test "x$have_glib" = x"no"; then
2796da2e2ef6Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797629baa8cSmrg  fi
2798629baa8cSmrgfi
2799145b7b3cSmrg
2800da2e2ef6SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801da2e2ef6Smrg]) # XORG_WITH_GLIB
2802629baa8cSmrg
2803da2e2ef6Smrg# XORG_LD_WRAP([required|optional])
2804da2e2ef6Smrg# ---------------------------------
2805da2e2ef6Smrg# Minimum version: 1.13.0
2806da2e2ef6Smrg#
2807da2e2ef6Smrg# Check if linker supports -wrap, passed via compiler flags
2808da2e2ef6Smrg#
2809da2e2ef6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810da2e2ef6Smrg# Otherwise the value of $enable_unit_tests is blank.
2811da2e2ef6Smrg#
2812da2e2ef6Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813da2e2ef6Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814da2e2ef6Smrg# available, an argument of "optional" allows use when some unit tests require
2815da2e2ef6Smrg# ld -wrap and others do not.
2816da2e2ef6Smrg#
2817da2e2ef6SmrgAC_DEFUN([XORG_LD_WRAP],[
2818da2e2ef6SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819da2e2ef6Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820da2e2ef6Smrg                      void __wrap_exit(int status) { return; }],
2821da2e2ef6Smrg                     [exit(0);])])
2822da2e2ef6Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823da2e2ef6Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824da2e2ef6Smrg  if test "x$have_ld_wrap" = x"no"; then
2825da2e2ef6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826da2e2ef6Smrg  fi
2827da2e2ef6Smrgfi
2828da2e2ef6SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829da2e2ef6Smrg#
2830da2e2ef6Smrg]) # XORG_LD_WRAP
2831b7d26471Smrg
2832da2e2ef6Smrg# XORG_CHECK_LINKER_FLAGS
2833da2e2ef6Smrg# -----------------------
2834da2e2ef6Smrg# SYNOPSIS
2835da2e2ef6Smrg#
2836da2e2ef6Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837da2e2ef6Smrg#
2838da2e2ef6Smrg# DESCRIPTION
2839da2e2ef6Smrg#
2840da2e2ef6Smrg#   Check whether the given linker FLAGS work with the current language's
2841da2e2ef6Smrg#   linker, or whether they give an error.
2842da2e2ef6Smrg#
2843da2e2ef6Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844da2e2ef6Smrg#   success/failure.
2845da2e2ef6Smrg#
2846da2e2ef6Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847da2e2ef6Smrg#
2848da2e2ef6Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849da2e2ef6Smrg#
2850da2e2ef6Smrg# LICENSE
2851da2e2ef6Smrg#
2852da2e2ef6Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853da2e2ef6Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854da2e2ef6Smrg#   Copyright (c) 2009 Matteo Frigo
2855da2e2ef6Smrg#
2856da2e2ef6Smrg#   This program is free software: you can redistribute it and/or modify it
2857da2e2ef6Smrg#   under the terms of the GNU General Public License as published by the
2858da2e2ef6Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2859da2e2ef6Smrg#   option) any later version.
2860da2e2ef6Smrg#
2861da2e2ef6Smrg#   This program is distributed in the hope that it will be useful, but
2862da2e2ef6Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863da2e2ef6Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864da2e2ef6Smrg#   Public License for more details.
2865da2e2ef6Smrg#
2866da2e2ef6Smrg#   You should have received a copy of the GNU General Public License along
2867da2e2ef6Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868da2e2ef6Smrg#
2869da2e2ef6Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870da2e2ef6Smrg#   gives unlimited permission to copy, distribute and modify the configure
2871da2e2ef6Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2872da2e2ef6Smrg#   need not follow the terms of the GNU General Public License when using
2873da2e2ef6Smrg#   or distributing such scripts, even though portions of the text of the
2874da2e2ef6Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875da2e2ef6Smrg#   all other use of the material that constitutes the Autoconf Macro.
2876da2e2ef6Smrg#
2877da2e2ef6Smrg#   This special exception to the GPL applies to versions of the Autoconf
2878da2e2ef6Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879da2e2ef6Smrg#   modified version of the Autoconf Macro, you may extend this special
2880da2e2ef6Smrg#   exception to the GPL to apply to your modified version as well.#
2881da2e2ef6SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882da2e2ef6Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883da2e2ef6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884da2e2ef6SmrgAS_LITERAL_IF([$1],
2885da2e2ef6Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886da2e2ef6Smrg      ax_save_FLAGS=$LDFLAGS
2887da2e2ef6Smrg      LDFLAGS="$1"
2888da2e2ef6Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889da2e2ef6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890da2e2ef6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891da2e2ef6Smrg      LDFLAGS=$ax_save_FLAGS])],
2892da2e2ef6Smrg  [ax_save_FLAGS=$LDFLAGS
2893da2e2ef6Smrg   LDFLAGS="$1"
2894da2e2ef6Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895da2e2ef6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896da2e2ef6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897da2e2ef6Smrg   LDFLAGS=$ax_save_FLAGS])
2898da2e2ef6Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899da2e2ef6SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900da2e2ef6Smrgif test "x$xorg_check_linker_flags" = xyes; then
2901da2e2ef6Smrg	m4_default([$2], :)
2902da2e2ef6Smrgelse
2903da2e2ef6Smrg	m4_default([$3], :)
2904da2e2ef6Smrgfi
2905da2e2ef6Smrg]) # XORG_CHECK_LINKER_FLAGS
2906b7d26471Smrg
2907da2e2ef6Smrg# XORG_MEMORY_CHECK_FLAGS
2908da2e2ef6Smrg# -----------------------
2909da2e2ef6Smrg# Minimum version: 1.16.0
2910629baa8cSmrg#
2911da2e2ef6Smrg# This macro attempts to find appropriate memory checking functionality
2912da2e2ef6Smrg# for various platforms which unit testing code may use to catch various
2913da2e2ef6Smrg# forms of memory allocation and access errors in testing.
2914da2e2ef6Smrg#
2915da2e2ef6Smrg# Interface to module:
2916da2e2ef6Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917da2e2ef6Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918da2e2ef6Smrg#
2919da2e2ef6Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920da2e2ef6Smrg#
2921da2e2ef6SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922b7d26471Smrg
2923da2e2ef6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924da2e2ef6SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925da2e2ef6Smrg           [Environment variables to enable memory checking in tests])
2926da2e2ef6Smrg
2927da2e2ef6Smrg# Check for different types of support on different platforms
2928da2e2ef6Smrgcase $host_os in
2929da2e2ef6Smrg    solaris*)
2930da2e2ef6Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2931da2e2ef6Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932da2e2ef6Smrg        ;;
2933da2e2ef6Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934da2e2ef6Smrg        # both directly and inverted, so should not be 0 or 255.
2935da2e2ef6Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936da2e2ef6Smrg        ;;
2937da2e2ef6Smrg    darwin*)
2938da2e2ef6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939da2e2ef6Smrg        ;;
2940da2e2ef6Smrg    *bsd*)
2941da2e2ef6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942da2e2ef6Smrg        ;;
2943da2e2ef6Smrgesac
2944da2e2ef6Smrg
2945da2e2ef6Smrg# User supplied flags override default flags
2946da2e2ef6Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947da2e2ef6Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
29485ffd6003Smrgfi
2949629baa8cSmrg
2950da2e2ef6SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951da2e2ef6Smrg]) # XORG_WITH_LINT
2952da2e2ef6Smrg
2953da2e2ef6Smrg# XORG_CHECK_MALLOC_ZERO
2954da2e2ef6Smrg# ----------------------
2955da2e2ef6Smrg# Minimum version: 1.0.0
2956629baa8cSmrg#
2957da2e2ef6Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958da2e2ef6Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959da2e2ef6Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29601d778f8eSmrg#
29611d778f8eSmrg# No longer actually tests since there is no guarantee applications will
29621d778f8eSmrg# run with the same malloc implementation we tested against, and the cost
29631d778f8eSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29641d778f8eSmrg# Still allows builders to override when they have complete control over
29651d778f8eSmrg# which malloc implementation will be used.
2966da2e2ef6SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967da2e2ef6SmrgAC_ARG_ENABLE(malloc0returnsnull,
2968da2e2ef6Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29691d778f8eSmrg		       [assume malloc(0) can return NULL (default: yes)]),
2970da2e2ef6Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29711d778f8eSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29721d778f8eSmrg
29731d778f8eSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
2974da2e2ef6SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975da2e2ef6Smrg
2976da2e2ef6Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977da2e2ef6Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978da2e2ef6Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979da2e2ef6Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29805ffd6003Smrgelse
2981da2e2ef6Smrg	MALLOC_ZERO_CFLAGS=""
2982da2e2ef6Smrg	XMALLOC_ZERO_CFLAGS=""
2983da2e2ef6Smrg	XTMALLOC_ZERO_CFLAGS=""
29845ffd6003Smrgfi
2985145b7b3cSmrg
2986da2e2ef6SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987da2e2ef6SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988da2e2ef6SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989da2e2ef6Smrg]) # XORG_CHECK_MALLOC_ZERO
2990b7d26471Smrg
2991da2e2ef6Smrg# XORG_WITH_LINT()
2992da2e2ef6Smrg# ----------------
2993da2e2ef6Smrg# Minimum version: 1.1.0
2994145b7b3cSmrg#
2995da2e2ef6Smrg# This macro enables the use of a tool that flags some suspicious and
2996da2e2ef6Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997da2e2ef6Smrg# It will attempt to locate the tool and use appropriate options.
2998da2e2ef6Smrg# There are various lint type tools on different platforms.
2999b7d26471Smrg#
3000da2e2ef6Smrg# Interface to module:
3001da2e2ef6Smrg# LINT:		returns the path to the tool found on the platform
3002da2e2ef6Smrg#		or the value set to LINT on the configure cmd line
3003da2e2ef6Smrg#		also an Automake conditional
3004da2e2ef6Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005da2e2ef6Smrg#
3006da2e2ef6Smrg# --with-lint:	'yes' user instructs the module to use lint
3007da2e2ef6Smrg#		'no' user instructs the module not to use lint (default)
3008da2e2ef6Smrg#
3009da2e2ef6Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010da2e2ef6Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011da2e2ef6Smrg#
3012da2e2ef6SmrgAC_DEFUN([XORG_WITH_LINT],[
3013b7d26471Smrg
3014da2e2ef6SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015da2e2ef6SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016da2e2ef6SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017da2e2ef6Smrg		[Use a lint-style source code checker (default: disabled)])],
3018da2e2ef6Smrg		[use_lint=$withval], [use_lint=no])
3019b7d26471Smrg
3020da2e2ef6Smrg# Obtain platform specific info like program name and options
3021da2e2ef6Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022da2e2ef6Smrgcase $host_os in
3023da2e2ef6Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024da2e2ef6Smrg	lint_name=splint
3025da2e2ef6Smrg	lint_options="-badflag"
3026da2e2ef6Smrg	;;
3027da2e2ef6Smrg  *freebsd* | *netbsd*)
3028da2e2ef6Smrg	lint_name=lint
3029da2e2ef6Smrg	lint_options="-u -b"
3030da2e2ef6Smrg	;;
3031da2e2ef6Smrg  *solaris*)
3032da2e2ef6Smrg	lint_name=lint
3033da2e2ef6Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034da2e2ef6Smrg	;;
3035da2e2ef6Smrgesac
3036da2e2ef6Smrg
3037da2e2ef6Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038da2e2ef6Smrgif test "x$use_lint" = x"yes" ; then
3039da2e2ef6Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040da2e2ef6Smrg   if test "x$LINT" = "x"; then
3041da2e2ef6Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042da2e2ef6Smrg   fi
3043da2e2ef6Smrgelif test "x$use_lint" = x"no" ; then
3044da2e2ef6Smrg   if test "x$LINT" != "x"; then
3045da2e2ef6Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046da2e2ef6Smrg   fi
3047629baa8cSmrgelse
3048da2e2ef6Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049629baa8cSmrgfi
3050145b7b3cSmrg
3051da2e2ef6Smrg# User supplied flags override default flags
3052da2e2ef6Smrgif test "x$LINT_FLAGS" != "x"; then
3053da2e2ef6Smrg   lint_options=$LINT_FLAGS
3054da2e2ef6Smrgfi
3055da2e2ef6Smrg
3056da2e2ef6SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057da2e2ef6SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058da2e2ef6Smrg
3059da2e2ef6Smrg]) # XORG_WITH_LINT
3060629baa8cSmrg
3061da2e2ef6Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062da2e2ef6Smrg# --------------------------
3063da2e2ef6Smrg# Minimum version: 1.1.0
3064629baa8cSmrg#
3065da2e2ef6Smrg# Sets up flags for building lint libraries for checking programs that call
3066da2e2ef6Smrg# functions in the library.
3067da2e2ef6Smrg#
3068da2e2ef6Smrg# Interface to module:
3069da2e2ef6Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070da2e2ef6Smrg# MAKE_LINT_LIB		- Automake conditional
3071da2e2ef6Smrg#
3072da2e2ef6Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073da2e2ef6Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3074578741aaSmrg
3075da2e2ef6SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076da2e2ef6SmrgAC_REQUIRE([XORG_WITH_LINT])
3077da2e2ef6SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078da2e2ef6Smrg	[Create lint library (default: disabled)])],
3079da2e2ef6Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080578741aaSmrg
3081da2e2ef6Smrgif test "x$make_lint_lib" = x"yes" ; then
3082da2e2ef6Smrg   LINTLIB=llib-l$1.ln
3083da2e2ef6Smrg   if test "x$LINT" = "x"; then
3084da2e2ef6Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085da2e2ef6Smrg   fi
3086da2e2ef6Smrgelif test "x$make_lint_lib" != x"no" ; then
3087da2e2ef6Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088da2e2ef6Smrgfi
3089578741aaSmrg
3090da2e2ef6SmrgAC_SUBST(LINTLIB)
3091da2e2ef6SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3092145b7b3cSmrg
3093da2e2ef6Smrg]) # XORG_LINT_LIBRARY
30945ffd6003Smrg
3095da2e2ef6Smrg# XORG_COMPILER_BRAND
3096da2e2ef6Smrg# -------------------
3097da2e2ef6Smrg# Minimum version: 1.14.0
3098629baa8cSmrg#
3099da2e2ef6Smrg# Checks for various brands of compilers and sets flags as appropriate:
3100da2e2ef6Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101da2e2ef6Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102da2e2ef6Smrg#   clang compiler - sets CLANGCC to "yes"
3103da2e2ef6Smrg#   Intel compiler - sets INTELCC to "yes"
3104da2e2ef6Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105da2e2ef6Smrg#
3106da2e2ef6SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107da2e2ef6SmrgAC_LANG_CASE(
3108da2e2ef6Smrg	[C], [
31094901b09eSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31104901b09eSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31114901b09eSmrg		m4_version_prereq([2.70],
31124901b09eSmrg			[AC_REQUIRE([AC_PROG_CC])],
31134901b09eSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114da2e2ef6Smrg	],
3115da2e2ef6Smrg	[C++], [
3116da2e2ef6Smrg		AC_REQUIRE([AC_PROG_CXX])
3117da2e2ef6Smrg	]
3118da2e2ef6Smrg)
3119da2e2ef6SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120da2e2ef6SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121da2e2ef6SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122da2e2ef6Smrg]) # XORG_COMPILER_BRAND
31235ffd6003Smrg
3124da2e2ef6Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125b7d26471Smrg# ---------------
3126da2e2ef6Smrg# Minimum version: 1.16.0
3127da2e2ef6Smrg#
3128da2e2ef6Smrg# Test if the compiler works when passed the given flag as a command line argument.
31294901b09eSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130da2e2ef6Smrg# next flag in the list until there are no more options.
3131da2e2ef6Smrg#
3132da2e2ef6Smrg# Note that this does not guarantee that the compiler supports the flag as some
3133da2e2ef6Smrg# compilers will simply ignore arguments that they do not understand, but we do
3134da2e2ef6Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135da2e2ef6Smrg# -Werror=unused-command-line-argument
3136da2e2ef6Smrg#
3137da2e2ef6SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138da2e2ef6Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139da2e2ef6Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140da2e2ef6Smrg
3141da2e2ef6SmrgAC_LANG_COMPILER_REQUIRE
3142da2e2ef6Smrg
3143da2e2ef6SmrgAC_LANG_CASE(
3144da2e2ef6Smrg	[C], [
31454901b09eSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31464901b09eSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31474901b09eSmrg		m4_version_prereq([2.70],
31484901b09eSmrg			[AC_REQUIRE([AC_PROG_CC])],
31494901b09eSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150da2e2ef6Smrg		define([PREFIX], [C])
3151da2e2ef6Smrg		define([CACHE_PREFIX], [cc])
3152da2e2ef6Smrg		define([COMPILER], [$CC])
3153da2e2ef6Smrg	],
3154da2e2ef6Smrg	[C++], [
3155da2e2ef6Smrg		define([PREFIX], [CXX])
3156da2e2ef6Smrg		define([CACHE_PREFIX], [cxx])
3157da2e2ef6Smrg		define([COMPILER], [$CXX])
3158da2e2ef6Smrg	]
3159da2e2ef6Smrg)
3160da2e2ef6Smrg
3161da2e2ef6Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162da2e2ef6Smrg
3163da2e2ef6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164da2e2ef6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165da2e2ef6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166da2e2ef6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167da2e2ef6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168da2e2ef6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169da2e2ef6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170da2e2ef6Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171da2e2ef6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172629baa8cSmrgfi
31735ffd6003Smrg
3174da2e2ef6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175da2e2ef6Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176da2e2ef6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177da2e2ef6Smrg	fi
3178da2e2ef6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179da2e2ef6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180da2e2ef6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181da2e2ef6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182da2e2ef6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183da2e2ef6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184da2e2ef6Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185da2e2ef6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3186da2e2ef6Smrgfi
31875ffd6003Smrg
3188da2e2ef6Smrgfound="no"
3189da2e2ef6Smrgm4_foreach([flag], m4_cdr($@), [
3190da2e2ef6Smrg	if test $found = "no" ; then
3191da2e2ef6Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192da2e2ef6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193da2e2ef6Smrg		fi
3194629baa8cSmrg
3195da2e2ef6Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196da2e2ef6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197da2e2ef6Smrg		fi
3198b7d26471Smrg
3199da2e2ef6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200b7d26471Smrg
3201da2e2ef6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202da2e2ef6Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203da2e2ef6Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204da2e2ef6Smrg		AC_CACHE_VAL($cacheid,
3205da2e2ef6Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206da2e2ef6Smrg					     [eval $cacheid=yes],
3207da2e2ef6Smrg					     [eval $cacheid=no])])
3208629baa8cSmrg
3209da2e2ef6Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210da2e2ef6Smrg
3211da2e2ef6Smrg		eval supported=\$$cacheid
3212da2e2ef6Smrg		AC_MSG_RESULT([$supported])
3213da2e2ef6Smrg		if test "$supported" = "yes" ; then
3214da2e2ef6Smrg			$1="$$1 ]flag["
3215da2e2ef6Smrg			found="yes"
3216da2e2ef6Smrg		fi
3217da2e2ef6Smrg	fi
3218da2e2ef6Smrg])
3219da2e2ef6Smrg]) # XORG_TESTSET_CFLAG
3220da2e2ef6Smrg
3221da2e2ef6Smrg# XORG_COMPILER_FLAGS
3222629baa8cSmrg# ---------------
3223da2e2ef6Smrg# Minimum version: 1.16.0
3224da2e2ef6Smrg#
3225da2e2ef6Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226da2e2ef6Smrg# arguments supported by the selected compiler which do NOT alter the generated
3227da2e2ef6Smrg# code.  These arguments will cause the compiler to print various warnings
3228da2e2ef6Smrg# during compilation AND turn a conservative set of warnings into errors.
3229da2e2ef6Smrg#
3230da2e2ef6Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231da2e2ef6Smrg# future versions of util-macros as options are added to new compilers.
3232da2e2ef6Smrg#
3233da2e2ef6SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234da2e2ef6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235b7d26471Smrg
3236da2e2ef6SmrgAC_ARG_ENABLE(selective-werror,
3237da2e2ef6Smrg              AS_HELP_STRING([--disable-selective-werror],
3238da2e2ef6Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3239da2e2ef6Smrg              [SELECTIVE_WERROR=$enableval],
3240da2e2ef6Smrg              [SELECTIVE_WERROR=yes])
3241b7d26471Smrg
3242da2e2ef6SmrgAC_LANG_CASE(
3243da2e2ef6Smrg        [C], [
3244da2e2ef6Smrg                define([PREFIX], [C])
3245da2e2ef6Smrg        ],
3246da2e2ef6Smrg        [C++], [
3247da2e2ef6Smrg                define([PREFIX], [CXX])
3248da2e2ef6Smrg        ]
3249da2e2ef6Smrg)
3250da2e2ef6Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251da2e2ef6Smrgif test "x$SUNCC" = "xyes"; then
3252da2e2ef6Smrg    [BASE_]PREFIX[FLAGS]="-v"
32535ffd6003Smrgelse
3254da2e2ef6Smrg    [BASE_]PREFIX[FLAGS]=""
3255b7d26471Smrgfi
3256145b7b3cSmrg
3257da2e2ef6Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262145b7b3cSmrg
3263da2e2ef6SmrgAC_LANG_CASE(
3264da2e2ef6Smrg	[C], [
3265da2e2ef6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266da2e2ef6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267da2e2ef6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268da2e2ef6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269da2e2ef6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270da2e2ef6Smrg	]
3271da2e2ef6Smrg)
3272da2e2ef6Smrg
3273da2e2ef6Smrg# This chunk adds additional warnings that could catch undesired effects.
3274da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281da2e2ef6Smrg
3282da2e2ef6Smrg# These are currently disabled because they are noisy.  They will be enabled
3283da2e2ef6Smrg# in the future once the codebase is sufficiently modernized to silence
3284da2e2ef6Smrg# them.  For now, I don't want them to drown out the other warnings.
3285da2e2ef6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286da2e2ef6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287da2e2ef6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288da2e2ef6Smrg
32894901b09eSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290da2e2ef6Smrg# when there are problems that should be fixed.
3291da2e2ef6Smrg
3292da2e2ef6Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306b7d26471Smrgelse
3307da2e2ef6SmrgAC_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])
3308da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320da2e2ef6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321629baa8cSmrgfi
3322b7d26471Smrg
3323da2e2ef6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324da2e2ef6Smrg]) # XORG_COMPILER_FLAGS
3325da2e2ef6Smrg
3326da2e2ef6Smrg# XORG_CWARNFLAGS
3327da2e2ef6Smrg# ---------------
3328da2e2ef6Smrg# Minimum version: 1.2.0
3329da2e2ef6Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330b7d26471Smrg#
3331da2e2ef6Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3332da2e2ef6Smrg#
3333da2e2ef6Smrg# This function is deprecated because it defines -fno-strict-aliasing
3334da2e2ef6Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335da2e2ef6Smrg# is needed, then it should be added explicitly in the module when
3336da2e2ef6Smrg# it is updated to use BASE_CFLAGS.
3337da2e2ef6Smrg#
3338da2e2ef6SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339da2e2ef6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340da2e2ef6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341da2e2ef6SmrgAC_LANG_CASE(
3342da2e2ef6Smrg	[C], [
3343da2e2ef6Smrg		CWARNFLAGS="$BASE_CFLAGS"
3344da2e2ef6Smrg		if  test "x$GCC" = xyes ; then
3345da2e2ef6Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346da2e2ef6Smrg		fi
3347da2e2ef6Smrg		AC_SUBST(CWARNFLAGS)
3348da2e2ef6Smrg	]
3349da2e2ef6Smrg)
3350da2e2ef6Smrg]) # XORG_CWARNFLAGS
3351b7d26471Smrg
3352da2e2ef6Smrg# XORG_STRICT_OPTION
3353da2e2ef6Smrg# -----------------------
3354da2e2ef6Smrg# Minimum version: 1.3.0
3355da2e2ef6Smrg#
3356da2e2ef6Smrg# Add configure option to enable strict compilation flags, such as treating
3357da2e2ef6Smrg# warnings as fatal errors.
3358da2e2ef6Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359da2e2ef6Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3360da2e2ef6Smrg#
3361da2e2ef6Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362da2e2ef6Smrg# when strict compilation is unconditionally desired.
3363da2e2ef6SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364da2e2ef6SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365da2e2ef6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366da2e2ef6Smrg
3367da2e2ef6SmrgAC_ARG_ENABLE(strict-compilation,
3368da2e2ef6Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3369da2e2ef6Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370da2e2ef6Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371da2e2ef6Smrg
3372da2e2ef6SmrgAC_LANG_CASE(
3373da2e2ef6Smrg        [C], [
3374da2e2ef6Smrg                define([PREFIX], [C])
3375da2e2ef6Smrg        ],
3376da2e2ef6Smrg        [C++], [
3377da2e2ef6Smrg                define([PREFIX], [CXX])
3378da2e2ef6Smrg        ]
3379da2e2ef6Smrg)
3380da2e2ef6Smrg
3381da2e2ef6Smrg[STRICT_]PREFIX[FLAGS]=""
3382da2e2ef6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383da2e2ef6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384da2e2ef6Smrg
3385da2e2ef6Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386da2e2ef6Smrg# activate it with -Werror, so we add it here explicitly.
3387da2e2ef6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388da2e2ef6Smrg
3389da2e2ef6Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3390da2e2ef6Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391da2e2ef6Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392629baa8cSmrgfi
3393da2e2ef6SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394da2e2ef6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395da2e2ef6SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396da2e2ef6Smrg]) # XORG_STRICT_OPTION
3397145b7b3cSmrg
33984901b09eSmrg# XORG_DEFAULT_NOCODE_OPTIONS
33994901b09eSmrg# ---------------------------
34004901b09eSmrg# Minimum version: 1.20.0
34014901b09eSmrg#
34024901b09eSmrg# Defines default options for X.Org modules which don't compile code,
34034901b09eSmrg# such as fonts, bitmaps, cursors, and docs.
34044901b09eSmrg#
34054901b09eSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34064901b09eSmrgAC_REQUIRE([AC_PROG_INSTALL])
34074901b09eSmrgXORG_RELEASE_VERSION
34084901b09eSmrgXORG_CHANGELOG
34094901b09eSmrgXORG_INSTALL
34104901b09eSmrgXORG_MANPAGE_SECTIONS
34114901b09eSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34124901b09eSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34134901b09eSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34144901b09eSmrg
3415da2e2ef6Smrg# XORG_DEFAULT_OPTIONS
3416da2e2ef6Smrg# --------------------
3417da2e2ef6Smrg# Minimum version: 1.3.0
3418629baa8cSmrg#
34194901b09eSmrg# Defines default options for X.Org modules which compile code.
3420da2e2ef6Smrg#
3421da2e2ef6SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422da2e2ef6SmrgAC_REQUIRE([AC_PROG_INSTALL])
3423da2e2ef6SmrgXORG_COMPILER_FLAGS
3424da2e2ef6SmrgXORG_CWARNFLAGS
3425da2e2ef6SmrgXORG_STRICT_OPTION
34264901b09eSmrgXORG_DEFAULT_NOCODE_OPTIONS
3427da2e2ef6Smrg]) # XORG_DEFAULT_OPTIONS
3428145b7b3cSmrg
3429da2e2ef6Smrg# XORG_INSTALL()
3430da2e2ef6Smrg# ----------------
3431da2e2ef6Smrg# Minimum version: 1.4.0
3432da2e2ef6Smrg#
3433da2e2ef6Smrg# Defines the variable INSTALL_CMD as the command to copy
3434da2e2ef6Smrg# INSTALL from $prefix/share/util-macros.
3435da2e2ef6Smrg#
3436da2e2ef6SmrgAC_DEFUN([XORG_INSTALL], [
3437da2e2ef6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438da2e2ef6Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439da2e2ef6SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440da2e2ef6Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441da2e2ef6Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442da2e2ef6Smrgtouch \$(top_srcdir)/INSTALL; \
3443da2e2ef6Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444da2e2ef6SmrgAC_SUBST([INSTALL_CMD])
3445da2e2ef6Smrg]) # XORG_INSTALL
3446da2e2ef6Smrgdnl Copyright 2005 Red Hat, Inc
3447da2e2ef6Smrgdnl
3448da2e2ef6Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449da2e2ef6Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450da2e2ef6Smrgdnl the above copyright notice appear in all copies and that both that
3451da2e2ef6Smrgdnl copyright notice and this permission notice appear in supporting
3452da2e2ef6Smrgdnl documentation.
3453da2e2ef6Smrgdnl
3454da2e2ef6Smrgdnl The above copyright notice and this permission notice shall be included
3455da2e2ef6Smrgdnl in all copies or substantial portions of the Software.
3456da2e2ef6Smrgdnl
3457da2e2ef6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458da2e2ef6Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459da2e2ef6Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460da2e2ef6Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461da2e2ef6Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462da2e2ef6Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463da2e2ef6Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464da2e2ef6Smrgdnl
3465da2e2ef6Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466da2e2ef6Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467da2e2ef6Smrgdnl other dealings in this Software without prior written authorization
3468da2e2ef6Smrgdnl from the copyright holders.
3469da2e2ef6Smrgdnl
3470b7d26471Smrg
3471da2e2ef6Smrg# XORG_RELEASE_VERSION
3472da2e2ef6Smrg# --------------------
3473da2e2ef6Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3474b7d26471Smrg
3475da2e2ef6SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476da2e2ef6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477da2e2ef6Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478da2e2ef6Smrg		[Major version of this package])
3479da2e2ef6Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480da2e2ef6Smrg	if test "x$PVM" = "x"; then
3481da2e2ef6Smrg		PVM="0"
3482da2e2ef6Smrg	fi
3483da2e2ef6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484da2e2ef6Smrg		[$PVM],
3485da2e2ef6Smrg		[Minor version of this package])
3486da2e2ef6Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487da2e2ef6Smrg	if test "x$PVP" = "x"; then
3488da2e2ef6Smrg		PVP="0"
3489da2e2ef6Smrg	fi
3490da2e2ef6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491da2e2ef6Smrg		[$PVP],
3492da2e2ef6Smrg		[Patch version of this package])
3493da2e2ef6Smrg])
3494da2e2ef6Smrg
3495da2e2ef6Smrg# XORG_CHANGELOG()
3496da2e2ef6Smrg# ----------------
3497da2e2ef6Smrg# Minimum version: 1.2.0
3498da2e2ef6Smrg#
3499da2e2ef6Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3500da2e2ef6Smrg# ChangeLog from git.
3501da2e2ef6Smrg#
3502da2e2ef6Smrg#
3503da2e2ef6SmrgAC_DEFUN([XORG_CHANGELOG], [
3504da2e2ef6SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505da2e2ef6Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506da2e2ef6Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507da2e2ef6Smrgtouch \$(top_srcdir)/ChangeLog; \
3508da2e2ef6Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509da2e2ef6SmrgAC_SUBST([CHANGELOG_CMD])
3510da2e2ef6Smrg]) # XORG_CHANGELOG
3511da2e2ef6Smrg
3512da2e2ef6Smrgdnl
35131d778f8eSmrgdnl Copyright (c) 2005, 2025, Oracle and/or its affiliates.
3514da2e2ef6Smrgdnl
3515da2e2ef6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3516da2e2ef6Smrgdnl copy of this software and associated documentation files (the "Software"),
3517da2e2ef6Smrgdnl to deal in the Software without restriction, including without limitation
3518da2e2ef6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3519da2e2ef6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3520da2e2ef6Smrgdnl Software is furnished to do so, subject to the following conditions:
3521da2e2ef6Smrgdnl
3522da2e2ef6Smrgdnl The above copyright notice and this permission notice (including the next
3523da2e2ef6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3524da2e2ef6Smrgdnl Software.
3525da2e2ef6Smrgdnl
3526da2e2ef6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3527da2e2ef6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3528da2e2ef6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3529da2e2ef6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3530da2e2ef6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3531da2e2ef6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3532da2e2ef6Smrgdnl DEALINGS IN THE SOFTWARE.
3533da2e2ef6Smrgdnl
3534b7d26471Smrg
3535da2e2ef6Smrg# XTRANS_TCP_FLAGS()
3536da2e2ef6Smrg# ------------------
3537da2e2ef6Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
3538da2e2ef6SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
3539da2e2ef6Smrg # SVR4 hides these in libraries other than libc
3540da2e2ef6Smrg AC_SEARCH_LIBS(socket, [socket])
3541da2e2ef6Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3542da2e2ef6Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3543da2e2ef6Smrg   AC_CHECK_LIB([ws2_32],[main])
3544da2e2ef6Smrg fi
3545578741aaSmrg
3546da2e2ef6Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
35471d778f8eSmrg AC_CHECK_FUNCS([getaddrinfo inet_ntop])
35481d778f8eSmrg
3549da2e2ef6Smrg AC_ARG_ENABLE(ipv6,
3550da2e2ef6Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
3551da2e2ef6Smrg	[IPV6CONN=$enableval],
35521d778f8eSmrg	[IPV6CONN=$ac_cv_func_getaddrinfo])
3553da2e2ef6Smrg AC_MSG_CHECKING([if IPv6 support should be built])
3554da2e2ef6Smrg if test "$IPV6CONN" = "yes"; then
3555da2e2ef6Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
3556da2e2ef6Smrg fi
3557da2e2ef6Smrg AC_MSG_RESULT($IPV6CONN)
3558145b7b3cSmrg
3559da2e2ef6Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
3560da2e2ef6Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
3561da2e2ef6Smrg	AC_DEFINE([BSD44SOCKETS],1,
3562da2e2ef6Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
3563da2e2ef6Smrg#include <sys/types.h>
3564da2e2ef6Smrg#include <sys/socket.h>
3565da2e2ef6Smrg#include <netinet/in.h>
3566da2e2ef6Smrg ])
3567145b7b3cSmrg
3568da2e2ef6Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
35691d778f8eSmrg # and added a type defined to be large enough to hold any sockaddr format.
35701d778f8eSmrg AC_CHECK_TYPES([socklen_t, struct sockaddr_storage], [], [], [
3571da2e2ef6SmrgAC_INCLUDES_DEFAULT
35721d778f8eSmrg#include <sys/socket.h>
35731d778f8eSmrg ])
3574b7d26471Smrg
3575da2e2ef6Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
3576da2e2ef6Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
3577da2e2ef6Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
3578da2e2ef6Smrg                 [
3579da2e2ef6SmrgAC_INCLUDES_DEFAULT
3580da2e2ef6Smrg#include <sys/socket.h>
3581da2e2ef6Smrg                 ])
3582da2e2ef6Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
3583da2e2ef6Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3584da2e2ef6Smrg     unset ac_cv_member_struct_msghdr_msg_control
3585da2e2ef6Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
3586da2e2ef6Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3587da2e2ef6Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
3588da2e2ef6Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3589da2e2ef6Smrg                     ], [], [
3590da2e2ef6Smrg#define _XOPEN_SOURCE 600
3591da2e2ef6SmrgAC_INCLUDES_DEFAULT
3592da2e2ef6Smrg#include <sys/socket.h>
3593da2e2ef6Smrg                     ])
3594da2e2ef6Smrg fi
3595da2e2ef6Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
3596da2e2ef6Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
3597da2e2ef6Smrg     unset ac_cv_member_struct_msghdr_msg_control
3598da2e2ef6Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
3599da2e2ef6Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
3600da2e2ef6Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
3601da2e2ef6Smrg                       [Defined if needed to expose struct msghdr.msg_control])
3602da2e2ef6Smrg                     ], [], [
3603da2e2ef6Smrg#define _XOPEN_SOURCE 500
3604da2e2ef6SmrgAC_INCLUDES_DEFAULT
3605da2e2ef6Smrg#include <sys/socket.h>
3606da2e2ef6Smrg                     ])
3607da2e2ef6Smrg fi
3608145b7b3cSmrg
3609578741aaSmrg
3610da2e2ef6Smrg]) # XTRANS_TCP_FLAGS
3611145b7b3cSmrg
3612da2e2ef6Smrg# XTRANS_CONNECTION_FLAGS()
3613da2e2ef6Smrg# -------------------------
3614da2e2ef6Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
3615da2e2ef6Smrg# that use Xtrans functions
3616da2e2ef6SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
3617da2e2ef6Smrg AC_REQUIRE([AC_CANONICAL_HOST])
3618da2e2ef6Smrg [case $host_os in
3619da2e2ef6Smrg	mingw*)	unixdef="no"   ;;
3620da2e2ef6Smrg	*)	unixdef="yes"  ;;
3621da2e2ef6Smrg esac]
3622da2e2ef6Smrg AC_ARG_ENABLE(unix-transport,
3623da2e2ef6Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3624da2e2ef6Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
3625da2e2ef6Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
3626da2e2ef6Smrg if test "$UNIXCONN" = "yes"; then
3627da2e2ef6Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
3628da2e2ef6Smrg fi
3629da2e2ef6Smrg AC_MSG_RESULT($UNIXCONN)
3630da2e2ef6Smrg AC_ARG_ENABLE(tcp-transport,
3631da2e2ef6Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3632da2e2ef6Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
3633da2e2ef6Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
3634da2e2ef6Smrg AC_MSG_RESULT($TCPCONN)
3635da2e2ef6Smrg if test "$TCPCONN" = "yes"; then
3636da2e2ef6Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
3637da2e2ef6Smrg	XTRANS_TCP_FLAGS
3638da2e2ef6Smrg fi
3639da2e2ef6Smrg [case $host_os in
3640da2e2ef6Smrg	solaris*)		localdef="yes" ;;
3641da2e2ef6Smrg	*)			localdef="no"  ;;
3642da2e2ef6Smrg esac]
3643da2e2ef6Smrg AC_ARG_ENABLE(local-transport,
3644da2e2ef6Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
3645da2e2ef6Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
3646da2e2ef6Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
3647da2e2ef6Smrg AC_MSG_RESULT($LOCALCONN)
3648da2e2ef6Smrg if test "$LOCALCONN" = "yes"; then
3649da2e2ef6Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
3650da2e2ef6Smrg fi
3651578741aaSmrg
3652da2e2ef6Smrg # Other functions Xtrans may need
3653da2e2ef6Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
3654578741aaSmrg
3655da2e2ef6Smrg]) # XTRANS_CONNECTION_FLAGS
3656145b7b3cSmrg
3657b7d26471Smrg
3658da2e2ef6Smrg# XTRANS_SECURE_RPC_FLAGS()
3659da2e2ef6Smrg# -------------------------
3660da2e2ef6Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
3661da2e2ef6Smrg# so that any necessary networking libraries are already found
3662da2e2ef6SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
3663da2e2ef6Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
3664da2e2ef6Smrg AC_ARG_ENABLE(secure-rpc,
3665da2e2ef6Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
3666da2e2ef6Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3667145b7b3cSmrg
3668da2e2ef6Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
3669da2e2ef6Smrg	FOUND_SECURE_RPC="no"
3670da2e2ef6Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
3671da2e2ef6Smrg			[FOUND_SECURE_RPC="yes"])
3672da2e2ef6Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
3673da2e2ef6Smrg		if test "x$SECURE_RPC" = "xyes" ; then
3674da2e2ef6Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
3675da2e2ef6Smrg		fi
3676da2e2ef6Smrg		SECURE_RPC="no"
3677da2e2ef6Smrg	else
3678da2e2ef6Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
3679da2e2ef6Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
3680da2e2ef6Smrg		SECURE_RPC="yes"
3681da2e2ef6Smrg	fi
3682da2e2ef6Smrg fi
3683da2e2ef6Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
3684da2e2ef6Smrg if test "x$SECURE_RPC" = "xyes" ; then
3685da2e2ef6Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
3686da2e2ef6Smrg fi
3687da2e2ef6Smrg AC_MSG_RESULT($SECURE_RPC)
3688da2e2ef6Smrg]) # XTRANS_SECURE_RPC_FLAGS
3689145b7b3cSmrg
3690145b7b3cSmrg
3691b7d26471Smrgm4_include([m4/ax_define_dir.m4])
3692b7d26471Smrgm4_include([m4/libtool.m4])
3693b7d26471Smrgm4_include([m4/ltoptions.m4])
3694b7d26471Smrgm4_include([m4/ltsugar.m4])
3695b7d26471Smrgm4_include([m4/ltversion.m4])
3696b7d26471Smrgm4_include([m4/lt~obsolete.m4])
3697