1d3173433Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
26ef05171Smrg
3d3173433Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
443f32c10Smrg
543f32c10Smrg# This file is free software; the Free Software Foundation
643f32c10Smrg# gives unlimited permission to copy and/or distribute it,
743f32c10Smrg# with or without modifications, as long as this notice is preserved.
843f32c10Smrg
943f32c10Smrg# This program is distributed in the hope that it will be useful,
1043f32c10Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1143f32c10Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1243f32c10Smrg# PARTICULAR PURPOSE.
1343f32c10Smrg
146ef05171Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1543f32c10Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1643f32c10Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17d3173433Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18d3173433Smrg[m4_warning([this file was generated for autoconf 2.72.
1943f32c10SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2043f32c10SmrgIf you have problems, you may need to regenerate the build system entirely.
216ef05171SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2243f32c10Smrg
23d3173433Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24fbfaf8f3Smrg#
25fbfaf8f3Smrg# This file is free software; the Free Software Foundation
26fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
27fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
2843f32c10Smrg
29fbfaf8f3Smrg# AM_AUTOMAKE_VERSION(VERSION)
30fbfaf8f3Smrg# ----------------------------
31fbfaf8f3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32fbfaf8f3Smrg# generated from the m4 files accompanying Automake X.Y.
33fbfaf8f3Smrg# (This private macro should not be called outside this file.)
34fbfaf8f3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35d3173433Smrg[am__api_version='1.17'
36fbfaf8f3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37fbfaf8f3Smrgdnl require some minimum version.  Point them to the right macro.
38d3173433Smrgm4_if([$1], [1.17], [],
39fbfaf8f3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40fbfaf8f3Smrg])
416ef05171Smrg
42fbfaf8f3Smrg# _AM_AUTOCONF_VERSION(VERSION)
43fbfaf8f3Smrg# -----------------------------
44fbfaf8f3Smrg# aclocal traces this macro to find the Autoconf version.
45fbfaf8f3Smrg# This is a private macro too.  Using m4_define simplifies
46fbfaf8f3Smrg# the logic in aclocal, which can simply ignore this definition.
47fbfaf8f3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
486ef05171Smrg
49fbfaf8f3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50fbfaf8f3Smrg# -------------------------------
51fbfaf8f3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52fbfaf8f3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53fbfaf8f3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54d3173433Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
55fbfaf8f3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56fbfaf8f3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57fbfaf8f3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
586ef05171Smrg
59fbfaf8f3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6043f32c10Smrg
61d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62fbfaf8f3Smrg#
63fbfaf8f3Smrg# This file is free software; the Free Software Foundation
64fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
65fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
6643f32c10Smrg
67fbfaf8f3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68fbfaf8f3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69fbfaf8f3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70fbfaf8f3Smrg#
71fbfaf8f3Smrg# Of course, Automake must honor this variable whenever it calls a
72fbfaf8f3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73fbfaf8f3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74fbfaf8f3Smrg# depending on how configure is run.  This is pretty annoying, since
75fbfaf8f3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76fbfaf8f3Smrg# source directory, any form will work fine, but in subdirectories a
77fbfaf8f3Smrg# relative path needs to be adjusted first.
78fbfaf8f3Smrg#
79fbfaf8f3Smrg# $ac_aux_dir/missing
80fbfaf8f3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81fbfaf8f3Smrg# $top_srcdir/$ac_aux_dir/missing
82fbfaf8f3Smrg#    fails if $ac_aux_dir is absolute,
83fbfaf8f3Smrg#    fails when called from a subdirectory in a VPATH build with
84fbfaf8f3Smrg#          a relative $ac_aux_dir
85fbfaf8f3Smrg#
86fbfaf8f3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87fbfaf8f3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88fbfaf8f3Smrg# harmless because $srcdir is '.', but things will broke when you
89fbfaf8f3Smrg# start a VPATH build or use an absolute $srcdir.
90fbfaf8f3Smrg#
91fbfaf8f3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92fbfaf8f3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93fbfaf8f3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94fbfaf8f3Smrg# and then we would define $MISSING as
95fbfaf8f3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96fbfaf8f3Smrg# This will work as long as MISSING is not called from configure, because
97fbfaf8f3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98fbfaf8f3Smrg# However there are other variables, like CC, which are often used in
99fbfaf8f3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100fbfaf8f3Smrg#
101fbfaf8f3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102fbfaf8f3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103fbfaf8f3Smrg# configured tree to be moved without reconfiguration.
10443f32c10Smrg
105fbfaf8f3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
106fbfaf8f3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107fbfaf8f3Smrg# Expand $ac_aux_dir to an absolute path.
108fbfaf8f3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109fbfaf8f3Smrg])
11043f32c10Smrg
111fbfaf8f3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11243f32c10Smrg
113d3173433Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114fbfaf8f3Smrg#
115fbfaf8f3Smrg# This file is free software; the Free Software Foundation
116fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
117fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
11843f32c10Smrg
119fbfaf8f3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120fbfaf8f3Smrg# -------------------------------------
121fbfaf8f3Smrg# Define a conditional.
122fbfaf8f3SmrgAC_DEFUN([AM_CONDITIONAL],
123fbfaf8f3Smrg[AC_PREREQ([2.52])dnl
124fbfaf8f3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125fbfaf8f3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126fbfaf8f3SmrgAC_SUBST([$1_TRUE])dnl
127fbfaf8f3SmrgAC_SUBST([$1_FALSE])dnl
128fbfaf8f3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129fbfaf8f3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130fbfaf8f3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131fbfaf8f3Smrgif $2; then
132fbfaf8f3Smrg  $1_TRUE=
133fbfaf8f3Smrg  $1_FALSE='#'
134fbfaf8f3Smrgelse
135fbfaf8f3Smrg  $1_TRUE='#'
136fbfaf8f3Smrg  $1_FALSE=
137fbfaf8f3Smrgfi
138fbfaf8f3SmrgAC_CONFIG_COMMANDS_PRE(
139fbfaf8f3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140fbfaf8f3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141fbfaf8f3SmrgUsually this means the macro was only invoked conditionally.]])
142fbfaf8f3Smrgfi])])
14343f32c10Smrg
144d3173433Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
145fbfaf8f3Smrg#
146fbfaf8f3Smrg# This file is free software; the Free Software Foundation
147fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
148fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
14943f32c10Smrg
15043f32c10Smrg
151fbfaf8f3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152fbfaf8f3Smrg# written in clear, in which case automake, when reading aclocal.m4,
153fbfaf8f3Smrg# will think it sees a *use*, and therefore will trigger all it's
154fbfaf8f3Smrg# C support machinery.  Also note that it means that autoscan, seeing
155fbfaf8f3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15643f32c10Smrg
15743f32c10Smrg
158fbfaf8f3Smrg# _AM_DEPENDENCIES(NAME)
159fbfaf8f3Smrg# ----------------------
160fbfaf8f3Smrg# See how the compiler implements dependency checking.
161fbfaf8f3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162fbfaf8f3Smrg# We try a few techniques and use that to set a single cache variable.
163fbfaf8f3Smrg#
164fbfaf8f3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165fbfaf8f3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166fbfaf8f3Smrg# dependency, and given that the user is not expected to run this macro,
167fbfaf8f3Smrg# just rely on AC_PROG_CC.
168fbfaf8f3SmrgAC_DEFUN([_AM_DEPENDENCIES],
169fbfaf8f3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170fbfaf8f3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171fbfaf8f3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172fbfaf8f3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17343f32c10Smrg
174fbfaf8f3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175fbfaf8f3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176fbfaf8f3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177fbfaf8f3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178fbfaf8f3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179fbfaf8f3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180fbfaf8f3Smrg                    [depcc="$$1"   am_compiler_list=])
18143f32c10Smrg
182fbfaf8f3SmrgAC_CACHE_CHECK([dependency style of $depcc],
183fbfaf8f3Smrg               [am_cv_$1_dependencies_compiler_type],
184fbfaf8f3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185fbfaf8f3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186fbfaf8f3Smrg  # making bogus files that we don't know about and never remove.  For
187fbfaf8f3Smrg  # instance it was reported that on HP-UX the gcc test will end up
188fbfaf8f3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
189fbfaf8f3Smrg  # in D".
190fbfaf8f3Smrg  rm -rf conftest.dir
191fbfaf8f3Smrg  mkdir conftest.dir
192fbfaf8f3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193fbfaf8f3Smrg  # using a relative directory.
194fbfaf8f3Smrg  cp "$am_depcomp" conftest.dir
195fbfaf8f3Smrg  cd conftest.dir
196fbfaf8f3Smrg  # We will build objects and dependencies in a subdirectory because
197fbfaf8f3Smrg  # it helps to detect inapplicable dependency modes.  For instance
198fbfaf8f3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199fbfaf8f3Smrg  # side effect of compilation, but ICC will put the dependencies in
200fbfaf8f3Smrg  # the current directory while Tru64 will put them in the object
201fbfaf8f3Smrg  # directory.
202fbfaf8f3Smrg  mkdir sub
20343f32c10Smrg
204fbfaf8f3Smrg  am_cv_$1_dependencies_compiler_type=none
205fbfaf8f3Smrg  if test "$am_compiler_list" = ""; then
206fbfaf8f3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207fbfaf8f3Smrg  fi
208fbfaf8f3Smrg  am__universal=false
209fbfaf8f3Smrg  m4_case([$1], [CC],
210fbfaf8f3Smrg    [case " $depcc " in #(
211fbfaf8f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212fbfaf8f3Smrg     esac],
213fbfaf8f3Smrg    [CXX],
214fbfaf8f3Smrg    [case " $depcc " in #(
215fbfaf8f3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216fbfaf8f3Smrg     esac])
21743f32c10Smrg
218fbfaf8f3Smrg  for depmode in $am_compiler_list; do
219fbfaf8f3Smrg    # Setup a source with many dependencies, because some compilers
220fbfaf8f3Smrg    # like to wrap large dependency lists on column 80 (with \), and
221fbfaf8f3Smrg    # we should not choose a depcomp mode which is confused by this.
222fbfaf8f3Smrg    #
223fbfaf8f3Smrg    # We need to recreate these files for each test, as the compiler may
224fbfaf8f3Smrg    # overwrite some of them when testing with obscure command lines.
225fbfaf8f3Smrg    # This happens at least with the AIX C compiler.
226fbfaf8f3Smrg    : > sub/conftest.c
227fbfaf8f3Smrg    for i in 1 2 3 4 5 6; do
228fbfaf8f3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229fbfaf8f3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230fbfaf8f3Smrg      # Solaris 10 /bin/sh.
231fbfaf8f3Smrg      echo '/* dummy */' > sub/conftst$i.h
232fbfaf8f3Smrg    done
233fbfaf8f3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2346ef05171Smrg
235fbfaf8f3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236fbfaf8f3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
237fbfaf8f3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
238fbfaf8f3Smrg    # versions had trouble with output in subdirs.
239fbfaf8f3Smrg    am__obj=sub/conftest.${OBJEXT-o}
240fbfaf8f3Smrg    am__minus_obj="-o $am__obj"
241fbfaf8f3Smrg    case $depmode in
242fbfaf8f3Smrg    gcc)
243fbfaf8f3Smrg      # This depmode causes a compiler race in universal mode.
244fbfaf8f3Smrg      test "$am__universal" = false || continue
245fbfaf8f3Smrg      ;;
246fbfaf8f3Smrg    nosideeffect)
247fbfaf8f3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
248fbfaf8f3Smrg      # only be used when explicitly requested.
249fbfaf8f3Smrg      if test "x$enable_dependency_tracking" = xyes; then
250fbfaf8f3Smrg	continue
251fbfaf8f3Smrg      else
252fbfaf8f3Smrg	break
253fbfaf8f3Smrg      fi
254fbfaf8f3Smrg      ;;
255fbfaf8f3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256fbfaf8f3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257fbfaf8f3Smrg      # not run yet.  These depmodes are late enough in the game, and
258fbfaf8f3Smrg      # so weak that their functioning should not be impacted.
259fbfaf8f3Smrg      am__obj=conftest.${OBJEXT-o}
260fbfaf8f3Smrg      am__minus_obj=
261fbfaf8f3Smrg      ;;
262fbfaf8f3Smrg    none) break ;;
263fbfaf8f3Smrg    esac
264fbfaf8f3Smrg    if depmode=$depmode \
265fbfaf8f3Smrg       source=sub/conftest.c object=$am__obj \
266fbfaf8f3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267fbfaf8f3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268fbfaf8f3Smrg         >/dev/null 2>conftest.err &&
269fbfaf8f3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270fbfaf8f3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271fbfaf8f3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272fbfaf8f3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273fbfaf8f3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274fbfaf8f3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275fbfaf8f3Smrg      # that says an option was ignored or not supported.
276d3173433Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
277fbfaf8f3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278fbfaf8f3Smrg      # The diagnosis changed in icc 8.0:
279fbfaf8f3Smrg      #   icc: Command line remark: option '-MP' not supported
280fbfaf8f3Smrg      if (grep 'ignoring option' conftest.err ||
281fbfaf8f3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282fbfaf8f3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283fbfaf8f3Smrg        break
284fbfaf8f3Smrg      fi
285fbfaf8f3Smrg    fi
286fbfaf8f3Smrg  done
2876ef05171Smrg
288fbfaf8f3Smrg  cd ..
289fbfaf8f3Smrg  rm -rf conftest.dir
290fbfaf8f3Smrgelse
291fbfaf8f3Smrg  am_cv_$1_dependencies_compiler_type=none
292fbfaf8f3Smrgfi
293fbfaf8f3Smrg])
294fbfaf8f3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295fbfaf8f3SmrgAM_CONDITIONAL([am__fastdep$1], [
296fbfaf8f3Smrg  test "x$enable_dependency_tracking" != xno \
297fbfaf8f3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298fbfaf8f3Smrg])
29943f32c10Smrg
3006ef05171Smrg
301fbfaf8f3Smrg# AM_SET_DEPDIR
302fbfaf8f3Smrg# -------------
303fbfaf8f3Smrg# Choose a directory name for dependency files.
304fbfaf8f3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305fbfaf8f3SmrgAC_DEFUN([AM_SET_DEPDIR],
306fbfaf8f3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307fbfaf8f3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308fbfaf8f3Smrg])
3096ef05171Smrg
3106ef05171Smrg
311fbfaf8f3Smrg# AM_DEP_TRACK
312fbfaf8f3Smrg# ------------
313fbfaf8f3SmrgAC_DEFUN([AM_DEP_TRACK],
314fbfaf8f3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
315fbfaf8f3SmrgAS_HELP_STRING(
316fbfaf8f3Smrg  [--enable-dependency-tracking],
317fbfaf8f3Smrg  [do not reject slow dependency extractors])
318fbfaf8f3SmrgAS_HELP_STRING(
319fbfaf8f3Smrg  [--disable-dependency-tracking],
320fbfaf8f3Smrg  [speeds up one-time build])])
321fbfaf8f3Smrgif test "x$enable_dependency_tracking" != xno; then
322fbfaf8f3Smrg  am_depcomp="$ac_aux_dir/depcomp"
323fbfaf8f3Smrg  AMDEPBACKSLASH='\'
324fbfaf8f3Smrg  am__nodep='_no'
325fbfaf8f3Smrgfi
326fbfaf8f3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327fbfaf8f3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328fbfaf8f3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329fbfaf8f3SmrgAC_SUBST([am__nodep])dnl
330fbfaf8f3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331fbfaf8f3Smrg])
3326ef05171Smrg
333fbfaf8f3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3346ef05171Smrg
335d3173433Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336fbfaf8f3Smrg#
337fbfaf8f3Smrg# This file is free software; the Free Software Foundation
338fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
339fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
3406ef05171Smrg
341fbfaf8f3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342fbfaf8f3Smrg# ------------------------------
343fbfaf8f3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344fbfaf8f3Smrg[{
345fbfaf8f3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346fbfaf8f3Smrg  # are listed without --file.  Let's play safe and only enable the eval
347fbfaf8f3Smrg  # if we detect the quoting.
348fbfaf8f3Smrg  # TODO: see whether this extra hack can be removed once we start
349fbfaf8f3Smrg  # requiring Autoconf 2.70 or later.
350fbfaf8f3Smrg  AS_CASE([$CONFIG_FILES],
351fbfaf8f3Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352fbfaf8f3Smrg          [*], [set x $CONFIG_FILES])
353fbfaf8f3Smrg  shift
354fbfaf8f3Smrg  # Used to flag and report bootstrapping failures.
355fbfaf8f3Smrg  am_rc=0
356fbfaf8f3Smrg  for am_mf
357fbfaf8f3Smrg  do
358fbfaf8f3Smrg    # Strip MF so we end up with the name of the file.
359fbfaf8f3Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360fbfaf8f3Smrg    # Check whether this is an Automake generated Makefile which includes
361fbfaf8f3Smrg    # dependency-tracking related rules and includes.
362fbfaf8f3Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363fbfaf8f3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364fbfaf8f3Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365fbfaf8f3Smrg      || continue
366fbfaf8f3Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367fbfaf8f3Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368fbfaf8f3Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369fbfaf8f3Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370fbfaf8f3Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371fbfaf8f3Smrg  done
372fbfaf8f3Smrg  if test $am_rc -ne 0; then
373fbfaf8f3Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374fbfaf8f3Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375fbfaf8f3Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376fbfaf8f3Smrg    necessary).  You can also try re-running configure with the
377fbfaf8f3Smrg    '--disable-dependency-tracking' option to at least be able to build
378fbfaf8f3Smrg    the package (albeit without support for automatic dependency tracking).])
379fbfaf8f3Smrg  fi
380fbfaf8f3Smrg  AS_UNSET([am_dirpart])
381fbfaf8f3Smrg  AS_UNSET([am_filepart])
382fbfaf8f3Smrg  AS_UNSET([am_mf])
383fbfaf8f3Smrg  AS_UNSET([am_rc])
384fbfaf8f3Smrg  rm -f conftest-deps.mk
385fbfaf8f3Smrg}
386fbfaf8f3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38743f32c10Smrg
38843f32c10Smrg
389fbfaf8f3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390fbfaf8f3Smrg# -----------------------------
391fbfaf8f3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39243f32c10Smrg#
393fbfaf8f3Smrg# This code is only required when automatic dependency tracking is enabled.
394fbfaf8f3Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395fbfaf8f3Smrg# order to bootstrap the dependency handling code.
396fbfaf8f3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397fbfaf8f3Smrg[AC_CONFIG_COMMANDS([depfiles],
398fbfaf8f3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399fbfaf8f3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40043f32c10Smrg
401fbfaf8f3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40243f32c10Smrg
403d3173433Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
40443f32c10Smrg#
405fbfaf8f3Smrg# This file is free software; the Free Software Foundation
406fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
407fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
40843f32c10Smrg
409fbfaf8f3Smrg# This macro actually does too much.  Some checks are only needed if
410fbfaf8f3Smrg# your package does certain things.  But this isn't really a big deal.
41143f32c10Smrg
412fbfaf8f3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413fbfaf8f3Smrgm4_define([AC_PROG_CC],
414fbfaf8f3Smrgm4_defn([AC_PROG_CC])
415fbfaf8f3Smrg[_AM_PROG_CC_C_O
416fbfaf8f3Smrg])
417ea148d1dSmrg
418fbfaf8f3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419fbfaf8f3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420fbfaf8f3Smrg# -----------------------------------------------
421fbfaf8f3Smrg# The call with PACKAGE and VERSION arguments is the old style
422fbfaf8f3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423fbfaf8f3Smrg# and VERSION should now be passed to AC_INIT and removed from
424fbfaf8f3Smrg# the call to AM_INIT_AUTOMAKE.
425fbfaf8f3Smrg# We support both call styles for the transition.  After
426fbfaf8f3Smrg# the next Automake release, Autoconf can make the AC_INIT
427fbfaf8f3Smrg# arguments mandatory, and then we can depend on a new Autoconf
428fbfaf8f3Smrg# release and drop the old call support.
429fbfaf8f3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
430fbfaf8f3Smrg[AC_PREREQ([2.65])dnl
431fbfaf8f3Smrgm4_ifdef([_$0_ALREADY_INIT],
432fbfaf8f3Smrg  [m4_fatal([$0 expanded multiple times
433fbfaf8f3Smrg]m4_defn([_$0_ALREADY_INIT]))],
434fbfaf8f3Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435fbfaf8f3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436fbfaf8f3Smrgdnl the ones we care about.
437fbfaf8f3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438fbfaf8f3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439fbfaf8f3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440fbfaf8f3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441fbfaf8f3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442fbfaf8f3Smrg  # is not polluted with repeated "-I."
443fbfaf8f3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444fbfaf8f3Smrg  # test to see if srcdir already configured
445fbfaf8f3Smrg  if test -f $srcdir/config.status; then
446fbfaf8f3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447fbfaf8f3Smrg  fi
44843f32c10Smrgfi
44943f32c10Smrg
450fbfaf8f3Smrg# test whether we have cygpath
451fbfaf8f3Smrgif test -z "$CYGPATH_W"; then
452fbfaf8f3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453fbfaf8f3Smrg    CYGPATH_W='cygpath -w'
454fbfaf8f3Smrg  else
455fbfaf8f3Smrg    CYGPATH_W=echo
456fbfaf8f3Smrg  fi
45743f32c10Smrgfi
458fbfaf8f3SmrgAC_SUBST([CYGPATH_W])
45943f32c10Smrg
460fbfaf8f3Smrg# Define the identity of the package.
461fbfaf8f3Smrgdnl Distinguish between old-style and new-style calls.
462fbfaf8f3Smrgm4_ifval([$2],
463fbfaf8f3Smrg[AC_DIAGNOSE([obsolete],
464fbfaf8f3Smrg             [$0: two- and three-arguments forms are deprecated.])
465fbfaf8f3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466fbfaf8f3Smrg AC_SUBST([PACKAGE], [$1])dnl
467fbfaf8f3Smrg AC_SUBST([VERSION], [$2])],
468fbfaf8f3Smrg[_AM_SET_OPTIONS([$1])dnl
469fbfaf8f3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
470fbfaf8f3Smrgm4_if(
471fbfaf8f3Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
472fbfaf8f3Smrg  [ok:ok],,
473fbfaf8f3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474fbfaf8f3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475fbfaf8f3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47643f32c10Smrg
477fbfaf8f3Smrg_AM_IF_OPTION([no-define],,
478fbfaf8f3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
479fbfaf8f3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48043f32c10Smrg
481fbfaf8f3Smrg# Some tools Automake needs.
482fbfaf8f3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483fbfaf8f3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
484fbfaf8f3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
485fbfaf8f3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
486fbfaf8f3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
487fbfaf8f3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
488fbfaf8f3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489fbfaf8f3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490fbfaf8f3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
491fbfaf8f3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
492fbfaf8f3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
493fbfaf8f3Smrg# dies out for good.  For more background, see:
494fbfaf8f3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495fbfaf8f3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
496fbfaf8f3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497fbfaf8f3Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
498fbfaf8f3Smrg# system "awk" is bad on some platforms.
499fbfaf8f3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500fbfaf8f3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501fbfaf8f3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502fbfaf8f3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503fbfaf8f3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504fbfaf8f3Smrg			     [_AM_PROG_TAR([v7])])])
505fbfaf8f3Smrg_AM_IF_OPTION([no-dependencies],,
506fbfaf8f3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
507fbfaf8f3Smrg		  [_AM_DEPENDENCIES([CC])],
508fbfaf8f3Smrg		  [m4_define([AC_PROG_CC],
509fbfaf8f3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510fbfaf8f3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
511fbfaf8f3Smrg		  [_AM_DEPENDENCIES([CXX])],
512fbfaf8f3Smrg		  [m4_define([AC_PROG_CXX],
513fbfaf8f3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514fbfaf8f3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
515fbfaf8f3Smrg		  [_AM_DEPENDENCIES([OBJC])],
516fbfaf8f3Smrg		  [m4_define([AC_PROG_OBJC],
517fbfaf8f3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
518fbfaf8f3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
519fbfaf8f3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
520fbfaf8f3Smrg		  [m4_define([AC_PROG_OBJCXX],
521fbfaf8f3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522fbfaf8f3Smrg])
523fbfaf8f3Smrg# Variables for tags utilities; see am/tags.am
524fbfaf8f3Smrgif test -z "$CTAGS"; then
525fbfaf8f3Smrg  CTAGS=ctags
52643f32c10Smrgfi
527fbfaf8f3SmrgAC_SUBST([CTAGS])
528fbfaf8f3Smrgif test -z "$ETAGS"; then
529fbfaf8f3Smrg  ETAGS=etags
53043f32c10Smrgfi
531fbfaf8f3SmrgAC_SUBST([ETAGS])
532fbfaf8f3Smrgif test -z "$CSCOPE"; then
533fbfaf8f3Smrg  CSCOPE=cscope
53443f32c10Smrgfi
535fbfaf8f3SmrgAC_SUBST([CSCOPE])
53643f32c10Smrg
537d3173433SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
538fbfaf8f3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
539fbfaf8f3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
540fbfaf8f3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541fbfaf8f3SmrgAC_CONFIG_COMMANDS_PRE(dnl
542fbfaf8f3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543fbfaf8f3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54443f32c10Smrg
545d3173433SmrgAC_REQUIRE([_AM_PROG_RM_F])
546d3173433SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54743f32c10Smrg
548fbfaf8f3Smrgdnl The trailing newline in this macro's definition is deliberate, for
549fbfaf8f3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
550fbfaf8f3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551fbfaf8f3Smrg])
5526ef05171Smrg
553fbfaf8f3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
554fbfaf8f3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
555fbfaf8f3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
556fbfaf8f3Smrgm4_define([_AC_COMPILER_EXEEXT],
557fbfaf8f3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5586ef05171Smrg
559fbfaf8f3Smrg# When config.status generates a header, we must update the stamp-h file.
560fbfaf8f3Smrg# This file resides in the same directory as the config header
561fbfaf8f3Smrg# that is generated.  The stamp files are numbered to have different names.
56243f32c10Smrg
563fbfaf8f3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
564fbfaf8f3Smrg# loop where config.status creates the headers, so we can generate
565fbfaf8f3Smrg# our stamp files there.
566fbfaf8f3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
567fbfaf8f3Smrg[# Compute $1's index in $config_headers.
568fbfaf8f3Smrg_am_arg=$1
569fbfaf8f3Smrg_am_stamp_count=1
570fbfaf8f3Smrgfor _am_header in $config_headers :; do
571fbfaf8f3Smrg  case $_am_header in
572fbfaf8f3Smrg    $_am_arg | $_am_arg:* )
573fbfaf8f3Smrg      break ;;
574fbfaf8f3Smrg    * )
575fbfaf8f3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576fbfaf8f3Smrg  esac
577fbfaf8f3Smrgdone
578fbfaf8f3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
57943f32c10Smrg
580d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
581fbfaf8f3Smrg#
582fbfaf8f3Smrg# This file is free software; the Free Software Foundation
583fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
584fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
58543f32c10Smrg
586fbfaf8f3Smrg# AM_PROG_INSTALL_SH
587fbfaf8f3Smrg# ------------------
588fbfaf8f3Smrg# Define $install_sh.
589fbfaf8f3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
590fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
591fbfaf8f3Smrgif test x"${install_sh+set}" != xset; then
592fbfaf8f3Smrg  case $am_aux_dir in
593fbfaf8f3Smrg  *\ * | *\	*)
594fbfaf8f3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595fbfaf8f3Smrg  *)
596fbfaf8f3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597fbfaf8f3Smrg  esac
59843f32c10Smrgfi
599fbfaf8f3SmrgAC_SUBST([install_sh])])
60043f32c10Smrg
601d3173433Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
602fbfaf8f3Smrg#
603fbfaf8f3Smrg# This file is free software; the Free Software Foundation
604fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
605fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
60643f32c10Smrg
607fbfaf8f3Smrg# Check whether the underlying file-system supports filenames
608fbfaf8f3Smrg# with a leading dot.  For instance MS-DOS doesn't.
609fbfaf8f3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
610fbfaf8f3Smrg[rm -rf .tst 2>/dev/null
611fbfaf8f3Smrgmkdir .tst 2>/dev/null
612fbfaf8f3Smrgif test -d .tst; then
613fbfaf8f3Smrg  am__leading_dot=.
61443f32c10Smrgelse
615fbfaf8f3Smrg  am__leading_dot=_
61643f32c10Smrgfi
617fbfaf8f3Smrgrmdir .tst 2>/dev/null
618fbfaf8f3SmrgAC_SUBST([am__leading_dot])])
61943f32c10Smrg
620fbfaf8f3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
62143f32c10Smrg
622d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623fbfaf8f3Smrg#
624fbfaf8f3Smrg# This file is free software; the Free Software Foundation
625fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
626fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
62743f32c10Smrg
628fbfaf8f3Smrg# AM_MAKE_INCLUDE()
629fbfaf8f3Smrg# -----------------
630fbfaf8f3Smrg# Check whether make has an 'include' directive that can support all
631fbfaf8f3Smrg# the idioms we need for our automatic dependency tracking code.
632fbfaf8f3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
633fbfaf8f3Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634fbfaf8f3Smrgcat > confinc.mk << 'END'
635fbfaf8f3Smrgam__doit:
636fbfaf8f3Smrg	@echo this is the am__doit target >confinc.out
637fbfaf8f3Smrg.PHONY: am__doit
638fbfaf8f3SmrgEND
639fbfaf8f3Smrgam__include="#"
640fbfaf8f3Smrgam__quote=
641fbfaf8f3Smrg# BSD make does it like this.
642fbfaf8f3Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643fbfaf8f3Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644fbfaf8f3Smrgecho 'include confinc.mk # ignored' > confmf.GNU
645fbfaf8f3Smrg_am_result=no
646fbfaf8f3Smrgfor s in GNU BSD; do
647fbfaf8f3Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648fbfaf8f3Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649fbfaf8f3Smrg      ['0:this is the am__doit target'],
650fbfaf8f3Smrg      [AS_CASE([$s],
651fbfaf8f3Smrg          [BSD], [am__include='.include' am__quote='"'],
652fbfaf8f3Smrg          [am__include='include' am__quote=''])])
653fbfaf8f3Smrg  if test "$am__include" != "#"; then
654fbfaf8f3Smrg    _am_result="yes ($s style)"
655fbfaf8f3Smrg    break
656fbfaf8f3Smrg  fi
657fbfaf8f3Smrgdone
658fbfaf8f3Smrgrm -f confinc.* confmf.*
659fbfaf8f3SmrgAC_MSG_RESULT([${_am_result}])
660fbfaf8f3SmrgAC_SUBST([am__include])])
661fbfaf8f3SmrgAC_SUBST([am__quote])])
66243f32c10Smrg
663fbfaf8f3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
66443f32c10Smrg
665d3173433Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
66643f32c10Smrg#
667fbfaf8f3Smrg# This file is free software; the Free Software Foundation
668fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
669fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
67043f32c10Smrg
671fbfaf8f3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
672fbfaf8f3Smrg# ------------------------------
673fbfaf8f3SmrgAC_DEFUN([AM_MISSING_PROG],
674fbfaf8f3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
675fbfaf8f3Smrg$1=${$1-"${am_missing_run}$2"}
676fbfaf8f3SmrgAC_SUBST($1)])
67743f32c10Smrg
678fbfaf8f3Smrg# AM_MISSING_HAS_RUN
679fbfaf8f3Smrg# ------------------
680fbfaf8f3Smrg# Define MISSING if not defined so far and test if it is modern enough.
681fbfaf8f3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
682fbfaf8f3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
683fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
684fbfaf8f3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
685fbfaf8f3Smrgif test x"${MISSING+set}" != xset; then
686fbfaf8f3Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
68743f32c10Smrgfi
688fbfaf8f3Smrg# Use eval to expand $SHELL
689fbfaf8f3Smrgif eval "$MISSING --is-lightweight"; then
690fbfaf8f3Smrg  am_missing_run="$MISSING "
691fbfaf8f3Smrgelse
692fbfaf8f3Smrg  am_missing_run=
693fbfaf8f3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
69443f32c10Smrgfi
695fbfaf8f3Smrg])
69643f32c10Smrg
697fbfaf8f3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
69843f32c10Smrg
699d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700fbfaf8f3Smrg#
701fbfaf8f3Smrg# This file is free software; the Free Software Foundation
702fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
703fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
70443f32c10Smrg
705fbfaf8f3Smrg# _AM_MANGLE_OPTION(NAME)
706fbfaf8f3Smrg# -----------------------
707fbfaf8f3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
708fbfaf8f3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
70943f32c10Smrg
710fbfaf8f3Smrg# _AM_SET_OPTION(NAME)
711fbfaf8f3Smrg# --------------------
712fbfaf8f3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
713fbfaf8f3SmrgAC_DEFUN([_AM_SET_OPTION],
714fbfaf8f3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7156ef05171Smrg
716fbfaf8f3Smrg# _AM_SET_OPTIONS(OPTIONS)
717fbfaf8f3Smrg# ------------------------
718fbfaf8f3Smrg# OPTIONS is a space-separated list of Automake options.
719fbfaf8f3SmrgAC_DEFUN([_AM_SET_OPTIONS],
720fbfaf8f3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7216ef05171Smrg
722fbfaf8f3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
723fbfaf8f3Smrg# -------------------------------------------
724fbfaf8f3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
725fbfaf8f3SmrgAC_DEFUN([_AM_IF_OPTION],
726fbfaf8f3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7276ef05171Smrg
728d3173433Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
729ea148d1dSmrg#
730fbfaf8f3Smrg# This file is free software; the Free Software Foundation
731fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
732fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
7336ef05171Smrg
734fbfaf8f3Smrg# _AM_PROG_CC_C_O
735fbfaf8f3Smrg# ---------------
736fbfaf8f3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
737fbfaf8f3Smrg# to automatically call this.
738fbfaf8f3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
739fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
740fbfaf8f3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
741fbfaf8f3SmrgAC_LANG_PUSH([C])dnl
742fbfaf8f3SmrgAC_CACHE_CHECK(
743fbfaf8f3Smrg  [whether $CC understands -c and -o together],
744fbfaf8f3Smrg  [am_cv_prog_cc_c_o],
745fbfaf8f3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
746fbfaf8f3Smrg  # Make sure it works both with $CC and with simple cc.
747fbfaf8f3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
748fbfaf8f3Smrg  # compilers refuse to overwrite an existing .o file with -o,
749fbfaf8f3Smrg  # though they will create one.
750fbfaf8f3Smrg  am_cv_prog_cc_c_o=yes
751fbfaf8f3Smrg  for am_i in 1 2; do
752fbfaf8f3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
753fbfaf8f3Smrg         && test -f conftest2.$ac_objext; then
754fbfaf8f3Smrg      : OK
755fbfaf8f3Smrg    else
756fbfaf8f3Smrg      am_cv_prog_cc_c_o=no
757fbfaf8f3Smrg      break
758fbfaf8f3Smrg    fi
759fbfaf8f3Smrg  done
760fbfaf8f3Smrg  rm -f core conftest*
761fbfaf8f3Smrg  unset am_i])
762fbfaf8f3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
763fbfaf8f3Smrg   # Losing compiler, so override with the script.
764fbfaf8f3Smrg   # FIXME: It is wrong to rewrite CC.
765fbfaf8f3Smrg   # But if we don't then we get into trouble of one sort or another.
766fbfaf8f3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
767fbfaf8f3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
768fbfaf8f3Smrg   CC="$am_aux_dir/compile $CC"
7696ef05171Smrgfi
770fbfaf8f3SmrgAC_LANG_POP([C])])
7716ef05171Smrg
772fbfaf8f3Smrg# For backward compatibility.
773fbfaf8f3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7746ef05171Smrg
775d3173433Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776d3173433Smrg#
777d3173433Smrg# This file is free software; the Free Software Foundation
778d3173433Smrg# gives unlimited permission to copy and/or distribute it,
779d3173433Smrg# with or without modifications, as long as this notice is preserved.
780d3173433Smrg
781d3173433Smrg# _AM_PROG_RM_F
782d3173433Smrg# ---------------
783d3173433Smrg# Check whether 'rm -f' without any arguments works.
784d3173433Smrg# https://bugs.gnu.org/10828
785d3173433SmrgAC_DEFUN([_AM_PROG_RM_F],
786d3173433Smrg[am__rm_f_notfound=
787d3173433SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788d3173433SmrgAC_SUBST(am__rm_f_notfound)
789d3173433Smrg])
790d3173433Smrg
791d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7926ef05171Smrg#
793fbfaf8f3Smrg# This file is free software; the Free Software Foundation
794fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
795fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
7966ef05171Smrg
797fbfaf8f3Smrg# AM_RUN_LOG(COMMAND)
798fbfaf8f3Smrg# -------------------
799fbfaf8f3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
800fbfaf8f3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
801fbfaf8f3SmrgAC_DEFUN([AM_RUN_LOG],
802fbfaf8f3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
803fbfaf8f3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804fbfaf8f3Smrg   ac_status=$?
805fbfaf8f3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
806fbfaf8f3Smrg   (exit $ac_status); }])
8076ef05171Smrg
808fbfaf8f3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8096ef05171Smrg
810d3173433Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8116ef05171Smrg#
812fbfaf8f3Smrg# This file is free software; the Free Software Foundation
813fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
814fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
8156ef05171Smrg
816d3173433Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
817d3173433Smrg# ----------------------------
818d3173433SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819d3173433SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820d3173433Smrg               am_cv_sleep_fractional_seconds, [dnl
821d3173433SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822d3173433Smrg                                 [am_cv_sleep_fractional_seconds=no])
823d3173433Smrg])])
824d3173433Smrg
825d3173433Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826d3173433Smrg# -----------------------------------
827d3173433Smrg# Determine the filesystem's resolution for file modification
828d3173433Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
829d3173433Smrg# of only two seconds, even with the most recent "exFAT" extensions.
830d3173433Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831d3173433Smrg# nanosecond, matching clock_gettime.  However, it is probably not
832d3173433Smrg# possible to delay execution of a shell script for less than one
833d3173433Smrg# millisecond, due to process creation overhead and scheduling
834d3173433Smrg# granularity, so we don't check for anything finer than that. (See below.)
835d3173433SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836d3173433SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837d3173433SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838d3173433Smrg               am_cv_filesystem_timestamp_resolution, [dnl
839d3173433Smrg# Default to the worst case.
840d3173433Smrgam_cv_filesystem_timestamp_resolution=2
841d3173433Smrg
842d3173433Smrg# Only try to go finer than 1 sec if sleep can do it.
843d3173433Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844d3173433Smrg# - 1 sec is not much of a win compared to 2 sec, and
845d3173433Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
846d3173433Smrg# 
847d3173433Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
848d3173433Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849d3173433Smrg# exchange for not incurring the 2s delay for running the test for all
850d3173433Smrg# packages.
851d3173433Smrg#
852d3173433Smrgam_try_resolutions=
853d3173433Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854d3173433Smrg  # Even a millisecond often causes a bunch of false positives,
855d3173433Smrg  # so just try a hundredth of a second. The time saved between .001 and
856d3173433Smrg  # .01 is not terribly consequential.
857d3173433Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858d3173433Smrgfi
859d3173433Smrg
860d3173433Smrg# In order to catch current-generation FAT out, we must *modify* files
861d3173433Smrg# that already exist; the *creation* timestamp is finer.  Use names
862d3173433Smrg# that make ls -t sort them differently when they have equal
863d3173433Smrg# timestamps than when they have distinct timestamps, keeping
864d3173433Smrg# in mind that ls -t prints the *newest* file first.
865d3173433Smrgrm -f conftest.ts?
866d3173433Smrg: > conftest.ts1
867d3173433Smrg: > conftest.ts2
868d3173433Smrg: > conftest.ts3
869d3173433Smrg
870d3173433Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871d3173433Smrg# clobber the current shell's arguments. (Outer-level square brackets
872d3173433Smrg# are removed by m4; they're present so that m4 does not expand
873d3173433Smrg# <dollar><star>; be careful, easy to get confused.)
874d3173433Smrgif (
875d3173433Smrg     set X `[ls -t conftest.ts[12]]` &&
876d3173433Smrg     {
877d3173433Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878d3173433Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879d3173433Smrg     }
880d3173433Smrg); then :; else
881d3173433Smrg  # If neither matched, then we have a broken ls.  This can happen
882d3173433Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883d3173433Smrg  # broken ls alias from the environment.  This has actually
884d3173433Smrg  # happened.  Such a system could not be considered "sane".
885d3173433Smrg  _AS_ECHO_UNQUOTED(
886d3173433Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887d3173433Smrg    [AS_MESSAGE_LOG_FD])
888d3173433Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889d3173433SmrgMake sure there is not a broken ls alias in your environment.])
890d3173433Smrgfi
891d3173433Smrg
892d3173433Smrgfor am_try_res in $am_try_resolutions; do
893d3173433Smrg  # Any one fine-grained sleep might happen to cross the boundary
894d3173433Smrg  # between two values of a coarser actual resolution, but if we do
895d3173433Smrg  # two fine-grained sleeps in a row, at least one of them will fall
896d3173433Smrg  # entirely within a coarse interval.
897d3173433Smrg  echo alpha > conftest.ts1
898d3173433Smrg  sleep $am_try_res
899d3173433Smrg  echo beta > conftest.ts2
900d3173433Smrg  sleep $am_try_res
901d3173433Smrg  echo gamma > conftest.ts3
902d3173433Smrg
903d3173433Smrg  # We assume that 'ls -t' will make use of high-resolution
904d3173433Smrg  # timestamps if the operating system supports them at all.
905d3173433Smrg  if (set X `ls -t conftest.ts?` &&
906d3173433Smrg      test "$[]2" = conftest.ts3 &&
907d3173433Smrg      test "$[]3" = conftest.ts2 &&
908d3173433Smrg      test "$[]4" = conftest.ts1); then
909d3173433Smrg    #
910d3173433Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911d3173433Smrg    # because we don't need to test make.
912d3173433Smrg    make_ok=true
913d3173433Smrg    if test $am_try_res != 1; then
914d3173433Smrg      # But if we've succeeded so far with a subsecond resolution, we
915d3173433Smrg      # have one more thing to check: make. It can happen that
916d3173433Smrg      # everything else supports the subsecond mtimes, but make doesn't;
917d3173433Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918d3173433Smrg      # released under GPLv2). https://bugs.gnu.org/68808
919d3173433Smrg      # 
920d3173433Smrg      # We test $MAKE if it is defined in the environment, else "make".
921d3173433Smrg      # It might get overridden later, but our hope is that in practice
922d3173433Smrg      # it does not matter: it is the system "make" which is (by far)
923d3173433Smrg      # the most likely to be broken, whereas if the user overrides it,
924d3173433Smrg      # probably they did so with a better, or at least not worse, make.
925d3173433Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926d3173433Smrg      #
927d3173433Smrg      # Create a Makefile (real tab character here):
928d3173433Smrg      rm -f conftest.mk
929d3173433Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930d3173433Smrg      echo '	touch conftest.ts2' >>conftest.mk
931d3173433Smrg      #
932d3173433Smrg      # Now, running
933d3173433Smrg      #   touch conftest.ts1; touch conftest.ts2; make
934d3173433Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935d3173433Smrg      # but most often, it will fail if make's support is insufficient. So
936d3173433Smrg      # test for several consecutive successes.
937d3173433Smrg      #
938d3173433Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
939d3173433Smrg      # files, not create new ones, per above.)
940d3173433Smrg      n=0
941d3173433Smrg      make=${MAKE-make}
942d3173433Smrg      until test $n -eq 3; do
943d3173433Smrg        echo one > conftest.ts1
944d3173433Smrg        sleep $am_try_res
945d3173433Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946d3173433Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947d3173433Smrg          make_ok=false
948d3173433Smrg          break # out of $n loop
949d3173433Smrg        fi
950d3173433Smrg        n=`expr $n + 1`
951d3173433Smrg      done
952d3173433Smrg    fi
953d3173433Smrg    #
954d3173433Smrg    if $make_ok; then
955d3173433Smrg      # Everything we know to check worked out, so call this resolution good.
956d3173433Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957d3173433Smrg      break # out of $am_try_res loop
958d3173433Smrg    fi
959d3173433Smrg    # Otherwise, we'll go on to check the next resolution.
960d3173433Smrg  fi
961d3173433Smrgdone
962d3173433Smrgrm -f conftest.ts?
963d3173433Smrg# (end _am_filesystem_timestamp_resolution)
964d3173433Smrg])])
965d3173433Smrg
966fbfaf8f3Smrg# AM_SANITY_CHECK
967fbfaf8f3Smrg# ---------------
968fbfaf8f3SmrgAC_DEFUN([AM_SANITY_CHECK],
969d3173433Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970d3173433Smrg# This check should not be cached, as it may vary across builds of
971d3173433Smrg# different projects.
972d3173433SmrgAC_MSG_CHECKING([whether build environment is sane])
973fbfaf8f3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
974fbfaf8f3Smrg# name.  Accept space and tab only in the latter.
975fbfaf8f3Smrgam_lf='
976fbfaf8f3Smrg'
977fbfaf8f3Smrgcase `pwd` in
978fbfaf8f3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
979fbfaf8f3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
980fbfaf8f3Smrgesac
981fbfaf8f3Smrgcase $srcdir in
982fbfaf8f3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
983fbfaf8f3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
984fbfaf8f3Smrgesac
9856ef05171Smrg
986fbfaf8f3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
987fbfaf8f3Smrg# arguments.  Must try -L first in case configure is actually a
988fbfaf8f3Smrg# symlink; some systems play weird games with the mod time of symlinks
989fbfaf8f3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
990fbfaf8f3Smrg# directory).
991d3173433Smrgam_build_env_is_sane=no
992d3173433Smrgam_has_slept=no
993d3173433Smrgrm -f conftest.file
994d3173433Smrgfor am_try in 1 2; do
995d3173433Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996d3173433Smrg  if (
997d3173433Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998d3173433Smrg    if test "$[]*" = "X"; then
999d3173433Smrg      # -L didn't work.
1000d3173433Smrg      set X `ls -t "$srcdir/configure" conftest.file`
1001d3173433Smrg    fi
1002d3173433Smrg    test "$[]2" = conftest.file
1003d3173433Smrg  ); then
1004d3173433Smrg    am_build_env_is_sane=yes
1005d3173433Smrg    break
1006d3173433Smrg  fi
1007d3173433Smrg  # Just in case.
1008d3173433Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009d3173433Smrg  am_has_slept=yes
1010d3173433Smrgdone
1011d3173433Smrg
1012d3173433SmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013d3173433Smrgif test "$am_build_env_is_sane" = no; then
1014d3173433Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
1015fbfaf8f3SmrgCheck your system clock])
10166ef05171Smrgfi
1017d3173433Smrg
1018fbfaf8f3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
1019fbfaf8f3Smrg# generated files are strictly newer.
1020fbfaf8f3Smrgam_sleep_pid=
1021d3173433SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022d3173433Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
1023fbfaf8f3Smrg  am_sleep_pid=$!
1024d3173433Smrg])
1025fbfaf8f3SmrgAC_CONFIG_COMMANDS_PRE(
1026fbfaf8f3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
1027fbfaf8f3Smrg   if test -n "$am_sleep_pid"; then
1028fbfaf8f3Smrg     # Hide warnings about reused PIDs.
1029fbfaf8f3Smrg     wait $am_sleep_pid 2>/dev/null
1030fbfaf8f3Smrg   fi
1031fbfaf8f3Smrg   AC_MSG_RESULT([done])])
1032fbfaf8f3Smrgrm -f conftest.file
1033fbfaf8f3Smrg])
10346ef05171Smrg
1035d3173433Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10366ef05171Smrg#
1037fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1038fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1039fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
10406ef05171Smrg
1041d3173433Smrg# _AM_SILENT_RULES
1042d3173433Smrg# ----------------
1043d3173433Smrg# Enable less verbose build rules support.
1044d3173433SmrgAC_DEFUN([_AM_SILENT_RULES],
1045d3173433Smrg[AM_DEFAULT_VERBOSITY=1
1046d3173433SmrgAC_ARG_ENABLE([silent-rules], [dnl
1047fbfaf8f3SmrgAS_HELP_STRING(
1048fbfaf8f3Smrg  [--enable-silent-rules],
1049fbfaf8f3Smrg  [less verbose build output (undo: "make V=1")])
1050fbfaf8f3SmrgAS_HELP_STRING(
1051fbfaf8f3Smrg  [--disable-silent-rules],
1052fbfaf8f3Smrg  [verbose build output (undo: "make V=0")])dnl
1053fbfaf8f3Smrg])
1054fbfaf8f3Smrgdnl
1055fbfaf8f3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1056fbfaf8f3Smrgdnl do not support nested variable expansions.
1057fbfaf8f3Smrgdnl See automake bug#9928 and bug#10237.
1058fbfaf8f3Smrgam_make=${MAKE-make}
1059fbfaf8f3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
1060fbfaf8f3Smrg   [am_cv_make_support_nested_variables],
1061fbfaf8f3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
1062fbfaf8f3SmrgBAR0=false
1063fbfaf8f3SmrgBAR1=true
1064fbfaf8f3SmrgV=1
1065fbfaf8f3Smrgam__doit:
1066fbfaf8f3Smrg	@$(TRUE)
1067fbfaf8f3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1068fbfaf8f3Smrg  am_cv_make_support_nested_variables=yes
10696ef05171Smrgelse
1070fbfaf8f3Smrg  am_cv_make_support_nested_variables=no
1071fbfaf8f3Smrgfi])
1072fbfaf8f3SmrgAC_SUBST([AM_V])dnl
1073fbfaf8f3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
1074fbfaf8f3SmrgAC_SUBST([AM_DEFAULT_V])dnl
1075fbfaf8f3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1076fbfaf8f3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1077fbfaf8f3SmrgAM_BACKSLASH='\'
1078fbfaf8f3SmrgAC_SUBST([AM_BACKSLASH])dnl
1079fbfaf8f3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080d3173433Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081d3173433Smrgdnl to AM_SILENT_RULES to change the default value.
1082d3173433SmrgAC_CONFIG_COMMANDS_PRE([dnl
1083d3173433Smrgcase $enable_silent_rules in @%:@ (((
1084d3173433Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085d3173433Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086d3173433Smrgesac
1087d3173433Smrgif test $am_cv_make_support_nested_variables = yes; then
1088d3173433Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089d3173433Smrg  AM_V='$(V)'
1090d3173433Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091d3173433Smrgelse
1092d3173433Smrg  AM_V=$AM_DEFAULT_VERBOSITY
1093d3173433Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094d3173433Smrgfi
1095d3173433Smrg])dnl
1096fbfaf8f3Smrg])
10976ef05171Smrg
1098d3173433Smrg# AM_SILENT_RULES([DEFAULT])
1099d3173433Smrg# --------------------------
1100d3173433Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101d3173433Smrg# empty being verbose).
1102d3173433SmrgAC_DEFUN([AM_SILENT_RULES],
1103d3173433Smrg[AC_REQUIRE([_AM_SILENT_RULES])
1104d3173433SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105d3173433Smrg
1106d3173433Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11076ef05171Smrg#
1108fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1109fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1110fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
11116ef05171Smrg
1112fbfaf8f3Smrg# AM_PROG_INSTALL_STRIP
1113fbfaf8f3Smrg# ---------------------
1114fbfaf8f3Smrg# One issue with vendor 'install' (even GNU) is that you can't
1115fbfaf8f3Smrg# specify the program used to strip binaries.  This is especially
1116fbfaf8f3Smrg# annoying in cross-compiling environments, where the build's strip
1117fbfaf8f3Smrg# is unlikely to handle the host's binaries.
1118fbfaf8f3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
1119fbfaf8f3Smrg# always use install-sh in "make install-strip", and initialize
1120fbfaf8f3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
1121fbfaf8f3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
1122fbfaf8f3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1123fbfaf8f3Smrg# Installed binaries are usually stripped using 'strip' when the user
1124fbfaf8f3Smrg# run "make install-strip".  However 'strip' might not be the right
1125fbfaf8f3Smrg# tool to use in cross-compilation environments, therefore Automake
1126fbfaf8f3Smrg# will honor the 'STRIP' environment variable to overrule this program.
1127fbfaf8f3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1128fbfaf8f3Smrgif test "$cross_compiling" != no; then
1129fbfaf8f3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
11306ef05171Smrgfi
1131fbfaf8f3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1132fbfaf8f3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11336ef05171Smrg
1134d3173433Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135fbfaf8f3Smrg#
1136fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1137fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1138fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
11396ef05171Smrg
1140fbfaf8f3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
11416ef05171Smrg# ---------------------------
1142fbfaf8f3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1143fbfaf8f3Smrg# This macro is traced by Automake.
1144fbfaf8f3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11456ef05171Smrg
1146fbfaf8f3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1147fbfaf8f3Smrg# --------------------------
1148fbfaf8f3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1149fbfaf8f3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11506ef05171Smrg
1151fbfaf8f3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152fbfaf8f3Smrg
1153d3173433Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11546ef05171Smrg#
1155fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1156fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1157fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
1158fbfaf8f3Smrg
1159fbfaf8f3Smrg# _AM_PROG_TAR(FORMAT)
1160fbfaf8f3Smrg# --------------------
1161fbfaf8f3Smrg# Check how to create a tarball in format FORMAT.
1162fbfaf8f3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11636ef05171Smrg#
1164fbfaf8f3Smrg# Substitute a variable $(am__tar) that is a command
1165fbfaf8f3Smrg# writing to stdout a FORMAT-tarball containing the directory
1166fbfaf8f3Smrg# $tardir.
1167fbfaf8f3Smrg#     tardir=directory && $(am__tar) > result.tar
11686ef05171Smrg#
1169fbfaf8f3Smrg# Substitute a variable $(am__untar) that extract such
1170fbfaf8f3Smrg# a tarball read from stdin.
1171fbfaf8f3Smrg#     $(am__untar) < result.tar
11726ef05171Smrg#
1173fbfaf8f3SmrgAC_DEFUN([_AM_PROG_TAR],
1174fbfaf8f3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1175fbfaf8f3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1176fbfaf8f3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11776ef05171Smrg
1178fbfaf8f3Smrg# We'll loop over all known methods to create a tar archive until one works.
1179fbfaf8f3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11806ef05171Smrg
1181fbfaf8f3Smrgm4_if([$1], [v7],
1182fbfaf8f3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11836ef05171Smrg
1184fbfaf8f3Smrg  [m4_case([$1],
1185fbfaf8f3Smrg    [ustar],
1186fbfaf8f3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1187fbfaf8f3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1188fbfaf8f3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1189fbfaf8f3Smrg      # and bug#13588).
1190fbfaf8f3Smrg      am_max_uid=2097151 # 2^21 - 1
1191fbfaf8f3Smrg      am_max_gid=$am_max_uid
1192fbfaf8f3Smrg      # The $UID and $GID variables are not portable, so we need to resort
1193fbfaf8f3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1194fbfaf8f3Smrg      # below are definitely unexpected, so allow the users to see them
1195fbfaf8f3Smrg      # (that is, avoid stderr redirection).
1196fbfaf8f3Smrg      am_uid=`id -u || echo unknown`
1197fbfaf8f3Smrg      am_gid=`id -g || echo unknown`
1198fbfaf8f3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199d3173433Smrg      if test x$am_uid = xunknown; then
1200d3173433Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201d3173433Smrg      elif test $am_uid -le $am_max_uid; then
1202d3173433Smrg        AC_MSG_RESULT([yes])
1203fbfaf8f3Smrg      else
1204d3173433Smrg        AC_MSG_RESULT([no])
1205d3173433Smrg        _am_tools=none
1206fbfaf8f3Smrg      fi
1207fbfaf8f3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208d3173433Smrg      if test x$gm_gid = xunknown; then
1209d3173433Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210d3173433Smrg      elif test $am_gid -le $am_max_gid; then
1211d3173433Smrg        AC_MSG_RESULT([yes])
1212fbfaf8f3Smrg      else
1213fbfaf8f3Smrg        AC_MSG_RESULT([no])
1214fbfaf8f3Smrg        _am_tools=none
1215fbfaf8f3Smrg      fi],
12166ef05171Smrg
1217fbfaf8f3Smrg  [pax],
1218fbfaf8f3Smrg    [],
12196ef05171Smrg
1220fbfaf8f3Smrg  [m4_fatal([Unknown tar format])])
12216ef05171Smrg
1222fbfaf8f3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
12236ef05171Smrg
1224fbfaf8f3Smrg  # Go ahead even if we have the value already cached.  We do so because we
1225fbfaf8f3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1226fbfaf8f3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12276ef05171Smrg
1228fbfaf8f3Smrg  for _am_tool in $_am_tools; do
1229fbfaf8f3Smrg    case $_am_tool in
1230fbfaf8f3Smrg    gnutar)
1231fbfaf8f3Smrg      for _am_tar in tar gnutar gtar; do
1232fbfaf8f3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1233fbfaf8f3Smrg      done
1234fbfaf8f3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1235fbfaf8f3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1236fbfaf8f3Smrg      am__untar="$_am_tar -xf -"
1237fbfaf8f3Smrg      ;;
1238fbfaf8f3Smrg    plaintar)
1239fbfaf8f3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1240fbfaf8f3Smrg      # ustar tarball either.
1241fbfaf8f3Smrg      (tar --version) >/dev/null 2>&1 && continue
1242fbfaf8f3Smrg      am__tar='tar chf - "$$tardir"'
1243fbfaf8f3Smrg      am__tar_='tar chf - "$tardir"'
1244fbfaf8f3Smrg      am__untar='tar xf -'
1245fbfaf8f3Smrg      ;;
1246fbfaf8f3Smrg    pax)
1247fbfaf8f3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1248fbfaf8f3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1249fbfaf8f3Smrg      am__untar='pax -r'
1250fbfaf8f3Smrg      ;;
1251fbfaf8f3Smrg    cpio)
1252fbfaf8f3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1253fbfaf8f3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1254fbfaf8f3Smrg      am__untar='cpio -i -H $1 -d'
1255fbfaf8f3Smrg      ;;
1256fbfaf8f3Smrg    none)
1257fbfaf8f3Smrg      am__tar=false
1258fbfaf8f3Smrg      am__tar_=false
1259fbfaf8f3Smrg      am__untar=false
1260fbfaf8f3Smrg      ;;
1261fbfaf8f3Smrg    esac
1262fbfaf8f3Smrg
1263fbfaf8f3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1264fbfaf8f3Smrg    # and am__untar set.
1265fbfaf8f3Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266fbfaf8f3Smrg
1267fbfaf8f3Smrg    # tar/untar a dummy directory, and stop if the command works.
1268fbfaf8f3Smrg    rm -rf conftest.dir
1269fbfaf8f3Smrg    mkdir conftest.dir
1270fbfaf8f3Smrg    echo GrepMe > conftest.dir/file
1271fbfaf8f3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1272fbfaf8f3Smrg    rm -rf conftest.dir
1273fbfaf8f3Smrg    if test -s conftest.tar; then
1274fbfaf8f3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1275fbfaf8f3Smrg      AM_RUN_LOG([cat conftest.dir/file])
1276fbfaf8f3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1277fbfaf8f3Smrg    fi
1278fbfaf8f3Smrg  done
1279fbfaf8f3Smrg  rm -rf conftest.dir
1280fbfaf8f3Smrg
1281fbfaf8f3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1282fbfaf8f3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283fbfaf8f3Smrg
1284fbfaf8f3SmrgAC_SUBST([am__tar])
1285fbfaf8f3SmrgAC_SUBST([am__untar])
1286fbfaf8f3Smrg]) # _AM_PROG_TAR
1287fbfaf8f3Smrg
1288d3173433Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289d3173433Smrg#
1290d3173433Smrg# This file is free software; the Free Software Foundation
1291d3173433Smrg# gives unlimited permission to copy and/or distribute it,
1292d3173433Smrg# with or without modifications, as long as this notice is preserved.
1293d3173433Smrg
1294d3173433Smrg# _AM_PROG_XARGS_N
1295d3173433Smrg# ----------------
1296d3173433Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297d3173433Smrg# is not optimized at all as we never expect to use it.
1298d3173433SmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299d3173433Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300d3173433SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301d3173433Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302d3173433SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303d3173433Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304d3173433Smrg])dnl
1305d3173433SmrgAC_SUBST(am__xargs_n)
1306d3173433Smrg])
1307d3173433Smrg
1308fbfaf8f3Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309fbfaf8f3Smrgdnl serial 11 (pkg-config-0.29)
1310fbfaf8f3Smrgdnl
1311fbfaf8f3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312fbfaf8f3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313fbfaf8f3Smrgdnl
1314fbfaf8f3Smrgdnl This program is free software; you can redistribute it and/or modify
1315fbfaf8f3Smrgdnl it under the terms of the GNU General Public License as published by
1316fbfaf8f3Smrgdnl the Free Software Foundation; either version 2 of the License, or
1317fbfaf8f3Smrgdnl (at your option) any later version.
1318fbfaf8f3Smrgdnl
1319fbfaf8f3Smrgdnl This program is distributed in the hope that it will be useful, but
1320fbfaf8f3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321fbfaf8f3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322fbfaf8f3Smrgdnl General Public License for more details.
1323fbfaf8f3Smrgdnl
1324fbfaf8f3Smrgdnl You should have received a copy of the GNU General Public License
1325fbfaf8f3Smrgdnl along with this program; if not, write to the Free Software
1326fbfaf8f3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327fbfaf8f3Smrgdnl 02111-1307, USA.
1328fbfaf8f3Smrgdnl
1329fbfaf8f3Smrgdnl As a special exception to the GNU General Public License, if you
1330fbfaf8f3Smrgdnl distribute this file as part of a program that contains a
1331fbfaf8f3Smrgdnl configuration script generated by Autoconf, you may include it under
1332fbfaf8f3Smrgdnl the same distribution terms that you use for the rest of that
1333fbfaf8f3Smrgdnl program.
13346ef05171Smrg
1335fbfaf8f3Smrgdnl PKG_PREREQ(MIN-VERSION)
1336fbfaf8f3Smrgdnl -----------------------
1337fbfaf8f3Smrgdnl Since: 0.29
1338fbfaf8f3Smrgdnl
1339fbfaf8f3Smrgdnl Verify that the version of the pkg-config macros are at least
1340fbfaf8f3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341fbfaf8f3Smrgdnl installed version of pkg-config, this checks the developer's version
1342fbfaf8f3Smrgdnl of pkg.m4 when generating configure.
1343fbfaf8f3Smrgdnl
1344fbfaf8f3Smrgdnl To ensure that this macro is defined, also add:
1345fbfaf8f3Smrgdnl m4_ifndef([PKG_PREREQ],
1346fbfaf8f3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347fbfaf8f3Smrgdnl
1348fbfaf8f3Smrgdnl See the "Since" comment for each macro you use to see what version
1349fbfaf8f3Smrgdnl of the macros you require.
1350fbfaf8f3Smrgm4_defun([PKG_PREREQ],
1351fbfaf8f3Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352fbfaf8f3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353fbfaf8f3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354fbfaf8f3Smrg])dnl PKG_PREREQ
13556ef05171Smrg
1356fbfaf8f3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357fbfaf8f3Smrgdnl ----------------------------------
1358fbfaf8f3Smrgdnl Since: 0.16
1359fbfaf8f3Smrgdnl
1360fbfaf8f3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361fbfaf8f3Smrgdnl first found in the path. Checks that the version of pkg-config found
1362fbfaf8f3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363fbfaf8f3Smrgdnl used since that's the first version where most current features of
1364fbfaf8f3Smrgdnl pkg-config existed.
1365fbfaf8f3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1366fbfaf8f3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367fbfaf8f3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368fbfaf8f3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
13726ef05171Smrg
1373fbfaf8f3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1374fbfaf8f3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
13756ef05171Smrgfi
1376fbfaf8f3Smrgif test -n "$PKG_CONFIG"; then
1377fbfaf8f3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1378fbfaf8f3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1379fbfaf8f3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1380fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1381fbfaf8f3Smrg	else
1382fbfaf8f3Smrg		AC_MSG_RESULT([no])
1383fbfaf8f3Smrg		PKG_CONFIG=""
1384fbfaf8f3Smrg	fi
1385fbfaf8f3Smrgfi[]dnl
1386fbfaf8f3Smrg])dnl PKG_PROG_PKG_CONFIG
13876ef05171Smrg
1388fbfaf8f3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389fbfaf8f3Smrgdnl -------------------------------------------------------------------
1390fbfaf8f3Smrgdnl Since: 0.18
1391fbfaf8f3Smrgdnl
1392fbfaf8f3Smrgdnl Check to see whether a particular set of modules exists. Similar to
1393fbfaf8f3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394fbfaf8f3Smrgdnl
1395fbfaf8f3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396fbfaf8f3Smrgdnl only at the first occurence in configure.ac, so if the first place
1397fbfaf8f3Smrgdnl it's called might be skipped (such as if it is within an "if", you
1398fbfaf8f3Smrgdnl have to call PKG_CHECK_EXISTS manually
1399fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1400fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1401fbfaf8f3Smrgif test -n "$PKG_CONFIG" && \
1402fbfaf8f3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403fbfaf8f3Smrg  m4_default([$2], [:])
1404fbfaf8f3Smrgm4_ifvaln([$3], [else
1405fbfaf8f3Smrg  $3])dnl
1406fbfaf8f3Smrgfi])
14076ef05171Smrg
1408fbfaf8f3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409fbfaf8f3Smrgdnl ---------------------------------------------
1410fbfaf8f3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411fbfaf8f3Smrgdnl pkg_failed based on the result.
1412fbfaf8f3Smrgm4_define([_PKG_CONFIG],
1413fbfaf8f3Smrg[if test -n "$$1"; then
1414fbfaf8f3Smrg    pkg_cv_[]$1="$$1"
1415fbfaf8f3Smrg elif test -n "$PKG_CONFIG"; then
1416fbfaf8f3Smrg    PKG_CHECK_EXISTS([$3],
1417fbfaf8f3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418fbfaf8f3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1419fbfaf8f3Smrg		     [pkg_failed=yes])
1420fbfaf8f3Smrg else
1421fbfaf8f3Smrg    pkg_failed=untried
1422fbfaf8f3Smrgfi[]dnl
1423fbfaf8f3Smrg])dnl _PKG_CONFIG
14246ef05171Smrg
1425fbfaf8f3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426fbfaf8f3Smrgdnl ---------------------------
1427fbfaf8f3Smrgdnl Internal check to see if pkg-config supports short errors.
1428fbfaf8f3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1429fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1430fbfaf8f3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1431fbfaf8f3Smrg        _pkg_short_errors_supported=yes
14326ef05171Smrgelse
1433fbfaf8f3Smrg        _pkg_short_errors_supported=no
1434fbfaf8f3Smrgfi[]dnl
1435fbfaf8f3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
14366ef05171Smrg
14376ef05171Smrg
1438fbfaf8f3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439fbfaf8f3Smrgdnl   [ACTION-IF-NOT-FOUND])
1440fbfaf8f3Smrgdnl --------------------------------------------------------------
1441fbfaf8f3Smrgdnl Since: 0.4.0
1442fbfaf8f3Smrgdnl
1443fbfaf8f3Smrgdnl Note that if there is a possibility the first call to
1444fbfaf8f3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445fbfaf8f3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1446fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_MODULES],
1447fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1448fbfaf8f3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1449fbfaf8f3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450fbfaf8f3Smrg
1451fbfaf8f3Smrgpkg_failed=no
1452fbfaf8f3SmrgAC_MSG_CHECKING([for $1])
14536ef05171Smrg
1454fbfaf8f3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1455fbfaf8f3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
14566ef05171Smrg
1457fbfaf8f3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1458fbfaf8f3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1459fbfaf8f3SmrgSee the pkg-config man page for more details.])
14606ef05171Smrg
1461fbfaf8f3Smrgif test $pkg_failed = yes; then
1462fbfaf8f3Smrg   	AC_MSG_RESULT([no])
1463fbfaf8f3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1464fbfaf8f3Smrg        if test $_pkg_short_errors_supported = yes; then
1465fbfaf8f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1466fbfaf8f3Smrg        else 
1467fbfaf8f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1468fbfaf8f3Smrg        fi
1469fbfaf8f3Smrg	# Put the nasty error message in config.log where it belongs
1470fbfaf8f3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
14716ef05171Smrg
1472fbfaf8f3Smrg	m4_default([$4], [AC_MSG_ERROR(
1473fbfaf8f3Smrg[Package requirements ($2) were not met:
147443f32c10Smrg
1475fbfaf8f3Smrg$$1_PKG_ERRORS
147643f32c10Smrg
1477fbfaf8f3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1478fbfaf8f3Smrginstalled software in a non-standard prefix.
1479fbfaf8f3Smrg
1480fbfaf8f3Smrg_PKG_TEXT])[]dnl
1481fbfaf8f3Smrg        ])
1482fbfaf8f3Smrgelif test $pkg_failed = untried; then
1483fbfaf8f3Smrg     	AC_MSG_RESULT([no])
1484fbfaf8f3Smrg	m4_default([$4], [AC_MSG_FAILURE(
1485fbfaf8f3Smrg[The pkg-config script could not be found or is too old.  Make sure it
1486fbfaf8f3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1487fbfaf8f3Smrgpath to pkg-config.
1488fbfaf8f3Smrg
1489fbfaf8f3Smrg_PKG_TEXT
1490fbfaf8f3Smrg
1491fbfaf8f3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492fbfaf8f3Smrg        ])
149343f32c10Smrgelse
1494fbfaf8f3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1495fbfaf8f3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1496fbfaf8f3Smrg        AC_MSG_RESULT([yes])
1497fbfaf8f3Smrg	$3
1498fbfaf8f3Smrgfi[]dnl
1499fbfaf8f3Smrg])dnl PKG_CHECK_MODULES
150043f32c10Smrg
150143f32c10Smrg
1502fbfaf8f3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503fbfaf8f3Smrgdnl   [ACTION-IF-NOT-FOUND])
1504fbfaf8f3Smrgdnl ---------------------------------------------------------------------
1505fbfaf8f3Smrgdnl Since: 0.29
1506fbfaf8f3Smrgdnl
1507fbfaf8f3Smrgdnl Checks for existence of MODULES and gathers its build flags with
1508fbfaf8f3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509fbfaf8f3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510fbfaf8f3Smrgdnl
1511fbfaf8f3Smrgdnl Note that if there is a possibility the first call to
1512fbfaf8f3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513fbfaf8f3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514fbfaf8f3Smrgdnl configure.ac.
1515fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517fbfaf8f3Smrg_save_PKG_CONFIG=$PKG_CONFIG
1518fbfaf8f3SmrgPKG_CONFIG="$PKG_CONFIG --static"
1519fbfaf8f3SmrgPKG_CHECK_MODULES($@)
1520fbfaf8f3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521fbfaf8f3Smrg])dnl PKG_CHECK_MODULES_STATIC
152243f32c10Smrg
15236ef05171Smrg
1524fbfaf8f3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1525fbfaf8f3Smrgdnl -------------------------
1526fbfaf8f3Smrgdnl Since: 0.27
1527fbfaf8f3Smrgdnl
1528fbfaf8f3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529fbfaf8f3Smrgdnl should install pkg-config .pc files. By default the directory is
1530fbfaf8f3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531fbfaf8f3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532fbfaf8f3Smrgdnl parameter.
1533fbfaf8f3SmrgAC_DEFUN([PKG_INSTALLDIR],
1534fbfaf8f3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535fbfaf8f3Smrgm4_pushdef([pkg_description],
1536fbfaf8f3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537fbfaf8f3SmrgAC_ARG_WITH([pkgconfigdir],
1538fbfaf8f3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539fbfaf8f3Smrg    [with_pkgconfigdir=]pkg_default)
1540fbfaf8f3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541fbfaf8f3Smrgm4_popdef([pkg_default])
1542fbfaf8f3Smrgm4_popdef([pkg_description])
1543fbfaf8f3Smrg])dnl PKG_INSTALLDIR
15446ef05171Smrg
15456ef05171Smrg
1546fbfaf8f3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547fbfaf8f3Smrgdnl --------------------------------
1548fbfaf8f3Smrgdnl Since: 0.27
1549fbfaf8f3Smrgdnl
1550fbfaf8f3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551fbfaf8f3Smrgdnl module should install arch-independent pkg-config .pc files. By
1552fbfaf8f3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553fbfaf8f3Smrgdnl changed by passing DIRECTORY. The user can override through the
1554fbfaf8f3Smrgdnl --with-noarch-pkgconfigdir parameter.
1555fbfaf8f3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556fbfaf8f3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557fbfaf8f3Smrgm4_pushdef([pkg_description],
1558fbfaf8f3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559fbfaf8f3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560fbfaf8f3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561fbfaf8f3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1562fbfaf8f3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563fbfaf8f3Smrgm4_popdef([pkg_default])
1564fbfaf8f3Smrgm4_popdef([pkg_description])
1565fbfaf8f3Smrg])dnl PKG_NOARCH_INSTALLDIR
156643f32c10Smrg
156743f32c10Smrg
1568fbfaf8f3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569fbfaf8f3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570fbfaf8f3Smrgdnl -------------------------------------------
1571fbfaf8f3Smrgdnl Since: 0.28
1572fbfaf8f3Smrgdnl
1573fbfaf8f3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1574fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_VAR],
1575fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576fbfaf8f3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577fbfaf8f3Smrg
1578fbfaf8f3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579fbfaf8f3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580fbfaf8f3Smrg
1581fbfaf8f3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582fbfaf8f3Smrg])dnl PKG_CHECK_VAR
1583fbfaf8f3Smrg
1584fbfaf8f3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1585fbfaf8f3Smrgdnl
1586fbfaf8f3Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1587fbfaf8f3Smrgdnl
1588fbfaf8f3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1589fbfaf8f3Smrgdnl copy of this software and associated documentation files (the "Software"),
1590fbfaf8f3Smrgdnl to deal in the Software without restriction, including without limitation
1591fbfaf8f3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1592fbfaf8f3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1593fbfaf8f3Smrgdnl Software is furnished to do so, subject to the following conditions:
1594fbfaf8f3Smrgdnl
1595fbfaf8f3Smrgdnl The above copyright notice and this permission notice (including the next
1596fbfaf8f3Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1597fbfaf8f3Smrgdnl Software.
1598fbfaf8f3Smrgdnl
1599fbfaf8f3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1600fbfaf8f3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601fbfaf8f3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1602fbfaf8f3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1603fbfaf8f3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1604fbfaf8f3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1605fbfaf8f3Smrgdnl DEALINGS IN THE SOFTWARE.
160643f32c10Smrg
1607fbfaf8f3Smrg# XORG_MACROS_VERSION(required-version)
1608fbfaf8f3Smrg# -------------------------------------
160943f32c10Smrg# Minimum version: 1.1.0
161043f32c10Smrg#
1611fbfaf8f3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1612fbfaf8f3Smrg# your configure.ac with the minimum required version, such as:
1613fbfaf8f3Smrg# XORG_MACROS_VERSION(1.1)
161443f32c10Smrg#
1615fbfaf8f3Smrg# To ensure that this macro is defined, also add:
1616fbfaf8f3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1617fbfaf8f3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16186ef05171Smrg#
1619fbfaf8f3Smrg#
1620fbfaf8f3Smrg# See the "minimum version" comment for each macro you use to see what
1621fbfaf8f3Smrg# version you require.
1622fbfaf8f3Smrgm4_defun([XORG_MACROS_VERSION],[
1623d3173433Smrgm4_define([vers_have], [1.20.1])
1624fbfaf8f3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1625fbfaf8f3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1626fbfaf8f3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1627fbfaf8f3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1628fbfaf8f3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1629fbfaf8f3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1630fbfaf8f3Smrgm4_undefine([vers_have])
1631fbfaf8f3Smrgm4_undefine([maj_have])
1632fbfaf8f3Smrgm4_undefine([maj_needed])
1633fbfaf8f3Smrg]) # XORG_MACROS_VERSION
163443f32c10Smrg
1635fbfaf8f3Smrg# XORG_PROG_RAWCPP()
1636fbfaf8f3Smrg# ------------------
1637fbfaf8f3Smrg# Minimum version: 1.0.0
1638fbfaf8f3Smrg#
1639fbfaf8f3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1640fbfaf8f3Smrg# such as man pages and config files
1641fbfaf8f3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1642fbfaf8f3SmrgAC_REQUIRE([AC_PROG_CPP])
1643fbfaf8f3SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1644fbfaf8f3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16456ef05171Smrg
1646fbfaf8f3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1647fbfaf8f3Smrg# which is not the best choice for supporting other OS'es, but covers most
1648fbfaf8f3Smrg# of the ones we need for now.
1649fbfaf8f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1650fbfaf8f3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1651fbfaf8f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1652fbfaf8f3Smrg	AC_MSG_RESULT([no])
1653fbfaf8f3Smrgelse
1654fbfaf8f3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1655fbfaf8f3Smrg		RAWCPPFLAGS=-undef
1656fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1657fbfaf8f3Smrg	# under Cygwin unix is still defined even with -undef
1658fbfaf8f3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1659fbfaf8f3Smrg		RAWCPPFLAGS="-undef -ansi"
1660fbfaf8f3Smrg		AC_MSG_RESULT([yes, with -ansi])
1661fbfaf8f3Smrg	else
1662fbfaf8f3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1663fbfaf8f3Smrg	fi
166443f32c10Smrgfi
1665fbfaf8f3Smrgrm -f conftest.$ac_ext
16666ef05171Smrg
1667fbfaf8f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1668fbfaf8f3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669d3173433Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1670fbfaf8f3Smrg	AC_MSG_RESULT([no])
1671fbfaf8f3Smrgelse
1672d3173433Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
1673fbfaf8f3Smrg		TRADITIONALCPPFLAGS="-traditional"
1674fbfaf8f3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1675fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1676fbfaf8f3Smrg	else
1677fbfaf8f3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1678fbfaf8f3Smrg	fi
1679fbfaf8f3Smrgfi
1680fbfaf8f3Smrgrm -f conftest.$ac_ext
1681fbfaf8f3SmrgAC_SUBST(RAWCPPFLAGS)
1682fbfaf8f3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1683fbfaf8f3Smrg]) # XORG_PROG_RAWCPP
168443f32c10Smrg
1685fbfaf8f3Smrg# XORG_MANPAGE_SECTIONS()
1686fbfaf8f3Smrg# -----------------------
1687fbfaf8f3Smrg# Minimum version: 1.0.0
16886ef05171Smrg#
1689fbfaf8f3Smrg# Determine which sections man pages go in for the different man page types
1690fbfaf8f3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1691fbfaf8f3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1692fbfaf8f3Smrg# Override default settings by setting environment variables
1693fbfaf8f3Smrg# Added MAN_SUBSTS in version 1.8
1694fbfaf8f3Smrg# Added AC_PROG_SED in version 1.8
16956ef05171Smrg
1696fbfaf8f3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1697fbfaf8f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1698fbfaf8f3SmrgAC_REQUIRE([AC_PROG_SED])
16996ef05171Smrg
1700fbfaf8f3Smrgcase $host_os in
1701fbfaf8f3Smrg    solaris*)
1702fbfaf8f3Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703fbfaf8f3Smrg        # check for a man page file found in later versions that use
1704fbfaf8f3Smrg        # traditional section numbers instead
1705fbfaf8f3Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706fbfaf8f3Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707fbfaf8f3Smrg        ;;
1708fbfaf8f3Smrg    *) SYSV_MAN_SECTIONS=false ;;
1709fbfaf8f3Smrgesac
17106ef05171Smrg
1711fbfaf8f3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1712fbfaf8f3Smrg    APP_MAN_SUFFIX=1
1713fbfaf8f3Smrgfi
1714fbfaf8f3Smrgif test x$APP_MAN_DIR = x    ; then
1715fbfaf8f3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1716fbfaf8f3Smrgfi
17176ef05171Smrg
1718fbfaf8f3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1719fbfaf8f3Smrg    LIB_MAN_SUFFIX=3
1720fbfaf8f3Smrgfi
1721fbfaf8f3Smrgif test x$LIB_MAN_DIR = x    ; then
1722fbfaf8f3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1723fbfaf8f3Smrgfi
17246ef05171Smrg
1725fbfaf8f3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1726fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1727fbfaf8f3Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1728fbfaf8f3Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1729fbfaf8f3Smrg    esac
1730fbfaf8f3Smrgfi
1731fbfaf8f3Smrgif test x$FILE_MAN_DIR = x    ; then
1732fbfaf8f3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
17336ef05171Smrgfi
17346ef05171Smrg
1735fbfaf8f3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1736fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1737fbfaf8f3Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1738fbfaf8f3Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1739fbfaf8f3Smrg    esac
1740fbfaf8f3Smrgfi
1741fbfaf8f3Smrgif test x$MISC_MAN_DIR = x    ; then
1742fbfaf8f3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743fbfaf8f3Smrgfi
1744fbfaf8f3Smrg
1745fbfaf8f3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1747fbfaf8f3Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748fbfaf8f3Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1749fbfaf8f3Smrg    esac
1750fbfaf8f3Smrgfi
1751fbfaf8f3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1752fbfaf8f3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1753fbfaf8f3Smrgfi
1754fbfaf8f3Smrg
1755fbfaf8f3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1757fbfaf8f3Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758fbfaf8f3Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1759fbfaf8f3Smrg    esac
1760fbfaf8f3Smrgfi
1761fbfaf8f3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1762fbfaf8f3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17636ef05171Smrgfi
17646ef05171Smrg
17656ef05171Smrg
1766fbfaf8f3SmrgAC_SUBST([APP_MAN_SUFFIX])
1767fbfaf8f3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1768fbfaf8f3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1769fbfaf8f3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1770fbfaf8f3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1771fbfaf8f3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1772fbfaf8f3SmrgAC_SUBST([APP_MAN_DIR])
1773fbfaf8f3SmrgAC_SUBST([LIB_MAN_DIR])
1774fbfaf8f3SmrgAC_SUBST([FILE_MAN_DIR])
1775fbfaf8f3SmrgAC_SUBST([MISC_MAN_DIR])
1776fbfaf8f3SmrgAC_SUBST([DRIVER_MAN_DIR])
1777fbfaf8f3SmrgAC_SUBST([ADMIN_MAN_DIR])
17786ef05171Smrg
1779fbfaf8f3SmrgXORG_MAN_PAGE="X Version 11"
1780fbfaf8f3SmrgAC_SUBST([XORG_MAN_PAGE])
1781fbfaf8f3SmrgMAN_SUBSTS="\
1782fbfaf8f3Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1783fbfaf8f3Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1784fbfaf8f3Smrg	-e 's|__xservername__|Xorg|g' \
1785fbfaf8f3Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1786fbfaf8f3Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1787fbfaf8f3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1788fbfaf8f3Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1789fbfaf8f3Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1790fbfaf8f3Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1791fbfaf8f3Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1792fbfaf8f3Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1793fbfaf8f3Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1794fbfaf8f3SmrgAC_SUBST([MAN_SUBSTS])
17956ef05171Smrg
1796fbfaf8f3Smrg]) # XORG_MANPAGE_SECTIONS
17976ef05171Smrg
1798fbfaf8f3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1799fbfaf8f3Smrg# ------------------------
1800fbfaf8f3Smrg# Minimum version: 1.7.0
1801fbfaf8f3Smrg#
1802fbfaf8f3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1803fbfaf8f3Smrg# provided by xorg-sgml-doctools, if installed.
1804fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1805fbfaf8f3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1806fbfaf8f3SmrgXORG_SGML_PATH=
1807fbfaf8f3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1808fbfaf8f3Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1809fbfaf8f3Smrg    [m4_ifval([$1],[:],
1810fbfaf8f3Smrg        [if test x"$cross_compiling" != x"yes" ; then
1811fbfaf8f3Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1812fbfaf8f3Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1813fbfaf8f3Smrg         fi])
1814fbfaf8f3Smrg    ])
18156ef05171Smrg
1816fbfaf8f3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1817fbfaf8f3Smrg# the path and the name of the doc stylesheet
1818fbfaf8f3Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1819fbfaf8f3Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1820fbfaf8f3Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1821fbfaf8f3Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1822fbfaf8f3Smrgelse
1823fbfaf8f3Smrg   AC_MSG_RESULT([no])
1824fbfaf8f3Smrgfi
18256ef05171Smrg
1826fbfaf8f3SmrgAC_SUBST(XORG_SGML_PATH)
1827fbfaf8f3SmrgAC_SUBST(STYLESHEET_SRCDIR)
1828fbfaf8f3SmrgAC_SUBST(XSL_STYLESHEET)
1829fbfaf8f3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1830fbfaf8f3Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831fbfaf8f3Smrg
1832fbfaf8f3Smrg# XORG_CHECK_LINUXDOC
1833fbfaf8f3Smrg# -------------------
1834fbfaf8f3Smrg# Minimum version: 1.0.0
18356ef05171Smrg#
1836fbfaf8f3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1837fbfaf8f3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1838fbfaf8f3Smrg# Whether or not the necessary tools and files are found can be checked
1839fbfaf8f3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1840fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1841fbfaf8f3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1842fbfaf8f3SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18436ef05171Smrg
1844fbfaf8f3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18456ef05171Smrg
1846fbfaf8f3SmrgAC_MSG_CHECKING([whether to build documentation])
1847fbfaf8f3Smrg
1848fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1849fbfaf8f3Smrg   BUILDDOC=yes
18506ef05171Smrgelse
1851fbfaf8f3Smrg   BUILDDOC=no
18526ef05171Smrgfi
18536ef05171Smrg
1854fbfaf8f3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18556ef05171Smrg
1856fbfaf8f3SmrgAC_MSG_RESULT([$BUILDDOC])
18576ef05171Smrg
1858fbfaf8f3SmrgAC_MSG_CHECKING([whether to build pdf documentation])
18596ef05171Smrg
1860fbfaf8f3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1861fbfaf8f3Smrg   BUILDPDFDOC=yes
18626ef05171Smrgelse
1863fbfaf8f3Smrg   BUILDPDFDOC=no
18646ef05171Smrgfi
18656ef05171Smrg
1866fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18676ef05171Smrg
1868fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
18696ef05171Smrg
1870fbfaf8f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1871fbfaf8f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1872fbfaf8f3SmrgMAKE_PDF="$PS2PDF"
1873fbfaf8f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874fbfaf8f3Smrg
1875fbfaf8f3SmrgAC_SUBST(MAKE_TEXT)
1876fbfaf8f3SmrgAC_SUBST(MAKE_PS)
1877fbfaf8f3SmrgAC_SUBST(MAKE_PDF)
1878fbfaf8f3SmrgAC_SUBST(MAKE_HTML)
1879fbfaf8f3Smrg]) # XORG_CHECK_LINUXDOC
1880fbfaf8f3Smrg
1881fbfaf8f3Smrg# XORG_CHECK_DOCBOOK
1882fbfaf8f3Smrg# -------------------
1883fbfaf8f3Smrg# Minimum version: 1.0.0
18846ef05171Smrg#
1885fbfaf8f3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1886fbfaf8f3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1887fbfaf8f3Smrg# indicates whether the necessary tools and files are found and, if set,
1888fbfaf8f3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1889fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1890fbfaf8f3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18916ef05171Smrg
1892fbfaf8f3SmrgBUILDTXTDOC=no
1893fbfaf8f3SmrgBUILDPDFDOC=no
1894fbfaf8f3SmrgBUILDPSDOC=no
1895fbfaf8f3SmrgBUILDHTMLDOC=no
18966ef05171Smrg
1897fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1898fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1899fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1900fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19016ef05171Smrg
1902fbfaf8f3SmrgAC_MSG_CHECKING([whether to build text documentation])
1903fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1904fbfaf8f3Smrg   test x$BUILD_TXTDOC != xno; then
1905fbfaf8f3Smrg	BUILDTXTDOC=yes
1906fbfaf8f3Smrgfi
1907fbfaf8f3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1908fbfaf8f3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
19096ef05171Smrg
1910fbfaf8f3SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1911fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1912fbfaf8f3Smrg   test x$BUILD_PDFDOC != xno; then
1913fbfaf8f3Smrg	BUILDPDFDOC=yes
1914fbfaf8f3Smrgfi
1915fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1916fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
19176ef05171Smrg
1918fbfaf8f3SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1919fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1920fbfaf8f3Smrg   test x$BUILD_PSDOC != xno; then
1921fbfaf8f3Smrg	BUILDPSDOC=yes
19226ef05171Smrgfi
1923fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1924fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPSDOC])
19256ef05171Smrg
1926fbfaf8f3SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1927fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1928fbfaf8f3Smrg   test x$BUILD_HTMLDOC != xno; then
1929fbfaf8f3Smrg	BUILDHTMLDOC=yes
1930fbfaf8f3Smrgfi
1931fbfaf8f3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1932fbfaf8f3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19336ef05171Smrg
1934fbfaf8f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1935fbfaf8f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1936fbfaf8f3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1937fbfaf8f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938fbfaf8f3Smrg
1939fbfaf8f3SmrgAC_SUBST(MAKE_TEXT)
1940fbfaf8f3SmrgAC_SUBST(MAKE_PS)
1941fbfaf8f3SmrgAC_SUBST(MAKE_PDF)
1942fbfaf8f3SmrgAC_SUBST(MAKE_HTML)
1943fbfaf8f3Smrg]) # XORG_CHECK_DOCBOOK
1944fbfaf8f3Smrg
1945fbfaf8f3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19466ef05171Smrg# ----------------
1947fbfaf8f3Smrg# Minimum version: 1.5.0
1948fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19496ef05171Smrg#
1950fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
1951fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
1952fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953fbfaf8f3Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1954fbfaf8f3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1955fbfaf8f3Smrg# --with-xmlto assumes 'auto'.
19566ef05171Smrg#
1957fbfaf8f3Smrg# Interface to module:
1958fbfaf8f3Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1959fbfaf8f3Smrg# XMLTO:	returns the path of the xmlto program found
1960fbfaf8f3Smrg#		returns the path set by the user in the environment
1961fbfaf8f3Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1962fbfaf8f3Smrg#		'no' user instructs the module not to use xmlto
1963fbfaf8f3Smrg#
1964fbfaf8f3Smrg# Added in version 1.10.0
1965fbfaf8f3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1966fbfaf8f3Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967fbfaf8f3Smrg#
1968fbfaf8f3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969fbfaf8f3Smrg#
1970fbfaf8f3SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1971fbfaf8f3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1972fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
1973fbfaf8f3SmrgAC_ARG_WITH(xmlto,
1974fbfaf8f3Smrg	AS_HELP_STRING([--with-xmlto],
1975fbfaf8f3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1976fbfaf8f3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1977fbfaf8f3Smrgm4_undefine([_defopt])
197843f32c10Smrg
1979fbfaf8f3Smrgif test "x$use_xmlto" = x"auto"; then
1980fbfaf8f3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1981fbfaf8f3Smrg   if test "x$XMLTO" = "x"; then
1982fbfaf8f3Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1983fbfaf8f3Smrg	have_xmlto=no
1984fbfaf8f3Smrg   else
1985fbfaf8f3Smrg        have_xmlto=yes
1986fbfaf8f3Smrg   fi
1987fbfaf8f3Smrgelif test "x$use_xmlto" = x"yes" ; then
1988fbfaf8f3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1989fbfaf8f3Smrg   if test "x$XMLTO" = "x"; then
1990fbfaf8f3Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1991fbfaf8f3Smrg   fi
1992fbfaf8f3Smrg   have_xmlto=yes
1993fbfaf8f3Smrgelif test "x$use_xmlto" = x"no" ; then
1994fbfaf8f3Smrg   if test "x$XMLTO" != "x"; then
1995fbfaf8f3Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1996fbfaf8f3Smrg   fi
1997fbfaf8f3Smrg   have_xmlto=no
1998fbfaf8f3Smrgelse
1999fbfaf8f3Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000fbfaf8f3Smrgfi
20016ef05171Smrg
2002fbfaf8f3Smrg# Test for a minimum version of xmlto, if provided.
2003fbfaf8f3Smrgm4_ifval([$1],
2004fbfaf8f3Smrg[if test "$have_xmlto" = yes; then
2005fbfaf8f3Smrg    # scrape the xmlto version
2006fbfaf8f3Smrg    AC_MSG_CHECKING([the xmlto version])
2007fbfaf8f3Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2008fbfaf8f3Smrg    AC_MSG_RESULT([$xmlto_version])
2009fbfaf8f3Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2010fbfaf8f3Smrg        [if test "x$use_xmlto" = xauto; then
2011fbfaf8f3Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2012fbfaf8f3Smrg            have_xmlto=no
2013fbfaf8f3Smrg        else
2014fbfaf8f3Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2015fbfaf8f3Smrg        fi])
2016fbfaf8f3Smrgfi])
201743f32c10Smrg
2018fbfaf8f3Smrg# Test for the ability of xmlto to generate a text target
20196ef05171Smrg#
2020fbfaf8f3Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021fbfaf8f3Smrg# following test for empty XML docbook files.
2022fbfaf8f3Smrg# For compatibility reasons use the following empty XML docbook file and if
2023fbfaf8f3Smrg# it fails try it again with a non-empty XML file.
2024fbfaf8f3Smrghave_xmlto_text=no
2025fbfaf8f3Smrgcat > conftest.xml << "EOF"
2026fbfaf8f3SmrgEOF
2027fbfaf8f3SmrgAS_IF([test "$have_xmlto" = yes],
2028fbfaf8f3Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2029fbfaf8f3Smrg             [have_xmlto_text=yes],
2030fbfaf8f3Smrg             [# Try it again with a non-empty XML file.
2031fbfaf8f3Smrg              cat > conftest.xml << "EOF"
2032fbfaf8f3Smrg<x></x>
2033fbfaf8f3SmrgEOF
2034fbfaf8f3Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035fbfaf8f3Smrg                    [have_xmlto_text=yes],
2036fbfaf8f3Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2037fbfaf8f3Smrgrm -f conftest.xml
2038fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2039fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2040fbfaf8f3Smrg]) # XORG_WITH_XMLTO
2041fbfaf8f3Smrg
2042fbfaf8f3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2043fbfaf8f3Smrg# --------------------------------------------
2044fbfaf8f3Smrg# Minimum version: 1.12.0
2045fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2046fbfaf8f3Smrg#
2047fbfaf8f3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2048fbfaf8f3Smrg# XML-based language used for the transformation of XML documents.
2049fbfaf8f3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2050fbfaf8f3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
2051fbfaf8f3Smrg# The XSLT processor is often used as a standalone tool for transformations.
2052fbfaf8f3Smrg# It should not be assumed that this tool is used only to work with documnetation.
2053fbfaf8f3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20546ef05171Smrg#
2055fbfaf8f3Smrg# Interface to module:
2056fbfaf8f3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2057fbfaf8f3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
2058fbfaf8f3Smrg#		 returns the path set by the user in the environment
2059fbfaf8f3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2060fbfaf8f3Smrg#		  'no' user instructs the module not to use xsltproc
2061fbfaf8f3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20626ef05171Smrg#
2063fbfaf8f3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
206443f32c10Smrg#
2065fbfaf8f3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
2066fbfaf8f3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2067fbfaf8f3Smrg# Preserves the interface, should it be implemented later
2068fbfaf8f3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2069fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2070fbfaf8f3SmrgAC_ARG_WITH(xsltproc,
2071fbfaf8f3Smrg	AS_HELP_STRING([--with-xsltproc],
2072fbfaf8f3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2073fbfaf8f3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2074fbfaf8f3Smrgm4_undefine([_defopt])
207543f32c10Smrg
2076fbfaf8f3Smrgif test "x$use_xsltproc" = x"auto"; then
2077fbfaf8f3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2078fbfaf8f3Smrg   if test "x$XSLTPROC" = "x"; then
2079fbfaf8f3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2080fbfaf8f3Smrg	have_xsltproc=no
2081fbfaf8f3Smrg   else
2082fbfaf8f3Smrg        have_xsltproc=yes
2083fbfaf8f3Smrg   fi
2084fbfaf8f3Smrgelif test "x$use_xsltproc" = x"yes" ; then
2085fbfaf8f3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
2086fbfaf8f3Smrg   if test "x$XSLTPROC" = "x"; then
2087fbfaf8f3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2088fbfaf8f3Smrg   fi
2089fbfaf8f3Smrg   have_xsltproc=yes
2090fbfaf8f3Smrgelif test "x$use_xsltproc" = x"no" ; then
2091fbfaf8f3Smrg   if test "x$XSLTPROC" != "x"; then
2092fbfaf8f3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2093fbfaf8f3Smrg   fi
2094fbfaf8f3Smrg   have_xsltproc=no
2095fbfaf8f3Smrgelse
2096fbfaf8f3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097fbfaf8f3Smrgfi
209843f32c10Smrg
2099fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2100fbfaf8f3Smrg]) # XORG_WITH_XSLTPROC
210143f32c10Smrg
2102fbfaf8f3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2103fbfaf8f3Smrg# ----------------------------------------
2104fbfaf8f3Smrg# Minimum version: 1.15.0
2105fbfaf8f3Smrg#
2106fbfaf8f3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
2107fbfaf8f3Smrg# scanning arbitrary text files, extracting information from those text files,
2108fbfaf8f3Smrg# and printing reports based on that information.
2109fbfaf8f3Smrg#
2110fbfaf8f3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111fbfaf8f3Smrg#
2112fbfaf8f3Smrg# Interface to module:
2113fbfaf8f3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
2114fbfaf8f3Smrg# PERL:	     returns the path of the perl program found
2115fbfaf8f3Smrg#	     returns the path set by the user in the environment
2116fbfaf8f3Smrg# --with-perl: 'yes' user instructs the module to use perl
2117fbfaf8f3Smrg#	       'no' user instructs the module not to use perl
2118fbfaf8f3Smrg# have_perl: returns yes if perl found in PATH or no
2119fbfaf8f3Smrg#
2120fbfaf8f3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2121fbfaf8f3Smrg#
2122fbfaf8f3SmrgAC_DEFUN([XORG_WITH_PERL],[
2123fbfaf8f3SmrgAC_ARG_VAR([PERL], [Path to perl command])
2124fbfaf8f3Smrg# Preserves the interface, should it be implemented later
2125fbfaf8f3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2126fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2127fbfaf8f3SmrgAC_ARG_WITH(perl,
2128fbfaf8f3Smrg	AS_HELP_STRING([--with-perl],
2129fbfaf8f3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
2130fbfaf8f3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
2131fbfaf8f3Smrgm4_undefine([_defopt])
213243f32c10Smrg
2133fbfaf8f3Smrgif test "x$use_perl" = x"auto"; then
2134fbfaf8f3Smrg   AC_PATH_PROG([PERL], [perl])
2135fbfaf8f3Smrg   if test "x$PERL" = "x"; then
2136fbfaf8f3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
2137fbfaf8f3Smrg	have_perl=no
2138fbfaf8f3Smrg   else
2139fbfaf8f3Smrg        have_perl=yes
2140fbfaf8f3Smrg   fi
2141fbfaf8f3Smrgelif test "x$use_perl" = x"yes" ; then
2142fbfaf8f3Smrg   AC_PATH_PROG([PERL], [perl])
2143fbfaf8f3Smrg   if test "x$PERL" = "x"; then
2144fbfaf8f3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2145fbfaf8f3Smrg   fi
2146fbfaf8f3Smrg   have_perl=yes
2147fbfaf8f3Smrgelif test "x$use_perl" = x"no" ; then
2148fbfaf8f3Smrg   if test "x$PERL" != "x"; then
2149fbfaf8f3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2150fbfaf8f3Smrg   fi
2151fbfaf8f3Smrg   have_perl=no
2152fbfaf8f3Smrgelse
2153fbfaf8f3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2154fbfaf8f3Smrgfi
215543f32c10Smrg
2156fbfaf8f3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2157fbfaf8f3Smrg]) # XORG_WITH_PERL
215843f32c10Smrg
2159fbfaf8f3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160fbfaf8f3Smrg# ----------------
2161fbfaf8f3Smrg# Minimum version: 1.5.0
2162fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216343f32c10Smrg#
2164fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2165fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2166fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167fbfaf8f3Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2168fbfaf8f3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2169fbfaf8f3Smrg# --with-asciidoc assumes 'auto'.
217043f32c10Smrg#
2171fbfaf8f3Smrg# Interface to module:
2172fbfaf8f3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2173fbfaf8f3Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2174fbfaf8f3Smrg#		 returns the path set by the user in the environment
2175fbfaf8f3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2176fbfaf8f3Smrg#		  'no' user instructs the module not to use asciidoc
217743f32c10Smrg#
2178fbfaf8f3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
217943f32c10Smrg#
2180fbfaf8f3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2181fbfaf8f3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2182fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2183fbfaf8f3SmrgAC_ARG_WITH(asciidoc,
2184fbfaf8f3Smrg	AS_HELP_STRING([--with-asciidoc],
2185fbfaf8f3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2186fbfaf8f3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2187fbfaf8f3Smrgm4_undefine([_defopt])
218843f32c10Smrg
2189fbfaf8f3Smrgif test "x$use_asciidoc" = x"auto"; then
2190fbfaf8f3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2191fbfaf8f3Smrg   if test "x$ASCIIDOC" = "x"; then
2192fbfaf8f3Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2193fbfaf8f3Smrg	have_asciidoc=no
2194fbfaf8f3Smrg   else
2195fbfaf8f3Smrg        have_asciidoc=yes
2196fbfaf8f3Smrg   fi
2197fbfaf8f3Smrgelif test "x$use_asciidoc" = x"yes" ; then
2198fbfaf8f3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2199fbfaf8f3Smrg   if test "x$ASCIIDOC" = "x"; then
2200fbfaf8f3Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2201fbfaf8f3Smrg   fi
2202fbfaf8f3Smrg   have_asciidoc=yes
2203fbfaf8f3Smrgelif test "x$use_asciidoc" = x"no" ; then
2204fbfaf8f3Smrg   if test "x$ASCIIDOC" != "x"; then
2205fbfaf8f3Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2206fbfaf8f3Smrg   fi
2207fbfaf8f3Smrg   have_asciidoc=no
2208fbfaf8f3Smrgelse
2209fbfaf8f3Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2210fbfaf8f3Smrgfi
2211fbfaf8f3Smrgm4_ifval([$1],
2212fbfaf8f3Smrg[if test "$have_asciidoc" = yes; then
2213fbfaf8f3Smrg    # scrape the asciidoc version
2214fbfaf8f3Smrg    AC_MSG_CHECKING([the asciidoc version])
2215fbfaf8f3Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2216fbfaf8f3Smrg    AC_MSG_RESULT([$asciidoc_version])
2217fbfaf8f3Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2218fbfaf8f3Smrg        [if test "x$use_asciidoc" = xauto; then
2219fbfaf8f3Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2220fbfaf8f3Smrg            have_asciidoc=no
2221fbfaf8f3Smrg        else
2222fbfaf8f3Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2223fbfaf8f3Smrg        fi])
2224fbfaf8f3Smrgfi])
2225fbfaf8f3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2226fbfaf8f3Smrg]) # XORG_WITH_ASCIIDOC
222743f32c10Smrg
2228fbfaf8f3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2229fbfaf8f3Smrg# -------------------------------------------
2230fbfaf8f3Smrg# Minimum version: 1.5.0
2231fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2232fbfaf8f3Smrg# Minimum version for optional DOT checking: 1.18.0
2233fbfaf8f3Smrg#
2234fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2235fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2236fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237fbfaf8f3Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2238fbfaf8f3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2239fbfaf8f3Smrg# --with-doxygen assumes 'auto'.
2240fbfaf8f3Smrg#
2241fbfaf8f3Smrg# Interface to module:
2242fbfaf8f3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2243fbfaf8f3Smrg# DOXYGEN:	 returns the path of the doxygen program found
2244fbfaf8f3Smrg#		 returns the path set by the user in the environment
2245fbfaf8f3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2246fbfaf8f3Smrg#		  'no' user instructs the module not to use doxygen
224743f32c10Smrg#
2248fbfaf8f3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249fbfaf8f3Smrg#
2250fbfaf8f3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2251fbfaf8f3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2252fbfaf8f3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2253fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2254fbfaf8f3SmrgAC_ARG_WITH(doxygen,
2255fbfaf8f3Smrg	AS_HELP_STRING([--with-doxygen],
2256fbfaf8f3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2257fbfaf8f3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2258fbfaf8f3Smrgm4_undefine([_defopt])
225943f32c10Smrg
2260fbfaf8f3Smrgif test "x$use_doxygen" = x"auto"; then
2261fbfaf8f3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2262fbfaf8f3Smrg   if test "x$DOXYGEN" = "x"; then
2263fbfaf8f3Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2264fbfaf8f3Smrg	have_doxygen=no
2265fbfaf8f3Smrg   else
2266fbfaf8f3Smrg        have_doxygen=yes
2267fbfaf8f3Smrg   fi
2268fbfaf8f3Smrgelif test "x$use_doxygen" = x"yes" ; then
2269fbfaf8f3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2270fbfaf8f3Smrg   if test "x$DOXYGEN" = "x"; then
2271fbfaf8f3Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2272fbfaf8f3Smrg   fi
2273fbfaf8f3Smrg   have_doxygen=yes
2274fbfaf8f3Smrgelif test "x$use_doxygen" = x"no" ; then
2275fbfaf8f3Smrg   if test "x$DOXYGEN" != "x"; then
2276fbfaf8f3Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2277fbfaf8f3Smrg   fi
2278fbfaf8f3Smrg   have_doxygen=no
227943f32c10Smrgelse
2280fbfaf8f3Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
228143f32c10Smrgfi
2282fbfaf8f3Smrgm4_ifval([$1],
2283fbfaf8f3Smrg[if test "$have_doxygen" = yes; then
2284fbfaf8f3Smrg    # scrape the doxygen version
2285fbfaf8f3Smrg    AC_MSG_CHECKING([the doxygen version])
2286fbfaf8f3Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2287fbfaf8f3Smrg    AC_MSG_RESULT([$doxygen_version])
2288fbfaf8f3Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2289fbfaf8f3Smrg        [if test "x$use_doxygen" = xauto; then
2290fbfaf8f3Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2291fbfaf8f3Smrg            have_doxygen=no
2292fbfaf8f3Smrg        else
2293fbfaf8f3Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2294fbfaf8f3Smrg        fi])
2295fbfaf8f3Smrgfi])
229643f32c10Smrg
2297fbfaf8f3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2298fbfaf8f3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2299fbfaf8f3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2300fbfaf8f3SmrgHAVE_DOT=no
2301fbfaf8f3Smrgif test "x$have_doxygen" = "xyes"; then
2302fbfaf8f3Smrg  AC_PATH_PROG([DOT], [dot])
2303fbfaf8f3Smrg    if test "x$DOT" != "x"; then
2304fbfaf8f3Smrg      HAVE_DOT=yes
2305fbfaf8f3Smrg    fi
2306fbfaf8f3Smrgfi
230743f32c10Smrg
2308fbfaf8f3SmrgAC_SUBST([HAVE_DOT])
2309fbfaf8f3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2310fbfaf8f3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2311fbfaf8f3Smrg]) # XORG_WITH_DOXYGEN
231243f32c10Smrg
2313fbfaf8f3Smrg# XORG_WITH_GROFF([DEFAULT])
2314fbfaf8f3Smrg# ----------------
2315fbfaf8f3Smrg# Minimum version: 1.6.0
2316fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
231743f32c10Smrg#
2318fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2319fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2320fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321fbfaf8f3Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2322fbfaf8f3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2323fbfaf8f3Smrg# --with-groff assumes 'auto'.
2324fbfaf8f3Smrg#
2325fbfaf8f3Smrg# Interface to module:
2326fbfaf8f3Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2327fbfaf8f3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2328fbfaf8f3Smrg# HAVE_GROFF_MS: the -ms macros package
2329fbfaf8f3Smrg# GROFF:	 returns the path of the groff program found
2330fbfaf8f3Smrg#		 returns the path set by the user in the environment
2331fbfaf8f3Smrg# --with-groff:	 'yes' user instructs the module to use groff
2332fbfaf8f3Smrg#		 'no' user instructs the module not to use groff
2333fbfaf8f3Smrg#
2334fbfaf8f3Smrg# Added in version 1.9.0:
2335fbfaf8f3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2336fbfaf8f3Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2337fbfaf8f3Smrg#		   psselect from the psutils package.
2338fbfaf8f3Smrg#		   the ghostcript package. Refer to the grohtml man pages
2339fbfaf8f3Smrg#
2340fbfaf8f3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2341fbfaf8f3Smrg#
2342fbfaf8f3Smrg# OS and distros often splits groff in a basic and full package, the former
2343fbfaf8f3Smrg# having the groff program and the later having devices, fonts and macros
2344fbfaf8f3Smrg# Checking for the groff executable is not enough.
2345fbfaf8f3Smrg#
2346fbfaf8f3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2347fbfaf8f3Smrg# unset HAVE_GROFF or GROFF env variables.
2348fbfaf8f3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2349fbfaf8f3Smrg#
2350fbfaf8f3SmrgAC_DEFUN([XORG_WITH_GROFF],[
2351fbfaf8f3SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2352fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2353fbfaf8f3SmrgAC_ARG_WITH(groff,
2354fbfaf8f3Smrg	AS_HELP_STRING([--with-groff],
2355fbfaf8f3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2356fbfaf8f3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2357fbfaf8f3Smrgm4_undefine([_defopt])
235843f32c10Smrg
2359fbfaf8f3Smrgif test "x$use_groff" = x"auto"; then
2360fbfaf8f3Smrg   AC_PATH_PROG([GROFF], [groff])
2361fbfaf8f3Smrg   if test "x$GROFF" = "x"; then
2362fbfaf8f3Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2363fbfaf8f3Smrg	have_groff=no
2364fbfaf8f3Smrg   else
2365fbfaf8f3Smrg        have_groff=yes
2366fbfaf8f3Smrg   fi
2367fbfaf8f3Smrgelif test "x$use_groff" = x"yes" ; then
2368fbfaf8f3Smrg   AC_PATH_PROG([GROFF], [groff])
2369fbfaf8f3Smrg   if test "x$GROFF" = "x"; then
2370fbfaf8f3Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2371fbfaf8f3Smrg   fi
2372fbfaf8f3Smrg   have_groff=yes
2373fbfaf8f3Smrgelif test "x$use_groff" = x"no" ; then
2374fbfaf8f3Smrg   if test "x$GROFF" != "x"; then
2375fbfaf8f3Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2376fbfaf8f3Smrg   fi
2377fbfaf8f3Smrg   have_groff=no
237843f32c10Smrgelse
2379fbfaf8f3Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
238043f32c10Smrgfi
238143f32c10Smrg
2382fbfaf8f3Smrg# We have groff, test for the presence of the macro packages
2383fbfaf8f3Smrgif test "x$have_groff" = x"yes"; then
2384fbfaf8f3Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2385fbfaf8f3Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2386fbfaf8f3Smrg        groff_ms_works=yes
2387fbfaf8f3Smrg    else
2388fbfaf8f3Smrg        groff_ms_works=no
2389fbfaf8f3Smrg    fi
2390fbfaf8f3Smrg    AC_MSG_RESULT([$groff_ms_works])
2391fbfaf8f3Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2392fbfaf8f3Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2393fbfaf8f3Smrg        groff_mm_works=yes
2394fbfaf8f3Smrg    else
2395fbfaf8f3Smrg        groff_mm_works=no
2396fbfaf8f3Smrg    fi
2397fbfaf8f3Smrg    AC_MSG_RESULT([$groff_mm_works])
2398fbfaf8f3Smrgfi
239943f32c10Smrg
2400fbfaf8f3Smrg# We have groff, test for HTML dependencies, one command per package
2401fbfaf8f3Smrgif test "x$have_groff" = x"yes"; then
2402fbfaf8f3Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2403fbfaf8f3Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2404fbfaf8f3Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2405fbfaf8f3Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2406fbfaf8f3Smrg      have_groff_html=yes
2407fbfaf8f3Smrg   else
2408fbfaf8f3Smrg      have_groff_html=no
2409fbfaf8f3Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2410fbfaf8f3Smrg   fi
2411fbfaf8f3Smrgfi
241243f32c10Smrg
2413fbfaf8f3Smrg# Set Automake conditionals for Makefiles
2414fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2415fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2416fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2417fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2418fbfaf8f3Smrg]) # XORG_WITH_GROFF
241943f32c10Smrg
2420fbfaf8f3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2421fbfaf8f3Smrg# ---------------------------------------
2422fbfaf8f3Smrg# Minimum version: 1.6.0
2423fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2424fbfaf8f3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2425fbfaf8f3Smrg#
2426fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2427fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2428fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429fbfaf8f3Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2430fbfaf8f3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2431fbfaf8f3Smrg# --with-fop assumes 'auto'.
2432fbfaf8f3Smrg#
2433fbfaf8f3Smrg# Interface to module:
2434fbfaf8f3Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2435fbfaf8f3Smrg# FOP:	 	returns the path of the fop program found
2436fbfaf8f3Smrg#		returns the path set by the user in the environment
2437fbfaf8f3Smrg# --with-fop: 	'yes' user instructs the module to use fop
2438fbfaf8f3Smrg#		'no' user instructs the module not to use fop
2439fbfaf8f3Smrg#
2440fbfaf8f3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2441fbfaf8f3Smrg#
2442fbfaf8f3SmrgAC_DEFUN([XORG_WITH_FOP],[
2443fbfaf8f3SmrgAC_ARG_VAR([FOP], [Path to fop command])
2444fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2445fbfaf8f3SmrgAC_ARG_WITH(fop,
2446fbfaf8f3Smrg	AS_HELP_STRING([--with-fop],
2447fbfaf8f3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2448fbfaf8f3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2449fbfaf8f3Smrgm4_undefine([_defopt])
2450fbfaf8f3Smrg
2451fbfaf8f3Smrgif test "x$use_fop" = x"auto"; then
2452fbfaf8f3Smrg   AC_PATH_PROG([FOP], [fop])
2453fbfaf8f3Smrg   if test "x$FOP" = "x"; then
2454fbfaf8f3Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2455fbfaf8f3Smrg	have_fop=no
2456fbfaf8f3Smrg   else
2457fbfaf8f3Smrg        have_fop=yes
2458fbfaf8f3Smrg   fi
2459fbfaf8f3Smrgelif test "x$use_fop" = x"yes" ; then
2460fbfaf8f3Smrg   AC_PATH_PROG([FOP], [fop])
2461fbfaf8f3Smrg   if test "x$FOP" = "x"; then
2462fbfaf8f3Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2463fbfaf8f3Smrg   fi
2464fbfaf8f3Smrg   have_fop=yes
2465fbfaf8f3Smrgelif test "x$use_fop" = x"no" ; then
2466fbfaf8f3Smrg   if test "x$FOP" != "x"; then
2467fbfaf8f3Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2468fbfaf8f3Smrg   fi
2469fbfaf8f3Smrg   have_fop=no
2470fbfaf8f3Smrgelse
2471fbfaf8f3Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
247243f32c10Smrgfi
247343f32c10Smrg
2474fbfaf8f3Smrg# Test for a minimum version of fop, if provided.
2475fbfaf8f3Smrgm4_ifval([$1],
2476fbfaf8f3Smrg[if test "$have_fop" = yes; then
2477fbfaf8f3Smrg    # scrape the fop version
2478fbfaf8f3Smrg    AC_MSG_CHECKING([for fop minimum version])
2479fbfaf8f3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2480fbfaf8f3Smrg    AC_MSG_RESULT([$fop_version])
2481fbfaf8f3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2482fbfaf8f3Smrg        [if test "x$use_fop" = xauto; then
2483fbfaf8f3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2484fbfaf8f3Smrg            have_fop=no
2485fbfaf8f3Smrg        else
2486fbfaf8f3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2487fbfaf8f3Smrg        fi])
2488fbfaf8f3Smrgfi])
2489fbfaf8f3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2490fbfaf8f3Smrg]) # XORG_WITH_FOP
249143f32c10Smrg
2492fbfaf8f3Smrg# XORG_WITH_M4([MIN-VERSION])
2493fbfaf8f3Smrg# ---------------------------
2494fbfaf8f3Smrg# Minimum version: 1.19.0
249543f32c10Smrg#
2496fbfaf8f3Smrg# This macro attempts to locate an m4 macro processor which supports
2497fbfaf8f3Smrg# -I option and is only useful for modules relying on M4 in order to
2498fbfaf8f3Smrg# expand macros in source code files.
2499fbfaf8f3Smrg#
2500fbfaf8f3Smrg# Interface to module:
2501fbfaf8f3Smrg# M4:	 	returns the path of the m4 program found
2502fbfaf8f3Smrg#		returns the path set by the user in the environment
2503fbfaf8f3Smrg#
2504fbfaf8f3SmrgAC_DEFUN([XORG_WITH_M4], [
2505fbfaf8f3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2506fbfaf8f3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2507fbfaf8f3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2508fbfaf8f3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2509fbfaf8f3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2510fbfaf8f3Smrg   [$PATH:/usr/gnu/bin])])
251143f32c10Smrg
2512fbfaf8f3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2513fbfaf8f3Smrg]) # XORG_WITH_M4
2514fbfaf8f3Smrg
2515fbfaf8f3Smrg# XORG_WITH_PS2PDF([DEFAULT])
2516fbfaf8f3Smrg# ----------------
2517fbfaf8f3Smrg# Minimum version: 1.6.0
2518fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2519fbfaf8f3Smrg#
2520fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2521fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2522fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523fbfaf8f3Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2524fbfaf8f3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2525fbfaf8f3Smrg# --with-ps2pdf assumes 'auto'.
2526fbfaf8f3Smrg#
2527fbfaf8f3Smrg# Interface to module:
2528fbfaf8f3Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2529fbfaf8f3Smrg# PS2PDF:	returns the path of the ps2pdf program found
2530fbfaf8f3Smrg#		returns the path set by the user in the environment
2531fbfaf8f3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2532fbfaf8f3Smrg#		 'no' user instructs the module not to use ps2pdf
2533fbfaf8f3Smrg#
2534fbfaf8f3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2535fbfaf8f3Smrg#
2536fbfaf8f3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2537fbfaf8f3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2538fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539fbfaf8f3SmrgAC_ARG_WITH(ps2pdf,
2540fbfaf8f3Smrg	AS_HELP_STRING([--with-ps2pdf],
2541fbfaf8f3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2542fbfaf8f3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2543fbfaf8f3Smrgm4_undefine([_defopt])
254443f32c10Smrg
2545fbfaf8f3Smrgif test "x$use_ps2pdf" = x"auto"; then
2546fbfaf8f3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2547fbfaf8f3Smrg   if test "x$PS2PDF" = "x"; then
2548fbfaf8f3Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2549fbfaf8f3Smrg	have_ps2pdf=no
2550fbfaf8f3Smrg   else
2551fbfaf8f3Smrg        have_ps2pdf=yes
2552fbfaf8f3Smrg   fi
2553fbfaf8f3Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2554fbfaf8f3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2555fbfaf8f3Smrg   if test "x$PS2PDF" = "x"; then
2556fbfaf8f3Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2557fbfaf8f3Smrg   fi
2558fbfaf8f3Smrg   have_ps2pdf=yes
2559fbfaf8f3Smrgelif test "x$use_ps2pdf" = x"no" ; then
2560fbfaf8f3Smrg   if test "x$PS2PDF" != "x"; then
2561fbfaf8f3Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2562fbfaf8f3Smrg   fi
2563fbfaf8f3Smrg   have_ps2pdf=no
2564fbfaf8f3Smrgelse
2565fbfaf8f3Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566fbfaf8f3Smrgfi
2567fbfaf8f3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2568fbfaf8f3Smrg]) # XORG_WITH_PS2PDF
256943f32c10Smrg
2570fbfaf8f3Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2571fbfaf8f3Smrg# ----------------
2572fbfaf8f3Smrg# Minimum version: 1.6.0
257343f32c10Smrg#
2574fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2575fbfaf8f3Smrg# not at the appropriate level. This macro enables a builder to skip all
2576fbfaf8f3Smrg# documentation targets except traditional man pages.
2577fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2579fbfaf8f3Smrg# Refer to:
2580fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2581fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2582fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2583fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2584fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2585fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586fbfaf8f3Smrg#
2587fbfaf8f3Smrg# Interface to module:
2588fbfaf8f3Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2589fbfaf8f3Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2590fbfaf8f3Smrg#		 'no' user instructs the module not to generate docs
2591fbfaf8f3Smrg# parm1:	specify the default value, yes or no.
2592fbfaf8f3Smrg#
2593fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2594fbfaf8f3Smrgm4_define([docs_default], m4_default([$1], [yes]))
2595fbfaf8f3SmrgAC_ARG_ENABLE(docs,
2596fbfaf8f3Smrg	AS_HELP_STRING([--enable-docs],
2597fbfaf8f3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2598fbfaf8f3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2599fbfaf8f3Smrgm4_undefine([docs_default])
2600fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2601fbfaf8f3SmrgAC_MSG_CHECKING([whether to build documentation])
2602fbfaf8f3SmrgAC_MSG_RESULT([$build_docs])
2603fbfaf8f3Smrg]) # XORG_ENABLE_DOCS
260443f32c10Smrg
2605fbfaf8f3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2606fbfaf8f3Smrg# ----------------
2607fbfaf8f3Smrg# Minimum version: 1.6.0
2608fbfaf8f3Smrg#
2609fbfaf8f3Smrg# This macro enables a builder to skip all developer documentation.
2610fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2612fbfaf8f3Smrg# Refer to:
2613fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2614fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2615fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2616fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2617fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2618fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619fbfaf8f3Smrg#
2620fbfaf8f3Smrg# Interface to module:
2621fbfaf8f3Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2622fbfaf8f3Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2623fbfaf8f3Smrg#			'no' user instructs the module not to generate developer docs
2624fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2625fbfaf8f3Smrg#
2626fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2627fbfaf8f3Smrgm4_define([devel_default], m4_default([$1], [yes]))
2628fbfaf8f3SmrgAC_ARG_ENABLE(devel-docs,
2629fbfaf8f3Smrg	AS_HELP_STRING([--enable-devel-docs],
2630fbfaf8f3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2631fbfaf8f3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2632fbfaf8f3Smrgm4_undefine([devel_default])
2633fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2634fbfaf8f3SmrgAC_MSG_CHECKING([whether to build developer documentation])
2635fbfaf8f3SmrgAC_MSG_RESULT([$build_devel_docs])
2636fbfaf8f3Smrg]) # XORG_ENABLE_DEVEL_DOCS
263743f32c10Smrg
2638fbfaf8f3Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2639fbfaf8f3Smrg# ----------------
2640fbfaf8f3Smrg# Minimum version: 1.6.0
264143f32c10Smrg#
2642fbfaf8f3Smrg# This macro enables a builder to skip all functional specification targets.
2643fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2645fbfaf8f3Smrg# Refer to:
2646fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2647fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2648fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2649fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2650fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2651fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652fbfaf8f3Smrg#
2653fbfaf8f3Smrg# Interface to module:
2654fbfaf8f3Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2655fbfaf8f3Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2656fbfaf8f3Smrg#			'no' user instructs the module not to generate specs
2657fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2658fbfaf8f3Smrg#
2659fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2660fbfaf8f3Smrgm4_define([spec_default], m4_default([$1], [yes]))
2661fbfaf8f3SmrgAC_ARG_ENABLE(specs,
2662fbfaf8f3Smrg	AS_HELP_STRING([--enable-specs],
2663fbfaf8f3Smrg	   [Enable building the specs (default: ]spec_default[)]),
2664fbfaf8f3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2665fbfaf8f3Smrgm4_undefine([spec_default])
2666fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2667fbfaf8f3SmrgAC_MSG_CHECKING([whether to build functional specifications])
2668fbfaf8f3SmrgAC_MSG_RESULT([$build_specs])
2669fbfaf8f3Smrg]) # XORG_ENABLE_SPECS
267043f32c10Smrg
2671fbfaf8f3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2672fbfaf8f3Smrg# ----------------------------------------------
2673fbfaf8f3Smrg# Minimum version: 1.13.0
2674fbfaf8f3Smrg#
2675fbfaf8f3Smrg# This macro enables a builder to enable/disable unit testing
2676fbfaf8f3Smrg# It makes no assumption about the test cases implementation
2677fbfaf8f3Smrg# Test cases may or may not use Automake "Support for test suites"
2678fbfaf8f3Smrg# They may or may not use the software utility library GLib
2679fbfaf8f3Smrg#
2680fbfaf8f3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2681fbfaf8f3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2682fbfaf8f3Smrg# The variable enable_unit_tests is used by other macros in this file.
2683fbfaf8f3Smrg#
2684fbfaf8f3Smrg# Interface to module:
2685fbfaf8f3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2686fbfaf8f3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2687fbfaf8f3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2688fbfaf8f3Smrg#			'no' user instructs the module not to build tests
2689fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2690fbfaf8f3Smrg#
2691fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2692fbfaf8f3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2693fbfaf8f3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2694fbfaf8f3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2695fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2696fbfaf8f3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2697fbfaf8f3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2698fbfaf8f3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2699fbfaf8f3Smrgm4_undefine([_defopt])
2700fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2701fbfaf8f3SmrgAC_MSG_CHECKING([whether to build unit test cases])
2702fbfaf8f3SmrgAC_MSG_RESULT([$enable_unit_tests])
2703fbfaf8f3Smrg]) # XORG_ENABLE_UNIT_TESTS
270443f32c10Smrg
2705fbfaf8f3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2706fbfaf8f3Smrg# ------------------------------------------------------
2707fbfaf8f3Smrg# Minimum version: 1.17.0
2708fbfaf8f3Smrg#
2709fbfaf8f3Smrg# This macro enables a builder to enable/disable integration testing
2710fbfaf8f3Smrg# It makes no assumption about the test cases' implementation
2711fbfaf8f3Smrg# Test cases may or may not use Automake "Support for test suites"
2712fbfaf8f3Smrg#
2713fbfaf8f3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2714fbfaf8f3Smrg# usually requires less dependencies and may be built and run under less
2715fbfaf8f3Smrg# stringent environments than integration tests.
2716fbfaf8f3Smrg#
2717fbfaf8f3Smrg# Interface to module:
2718fbfaf8f3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2719fbfaf8f3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2720fbfaf8f3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2721fbfaf8f3Smrg#                             'no' user instructs the module not to build tests
2722fbfaf8f3Smrg# parm1:                      specify the default value, yes or no.
2723fbfaf8f3Smrg#
2724fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2725fbfaf8f3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2726fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2727fbfaf8f3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2728fbfaf8f3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2729fbfaf8f3Smrg	[enable_integration_tests=$enableval],
2730fbfaf8f3Smrg	[enable_integration_tests=]_defopt)
2731fbfaf8f3Smrgm4_undefine([_defopt])
2732fbfaf8f3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2733fbfaf8f3Smrg	[test "x$enable_integration_tests" != xno])
2734fbfaf8f3SmrgAC_MSG_CHECKING([whether to build unit test cases])
2735fbfaf8f3SmrgAC_MSG_RESULT([$enable_integration_tests])
2736fbfaf8f3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
27376ef05171Smrg
2738fbfaf8f3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2739fbfaf8f3Smrg# ----------------------------------------
2740fbfaf8f3Smrg# Minimum version: 1.13.0
2741fbfaf8f3Smrg#
2742fbfaf8f3Smrg# GLib is a library which provides advanced data structures and functions.
2743fbfaf8f3Smrg# This macro enables a module to test for the presence of Glib.
2744fbfaf8f3Smrg#
2745fbfaf8f3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2746fbfaf8f3Smrg# Otherwise the value of $enable_unit_tests is blank.
2747fbfaf8f3Smrg#
2748fbfaf8f3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2749fbfaf8f3Smrg# test support usually requires less dependencies and may be built and run under
2750fbfaf8f3Smrg# less stringent environments than integration tests.
2751fbfaf8f3Smrg#
2752fbfaf8f3Smrg# Interface to module:
2753fbfaf8f3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2754fbfaf8f3Smrg# with_glib: used in configure.ac to know if GLib has been found
2755fbfaf8f3Smrg# --with-glib:	'yes' user instructs the module to use glib
2756fbfaf8f3Smrg#		'no' user instructs the module not to use glib
2757fbfaf8f3Smrg#
2758fbfaf8f3SmrgAC_DEFUN([XORG_WITH_GLIB],[
2759fbfaf8f3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2760fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2761fbfaf8f3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2762fbfaf8f3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2763fbfaf8f3Smrg	[with_glib=$withval], [with_glib=]_defopt)
2764fbfaf8f3Smrgm4_undefine([_defopt])
2765fbfaf8f3Smrg
2766fbfaf8f3Smrghave_glib=no
2767fbfaf8f3Smrg# Do not probe GLib if user explicitly disabled unit testing
2768fbfaf8f3Smrgif test "x$enable_unit_tests" != x"no"; then
2769fbfaf8f3Smrg  # Do not probe GLib if user explicitly disabled it
2770fbfaf8f3Smrg  if test "x$with_glib" != x"no"; then
2771fbfaf8f3Smrg    m4_ifval(
2772fbfaf8f3Smrg      [$1],
2773fbfaf8f3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2774fbfaf8f3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2775fbfaf8f3Smrg    )
277643f32c10Smrg  fi
277743f32c10Smrgfi
277843f32c10Smrg
2779fbfaf8f3Smrg# Not having GLib when unit testing has been explicitly requested is an error
2780fbfaf8f3Smrgif test "x$enable_unit_tests" = x"yes"; then
2781fbfaf8f3Smrg  if test "x$have_glib" = x"no"; then
2782fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
278343f32c10Smrg  fi
278443f32c10Smrgfi
278543f32c10Smrg
2786fbfaf8f3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2787fbfaf8f3Smrgif test "x$enable_unit_tests" = x"no"; then
2788fbfaf8f3Smrg  if test "x$with_glib" = x"yes"; then
2789fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2790fbfaf8f3Smrg  fi
2791fbfaf8f3Smrgfi
279243f32c10Smrg
2793fbfaf8f3Smrg# Not having GLib when it has been explicitly requested is an error
2794fbfaf8f3Smrgif test "x$with_glib" = x"yes"; then
2795fbfaf8f3Smrg  if test "x$have_glib" = x"no"; then
2796fbfaf8f3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2797fbfaf8f3Smrg  fi
2798fbfaf8f3Smrgfi
27996ef05171Smrg
2800fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2801fbfaf8f3Smrg]) # XORG_WITH_GLIB
28026ef05171Smrg
2803fbfaf8f3Smrg# XORG_LD_WRAP([required|optional])
2804fbfaf8f3Smrg# ---------------------------------
2805fbfaf8f3Smrg# Minimum version: 1.13.0
2806fbfaf8f3Smrg#
2807fbfaf8f3Smrg# Check if linker supports -wrap, passed via compiler flags
2808fbfaf8f3Smrg#
2809fbfaf8f3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2810fbfaf8f3Smrg# Otherwise the value of $enable_unit_tests is blank.
2811fbfaf8f3Smrg#
2812fbfaf8f3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2813fbfaf8f3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2814fbfaf8f3Smrg# available, an argument of "optional" allows use when some unit tests require
2815fbfaf8f3Smrg# ld -wrap and others do not.
2816fbfaf8f3Smrg#
2817fbfaf8f3SmrgAC_DEFUN([XORG_LD_WRAP],[
2818fbfaf8f3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2819fbfaf8f3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2820fbfaf8f3Smrg                      void __wrap_exit(int status) { return; }],
2821fbfaf8f3Smrg                     [exit(0);])])
2822fbfaf8f3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2823fbfaf8f3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2824fbfaf8f3Smrg  if test "x$have_ld_wrap" = x"no"; then
2825fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2826fbfaf8f3Smrg  fi
2827fbfaf8f3Smrgfi
2828fbfaf8f3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2829fbfaf8f3Smrg#
2830fbfaf8f3Smrg]) # XORG_LD_WRAP
28316ef05171Smrg
2832fbfaf8f3Smrg# XORG_CHECK_LINKER_FLAGS
2833fbfaf8f3Smrg# -----------------------
2834fbfaf8f3Smrg# SYNOPSIS
2835fbfaf8f3Smrg#
2836fbfaf8f3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2837fbfaf8f3Smrg#
2838fbfaf8f3Smrg# DESCRIPTION
2839fbfaf8f3Smrg#
2840fbfaf8f3Smrg#   Check whether the given linker FLAGS work with the current language's
2841fbfaf8f3Smrg#   linker, or whether they give an error.
2842fbfaf8f3Smrg#
2843fbfaf8f3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2844fbfaf8f3Smrg#   success/failure.
2845fbfaf8f3Smrg#
2846fbfaf8f3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2847fbfaf8f3Smrg#
2848fbfaf8f3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2849fbfaf8f3Smrg#
2850fbfaf8f3Smrg# LICENSE
2851fbfaf8f3Smrg#
2852fbfaf8f3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2853fbfaf8f3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2854fbfaf8f3Smrg#   Copyright (c) 2009 Matteo Frigo
2855fbfaf8f3Smrg#
2856fbfaf8f3Smrg#   This program is free software: you can redistribute it and/or modify it
2857fbfaf8f3Smrg#   under the terms of the GNU General Public License as published by the
2858fbfaf8f3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2859fbfaf8f3Smrg#   option) any later version.
2860fbfaf8f3Smrg#
2861fbfaf8f3Smrg#   This program is distributed in the hope that it will be useful, but
2862fbfaf8f3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2863fbfaf8f3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2864fbfaf8f3Smrg#   Public License for more details.
2865fbfaf8f3Smrg#
2866fbfaf8f3Smrg#   You should have received a copy of the GNU General Public License along
2867fbfaf8f3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2868fbfaf8f3Smrg#
2869fbfaf8f3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2870fbfaf8f3Smrg#   gives unlimited permission to copy, distribute and modify the configure
2871fbfaf8f3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2872fbfaf8f3Smrg#   need not follow the terms of the GNU General Public License when using
2873fbfaf8f3Smrg#   or distributing such scripts, even though portions of the text of the
2874fbfaf8f3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2875fbfaf8f3Smrg#   all other use of the material that constitutes the Autoconf Macro.
2876fbfaf8f3Smrg#
2877fbfaf8f3Smrg#   This special exception to the GPL applies to versions of the Autoconf
2878fbfaf8f3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2879fbfaf8f3Smrg#   modified version of the Autoconf Macro, you may extend this special
2880fbfaf8f3Smrg#   exception to the GPL to apply to your modified version as well.#
2881fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2882fbfaf8f3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2883fbfaf8f3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2884fbfaf8f3SmrgAS_LITERAL_IF([$1],
2885fbfaf8f3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2886fbfaf8f3Smrg      ax_save_FLAGS=$LDFLAGS
2887fbfaf8f3Smrg      LDFLAGS="$1"
2888fbfaf8f3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2889fbfaf8f3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2890fbfaf8f3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2891fbfaf8f3Smrg      LDFLAGS=$ax_save_FLAGS])],
2892fbfaf8f3Smrg  [ax_save_FLAGS=$LDFLAGS
2893fbfaf8f3Smrg   LDFLAGS="$1"
2894fbfaf8f3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2895fbfaf8f3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2896fbfaf8f3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2897fbfaf8f3Smrg   LDFLAGS=$ax_save_FLAGS])
2898fbfaf8f3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2899fbfaf8f3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2900fbfaf8f3Smrgif test "x$xorg_check_linker_flags" = xyes; then
2901fbfaf8f3Smrg	m4_default([$2], :)
2902fbfaf8f3Smrgelse
2903fbfaf8f3Smrg	m4_default([$3], :)
2904fbfaf8f3Smrgfi
2905fbfaf8f3Smrg]) # XORG_CHECK_LINKER_FLAGS
29066ef05171Smrg
2907fbfaf8f3Smrg# XORG_MEMORY_CHECK_FLAGS
2908fbfaf8f3Smrg# -----------------------
2909fbfaf8f3Smrg# Minimum version: 1.16.0
2910fbfaf8f3Smrg#
2911fbfaf8f3Smrg# This macro attempts to find appropriate memory checking functionality
2912fbfaf8f3Smrg# for various platforms which unit testing code may use to catch various
2913fbfaf8f3Smrg# forms of memory allocation and access errors in testing.
2914fbfaf8f3Smrg#
2915fbfaf8f3Smrg# Interface to module:
2916fbfaf8f3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2917fbfaf8f3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2918fbfaf8f3Smrg#
2919fbfaf8f3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2920fbfaf8f3Smrg#
2921fbfaf8f3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
29226ef05171Smrg
2923fbfaf8f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2924fbfaf8f3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2925fbfaf8f3Smrg           [Environment variables to enable memory checking in tests])
29266ef05171Smrg
2927fbfaf8f3Smrg# Check for different types of support on different platforms
2928fbfaf8f3Smrgcase $host_os in
2929fbfaf8f3Smrg    solaris*)
2930fbfaf8f3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2931fbfaf8f3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2932fbfaf8f3Smrg        ;;
2933fbfaf8f3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2934fbfaf8f3Smrg        # both directly and inverted, so should not be 0 or 255.
2935fbfaf8f3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2936fbfaf8f3Smrg        ;;
2937fbfaf8f3Smrg    darwin*)
2938fbfaf8f3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2939fbfaf8f3Smrg        ;;
2940fbfaf8f3Smrg    *bsd*)
2941fbfaf8f3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2942fbfaf8f3Smrg        ;;
2943fbfaf8f3Smrgesac
29446ef05171Smrg
2945fbfaf8f3Smrg# User supplied flags override default flags
2946fbfaf8f3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2947fbfaf8f3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
29486ef05171Smrgfi
294943f32c10Smrg
2950fbfaf8f3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2951fbfaf8f3Smrg]) # XORG_WITH_LINT
295243f32c10Smrg
2953fbfaf8f3Smrg# XORG_CHECK_MALLOC_ZERO
2954fbfaf8f3Smrg# ----------------------
2955fbfaf8f3Smrg# Minimum version: 1.0.0
295643f32c10Smrg#
2957fbfaf8f3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2958fbfaf8f3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2959fbfaf8f3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960d3173433Smrg#
2961d3173433Smrg# No longer actually tests since there is no guarantee applications will
2962d3173433Smrg# run with the same malloc implementation we tested against, and the cost
2963d3173433Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
2964d3173433Smrg# Still allows builders to override when they have complete control over
2965d3173433Smrg# which malloc implementation will be used.
2966fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2967fbfaf8f3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2968fbfaf8f3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2969d3173433Smrg		       [malloc(0) returns NULL (default: yes)]),
2970fbfaf8f3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2971d3173433Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
297243f32c10Smrg
2973fbfaf8f3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2974fbfaf8f3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
297543f32c10Smrg
2976fbfaf8f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2977fbfaf8f3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2978fbfaf8f3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2979fbfaf8f3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
298043f32c10Smrgelse
2981fbfaf8f3Smrg	MALLOC_ZERO_CFLAGS=""
2982fbfaf8f3Smrg	XMALLOC_ZERO_CFLAGS=""
2983fbfaf8f3Smrg	XTMALLOC_ZERO_CFLAGS=""
298443f32c10Smrgfi
298543f32c10Smrg
2986fbfaf8f3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2987fbfaf8f3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2988fbfaf8f3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2989fbfaf8f3Smrg]) # XORG_CHECK_MALLOC_ZERO
299043f32c10Smrg
2991fbfaf8f3Smrg# XORG_WITH_LINT()
2992fbfaf8f3Smrg# ----------------
2993fbfaf8f3Smrg# Minimum version: 1.1.0
299443f32c10Smrg#
2995fbfaf8f3Smrg# This macro enables the use of a tool that flags some suspicious and
2996fbfaf8f3Smrg# non-portable constructs (likely to be bugs) in C language source code.
2997fbfaf8f3Smrg# It will attempt to locate the tool and use appropriate options.
2998fbfaf8f3Smrg# There are various lint type tools on different platforms.
299943f32c10Smrg#
3000fbfaf8f3Smrg# Interface to module:
3001fbfaf8f3Smrg# LINT:		returns the path to the tool found on the platform
3002fbfaf8f3Smrg#		or the value set to LINT on the configure cmd line
3003fbfaf8f3Smrg#		also an Automake conditional
3004fbfaf8f3Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
3005fbfaf8f3Smrg#
3006fbfaf8f3Smrg# --with-lint:	'yes' user instructs the module to use lint
3007fbfaf8f3Smrg#		'no' user instructs the module not to use lint (default)
3008fbfaf8f3Smrg#
3009fbfaf8f3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3010fbfaf8f3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
3011fbfaf8f3Smrg#
3012fbfaf8f3SmrgAC_DEFUN([XORG_WITH_LINT],[
301343f32c10Smrg
3014fbfaf8f3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3015fbfaf8f3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3016fbfaf8f3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3017fbfaf8f3Smrg		[Use a lint-style source code checker (default: disabled)])],
3018fbfaf8f3Smrg		[use_lint=$withval], [use_lint=no])
301943f32c10Smrg
3020fbfaf8f3Smrg# Obtain platform specific info like program name and options
3021fbfaf8f3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3022fbfaf8f3Smrgcase $host_os in
3023fbfaf8f3Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3024fbfaf8f3Smrg	lint_name=splint
3025fbfaf8f3Smrg	lint_options="-badflag"
3026fbfaf8f3Smrg	;;
3027fbfaf8f3Smrg  *freebsd* | *netbsd*)
3028fbfaf8f3Smrg	lint_name=lint
3029fbfaf8f3Smrg	lint_options="-u -b"
3030fbfaf8f3Smrg	;;
3031fbfaf8f3Smrg  *solaris*)
3032fbfaf8f3Smrg	lint_name=lint
3033fbfaf8f3Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3034fbfaf8f3Smrg	;;
3035fbfaf8f3Smrgesac
3036fbfaf8f3Smrg
3037fbfaf8f3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3038fbfaf8f3Smrgif test "x$use_lint" = x"yes" ; then
3039fbfaf8f3Smrg   AC_PATH_PROG([LINT], [$lint_name])
3040fbfaf8f3Smrg   if test "x$LINT" = "x"; then
3041fbfaf8f3Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3042fbfaf8f3Smrg   fi
3043fbfaf8f3Smrgelif test "x$use_lint" = x"no" ; then
3044fbfaf8f3Smrg   if test "x$LINT" != "x"; then
3045fbfaf8f3Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3046fbfaf8f3Smrg   fi
304743f32c10Smrgelse
3048fbfaf8f3Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
304943f32c10Smrgfi
305043f32c10Smrg
3051fbfaf8f3Smrg# User supplied flags override default flags
3052fbfaf8f3Smrgif test "x$LINT_FLAGS" != "x"; then
3053fbfaf8f3Smrg   lint_options=$LINT_FLAGS
3054fbfaf8f3Smrgfi
305543f32c10Smrg
3056fbfaf8f3SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3057fbfaf8f3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
305843f32c10Smrg
3059fbfaf8f3Smrg]) # XORG_WITH_LINT
306043f32c10Smrg
3061fbfaf8f3Smrg# XORG_LINT_LIBRARY(LIBNAME)
3062fbfaf8f3Smrg# --------------------------
3063fbfaf8f3Smrg# Minimum version: 1.1.0
30646ef05171Smrg#
3065fbfaf8f3Smrg# Sets up flags for building lint libraries for checking programs that call
3066fbfaf8f3Smrg# functions in the library.
3067fbfaf8f3Smrg#
3068fbfaf8f3Smrg# Interface to module:
3069fbfaf8f3Smrg# LINTLIB		- Automake variable with the name of lint library file to make
3070fbfaf8f3Smrg# MAKE_LINT_LIB		- Automake conditional
3071fbfaf8f3Smrg#
3072fbfaf8f3Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3073fbfaf8f3Smrg#			  - 'no' user instructs the module not to create a lint library (default)
30746ef05171Smrg
3075fbfaf8f3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
3076fbfaf8f3SmrgAC_REQUIRE([XORG_WITH_LINT])
3077fbfaf8f3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3078fbfaf8f3Smrg	[Create lint library (default: disabled)])],
3079fbfaf8f3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080fbfaf8f3Smrg
3081fbfaf8f3Smrgif test "x$make_lint_lib" = x"yes" ; then
3082fbfaf8f3Smrg   LINTLIB=llib-l$1.ln
3083fbfaf8f3Smrg   if test "x$LINT" = "x"; then
3084fbfaf8f3Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3085fbfaf8f3Smrg   fi
3086fbfaf8f3Smrgelif test "x$make_lint_lib" != x"no" ; then
3087fbfaf8f3Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30886ef05171Smrgfi
30896ef05171Smrg
3090fbfaf8f3SmrgAC_SUBST(LINTLIB)
3091fbfaf8f3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
309243f32c10Smrg
3093fbfaf8f3Smrg]) # XORG_LINT_LIBRARY
309443f32c10Smrg
3095fbfaf8f3Smrg# XORG_COMPILER_BRAND
30966ef05171Smrg# -------------------
3097fbfaf8f3Smrg# Minimum version: 1.14.0
30986ef05171Smrg#
3099fbfaf8f3Smrg# Checks for various brands of compilers and sets flags as appropriate:
3100fbfaf8f3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3101fbfaf8f3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3102fbfaf8f3Smrg#   clang compiler - sets CLANGCC to "yes"
3103fbfaf8f3Smrg#   Intel compiler - sets INTELCC to "yes"
3104fbfaf8f3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3105fbfaf8f3Smrg#
3106fbfaf8f3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
3107fbfaf8f3SmrgAC_LANG_CASE(
3108fbfaf8f3Smrg	[C], [
3109fbfaf8f3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110fbfaf8f3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111fbfaf8f3Smrg		m4_version_prereq([2.70],
3112fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC])],
3113fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3114fbfaf8f3Smrg	],
3115fbfaf8f3Smrg	[C++], [
3116fbfaf8f3Smrg		AC_REQUIRE([AC_PROG_CXX])
3117fbfaf8f3Smrg	]
3118fbfaf8f3Smrg)
3119fbfaf8f3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3120fbfaf8f3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3121fbfaf8f3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3122fbfaf8f3Smrg]) # XORG_COMPILER_BRAND
312343f32c10Smrg
3124fbfaf8f3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
312543f32c10Smrg# ---------------
3126fbfaf8f3Smrg# Minimum version: 1.16.0
3127fbfaf8f3Smrg#
3128fbfaf8f3Smrg# Test if the compiler works when passed the given flag as a command line argument.
3129fbfaf8f3Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
3130fbfaf8f3Smrg# next flag in the list until there are no more options.
3131fbfaf8f3Smrg#
3132fbfaf8f3Smrg# Note that this does not guarantee that the compiler supports the flag as some
3133fbfaf8f3Smrg# compilers will simply ignore arguments that they do not understand, but we do
3134fbfaf8f3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
3135fbfaf8f3Smrg# -Werror=unused-command-line-argument
3136fbfaf8f3Smrg#
3137fbfaf8f3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
3138fbfaf8f3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3139fbfaf8f3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31406ef05171Smrg
3141fbfaf8f3SmrgAC_LANG_COMPILER_REQUIRE
31426ef05171Smrg
3143fbfaf8f3SmrgAC_LANG_CASE(
3144fbfaf8f3Smrg	[C], [
3145fbfaf8f3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146fbfaf8f3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147fbfaf8f3Smrg		m4_version_prereq([2.70],
3148fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC])],
3149fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3150fbfaf8f3Smrg		define([PREFIX], [C])
3151fbfaf8f3Smrg		define([CACHE_PREFIX], [cc])
3152fbfaf8f3Smrg		define([COMPILER], [$CC])
3153fbfaf8f3Smrg	],
3154fbfaf8f3Smrg	[C++], [
3155fbfaf8f3Smrg		define([PREFIX], [CXX])
3156fbfaf8f3Smrg		define([CACHE_PREFIX], [cxx])
3157fbfaf8f3Smrg		define([COMPILER], [$CXX])
3158fbfaf8f3Smrg	]
3159fbfaf8f3Smrg)
3160fbfaf8f3Smrg
3161fbfaf8f3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162fbfaf8f3Smrg
3163fbfaf8f3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3164fbfaf8f3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3165fbfaf8f3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3166fbfaf8f3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3167fbfaf8f3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3168fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3169fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3170fbfaf8f3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3171fbfaf8f3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
317243f32c10Smrgfi
3173fbfaf8f3Smrg
3174fbfaf8f3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3175fbfaf8f3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3176fbfaf8f3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3177fbfaf8f3Smrg	fi
3178fbfaf8f3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3179fbfaf8f3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3180fbfaf8f3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3181fbfaf8f3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3182fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3183fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3184fbfaf8f3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3185fbfaf8f3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31866ef05171Smrgfi
3187fbfaf8f3Smrg
3188fbfaf8f3Smrgfound="no"
3189fbfaf8f3Smrgm4_foreach([flag], m4_cdr($@), [
3190fbfaf8f3Smrg	if test $found = "no" ; then
3191fbfaf8f3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3192fbfaf8f3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3193fbfaf8f3Smrg		fi
3194fbfaf8f3Smrg
3195fbfaf8f3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3196fbfaf8f3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3197fbfaf8f3Smrg		fi
3198fbfaf8f3Smrg
3199fbfaf8f3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200fbfaf8f3Smrg
3201fbfaf8f3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3202fbfaf8f3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3203fbfaf8f3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3204fbfaf8f3Smrg		AC_CACHE_VAL($cacheid,
3205fbfaf8f3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3206fbfaf8f3Smrg					     [eval $cacheid=yes],
3207fbfaf8f3Smrg					     [eval $cacheid=no])])
3208fbfaf8f3Smrg
3209fbfaf8f3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210fbfaf8f3Smrg
3211fbfaf8f3Smrg		eval supported=\$$cacheid
3212fbfaf8f3Smrg		AC_MSG_RESULT([$supported])
3213fbfaf8f3Smrg		if test "$supported" = "yes" ; then
3214fbfaf8f3Smrg			$1="$$1 ]flag["
3215fbfaf8f3Smrg			found="yes"
3216fbfaf8f3Smrg		fi
3217fbfaf8f3Smrg	fi
32186ef05171Smrg])
3219fbfaf8f3Smrg]) # XORG_TESTSET_CFLAG
322043f32c10Smrg
3221fbfaf8f3Smrg# XORG_COMPILER_FLAGS
3222fbfaf8f3Smrg# ---------------
3223fbfaf8f3Smrg# Minimum version: 1.16.0
32246ef05171Smrg#
3225fbfaf8f3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3226fbfaf8f3Smrg# arguments supported by the selected compiler which do NOT alter the generated
3227fbfaf8f3Smrg# code.  These arguments will cause the compiler to print various warnings
3228fbfaf8f3Smrg# during compilation AND turn a conservative set of warnings into errors.
3229fbfaf8f3Smrg#
3230fbfaf8f3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3231fbfaf8f3Smrg# future versions of util-macros as options are added to new compilers.
3232fbfaf8f3Smrg#
3233fbfaf8f3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3234fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
32356ef05171Smrg
3236fbfaf8f3SmrgAC_ARG_ENABLE(selective-werror,
3237fbfaf8f3Smrg              AS_HELP_STRING([--disable-selective-werror],
3238fbfaf8f3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3239fbfaf8f3Smrg              [SELECTIVE_WERROR=$enableval],
3240fbfaf8f3Smrg              [SELECTIVE_WERROR=yes])
3241fbfaf8f3Smrg
3242fbfaf8f3SmrgAC_LANG_CASE(
3243fbfaf8f3Smrg        [C], [
3244fbfaf8f3Smrg                define([PREFIX], [C])
3245fbfaf8f3Smrg        ],
3246fbfaf8f3Smrg        [C++], [
3247fbfaf8f3Smrg                define([PREFIX], [CXX])
3248fbfaf8f3Smrg        ]
3249fbfaf8f3Smrg)
3250fbfaf8f3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3251fbfaf8f3Smrgif test "x$SUNCC" = "xyes"; then
3252fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]="-v"
32536ef05171Smrgelse
3254fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]=""
32556ef05171Smrgfi
32566ef05171Smrg
3257fbfaf8f3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3258fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3259fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3260fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3261fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
326243f32c10Smrg
3263fbfaf8f3SmrgAC_LANG_CASE(
3264fbfaf8f3Smrg	[C], [
3265fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3266fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3267fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3268fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3269fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3270fbfaf8f3Smrg	]
3271fbfaf8f3Smrg)
327243f32c10Smrg
3273fbfaf8f3Smrg# This chunk adds additional warnings that could catch undesired effects.
3274fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3275fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3276fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3277fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3278fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3279fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3280fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
328143f32c10Smrg
3282fbfaf8f3Smrg# These are currently disabled because they are noisy.  They will be enabled
3283fbfaf8f3Smrg# in the future once the codebase is sufficiently modernized to silence
3284fbfaf8f3Smrg# them.  For now, I don't want them to drown out the other warnings.
3285fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3286fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3287fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
328843f32c10Smrg
3289fbfaf8f3Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3290fbfaf8f3Smrg# when there are problems that should be fixed.
32916ef05171Smrg
3292fbfaf8f3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3293fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3294fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3295fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3296fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3297fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3298fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3299fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3300fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3301fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3302fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3303fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3304fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3305fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3306fbfaf8f3Smrgelse
3307fbfaf8f3SmrgAC_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])
3308fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3309fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3310fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3311fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3312fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3313fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3314fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3315fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3316fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3317fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3318fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3319fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3320fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3321fbfaf8f3Smrgfi
3322fbfaf8f3Smrg
3323fbfaf8f3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3324fbfaf8f3Smrg]) # XORG_COMPILER_FLAGS
332543f32c10Smrg
3326fbfaf8f3Smrg# XORG_CWARNFLAGS
3327fbfaf8f3Smrg# ---------------
3328fbfaf8f3Smrg# Minimum version: 1.2.0
3329fbfaf8f3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
333043f32c10Smrg#
3331fbfaf8f3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3332fbfaf8f3Smrg#
3333fbfaf8f3Smrg# This function is deprecated because it defines -fno-strict-aliasing
3334fbfaf8f3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3335fbfaf8f3Smrg# is needed, then it should be added explicitly in the module when
3336fbfaf8f3Smrg# it is updated to use BASE_CFLAGS.
3337fbfaf8f3Smrg#
3338fbfaf8f3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3339fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3340fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3341fbfaf8f3SmrgAC_LANG_CASE(
3342fbfaf8f3Smrg	[C], [
3343fbfaf8f3Smrg		CWARNFLAGS="$BASE_CFLAGS"
3344fbfaf8f3Smrg		if  test "x$GCC" = xyes ; then
3345fbfaf8f3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3346fbfaf8f3Smrg		fi
3347fbfaf8f3Smrg		AC_SUBST(CWARNFLAGS)
3348fbfaf8f3Smrg	]
3349fbfaf8f3Smrg)
3350fbfaf8f3Smrg]) # XORG_CWARNFLAGS
335143f32c10Smrg
3352fbfaf8f3Smrg# XORG_STRICT_OPTION
3353fbfaf8f3Smrg# -----------------------
3354fbfaf8f3Smrg# Minimum version: 1.3.0
335543f32c10Smrg#
3356fbfaf8f3Smrg# Add configure option to enable strict compilation flags, such as treating
3357fbfaf8f3Smrg# warnings as fatal errors.
3358fbfaf8f3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3359fbfaf8f3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33606ef05171Smrg#
3361fbfaf8f3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3362fbfaf8f3Smrg# when strict compilation is unconditionally desired.
3363fbfaf8f3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3364fbfaf8f3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3365fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
336643f32c10Smrg
3367fbfaf8f3SmrgAC_ARG_ENABLE(strict-compilation,
3368fbfaf8f3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3369fbfaf8f3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3370fbfaf8f3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
33716ef05171Smrg
3372fbfaf8f3SmrgAC_LANG_CASE(
3373fbfaf8f3Smrg        [C], [
3374fbfaf8f3Smrg                define([PREFIX], [C])
3375fbfaf8f3Smrg        ],
3376fbfaf8f3Smrg        [C++], [
3377fbfaf8f3Smrg                define([PREFIX], [CXX])
3378fbfaf8f3Smrg        ]
3379fbfaf8f3Smrg)
33806ef05171Smrg
3381fbfaf8f3Smrg[STRICT_]PREFIX[FLAGS]=""
3382fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3383fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
33846ef05171Smrg
3385fbfaf8f3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3386fbfaf8f3Smrg# activate it with -Werror, so we add it here explicitly.
3387fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
33886ef05171Smrg
3389fbfaf8f3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3390fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3391fbfaf8f3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392fbfaf8f3Smrgfi
3393fbfaf8f3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3394fbfaf8f3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3395fbfaf8f3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3396fbfaf8f3Smrg]) # XORG_STRICT_OPTION
33976ef05171Smrg
3398fbfaf8f3Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3399fbfaf8f3Smrg# ---------------------------
3400fbfaf8f3Smrg# Minimum version: 1.20.0
3401fbfaf8f3Smrg#
3402fbfaf8f3Smrg# Defines default options for X.Org modules which don't compile code,
3403fbfaf8f3Smrg# such as fonts, bitmaps, cursors, and docs.
3404fbfaf8f3Smrg#
3405fbfaf8f3SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406fbfaf8f3SmrgAC_REQUIRE([AC_PROG_INSTALL])
3407fbfaf8f3SmrgXORG_RELEASE_VERSION
3408fbfaf8f3SmrgXORG_CHANGELOG
3409fbfaf8f3SmrgXORG_INSTALL
3410fbfaf8f3SmrgXORG_MANPAGE_SECTIONS
3411fbfaf8f3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412fbfaf8f3Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413fbfaf8f3Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34146ef05171Smrg
3415fbfaf8f3Smrg# XORG_DEFAULT_OPTIONS
3416fbfaf8f3Smrg# --------------------
3417fbfaf8f3Smrg# Minimum version: 1.3.0
3418fbfaf8f3Smrg#
3419fbfaf8f3Smrg# Defines default options for X.Org modules which compile code.
3420fbfaf8f3Smrg#
3421fbfaf8f3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3422fbfaf8f3SmrgAC_REQUIRE([AC_PROG_INSTALL])
3423fbfaf8f3SmrgXORG_COMPILER_FLAGS
3424fbfaf8f3SmrgXORG_CWARNFLAGS
3425fbfaf8f3SmrgXORG_STRICT_OPTION
3426fbfaf8f3SmrgXORG_DEFAULT_NOCODE_OPTIONS
3427fbfaf8f3Smrg]) # XORG_DEFAULT_OPTIONS
342843f32c10Smrg
3429fbfaf8f3Smrg# XORG_INSTALL()
3430fbfaf8f3Smrg# ----------------
3431fbfaf8f3Smrg# Minimum version: 1.4.0
3432fbfaf8f3Smrg#
3433fbfaf8f3Smrg# Defines the variable INSTALL_CMD as the command to copy
3434fbfaf8f3Smrg# INSTALL from $prefix/share/util-macros.
3435fbfaf8f3Smrg#
3436fbfaf8f3SmrgAC_DEFUN([XORG_INSTALL], [
3437fbfaf8f3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3438fbfaf8f3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3439fbfaf8f3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3440fbfaf8f3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441fbfaf8f3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442fbfaf8f3Smrgtouch \$(top_srcdir)/INSTALL; \
3443fbfaf8f3Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3444fbfaf8f3SmrgAC_SUBST([INSTALL_CMD])
3445fbfaf8f3Smrg]) # XORG_INSTALL
3446fbfaf8f3Smrgdnl Copyright 2005 Red Hat, Inc
3447fbfaf8f3Smrgdnl
3448fbfaf8f3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3449fbfaf8f3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3450fbfaf8f3Smrgdnl the above copyright notice appear in all copies and that both that
3451fbfaf8f3Smrgdnl copyright notice and this permission notice appear in supporting
3452fbfaf8f3Smrgdnl documentation.
3453fbfaf8f3Smrgdnl
3454fbfaf8f3Smrgdnl The above copyright notice and this permission notice shall be included
3455fbfaf8f3Smrgdnl in all copies or substantial portions of the Software.
3456fbfaf8f3Smrgdnl
3457fbfaf8f3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3458fbfaf8f3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3459fbfaf8f3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3460fbfaf8f3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3461fbfaf8f3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3462fbfaf8f3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3463fbfaf8f3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3464fbfaf8f3Smrgdnl
3465fbfaf8f3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3466fbfaf8f3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3467fbfaf8f3Smrgdnl other dealings in this Software without prior written authorization
3468fbfaf8f3Smrgdnl from the copyright holders.
3469fbfaf8f3Smrgdnl
34706ef05171Smrg
3471fbfaf8f3Smrg# XORG_RELEASE_VERSION
3472fbfaf8f3Smrg# --------------------
3473fbfaf8f3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
347443f32c10Smrg
3475fbfaf8f3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3476fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3477fbfaf8f3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3478fbfaf8f3Smrg		[Major version of this package])
3479fbfaf8f3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3480fbfaf8f3Smrg	if test "x$PVM" = "x"; then
3481fbfaf8f3Smrg		PVM="0"
3482fbfaf8f3Smrg	fi
3483fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3484fbfaf8f3Smrg		[$PVM],
3485fbfaf8f3Smrg		[Minor version of this package])
3486fbfaf8f3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3487fbfaf8f3Smrg	if test "x$PVP" = "x"; then
3488fbfaf8f3Smrg		PVP="0"
3489fbfaf8f3Smrg	fi
3490fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3491fbfaf8f3Smrg		[$PVP],
3492fbfaf8f3Smrg		[Patch version of this package])
3493fbfaf8f3Smrg])
34946ef05171Smrg
3495fbfaf8f3Smrg# XORG_CHANGELOG()
3496fbfaf8f3Smrg# ----------------
3497fbfaf8f3Smrg# Minimum version: 1.2.0
3498fbfaf8f3Smrg#
3499fbfaf8f3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3500fbfaf8f3Smrg# ChangeLog from git.
3501fbfaf8f3Smrg#
3502fbfaf8f3Smrg#
3503fbfaf8f3SmrgAC_DEFUN([XORG_CHANGELOG], [
3504fbfaf8f3SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3505fbfaf8f3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506fbfaf8f3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507fbfaf8f3Smrgtouch \$(top_srcdir)/ChangeLog; \
3508fbfaf8f3Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3509fbfaf8f3SmrgAC_SUBST([CHANGELOG_CMD])
3510fbfaf8f3Smrg]) # XORG_CHANGELOG
351143f32c10Smrg
3512