aclocal.m4 revision fbfaf8f3
1fbfaf8f3Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
26ef05171Smrg
3fbfaf8f3Smrg# Copyright (C) 1996-2021 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
17fbfaf8f3Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18fbfaf8f3Smrg[m4_warning([this file was generated for autoconf 2.71.
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
23fbfaf8f3Smrg# Copyright (C) 2002-2021 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],
35fbfaf8f3Smrg[am__api_version='1.16'
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.
38fbfaf8f3Smrgm4_if([$1], [1.16.5], [],
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],
54fbfaf8f3Smrg[AM_AUTOMAKE_VERSION([1.16.5])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
61fbfaf8f3Smrg# Copyright (C) 2001-2021 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
113fbfaf8f3Smrg# Copyright (C) 1997-2021 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
144fbfaf8f3Smrg# Copyright (C) 1999-2021 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.
276fbfaf8f3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
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
335fbfaf8f3Smrg# Copyright (C) 1999-2021 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
403fbfaf8f3Smrg# Copyright (C) 1996-2021 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
537fbfaf8f3SmrgAC_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
545fbfaf8f3Smrg# POSIX will say in a future version that running "rm -f" with no argument
546fbfaf8f3Smrg# is OK; and we want to be able to make that assumption in our Makefile
547fbfaf8f3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
548fbfaf8f3Smrg# actually supported "in the wild" to an acceptable degree.
549fbfaf8f3Smrg# See automake bug#10828.
550fbfaf8f3Smrg# To make any issue more visible, cause the running configure to be aborted
551fbfaf8f3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
552fbfaf8f3Smrg# user can still override this though.
553fbfaf8f3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
554fbfaf8f3Smrg  cat >&2 <<'END'
555fbfaf8f3SmrgOops!
5566ef05171Smrg
557fbfaf8f3SmrgYour 'rm' program seems unable to run without file operands specified
558fbfaf8f3Smrgon the command line, even when the '-f' option is present.  This is contrary
559fbfaf8f3Smrgto the behaviour of most rm programs out there, and not conforming with
560fbfaf8f3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5616ef05171Smrg
562fbfaf8f3SmrgPlease tell bug-automake@gnu.org about your system, including the value
563fbfaf8f3Smrgof your $PATH and any error possibly output before this message.  This
564fbfaf8f3Smrgcan help us improve future automake versions.
56543f32c10Smrg
566fbfaf8f3SmrgEND
567fbfaf8f3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
568fbfaf8f3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
569fbfaf8f3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
570fbfaf8f3Smrg    echo >&2
571fbfaf8f3Smrg  else
572fbfaf8f3Smrg    cat >&2 <<'END'
573fbfaf8f3SmrgAborting the configuration process, to ensure you take notice of the issue.
5746ef05171Smrg
575fbfaf8f3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576fbfaf8f3Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577fbfaf8f3Smrg
578fbfaf8f3SmrgIf you want to complete the configuration process using your problematic
579fbfaf8f3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
580fbfaf8f3Smrgto "yes", and re-run configure.
581fbfaf8f3Smrg
582fbfaf8f3SmrgEND
583fbfaf8f3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
584fbfaf8f3Smrg  fi
5856ef05171Smrgfi
586fbfaf8f3Smrgdnl The trailing newline in this macro's definition is deliberate, for
587fbfaf8f3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588fbfaf8f3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589fbfaf8f3Smrg])
5906ef05171Smrg
591fbfaf8f3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592fbfaf8f3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593fbfaf8f3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594fbfaf8f3Smrgm4_define([_AC_COMPILER_EXEEXT],
595fbfaf8f3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5966ef05171Smrg
597fbfaf8f3Smrg# When config.status generates a header, we must update the stamp-h file.
598fbfaf8f3Smrg# This file resides in the same directory as the config header
599fbfaf8f3Smrg# that is generated.  The stamp files are numbered to have different names.
60043f32c10Smrg
601fbfaf8f3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602fbfaf8f3Smrg# loop where config.status creates the headers, so we can generate
603fbfaf8f3Smrg# our stamp files there.
604fbfaf8f3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605fbfaf8f3Smrg[# Compute $1's index in $config_headers.
606fbfaf8f3Smrg_am_arg=$1
607fbfaf8f3Smrg_am_stamp_count=1
608fbfaf8f3Smrgfor _am_header in $config_headers :; do
609fbfaf8f3Smrg  case $_am_header in
610fbfaf8f3Smrg    $_am_arg | $_am_arg:* )
611fbfaf8f3Smrg      break ;;
612fbfaf8f3Smrg    * )
613fbfaf8f3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614fbfaf8f3Smrg  esac
615fbfaf8f3Smrgdone
616fbfaf8f3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61743f32c10Smrg
618fbfaf8f3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619fbfaf8f3Smrg#
620fbfaf8f3Smrg# This file is free software; the Free Software Foundation
621fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
622fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
62343f32c10Smrg
624fbfaf8f3Smrg# AM_PROG_INSTALL_SH
625fbfaf8f3Smrg# ------------------
626fbfaf8f3Smrg# Define $install_sh.
627fbfaf8f3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629fbfaf8f3Smrgif test x"${install_sh+set}" != xset; then
630fbfaf8f3Smrg  case $am_aux_dir in
631fbfaf8f3Smrg  *\ * | *\	*)
632fbfaf8f3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633fbfaf8f3Smrg  *)
634fbfaf8f3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635fbfaf8f3Smrg  esac
63643f32c10Smrgfi
637fbfaf8f3SmrgAC_SUBST([install_sh])])
63843f32c10Smrg
639fbfaf8f3Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640fbfaf8f3Smrg#
641fbfaf8f3Smrg# This file is free software; the Free Software Foundation
642fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
643fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
64443f32c10Smrg
645fbfaf8f3Smrg# Check whether the underlying file-system supports filenames
646fbfaf8f3Smrg# with a leading dot.  For instance MS-DOS doesn't.
647fbfaf8f3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648fbfaf8f3Smrg[rm -rf .tst 2>/dev/null
649fbfaf8f3Smrgmkdir .tst 2>/dev/null
650fbfaf8f3Smrgif test -d .tst; then
651fbfaf8f3Smrg  am__leading_dot=.
65243f32c10Smrgelse
653fbfaf8f3Smrg  am__leading_dot=_
65443f32c10Smrgfi
655fbfaf8f3Smrgrmdir .tst 2>/dev/null
656fbfaf8f3SmrgAC_SUBST([am__leading_dot])])
65743f32c10Smrg
658fbfaf8f3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65943f32c10Smrg
660fbfaf8f3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661fbfaf8f3Smrg#
662fbfaf8f3Smrg# This file is free software; the Free Software Foundation
663fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
664fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
66543f32c10Smrg
666fbfaf8f3Smrg# AM_MAKE_INCLUDE()
667fbfaf8f3Smrg# -----------------
668fbfaf8f3Smrg# Check whether make has an 'include' directive that can support all
669fbfaf8f3Smrg# the idioms we need for our automatic dependency tracking code.
670fbfaf8f3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671fbfaf8f3Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672fbfaf8f3Smrgcat > confinc.mk << 'END'
673fbfaf8f3Smrgam__doit:
674fbfaf8f3Smrg	@echo this is the am__doit target >confinc.out
675fbfaf8f3Smrg.PHONY: am__doit
676fbfaf8f3SmrgEND
677fbfaf8f3Smrgam__include="#"
678fbfaf8f3Smrgam__quote=
679fbfaf8f3Smrg# BSD make does it like this.
680fbfaf8f3Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681fbfaf8f3Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682fbfaf8f3Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683fbfaf8f3Smrg_am_result=no
684fbfaf8f3Smrgfor s in GNU BSD; do
685fbfaf8f3Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686fbfaf8f3Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687fbfaf8f3Smrg      ['0:this is the am__doit target'],
688fbfaf8f3Smrg      [AS_CASE([$s],
689fbfaf8f3Smrg          [BSD], [am__include='.include' am__quote='"'],
690fbfaf8f3Smrg          [am__include='include' am__quote=''])])
691fbfaf8f3Smrg  if test "$am__include" != "#"; then
692fbfaf8f3Smrg    _am_result="yes ($s style)"
693fbfaf8f3Smrg    break
694fbfaf8f3Smrg  fi
695fbfaf8f3Smrgdone
696fbfaf8f3Smrgrm -f confinc.* confmf.*
697fbfaf8f3SmrgAC_MSG_RESULT([${_am_result}])
698fbfaf8f3SmrgAC_SUBST([am__include])])
699fbfaf8f3SmrgAC_SUBST([am__quote])])
70043f32c10Smrg
701fbfaf8f3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70243f32c10Smrg
703fbfaf8f3Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70443f32c10Smrg#
705fbfaf8f3Smrg# This file is free software; the Free Software Foundation
706fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
707fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
70843f32c10Smrg
709fbfaf8f3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710fbfaf8f3Smrg# ------------------------------
711fbfaf8f3SmrgAC_DEFUN([AM_MISSING_PROG],
712fbfaf8f3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713fbfaf8f3Smrg$1=${$1-"${am_missing_run}$2"}
714fbfaf8f3SmrgAC_SUBST($1)])
71543f32c10Smrg
716fbfaf8f3Smrg# AM_MISSING_HAS_RUN
717fbfaf8f3Smrg# ------------------
718fbfaf8f3Smrg# Define MISSING if not defined so far and test if it is modern enough.
719fbfaf8f3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720fbfaf8f3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722fbfaf8f3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723fbfaf8f3Smrgif test x"${MISSING+set}" != xset; then
724fbfaf8f3Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72543f32c10Smrgfi
726fbfaf8f3Smrg# Use eval to expand $SHELL
727fbfaf8f3Smrgif eval "$MISSING --is-lightweight"; then
728fbfaf8f3Smrg  am_missing_run="$MISSING "
729fbfaf8f3Smrgelse
730fbfaf8f3Smrg  am_missing_run=
731fbfaf8f3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73243f32c10Smrgfi
733fbfaf8f3Smrg])
73443f32c10Smrg
735fbfaf8f3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73643f32c10Smrg
737fbfaf8f3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738fbfaf8f3Smrg#
739fbfaf8f3Smrg# This file is free software; the Free Software Foundation
740fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
741fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
74243f32c10Smrg
743fbfaf8f3Smrg# _AM_MANGLE_OPTION(NAME)
744fbfaf8f3Smrg# -----------------------
745fbfaf8f3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746fbfaf8f3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74743f32c10Smrg
748fbfaf8f3Smrg# _AM_SET_OPTION(NAME)
749fbfaf8f3Smrg# --------------------
750fbfaf8f3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751fbfaf8f3SmrgAC_DEFUN([_AM_SET_OPTION],
752fbfaf8f3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7536ef05171Smrg
754fbfaf8f3Smrg# _AM_SET_OPTIONS(OPTIONS)
755fbfaf8f3Smrg# ------------------------
756fbfaf8f3Smrg# OPTIONS is a space-separated list of Automake options.
757fbfaf8f3SmrgAC_DEFUN([_AM_SET_OPTIONS],
758fbfaf8f3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7596ef05171Smrg
760fbfaf8f3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761fbfaf8f3Smrg# -------------------------------------------
762fbfaf8f3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763fbfaf8f3SmrgAC_DEFUN([_AM_IF_OPTION],
764fbfaf8f3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7656ef05171Smrg
766fbfaf8f3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767ea148d1dSmrg#
768fbfaf8f3Smrg# This file is free software; the Free Software Foundation
769fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
770fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
7716ef05171Smrg
772fbfaf8f3Smrg# _AM_PROG_CC_C_O
773fbfaf8f3Smrg# ---------------
774fbfaf8f3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
775fbfaf8f3Smrg# to automatically call this.
776fbfaf8f3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
777fbfaf8f3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
778fbfaf8f3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
779fbfaf8f3SmrgAC_LANG_PUSH([C])dnl
780fbfaf8f3SmrgAC_CACHE_CHECK(
781fbfaf8f3Smrg  [whether $CC understands -c and -o together],
782fbfaf8f3Smrg  [am_cv_prog_cc_c_o],
783fbfaf8f3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
784fbfaf8f3Smrg  # Make sure it works both with $CC and with simple cc.
785fbfaf8f3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
786fbfaf8f3Smrg  # compilers refuse to overwrite an existing .o file with -o,
787fbfaf8f3Smrg  # though they will create one.
788fbfaf8f3Smrg  am_cv_prog_cc_c_o=yes
789fbfaf8f3Smrg  for am_i in 1 2; do
790fbfaf8f3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
791fbfaf8f3Smrg         && test -f conftest2.$ac_objext; then
792fbfaf8f3Smrg      : OK
793fbfaf8f3Smrg    else
794fbfaf8f3Smrg      am_cv_prog_cc_c_o=no
795fbfaf8f3Smrg      break
796fbfaf8f3Smrg    fi
797fbfaf8f3Smrg  done
798fbfaf8f3Smrg  rm -f core conftest*
799fbfaf8f3Smrg  unset am_i])
800fbfaf8f3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
801fbfaf8f3Smrg   # Losing compiler, so override with the script.
802fbfaf8f3Smrg   # FIXME: It is wrong to rewrite CC.
803fbfaf8f3Smrg   # But if we don't then we get into trouble of one sort or another.
804fbfaf8f3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
805fbfaf8f3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
806fbfaf8f3Smrg   CC="$am_aux_dir/compile $CC"
8076ef05171Smrgfi
808fbfaf8f3SmrgAC_LANG_POP([C])])
8096ef05171Smrg
810fbfaf8f3Smrg# For backward compatibility.
811fbfaf8f3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8126ef05171Smrg
813fbfaf8f3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8146ef05171Smrg#
815fbfaf8f3Smrg# This file is free software; the Free Software Foundation
816fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
817fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
8186ef05171Smrg
819fbfaf8f3Smrg# AM_RUN_LOG(COMMAND)
820fbfaf8f3Smrg# -------------------
821fbfaf8f3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
822fbfaf8f3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
823fbfaf8f3SmrgAC_DEFUN([AM_RUN_LOG],
824fbfaf8f3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
825fbfaf8f3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
826fbfaf8f3Smrg   ac_status=$?
827fbfaf8f3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
828fbfaf8f3Smrg   (exit $ac_status); }])
8296ef05171Smrg
830fbfaf8f3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8316ef05171Smrg
832fbfaf8f3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8336ef05171Smrg#
834fbfaf8f3Smrg# This file is free software; the Free Software Foundation
835fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
836fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
8376ef05171Smrg
838fbfaf8f3Smrg# AM_SANITY_CHECK
839fbfaf8f3Smrg# ---------------
840fbfaf8f3SmrgAC_DEFUN([AM_SANITY_CHECK],
841fbfaf8f3Smrg[AC_MSG_CHECKING([whether build environment is sane])
842fbfaf8f3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843fbfaf8f3Smrg# name.  Accept space and tab only in the latter.
844fbfaf8f3Smrgam_lf='
845fbfaf8f3Smrg'
846fbfaf8f3Smrgcase `pwd` in
847fbfaf8f3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848fbfaf8f3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849fbfaf8f3Smrgesac
850fbfaf8f3Smrgcase $srcdir in
851fbfaf8f3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
852fbfaf8f3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853fbfaf8f3Smrgesac
8546ef05171Smrg
855fbfaf8f3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856fbfaf8f3Smrg# arguments.  Must try -L first in case configure is actually a
857fbfaf8f3Smrg# symlink; some systems play weird games with the mod time of symlinks
858fbfaf8f3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859fbfaf8f3Smrg# directory).
860fbfaf8f3Smrgif (
861fbfaf8f3Smrg   am_has_slept=no
862fbfaf8f3Smrg   for am_try in 1 2; do
863fbfaf8f3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
864fbfaf8f3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
865fbfaf8f3Smrg     if test "$[*]" = "X"; then
866fbfaf8f3Smrg	# -L didn't work.
867fbfaf8f3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
868fbfaf8f3Smrg     fi
869fbfaf8f3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
870fbfaf8f3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8716ef05171Smrg
872fbfaf8f3Smrg	# If neither matched, then we have a broken ls.  This can happen
873fbfaf8f3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
874fbfaf8f3Smrg	# broken ls alias from the environment.  This has actually
875fbfaf8f3Smrg	# happened.  Such a system could not be considered "sane".
876fbfaf8f3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
877fbfaf8f3Smrg  alias in your environment])
878fbfaf8f3Smrg     fi
879fbfaf8f3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
880fbfaf8f3Smrg       break
881fbfaf8f3Smrg     fi
882fbfaf8f3Smrg     # Just in case.
883fbfaf8f3Smrg     sleep 1
884fbfaf8f3Smrg     am_has_slept=yes
885fbfaf8f3Smrg   done
886fbfaf8f3Smrg   test "$[2]" = conftest.file
887fbfaf8f3Smrg   )
888fbfaf8f3Smrgthen
889fbfaf8f3Smrg   # Ok.
890fbfaf8f3Smrg   :
8916ef05171Smrgelse
892fbfaf8f3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893fbfaf8f3SmrgCheck your system clock])
8946ef05171Smrgfi
895fbfaf8f3SmrgAC_MSG_RESULT([yes])
896fbfaf8f3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
897fbfaf8f3Smrg# generated files are strictly newer.
898fbfaf8f3Smrgam_sleep_pid=
899fbfaf8f3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
900fbfaf8f3Smrg  ( sleep 1 ) &
901fbfaf8f3Smrg  am_sleep_pid=$!
9026ef05171Smrgfi
903fbfaf8f3SmrgAC_CONFIG_COMMANDS_PRE(
904fbfaf8f3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
905fbfaf8f3Smrg   if test -n "$am_sleep_pid"; then
906fbfaf8f3Smrg     # Hide warnings about reused PIDs.
907fbfaf8f3Smrg     wait $am_sleep_pid 2>/dev/null
908fbfaf8f3Smrg   fi
909fbfaf8f3Smrg   AC_MSG_RESULT([done])])
910fbfaf8f3Smrgrm -f conftest.file
911fbfaf8f3Smrg])
9126ef05171Smrg
913fbfaf8f3Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9146ef05171Smrg#
915fbfaf8f3Smrg# This file is free software; the Free Software Foundation
916fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
917fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
9186ef05171Smrg
919fbfaf8f3Smrg# AM_SILENT_RULES([DEFAULT])
920fbfaf8f3Smrg# --------------------------
921fbfaf8f3Smrg# Enable less verbose build rules; with the default set to DEFAULT
922fbfaf8f3Smrg# ("yes" being less verbose, "no" or empty being verbose).
923fbfaf8f3SmrgAC_DEFUN([AM_SILENT_RULES],
924fbfaf8f3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
925fbfaf8f3SmrgAS_HELP_STRING(
926fbfaf8f3Smrg  [--enable-silent-rules],
927fbfaf8f3Smrg  [less verbose build output (undo: "make V=1")])
928fbfaf8f3SmrgAS_HELP_STRING(
929fbfaf8f3Smrg  [--disable-silent-rules],
930fbfaf8f3Smrg  [verbose build output (undo: "make V=0")])dnl
931fbfaf8f3Smrg])
932fbfaf8f3Smrgcase $enable_silent_rules in @%:@ (((
933fbfaf8f3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
934fbfaf8f3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
935fbfaf8f3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936fbfaf8f3Smrgesac
937fbfaf8f3Smrgdnl
938fbfaf8f3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
939fbfaf8f3Smrgdnl do not support nested variable expansions.
940fbfaf8f3Smrgdnl See automake bug#9928 and bug#10237.
941fbfaf8f3Smrgam_make=${MAKE-make}
942fbfaf8f3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
943fbfaf8f3Smrg   [am_cv_make_support_nested_variables],
944fbfaf8f3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
945fbfaf8f3SmrgBAR0=false
946fbfaf8f3SmrgBAR1=true
947fbfaf8f3SmrgV=1
948fbfaf8f3Smrgam__doit:
949fbfaf8f3Smrg	@$(TRUE)
950fbfaf8f3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
951fbfaf8f3Smrg  am_cv_make_support_nested_variables=yes
9526ef05171Smrgelse
953fbfaf8f3Smrg  am_cv_make_support_nested_variables=no
954fbfaf8f3Smrgfi])
955fbfaf8f3Smrgif test $am_cv_make_support_nested_variables = yes; then
956fbfaf8f3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
957fbfaf8f3Smrg  AM_V='$(V)'
958fbfaf8f3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959fbfaf8f3Smrgelse
960fbfaf8f3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
961fbfaf8f3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9626ef05171Smrgfi
963fbfaf8f3SmrgAC_SUBST([AM_V])dnl
964fbfaf8f3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
965fbfaf8f3SmrgAC_SUBST([AM_DEFAULT_V])dnl
966fbfaf8f3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967fbfaf8f3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968fbfaf8f3SmrgAM_BACKSLASH='\'
969fbfaf8f3SmrgAC_SUBST([AM_BACKSLASH])dnl
970fbfaf8f3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971fbfaf8f3Smrg])
9726ef05171Smrg
973fbfaf8f3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9746ef05171Smrg#
975fbfaf8f3Smrg# This file is free software; the Free Software Foundation
976fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
977fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
9786ef05171Smrg
979fbfaf8f3Smrg# AM_PROG_INSTALL_STRIP
980fbfaf8f3Smrg# ---------------------
981fbfaf8f3Smrg# One issue with vendor 'install' (even GNU) is that you can't
982fbfaf8f3Smrg# specify the program used to strip binaries.  This is especially
983fbfaf8f3Smrg# annoying in cross-compiling environments, where the build's strip
984fbfaf8f3Smrg# is unlikely to handle the host's binaries.
985fbfaf8f3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
986fbfaf8f3Smrg# always use install-sh in "make install-strip", and initialize
987fbfaf8f3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988fbfaf8f3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989fbfaf8f3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
990fbfaf8f3Smrg# Installed binaries are usually stripped using 'strip' when the user
991fbfaf8f3Smrg# run "make install-strip".  However 'strip' might not be the right
992fbfaf8f3Smrg# tool to use in cross-compilation environments, therefore Automake
993fbfaf8f3Smrg# will honor the 'STRIP' environment variable to overrule this program.
994fbfaf8f3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995fbfaf8f3Smrgif test "$cross_compiling" != no; then
996fbfaf8f3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9976ef05171Smrgfi
998fbfaf8f3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999fbfaf8f3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10006ef05171Smrg
1001fbfaf8f3Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002fbfaf8f3Smrg#
1003fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1004fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1005fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
10066ef05171Smrg
1007fbfaf8f3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10086ef05171Smrg# ---------------------------
1009fbfaf8f3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010fbfaf8f3Smrg# This macro is traced by Automake.
1011fbfaf8f3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10126ef05171Smrg
1013fbfaf8f3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
1014fbfaf8f3Smrg# --------------------------
1015fbfaf8f3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016fbfaf8f3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10176ef05171Smrg
1018fbfaf8f3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019fbfaf8f3Smrg
1020fbfaf8f3Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10216ef05171Smrg#
1022fbfaf8f3Smrg# This file is free software; the Free Software Foundation
1023fbfaf8f3Smrg# gives unlimited permission to copy and/or distribute it,
1024fbfaf8f3Smrg# with or without modifications, as long as this notice is preserved.
1025fbfaf8f3Smrg
1026fbfaf8f3Smrg# _AM_PROG_TAR(FORMAT)
1027fbfaf8f3Smrg# --------------------
1028fbfaf8f3Smrg# Check how to create a tarball in format FORMAT.
1029fbfaf8f3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10306ef05171Smrg#
1031fbfaf8f3Smrg# Substitute a variable $(am__tar) that is a command
1032fbfaf8f3Smrg# writing to stdout a FORMAT-tarball containing the directory
1033fbfaf8f3Smrg# $tardir.
1034fbfaf8f3Smrg#     tardir=directory && $(am__tar) > result.tar
10356ef05171Smrg#
1036fbfaf8f3Smrg# Substitute a variable $(am__untar) that extract such
1037fbfaf8f3Smrg# a tarball read from stdin.
1038fbfaf8f3Smrg#     $(am__untar) < result.tar
10396ef05171Smrg#
1040fbfaf8f3SmrgAC_DEFUN([_AM_PROG_TAR],
1041fbfaf8f3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
1042fbfaf8f3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
1043fbfaf8f3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10446ef05171Smrg
1045fbfaf8f3Smrg# We'll loop over all known methods to create a tar archive until one works.
1046fbfaf8f3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10476ef05171Smrg
1048fbfaf8f3Smrgm4_if([$1], [v7],
1049fbfaf8f3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10506ef05171Smrg
1051fbfaf8f3Smrg  [m4_case([$1],
1052fbfaf8f3Smrg    [ustar],
1053fbfaf8f3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1054fbfaf8f3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1055fbfaf8f3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1056fbfaf8f3Smrg      # and bug#13588).
1057fbfaf8f3Smrg      am_max_uid=2097151 # 2^21 - 1
1058fbfaf8f3Smrg      am_max_gid=$am_max_uid
1059fbfaf8f3Smrg      # The $UID and $GID variables are not portable, so we need to resort
1060fbfaf8f3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1061fbfaf8f3Smrg      # below are definitely unexpected, so allow the users to see them
1062fbfaf8f3Smrg      # (that is, avoid stderr redirection).
1063fbfaf8f3Smrg      am_uid=`id -u || echo unknown`
1064fbfaf8f3Smrg      am_gid=`id -g || echo unknown`
1065fbfaf8f3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1066fbfaf8f3Smrg      if test $am_uid -le $am_max_uid; then
1067fbfaf8f3Smrg         AC_MSG_RESULT([yes])
1068fbfaf8f3Smrg      else
1069fbfaf8f3Smrg         AC_MSG_RESULT([no])
1070fbfaf8f3Smrg         _am_tools=none
1071fbfaf8f3Smrg      fi
1072fbfaf8f3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1073fbfaf8f3Smrg      if test $am_gid -le $am_max_gid; then
1074fbfaf8f3Smrg         AC_MSG_RESULT([yes])
1075fbfaf8f3Smrg      else
1076fbfaf8f3Smrg        AC_MSG_RESULT([no])
1077fbfaf8f3Smrg        _am_tools=none
1078fbfaf8f3Smrg      fi],
10796ef05171Smrg
1080fbfaf8f3Smrg  [pax],
1081fbfaf8f3Smrg    [],
10826ef05171Smrg
1083fbfaf8f3Smrg  [m4_fatal([Unknown tar format])])
10846ef05171Smrg
1085fbfaf8f3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10866ef05171Smrg
1087fbfaf8f3Smrg  # Go ahead even if we have the value already cached.  We do so because we
1088fbfaf8f3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1089fbfaf8f3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10906ef05171Smrg
1091fbfaf8f3Smrg  for _am_tool in $_am_tools; do
1092fbfaf8f3Smrg    case $_am_tool in
1093fbfaf8f3Smrg    gnutar)
1094fbfaf8f3Smrg      for _am_tar in tar gnutar gtar; do
1095fbfaf8f3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1096fbfaf8f3Smrg      done
1097fbfaf8f3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1098fbfaf8f3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1099fbfaf8f3Smrg      am__untar="$_am_tar -xf -"
1100fbfaf8f3Smrg      ;;
1101fbfaf8f3Smrg    plaintar)
1102fbfaf8f3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1103fbfaf8f3Smrg      # ustar tarball either.
1104fbfaf8f3Smrg      (tar --version) >/dev/null 2>&1 && continue
1105fbfaf8f3Smrg      am__tar='tar chf - "$$tardir"'
1106fbfaf8f3Smrg      am__tar_='tar chf - "$tardir"'
1107fbfaf8f3Smrg      am__untar='tar xf -'
1108fbfaf8f3Smrg      ;;
1109fbfaf8f3Smrg    pax)
1110fbfaf8f3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1111fbfaf8f3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1112fbfaf8f3Smrg      am__untar='pax -r'
1113fbfaf8f3Smrg      ;;
1114fbfaf8f3Smrg    cpio)
1115fbfaf8f3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1116fbfaf8f3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1117fbfaf8f3Smrg      am__untar='cpio -i -H $1 -d'
1118fbfaf8f3Smrg      ;;
1119fbfaf8f3Smrg    none)
1120fbfaf8f3Smrg      am__tar=false
1121fbfaf8f3Smrg      am__tar_=false
1122fbfaf8f3Smrg      am__untar=false
1123fbfaf8f3Smrg      ;;
1124fbfaf8f3Smrg    esac
1125fbfaf8f3Smrg
1126fbfaf8f3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1127fbfaf8f3Smrg    # and am__untar set.
1128fbfaf8f3Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129fbfaf8f3Smrg
1130fbfaf8f3Smrg    # tar/untar a dummy directory, and stop if the command works.
1131fbfaf8f3Smrg    rm -rf conftest.dir
1132fbfaf8f3Smrg    mkdir conftest.dir
1133fbfaf8f3Smrg    echo GrepMe > conftest.dir/file
1134fbfaf8f3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1135fbfaf8f3Smrg    rm -rf conftest.dir
1136fbfaf8f3Smrg    if test -s conftest.tar; then
1137fbfaf8f3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1138fbfaf8f3Smrg      AM_RUN_LOG([cat conftest.dir/file])
1139fbfaf8f3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1140fbfaf8f3Smrg    fi
1141fbfaf8f3Smrg  done
1142fbfaf8f3Smrg  rm -rf conftest.dir
1143fbfaf8f3Smrg
1144fbfaf8f3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1145fbfaf8f3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146fbfaf8f3Smrg
1147fbfaf8f3SmrgAC_SUBST([am__tar])
1148fbfaf8f3SmrgAC_SUBST([am__untar])
1149fbfaf8f3Smrg]) # _AM_PROG_TAR
1150fbfaf8f3Smrg
1151fbfaf8f3Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152fbfaf8f3Smrgdnl serial 11 (pkg-config-0.29)
1153fbfaf8f3Smrgdnl
1154fbfaf8f3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155fbfaf8f3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156fbfaf8f3Smrgdnl
1157fbfaf8f3Smrgdnl This program is free software; you can redistribute it and/or modify
1158fbfaf8f3Smrgdnl it under the terms of the GNU General Public License as published by
1159fbfaf8f3Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160fbfaf8f3Smrgdnl (at your option) any later version.
1161fbfaf8f3Smrgdnl
1162fbfaf8f3Smrgdnl This program is distributed in the hope that it will be useful, but
1163fbfaf8f3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164fbfaf8f3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165fbfaf8f3Smrgdnl General Public License for more details.
1166fbfaf8f3Smrgdnl
1167fbfaf8f3Smrgdnl You should have received a copy of the GNU General Public License
1168fbfaf8f3Smrgdnl along with this program; if not, write to the Free Software
1169fbfaf8f3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170fbfaf8f3Smrgdnl 02111-1307, USA.
1171fbfaf8f3Smrgdnl
1172fbfaf8f3Smrgdnl As a special exception to the GNU General Public License, if you
1173fbfaf8f3Smrgdnl distribute this file as part of a program that contains a
1174fbfaf8f3Smrgdnl configuration script generated by Autoconf, you may include it under
1175fbfaf8f3Smrgdnl the same distribution terms that you use for the rest of that
1176fbfaf8f3Smrgdnl program.
11776ef05171Smrg
1178fbfaf8f3Smrgdnl PKG_PREREQ(MIN-VERSION)
1179fbfaf8f3Smrgdnl -----------------------
1180fbfaf8f3Smrgdnl Since: 0.29
1181fbfaf8f3Smrgdnl
1182fbfaf8f3Smrgdnl Verify that the version of the pkg-config macros are at least
1183fbfaf8f3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184fbfaf8f3Smrgdnl installed version of pkg-config, this checks the developer's version
1185fbfaf8f3Smrgdnl of pkg.m4 when generating configure.
1186fbfaf8f3Smrgdnl
1187fbfaf8f3Smrgdnl To ensure that this macro is defined, also add:
1188fbfaf8f3Smrgdnl m4_ifndef([PKG_PREREQ],
1189fbfaf8f3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190fbfaf8f3Smrgdnl
1191fbfaf8f3Smrgdnl See the "Since" comment for each macro you use to see what version
1192fbfaf8f3Smrgdnl of the macros you require.
1193fbfaf8f3Smrgm4_defun([PKG_PREREQ],
1194fbfaf8f3Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195fbfaf8f3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196fbfaf8f3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197fbfaf8f3Smrg])dnl PKG_PREREQ
11986ef05171Smrg
1199fbfaf8f3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200fbfaf8f3Smrgdnl ----------------------------------
1201fbfaf8f3Smrgdnl Since: 0.16
1202fbfaf8f3Smrgdnl
1203fbfaf8f3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204fbfaf8f3Smrgdnl first found in the path. Checks that the version of pkg-config found
1205fbfaf8f3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206fbfaf8f3Smrgdnl used since that's the first version where most current features of
1207fbfaf8f3Smrgdnl pkg-config existed.
1208fbfaf8f3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209fbfaf8f3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210fbfaf8f3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211fbfaf8f3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214fbfaf8f3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12156ef05171Smrg
1216fbfaf8f3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217fbfaf8f3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12186ef05171Smrgfi
1219fbfaf8f3Smrgif test -n "$PKG_CONFIG"; then
1220fbfaf8f3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221fbfaf8f3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222fbfaf8f3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1224fbfaf8f3Smrg	else
1225fbfaf8f3Smrg		AC_MSG_RESULT([no])
1226fbfaf8f3Smrg		PKG_CONFIG=""
1227fbfaf8f3Smrg	fi
1228fbfaf8f3Smrgfi[]dnl
1229fbfaf8f3Smrg])dnl PKG_PROG_PKG_CONFIG
12306ef05171Smrg
1231fbfaf8f3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232fbfaf8f3Smrgdnl -------------------------------------------------------------------
1233fbfaf8f3Smrgdnl Since: 0.18
1234fbfaf8f3Smrgdnl
1235fbfaf8f3Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236fbfaf8f3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237fbfaf8f3Smrgdnl
1238fbfaf8f3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239fbfaf8f3Smrgdnl only at the first occurence in configure.ac, so if the first place
1240fbfaf8f3Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241fbfaf8f3Smrgdnl have to call PKG_CHECK_EXISTS manually
1242fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244fbfaf8f3Smrgif test -n "$PKG_CONFIG" && \
1245fbfaf8f3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246fbfaf8f3Smrg  m4_default([$2], [:])
1247fbfaf8f3Smrgm4_ifvaln([$3], [else
1248fbfaf8f3Smrg  $3])dnl
1249fbfaf8f3Smrgfi])
12506ef05171Smrg
1251fbfaf8f3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252fbfaf8f3Smrgdnl ---------------------------------------------
1253fbfaf8f3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254fbfaf8f3Smrgdnl pkg_failed based on the result.
1255fbfaf8f3Smrgm4_define([_PKG_CONFIG],
1256fbfaf8f3Smrg[if test -n "$$1"; then
1257fbfaf8f3Smrg    pkg_cv_[]$1="$$1"
1258fbfaf8f3Smrg elif test -n "$PKG_CONFIG"; then
1259fbfaf8f3Smrg    PKG_CHECK_EXISTS([$3],
1260fbfaf8f3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261fbfaf8f3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262fbfaf8f3Smrg		     [pkg_failed=yes])
1263fbfaf8f3Smrg else
1264fbfaf8f3Smrg    pkg_failed=untried
1265fbfaf8f3Smrgfi[]dnl
1266fbfaf8f3Smrg])dnl _PKG_CONFIG
12676ef05171Smrg
1268fbfaf8f3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269fbfaf8f3Smrgdnl ---------------------------
1270fbfaf8f3Smrgdnl Internal check to see if pkg-config supports short errors.
1271fbfaf8f3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273fbfaf8f3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274fbfaf8f3Smrg        _pkg_short_errors_supported=yes
12756ef05171Smrgelse
1276fbfaf8f3Smrg        _pkg_short_errors_supported=no
1277fbfaf8f3Smrgfi[]dnl
1278fbfaf8f3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12796ef05171Smrg
12806ef05171Smrg
1281fbfaf8f3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282fbfaf8f3Smrgdnl   [ACTION-IF-NOT-FOUND])
1283fbfaf8f3Smrgdnl --------------------------------------------------------------
1284fbfaf8f3Smrgdnl Since: 0.4.0
1285fbfaf8f3Smrgdnl
1286fbfaf8f3Smrgdnl Note that if there is a possibility the first call to
1287fbfaf8f3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288fbfaf8f3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291fbfaf8f3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292fbfaf8f3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293fbfaf8f3Smrg
1294fbfaf8f3Smrgpkg_failed=no
1295fbfaf8f3SmrgAC_MSG_CHECKING([for $1])
12966ef05171Smrg
1297fbfaf8f3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298fbfaf8f3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12996ef05171Smrg
1300fbfaf8f3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301fbfaf8f3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302fbfaf8f3SmrgSee the pkg-config man page for more details.])
13036ef05171Smrg
1304fbfaf8f3Smrgif test $pkg_failed = yes; then
1305fbfaf8f3Smrg   	AC_MSG_RESULT([no])
1306fbfaf8f3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307fbfaf8f3Smrg        if test $_pkg_short_errors_supported = yes; then
1308fbfaf8f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309fbfaf8f3Smrg        else 
1310fbfaf8f3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311fbfaf8f3Smrg        fi
1312fbfaf8f3Smrg	# Put the nasty error message in config.log where it belongs
1313fbfaf8f3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13146ef05171Smrg
1315fbfaf8f3Smrg	m4_default([$4], [AC_MSG_ERROR(
1316fbfaf8f3Smrg[Package requirements ($2) were not met:
131743f32c10Smrg
1318fbfaf8f3Smrg$$1_PKG_ERRORS
131943f32c10Smrg
1320fbfaf8f3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321fbfaf8f3Smrginstalled software in a non-standard prefix.
1322fbfaf8f3Smrg
1323fbfaf8f3Smrg_PKG_TEXT])[]dnl
1324fbfaf8f3Smrg        ])
1325fbfaf8f3Smrgelif test $pkg_failed = untried; then
1326fbfaf8f3Smrg     	AC_MSG_RESULT([no])
1327fbfaf8f3Smrg	m4_default([$4], [AC_MSG_FAILURE(
1328fbfaf8f3Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329fbfaf8f3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330fbfaf8f3Smrgpath to pkg-config.
1331fbfaf8f3Smrg
1332fbfaf8f3Smrg_PKG_TEXT
1333fbfaf8f3Smrg
1334fbfaf8f3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335fbfaf8f3Smrg        ])
133643f32c10Smrgelse
1337fbfaf8f3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338fbfaf8f3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339fbfaf8f3Smrg        AC_MSG_RESULT([yes])
1340fbfaf8f3Smrg	$3
1341fbfaf8f3Smrgfi[]dnl
1342fbfaf8f3Smrg])dnl PKG_CHECK_MODULES
134343f32c10Smrg
134443f32c10Smrg
1345fbfaf8f3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346fbfaf8f3Smrgdnl   [ACTION-IF-NOT-FOUND])
1347fbfaf8f3Smrgdnl ---------------------------------------------------------------------
1348fbfaf8f3Smrgdnl Since: 0.29
1349fbfaf8f3Smrgdnl
1350fbfaf8f3Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351fbfaf8f3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352fbfaf8f3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353fbfaf8f3Smrgdnl
1354fbfaf8f3Smrgdnl Note that if there is a possibility the first call to
1355fbfaf8f3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356fbfaf8f3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357fbfaf8f3Smrgdnl configure.ac.
1358fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360fbfaf8f3Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361fbfaf8f3SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362fbfaf8f3SmrgPKG_CHECK_MODULES($@)
1363fbfaf8f3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364fbfaf8f3Smrg])dnl PKG_CHECK_MODULES_STATIC
136543f32c10Smrg
13666ef05171Smrg
1367fbfaf8f3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368fbfaf8f3Smrgdnl -------------------------
1369fbfaf8f3Smrgdnl Since: 0.27
1370fbfaf8f3Smrgdnl
1371fbfaf8f3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372fbfaf8f3Smrgdnl should install pkg-config .pc files. By default the directory is
1373fbfaf8f3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374fbfaf8f3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375fbfaf8f3Smrgdnl parameter.
1376fbfaf8f3SmrgAC_DEFUN([PKG_INSTALLDIR],
1377fbfaf8f3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378fbfaf8f3Smrgm4_pushdef([pkg_description],
1379fbfaf8f3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380fbfaf8f3SmrgAC_ARG_WITH([pkgconfigdir],
1381fbfaf8f3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382fbfaf8f3Smrg    [with_pkgconfigdir=]pkg_default)
1383fbfaf8f3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384fbfaf8f3Smrgm4_popdef([pkg_default])
1385fbfaf8f3Smrgm4_popdef([pkg_description])
1386fbfaf8f3Smrg])dnl PKG_INSTALLDIR
13876ef05171Smrg
13886ef05171Smrg
1389fbfaf8f3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390fbfaf8f3Smrgdnl --------------------------------
1391fbfaf8f3Smrgdnl Since: 0.27
1392fbfaf8f3Smrgdnl
1393fbfaf8f3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394fbfaf8f3Smrgdnl module should install arch-independent pkg-config .pc files. By
1395fbfaf8f3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396fbfaf8f3Smrgdnl changed by passing DIRECTORY. The user can override through the
1397fbfaf8f3Smrgdnl --with-noarch-pkgconfigdir parameter.
1398fbfaf8f3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399fbfaf8f3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400fbfaf8f3Smrgm4_pushdef([pkg_description],
1401fbfaf8f3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402fbfaf8f3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403fbfaf8f3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404fbfaf8f3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405fbfaf8f3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406fbfaf8f3Smrgm4_popdef([pkg_default])
1407fbfaf8f3Smrgm4_popdef([pkg_description])
1408fbfaf8f3Smrg])dnl PKG_NOARCH_INSTALLDIR
140943f32c10Smrg
141043f32c10Smrg
1411fbfaf8f3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412fbfaf8f3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413fbfaf8f3Smrgdnl -------------------------------------------
1414fbfaf8f3Smrgdnl Since: 0.28
1415fbfaf8f3Smrgdnl
1416fbfaf8f3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417fbfaf8f3SmrgAC_DEFUN([PKG_CHECK_VAR],
1418fbfaf8f3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419fbfaf8f3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420fbfaf8f3Smrg
1421fbfaf8f3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422fbfaf8f3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423fbfaf8f3Smrg
1424fbfaf8f3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425fbfaf8f3Smrg])dnl PKG_CHECK_VAR
1426fbfaf8f3Smrg
1427fbfaf8f3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428fbfaf8f3Smrgdnl
1429fbfaf8f3Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
1430fbfaf8f3Smrgdnl
1431fbfaf8f3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432fbfaf8f3Smrgdnl copy of this software and associated documentation files (the "Software"),
1433fbfaf8f3Smrgdnl to deal in the Software without restriction, including without limitation
1434fbfaf8f3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435fbfaf8f3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436fbfaf8f3Smrgdnl Software is furnished to do so, subject to the following conditions:
1437fbfaf8f3Smrgdnl
1438fbfaf8f3Smrgdnl The above copyright notice and this permission notice (including the next
1439fbfaf8f3Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440fbfaf8f3Smrgdnl Software.
1441fbfaf8f3Smrgdnl
1442fbfaf8f3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443fbfaf8f3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444fbfaf8f3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445fbfaf8f3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446fbfaf8f3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447fbfaf8f3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448fbfaf8f3Smrgdnl DEALINGS IN THE SOFTWARE.
144943f32c10Smrg
1450fbfaf8f3Smrg# XORG_MACROS_VERSION(required-version)
1451fbfaf8f3Smrg# -------------------------------------
145243f32c10Smrg# Minimum version: 1.1.0
145343f32c10Smrg#
1454fbfaf8f3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455fbfaf8f3Smrg# your configure.ac with the minimum required version, such as:
1456fbfaf8f3Smrg# XORG_MACROS_VERSION(1.1)
145743f32c10Smrg#
1458fbfaf8f3Smrg# To ensure that this macro is defined, also add:
1459fbfaf8f3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460fbfaf8f3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14616ef05171Smrg#
1462fbfaf8f3Smrg#
1463fbfaf8f3Smrg# See the "minimum version" comment for each macro you use to see what
1464fbfaf8f3Smrg# version you require.
1465fbfaf8f3Smrgm4_defun([XORG_MACROS_VERSION],[
1466fbfaf8f3Smrgm4_define([vers_have], [1.20.0])
1467fbfaf8f3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468fbfaf8f3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469fbfaf8f3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470fbfaf8f3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471fbfaf8f3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472fbfaf8f3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473fbfaf8f3Smrgm4_undefine([vers_have])
1474fbfaf8f3Smrgm4_undefine([maj_have])
1475fbfaf8f3Smrgm4_undefine([maj_needed])
1476fbfaf8f3Smrg]) # XORG_MACROS_VERSION
147743f32c10Smrg
1478fbfaf8f3Smrg# XORG_PROG_RAWCPP()
1479fbfaf8f3Smrg# ------------------
1480fbfaf8f3Smrg# Minimum version: 1.0.0
1481fbfaf8f3Smrg#
1482fbfaf8f3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483fbfaf8f3Smrg# such as man pages and config files
1484fbfaf8f3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485fbfaf8f3SmrgAC_REQUIRE([AC_PROG_CPP])
1486fbfaf8f3SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487fbfaf8f3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14886ef05171Smrg
1489fbfaf8f3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490fbfaf8f3Smrg# which is not the best choice for supporting other OS'es, but covers most
1491fbfaf8f3Smrg# of the ones we need for now.
1492fbfaf8f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493fbfaf8f3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494fbfaf8f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495fbfaf8f3Smrg	AC_MSG_RESULT([no])
1496fbfaf8f3Smrgelse
1497fbfaf8f3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498fbfaf8f3Smrg		RAWCPPFLAGS=-undef
1499fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1500fbfaf8f3Smrg	# under Cygwin unix is still defined even with -undef
1501fbfaf8f3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502fbfaf8f3Smrg		RAWCPPFLAGS="-undef -ansi"
1503fbfaf8f3Smrg		AC_MSG_RESULT([yes, with -ansi])
1504fbfaf8f3Smrg	else
1505fbfaf8f3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506fbfaf8f3Smrg	fi
150743f32c10Smrgfi
1508fbfaf8f3Smrgrm -f conftest.$ac_ext
15096ef05171Smrg
1510fbfaf8f3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511fbfaf8f3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512fbfaf8f3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1513fbfaf8f3Smrg	AC_MSG_RESULT([no])
1514fbfaf8f3Smrgelse
1515fbfaf8f3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1516fbfaf8f3Smrg		TRADITIONALCPPFLAGS="-traditional"
1517fbfaf8f3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518fbfaf8f3Smrg		AC_MSG_RESULT([yes])
1519fbfaf8f3Smrg	else
1520fbfaf8f3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521fbfaf8f3Smrg	fi
1522fbfaf8f3Smrgfi
1523fbfaf8f3Smrgrm -f conftest.$ac_ext
1524fbfaf8f3SmrgAC_SUBST(RAWCPPFLAGS)
1525fbfaf8f3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526fbfaf8f3Smrg]) # XORG_PROG_RAWCPP
152743f32c10Smrg
1528fbfaf8f3Smrg# XORG_MANPAGE_SECTIONS()
1529fbfaf8f3Smrg# -----------------------
1530fbfaf8f3Smrg# Minimum version: 1.0.0
15316ef05171Smrg#
1532fbfaf8f3Smrg# Determine which sections man pages go in for the different man page types
1533fbfaf8f3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534fbfaf8f3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535fbfaf8f3Smrg# Override default settings by setting environment variables
1536fbfaf8f3Smrg# Added MAN_SUBSTS in version 1.8
1537fbfaf8f3Smrg# Added AC_PROG_SED in version 1.8
15386ef05171Smrg
1539fbfaf8f3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540fbfaf8f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541fbfaf8f3SmrgAC_REQUIRE([AC_PROG_SED])
15426ef05171Smrg
1543fbfaf8f3Smrgcase $host_os in
1544fbfaf8f3Smrg    solaris*)
1545fbfaf8f3Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546fbfaf8f3Smrg        # check for a man page file found in later versions that use
1547fbfaf8f3Smrg        # traditional section numbers instead
1548fbfaf8f3Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549fbfaf8f3Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550fbfaf8f3Smrg        ;;
1551fbfaf8f3Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552fbfaf8f3Smrgesac
15536ef05171Smrg
1554fbfaf8f3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555fbfaf8f3Smrg    APP_MAN_SUFFIX=1
1556fbfaf8f3Smrgfi
1557fbfaf8f3Smrgif test x$APP_MAN_DIR = x    ; then
1558fbfaf8f3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559fbfaf8f3Smrgfi
15606ef05171Smrg
1561fbfaf8f3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562fbfaf8f3Smrg    LIB_MAN_SUFFIX=3
1563fbfaf8f3Smrgfi
1564fbfaf8f3Smrgif test x$LIB_MAN_DIR = x    ; then
1565fbfaf8f3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566fbfaf8f3Smrgfi
15676ef05171Smrg
1568fbfaf8f3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1570fbfaf8f3Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571fbfaf8f3Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572fbfaf8f3Smrg    esac
1573fbfaf8f3Smrgfi
1574fbfaf8f3Smrgif test x$FILE_MAN_DIR = x    ; then
1575fbfaf8f3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15766ef05171Smrgfi
15776ef05171Smrg
1578fbfaf8f3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1580fbfaf8f3Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581fbfaf8f3Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582fbfaf8f3Smrg    esac
1583fbfaf8f3Smrgfi
1584fbfaf8f3Smrgif test x$MISC_MAN_DIR = x    ; then
1585fbfaf8f3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586fbfaf8f3Smrgfi
1587fbfaf8f3Smrg
1588fbfaf8f3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1590fbfaf8f3Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591fbfaf8f3Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592fbfaf8f3Smrg    esac
1593fbfaf8f3Smrgfi
1594fbfaf8f3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595fbfaf8f3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596fbfaf8f3Smrgfi
1597fbfaf8f3Smrg
1598fbfaf8f3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599fbfaf8f3Smrg    case $SYSV_MAN_SECTIONS in
1600fbfaf8f3Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601fbfaf8f3Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602fbfaf8f3Smrg    esac
1603fbfaf8f3Smrgfi
1604fbfaf8f3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605fbfaf8f3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16066ef05171Smrgfi
16076ef05171Smrg
16086ef05171Smrg
1609fbfaf8f3SmrgAC_SUBST([APP_MAN_SUFFIX])
1610fbfaf8f3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611fbfaf8f3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612fbfaf8f3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613fbfaf8f3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614fbfaf8f3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615fbfaf8f3SmrgAC_SUBST([APP_MAN_DIR])
1616fbfaf8f3SmrgAC_SUBST([LIB_MAN_DIR])
1617fbfaf8f3SmrgAC_SUBST([FILE_MAN_DIR])
1618fbfaf8f3SmrgAC_SUBST([MISC_MAN_DIR])
1619fbfaf8f3SmrgAC_SUBST([DRIVER_MAN_DIR])
1620fbfaf8f3SmrgAC_SUBST([ADMIN_MAN_DIR])
16216ef05171Smrg
1622fbfaf8f3SmrgXORG_MAN_PAGE="X Version 11"
1623fbfaf8f3SmrgAC_SUBST([XORG_MAN_PAGE])
1624fbfaf8f3SmrgMAN_SUBSTS="\
1625fbfaf8f3Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626fbfaf8f3Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627fbfaf8f3Smrg	-e 's|__xservername__|Xorg|g' \
1628fbfaf8f3Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629fbfaf8f3Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630fbfaf8f3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631fbfaf8f3Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632fbfaf8f3Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633fbfaf8f3Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634fbfaf8f3Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635fbfaf8f3Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636fbfaf8f3Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637fbfaf8f3SmrgAC_SUBST([MAN_SUBSTS])
16386ef05171Smrg
1639fbfaf8f3Smrg]) # XORG_MANPAGE_SECTIONS
16406ef05171Smrg
1641fbfaf8f3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642fbfaf8f3Smrg# ------------------------
1643fbfaf8f3Smrg# Minimum version: 1.7.0
1644fbfaf8f3Smrg#
1645fbfaf8f3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646fbfaf8f3Smrg# provided by xorg-sgml-doctools, if installed.
1647fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648fbfaf8f3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649fbfaf8f3SmrgXORG_SGML_PATH=
1650fbfaf8f3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651fbfaf8f3Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652fbfaf8f3Smrg    [m4_ifval([$1],[:],
1653fbfaf8f3Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654fbfaf8f3Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655fbfaf8f3Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656fbfaf8f3Smrg         fi])
1657fbfaf8f3Smrg    ])
16586ef05171Smrg
1659fbfaf8f3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660fbfaf8f3Smrg# the path and the name of the doc stylesheet
1661fbfaf8f3Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662fbfaf8f3Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663fbfaf8f3Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664fbfaf8f3Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665fbfaf8f3Smrgelse
1666fbfaf8f3Smrg   AC_MSG_RESULT([no])
1667fbfaf8f3Smrgfi
16686ef05171Smrg
1669fbfaf8f3SmrgAC_SUBST(XORG_SGML_PATH)
1670fbfaf8f3SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671fbfaf8f3SmrgAC_SUBST(XSL_STYLESHEET)
1672fbfaf8f3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673fbfaf8f3Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674fbfaf8f3Smrg
1675fbfaf8f3Smrg# XORG_CHECK_LINUXDOC
1676fbfaf8f3Smrg# -------------------
1677fbfaf8f3Smrg# Minimum version: 1.0.0
16786ef05171Smrg#
1679fbfaf8f3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680fbfaf8f3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681fbfaf8f3Smrg# Whether or not the necessary tools and files are found can be checked
1682fbfaf8f3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684fbfaf8f3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685fbfaf8f3SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16866ef05171Smrg
1687fbfaf8f3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16886ef05171Smrg
1689fbfaf8f3SmrgAC_MSG_CHECKING([whether to build documentation])
1690fbfaf8f3Smrg
1691fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692fbfaf8f3Smrg   BUILDDOC=yes
16936ef05171Smrgelse
1694fbfaf8f3Smrg   BUILDDOC=no
16956ef05171Smrgfi
16966ef05171Smrg
1697fbfaf8f3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16986ef05171Smrg
1699fbfaf8f3SmrgAC_MSG_RESULT([$BUILDDOC])
17006ef05171Smrg
1701fbfaf8f3SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17026ef05171Smrg
1703fbfaf8f3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704fbfaf8f3Smrg   BUILDPDFDOC=yes
17056ef05171Smrgelse
1706fbfaf8f3Smrg   BUILDPDFDOC=no
17076ef05171Smrgfi
17086ef05171Smrg
1709fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17106ef05171Smrg
1711fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17126ef05171Smrg
1713fbfaf8f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714fbfaf8f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715fbfaf8f3SmrgMAKE_PDF="$PS2PDF"
1716fbfaf8f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717fbfaf8f3Smrg
1718fbfaf8f3SmrgAC_SUBST(MAKE_TEXT)
1719fbfaf8f3SmrgAC_SUBST(MAKE_PS)
1720fbfaf8f3SmrgAC_SUBST(MAKE_PDF)
1721fbfaf8f3SmrgAC_SUBST(MAKE_HTML)
1722fbfaf8f3Smrg]) # XORG_CHECK_LINUXDOC
1723fbfaf8f3Smrg
1724fbfaf8f3Smrg# XORG_CHECK_DOCBOOK
1725fbfaf8f3Smrg# -------------------
1726fbfaf8f3Smrg# Minimum version: 1.0.0
17276ef05171Smrg#
1728fbfaf8f3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729fbfaf8f3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730fbfaf8f3Smrg# indicates whether the necessary tools and files are found and, if set,
1731fbfaf8f3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733fbfaf8f3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17346ef05171Smrg
1735fbfaf8f3SmrgBUILDTXTDOC=no
1736fbfaf8f3SmrgBUILDPDFDOC=no
1737fbfaf8f3SmrgBUILDPSDOC=no
1738fbfaf8f3SmrgBUILDHTMLDOC=no
17396ef05171Smrg
1740fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743fbfaf8f3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17446ef05171Smrg
1745fbfaf8f3SmrgAC_MSG_CHECKING([whether to build text documentation])
1746fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747fbfaf8f3Smrg   test x$BUILD_TXTDOC != xno; then
1748fbfaf8f3Smrg	BUILDTXTDOC=yes
1749fbfaf8f3Smrgfi
1750fbfaf8f3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751fbfaf8f3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17526ef05171Smrg
1753fbfaf8f3SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755fbfaf8f3Smrg   test x$BUILD_PDFDOC != xno; then
1756fbfaf8f3Smrg	BUILDPDFDOC=yes
1757fbfaf8f3Smrgfi
1758fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17606ef05171Smrg
1761fbfaf8f3SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763fbfaf8f3Smrg   test x$BUILD_PSDOC != xno; then
1764fbfaf8f3Smrg	BUILDPSDOC=yes
17656ef05171Smrgfi
1766fbfaf8f3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767fbfaf8f3SmrgAC_MSG_RESULT([$BUILDPSDOC])
17686ef05171Smrg
1769fbfaf8f3SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770fbfaf8f3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771fbfaf8f3Smrg   test x$BUILD_HTMLDOC != xno; then
1772fbfaf8f3Smrg	BUILDHTMLDOC=yes
1773fbfaf8f3Smrgfi
1774fbfaf8f3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775fbfaf8f3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17766ef05171Smrg
1777fbfaf8f3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778fbfaf8f3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779fbfaf8f3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780fbfaf8f3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781fbfaf8f3Smrg
1782fbfaf8f3SmrgAC_SUBST(MAKE_TEXT)
1783fbfaf8f3SmrgAC_SUBST(MAKE_PS)
1784fbfaf8f3SmrgAC_SUBST(MAKE_PDF)
1785fbfaf8f3SmrgAC_SUBST(MAKE_HTML)
1786fbfaf8f3Smrg]) # XORG_CHECK_DOCBOOK
1787fbfaf8f3Smrg
1788fbfaf8f3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17896ef05171Smrg# ----------------
1790fbfaf8f3Smrg# Minimum version: 1.5.0
1791fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17926ef05171Smrg#
1793fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
1794fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
1795fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796fbfaf8f3Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
1797fbfaf8f3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1798fbfaf8f3Smrg# --with-xmlto assumes 'auto'.
17996ef05171Smrg#
1800fbfaf8f3Smrg# Interface to module:
1801fbfaf8f3Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802fbfaf8f3Smrg# XMLTO:	returns the path of the xmlto program found
1803fbfaf8f3Smrg#		returns the path set by the user in the environment
1804fbfaf8f3Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805fbfaf8f3Smrg#		'no' user instructs the module not to use xmlto
1806fbfaf8f3Smrg#
1807fbfaf8f3Smrg# Added in version 1.10.0
1808fbfaf8f3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809fbfaf8f3Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810fbfaf8f3Smrg#
1811fbfaf8f3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812fbfaf8f3Smrg#
1813fbfaf8f3SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814fbfaf8f3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1815fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816fbfaf8f3SmrgAC_ARG_WITH(xmlto,
1817fbfaf8f3Smrg	AS_HELP_STRING([--with-xmlto],
1818fbfaf8f3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1819fbfaf8f3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1820fbfaf8f3Smrgm4_undefine([_defopt])
182143f32c10Smrg
1822fbfaf8f3Smrgif test "x$use_xmlto" = x"auto"; then
1823fbfaf8f3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824fbfaf8f3Smrg   if test "x$XMLTO" = "x"; then
1825fbfaf8f3Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826fbfaf8f3Smrg	have_xmlto=no
1827fbfaf8f3Smrg   else
1828fbfaf8f3Smrg        have_xmlto=yes
1829fbfaf8f3Smrg   fi
1830fbfaf8f3Smrgelif test "x$use_xmlto" = x"yes" ; then
1831fbfaf8f3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832fbfaf8f3Smrg   if test "x$XMLTO" = "x"; then
1833fbfaf8f3Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834fbfaf8f3Smrg   fi
1835fbfaf8f3Smrg   have_xmlto=yes
1836fbfaf8f3Smrgelif test "x$use_xmlto" = x"no" ; then
1837fbfaf8f3Smrg   if test "x$XMLTO" != "x"; then
1838fbfaf8f3Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839fbfaf8f3Smrg   fi
1840fbfaf8f3Smrg   have_xmlto=no
1841fbfaf8f3Smrgelse
1842fbfaf8f3Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843fbfaf8f3Smrgfi
18446ef05171Smrg
1845fbfaf8f3Smrg# Test for a minimum version of xmlto, if provided.
1846fbfaf8f3Smrgm4_ifval([$1],
1847fbfaf8f3Smrg[if test "$have_xmlto" = yes; then
1848fbfaf8f3Smrg    # scrape the xmlto version
1849fbfaf8f3Smrg    AC_MSG_CHECKING([the xmlto version])
1850fbfaf8f3Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851fbfaf8f3Smrg    AC_MSG_RESULT([$xmlto_version])
1852fbfaf8f3Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853fbfaf8f3Smrg        [if test "x$use_xmlto" = xauto; then
1854fbfaf8f3Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855fbfaf8f3Smrg            have_xmlto=no
1856fbfaf8f3Smrg        else
1857fbfaf8f3Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858fbfaf8f3Smrg        fi])
1859fbfaf8f3Smrgfi])
186043f32c10Smrg
1861fbfaf8f3Smrg# Test for the ability of xmlto to generate a text target
18626ef05171Smrg#
1863fbfaf8f3Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864fbfaf8f3Smrg# following test for empty XML docbook files.
1865fbfaf8f3Smrg# For compatibility reasons use the following empty XML docbook file and if
1866fbfaf8f3Smrg# it fails try it again with a non-empty XML file.
1867fbfaf8f3Smrghave_xmlto_text=no
1868fbfaf8f3Smrgcat > conftest.xml << "EOF"
1869fbfaf8f3SmrgEOF
1870fbfaf8f3SmrgAS_IF([test "$have_xmlto" = yes],
1871fbfaf8f3Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872fbfaf8f3Smrg             [have_xmlto_text=yes],
1873fbfaf8f3Smrg             [# Try it again with a non-empty XML file.
1874fbfaf8f3Smrg              cat > conftest.xml << "EOF"
1875fbfaf8f3Smrg<x></x>
1876fbfaf8f3SmrgEOF
1877fbfaf8f3Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878fbfaf8f3Smrg                    [have_xmlto_text=yes],
1879fbfaf8f3Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880fbfaf8f3Smrgrm -f conftest.xml
1881fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883fbfaf8f3Smrg]) # XORG_WITH_XMLTO
1884fbfaf8f3Smrg
1885fbfaf8f3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886fbfaf8f3Smrg# --------------------------------------------
1887fbfaf8f3Smrg# Minimum version: 1.12.0
1888fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889fbfaf8f3Smrg#
1890fbfaf8f3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891fbfaf8f3Smrg# XML-based language used for the transformation of XML documents.
1892fbfaf8f3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893fbfaf8f3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894fbfaf8f3Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895fbfaf8f3Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896fbfaf8f3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18976ef05171Smrg#
1898fbfaf8f3Smrg# Interface to module:
1899fbfaf8f3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900fbfaf8f3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901fbfaf8f3Smrg#		 returns the path set by the user in the environment
1902fbfaf8f3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903fbfaf8f3Smrg#		  'no' user instructs the module not to use xsltproc
1904fbfaf8f3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19056ef05171Smrg#
1906fbfaf8f3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190743f32c10Smrg#
1908fbfaf8f3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909fbfaf8f3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910fbfaf8f3Smrg# Preserves the interface, should it be implemented later
1911fbfaf8f3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913fbfaf8f3SmrgAC_ARG_WITH(xsltproc,
1914fbfaf8f3Smrg	AS_HELP_STRING([--with-xsltproc],
1915fbfaf8f3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916fbfaf8f3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917fbfaf8f3Smrgm4_undefine([_defopt])
191843f32c10Smrg
1919fbfaf8f3Smrgif test "x$use_xsltproc" = x"auto"; then
1920fbfaf8f3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921fbfaf8f3Smrg   if test "x$XSLTPROC" = "x"; then
1922fbfaf8f3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923fbfaf8f3Smrg	have_xsltproc=no
1924fbfaf8f3Smrg   else
1925fbfaf8f3Smrg        have_xsltproc=yes
1926fbfaf8f3Smrg   fi
1927fbfaf8f3Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928fbfaf8f3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929fbfaf8f3Smrg   if test "x$XSLTPROC" = "x"; then
1930fbfaf8f3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931fbfaf8f3Smrg   fi
1932fbfaf8f3Smrg   have_xsltproc=yes
1933fbfaf8f3Smrgelif test "x$use_xsltproc" = x"no" ; then
1934fbfaf8f3Smrg   if test "x$XSLTPROC" != "x"; then
1935fbfaf8f3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936fbfaf8f3Smrg   fi
1937fbfaf8f3Smrg   have_xsltproc=no
1938fbfaf8f3Smrgelse
1939fbfaf8f3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940fbfaf8f3Smrgfi
194143f32c10Smrg
1942fbfaf8f3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943fbfaf8f3Smrg]) # XORG_WITH_XSLTPROC
194443f32c10Smrg
1945fbfaf8f3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946fbfaf8f3Smrg# ----------------------------------------
1947fbfaf8f3Smrg# Minimum version: 1.15.0
1948fbfaf8f3Smrg#
1949fbfaf8f3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950fbfaf8f3Smrg# scanning arbitrary text files, extracting information from those text files,
1951fbfaf8f3Smrg# and printing reports based on that information.
1952fbfaf8f3Smrg#
1953fbfaf8f3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954fbfaf8f3Smrg#
1955fbfaf8f3Smrg# Interface to module:
1956fbfaf8f3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957fbfaf8f3Smrg# PERL:	     returns the path of the perl program found
1958fbfaf8f3Smrg#	     returns the path set by the user in the environment
1959fbfaf8f3Smrg# --with-perl: 'yes' user instructs the module to use perl
1960fbfaf8f3Smrg#	       'no' user instructs the module not to use perl
1961fbfaf8f3Smrg# have_perl: returns yes if perl found in PATH or no
1962fbfaf8f3Smrg#
1963fbfaf8f3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964fbfaf8f3Smrg#
1965fbfaf8f3SmrgAC_DEFUN([XORG_WITH_PERL],[
1966fbfaf8f3SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967fbfaf8f3Smrg# Preserves the interface, should it be implemented later
1968fbfaf8f3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970fbfaf8f3SmrgAC_ARG_WITH(perl,
1971fbfaf8f3Smrg	AS_HELP_STRING([--with-perl],
1972fbfaf8f3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973fbfaf8f3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974fbfaf8f3Smrgm4_undefine([_defopt])
197543f32c10Smrg
1976fbfaf8f3Smrgif test "x$use_perl" = x"auto"; then
1977fbfaf8f3Smrg   AC_PATH_PROG([PERL], [perl])
1978fbfaf8f3Smrg   if test "x$PERL" = "x"; then
1979fbfaf8f3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980fbfaf8f3Smrg	have_perl=no
1981fbfaf8f3Smrg   else
1982fbfaf8f3Smrg        have_perl=yes
1983fbfaf8f3Smrg   fi
1984fbfaf8f3Smrgelif test "x$use_perl" = x"yes" ; then
1985fbfaf8f3Smrg   AC_PATH_PROG([PERL], [perl])
1986fbfaf8f3Smrg   if test "x$PERL" = "x"; then
1987fbfaf8f3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988fbfaf8f3Smrg   fi
1989fbfaf8f3Smrg   have_perl=yes
1990fbfaf8f3Smrgelif test "x$use_perl" = x"no" ; then
1991fbfaf8f3Smrg   if test "x$PERL" != "x"; then
1992fbfaf8f3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993fbfaf8f3Smrg   fi
1994fbfaf8f3Smrg   have_perl=no
1995fbfaf8f3Smrgelse
1996fbfaf8f3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997fbfaf8f3Smrgfi
199843f32c10Smrg
1999fbfaf8f3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000fbfaf8f3Smrg]) # XORG_WITH_PERL
200143f32c10Smrg
2002fbfaf8f3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003fbfaf8f3Smrg# ----------------
2004fbfaf8f3Smrg# Minimum version: 1.5.0
2005fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200643f32c10Smrg#
2007fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2008fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2009fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010fbfaf8f3Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
2011fbfaf8f3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2012fbfaf8f3Smrg# --with-asciidoc assumes 'auto'.
201343f32c10Smrg#
2014fbfaf8f3Smrg# Interface to module:
2015fbfaf8f3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016fbfaf8f3Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017fbfaf8f3Smrg#		 returns the path set by the user in the environment
2018fbfaf8f3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019fbfaf8f3Smrg#		  'no' user instructs the module not to use asciidoc
202043f32c10Smrg#
2021fbfaf8f3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202243f32c10Smrg#
2023fbfaf8f3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024fbfaf8f3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2025fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026fbfaf8f3SmrgAC_ARG_WITH(asciidoc,
2027fbfaf8f3Smrg	AS_HELP_STRING([--with-asciidoc],
2028fbfaf8f3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2029fbfaf8f3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2030fbfaf8f3Smrgm4_undefine([_defopt])
203143f32c10Smrg
2032fbfaf8f3Smrgif test "x$use_asciidoc" = x"auto"; then
2033fbfaf8f3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034fbfaf8f3Smrg   if test "x$ASCIIDOC" = "x"; then
2035fbfaf8f3Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036fbfaf8f3Smrg	have_asciidoc=no
2037fbfaf8f3Smrg   else
2038fbfaf8f3Smrg        have_asciidoc=yes
2039fbfaf8f3Smrg   fi
2040fbfaf8f3Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041fbfaf8f3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042fbfaf8f3Smrg   if test "x$ASCIIDOC" = "x"; then
2043fbfaf8f3Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044fbfaf8f3Smrg   fi
2045fbfaf8f3Smrg   have_asciidoc=yes
2046fbfaf8f3Smrgelif test "x$use_asciidoc" = x"no" ; then
2047fbfaf8f3Smrg   if test "x$ASCIIDOC" != "x"; then
2048fbfaf8f3Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049fbfaf8f3Smrg   fi
2050fbfaf8f3Smrg   have_asciidoc=no
2051fbfaf8f3Smrgelse
2052fbfaf8f3Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053fbfaf8f3Smrgfi
2054fbfaf8f3Smrgm4_ifval([$1],
2055fbfaf8f3Smrg[if test "$have_asciidoc" = yes; then
2056fbfaf8f3Smrg    # scrape the asciidoc version
2057fbfaf8f3Smrg    AC_MSG_CHECKING([the asciidoc version])
2058fbfaf8f3Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059fbfaf8f3Smrg    AC_MSG_RESULT([$asciidoc_version])
2060fbfaf8f3Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061fbfaf8f3Smrg        [if test "x$use_asciidoc" = xauto; then
2062fbfaf8f3Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063fbfaf8f3Smrg            have_asciidoc=no
2064fbfaf8f3Smrg        else
2065fbfaf8f3Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066fbfaf8f3Smrg        fi])
2067fbfaf8f3Smrgfi])
2068fbfaf8f3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069fbfaf8f3Smrg]) # XORG_WITH_ASCIIDOC
207043f32c10Smrg
2071fbfaf8f3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2072fbfaf8f3Smrg# -------------------------------------------
2073fbfaf8f3Smrg# Minimum version: 1.5.0
2074fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2075fbfaf8f3Smrg# Minimum version for optional DOT checking: 1.18.0
2076fbfaf8f3Smrg#
2077fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2078fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2079fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080fbfaf8f3Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
2081fbfaf8f3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2082fbfaf8f3Smrg# --with-doxygen assumes 'auto'.
2083fbfaf8f3Smrg#
2084fbfaf8f3Smrg# Interface to module:
2085fbfaf8f3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086fbfaf8f3Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087fbfaf8f3Smrg#		 returns the path set by the user in the environment
2088fbfaf8f3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089fbfaf8f3Smrg#		  'no' user instructs the module not to use doxygen
209043f32c10Smrg#
2091fbfaf8f3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092fbfaf8f3Smrg#
2093fbfaf8f3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094fbfaf8f3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2095fbfaf8f3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2096fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097fbfaf8f3SmrgAC_ARG_WITH(doxygen,
2098fbfaf8f3Smrg	AS_HELP_STRING([--with-doxygen],
2099fbfaf8f3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2100fbfaf8f3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2101fbfaf8f3Smrgm4_undefine([_defopt])
210243f32c10Smrg
2103fbfaf8f3Smrgif test "x$use_doxygen" = x"auto"; then
2104fbfaf8f3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105fbfaf8f3Smrg   if test "x$DOXYGEN" = "x"; then
2106fbfaf8f3Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107fbfaf8f3Smrg	have_doxygen=no
2108fbfaf8f3Smrg   else
2109fbfaf8f3Smrg        have_doxygen=yes
2110fbfaf8f3Smrg   fi
2111fbfaf8f3Smrgelif test "x$use_doxygen" = x"yes" ; then
2112fbfaf8f3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113fbfaf8f3Smrg   if test "x$DOXYGEN" = "x"; then
2114fbfaf8f3Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115fbfaf8f3Smrg   fi
2116fbfaf8f3Smrg   have_doxygen=yes
2117fbfaf8f3Smrgelif test "x$use_doxygen" = x"no" ; then
2118fbfaf8f3Smrg   if test "x$DOXYGEN" != "x"; then
2119fbfaf8f3Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120fbfaf8f3Smrg   fi
2121fbfaf8f3Smrg   have_doxygen=no
212243f32c10Smrgelse
2123fbfaf8f3Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212443f32c10Smrgfi
2125fbfaf8f3Smrgm4_ifval([$1],
2126fbfaf8f3Smrg[if test "$have_doxygen" = yes; then
2127fbfaf8f3Smrg    # scrape the doxygen version
2128fbfaf8f3Smrg    AC_MSG_CHECKING([the doxygen version])
2129fbfaf8f3Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130fbfaf8f3Smrg    AC_MSG_RESULT([$doxygen_version])
2131fbfaf8f3Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132fbfaf8f3Smrg        [if test "x$use_doxygen" = xauto; then
2133fbfaf8f3Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134fbfaf8f3Smrg            have_doxygen=no
2135fbfaf8f3Smrg        else
2136fbfaf8f3Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137fbfaf8f3Smrg        fi])
2138fbfaf8f3Smrgfi])
213943f32c10Smrg
2140fbfaf8f3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2141fbfaf8f3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2142fbfaf8f3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
2143fbfaf8f3SmrgHAVE_DOT=no
2144fbfaf8f3Smrgif test "x$have_doxygen" = "xyes"; then
2145fbfaf8f3Smrg  AC_PATH_PROG([DOT], [dot])
2146fbfaf8f3Smrg    if test "x$DOT" != "x"; then
2147fbfaf8f3Smrg      HAVE_DOT=yes
2148fbfaf8f3Smrg    fi
2149fbfaf8f3Smrgfi
215043f32c10Smrg
2151fbfaf8f3SmrgAC_SUBST([HAVE_DOT])
2152fbfaf8f3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153fbfaf8f3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154fbfaf8f3Smrg]) # XORG_WITH_DOXYGEN
215543f32c10Smrg
2156fbfaf8f3Smrg# XORG_WITH_GROFF([DEFAULT])
2157fbfaf8f3Smrg# ----------------
2158fbfaf8f3Smrg# Minimum version: 1.6.0
2159fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216043f32c10Smrg#
2161fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2162fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2163fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164fbfaf8f3Smrg# the --with-groff option, it allows maximum flexibility in making decisions
2165fbfaf8f3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2166fbfaf8f3Smrg# --with-groff assumes 'auto'.
2167fbfaf8f3Smrg#
2168fbfaf8f3Smrg# Interface to module:
2169fbfaf8f3Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170fbfaf8f3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171fbfaf8f3Smrg# HAVE_GROFF_MS: the -ms macros package
2172fbfaf8f3Smrg# GROFF:	 returns the path of the groff program found
2173fbfaf8f3Smrg#		 returns the path set by the user in the environment
2174fbfaf8f3Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175fbfaf8f3Smrg#		 'no' user instructs the module not to use groff
2176fbfaf8f3Smrg#
2177fbfaf8f3Smrg# Added in version 1.9.0:
2178fbfaf8f3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179fbfaf8f3Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180fbfaf8f3Smrg#		   psselect from the psutils package.
2181fbfaf8f3Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182fbfaf8f3Smrg#
2183fbfaf8f3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184fbfaf8f3Smrg#
2185fbfaf8f3Smrg# OS and distros often splits groff in a basic and full package, the former
2186fbfaf8f3Smrg# having the groff program and the later having devices, fonts and macros
2187fbfaf8f3Smrg# Checking for the groff executable is not enough.
2188fbfaf8f3Smrg#
2189fbfaf8f3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190fbfaf8f3Smrg# unset HAVE_GROFF or GROFF env variables.
2191fbfaf8f3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192fbfaf8f3Smrg#
2193fbfaf8f3SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194fbfaf8f3SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2195fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196fbfaf8f3SmrgAC_ARG_WITH(groff,
2197fbfaf8f3Smrg	AS_HELP_STRING([--with-groff],
2198fbfaf8f3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2199fbfaf8f3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2200fbfaf8f3Smrgm4_undefine([_defopt])
220143f32c10Smrg
2202fbfaf8f3Smrgif test "x$use_groff" = x"auto"; then
2203fbfaf8f3Smrg   AC_PATH_PROG([GROFF], [groff])
2204fbfaf8f3Smrg   if test "x$GROFF" = "x"; then
2205fbfaf8f3Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206fbfaf8f3Smrg	have_groff=no
2207fbfaf8f3Smrg   else
2208fbfaf8f3Smrg        have_groff=yes
2209fbfaf8f3Smrg   fi
2210fbfaf8f3Smrgelif test "x$use_groff" = x"yes" ; then
2211fbfaf8f3Smrg   AC_PATH_PROG([GROFF], [groff])
2212fbfaf8f3Smrg   if test "x$GROFF" = "x"; then
2213fbfaf8f3Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214fbfaf8f3Smrg   fi
2215fbfaf8f3Smrg   have_groff=yes
2216fbfaf8f3Smrgelif test "x$use_groff" = x"no" ; then
2217fbfaf8f3Smrg   if test "x$GROFF" != "x"; then
2218fbfaf8f3Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219fbfaf8f3Smrg   fi
2220fbfaf8f3Smrg   have_groff=no
222143f32c10Smrgelse
2222fbfaf8f3Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222343f32c10Smrgfi
222443f32c10Smrg
2225fbfaf8f3Smrg# We have groff, test for the presence of the macro packages
2226fbfaf8f3Smrgif test "x$have_groff" = x"yes"; then
2227fbfaf8f3Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228fbfaf8f3Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229fbfaf8f3Smrg        groff_ms_works=yes
2230fbfaf8f3Smrg    else
2231fbfaf8f3Smrg        groff_ms_works=no
2232fbfaf8f3Smrg    fi
2233fbfaf8f3Smrg    AC_MSG_RESULT([$groff_ms_works])
2234fbfaf8f3Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235fbfaf8f3Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236fbfaf8f3Smrg        groff_mm_works=yes
2237fbfaf8f3Smrg    else
2238fbfaf8f3Smrg        groff_mm_works=no
2239fbfaf8f3Smrg    fi
2240fbfaf8f3Smrg    AC_MSG_RESULT([$groff_mm_works])
2241fbfaf8f3Smrgfi
224243f32c10Smrg
2243fbfaf8f3Smrg# We have groff, test for HTML dependencies, one command per package
2244fbfaf8f3Smrgif test "x$have_groff" = x"yes"; then
2245fbfaf8f3Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246fbfaf8f3Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247fbfaf8f3Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248fbfaf8f3Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249fbfaf8f3Smrg      have_groff_html=yes
2250fbfaf8f3Smrg   else
2251fbfaf8f3Smrg      have_groff_html=no
2252fbfaf8f3Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253fbfaf8f3Smrg   fi
2254fbfaf8f3Smrgfi
225543f32c10Smrg
2256fbfaf8f3Smrg# Set Automake conditionals for Makefiles
2257fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261fbfaf8f3Smrg]) # XORG_WITH_GROFF
226243f32c10Smrg
2263fbfaf8f3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264fbfaf8f3Smrg# ---------------------------------------
2265fbfaf8f3Smrg# Minimum version: 1.6.0
2266fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2267fbfaf8f3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268fbfaf8f3Smrg#
2269fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2270fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2271fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272fbfaf8f3Smrg# the --with-fop option, it allows maximum flexibility in making decisions
2273fbfaf8f3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2274fbfaf8f3Smrg# --with-fop assumes 'auto'.
2275fbfaf8f3Smrg#
2276fbfaf8f3Smrg# Interface to module:
2277fbfaf8f3Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278fbfaf8f3Smrg# FOP:	 	returns the path of the fop program found
2279fbfaf8f3Smrg#		returns the path set by the user in the environment
2280fbfaf8f3Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281fbfaf8f3Smrg#		'no' user instructs the module not to use fop
2282fbfaf8f3Smrg#
2283fbfaf8f3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284fbfaf8f3Smrg#
2285fbfaf8f3SmrgAC_DEFUN([XORG_WITH_FOP],[
2286fbfaf8f3SmrgAC_ARG_VAR([FOP], [Path to fop command])
2287fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288fbfaf8f3SmrgAC_ARG_WITH(fop,
2289fbfaf8f3Smrg	AS_HELP_STRING([--with-fop],
2290fbfaf8f3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2291fbfaf8f3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2292fbfaf8f3Smrgm4_undefine([_defopt])
2293fbfaf8f3Smrg
2294fbfaf8f3Smrgif test "x$use_fop" = x"auto"; then
2295fbfaf8f3Smrg   AC_PATH_PROG([FOP], [fop])
2296fbfaf8f3Smrg   if test "x$FOP" = "x"; then
2297fbfaf8f3Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298fbfaf8f3Smrg	have_fop=no
2299fbfaf8f3Smrg   else
2300fbfaf8f3Smrg        have_fop=yes
2301fbfaf8f3Smrg   fi
2302fbfaf8f3Smrgelif test "x$use_fop" = x"yes" ; then
2303fbfaf8f3Smrg   AC_PATH_PROG([FOP], [fop])
2304fbfaf8f3Smrg   if test "x$FOP" = "x"; then
2305fbfaf8f3Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306fbfaf8f3Smrg   fi
2307fbfaf8f3Smrg   have_fop=yes
2308fbfaf8f3Smrgelif test "x$use_fop" = x"no" ; then
2309fbfaf8f3Smrg   if test "x$FOP" != "x"; then
2310fbfaf8f3Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311fbfaf8f3Smrg   fi
2312fbfaf8f3Smrg   have_fop=no
2313fbfaf8f3Smrgelse
2314fbfaf8f3Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231543f32c10Smrgfi
231643f32c10Smrg
2317fbfaf8f3Smrg# Test for a minimum version of fop, if provided.
2318fbfaf8f3Smrgm4_ifval([$1],
2319fbfaf8f3Smrg[if test "$have_fop" = yes; then
2320fbfaf8f3Smrg    # scrape the fop version
2321fbfaf8f3Smrg    AC_MSG_CHECKING([for fop minimum version])
2322fbfaf8f3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323fbfaf8f3Smrg    AC_MSG_RESULT([$fop_version])
2324fbfaf8f3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325fbfaf8f3Smrg        [if test "x$use_fop" = xauto; then
2326fbfaf8f3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327fbfaf8f3Smrg            have_fop=no
2328fbfaf8f3Smrg        else
2329fbfaf8f3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330fbfaf8f3Smrg        fi])
2331fbfaf8f3Smrgfi])
2332fbfaf8f3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333fbfaf8f3Smrg]) # XORG_WITH_FOP
233443f32c10Smrg
2335fbfaf8f3Smrg# XORG_WITH_M4([MIN-VERSION])
2336fbfaf8f3Smrg# ---------------------------
2337fbfaf8f3Smrg# Minimum version: 1.19.0
233843f32c10Smrg#
2339fbfaf8f3Smrg# This macro attempts to locate an m4 macro processor which supports
2340fbfaf8f3Smrg# -I option and is only useful for modules relying on M4 in order to
2341fbfaf8f3Smrg# expand macros in source code files.
2342fbfaf8f3Smrg#
2343fbfaf8f3Smrg# Interface to module:
2344fbfaf8f3Smrg# M4:	 	returns the path of the m4 program found
2345fbfaf8f3Smrg#		returns the path set by the user in the environment
2346fbfaf8f3Smrg#
2347fbfaf8f3SmrgAC_DEFUN([XORG_WITH_M4], [
2348fbfaf8f3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2349fbfaf8f3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2350fbfaf8f3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2351fbfaf8f3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2352fbfaf8f3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2353fbfaf8f3Smrg   [$PATH:/usr/gnu/bin])])
235443f32c10Smrg
2355fbfaf8f3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
2356fbfaf8f3Smrg]) # XORG_WITH_M4
2357fbfaf8f3Smrg
2358fbfaf8f3Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359fbfaf8f3Smrg# ----------------
2360fbfaf8f3Smrg# Minimum version: 1.6.0
2361fbfaf8f3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362fbfaf8f3Smrg#
2363fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2364fbfaf8f3Smrg# not at the appropriate level. This macro enables a module to test for the
2365fbfaf8f3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366fbfaf8f3Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
2367fbfaf8f3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2368fbfaf8f3Smrg# --with-ps2pdf assumes 'auto'.
2369fbfaf8f3Smrg#
2370fbfaf8f3Smrg# Interface to module:
2371fbfaf8f3Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372fbfaf8f3Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373fbfaf8f3Smrg#		returns the path set by the user in the environment
2374fbfaf8f3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375fbfaf8f3Smrg#		 'no' user instructs the module not to use ps2pdf
2376fbfaf8f3Smrg#
2377fbfaf8f3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378fbfaf8f3Smrg#
2379fbfaf8f3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380fbfaf8f3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2381fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382fbfaf8f3SmrgAC_ARG_WITH(ps2pdf,
2383fbfaf8f3Smrg	AS_HELP_STRING([--with-ps2pdf],
2384fbfaf8f3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2385fbfaf8f3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2386fbfaf8f3Smrgm4_undefine([_defopt])
238743f32c10Smrg
2388fbfaf8f3Smrgif test "x$use_ps2pdf" = x"auto"; then
2389fbfaf8f3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390fbfaf8f3Smrg   if test "x$PS2PDF" = "x"; then
2391fbfaf8f3Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392fbfaf8f3Smrg	have_ps2pdf=no
2393fbfaf8f3Smrg   else
2394fbfaf8f3Smrg        have_ps2pdf=yes
2395fbfaf8f3Smrg   fi
2396fbfaf8f3Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397fbfaf8f3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398fbfaf8f3Smrg   if test "x$PS2PDF" = "x"; then
2399fbfaf8f3Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400fbfaf8f3Smrg   fi
2401fbfaf8f3Smrg   have_ps2pdf=yes
2402fbfaf8f3Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403fbfaf8f3Smrg   if test "x$PS2PDF" != "x"; then
2404fbfaf8f3Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405fbfaf8f3Smrg   fi
2406fbfaf8f3Smrg   have_ps2pdf=no
2407fbfaf8f3Smrgelse
2408fbfaf8f3Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409fbfaf8f3Smrgfi
2410fbfaf8f3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411fbfaf8f3Smrg]) # XORG_WITH_PS2PDF
241243f32c10Smrg
2413fbfaf8f3Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414fbfaf8f3Smrg# ----------------
2415fbfaf8f3Smrg# Minimum version: 1.6.0
241643f32c10Smrg#
2417fbfaf8f3Smrg# Documentation tools are not always available on all platforms and sometimes
2418fbfaf8f3Smrg# not at the appropriate level. This macro enables a builder to skip all
2419fbfaf8f3Smrg# documentation targets except traditional man pages.
2420fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2422fbfaf8f3Smrg# Refer to:
2423fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2424fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2427fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2428fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429fbfaf8f3Smrg#
2430fbfaf8f3Smrg# Interface to module:
2431fbfaf8f3Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432fbfaf8f3Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433fbfaf8f3Smrg#		 'no' user instructs the module not to generate docs
2434fbfaf8f3Smrg# parm1:	specify the default value, yes or no.
2435fbfaf8f3Smrg#
2436fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437fbfaf8f3Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438fbfaf8f3SmrgAC_ARG_ENABLE(docs,
2439fbfaf8f3Smrg	AS_HELP_STRING([--enable-docs],
2440fbfaf8f3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441fbfaf8f3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442fbfaf8f3Smrgm4_undefine([docs_default])
2443fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444fbfaf8f3SmrgAC_MSG_CHECKING([whether to build documentation])
2445fbfaf8f3SmrgAC_MSG_RESULT([$build_docs])
2446fbfaf8f3Smrg]) # XORG_ENABLE_DOCS
244743f32c10Smrg
2448fbfaf8f3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449fbfaf8f3Smrg# ----------------
2450fbfaf8f3Smrg# Minimum version: 1.6.0
2451fbfaf8f3Smrg#
2452fbfaf8f3Smrg# This macro enables a builder to skip all developer documentation.
2453fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2455fbfaf8f3Smrg# Refer to:
2456fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2457fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2460fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2461fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462fbfaf8f3Smrg#
2463fbfaf8f3Smrg# Interface to module:
2464fbfaf8f3Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465fbfaf8f3Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466fbfaf8f3Smrg#			'no' user instructs the module not to generate developer docs
2467fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2468fbfaf8f3Smrg#
2469fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2470fbfaf8f3Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471fbfaf8f3SmrgAC_ARG_ENABLE(devel-docs,
2472fbfaf8f3Smrg	AS_HELP_STRING([--enable-devel-docs],
2473fbfaf8f3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2474fbfaf8f3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2475fbfaf8f3Smrgm4_undefine([devel_default])
2476fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477fbfaf8f3SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478fbfaf8f3SmrgAC_MSG_RESULT([$build_devel_docs])
2479fbfaf8f3Smrg]) # XORG_ENABLE_DEVEL_DOCS
248043f32c10Smrg
2481fbfaf8f3Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482fbfaf8f3Smrg# ----------------
2483fbfaf8f3Smrg# Minimum version: 1.6.0
248443f32c10Smrg#
2485fbfaf8f3Smrg# This macro enables a builder to skip all functional specification targets.
2486fbfaf8f3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487fbfaf8f3Smrg# maximum flexibility in controlling documentation building.
2488fbfaf8f3Smrg# Refer to:
2489fbfaf8f3Smrg# XORG_WITH_XMLTO         --with-xmlto
2490fbfaf8f3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491fbfaf8f3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492fbfaf8f3Smrg# XORG_WITH_FOP           --with-fop
2493fbfaf8f3Smrg# XORG_WITH_GROFF         --with-groff
2494fbfaf8f3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495fbfaf8f3Smrg#
2496fbfaf8f3Smrg# Interface to module:
2497fbfaf8f3Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498fbfaf8f3Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499fbfaf8f3Smrg#			'no' user instructs the module not to generate specs
2500fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2501fbfaf8f3Smrg#
2502fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2503fbfaf8f3Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504fbfaf8f3SmrgAC_ARG_ENABLE(specs,
2505fbfaf8f3Smrg	AS_HELP_STRING([--enable-specs],
2506fbfaf8f3Smrg	   [Enable building the specs (default: ]spec_default[)]),
2507fbfaf8f3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2508fbfaf8f3Smrgm4_undefine([spec_default])
2509fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510fbfaf8f3SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511fbfaf8f3SmrgAC_MSG_RESULT([$build_specs])
2512fbfaf8f3Smrg]) # XORG_ENABLE_SPECS
251343f32c10Smrg
2514fbfaf8f3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515fbfaf8f3Smrg# ----------------------------------------------
2516fbfaf8f3Smrg# Minimum version: 1.13.0
2517fbfaf8f3Smrg#
2518fbfaf8f3Smrg# This macro enables a builder to enable/disable unit testing
2519fbfaf8f3Smrg# It makes no assumption about the test cases implementation
2520fbfaf8f3Smrg# Test cases may or may not use Automake "Support for test suites"
2521fbfaf8f3Smrg# They may or may not use the software utility library GLib
2522fbfaf8f3Smrg#
2523fbfaf8f3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524fbfaf8f3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525fbfaf8f3Smrg# The variable enable_unit_tests is used by other macros in this file.
2526fbfaf8f3Smrg#
2527fbfaf8f3Smrg# Interface to module:
2528fbfaf8f3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529fbfaf8f3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530fbfaf8f3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531fbfaf8f3Smrg#			'no' user instructs the module not to build tests
2532fbfaf8f3Smrg# parm1:		specify the default value, yes or no.
2533fbfaf8f3Smrg#
2534fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535fbfaf8f3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536fbfaf8f3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537fbfaf8f3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539fbfaf8f3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540fbfaf8f3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541fbfaf8f3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542fbfaf8f3Smrgm4_undefine([_defopt])
2543fbfaf8f3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544fbfaf8f3SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545fbfaf8f3SmrgAC_MSG_RESULT([$enable_unit_tests])
2546fbfaf8f3Smrg]) # XORG_ENABLE_UNIT_TESTS
254743f32c10Smrg
2548fbfaf8f3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549fbfaf8f3Smrg# ------------------------------------------------------
2550fbfaf8f3Smrg# Minimum version: 1.17.0
2551fbfaf8f3Smrg#
2552fbfaf8f3Smrg# This macro enables a builder to enable/disable integration testing
2553fbfaf8f3Smrg# It makes no assumption about the test cases' implementation
2554fbfaf8f3Smrg# Test cases may or may not use Automake "Support for test suites"
2555fbfaf8f3Smrg#
2556fbfaf8f3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557fbfaf8f3Smrg# usually requires less dependencies and may be built and run under less
2558fbfaf8f3Smrg# stringent environments than integration tests.
2559fbfaf8f3Smrg#
2560fbfaf8f3Smrg# Interface to module:
2561fbfaf8f3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562fbfaf8f3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563fbfaf8f3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564fbfaf8f3Smrg#                             'no' user instructs the module not to build tests
2565fbfaf8f3Smrg# parm1:                      specify the default value, yes or no.
2566fbfaf8f3Smrg#
2567fbfaf8f3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568fbfaf8f3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569fbfaf8f3Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570fbfaf8f3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571fbfaf8f3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572fbfaf8f3Smrg	[enable_integration_tests=$enableval],
2573fbfaf8f3Smrg	[enable_integration_tests=]_defopt)
2574fbfaf8f3Smrgm4_undefine([_defopt])
2575fbfaf8f3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576fbfaf8f3Smrg	[test "x$enable_integration_tests" != xno])
2577fbfaf8f3SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578fbfaf8f3SmrgAC_MSG_RESULT([$enable_integration_tests])
2579fbfaf8f3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25806ef05171Smrg
2581fbfaf8f3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582fbfaf8f3Smrg# ----------------------------------------
2583fbfaf8f3Smrg# Minimum version: 1.13.0
2584fbfaf8f3Smrg#
2585fbfaf8f3Smrg# GLib is a library which provides advanced data structures and functions.
2586fbfaf8f3Smrg# This macro enables a module to test for the presence of Glib.
2587fbfaf8f3Smrg#
2588fbfaf8f3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589fbfaf8f3Smrg# Otherwise the value of $enable_unit_tests is blank.
2590fbfaf8f3Smrg#
2591fbfaf8f3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592fbfaf8f3Smrg# test support usually requires less dependencies and may be built and run under
2593fbfaf8f3Smrg# less stringent environments than integration tests.
2594fbfaf8f3Smrg#
2595fbfaf8f3Smrg# Interface to module:
2596fbfaf8f3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597fbfaf8f3Smrg# with_glib: used in configure.ac to know if GLib has been found
2598fbfaf8f3Smrg# --with-glib:	'yes' user instructs the module to use glib
2599fbfaf8f3Smrg#		'no' user instructs the module not to use glib
2600fbfaf8f3Smrg#
2601fbfaf8f3SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602fbfaf8f3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603fbfaf8f3Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604fbfaf8f3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605fbfaf8f3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606fbfaf8f3Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607fbfaf8f3Smrgm4_undefine([_defopt])
2608fbfaf8f3Smrg
2609fbfaf8f3Smrghave_glib=no
2610fbfaf8f3Smrg# Do not probe GLib if user explicitly disabled unit testing
2611fbfaf8f3Smrgif test "x$enable_unit_tests" != x"no"; then
2612fbfaf8f3Smrg  # Do not probe GLib if user explicitly disabled it
2613fbfaf8f3Smrg  if test "x$with_glib" != x"no"; then
2614fbfaf8f3Smrg    m4_ifval(
2615fbfaf8f3Smrg      [$1],
2616fbfaf8f3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617fbfaf8f3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618fbfaf8f3Smrg    )
261943f32c10Smrg  fi
262043f32c10Smrgfi
262143f32c10Smrg
2622fbfaf8f3Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623fbfaf8f3Smrgif test "x$enable_unit_tests" = x"yes"; then
2624fbfaf8f3Smrg  if test "x$have_glib" = x"no"; then
2625fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262643f32c10Smrg  fi
262743f32c10Smrgfi
262843f32c10Smrg
2629fbfaf8f3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630fbfaf8f3Smrgif test "x$enable_unit_tests" = x"no"; then
2631fbfaf8f3Smrg  if test "x$with_glib" = x"yes"; then
2632fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633fbfaf8f3Smrg  fi
2634fbfaf8f3Smrgfi
263543f32c10Smrg
2636fbfaf8f3Smrg# Not having GLib when it has been explicitly requested is an error
2637fbfaf8f3Smrgif test "x$with_glib" = x"yes"; then
2638fbfaf8f3Smrg  if test "x$have_glib" = x"no"; then
2639fbfaf8f3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640fbfaf8f3Smrg  fi
2641fbfaf8f3Smrgfi
26426ef05171Smrg
2643fbfaf8f3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644fbfaf8f3Smrg]) # XORG_WITH_GLIB
26456ef05171Smrg
2646fbfaf8f3Smrg# XORG_LD_WRAP([required|optional])
2647fbfaf8f3Smrg# ---------------------------------
2648fbfaf8f3Smrg# Minimum version: 1.13.0
2649fbfaf8f3Smrg#
2650fbfaf8f3Smrg# Check if linker supports -wrap, passed via compiler flags
2651fbfaf8f3Smrg#
2652fbfaf8f3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653fbfaf8f3Smrg# Otherwise the value of $enable_unit_tests is blank.
2654fbfaf8f3Smrg#
2655fbfaf8f3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656fbfaf8f3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657fbfaf8f3Smrg# available, an argument of "optional" allows use when some unit tests require
2658fbfaf8f3Smrg# ld -wrap and others do not.
2659fbfaf8f3Smrg#
2660fbfaf8f3SmrgAC_DEFUN([XORG_LD_WRAP],[
2661fbfaf8f3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662fbfaf8f3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663fbfaf8f3Smrg                      void __wrap_exit(int status) { return; }],
2664fbfaf8f3Smrg                     [exit(0);])])
2665fbfaf8f3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666fbfaf8f3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667fbfaf8f3Smrg  if test "x$have_ld_wrap" = x"no"; then
2668fbfaf8f3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669fbfaf8f3Smrg  fi
2670fbfaf8f3Smrgfi
2671fbfaf8f3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672fbfaf8f3Smrg#
2673fbfaf8f3Smrg]) # XORG_LD_WRAP
26746ef05171Smrg
2675fbfaf8f3Smrg# XORG_CHECK_LINKER_FLAGS
2676fbfaf8f3Smrg# -----------------------
2677fbfaf8f3Smrg# SYNOPSIS
2678fbfaf8f3Smrg#
2679fbfaf8f3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680fbfaf8f3Smrg#
2681fbfaf8f3Smrg# DESCRIPTION
2682fbfaf8f3Smrg#
2683fbfaf8f3Smrg#   Check whether the given linker FLAGS work with the current language's
2684fbfaf8f3Smrg#   linker, or whether they give an error.
2685fbfaf8f3Smrg#
2686fbfaf8f3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687fbfaf8f3Smrg#   success/failure.
2688fbfaf8f3Smrg#
2689fbfaf8f3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690fbfaf8f3Smrg#
2691fbfaf8f3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692fbfaf8f3Smrg#
2693fbfaf8f3Smrg# LICENSE
2694fbfaf8f3Smrg#
2695fbfaf8f3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696fbfaf8f3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697fbfaf8f3Smrg#   Copyright (c) 2009 Matteo Frigo
2698fbfaf8f3Smrg#
2699fbfaf8f3Smrg#   This program is free software: you can redistribute it and/or modify it
2700fbfaf8f3Smrg#   under the terms of the GNU General Public License as published by the
2701fbfaf8f3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702fbfaf8f3Smrg#   option) any later version.
2703fbfaf8f3Smrg#
2704fbfaf8f3Smrg#   This program is distributed in the hope that it will be useful, but
2705fbfaf8f3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706fbfaf8f3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707fbfaf8f3Smrg#   Public License for more details.
2708fbfaf8f3Smrg#
2709fbfaf8f3Smrg#   You should have received a copy of the GNU General Public License along
2710fbfaf8f3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711fbfaf8f3Smrg#
2712fbfaf8f3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713fbfaf8f3Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714fbfaf8f3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715fbfaf8f3Smrg#   need not follow the terms of the GNU General Public License when using
2716fbfaf8f3Smrg#   or distributing such scripts, even though portions of the text of the
2717fbfaf8f3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718fbfaf8f3Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719fbfaf8f3Smrg#
2720fbfaf8f3Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721fbfaf8f3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722fbfaf8f3Smrg#   modified version of the Autoconf Macro, you may extend this special
2723fbfaf8f3Smrg#   exception to the GPL to apply to your modified version as well.#
2724fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725fbfaf8f3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726fbfaf8f3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727fbfaf8f3SmrgAS_LITERAL_IF([$1],
2728fbfaf8f3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729fbfaf8f3Smrg      ax_save_FLAGS=$LDFLAGS
2730fbfaf8f3Smrg      LDFLAGS="$1"
2731fbfaf8f3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732fbfaf8f3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733fbfaf8f3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734fbfaf8f3Smrg      LDFLAGS=$ax_save_FLAGS])],
2735fbfaf8f3Smrg  [ax_save_FLAGS=$LDFLAGS
2736fbfaf8f3Smrg   LDFLAGS="$1"
2737fbfaf8f3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738fbfaf8f3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739fbfaf8f3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740fbfaf8f3Smrg   LDFLAGS=$ax_save_FLAGS])
2741fbfaf8f3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742fbfaf8f3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743fbfaf8f3Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744fbfaf8f3Smrg	m4_default([$2], :)
2745fbfaf8f3Smrgelse
2746fbfaf8f3Smrg	m4_default([$3], :)
2747fbfaf8f3Smrgfi
2748fbfaf8f3Smrg]) # XORG_CHECK_LINKER_FLAGS
27496ef05171Smrg
2750fbfaf8f3Smrg# XORG_MEMORY_CHECK_FLAGS
2751fbfaf8f3Smrg# -----------------------
2752fbfaf8f3Smrg# Minimum version: 1.16.0
2753fbfaf8f3Smrg#
2754fbfaf8f3Smrg# This macro attempts to find appropriate memory checking functionality
2755fbfaf8f3Smrg# for various platforms which unit testing code may use to catch various
2756fbfaf8f3Smrg# forms of memory allocation and access errors in testing.
2757fbfaf8f3Smrg#
2758fbfaf8f3Smrg# Interface to module:
2759fbfaf8f3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760fbfaf8f3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761fbfaf8f3Smrg#
2762fbfaf8f3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763fbfaf8f3Smrg#
2764fbfaf8f3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27656ef05171Smrg
2766fbfaf8f3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767fbfaf8f3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768fbfaf8f3Smrg           [Environment variables to enable memory checking in tests])
27696ef05171Smrg
2770fbfaf8f3Smrg# Check for different types of support on different platforms
2771fbfaf8f3Smrgcase $host_os in
2772fbfaf8f3Smrg    solaris*)
2773fbfaf8f3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774fbfaf8f3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775fbfaf8f3Smrg        ;;
2776fbfaf8f3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777fbfaf8f3Smrg        # both directly and inverted, so should not be 0 or 255.
2778fbfaf8f3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779fbfaf8f3Smrg        ;;
2780fbfaf8f3Smrg    darwin*)
2781fbfaf8f3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782fbfaf8f3Smrg        ;;
2783fbfaf8f3Smrg    *bsd*)
2784fbfaf8f3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785fbfaf8f3Smrg        ;;
2786fbfaf8f3Smrgesac
27876ef05171Smrg
2788fbfaf8f3Smrg# User supplied flags override default flags
2789fbfaf8f3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790fbfaf8f3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27916ef05171Smrgfi
279243f32c10Smrg
2793fbfaf8f3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794fbfaf8f3Smrg]) # XORG_WITH_LINT
279543f32c10Smrg
2796fbfaf8f3Smrg# XORG_CHECK_MALLOC_ZERO
2797fbfaf8f3Smrg# ----------------------
2798fbfaf8f3Smrg# Minimum version: 1.0.0
279943f32c10Smrg#
2800fbfaf8f3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801fbfaf8f3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802fbfaf8f3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803fbfaf8f3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804fbfaf8f3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805fbfaf8f3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806fbfaf8f3Smrg		       [malloc(0) returns NULL (default: auto)]),
2807fbfaf8f3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808fbfaf8f3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280943f32c10Smrg
2810fbfaf8f3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811fbfaf8f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2812fbfaf8f3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2813fbfaf8f3Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814fbfaf8f3Smrg#include <stdlib.h>
2815fbfaf8f3Smrg],[
2816fbfaf8f3Smrg    char *m0, *r0, *c0, *p;
2817fbfaf8f3Smrg    m0 = malloc(0);
2818fbfaf8f3Smrg    p = malloc(10);
2819fbfaf8f3Smrg    r0 = realloc(p,0);
2820fbfaf8f3Smrg    c0 = calloc(0,10);
2821fbfaf8f3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822fbfaf8f3Smrg])],
2823fbfaf8f3Smrg		[xorg_cv_malloc0_returns_null=yes],
2824fbfaf8f3Smrg		[xorg_cv_malloc0_returns_null=no])])
2825fbfaf8f3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28266ef05171Smrgfi
2827fbfaf8f3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282843f32c10Smrg
2829fbfaf8f3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830fbfaf8f3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831fbfaf8f3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832fbfaf8f3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283343f32c10Smrgelse
2834fbfaf8f3Smrg	MALLOC_ZERO_CFLAGS=""
2835fbfaf8f3Smrg	XMALLOC_ZERO_CFLAGS=""
2836fbfaf8f3Smrg	XTMALLOC_ZERO_CFLAGS=""
283743f32c10Smrgfi
283843f32c10Smrg
2839fbfaf8f3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840fbfaf8f3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841fbfaf8f3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842fbfaf8f3Smrg]) # XORG_CHECK_MALLOC_ZERO
284343f32c10Smrg
2844fbfaf8f3Smrg# XORG_WITH_LINT()
2845fbfaf8f3Smrg# ----------------
2846fbfaf8f3Smrg# Minimum version: 1.1.0
284743f32c10Smrg#
2848fbfaf8f3Smrg# This macro enables the use of a tool that flags some suspicious and
2849fbfaf8f3Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850fbfaf8f3Smrg# It will attempt to locate the tool and use appropriate options.
2851fbfaf8f3Smrg# There are various lint type tools on different platforms.
285243f32c10Smrg#
2853fbfaf8f3Smrg# Interface to module:
2854fbfaf8f3Smrg# LINT:		returns the path to the tool found on the platform
2855fbfaf8f3Smrg#		or the value set to LINT on the configure cmd line
2856fbfaf8f3Smrg#		also an Automake conditional
2857fbfaf8f3Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858fbfaf8f3Smrg#
2859fbfaf8f3Smrg# --with-lint:	'yes' user instructs the module to use lint
2860fbfaf8f3Smrg#		'no' user instructs the module not to use lint (default)
2861fbfaf8f3Smrg#
2862fbfaf8f3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863fbfaf8f3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864fbfaf8f3Smrg#
2865fbfaf8f3SmrgAC_DEFUN([XORG_WITH_LINT],[
286643f32c10Smrg
2867fbfaf8f3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868fbfaf8f3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869fbfaf8f3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870fbfaf8f3Smrg		[Use a lint-style source code checker (default: disabled)])],
2871fbfaf8f3Smrg		[use_lint=$withval], [use_lint=no])
287243f32c10Smrg
2873fbfaf8f3Smrg# Obtain platform specific info like program name and options
2874fbfaf8f3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875fbfaf8f3Smrgcase $host_os in
2876fbfaf8f3Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877fbfaf8f3Smrg	lint_name=splint
2878fbfaf8f3Smrg	lint_options="-badflag"
2879fbfaf8f3Smrg	;;
2880fbfaf8f3Smrg  *freebsd* | *netbsd*)
2881fbfaf8f3Smrg	lint_name=lint
2882fbfaf8f3Smrg	lint_options="-u -b"
2883fbfaf8f3Smrg	;;
2884fbfaf8f3Smrg  *solaris*)
2885fbfaf8f3Smrg	lint_name=lint
2886fbfaf8f3Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887fbfaf8f3Smrg	;;
2888fbfaf8f3Smrgesac
2889fbfaf8f3Smrg
2890fbfaf8f3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891fbfaf8f3Smrgif test "x$use_lint" = x"yes" ; then
2892fbfaf8f3Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893fbfaf8f3Smrg   if test "x$LINT" = "x"; then
2894fbfaf8f3Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895fbfaf8f3Smrg   fi
2896fbfaf8f3Smrgelif test "x$use_lint" = x"no" ; then
2897fbfaf8f3Smrg   if test "x$LINT" != "x"; then
2898fbfaf8f3Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899fbfaf8f3Smrg   fi
290043f32c10Smrgelse
2901fbfaf8f3Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290243f32c10Smrgfi
290343f32c10Smrg
2904fbfaf8f3Smrg# User supplied flags override default flags
2905fbfaf8f3Smrgif test "x$LINT_FLAGS" != "x"; then
2906fbfaf8f3Smrg   lint_options=$LINT_FLAGS
2907fbfaf8f3Smrgfi
290843f32c10Smrg
2909fbfaf8f3SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910fbfaf8f3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291143f32c10Smrg
2912fbfaf8f3Smrg]) # XORG_WITH_LINT
291343f32c10Smrg
2914fbfaf8f3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915fbfaf8f3Smrg# --------------------------
2916fbfaf8f3Smrg# Minimum version: 1.1.0
29176ef05171Smrg#
2918fbfaf8f3Smrg# Sets up flags for building lint libraries for checking programs that call
2919fbfaf8f3Smrg# functions in the library.
2920fbfaf8f3Smrg#
2921fbfaf8f3Smrg# Interface to module:
2922fbfaf8f3Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923fbfaf8f3Smrg# MAKE_LINT_LIB		- Automake conditional
2924fbfaf8f3Smrg#
2925fbfaf8f3Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926fbfaf8f3Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29276ef05171Smrg
2928fbfaf8f3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929fbfaf8f3SmrgAC_REQUIRE([XORG_WITH_LINT])
2930fbfaf8f3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931fbfaf8f3Smrg	[Create lint library (default: disabled)])],
2932fbfaf8f3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933fbfaf8f3Smrg
2934fbfaf8f3Smrgif test "x$make_lint_lib" = x"yes" ; then
2935fbfaf8f3Smrg   LINTLIB=llib-l$1.ln
2936fbfaf8f3Smrg   if test "x$LINT" = "x"; then
2937fbfaf8f3Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938fbfaf8f3Smrg   fi
2939fbfaf8f3Smrgelif test "x$make_lint_lib" != x"no" ; then
2940fbfaf8f3Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29416ef05171Smrgfi
29426ef05171Smrg
2943fbfaf8f3SmrgAC_SUBST(LINTLIB)
2944fbfaf8f3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294543f32c10Smrg
2946fbfaf8f3Smrg]) # XORG_LINT_LIBRARY
294743f32c10Smrg
2948fbfaf8f3Smrg# XORG_COMPILER_BRAND
29496ef05171Smrg# -------------------
2950fbfaf8f3Smrg# Minimum version: 1.14.0
29516ef05171Smrg#
2952fbfaf8f3Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953fbfaf8f3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954fbfaf8f3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955fbfaf8f3Smrg#   clang compiler - sets CLANGCC to "yes"
2956fbfaf8f3Smrg#   Intel compiler - sets INTELCC to "yes"
2957fbfaf8f3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958fbfaf8f3Smrg#
2959fbfaf8f3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960fbfaf8f3SmrgAC_LANG_CASE(
2961fbfaf8f3Smrg	[C], [
2962fbfaf8f3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963fbfaf8f3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964fbfaf8f3Smrg		m4_version_prereq([2.70],
2965fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
2967fbfaf8f3Smrg	],
2968fbfaf8f3Smrg	[C++], [
2969fbfaf8f3Smrg		AC_REQUIRE([AC_PROG_CXX])
2970fbfaf8f3Smrg	]
2971fbfaf8f3Smrg)
2972fbfaf8f3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2973fbfaf8f3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2974fbfaf8f3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2975fbfaf8f3Smrg]) # XORG_COMPILER_BRAND
297643f32c10Smrg
2977fbfaf8f3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297843f32c10Smrg# ---------------
2979fbfaf8f3Smrg# Minimum version: 1.16.0
2980fbfaf8f3Smrg#
2981fbfaf8f3Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982fbfaf8f3Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
2983fbfaf8f3Smrg# next flag in the list until there are no more options.
2984fbfaf8f3Smrg#
2985fbfaf8f3Smrg# Note that this does not guarantee that the compiler supports the flag as some
2986fbfaf8f3Smrg# compilers will simply ignore arguments that they do not understand, but we do
2987fbfaf8f3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2988fbfaf8f3Smrg# -Werror=unused-command-line-argument
2989fbfaf8f3Smrg#
2990fbfaf8f3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2991fbfaf8f3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2992fbfaf8f3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29936ef05171Smrg
2994fbfaf8f3SmrgAC_LANG_COMPILER_REQUIRE
29956ef05171Smrg
2996fbfaf8f3SmrgAC_LANG_CASE(
2997fbfaf8f3Smrg	[C], [
2998fbfaf8f3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999fbfaf8f3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000fbfaf8f3Smrg		m4_version_prereq([2.70],
3001fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002fbfaf8f3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
3003fbfaf8f3Smrg		define([PREFIX], [C])
3004fbfaf8f3Smrg		define([CACHE_PREFIX], [cc])
3005fbfaf8f3Smrg		define([COMPILER], [$CC])
3006fbfaf8f3Smrg	],
3007fbfaf8f3Smrg	[C++], [
3008fbfaf8f3Smrg		define([PREFIX], [CXX])
3009fbfaf8f3Smrg		define([CACHE_PREFIX], [cxx])
3010fbfaf8f3Smrg		define([COMPILER], [$CXX])
3011fbfaf8f3Smrg	]
3012fbfaf8f3Smrg)
3013fbfaf8f3Smrg
3014fbfaf8f3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015fbfaf8f3Smrg
3016fbfaf8f3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3017fbfaf8f3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3018fbfaf8f3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3019fbfaf8f3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3020fbfaf8f3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3021fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3022fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3023fbfaf8f3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3024fbfaf8f3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
302543f32c10Smrgfi
3026fbfaf8f3Smrg
3027fbfaf8f3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3028fbfaf8f3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3029fbfaf8f3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3030fbfaf8f3Smrg	fi
3031fbfaf8f3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3032fbfaf8f3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3033fbfaf8f3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3034fbfaf8f3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3035fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3036fbfaf8f3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3037fbfaf8f3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3038fbfaf8f3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30396ef05171Smrgfi
3040fbfaf8f3Smrg
3041fbfaf8f3Smrgfound="no"
3042fbfaf8f3Smrgm4_foreach([flag], m4_cdr($@), [
3043fbfaf8f3Smrg	if test $found = "no" ; then
3044fbfaf8f3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3045fbfaf8f3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3046fbfaf8f3Smrg		fi
3047fbfaf8f3Smrg
3048fbfaf8f3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3049fbfaf8f3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3050fbfaf8f3Smrg		fi
3051fbfaf8f3Smrg
3052fbfaf8f3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053fbfaf8f3Smrg
3054fbfaf8f3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3055fbfaf8f3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3056fbfaf8f3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3057fbfaf8f3Smrg		AC_CACHE_VAL($cacheid,
3058fbfaf8f3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3059fbfaf8f3Smrg					     [eval $cacheid=yes],
3060fbfaf8f3Smrg					     [eval $cacheid=no])])
3061fbfaf8f3Smrg
3062fbfaf8f3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063fbfaf8f3Smrg
3064fbfaf8f3Smrg		eval supported=\$$cacheid
3065fbfaf8f3Smrg		AC_MSG_RESULT([$supported])
3066fbfaf8f3Smrg		if test "$supported" = "yes" ; then
3067fbfaf8f3Smrg			$1="$$1 ]flag["
3068fbfaf8f3Smrg			found="yes"
3069fbfaf8f3Smrg		fi
3070fbfaf8f3Smrg	fi
30716ef05171Smrg])
3072fbfaf8f3Smrg]) # XORG_TESTSET_CFLAG
307343f32c10Smrg
3074fbfaf8f3Smrg# XORG_COMPILER_FLAGS
3075fbfaf8f3Smrg# ---------------
3076fbfaf8f3Smrg# Minimum version: 1.16.0
30776ef05171Smrg#
3078fbfaf8f3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3079fbfaf8f3Smrg# arguments supported by the selected compiler which do NOT alter the generated
3080fbfaf8f3Smrg# code.  These arguments will cause the compiler to print various warnings
3081fbfaf8f3Smrg# during compilation AND turn a conservative set of warnings into errors.
3082fbfaf8f3Smrg#
3083fbfaf8f3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3084fbfaf8f3Smrg# future versions of util-macros as options are added to new compilers.
3085fbfaf8f3Smrg#
3086fbfaf8f3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3087fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30886ef05171Smrg
3089fbfaf8f3SmrgAC_ARG_ENABLE(selective-werror,
3090fbfaf8f3Smrg              AS_HELP_STRING([--disable-selective-werror],
3091fbfaf8f3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3092fbfaf8f3Smrg              [SELECTIVE_WERROR=$enableval],
3093fbfaf8f3Smrg              [SELECTIVE_WERROR=yes])
3094fbfaf8f3Smrg
3095fbfaf8f3SmrgAC_LANG_CASE(
3096fbfaf8f3Smrg        [C], [
3097fbfaf8f3Smrg                define([PREFIX], [C])
3098fbfaf8f3Smrg        ],
3099fbfaf8f3Smrg        [C++], [
3100fbfaf8f3Smrg                define([PREFIX], [CXX])
3101fbfaf8f3Smrg        ]
3102fbfaf8f3Smrg)
3103fbfaf8f3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3104fbfaf8f3Smrgif test "x$SUNCC" = "xyes"; then
3105fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]="-v"
31066ef05171Smrgelse
3107fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]=""
31086ef05171Smrgfi
31096ef05171Smrg
3110fbfaf8f3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3111fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3112fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3113fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3114fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
311543f32c10Smrg
3116fbfaf8f3SmrgAC_LANG_CASE(
3117fbfaf8f3Smrg	[C], [
3118fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3119fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3120fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3121fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3122fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3123fbfaf8f3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3124fbfaf8f3Smrg	]
3125fbfaf8f3Smrg)
312643f32c10Smrg
3127fbfaf8f3Smrg# This chunk adds additional warnings that could catch undesired effects.
3128fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3129fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3130fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3131fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3132fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3133fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3134fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
313543f32c10Smrg
3136fbfaf8f3Smrg# These are currently disabled because they are noisy.  They will be enabled
3137fbfaf8f3Smrg# in the future once the codebase is sufficiently modernized to silence
3138fbfaf8f3Smrg# them.  For now, I don't want them to drown out the other warnings.
3139fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3140fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3141fbfaf8f3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
314243f32c10Smrg
3143fbfaf8f3Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
3144fbfaf8f3Smrg# when there are problems that should be fixed.
31456ef05171Smrg
3146fbfaf8f3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3147fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3148fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3149fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3150fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3151fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3152fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3153fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3154fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3155fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3156fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3157fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3158fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3159fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3160fbfaf8f3Smrgelse
3161fbfaf8f3SmrgAC_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])
3162fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3163fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3164fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3165fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3166fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3167fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3168fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3169fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3170fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3171fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3172fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3173fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3174fbfaf8f3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3175fbfaf8f3Smrgfi
3176fbfaf8f3Smrg
3177fbfaf8f3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3178fbfaf8f3Smrg]) # XORG_COMPILER_FLAGS
317943f32c10Smrg
3180fbfaf8f3Smrg# XORG_CWARNFLAGS
3181fbfaf8f3Smrg# ---------------
3182fbfaf8f3Smrg# Minimum version: 1.2.0
3183fbfaf8f3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318443f32c10Smrg#
3185fbfaf8f3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186fbfaf8f3Smrg#
3187fbfaf8f3Smrg# This function is deprecated because it defines -fno-strict-aliasing
3188fbfaf8f3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3189fbfaf8f3Smrg# is needed, then it should be added explicitly in the module when
3190fbfaf8f3Smrg# it is updated to use BASE_CFLAGS.
3191fbfaf8f3Smrg#
3192fbfaf8f3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3193fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3194fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3195fbfaf8f3SmrgAC_LANG_CASE(
3196fbfaf8f3Smrg	[C], [
3197fbfaf8f3Smrg		CWARNFLAGS="$BASE_CFLAGS"
3198fbfaf8f3Smrg		if  test "x$GCC" = xyes ; then
3199fbfaf8f3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3200fbfaf8f3Smrg		fi
3201fbfaf8f3Smrg		AC_SUBST(CWARNFLAGS)
3202fbfaf8f3Smrg	]
3203fbfaf8f3Smrg)
3204fbfaf8f3Smrg]) # XORG_CWARNFLAGS
320543f32c10Smrg
3206fbfaf8f3Smrg# XORG_STRICT_OPTION
3207fbfaf8f3Smrg# -----------------------
3208fbfaf8f3Smrg# Minimum version: 1.3.0
320943f32c10Smrg#
3210fbfaf8f3Smrg# Add configure option to enable strict compilation flags, such as treating
3211fbfaf8f3Smrg# warnings as fatal errors.
3212fbfaf8f3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3213fbfaf8f3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32146ef05171Smrg#
3215fbfaf8f3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3216fbfaf8f3Smrg# when strict compilation is unconditionally desired.
3217fbfaf8f3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3218fbfaf8f3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3219fbfaf8f3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
322043f32c10Smrg
3221fbfaf8f3SmrgAC_ARG_ENABLE(strict-compilation,
3222fbfaf8f3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3223fbfaf8f3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3224fbfaf8f3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32256ef05171Smrg
3226fbfaf8f3SmrgAC_LANG_CASE(
3227fbfaf8f3Smrg        [C], [
3228fbfaf8f3Smrg                define([PREFIX], [C])
3229fbfaf8f3Smrg        ],
3230fbfaf8f3Smrg        [C++], [
3231fbfaf8f3Smrg                define([PREFIX], [CXX])
3232fbfaf8f3Smrg        ]
3233fbfaf8f3Smrg)
32346ef05171Smrg
3235fbfaf8f3Smrg[STRICT_]PREFIX[FLAGS]=""
3236fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3237fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32386ef05171Smrg
3239fbfaf8f3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3240fbfaf8f3Smrg# activate it with -Werror, so we add it here explicitly.
3241fbfaf8f3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32426ef05171Smrg
3243fbfaf8f3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3244fbfaf8f3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3245fbfaf8f3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3246fbfaf8f3Smrgfi
3247fbfaf8f3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3248fbfaf8f3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3249fbfaf8f3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3250fbfaf8f3Smrg]) # XORG_STRICT_OPTION
32516ef05171Smrg
3252fbfaf8f3Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253fbfaf8f3Smrg# ---------------------------
3254fbfaf8f3Smrg# Minimum version: 1.20.0
3255fbfaf8f3Smrg#
3256fbfaf8f3Smrg# Defines default options for X.Org modules which don't compile code,
3257fbfaf8f3Smrg# such as fonts, bitmaps, cursors, and docs.
3258fbfaf8f3Smrg#
3259fbfaf8f3SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260fbfaf8f3SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261fbfaf8f3SmrgXORG_RELEASE_VERSION
3262fbfaf8f3SmrgXORG_CHANGELOG
3263fbfaf8f3SmrgXORG_INSTALL
3264fbfaf8f3SmrgXORG_MANPAGE_SECTIONS
3265fbfaf8f3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266fbfaf8f3Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267fbfaf8f3Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32686ef05171Smrg
3269fbfaf8f3Smrg# XORG_DEFAULT_OPTIONS
3270fbfaf8f3Smrg# --------------------
3271fbfaf8f3Smrg# Minimum version: 1.3.0
3272fbfaf8f3Smrg#
3273fbfaf8f3Smrg# Defines default options for X.Org modules which compile code.
3274fbfaf8f3Smrg#
3275fbfaf8f3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3276fbfaf8f3SmrgAC_REQUIRE([AC_PROG_INSTALL])
3277fbfaf8f3SmrgXORG_COMPILER_FLAGS
3278fbfaf8f3SmrgXORG_CWARNFLAGS
3279fbfaf8f3SmrgXORG_STRICT_OPTION
3280fbfaf8f3SmrgXORG_DEFAULT_NOCODE_OPTIONS
3281fbfaf8f3Smrg]) # XORG_DEFAULT_OPTIONS
328243f32c10Smrg
3283fbfaf8f3Smrg# XORG_INSTALL()
3284fbfaf8f3Smrg# ----------------
3285fbfaf8f3Smrg# Minimum version: 1.4.0
3286fbfaf8f3Smrg#
3287fbfaf8f3Smrg# Defines the variable INSTALL_CMD as the command to copy
3288fbfaf8f3Smrg# INSTALL from $prefix/share/util-macros.
3289fbfaf8f3Smrg#
3290fbfaf8f3SmrgAC_DEFUN([XORG_INSTALL], [
3291fbfaf8f3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3292fbfaf8f3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3293fbfaf8f3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3294fbfaf8f3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3295fbfaf8f3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3296fbfaf8f3Smrgtouch \$(top_srcdir)/INSTALL; \
3297fbfaf8f3Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3298fbfaf8f3SmrgAC_SUBST([INSTALL_CMD])
3299fbfaf8f3Smrg]) # XORG_INSTALL
3300fbfaf8f3Smrgdnl Copyright 2005 Red Hat, Inc
3301fbfaf8f3Smrgdnl
3302fbfaf8f3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3303fbfaf8f3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3304fbfaf8f3Smrgdnl the above copyright notice appear in all copies and that both that
3305fbfaf8f3Smrgdnl copyright notice and this permission notice appear in supporting
3306fbfaf8f3Smrgdnl documentation.
3307fbfaf8f3Smrgdnl
3308fbfaf8f3Smrgdnl The above copyright notice and this permission notice shall be included
3309fbfaf8f3Smrgdnl in all copies or substantial portions of the Software.
3310fbfaf8f3Smrgdnl
3311fbfaf8f3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3312fbfaf8f3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3313fbfaf8f3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3314fbfaf8f3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3315fbfaf8f3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3316fbfaf8f3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3317fbfaf8f3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3318fbfaf8f3Smrgdnl
3319fbfaf8f3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3320fbfaf8f3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3321fbfaf8f3Smrgdnl other dealings in this Software without prior written authorization
3322fbfaf8f3Smrgdnl from the copyright holders.
3323fbfaf8f3Smrgdnl
33246ef05171Smrg
3325fbfaf8f3Smrg# XORG_RELEASE_VERSION
3326fbfaf8f3Smrg# --------------------
3327fbfaf8f3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
332843f32c10Smrg
3329fbfaf8f3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3330fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3331fbfaf8f3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3332fbfaf8f3Smrg		[Major version of this package])
3333fbfaf8f3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3334fbfaf8f3Smrg	if test "x$PVM" = "x"; then
3335fbfaf8f3Smrg		PVM="0"
3336fbfaf8f3Smrg	fi
3337fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3338fbfaf8f3Smrg		[$PVM],
3339fbfaf8f3Smrg		[Minor version of this package])
3340fbfaf8f3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3341fbfaf8f3Smrg	if test "x$PVP" = "x"; then
3342fbfaf8f3Smrg		PVP="0"
3343fbfaf8f3Smrg	fi
3344fbfaf8f3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3345fbfaf8f3Smrg		[$PVP],
3346fbfaf8f3Smrg		[Patch version of this package])
3347fbfaf8f3Smrg])
33486ef05171Smrg
3349fbfaf8f3Smrg# XORG_CHANGELOG()
3350fbfaf8f3Smrg# ----------------
3351fbfaf8f3Smrg# Minimum version: 1.2.0
3352fbfaf8f3Smrg#
3353fbfaf8f3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3354fbfaf8f3Smrg# ChangeLog from git.
3355fbfaf8f3Smrg#
3356fbfaf8f3Smrg#
3357fbfaf8f3SmrgAC_DEFUN([XORG_CHANGELOG], [
3358fbfaf8f3SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3359fbfaf8f3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3360fbfaf8f3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3361fbfaf8f3Smrgtouch \$(top_srcdir)/ChangeLog; \
3362fbfaf8f3Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3363fbfaf8f3SmrgAC_SUBST([CHANGELOG_CMD])
3364fbfaf8f3Smrg]) # XORG_CHANGELOG
336543f32c10Smrg
3366