aclocal.m4 revision bdc460c5
1bdc460c5Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
224047306Smrg
3bdc460c5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
414c0a534Smrg
514c0a534Smrg# This file is free software; the Free Software Foundation
614c0a534Smrg# gives unlimited permission to copy and/or distribute it,
714c0a534Smrg# with or without modifications, as long as this notice is preserved.
814c0a534Smrg
914c0a534Smrg# This program is distributed in the hope that it will be useful,
1014c0a534Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1114c0a534Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1214c0a534Smrg# PARTICULAR PURPOSE.
1314c0a534Smrg
1424047306Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17bdc460c5Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18bdc460c5Smrg[m4_warning([this file was generated for autoconf 2.71.
19bf2eeab3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20bf2eeab3SmrgIf you have problems, you may need to regenerate the build system entirely.
2124047306SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2214c0a534Smrg
23bdc460c5Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2414c0a534Smrg#
25bf2eeab3Smrg# This file is free software; the Free Software Foundation
26bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
27bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
2814c0a534Smrg
29bf2eeab3Smrg# AM_AUTOMAKE_VERSION(VERSION)
30bf2eeab3Smrg# ----------------------------
31bf2eeab3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32bf2eeab3Smrg# generated from the m4 files accompanying Automake X.Y.
33bf2eeab3Smrg# (This private macro should not be called outside this file.)
34bf2eeab3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35bdc460c5Smrg[am__api_version='1.16'
36bf2eeab3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37bf2eeab3Smrgdnl require some minimum version.  Point them to the right macro.
38bdc460c5Smrgm4_if([$1], [1.16.5], [],
39bf2eeab3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40bf2eeab3Smrg])
4114c0a534Smrg
42bf2eeab3Smrg# _AM_AUTOCONF_VERSION(VERSION)
4314c0a534Smrg# -----------------------------
44bf2eeab3Smrg# aclocal traces this macro to find the Autoconf version.
45bf2eeab3Smrg# This is a private macro too.  Using m4_define simplifies
46bf2eeab3Smrg# the logic in aclocal, which can simply ignore this definition.
47bf2eeab3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48bf2eeab3Smrg
49bf2eeab3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50bf2eeab3Smrg# -------------------------------
51bf2eeab3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52bf2eeab3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53bf2eeab3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54bdc460c5Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55bf2eeab3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56bf2eeab3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57bf2eeab3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5814c0a534Smrg
59bf2eeab3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6014c0a534Smrg
61bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
62bf2eeab3Smrg#
63bf2eeab3Smrg# This file is free software; the Free Software Foundation
64bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
65bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
66bf2eeab3Smrg
67bf2eeab3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6824047306Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6924047306Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7014c0a534Smrg#
71bf2eeab3Smrg# Of course, Automake must honor this variable whenever it calls a
72bf2eeab3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73bf2eeab3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74bf2eeab3Smrg# depending on how configure is run.  This is pretty annoying, since
75bf2eeab3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76bf2eeab3Smrg# source directory, any form will work fine, but in subdirectories a
77bf2eeab3Smrg# relative path needs to be adjusted first.
7814c0a534Smrg#
79bf2eeab3Smrg# $ac_aux_dir/missing
80bf2eeab3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81bf2eeab3Smrg# $top_srcdir/$ac_aux_dir/missing
82bf2eeab3Smrg#    fails if $ac_aux_dir is absolute,
83bf2eeab3Smrg#    fails when called from a subdirectory in a VPATH build with
84bf2eeab3Smrg#          a relative $ac_aux_dir
8514c0a534Smrg#
86bf2eeab3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87bf2eeab3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8824047306Smrg# harmless because $srcdir is '.', but things will broke when you
89bf2eeab3Smrg# start a VPATH build or use an absolute $srcdir.
9014c0a534Smrg#
91bf2eeab3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92bf2eeab3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93bf2eeab3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94bf2eeab3Smrg# and then we would define $MISSING as
95bf2eeab3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96bf2eeab3Smrg# This will work as long as MISSING is not called from configure, because
97bf2eeab3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
98bf2eeab3Smrg# However there are other variables, like CC, which are often used in
99bf2eeab3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100bf2eeab3Smrg#
101bf2eeab3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
102bf2eeab3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
103bf2eeab3Smrg# configured tree to be moved without reconfiguration.
10414c0a534Smrg
105bf2eeab3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10624047306Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10724047306Smrg# Expand $ac_aux_dir to an absolute path.
10824047306Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109bf2eeab3Smrg])
11014c0a534Smrg
111bf2eeab3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11214c0a534Smrg
113bdc460c5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
114bf2eeab3Smrg#
115bf2eeab3Smrg# This file is free software; the Free Software Foundation
116bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
117bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
11814c0a534Smrg
119bf2eeab3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120bf2eeab3Smrg# -------------------------------------
121bf2eeab3Smrg# Define a conditional.
122bf2eeab3SmrgAC_DEFUN([AM_CONDITIONAL],
12324047306Smrg[AC_PREREQ([2.52])dnl
12424047306Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12524047306Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126bf2eeab3SmrgAC_SUBST([$1_TRUE])dnl
127bf2eeab3SmrgAC_SUBST([$1_FALSE])dnl
128bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129bf2eeab3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130bf2eeab3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
131bf2eeab3Smrgif $2; then
132bf2eeab3Smrg  $1_TRUE=
133bf2eeab3Smrg  $1_FALSE='#'
134bf2eeab3Smrgelse
135bf2eeab3Smrg  $1_TRUE='#'
136bf2eeab3Smrg  $1_FALSE=
137bf2eeab3Smrgfi
138bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(
139bf2eeab3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140bf2eeab3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
141bf2eeab3SmrgUsually this means the macro was only invoked conditionally.]])
142bf2eeab3Smrgfi])])
14314c0a534Smrg
144bdc460c5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145bf2eeab3Smrg#
146bf2eeab3Smrg# This file is free software; the Free Software Foundation
147bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
148bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
14914c0a534Smrg
15014c0a534Smrg
15124047306Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152bf2eeab3Smrg# written in clear, in which case automake, when reading aclocal.m4,
153bf2eeab3Smrg# will think it sees a *use*, and therefore will trigger all it's
154bf2eeab3Smrg# C support machinery.  Also note that it means that autoscan, seeing
155bf2eeab3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15614c0a534Smrg
15714c0a534Smrg
158bf2eeab3Smrg# _AM_DEPENDENCIES(NAME)
159bf2eeab3Smrg# ----------------------
160bf2eeab3Smrg# See how the compiler implements dependency checking.
16124047306Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162bf2eeab3Smrg# We try a few techniques and use that to set a single cache variable.
163bf2eeab3Smrg#
164bf2eeab3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165bf2eeab3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166bf2eeab3Smrg# dependency, and given that the user is not expected to run this macro,
167bf2eeab3Smrg# just rely on AC_PROG_CC.
168bf2eeab3SmrgAC_DEFUN([_AM_DEPENDENCIES],
169bf2eeab3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
170bf2eeab3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171bf2eeab3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
172bf2eeab3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17314c0a534Smrg
17424047306Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17524047306Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17624047306Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17724047306Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17824047306Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17924047306Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18024047306Smrg                    [depcc="$$1"   am_compiler_list=])
18114c0a534Smrg
182bf2eeab3SmrgAC_CACHE_CHECK([dependency style of $depcc],
183bf2eeab3Smrg               [am_cv_$1_dependencies_compiler_type],
184bf2eeab3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185bf2eeab3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
186bf2eeab3Smrg  # making bogus files that we don't know about and never remove.  For
187bf2eeab3Smrg  # instance it was reported that on HP-UX the gcc test will end up
18824047306Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18924047306Smrg  # in D".
19024047306Smrg  rm -rf conftest.dir
191bf2eeab3Smrg  mkdir conftest.dir
192bf2eeab3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
193bf2eeab3Smrg  # using a relative directory.
194bf2eeab3Smrg  cp "$am_depcomp" conftest.dir
195bf2eeab3Smrg  cd conftest.dir
196bf2eeab3Smrg  # We will build objects and dependencies in a subdirectory because
197bf2eeab3Smrg  # it helps to detect inapplicable dependency modes.  For instance
198bf2eeab3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
199bf2eeab3Smrg  # side effect of compilation, but ICC will put the dependencies in
200bf2eeab3Smrg  # the current directory while Tru64 will put them in the object
201bf2eeab3Smrg  # directory.
202bf2eeab3Smrg  mkdir sub
20314c0a534Smrg
204bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
205bf2eeab3Smrg  if test "$am_compiler_list" = ""; then
206bf2eeab3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207bf2eeab3Smrg  fi
208bf2eeab3Smrg  am__universal=false
209bf2eeab3Smrg  m4_case([$1], [CC],
210bf2eeab3Smrg    [case " $depcc " in #(
211bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212bf2eeab3Smrg     esac],
213bf2eeab3Smrg    [CXX],
214bf2eeab3Smrg    [case " $depcc " in #(
215bf2eeab3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216bf2eeab3Smrg     esac])
21714c0a534Smrg
218bf2eeab3Smrg  for depmode in $am_compiler_list; do
219bf2eeab3Smrg    # Setup a source with many dependencies, because some compilers
220bf2eeab3Smrg    # like to wrap large dependency lists on column 80 (with \), and
221bf2eeab3Smrg    # we should not choose a depcomp mode which is confused by this.
222bf2eeab3Smrg    #
223bf2eeab3Smrg    # We need to recreate these files for each test, as the compiler may
224bf2eeab3Smrg    # overwrite some of them when testing with obscure command lines.
225bf2eeab3Smrg    # This happens at least with the AIX C compiler.
226bf2eeab3Smrg    : > sub/conftest.c
227bf2eeab3Smrg    for i in 1 2 3 4 5 6; do
228bf2eeab3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22924047306Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23024047306Smrg      # Solaris 10 /bin/sh.
23124047306Smrg      echo '/* dummy */' > sub/conftst$i.h
232bf2eeab3Smrg    done
233bf2eeab3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234bf2eeab3Smrg
23524047306Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236bf2eeab3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23724047306Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23824047306Smrg    # versions had trouble with output in subdirs.
239bf2eeab3Smrg    am__obj=sub/conftest.${OBJEXT-o}
240bf2eeab3Smrg    am__minus_obj="-o $am__obj"
241bf2eeab3Smrg    case $depmode in
242bf2eeab3Smrg    gcc)
243bf2eeab3Smrg      # This depmode causes a compiler race in universal mode.
244bf2eeab3Smrg      test "$am__universal" = false || continue
245bf2eeab3Smrg      ;;
246bf2eeab3Smrg    nosideeffect)
24724047306Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24824047306Smrg      # only be used when explicitly requested.
249bf2eeab3Smrg      if test "x$enable_dependency_tracking" = xyes; then
250bf2eeab3Smrg	continue
251bf2eeab3Smrg      else
252bf2eeab3Smrg	break
253bf2eeab3Smrg      fi
254bf2eeab3Smrg      ;;
25524047306Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25624047306Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257bf2eeab3Smrg      # not run yet.  These depmodes are late enough in the game, and
258bf2eeab3Smrg      # so weak that their functioning should not be impacted.
259bf2eeab3Smrg      am__obj=conftest.${OBJEXT-o}
260bf2eeab3Smrg      am__minus_obj=
261bf2eeab3Smrg      ;;
262bf2eeab3Smrg    none) break ;;
263bf2eeab3Smrg    esac
264bf2eeab3Smrg    if depmode=$depmode \
265bf2eeab3Smrg       source=sub/conftest.c object=$am__obj \
266bf2eeab3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267bf2eeab3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268bf2eeab3Smrg         >/dev/null 2>conftest.err &&
269bf2eeab3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270bf2eeab3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271bf2eeab3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272bf2eeab3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273bf2eeab3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
274bf2eeab3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
275bf2eeab3Smrg      # that says an option was ignored or not supported.
276bf2eeab3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
277bf2eeab3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
278bf2eeab3Smrg      # The diagnosis changed in icc 8.0:
279bf2eeab3Smrg      #   icc: Command line remark: option '-MP' not supported
280bf2eeab3Smrg      if (grep 'ignoring option' conftest.err ||
281bf2eeab3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282bf2eeab3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
283bf2eeab3Smrg        break
284bf2eeab3Smrg      fi
285bf2eeab3Smrg    fi
286bf2eeab3Smrg  done
287bf2eeab3Smrg
288bf2eeab3Smrg  cd ..
289bf2eeab3Smrg  rm -rf conftest.dir
29014c0a534Smrgelse
291bf2eeab3Smrg  am_cv_$1_dependencies_compiler_type=none
29214c0a534Smrgfi
293bf2eeab3Smrg])
294bf2eeab3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295bf2eeab3SmrgAM_CONDITIONAL([am__fastdep$1], [
296bf2eeab3Smrg  test "x$enable_dependency_tracking" != xno \
297bf2eeab3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298bf2eeab3Smrg])
29914c0a534Smrg
30014c0a534Smrg
301bf2eeab3Smrg# AM_SET_DEPDIR
302bf2eeab3Smrg# -------------
303bf2eeab3Smrg# Choose a directory name for dependency files.
30424047306Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305bf2eeab3SmrgAC_DEFUN([AM_SET_DEPDIR],
306bf2eeab3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307bf2eeab3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308bf2eeab3Smrg])
30914c0a534Smrg
31014c0a534Smrg
311bf2eeab3Smrg# AM_DEP_TRACK
312bf2eeab3Smrg# ------------
313bf2eeab3SmrgAC_DEFUN([AM_DEP_TRACK],
31424047306Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31524047306SmrgAS_HELP_STRING(
31624047306Smrg  [--enable-dependency-tracking],
31724047306Smrg  [do not reject slow dependency extractors])
31824047306SmrgAS_HELP_STRING(
31924047306Smrg  [--disable-dependency-tracking],
32024047306Smrg  [speeds up one-time build])])
321bf2eeab3Smrgif test "x$enable_dependency_tracking" != xno; then
322bf2eeab3Smrg  am_depcomp="$ac_aux_dir/depcomp"
323bf2eeab3Smrg  AMDEPBACKSLASH='\'
32424047306Smrg  am__nodep='_no'
32514c0a534Smrgfi
326bf2eeab3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327bf2eeab3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
328bf2eeab3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32924047306SmrgAC_SUBST([am__nodep])dnl
33024047306Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331bf2eeab3Smrg])
33214c0a534Smrg
333bf2eeab3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334bf2eeab3Smrg
335bdc460c5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336bf2eeab3Smrg#
337bf2eeab3Smrg# This file is free software; the Free Software Foundation
338bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
339bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
340bf2eeab3Smrg
341bf2eeab3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
342bf2eeab3Smrg# ------------------------------
343bf2eeab3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344bf2eeab3Smrg[{
34524047306Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346bf2eeab3Smrg  # are listed without --file.  Let's play safe and only enable the eval
347bf2eeab3Smrg  # if we detect the quoting.
348bdc460c5Smrg  # TODO: see whether this extra hack can be removed once we start
349bdc460c5Smrg  # requiring Autoconf 2.70 or later.
350bdc460c5Smrg  AS_CASE([$CONFIG_FILES],
351bdc460c5Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
352bdc460c5Smrg          [*], [set x $CONFIG_FILES])
353bf2eeab3Smrg  shift
354bdc460c5Smrg  # Used to flag and report bootstrapping failures.
355bdc460c5Smrg  am_rc=0
356bdc460c5Smrg  for am_mf
357bf2eeab3Smrg  do
358bf2eeab3Smrg    # Strip MF so we end up with the name of the file.
359bdc460c5Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360bdc460c5Smrg    # Check whether this is an Automake generated Makefile which includes
361bdc460c5Smrg    # dependency-tracking related rules and includes.
362bdc460c5Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363bf2eeab3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364bdc460c5Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365bdc460c5Smrg      || continue
366bdc460c5Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367bdc460c5Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368bdc460c5Smrg    AM_RUN_LOG([cd "$am_dirpart" \
369bdc460c5Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370bdc460c5Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
371bf2eeab3Smrg  done
372bdc460c5Smrg  if test $am_rc -ne 0; then
373bdc460c5Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374bdc460c5Smrg    for automatic dependency tracking.  If GNU make was not used, consider
375bdc460c5Smrg    re-running the configure script with MAKE="gmake" (or whatever is
376bdc460c5Smrg    necessary).  You can also try re-running configure with the
377bdc460c5Smrg    '--disable-dependency-tracking' option to at least be able to build
378bdc460c5Smrg    the package (albeit without support for automatic dependency tracking).])
379bdc460c5Smrg  fi
380bdc460c5Smrg  AS_UNSET([am_dirpart])
381bdc460c5Smrg  AS_UNSET([am_filepart])
382bdc460c5Smrg  AS_UNSET([am_mf])
383bdc460c5Smrg  AS_UNSET([am_rc])
384bdc460c5Smrg  rm -f conftest-deps.mk
385bf2eeab3Smrg}
386bf2eeab3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387bf2eeab3Smrg
388bf2eeab3Smrg
389bf2eeab3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
390bf2eeab3Smrg# -----------------------------
391bf2eeab3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392bf2eeab3Smrg#
393bdc460c5Smrg# This code is only required when automatic dependency tracking is enabled.
394bdc460c5Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395bdc460c5Smrg# order to bootstrap the dependency handling code.
396bf2eeab3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397bf2eeab3Smrg[AC_CONFIG_COMMANDS([depfiles],
398bf2eeab3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399bdc460c5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400bf2eeab3Smrg
401bf2eeab3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402bf2eeab3Smrg
403bdc460c5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404bf2eeab3Smrg#
405bf2eeab3Smrg# This file is free software; the Free Software Foundation
406bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
407bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
408bf2eeab3Smrg
409bf2eeab3Smrg# This macro actually does too much.  Some checks are only needed if
410bf2eeab3Smrg# your package does certain things.  But this isn't really a big deal.
411bf2eeab3Smrg
41224047306Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41324047306Smrgm4_define([AC_PROG_CC],
41424047306Smrgm4_defn([AC_PROG_CC])
41524047306Smrg[_AM_PROG_CC_C_O
41624047306Smrg])
41724047306Smrg
418bf2eeab3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419bf2eeab3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
420bf2eeab3Smrg# -----------------------------------------------
421bf2eeab3Smrg# The call with PACKAGE and VERSION arguments is the old style
422bf2eeab3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423bf2eeab3Smrg# and VERSION should now be passed to AC_INIT and removed from
424bf2eeab3Smrg# the call to AM_INIT_AUTOMAKE.
425bf2eeab3Smrg# We support both call styles for the transition.  After
426bf2eeab3Smrg# the next Automake release, Autoconf can make the AC_INIT
427bf2eeab3Smrg# arguments mandatory, and then we can depend on a new Autoconf
428bf2eeab3Smrg# release and drop the old call support.
429bf2eeab3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43024047306Smrg[AC_PREREQ([2.65])dnl
431bdc460c5Smrgm4_ifdef([_$0_ALREADY_INIT],
432bdc460c5Smrg  [m4_fatal([$0 expanded multiple times
433bdc460c5Smrg]m4_defn([_$0_ALREADY_INIT]))],
434bdc460c5Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
435bf2eeab3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
436bf2eeab3Smrgdnl the ones we care about.
437bf2eeab3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
438bf2eeab3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
439bf2eeab3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
440bf2eeab3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
441bf2eeab3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
442bf2eeab3Smrg  # is not polluted with repeated "-I."
443bf2eeab3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
444bf2eeab3Smrg  # test to see if srcdir already configured
445bf2eeab3Smrg  if test -f $srcdir/config.status; then
446bf2eeab3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
447bf2eeab3Smrg  fi
44814c0a534Smrgfi
44914c0a534Smrg
450bf2eeab3Smrg# test whether we have cygpath
451bf2eeab3Smrgif test -z "$CYGPATH_W"; then
452bf2eeab3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
453bf2eeab3Smrg    CYGPATH_W='cygpath -w'
454bf2eeab3Smrg  else
455bf2eeab3Smrg    CYGPATH_W=echo
456bf2eeab3Smrg  fi
45714c0a534Smrgfi
458bf2eeab3SmrgAC_SUBST([CYGPATH_W])
459bf2eeab3Smrg
460bf2eeab3Smrg# Define the identity of the package.
461bf2eeab3Smrgdnl Distinguish between old-style and new-style calls.
462bf2eeab3Smrgm4_ifval([$2],
46324047306Smrg[AC_DIAGNOSE([obsolete],
46424047306Smrg             [$0: two- and three-arguments forms are deprecated.])
46524047306Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
466bf2eeab3Smrg AC_SUBST([PACKAGE], [$1])dnl
467bf2eeab3Smrg AC_SUBST([VERSION], [$2])],
468bf2eeab3Smrg[_AM_SET_OPTIONS([$1])dnl
469bf2eeab3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47024047306Smrgm4_if(
471bdc460c5Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47224047306Smrg  [ok:ok],,
473bf2eeab3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
474bf2eeab3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
475bf2eeab3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476bf2eeab3Smrg
477bf2eeab3Smrg_AM_IF_OPTION([no-define],,
47824047306Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47924047306Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480bf2eeab3Smrg
481bf2eeab3Smrg# Some tools Automake needs.
482bf2eeab3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
483bf2eeab3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48424047306SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48524047306SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48624047306SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48724047306SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48824047306SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490bf2eeab3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49124047306SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49224047306Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49324047306Smrg# dies out for good.  For more background, see:
494bdc460c5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495bdc460c5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49624047306SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49724047306Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49824047306Smrg# system "awk" is bad on some platforms.
499bf2eeab3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
500bf2eeab3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
501bf2eeab3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
502bf2eeab3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503bf2eeab3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504bf2eeab3Smrg			     [_AM_PROG_TAR([v7])])])
505bf2eeab3Smrg_AM_IF_OPTION([no-dependencies],,
506bf2eeab3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50724047306Smrg		  [_AM_DEPENDENCIES([CC])],
50824047306Smrg		  [m4_define([AC_PROG_CC],
50924047306Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
510bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51124047306Smrg		  [_AM_DEPENDENCIES([CXX])],
51224047306Smrg		  [m4_define([AC_PROG_CXX],
51324047306Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
514bf2eeab3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51524047306Smrg		  [_AM_DEPENDENCIES([OBJC])],
51624047306Smrg		  [m4_define([AC_PROG_OBJC],
51724047306Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51824047306SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51924047306Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52024047306Smrg		  [m4_define([AC_PROG_OBJCXX],
52124047306Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522bf2eeab3Smrg])
523bdc460c5Smrg# Variables for tags utilities; see am/tags.am
524bdc460c5Smrgif test -z "$CTAGS"; then
525bdc460c5Smrg  CTAGS=ctags
526bdc460c5Smrgfi
527bdc460c5SmrgAC_SUBST([CTAGS])
528bdc460c5Smrgif test -z "$ETAGS"; then
529bdc460c5Smrg  ETAGS=etags
530bdc460c5Smrgfi
531bdc460c5SmrgAC_SUBST([ETAGS])
532bdc460c5Smrgif test -z "$CSCOPE"; then
533bdc460c5Smrg  CSCOPE=cscope
534bdc460c5Smrgfi
535bdc460c5SmrgAC_SUBST([CSCOPE])
536bdc460c5Smrg
53724047306SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53824047306Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53924047306Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54024047306Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541bf2eeab3SmrgAC_CONFIG_COMMANDS_PRE(dnl
542bf2eeab3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543bf2eeab3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54424047306Smrg
54524047306Smrg# POSIX will say in a future version that running "rm -f" with no argument
54624047306Smrg# is OK; and we want to be able to make that assumption in our Makefile
54724047306Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54824047306Smrg# actually supported "in the wild" to an acceptable degree.
54924047306Smrg# See automake bug#10828.
55024047306Smrg# To make any issue more visible, cause the running configure to be aborted
55124047306Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55224047306Smrg# user can still override this though.
55324047306Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55424047306Smrg  cat >&2 <<'END'
55524047306SmrgOops!
55624047306Smrg
55724047306SmrgYour 'rm' program seems unable to run without file operands specified
55824047306Smrgon the command line, even when the '-f' option is present.  This is contrary
55924047306Smrgto the behaviour of most rm programs out there, and not conforming with
56024047306Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56124047306Smrg
56224047306SmrgPlease tell bug-automake@gnu.org about your system, including the value
56324047306Smrgof your $PATH and any error possibly output before this message.  This
56424047306Smrgcan help us improve future automake versions.
56524047306Smrg
56624047306SmrgEND
56724047306Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56824047306Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56924047306Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57024047306Smrg    echo >&2
57124047306Smrg  else
57224047306Smrg    cat >&2 <<'END'
57324047306SmrgAborting the configuration process, to ensure you take notice of the issue.
57424047306Smrg
57524047306SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576bdc460c5Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57724047306Smrg
57824047306SmrgIf you want to complete the configuration process using your problematic
57924047306Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58024047306Smrgto "yes", and re-run configure.
58124047306Smrg
58224047306SmrgEND
58324047306Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58424047306Smrg  fi
58524047306Smrgfi
58624047306Smrgdnl The trailing newline in this macro's definition is deliberate, for
58724047306Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58824047306Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
589bf2eeab3Smrg])
590bf2eeab3Smrg
59124047306Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592bf2eeab3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593bf2eeab3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594bf2eeab3Smrgm4_define([_AC_COMPILER_EXEEXT],
595bf2eeab3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596bf2eeab3Smrg
597bf2eeab3Smrg# When config.status generates a header, we must update the stamp-h file.
598bf2eeab3Smrg# This file resides in the same directory as the config header
599bf2eeab3Smrg# that is generated.  The stamp files are numbered to have different names.
600bf2eeab3Smrg
601bf2eeab3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
602bf2eeab3Smrg# loop where config.status creates the headers, so we can generate
603bf2eeab3Smrg# our stamp files there.
604bf2eeab3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
605bf2eeab3Smrg[# Compute $1's index in $config_headers.
606bf2eeab3Smrg_am_arg=$1
607bf2eeab3Smrg_am_stamp_count=1
608bf2eeab3Smrgfor _am_header in $config_headers :; do
609bf2eeab3Smrg  case $_am_header in
610bf2eeab3Smrg    $_am_arg | $_am_arg:* )
611bf2eeab3Smrg      break ;;
612bf2eeab3Smrg    * )
613bf2eeab3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
614bf2eeab3Smrg  esac
615bf2eeab3Smrgdone
616bf2eeab3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617bf2eeab3Smrg
618bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619bf2eeab3Smrg#
620bf2eeab3Smrg# This file is free software; the Free Software Foundation
621bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
622bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
623bf2eeab3Smrg
624bf2eeab3Smrg# AM_PROG_INSTALL_SH
625bf2eeab3Smrg# ------------------
626bf2eeab3Smrg# Define $install_sh.
627bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
628bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62924047306Smrgif test x"${install_sh+set}" != xset; then
630bf2eeab3Smrg  case $am_aux_dir in
631bf2eeab3Smrg  *\ * | *\	*)
632bf2eeab3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633bf2eeab3Smrg  *)
634bf2eeab3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635bf2eeab3Smrg  esac
63614c0a534Smrgfi
63724047306SmrgAC_SUBST([install_sh])])
63814c0a534Smrg
639bdc460c5Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640bf2eeab3Smrg#
641bf2eeab3Smrg# This file is free software; the Free Software Foundation
642bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
643bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
644bf2eeab3Smrg
645bf2eeab3Smrg# Check whether the underlying file-system supports filenames
646bf2eeab3Smrg# with a leading dot.  For instance MS-DOS doesn't.
647bf2eeab3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
648bf2eeab3Smrg[rm -rf .tst 2>/dev/null
649bf2eeab3Smrgmkdir .tst 2>/dev/null
650bf2eeab3Smrgif test -d .tst; then
651bf2eeab3Smrg  am__leading_dot=.
652bf2eeab3Smrgelse
653bf2eeab3Smrg  am__leading_dot=_
65414c0a534Smrgfi
655bf2eeab3Smrgrmdir .tst 2>/dev/null
656bf2eeab3SmrgAC_SUBST([am__leading_dot])])
657bf2eeab3Smrg
658bf2eeab3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659bf2eeab3Smrg
660bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661bf2eeab3Smrg#
662bf2eeab3Smrg# This file is free software; the Free Software Foundation
663bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
664bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
665bf2eeab3Smrg
666bf2eeab3Smrg# AM_MAKE_INCLUDE()
667bf2eeab3Smrg# -----------------
668bdc460c5Smrg# Check whether make has an 'include' directive that can support all
669bdc460c5Smrg# the idioms we need for our automatic dependency tracking code.
670bf2eeab3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671bdc460c5Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672bdc460c5Smrgcat > confinc.mk << 'END'
673bf2eeab3Smrgam__doit:
674bdc460c5Smrg	@echo this is the am__doit target >confinc.out
675bf2eeab3Smrg.PHONY: am__doit
676bf2eeab3SmrgEND
677bf2eeab3Smrgam__include="#"
678bf2eeab3Smrgam__quote=
679bdc460c5Smrg# BSD make does it like this.
680bdc460c5Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681bdc460c5Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682bdc460c5Smrgecho 'include confinc.mk # ignored' > confmf.GNU
683bdc460c5Smrg_am_result=no
684bdc460c5Smrgfor s in GNU BSD; do
685bdc460c5Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686bdc460c5Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687bdc460c5Smrg      ['0:this is the am__doit target'],
688bdc460c5Smrg      [AS_CASE([$s],
689bdc460c5Smrg          [BSD], [am__include='.include' am__quote='"'],
690bdc460c5Smrg          [am__include='include' am__quote=''])])
691bdc460c5Smrg  if test "$am__include" != "#"; then
692bdc460c5Smrg    _am_result="yes ($s style)"
693bdc460c5Smrg    break
694bdc460c5Smrg  fi
695bdc460c5Smrgdone
696bdc460c5Smrgrm -f confinc.* confmf.*
697bdc460c5SmrgAC_MSG_RESULT([${_am_result}])
698bdc460c5SmrgAC_SUBST([am__include])])
699bdc460c5SmrgAC_SUBST([am__quote])])
70014c0a534Smrg
701bf2eeab3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702bf2eeab3Smrg
703bdc460c5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704bf2eeab3Smrg#
705bf2eeab3Smrg# This file is free software; the Free Software Foundation
706bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
707bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
708bf2eeab3Smrg
709bf2eeab3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
710bf2eeab3Smrg# ------------------------------
711bf2eeab3SmrgAC_DEFUN([AM_MISSING_PROG],
712bf2eeab3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
713bf2eeab3Smrg$1=${$1-"${am_missing_run}$2"}
714bf2eeab3SmrgAC_SUBST($1)])
715bf2eeab3Smrg
716bf2eeab3Smrg# AM_MISSING_HAS_RUN
717bf2eeab3Smrg# ------------------
71824047306Smrg# Define MISSING if not defined so far and test if it is modern enough.
71924047306Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
720bf2eeab3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
721bf2eeab3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
722bf2eeab3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
723bf2eeab3Smrgif test x"${MISSING+set}" != xset; then
724bdc460c5Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72514c0a534Smrgfi
726bf2eeab3Smrg# Use eval to expand $SHELL
72724047306Smrgif eval "$MISSING --is-lightweight"; then
72824047306Smrg  am_missing_run="$MISSING "
729bf2eeab3Smrgelse
730bf2eeab3Smrg  am_missing_run=
73124047306Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73214c0a534Smrgfi
733bf2eeab3Smrg])
73414c0a534Smrg
735bf2eeab3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736bf2eeab3Smrg
737bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738bf2eeab3Smrg#
739bf2eeab3Smrg# This file is free software; the Free Software Foundation
740bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
741bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
742bf2eeab3Smrg
743bf2eeab3Smrg# _AM_MANGLE_OPTION(NAME)
744bf2eeab3Smrg# -----------------------
745bf2eeab3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
746bf2eeab3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747bf2eeab3Smrg
748bf2eeab3Smrg# _AM_SET_OPTION(NAME)
74924047306Smrg# --------------------
750bf2eeab3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
751bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTION],
75224047306Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753bf2eeab3Smrg
754bf2eeab3Smrg# _AM_SET_OPTIONS(OPTIONS)
75524047306Smrg# ------------------------
756bf2eeab3Smrg# OPTIONS is a space-separated list of Automake options.
757bf2eeab3SmrgAC_DEFUN([_AM_SET_OPTIONS],
758bf2eeab3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75914c0a534Smrg
760bf2eeab3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
761bf2eeab3Smrg# -------------------------------------------
762bf2eeab3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
763bf2eeab3SmrgAC_DEFUN([_AM_IF_OPTION],
764bf2eeab3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76514c0a534Smrg
766bdc460c5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76724047306Smrg#
76824047306Smrg# This file is free software; the Free Software Foundation
76924047306Smrg# gives unlimited permission to copy and/or distribute it,
77024047306Smrg# with or without modifications, as long as this notice is preserved.
77124047306Smrg
77224047306Smrg# _AM_PROG_CC_C_O
77324047306Smrg# ---------------
77424047306Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77524047306Smrg# to automatically call this.
77624047306SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77724047306Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77824047306SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77924047306SmrgAC_LANG_PUSH([C])dnl
78024047306SmrgAC_CACHE_CHECK(
78124047306Smrg  [whether $CC understands -c and -o together],
78224047306Smrg  [am_cv_prog_cc_c_o],
78324047306Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78424047306Smrg  # Make sure it works both with $CC and with simple cc.
78524047306Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78624047306Smrg  # compilers refuse to overwrite an existing .o file with -o,
78724047306Smrg  # though they will create one.
78824047306Smrg  am_cv_prog_cc_c_o=yes
78924047306Smrg  for am_i in 1 2; do
79024047306Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79124047306Smrg         && test -f conftest2.$ac_objext; then
79224047306Smrg      : OK
79324047306Smrg    else
79424047306Smrg      am_cv_prog_cc_c_o=no
79524047306Smrg      break
79624047306Smrg    fi
79724047306Smrg  done
79824047306Smrg  rm -f core conftest*
79924047306Smrg  unset am_i])
80024047306Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80124047306Smrg   # Losing compiler, so override with the script.
80224047306Smrg   # FIXME: It is wrong to rewrite CC.
80324047306Smrg   # But if we don't then we get into trouble of one sort or another.
80424047306Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80524047306Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80624047306Smrg   CC="$am_aux_dir/compile $CC"
80724047306Smrgfi
80824047306SmrgAC_LANG_POP([C])])
80914c0a534Smrg
81024047306Smrg# For backward compatibility.
81124047306SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81224047306Smrg
813bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814bf2eeab3Smrg#
815bf2eeab3Smrg# This file is free software; the Free Software Foundation
816bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
817bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
81814c0a534Smrg
81924047306Smrg# AM_RUN_LOG(COMMAND)
82024047306Smrg# -------------------
82124047306Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82224047306Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82324047306SmrgAC_DEFUN([AM_RUN_LOG],
82424047306Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82524047306Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82624047306Smrg   ac_status=$?
82724047306Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82824047306Smrg   (exit $ac_status); }])
82924047306Smrg
83024047306Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83124047306Smrg
832bdc460c5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83324047306Smrg#
83424047306Smrg# This file is free software; the Free Software Foundation
83524047306Smrg# gives unlimited permission to copy and/or distribute it,
83624047306Smrg# with or without modifications, as long as this notice is preserved.
83714c0a534Smrg
838bf2eeab3Smrg# AM_SANITY_CHECK
839bf2eeab3Smrg# ---------------
840bf2eeab3SmrgAC_DEFUN([AM_SANITY_CHECK],
841bf2eeab3Smrg[AC_MSG_CHECKING([whether build environment is sane])
842bf2eeab3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843bf2eeab3Smrg# name.  Accept space and tab only in the latter.
844bf2eeab3Smrgam_lf='
845bf2eeab3Smrg'
846bf2eeab3Smrgcase `pwd` in
847bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848bf2eeab3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849bf2eeab3Smrgesac
850bf2eeab3Smrgcase $srcdir in
851bf2eeab3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85224047306Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853bf2eeab3Smrgesac
85414c0a534Smrg
85524047306Smrg# Do 'set' in a subshell so we don't clobber the current shell's
856bf2eeab3Smrg# arguments.  Must try -L first in case configure is actually a
857bf2eeab3Smrg# symlink; some systems play weird games with the mod time of symlinks
858bf2eeab3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
859bf2eeab3Smrg# directory).
860bf2eeab3Smrgif (
86124047306Smrg   am_has_slept=no
86224047306Smrg   for am_try in 1 2; do
86324047306Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86424047306Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86524047306Smrg     if test "$[*]" = "X"; then
86624047306Smrg	# -L didn't work.
86724047306Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86824047306Smrg     fi
86924047306Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87024047306Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87124047306Smrg
87224047306Smrg	# If neither matched, then we have a broken ls.  This can happen
87324047306Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87424047306Smrg	# broken ls alias from the environment.  This has actually
87524047306Smrg	# happened.  Such a system could not be considered "sane".
87624047306Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87724047306Smrg  alias in your environment])
87824047306Smrg     fi
87924047306Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88024047306Smrg       break
88124047306Smrg     fi
88224047306Smrg     # Just in case.
88324047306Smrg     sleep 1
88424047306Smrg     am_has_slept=yes
88524047306Smrg   done
886bf2eeab3Smrg   test "$[2]" = conftest.file
887bf2eeab3Smrg   )
888bf2eeab3Smrgthen
889bf2eeab3Smrg   # Ok.
890bf2eeab3Smrg   :
89114c0a534Smrgelse
892bf2eeab3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
893bf2eeab3SmrgCheck your system clock])
89414c0a534Smrgfi
89524047306SmrgAC_MSG_RESULT([yes])
89624047306Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89724047306Smrg# generated files are strictly newer.
89824047306Smrgam_sleep_pid=
89924047306Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90024047306Smrg  ( sleep 1 ) &
90124047306Smrg  am_sleep_pid=$!
90224047306Smrgfi
90324047306SmrgAC_CONFIG_COMMANDS_PRE(
90424047306Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90524047306Smrg   if test -n "$am_sleep_pid"; then
90624047306Smrg     # Hide warnings about reused PIDs.
90724047306Smrg     wait $am_sleep_pid 2>/dev/null
90824047306Smrg   fi
90924047306Smrg   AC_MSG_RESULT([done])])
91024047306Smrgrm -f conftest.file
91124047306Smrg])
91214c0a534Smrg
913bdc460c5Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914bf2eeab3Smrg#
915bf2eeab3Smrg# This file is free software; the Free Software Foundation
916bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
917bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
91814c0a534Smrg
919bf2eeab3Smrg# AM_SILENT_RULES([DEFAULT])
920bf2eeab3Smrg# --------------------------
921bf2eeab3Smrg# Enable less verbose build rules; with the default set to DEFAULT
92224047306Smrg# ("yes" being less verbose, "no" or empty being verbose).
923bf2eeab3SmrgAC_DEFUN([AM_SILENT_RULES],
92424047306Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92524047306SmrgAS_HELP_STRING(
92624047306Smrg  [--enable-silent-rules],
92724047306Smrg  [less verbose build output (undo: "make V=1")])
92824047306SmrgAS_HELP_STRING(
92924047306Smrg  [--disable-silent-rules],
93024047306Smrg  [verbose build output (undo: "make V=0")])dnl
93124047306Smrg])
93224047306Smrgcase $enable_silent_rules in @%:@ (((
93324047306Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93424047306Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93524047306Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936bf2eeab3Smrgesac
93724047306Smrgdnl
93824047306Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93924047306Smrgdnl do not support nested variable expansions.
94024047306Smrgdnl See automake bug#9928 and bug#10237.
94124047306Smrgam_make=${MAKE-make}
94224047306SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94324047306Smrg   [am_cv_make_support_nested_variables],
94424047306Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94524047306SmrgBAR0=false
94624047306SmrgBAR1=true
94724047306SmrgV=1
94824047306Smrgam__doit:
94924047306Smrg	@$(TRUE)
95024047306Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95124047306Smrg  am_cv_make_support_nested_variables=yes
95224047306Smrgelse
95324047306Smrg  am_cv_make_support_nested_variables=no
95424047306Smrgfi])
95524047306Smrgif test $am_cv_make_support_nested_variables = yes; then
95624047306Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95724047306Smrg  AM_V='$(V)'
95824047306Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95924047306Smrgelse
96024047306Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96124047306Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96224047306Smrgfi
96324047306SmrgAC_SUBST([AM_V])dnl
96424047306SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96524047306SmrgAC_SUBST([AM_DEFAULT_V])dnl
96624047306SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967bf2eeab3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968bf2eeab3SmrgAM_BACKSLASH='\'
969bf2eeab3SmrgAC_SUBST([AM_BACKSLASH])dnl
970bf2eeab3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971bf2eeab3Smrg])
97214c0a534Smrg
973bdc460c5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974bf2eeab3Smrg#
975bf2eeab3Smrg# This file is free software; the Free Software Foundation
976bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
977bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
97814c0a534Smrg
979bf2eeab3Smrg# AM_PROG_INSTALL_STRIP
980bf2eeab3Smrg# ---------------------
98124047306Smrg# One issue with vendor 'install' (even GNU) is that you can't
982bf2eeab3Smrg# specify the program used to strip binaries.  This is especially
983bf2eeab3Smrg# annoying in cross-compiling environments, where the build's strip
984bf2eeab3Smrg# is unlikely to handle the host's binaries.
985bf2eeab3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98624047306Smrg# always use install-sh in "make install-strip", and initialize
987bf2eeab3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
988bf2eeab3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
989bf2eeab3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99024047306Smrg# Installed binaries are usually stripped using 'strip' when the user
99124047306Smrg# run "make install-strip".  However 'strip' might not be the right
992bf2eeab3Smrg# tool to use in cross-compilation environments, therefore Automake
99324047306Smrg# will honor the 'STRIP' environment variable to overrule this program.
99424047306Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
995bf2eeab3Smrgif test "$cross_compiling" != no; then
996bf2eeab3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99714c0a534Smrgfi
998bf2eeab3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
999bf2eeab3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100014c0a534Smrg
1001bdc460c5Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002bf2eeab3Smrg#
1003bf2eeab3Smrg# This file is free software; the Free Software Foundation
1004bf2eeab3Smrg# gives unlimited permission to copy and/or distribute it,
1005bf2eeab3Smrg# with or without modifications, as long as this notice is preserved.
100614c0a534Smrg
1007bf2eeab3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
1008bf2eeab3Smrg# ---------------------------
1009bf2eeab3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1010bf2eeab3Smrg# This macro is traced by Automake.
1011bf2eeab3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101214c0a534Smrg
1013bf2eeab3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101424047306Smrg# --------------------------
1015bf2eeab3Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016bf2eeab3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101714c0a534Smrg
1018bf2eeab3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019bf2eeab3Smrg
1020bdc460c5Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102114c0a534Smrg#
102214c0a534Smrg# This file is free software; the Free Software Foundation
102314c0a534Smrg# gives unlimited permission to copy and/or distribute it,
102414c0a534Smrg# with or without modifications, as long as this notice is preserved.
102514c0a534Smrg
1026bf2eeab3Smrg# _AM_PROG_TAR(FORMAT)
1027bf2eeab3Smrg# --------------------
1028bf2eeab3Smrg# Check how to create a tarball in format FORMAT.
102924047306Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030bf2eeab3Smrg#
1031bf2eeab3Smrg# Substitute a variable $(am__tar) that is a command
1032bf2eeab3Smrg# writing to stdout a FORMAT-tarball containing the directory
1033bf2eeab3Smrg# $tardir.
1034bf2eeab3Smrg#     tardir=directory && $(am__tar) > result.tar
1035bf2eeab3Smrg#
1036bf2eeab3Smrg# Substitute a variable $(am__untar) that extract such
1037bf2eeab3Smrg# a tarball read from stdin.
1038bf2eeab3Smrg#     $(am__untar) < result.tar
103924047306Smrg#
1040bf2eeab3SmrgAC_DEFUN([_AM_PROG_TAR],
104124047306Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104224047306Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104324047306SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104424047306Smrg
104524047306Smrg# We'll loop over all known methods to create a tar archive until one works.
1046bf2eeab3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047bf2eeab3Smrg
104824047306Smrgm4_if([$1], [v7],
104924047306Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105024047306Smrg
105124047306Smrg  [m4_case([$1],
105224047306Smrg    [ustar],
105324047306Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105424047306Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105524047306Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105624047306Smrg      # and bug#13588).
105724047306Smrg      am_max_uid=2097151 # 2^21 - 1
105824047306Smrg      am_max_gid=$am_max_uid
105924047306Smrg      # The $UID and $GID variables are not portable, so we need to resort
106024047306Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106124047306Smrg      # below are definitely unexpected, so allow the users to see them
106224047306Smrg      # (that is, avoid stderr redirection).
106324047306Smrg      am_uid=`id -u || echo unknown`
106424047306Smrg      am_gid=`id -g || echo unknown`
106524047306Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106624047306Smrg      if test $am_uid -le $am_max_uid; then
106724047306Smrg         AC_MSG_RESULT([yes])
106824047306Smrg      else
106924047306Smrg         AC_MSG_RESULT([no])
107024047306Smrg         _am_tools=none
107124047306Smrg      fi
107224047306Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107324047306Smrg      if test $am_gid -le $am_max_gid; then
107424047306Smrg         AC_MSG_RESULT([yes])
107524047306Smrg      else
107624047306Smrg        AC_MSG_RESULT([no])
107724047306Smrg        _am_tools=none
107824047306Smrg      fi],
107924047306Smrg
108024047306Smrg  [pax],
108124047306Smrg    [],
108224047306Smrg
108324047306Smrg  [m4_fatal([Unknown tar format])])
108424047306Smrg
108524047306Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108624047306Smrg
108724047306Smrg  # Go ahead even if we have the value already cached.  We do so because we
108824047306Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108924047306Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109024047306Smrg
109124047306Smrg  for _am_tool in $_am_tools; do
109224047306Smrg    case $_am_tool in
109324047306Smrg    gnutar)
109424047306Smrg      for _am_tar in tar gnutar gtar; do
109524047306Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109624047306Smrg      done
109724047306Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109824047306Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109924047306Smrg      am__untar="$_am_tar -xf -"
110024047306Smrg      ;;
110124047306Smrg    plaintar)
110224047306Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110324047306Smrg      # ustar tarball either.
110424047306Smrg      (tar --version) >/dev/null 2>&1 && continue
110524047306Smrg      am__tar='tar chf - "$$tardir"'
110624047306Smrg      am__tar_='tar chf - "$tardir"'
110724047306Smrg      am__untar='tar xf -'
110824047306Smrg      ;;
110924047306Smrg    pax)
111024047306Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111124047306Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111224047306Smrg      am__untar='pax -r'
111324047306Smrg      ;;
111424047306Smrg    cpio)
111524047306Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111624047306Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111724047306Smrg      am__untar='cpio -i -H $1 -d'
111824047306Smrg      ;;
111924047306Smrg    none)
112024047306Smrg      am__tar=false
112124047306Smrg      am__tar_=false
112224047306Smrg      am__untar=false
112324047306Smrg      ;;
112424047306Smrg    esac
112514c0a534Smrg
112624047306Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112724047306Smrg    # and am__untar set.
112824047306Smrg    test -n "${am_cv_prog_tar_$1}" && break
112924047306Smrg
113024047306Smrg    # tar/untar a dummy directory, and stop if the command works.
113124047306Smrg    rm -rf conftest.dir
113224047306Smrg    mkdir conftest.dir
113324047306Smrg    echo GrepMe > conftest.dir/file
113424047306Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113524047306Smrg    rm -rf conftest.dir
113624047306Smrg    if test -s conftest.tar; then
113724047306Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113824047306Smrg      AM_RUN_LOG([cat conftest.dir/file])
113924047306Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114024047306Smrg    fi
114124047306Smrg  done
1142bf2eeab3Smrg  rm -rf conftest.dir
114314c0a534Smrg
114424047306Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114524047306Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114624047306Smrg
1147bf2eeab3SmrgAC_SUBST([am__tar])
1148bf2eeab3SmrgAC_SUBST([am__untar])
1149bf2eeab3Smrg]) # _AM_PROG_TAR
115014c0a534Smrg
1151bdc460c5Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152bdc460c5Smrgdnl serial 11 (pkg-config-0.29)
1153bdc460c5Smrgdnl
1154bdc460c5Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155bdc460c5Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156bdc460c5Smrgdnl
1157bdc460c5Smrgdnl This program is free software; you can redistribute it and/or modify
1158bdc460c5Smrgdnl it under the terms of the GNU General Public License as published by
1159bdc460c5Smrgdnl the Free Software Foundation; either version 2 of the License, or
1160bdc460c5Smrgdnl (at your option) any later version.
1161bdc460c5Smrgdnl
1162bdc460c5Smrgdnl This program is distributed in the hope that it will be useful, but
1163bdc460c5Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164bdc460c5Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165bdc460c5Smrgdnl General Public License for more details.
1166bdc460c5Smrgdnl
1167bdc460c5Smrgdnl You should have received a copy of the GNU General Public License
1168bdc460c5Smrgdnl along with this program; if not, write to the Free Software
1169bdc460c5Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170bdc460c5Smrgdnl 02111-1307, USA.
1171bdc460c5Smrgdnl
1172bdc460c5Smrgdnl As a special exception to the GNU General Public License, if you
1173bdc460c5Smrgdnl distribute this file as part of a program that contains a
1174bdc460c5Smrgdnl configuration script generated by Autoconf, you may include it under
1175bdc460c5Smrgdnl the same distribution terms that you use for the rest of that
1176bdc460c5Smrgdnl program.
1177bdc460c5Smrg
1178bdc460c5Smrgdnl PKG_PREREQ(MIN-VERSION)
1179bdc460c5Smrgdnl -----------------------
1180bdc460c5Smrgdnl Since: 0.29
1181bdc460c5Smrgdnl
1182bdc460c5Smrgdnl Verify that the version of the pkg-config macros are at least
1183bdc460c5Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184bdc460c5Smrgdnl installed version of pkg-config, this checks the developer's version
1185bdc460c5Smrgdnl of pkg.m4 when generating configure.
1186bdc460c5Smrgdnl
1187bdc460c5Smrgdnl To ensure that this macro is defined, also add:
1188bdc460c5Smrgdnl m4_ifndef([PKG_PREREQ],
1189bdc460c5Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190bdc460c5Smrgdnl
1191bdc460c5Smrgdnl See the "Since" comment for each macro you use to see what version
1192bdc460c5Smrgdnl of the macros you require.
1193bdc460c5Smrgm4_defun([PKG_PREREQ],
1194bdc460c5Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195bdc460c5Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196bdc460c5Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197bdc460c5Smrg])dnl PKG_PREREQ
1198bdc460c5Smrg
1199bdc460c5Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200bdc460c5Smrgdnl ----------------------------------
1201bdc460c5Smrgdnl Since: 0.16
1202bdc460c5Smrgdnl
1203bdc460c5Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204bdc460c5Smrgdnl first found in the path. Checks that the version of pkg-config found
1205bdc460c5Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206bdc460c5Smrgdnl used since that's the first version where most current features of
1207bdc460c5Smrgdnl pkg-config existed.
120824047306SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120924047306Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210bdc460c5Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211bdc460c5Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214bdc460c5SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215bdc460c5Smrg
121624047306Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121724047306Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121824047306Smrgfi
121924047306Smrgif test -n "$PKG_CONFIG"; then
122024047306Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122124047306Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122224047306Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122324047306Smrg		AC_MSG_RESULT([yes])
122424047306Smrg	else
122524047306Smrg		AC_MSG_RESULT([no])
122624047306Smrg		PKG_CONFIG=""
122724047306Smrg	fi
122824047306Smrgfi[]dnl
1229bdc460c5Smrg])dnl PKG_PROG_PKG_CONFIG
123024047306Smrg
1231bdc460c5Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232bdc460c5Smrgdnl -------------------------------------------------------------------
1233bdc460c5Smrgdnl Since: 0.18
1234bdc460c5Smrgdnl
1235bdc460c5Smrgdnl Check to see whether a particular set of modules exists. Similar to
1236bdc460c5Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237bdc460c5Smrgdnl
1238bdc460c5Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239bdc460c5Smrgdnl only at the first occurence in configure.ac, so if the first place
1240bdc460c5Smrgdnl it's called might be skipped (such as if it is within an "if", you
1241bdc460c5Smrgdnl have to call PKG_CHECK_EXISTS manually
124224047306SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124324047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124424047306Smrgif test -n "$PKG_CONFIG" && \
124524047306Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246bdc460c5Smrg  m4_default([$2], [:])
124724047306Smrgm4_ifvaln([$3], [else
124824047306Smrg  $3])dnl
124924047306Smrgfi])
125024047306Smrg
1251bdc460c5Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252bdc460c5Smrgdnl ---------------------------------------------
1253bdc460c5Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254bdc460c5Smrgdnl pkg_failed based on the result.
125524047306Smrgm4_define([_PKG_CONFIG],
125624047306Smrg[if test -n "$$1"; then
125724047306Smrg    pkg_cv_[]$1="$$1"
125824047306Smrg elif test -n "$PKG_CONFIG"; then
125924047306Smrg    PKG_CHECK_EXISTS([$3],
1260bdc460c5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261bdc460c5Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126224047306Smrg		     [pkg_failed=yes])
126324047306Smrg else
126424047306Smrg    pkg_failed=untried
126524047306Smrgfi[]dnl
1266bdc460c5Smrg])dnl _PKG_CONFIG
126724047306Smrg
1268bdc460c5Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269bdc460c5Smrgdnl ---------------------------
1270bdc460c5Smrgdnl Internal check to see if pkg-config supports short errors.
127124047306SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127224047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127324047306Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127424047306Smrg        _pkg_short_errors_supported=yes
127524047306Smrgelse
127624047306Smrg        _pkg_short_errors_supported=no
127724047306Smrgfi[]dnl
1278bdc460c5Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127924047306Smrg
128024047306Smrg
1281bdc460c5Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282bdc460c5Smrgdnl   [ACTION-IF-NOT-FOUND])
1283bdc460c5Smrgdnl --------------------------------------------------------------
1284bdc460c5Smrgdnl Since: 0.4.0
1285bdc460c5Smrgdnl
1286bdc460c5Smrgdnl Note that if there is a possibility the first call to
1287bdc460c5Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288bdc460c5Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128924047306SmrgAC_DEFUN([PKG_CHECK_MODULES],
129024047306Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129124047306SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129224047306SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129324047306Smrg
129424047306Smrgpkg_failed=no
129524047306SmrgAC_MSG_CHECKING([for $1])
129624047306Smrg
129724047306Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129824047306Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129924047306Smrg
130024047306Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130124047306Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130224047306SmrgSee the pkg-config man page for more details.])
130324047306Smrg
130424047306Smrgif test $pkg_failed = yes; then
1305bdc460c5Smrg   	AC_MSG_RESULT([no])
130624047306Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130724047306Smrg        if test $_pkg_short_errors_supported = yes; then
1308bdc460c5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130924047306Smrg        else 
1310bdc460c5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131124047306Smrg        fi
131224047306Smrg	# Put the nasty error message in config.log where it belongs
131324047306Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131424047306Smrg
1315bdc460c5Smrg	m4_default([$4], [AC_MSG_ERROR(
131624047306Smrg[Package requirements ($2) were not met:
131724047306Smrg
131824047306Smrg$$1_PKG_ERRORS
131924047306Smrg
132024047306SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132124047306Smrginstalled software in a non-standard prefix.
132224047306Smrg
1323bdc460c5Smrg_PKG_TEXT])[]dnl
1324bdc460c5Smrg        ])
132524047306Smrgelif test $pkg_failed = untried; then
1326bdc460c5Smrg     	AC_MSG_RESULT([no])
1327bdc460c5Smrg	m4_default([$4], [AC_MSG_FAILURE(
132824047306Smrg[The pkg-config script could not be found or is too old.  Make sure it
132924047306Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133024047306Smrgpath to pkg-config.
133124047306Smrg
133224047306Smrg_PKG_TEXT
133324047306Smrg
1334bdc460c5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335bdc460c5Smrg        ])
133624047306Smrgelse
133724047306Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133824047306Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133924047306Smrg        AC_MSG_RESULT([yes])
1340bdc460c5Smrg	$3
134124047306Smrgfi[]dnl
1342bdc460c5Smrg])dnl PKG_CHECK_MODULES
1343bdc460c5Smrg
1344bdc460c5Smrg
1345bdc460c5Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346bdc460c5Smrgdnl   [ACTION-IF-NOT-FOUND])
1347bdc460c5Smrgdnl ---------------------------------------------------------------------
1348bdc460c5Smrgdnl Since: 0.29
1349bdc460c5Smrgdnl
1350bdc460c5Smrgdnl Checks for existence of MODULES and gathers its build flags with
1351bdc460c5Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352bdc460c5Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353bdc460c5Smrgdnl
1354bdc460c5Smrgdnl Note that if there is a possibility the first call to
1355bdc460c5Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356bdc460c5Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357bdc460c5Smrgdnl configure.ac.
1358bdc460c5SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359bdc460c5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360bdc460c5Smrg_save_PKG_CONFIG=$PKG_CONFIG
1361bdc460c5SmrgPKG_CONFIG="$PKG_CONFIG --static"
1362bdc460c5SmrgPKG_CHECK_MODULES($@)
1363bdc460c5SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364bdc460c5Smrg])dnl PKG_CHECK_MODULES_STATIC
1365bdc460c5Smrg
1366bdc460c5Smrg
1367bdc460c5Smrgdnl PKG_INSTALLDIR([DIRECTORY])
1368bdc460c5Smrgdnl -------------------------
1369bdc460c5Smrgdnl Since: 0.27
1370bdc460c5Smrgdnl
1371bdc460c5Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372bdc460c5Smrgdnl should install pkg-config .pc files. By default the directory is
1373bdc460c5Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374bdc460c5Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375bdc460c5Smrgdnl parameter.
1376bdc460c5SmrgAC_DEFUN([PKG_INSTALLDIR],
1377bdc460c5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378bdc460c5Smrgm4_pushdef([pkg_description],
1379bdc460c5Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380bdc460c5SmrgAC_ARG_WITH([pkgconfigdir],
1381bdc460c5Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382bdc460c5Smrg    [with_pkgconfigdir=]pkg_default)
1383bdc460c5SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384bdc460c5Smrgm4_popdef([pkg_default])
1385bdc460c5Smrgm4_popdef([pkg_description])
1386bdc460c5Smrg])dnl PKG_INSTALLDIR
1387bdc460c5Smrg
1388bdc460c5Smrg
1389bdc460c5Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390bdc460c5Smrgdnl --------------------------------
1391bdc460c5Smrgdnl Since: 0.27
1392bdc460c5Smrgdnl
1393bdc460c5Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394bdc460c5Smrgdnl module should install arch-independent pkg-config .pc files. By
1395bdc460c5Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396bdc460c5Smrgdnl changed by passing DIRECTORY. The user can override through the
1397bdc460c5Smrgdnl --with-noarch-pkgconfigdir parameter.
1398bdc460c5SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399bdc460c5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400bdc460c5Smrgm4_pushdef([pkg_description],
1401bdc460c5Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402bdc460c5SmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403bdc460c5Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404bdc460c5Smrg    [with_noarch_pkgconfigdir=]pkg_default)
1405bdc460c5SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406bdc460c5Smrgm4_popdef([pkg_default])
1407bdc460c5Smrgm4_popdef([pkg_description])
1408bdc460c5Smrg])dnl PKG_NOARCH_INSTALLDIR
1409bdc460c5Smrg
1410bdc460c5Smrg
1411bdc460c5Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412bdc460c5Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413bdc460c5Smrgdnl -------------------------------------------
1414bdc460c5Smrgdnl Since: 0.28
1415bdc460c5Smrgdnl
1416bdc460c5Smrgdnl Retrieves the value of the pkg-config variable for the given module.
1417bdc460c5SmrgAC_DEFUN([PKG_CHECK_VAR],
1418bdc460c5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419bdc460c5SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420bdc460c5Smrg
1421bdc460c5Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422bdc460c5SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423bdc460c5Smrg
1424bdc460c5SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425bdc460c5Smrg])dnl PKG_CHECK_VAR
142624047306Smrg
1427bf2eeab3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428bf2eeab3Smrgdnl
1429bdc460c5Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143024047306Smrgdnl
1431bf2eeab3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432576bae58Smrgdnl copy of this software and associated documentation files (the "Software"),
1433576bae58Smrgdnl to deal in the Software without restriction, including without limitation
1434576bae58Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435576bae58Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436576bae58Smrgdnl Software is furnished to do so, subject to the following conditions:
1437bf2eeab3Smrgdnl
1438576bae58Smrgdnl The above copyright notice and this permission notice (including the next
1439576bae58Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1440576bae58Smrgdnl Software.
1441bf2eeab3Smrgdnl
1442576bae58Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443576bae58Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444576bae58Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445576bae58Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446576bae58Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447576bae58Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448576bae58Smrgdnl DEALINGS IN THE SOFTWARE.
144914c0a534Smrg
1450bf2eeab3Smrg# XORG_MACROS_VERSION(required-version)
1451bf2eeab3Smrg# -------------------------------------
1452bf2eeab3Smrg# Minimum version: 1.1.0
145314c0a534Smrg#
1454bf2eeab3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
1455bf2eeab3Smrg# your configure.ac with the minimum required version, such as:
1456bf2eeab3Smrg# XORG_MACROS_VERSION(1.1)
145714c0a534Smrg#
1458bf2eeab3Smrg# To ensure that this macro is defined, also add:
1459bf2eeab3Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460bf2eeab3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146114c0a534Smrg#
146214c0a534Smrg#
146324047306Smrg# See the "minimum version" comment for each macro you use to see what
1464bf2eeab3Smrg# version you require.
1465bf2eeab3Smrgm4_defun([XORG_MACROS_VERSION],[
1466bdc460c5Smrgm4_define([vers_have], [1.19.3])
1467bf2eeab3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468bf2eeab3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469bf2eeab3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470bf2eeab3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471bf2eeab3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472bf2eeab3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473bf2eeab3Smrgm4_undefine([vers_have])
1474bf2eeab3Smrgm4_undefine([maj_have])
1475bf2eeab3Smrgm4_undefine([maj_needed])
1476bf2eeab3Smrg]) # XORG_MACROS_VERSION
147714c0a534Smrg
1478bf2eeab3Smrg# XORG_PROG_RAWCPP()
1479bf2eeab3Smrg# ------------------
1480bf2eeab3Smrg# Minimum version: 1.0.0
148114c0a534Smrg#
1482bf2eeab3Smrg# Find cpp program and necessary flags for use in pre-processing text files
1483bf2eeab3Smrg# such as man pages and config files
1484bf2eeab3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485bf2eeab3SmrgAC_REQUIRE([AC_PROG_CPP])
1486bdc460c5SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487bf2eeab3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148814c0a534Smrg
1489bf2eeab3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1490bf2eeab3Smrg# which is not the best choice for supporting other OS'es, but covers most
1491bf2eeab3Smrg# of the ones we need for now.
1492bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14931a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1494bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1495bf2eeab3Smrg	AC_MSG_RESULT([no])
149614c0a534Smrgelse
1497bf2eeab3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1498bf2eeab3Smrg		RAWCPPFLAGS=-undef
1499bf2eeab3Smrg		AC_MSG_RESULT([yes])
1500bf2eeab3Smrg	# under Cygwin unix is still defined even with -undef
1501bf2eeab3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502bf2eeab3Smrg		RAWCPPFLAGS="-undef -ansi"
1503bf2eeab3Smrg		AC_MSG_RESULT([yes, with -ansi])
1504bf2eeab3Smrg	else
1505bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1506bf2eeab3Smrg	fi
150714c0a534Smrgfi
1508bf2eeab3Smrgrm -f conftest.$ac_ext
150914c0a534Smrg
1510bf2eeab3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15111a054510SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512bf2eeab3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1513bf2eeab3Smrg	AC_MSG_RESULT([no])
1514bf2eeab3Smrgelse
1515bf2eeab3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151624047306Smrg		TRADITIONALCPPFLAGS="-traditional"
1517bf2eeab3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1518bf2eeab3Smrg		AC_MSG_RESULT([yes])
1519bf2eeab3Smrg	else
1520bf2eeab3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1521bf2eeab3Smrg	fi
1522bf2eeab3Smrgfi
1523bf2eeab3Smrgrm -f conftest.$ac_ext
1524bf2eeab3SmrgAC_SUBST(RAWCPPFLAGS)
152524047306SmrgAC_SUBST(TRADITIONALCPPFLAGS)
1526bf2eeab3Smrg]) # XORG_PROG_RAWCPP
152714c0a534Smrg
1528bf2eeab3Smrg# XORG_MANPAGE_SECTIONS()
1529bf2eeab3Smrg# -----------------------
1530bf2eeab3Smrg# Minimum version: 1.0.0
153114c0a534Smrg#
1532bf2eeab3Smrg# Determine which sections man pages go in for the different man page types
1533bf2eeab3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1534bf2eeab3Smrg# Not sure if there's any better way than just hardcoding by OS name.
1535bf2eeab3Smrg# Override default settings by setting environment variables
1536576bae58Smrg# Added MAN_SUBSTS in version 1.8
1537576bae58Smrg# Added AC_PROG_SED in version 1.8
153814c0a534Smrg
1539bf2eeab3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540bf2eeab3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1541576bae58SmrgAC_REQUIRE([AC_PROG_SED])
154214c0a534Smrg
1543bdc460c5Smrgcase $host_os in
1544bdc460c5Smrg    solaris*)
1545bdc460c5Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546bdc460c5Smrg        # check for a man page file found in later versions that use
1547bdc460c5Smrg        # traditional section numbers instead
1548bdc460c5Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549bdc460c5Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550bdc460c5Smrg        ;;
1551bdc460c5Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552bdc460c5Smrgesac
1553bdc460c5Smrg
1554bf2eeab3Smrgif test x$APP_MAN_SUFFIX = x    ; then
1555bf2eeab3Smrg    APP_MAN_SUFFIX=1
1556bf2eeab3Smrgfi
1557bf2eeab3Smrgif test x$APP_MAN_DIR = x    ; then
1558bf2eeab3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559bf2eeab3Smrgfi
156014c0a534Smrg
1561bf2eeab3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
1562bf2eeab3Smrg    LIB_MAN_SUFFIX=3
1563bf2eeab3Smrgfi
1564bf2eeab3Smrgif test x$LIB_MAN_DIR = x    ; then
1565bf2eeab3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156614c0a534Smrgfi
156714c0a534Smrg
1568bf2eeab3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1570bdc460c5Smrg	true)				FILE_MAN_SUFFIX=4  ;;
1571bdc460c5Smrg	*)				FILE_MAN_SUFFIX=5  ;;
1572bf2eeab3Smrg    esac
1573bf2eeab3Smrgfi
1574bf2eeab3Smrgif test x$FILE_MAN_DIR = x    ; then
1575bf2eeab3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576bf2eeab3Smrgfi
157714c0a534Smrg
1578bf2eeab3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1580bdc460c5Smrg	true)				MISC_MAN_SUFFIX=5  ;;
1581bdc460c5Smrg	*)				MISC_MAN_SUFFIX=7  ;;
1582bf2eeab3Smrg    esac
1583bf2eeab3Smrgfi
1584bf2eeab3Smrgif test x$MISC_MAN_DIR = x    ; then
1585bf2eeab3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586bf2eeab3Smrgfi
158714c0a534Smrg
1588bf2eeab3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1590bdc460c5Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591bdc460c5Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592bf2eeab3Smrg    esac
1593bf2eeab3Smrgfi
1594bf2eeab3Smrgif test x$DRIVER_MAN_DIR = x    ; then
1595bf2eeab3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1596bf2eeab3Smrgfi
159714c0a534Smrg
1598bf2eeab3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599bdc460c5Smrg    case $SYSV_MAN_SECTIONS in
1600bdc460c5Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601bdc460c5Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
1602bf2eeab3Smrg    esac
1603bf2eeab3Smrgfi
1604bf2eeab3Smrgif test x$ADMIN_MAN_DIR = x    ; then
1605bf2eeab3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160614c0a534Smrgfi
160714c0a534Smrg
160814c0a534Smrg
1609bf2eeab3SmrgAC_SUBST([APP_MAN_SUFFIX])
1610bf2eeab3SmrgAC_SUBST([LIB_MAN_SUFFIX])
1611bf2eeab3SmrgAC_SUBST([FILE_MAN_SUFFIX])
1612bf2eeab3SmrgAC_SUBST([MISC_MAN_SUFFIX])
1613bf2eeab3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1614bf2eeab3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1615bf2eeab3SmrgAC_SUBST([APP_MAN_DIR])
1616bf2eeab3SmrgAC_SUBST([LIB_MAN_DIR])
1617bf2eeab3SmrgAC_SUBST([FILE_MAN_DIR])
1618bf2eeab3SmrgAC_SUBST([MISC_MAN_DIR])
1619bf2eeab3SmrgAC_SUBST([DRIVER_MAN_DIR])
1620bf2eeab3SmrgAC_SUBST([ADMIN_MAN_DIR])
1621576bae58Smrg
1622576bae58SmrgXORG_MAN_PAGE="X Version 11"
1623576bae58SmrgAC_SUBST([XORG_MAN_PAGE])
1624576bae58SmrgMAN_SUBSTS="\
1625576bae58Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1626576bae58Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1627576bae58Smrg	-e 's|__xservername__|Xorg|g' \
1628576bae58Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1629576bae58Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1630576bae58Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1631576bae58Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1632576bae58Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1633576bae58Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1634576bae58Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1635576bae58Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1636576bae58Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1637576bae58SmrgAC_SUBST([MAN_SUBSTS])
1638576bae58Smrg
1639bf2eeab3Smrg]) # XORG_MANPAGE_SECTIONS
1640bf2eeab3Smrg
1641576bae58Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1642576bae58Smrg# ------------------------
1643576bae58Smrg# Minimum version: 1.7.0
1644576bae58Smrg#
1645576bae58Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1646576bae58Smrg# provided by xorg-sgml-doctools, if installed.
1647576bae58SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1648576bae58SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1649576bae58SmrgXORG_SGML_PATH=
1650576bae58SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1651576bae58Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1652576bae58Smrg    [m4_ifval([$1],[:],
1653576bae58Smrg        [if test x"$cross_compiling" != x"yes" ; then
1654576bae58Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1655576bae58Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1656576bae58Smrg         fi])
1657576bae58Smrg    ])
1658576bae58Smrg
1659576bae58Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1660576bae58Smrg# the path and the name of the doc stylesheet
1661576bae58Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1662576bae58Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1663576bae58Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1664576bae58Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1665576bae58Smrgelse
1666576bae58Smrg   AC_MSG_RESULT([no])
1667576bae58Smrgfi
1668576bae58Smrg
1669576bae58SmrgAC_SUBST(XORG_SGML_PATH)
1670576bae58SmrgAC_SUBST(STYLESHEET_SRCDIR)
1671576bae58SmrgAC_SUBST(XSL_STYLESHEET)
1672576bae58SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1673576bae58Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674576bae58Smrg
1675bf2eeab3Smrg# XORG_CHECK_LINUXDOC
1676bf2eeab3Smrg# -------------------
1677bf2eeab3Smrg# Minimum version: 1.0.0
167814c0a534Smrg#
1679bf2eeab3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
1680bf2eeab3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1681bf2eeab3Smrg# Whether or not the necessary tools and files are found can be checked
1682bf2eeab3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1683bf2eeab3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1684576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1685576bae58SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168614c0a534Smrg
1687bf2eeab3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168814c0a534Smrg
1689576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
169014c0a534Smrg
1691576bae58Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1692bf2eeab3Smrg   BUILDDOC=yes
1693bf2eeab3Smrgelse
1694bf2eeab3Smrg   BUILDDOC=no
1695bf2eeab3Smrgfi
169614c0a534Smrg
1697bf2eeab3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169814c0a534Smrg
1699bf2eeab3SmrgAC_MSG_RESULT([$BUILDDOC])
170014c0a534Smrg
1701576bae58SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170214c0a534Smrg
1703576bae58Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1704bf2eeab3Smrg   BUILDPDFDOC=yes
1705bf2eeab3Smrgelse
1706bf2eeab3Smrg   BUILDPDFDOC=no
1707bf2eeab3Smrgfi
170814c0a534Smrg
1709bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171014c0a534Smrg
1711bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171214c0a534Smrg
1713576bae58SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1714bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1715bf2eeab3SmrgMAKE_PDF="$PS2PDF"
1716bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171714c0a534Smrg
1718bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1719bf2eeab3SmrgAC_SUBST(MAKE_PS)
1720bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1721bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1722bf2eeab3Smrg]) # XORG_CHECK_LINUXDOC
1723bf2eeab3Smrg
1724bf2eeab3Smrg# XORG_CHECK_DOCBOOK
1725bf2eeab3Smrg# -------------------
1726bf2eeab3Smrg# Minimum version: 1.0.0
1727bf2eeab3Smrg#
1728bf2eeab3Smrg# Checks for the ability to build output formats from SGML DocBook source.
1729bf2eeab3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1730bf2eeab3Smrg# indicates whether the necessary tools and files are found and, if set,
1731bf2eeab3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1732bf2eeab3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1733576bae58SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734576bae58Smrg
1735bf2eeab3SmrgBUILDTXTDOC=no
1736bf2eeab3SmrgBUILDPDFDOC=no
1737bf2eeab3SmrgBUILDPSDOC=no
1738bf2eeab3SmrgBUILDHTMLDOC=no
1739bf2eeab3Smrg
1740bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
1741bf2eeab3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1742bf2eeab3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
1743bf2eeab3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744bf2eeab3Smrg
1745576bae58SmrgAC_MSG_CHECKING([whether to build text documentation])
1746576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1747bf2eeab3Smrg   test x$BUILD_TXTDOC != xno; then
1748bf2eeab3Smrg	BUILDTXTDOC=yes
1749bf2eeab3Smrgfi
1750bf2eeab3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1751bf2eeab3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175214c0a534Smrg
1753576bae58SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1754576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1755bf2eeab3Smrg   test x$BUILD_PDFDOC != xno; then
1756bf2eeab3Smrg	BUILDPDFDOC=yes
175714c0a534Smrgfi
1758bf2eeab3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1759bf2eeab3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176014c0a534Smrg
1761576bae58SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1762576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1763bf2eeab3Smrg   test x$BUILD_PSDOC != xno; then
1764bf2eeab3Smrg	BUILDPSDOC=yes
1765bf2eeab3Smrgfi
1766bf2eeab3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1767bf2eeab3SmrgAC_MSG_RESULT([$BUILDPSDOC])
176814c0a534Smrg
1769576bae58SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1770576bae58Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1771bf2eeab3Smrg   test x$BUILD_HTMLDOC != xno; then
1772bf2eeab3Smrg	BUILDHTMLDOC=yes
1773bf2eeab3Smrgfi
1774bf2eeab3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1775bf2eeab3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177614c0a534Smrg
1777bf2eeab3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1778bf2eeab3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1779bf2eeab3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1780bf2eeab3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178114c0a534Smrg
1782bf2eeab3SmrgAC_SUBST(MAKE_TEXT)
1783bf2eeab3SmrgAC_SUBST(MAKE_PS)
1784bf2eeab3SmrgAC_SUBST(MAKE_PDF)
1785bf2eeab3SmrgAC_SUBST(MAKE_HTML)
1786bf2eeab3Smrg]) # XORG_CHECK_DOCBOOK
178714c0a534Smrg
17881a054510Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1789576bae58Smrg# ----------------
1790576bae58Smrg# Minimum version: 1.5.0
17911a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792576bae58Smrg#
1793576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
1794576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
1795576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796576bae58Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17971a054510Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17981a054510Smrg# --with-xmlto assumes 'auto'.
1799576bae58Smrg#
1800576bae58Smrg# Interface to module:
1801576bae58Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1802576bae58Smrg# XMLTO:	returns the path of the xmlto program found
1803576bae58Smrg#		returns the path set by the user in the environment
1804576bae58Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1805576bae58Smrg#		'no' user instructs the module not to use xmlto
1806576bae58Smrg#
1807576bae58Smrg# Added in version 1.10.0
1808576bae58Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1809576bae58Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810576bae58Smrg#
1811576bae58Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812576bae58Smrg#
1813576bae58SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1814576bae58SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18151a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
1816576bae58SmrgAC_ARG_WITH(xmlto,
1817576bae58Smrg	AS_HELP_STRING([--with-xmlto],
18181a054510Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18191a054510Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18201a054510Smrgm4_undefine([_defopt])
1821576bae58Smrg
1822576bae58Smrgif test "x$use_xmlto" = x"auto"; then
1823576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1824576bae58Smrg   if test "x$XMLTO" = "x"; then
1825576bae58Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1826576bae58Smrg	have_xmlto=no
1827576bae58Smrg   else
1828576bae58Smrg        have_xmlto=yes
1829576bae58Smrg   fi
1830576bae58Smrgelif test "x$use_xmlto" = x"yes" ; then
1831576bae58Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1832576bae58Smrg   if test "x$XMLTO" = "x"; then
1833576bae58Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1834576bae58Smrg   fi
1835576bae58Smrg   have_xmlto=yes
1836576bae58Smrgelif test "x$use_xmlto" = x"no" ; then
1837576bae58Smrg   if test "x$XMLTO" != "x"; then
1838576bae58Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1839576bae58Smrg   fi
1840576bae58Smrg   have_xmlto=no
1841576bae58Smrgelse
1842576bae58Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843576bae58Smrgfi
1844576bae58Smrg
1845576bae58Smrg# Test for a minimum version of xmlto, if provided.
1846576bae58Smrgm4_ifval([$1],
1847576bae58Smrg[if test "$have_xmlto" = yes; then
1848576bae58Smrg    # scrape the xmlto version
1849576bae58Smrg    AC_MSG_CHECKING([the xmlto version])
1850576bae58Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1851576bae58Smrg    AC_MSG_RESULT([$xmlto_version])
1852576bae58Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1853576bae58Smrg        [if test "x$use_xmlto" = xauto; then
1854576bae58Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1855576bae58Smrg            have_xmlto=no
1856576bae58Smrg        else
1857576bae58Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1858576bae58Smrg        fi])
1859576bae58Smrgfi])
1860576bae58Smrg
1861576bae58Smrg# Test for the ability of xmlto to generate a text target
1862bdc460c5Smrg#
1863bdc460c5Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864bdc460c5Smrg# following test for empty XML docbook files.
1865bdc460c5Smrg# For compatibility reasons use the following empty XML docbook file and if
1866bdc460c5Smrg# it fails try it again with a non-empty XML file.
1867576bae58Smrghave_xmlto_text=no
1868576bae58Smrgcat > conftest.xml << "EOF"
1869576bae58SmrgEOF
1870576bae58SmrgAS_IF([test "$have_xmlto" = yes],
1871576bae58Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1872576bae58Smrg             [have_xmlto_text=yes],
1873bdc460c5Smrg             [# Try it again with a non-empty XML file.
1874bdc460c5Smrg              cat > conftest.xml << "EOF"
1875bdc460c5Smrg<x></x>
1876bdc460c5SmrgEOF
1877bdc460c5Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878bdc460c5Smrg                    [have_xmlto_text=yes],
1879bdc460c5Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1880576bae58Smrgrm -f conftest.xml
1881576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1882576bae58SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1883576bae58Smrg]) # XORG_WITH_XMLTO
1884576bae58Smrg
18851a054510Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18861a054510Smrg# --------------------------------------------
18871a054510Smrg# Minimum version: 1.12.0
18881a054510Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18891a054510Smrg#
18901a054510Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18911a054510Smrg# XML-based language used for the transformation of XML documents.
18921a054510Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18931a054510Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18941a054510Smrg# The XSLT processor is often used as a standalone tool for transformations.
18951a054510Smrg# It should not be assumed that this tool is used only to work with documnetation.
18961a054510Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18971a054510Smrg#
18981a054510Smrg# Interface to module:
18991a054510Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19001a054510Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19011a054510Smrg#		 returns the path set by the user in the environment
19021a054510Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19031a054510Smrg#		  'no' user instructs the module not to use xsltproc
19041a054510Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19051a054510Smrg#
19061a054510Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19071a054510Smrg#
19081a054510SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19091a054510SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19101a054510Smrg# Preserves the interface, should it be implemented later
19111a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19121a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
19131a054510SmrgAC_ARG_WITH(xsltproc,
19141a054510Smrg	AS_HELP_STRING([--with-xsltproc],
19151a054510Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19161a054510Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19171a054510Smrgm4_undefine([_defopt])
19181a054510Smrg
19191a054510Smrgif test "x$use_xsltproc" = x"auto"; then
19201a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19211a054510Smrg   if test "x$XSLTPROC" = "x"; then
19221a054510Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19231a054510Smrg	have_xsltproc=no
19241a054510Smrg   else
19251a054510Smrg        have_xsltproc=yes
19261a054510Smrg   fi
19271a054510Smrgelif test "x$use_xsltproc" = x"yes" ; then
19281a054510Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19291a054510Smrg   if test "x$XSLTPROC" = "x"; then
19301a054510Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19311a054510Smrg   fi
19321a054510Smrg   have_xsltproc=yes
19331a054510Smrgelif test "x$use_xsltproc" = x"no" ; then
19341a054510Smrg   if test "x$XSLTPROC" != "x"; then
19351a054510Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19361a054510Smrg   fi
19371a054510Smrg   have_xsltproc=no
19381a054510Smrgelse
19391a054510Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19401a054510Smrgfi
19411a054510Smrg
19421a054510SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19431a054510Smrg]) # XORG_WITH_XSLTPROC
19441a054510Smrg
19451a054510Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19461a054510Smrg# ----------------------------------------
19471a054510Smrg# Minimum version: 1.15.0
19481a054510Smrg#
19491a054510Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19501a054510Smrg# scanning arbitrary text files, extracting information from those text files,
19511a054510Smrg# and printing reports based on that information.
19521a054510Smrg#
19531a054510Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19541a054510Smrg#
19551a054510Smrg# Interface to module:
19561a054510Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19571a054510Smrg# PERL:	     returns the path of the perl program found
19581a054510Smrg#	     returns the path set by the user in the environment
19591a054510Smrg# --with-perl: 'yes' user instructs the module to use perl
19601a054510Smrg#	       'no' user instructs the module not to use perl
19611a054510Smrg# have_perl: returns yes if perl found in PATH or no
19621a054510Smrg#
19631a054510Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19641a054510Smrg#
19651a054510SmrgAC_DEFUN([XORG_WITH_PERL],[
19661a054510SmrgAC_ARG_VAR([PERL], [Path to perl command])
19671a054510Smrg# Preserves the interface, should it be implemented later
19681a054510Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19691a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
19701a054510SmrgAC_ARG_WITH(perl,
19711a054510Smrg	AS_HELP_STRING([--with-perl],
19721a054510Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19731a054510Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19741a054510Smrgm4_undefine([_defopt])
19751a054510Smrg
19761a054510Smrgif test "x$use_perl" = x"auto"; then
19771a054510Smrg   AC_PATH_PROG([PERL], [perl])
19781a054510Smrg   if test "x$PERL" = "x"; then
19791a054510Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19801a054510Smrg	have_perl=no
19811a054510Smrg   else
19821a054510Smrg        have_perl=yes
19831a054510Smrg   fi
19841a054510Smrgelif test "x$use_perl" = x"yes" ; then
19851a054510Smrg   AC_PATH_PROG([PERL], [perl])
19861a054510Smrg   if test "x$PERL" = "x"; then
19871a054510Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19881a054510Smrg   fi
19891a054510Smrg   have_perl=yes
19901a054510Smrgelif test "x$use_perl" = x"no" ; then
19911a054510Smrg   if test "x$PERL" != "x"; then
19921a054510Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19931a054510Smrg   fi
19941a054510Smrg   have_perl=no
19951a054510Smrgelse
19961a054510Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19971a054510Smrgfi
19981a054510Smrg
19991a054510SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20001a054510Smrg]) # XORG_WITH_PERL
20011a054510Smrg
20021a054510Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003576bae58Smrg# ----------------
2004576bae58Smrg# Minimum version: 1.5.0
20051a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006576bae58Smrg#
2007576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2008576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2009576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010576bae58Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20111a054510Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20121a054510Smrg# --with-asciidoc assumes 'auto'.
2013576bae58Smrg#
2014576bae58Smrg# Interface to module:
2015576bae58Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2016576bae58Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
2017576bae58Smrg#		 returns the path set by the user in the environment
2018576bae58Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2019576bae58Smrg#		  'no' user instructs the module not to use asciidoc
2020576bae58Smrg#
2021576bae58Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022576bae58Smrg#
2023576bae58SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2024576bae58SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20251a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2026576bae58SmrgAC_ARG_WITH(asciidoc,
2027576bae58Smrg	AS_HELP_STRING([--with-asciidoc],
20281a054510Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20291a054510Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20301a054510Smrgm4_undefine([_defopt])
2031576bae58Smrg
2032576bae58Smrgif test "x$use_asciidoc" = x"auto"; then
2033576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2034576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
2035576bae58Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2036576bae58Smrg	have_asciidoc=no
2037576bae58Smrg   else
2038576bae58Smrg        have_asciidoc=yes
2039576bae58Smrg   fi
2040576bae58Smrgelif test "x$use_asciidoc" = x"yes" ; then
2041576bae58Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2042576bae58Smrg   if test "x$ASCIIDOC" = "x"; then
2043576bae58Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2044576bae58Smrg   fi
2045576bae58Smrg   have_asciidoc=yes
2046576bae58Smrgelif test "x$use_asciidoc" = x"no" ; then
2047576bae58Smrg   if test "x$ASCIIDOC" != "x"; then
2048576bae58Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2049576bae58Smrg   fi
2050576bae58Smrg   have_asciidoc=no
2051576bae58Smrgelse
2052576bae58Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053576bae58Smrgfi
2054576bae58Smrgm4_ifval([$1],
2055576bae58Smrg[if test "$have_asciidoc" = yes; then
2056576bae58Smrg    # scrape the asciidoc version
2057576bae58Smrg    AC_MSG_CHECKING([the asciidoc version])
2058576bae58Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2059576bae58Smrg    AC_MSG_RESULT([$asciidoc_version])
2060576bae58Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2061576bae58Smrg        [if test "x$use_asciidoc" = xauto; then
2062576bae58Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2063576bae58Smrg            have_asciidoc=no
2064576bae58Smrg        else
2065576bae58Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2066576bae58Smrg        fi])
2067576bae58Smrgfi])
2068576bae58SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2069576bae58Smrg]) # XORG_WITH_ASCIIDOC
2070576bae58Smrg
20711a054510Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207224047306Smrg# -------------------------------------------
2073576bae58Smrg# Minimum version: 1.5.0
20741a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207524047306Smrg# Minimum version for optional DOT checking: 1.18.0
2076576bae58Smrg#
2077576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2078576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2079576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080576bae58Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20811a054510Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20821a054510Smrg# --with-doxygen assumes 'auto'.
2083576bae58Smrg#
2084576bae58Smrg# Interface to module:
2085576bae58Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2086576bae58Smrg# DOXYGEN:	 returns the path of the doxygen program found
2087576bae58Smrg#		 returns the path set by the user in the environment
2088576bae58Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2089576bae58Smrg#		  'no' user instructs the module not to use doxygen
2090576bae58Smrg#
2091576bae58Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092576bae58Smrg#
2093576bae58SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2094576bae58SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209524047306SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20961a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2097576bae58SmrgAC_ARG_WITH(doxygen,
2098576bae58Smrg	AS_HELP_STRING([--with-doxygen],
20991a054510Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21001a054510Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21011a054510Smrgm4_undefine([_defopt])
2102576bae58Smrg
2103576bae58Smrgif test "x$use_doxygen" = x"auto"; then
2104576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2105576bae58Smrg   if test "x$DOXYGEN" = "x"; then
2106576bae58Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2107576bae58Smrg	have_doxygen=no
2108576bae58Smrg   else
2109576bae58Smrg        have_doxygen=yes
2110576bae58Smrg   fi
2111576bae58Smrgelif test "x$use_doxygen" = x"yes" ; then
2112576bae58Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2113576bae58Smrg   if test "x$DOXYGEN" = "x"; then
2114576bae58Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2115576bae58Smrg   fi
2116576bae58Smrg   have_doxygen=yes
2117576bae58Smrgelif test "x$use_doxygen" = x"no" ; then
2118576bae58Smrg   if test "x$DOXYGEN" != "x"; then
2119576bae58Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2120576bae58Smrg   fi
2121576bae58Smrg   have_doxygen=no
2122576bae58Smrgelse
2123576bae58Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124576bae58Smrgfi
2125576bae58Smrgm4_ifval([$1],
2126576bae58Smrg[if test "$have_doxygen" = yes; then
2127576bae58Smrg    # scrape the doxygen version
2128576bae58Smrg    AC_MSG_CHECKING([the doxygen version])
2129576bae58Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2130576bae58Smrg    AC_MSG_RESULT([$doxygen_version])
2131576bae58Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2132576bae58Smrg        [if test "x$use_doxygen" = xauto; then
2133576bae58Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2134576bae58Smrg            have_doxygen=no
2135576bae58Smrg        else
2136576bae58Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2137576bae58Smrg        fi])
2138576bae58Smrgfi])
213924047306Smrg
214024047306Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214124047306Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214224047306Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214324047306SmrgHAVE_DOT=no
214424047306Smrgif test "x$have_doxygen" = "xyes"; then
214524047306Smrg  AC_PATH_PROG([DOT], [dot])
214624047306Smrg    if test "x$DOT" != "x"; then
214724047306Smrg      HAVE_DOT=yes
214824047306Smrg    fi
214924047306Smrgfi
215024047306Smrg
215124047306SmrgAC_SUBST([HAVE_DOT])
215224047306SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2153576bae58SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2154576bae58Smrg]) # XORG_WITH_DOXYGEN
2155576bae58Smrg
21561a054510Smrg# XORG_WITH_GROFF([DEFAULT])
2157576bae58Smrg# ----------------
2158576bae58Smrg# Minimum version: 1.6.0
21591a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160576bae58Smrg#
2161576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2162576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2163576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164576bae58Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
21651a054510Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21661a054510Smrg# --with-groff assumes 'auto'.
2167576bae58Smrg#
2168576bae58Smrg# Interface to module:
2169576bae58Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2170576bae58Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2171576bae58Smrg# HAVE_GROFF_MS: the -ms macros package
2172576bae58Smrg# GROFF:	 returns the path of the groff program found
2173576bae58Smrg#		 returns the path set by the user in the environment
2174576bae58Smrg# --with-groff:	 'yes' user instructs the module to use groff
2175576bae58Smrg#		 'no' user instructs the module not to use groff
2176576bae58Smrg#
2177576bae58Smrg# Added in version 1.9.0:
2178576bae58Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2179576bae58Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2180576bae58Smrg#		   psselect from the psutils package.
2181576bae58Smrg#		   the ghostcript package. Refer to the grohtml man pages
2182576bae58Smrg#
2183576bae58Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2184576bae58Smrg#
2185576bae58Smrg# OS and distros often splits groff in a basic and full package, the former
2186576bae58Smrg# having the groff program and the later having devices, fonts and macros
2187576bae58Smrg# Checking for the groff executable is not enough.
2188576bae58Smrg#
2189576bae58Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2190576bae58Smrg# unset HAVE_GROFF or GROFF env variables.
2191576bae58Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2192576bae58Smrg#
2193576bae58SmrgAC_DEFUN([XORG_WITH_GROFF],[
2194576bae58SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21951a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2196576bae58SmrgAC_ARG_WITH(groff,
2197576bae58Smrg	AS_HELP_STRING([--with-groff],
21981a054510Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21991a054510Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22001a054510Smrgm4_undefine([_defopt])
2201576bae58Smrg
2202576bae58Smrgif test "x$use_groff" = x"auto"; then
2203576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2204576bae58Smrg   if test "x$GROFF" = "x"; then
2205576bae58Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2206576bae58Smrg	have_groff=no
2207576bae58Smrg   else
2208576bae58Smrg        have_groff=yes
2209576bae58Smrg   fi
2210576bae58Smrgelif test "x$use_groff" = x"yes" ; then
2211576bae58Smrg   AC_PATH_PROG([GROFF], [groff])
2212576bae58Smrg   if test "x$GROFF" = "x"; then
2213576bae58Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2214576bae58Smrg   fi
2215576bae58Smrg   have_groff=yes
2216576bae58Smrgelif test "x$use_groff" = x"no" ; then
2217576bae58Smrg   if test "x$GROFF" != "x"; then
2218576bae58Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2219576bae58Smrg   fi
2220576bae58Smrg   have_groff=no
2221576bae58Smrgelse
2222576bae58Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223576bae58Smrgfi
2224576bae58Smrg
2225576bae58Smrg# We have groff, test for the presence of the macro packages
2226576bae58Smrgif test "x$have_groff" = x"yes"; then
2227576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2228576bae58Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2229576bae58Smrg        groff_ms_works=yes
2230576bae58Smrg    else
2231576bae58Smrg        groff_ms_works=no
2232576bae58Smrg    fi
2233576bae58Smrg    AC_MSG_RESULT([$groff_ms_works])
2234576bae58Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2235576bae58Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2236576bae58Smrg        groff_mm_works=yes
2237576bae58Smrg    else
2238576bae58Smrg        groff_mm_works=no
2239576bae58Smrg    fi
2240576bae58Smrg    AC_MSG_RESULT([$groff_mm_works])
2241576bae58Smrgfi
2242576bae58Smrg
2243576bae58Smrg# We have groff, test for HTML dependencies, one command per package
2244576bae58Smrgif test "x$have_groff" = x"yes"; then
2245576bae58Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2246576bae58Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2247576bae58Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2248576bae58Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2249576bae58Smrg      have_groff_html=yes
2250576bae58Smrg   else
2251576bae58Smrg      have_groff_html=no
2252576bae58Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2253576bae58Smrg   fi
2254576bae58Smrgfi
2255576bae58Smrg
2256576bae58Smrg# Set Automake conditionals for Makefiles
2257576bae58SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2258576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2259576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2260576bae58SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2261576bae58Smrg]) # XORG_WITH_GROFF
2262576bae58Smrg
22631a054510Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22641a054510Smrg# ---------------------------------------
2265576bae58Smrg# Minimum version: 1.6.0
22661a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22671a054510Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2268576bae58Smrg#
2269576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2270576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2271576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272576bae58Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
22731a054510Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22741a054510Smrg# --with-fop assumes 'auto'.
2275576bae58Smrg#
2276576bae58Smrg# Interface to module:
2277576bae58Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2278576bae58Smrg# FOP:	 	returns the path of the fop program found
2279576bae58Smrg#		returns the path set by the user in the environment
2280576bae58Smrg# --with-fop: 	'yes' user instructs the module to use fop
2281576bae58Smrg#		'no' user instructs the module not to use fop
2282576bae58Smrg#
2283576bae58Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284576bae58Smrg#
2285576bae58SmrgAC_DEFUN([XORG_WITH_FOP],[
2286576bae58SmrgAC_ARG_VAR([FOP], [Path to fop command])
22871a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
2288576bae58SmrgAC_ARG_WITH(fop,
2289576bae58Smrg	AS_HELP_STRING([--with-fop],
22901a054510Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22911a054510Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22921a054510Smrgm4_undefine([_defopt])
2293576bae58Smrg
2294576bae58Smrgif test "x$use_fop" = x"auto"; then
2295576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2296576bae58Smrg   if test "x$FOP" = "x"; then
2297576bae58Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2298576bae58Smrg	have_fop=no
2299576bae58Smrg   else
2300576bae58Smrg        have_fop=yes
2301576bae58Smrg   fi
2302576bae58Smrgelif test "x$use_fop" = x"yes" ; then
2303576bae58Smrg   AC_PATH_PROG([FOP], [fop])
2304576bae58Smrg   if test "x$FOP" = "x"; then
2305576bae58Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2306576bae58Smrg   fi
2307576bae58Smrg   have_fop=yes
2308576bae58Smrgelif test "x$use_fop" = x"no" ; then
2309576bae58Smrg   if test "x$FOP" != "x"; then
2310576bae58Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2311576bae58Smrg   fi
2312576bae58Smrg   have_fop=no
2313576bae58Smrgelse
2314576bae58Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315576bae58Smrgfi
23161a054510Smrg
23171a054510Smrg# Test for a minimum version of fop, if provided.
23181a054510Smrgm4_ifval([$1],
23191a054510Smrg[if test "$have_fop" = yes; then
23201a054510Smrg    # scrape the fop version
23211a054510Smrg    AC_MSG_CHECKING([for fop minimum version])
23221a054510Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23231a054510Smrg    AC_MSG_RESULT([$fop_version])
23241a054510Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23251a054510Smrg        [if test "x$use_fop" = xauto; then
23261a054510Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23271a054510Smrg            have_fop=no
23281a054510Smrg        else
23291a054510Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23301a054510Smrg        fi])
23311a054510Smrgfi])
2332576bae58SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2333576bae58Smrg]) # XORG_WITH_FOP
2334576bae58Smrg
233524047306Smrg# XORG_WITH_M4([MIN-VERSION])
233624047306Smrg# ---------------------------
233724047306Smrg# Minimum version: 1.19.0
233824047306Smrg#
233924047306Smrg# This macro attempts to locate an m4 macro processor which supports
234024047306Smrg# -I option and is only useful for modules relying on M4 in order to
234124047306Smrg# expand macros in source code files.
234224047306Smrg#
234324047306Smrg# Interface to module:
234424047306Smrg# M4:	 	returns the path of the m4 program found
234524047306Smrg#		returns the path set by the user in the environment
234624047306Smrg#
234724047306SmrgAC_DEFUN([XORG_WITH_M4], [
234824047306SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234924047306Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235024047306Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235124047306Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235224047306Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235324047306Smrg   [$PATH:/usr/gnu/bin])])
235424047306Smrg
235524047306SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235624047306Smrg]) # XORG_WITH_M4
235724047306Smrg
23581a054510Smrg# XORG_WITH_PS2PDF([DEFAULT])
2359576bae58Smrg# ----------------
2360576bae58Smrg# Minimum version: 1.6.0
23611a054510Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2362576bae58Smrg#
2363576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2364576bae58Smrg# not at the appropriate level. This macro enables a module to test for the
2365576bae58Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366576bae58Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23671a054510Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23681a054510Smrg# --with-ps2pdf assumes 'auto'.
2369576bae58Smrg#
2370576bae58Smrg# Interface to module:
2371576bae58Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2372576bae58Smrg# PS2PDF:	returns the path of the ps2pdf program found
2373576bae58Smrg#		returns the path set by the user in the environment
2374576bae58Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2375576bae58Smrg#		 'no' user instructs the module not to use ps2pdf
2376576bae58Smrg#
2377576bae58Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2378576bae58Smrg#
2379576bae58SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2380576bae58SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23811a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
2382576bae58SmrgAC_ARG_WITH(ps2pdf,
2383576bae58Smrg	AS_HELP_STRING([--with-ps2pdf],
23841a054510Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23851a054510Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23861a054510Smrgm4_undefine([_defopt])
2387576bae58Smrg
2388576bae58Smrgif test "x$use_ps2pdf" = x"auto"; then
2389576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2390576bae58Smrg   if test "x$PS2PDF" = "x"; then
2391576bae58Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2392576bae58Smrg	have_ps2pdf=no
2393576bae58Smrg   else
2394576bae58Smrg        have_ps2pdf=yes
2395576bae58Smrg   fi
2396576bae58Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2397576bae58Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2398576bae58Smrg   if test "x$PS2PDF" = "x"; then
2399576bae58Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2400576bae58Smrg   fi
2401576bae58Smrg   have_ps2pdf=yes
2402576bae58Smrgelif test "x$use_ps2pdf" = x"no" ; then
2403576bae58Smrg   if test "x$PS2PDF" != "x"; then
2404576bae58Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2405576bae58Smrg   fi
2406576bae58Smrg   have_ps2pdf=no
2407576bae58Smrgelse
2408576bae58Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409576bae58Smrgfi
2410576bae58SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2411576bae58Smrg]) # XORG_WITH_PS2PDF
2412576bae58Smrg
2413576bae58Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2414576bae58Smrg# ----------------
2415576bae58Smrg# Minimum version: 1.6.0
2416576bae58Smrg#
2417576bae58Smrg# Documentation tools are not always available on all platforms and sometimes
2418576bae58Smrg# not at the appropriate level. This macro enables a builder to skip all
2419576bae58Smrg# documentation targets except traditional man pages.
2420576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421576bae58Smrg# maximum flexibilty in controlling documentation building.
2422576bae58Smrg# Refer to:
2423576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2424576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2425576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2426576bae58Smrg# XORG_WITH_FOP           --with-fop
2427576bae58Smrg# XORG_WITH_GROFF         --with-groff
2428576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2429576bae58Smrg#
2430576bae58Smrg# Interface to module:
2431576bae58Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2432576bae58Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2433576bae58Smrg#		 'no' user instructs the module not to generate docs
2434576bae58Smrg# parm1:	specify the default value, yes or no.
2435576bae58Smrg#
2436576bae58SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24371a054510Smrgm4_define([docs_default], m4_default([$1], [yes]))
2438576bae58SmrgAC_ARG_ENABLE(docs,
2439576bae58Smrg	AS_HELP_STRING([--enable-docs],
24401a054510Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24411a054510Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24421a054510Smrgm4_undefine([docs_default])
2443576bae58SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2444576bae58SmrgAC_MSG_CHECKING([whether to build documentation])
2445576bae58SmrgAC_MSG_RESULT([$build_docs])
2446576bae58Smrg]) # XORG_ENABLE_DOCS
2447576bae58Smrg
2448576bae58Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2449576bae58Smrg# ----------------
2450576bae58Smrg# Minimum version: 1.6.0
2451576bae58Smrg#
2452576bae58Smrg# This macro enables a builder to skip all developer documentation.
2453576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454576bae58Smrg# maximum flexibilty in controlling documentation building.
2455576bae58Smrg# Refer to:
2456576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2457576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2458576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2459576bae58Smrg# XORG_WITH_FOP           --with-fop
2460576bae58Smrg# XORG_WITH_GROFF         --with-groff
2461576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2462576bae58Smrg#
2463576bae58Smrg# Interface to module:
2464576bae58Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2465576bae58Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2466576bae58Smrg#			'no' user instructs the module not to generate developer docs
2467576bae58Smrg# parm1:		specify the default value, yes or no.
2468576bae58Smrg#
2469576bae58SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24701a054510Smrgm4_define([devel_default], m4_default([$1], [yes]))
2471576bae58SmrgAC_ARG_ENABLE(devel-docs,
2472576bae58Smrg	AS_HELP_STRING([--enable-devel-docs],
24731a054510Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24741a054510Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24751a054510Smrgm4_undefine([devel_default])
2476576bae58SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2477576bae58SmrgAC_MSG_CHECKING([whether to build developer documentation])
2478576bae58SmrgAC_MSG_RESULT([$build_devel_docs])
2479576bae58Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480576bae58Smrg
2481576bae58Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2482576bae58Smrg# ----------------
2483576bae58Smrg# Minimum version: 1.6.0
2484576bae58Smrg#
2485576bae58Smrg# This macro enables a builder to skip all functional specification targets.
2486576bae58Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487576bae58Smrg# maximum flexibilty in controlling documentation building.
2488576bae58Smrg# Refer to:
2489576bae58Smrg# XORG_WITH_XMLTO         --with-xmlto
2490576bae58Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2491576bae58Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2492576bae58Smrg# XORG_WITH_FOP           --with-fop
2493576bae58Smrg# XORG_WITH_GROFF         --with-groff
2494576bae58Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2495576bae58Smrg#
2496576bae58Smrg# Interface to module:
2497576bae58Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2498576bae58Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2499576bae58Smrg#			'no' user instructs the module not to generate specs
2500576bae58Smrg# parm1:		specify the default value, yes or no.
2501576bae58Smrg#
2502576bae58SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25031a054510Smrgm4_define([spec_default], m4_default([$1], [yes]))
2504576bae58SmrgAC_ARG_ENABLE(specs,
2505576bae58Smrg	AS_HELP_STRING([--enable-specs],
25061a054510Smrg	   [Enable building the specs (default: ]spec_default[)]),
25071a054510Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25081a054510Smrgm4_undefine([spec_default])
2509576bae58SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2510576bae58SmrgAC_MSG_CHECKING([whether to build functional specifications])
2511576bae58SmrgAC_MSG_RESULT([$build_specs])
2512576bae58Smrg]) # XORG_ENABLE_SPECS
2513576bae58Smrg
25141a054510Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25151a054510Smrg# ----------------------------------------------
25161a054510Smrg# Minimum version: 1.13.0
25171a054510Smrg#
25181a054510Smrg# This macro enables a builder to enable/disable unit testing
25191a054510Smrg# It makes no assumption about the test cases implementation
25201a054510Smrg# Test cases may or may not use Automake "Support for test suites"
25211a054510Smrg# They may or may not use the software utility library GLib
25221a054510Smrg#
25231a054510Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25241a054510Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25251a054510Smrg# The variable enable_unit_tests is used by other macros in this file.
25261a054510Smrg#
25271a054510Smrg# Interface to module:
25281a054510Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25291a054510Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25301a054510Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25311a054510Smrg#			'no' user instructs the module not to build tests
25321a054510Smrg# parm1:		specify the default value, yes or no.
25331a054510Smrg#
25341a054510SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25351a054510SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25361a054510SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253724047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25381a054510Smrgm4_define([_defopt], m4_default([$1], [auto]))
25391a054510SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25401a054510Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25411a054510Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25421a054510Smrgm4_undefine([_defopt])
25431a054510SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25441a054510SmrgAC_MSG_CHECKING([whether to build unit test cases])
25451a054510SmrgAC_MSG_RESULT([$enable_unit_tests])
25461a054510Smrg]) # XORG_ENABLE_UNIT_TESTS
25471a054510Smrg
254824047306Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254924047306Smrg# ------------------------------------------------------
255024047306Smrg# Minimum version: 1.17.0
255124047306Smrg#
255224047306Smrg# This macro enables a builder to enable/disable integration testing
255324047306Smrg# It makes no assumption about the test cases' implementation
255424047306Smrg# Test cases may or may not use Automake "Support for test suites"
255524047306Smrg#
255624047306Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255724047306Smrg# usually requires less dependencies and may be built and run under less
255824047306Smrg# stringent environments than integration tests.
255924047306Smrg#
256024047306Smrg# Interface to module:
256124047306Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256224047306Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256324047306Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256424047306Smrg#                             'no' user instructs the module not to build tests
256524047306Smrg# parm1:                      specify the default value, yes or no.
256624047306Smrg#
256724047306SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256824047306SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256924047306Smrgm4_define([_defopt], m4_default([$1], [auto]))
257024047306SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257124047306Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257224047306Smrg	[enable_integration_tests=$enableval],
257324047306Smrg	[enable_integration_tests=]_defopt)
257424047306Smrgm4_undefine([_defopt])
257524047306SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257624047306Smrg	[test "x$enable_integration_tests" != xno])
257724047306SmrgAC_MSG_CHECKING([whether to build unit test cases])
257824047306SmrgAC_MSG_RESULT([$enable_integration_tests])
257924047306Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258024047306Smrg
25811a054510Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25821a054510Smrg# ----------------------------------------
25831a054510Smrg# Minimum version: 1.13.0
25841a054510Smrg#
25851a054510Smrg# GLib is a library which provides advanced data structures and functions.
25861a054510Smrg# This macro enables a module to test for the presence of Glib.
25871a054510Smrg#
25881a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25891a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
25901a054510Smrg#
259124047306Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259224047306Smrg# test support usually requires less dependencies and may be built and run under
259324047306Smrg# less stringent environments than integration tests.
259424047306Smrg#
25951a054510Smrg# Interface to module:
25961a054510Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25971a054510Smrg# with_glib: used in configure.ac to know if GLib has been found
25981a054510Smrg# --with-glib:	'yes' user instructs the module to use glib
25991a054510Smrg#		'no' user instructs the module not to use glib
26001a054510Smrg#
26011a054510SmrgAC_DEFUN([XORG_WITH_GLIB],[
26021a054510SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26031a054510Smrgm4_define([_defopt], m4_default([$2], [auto]))
26041a054510SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26051a054510Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26061a054510Smrg	[with_glib=$withval], [with_glib=]_defopt)
26071a054510Smrgm4_undefine([_defopt])
26081a054510Smrg
26091a054510Smrghave_glib=no
26101a054510Smrg# Do not probe GLib if user explicitly disabled unit testing
26111a054510Smrgif test "x$enable_unit_tests" != x"no"; then
26121a054510Smrg  # Do not probe GLib if user explicitly disabled it
26131a054510Smrg  if test "x$with_glib" != x"no"; then
26141a054510Smrg    m4_ifval(
26151a054510Smrg      [$1],
26161a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26171a054510Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26181a054510Smrg    )
26191a054510Smrg  fi
26201a054510Smrgfi
26211a054510Smrg
26221a054510Smrg# Not having GLib when unit testing has been explicitly requested is an error
26231a054510Smrgif test "x$enable_unit_tests" = x"yes"; then
26241a054510Smrg  if test "x$have_glib" = x"no"; then
26251a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26261a054510Smrg  fi
26271a054510Smrgfi
26281a054510Smrg
26291a054510Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26301a054510Smrgif test "x$enable_unit_tests" = x"no"; then
26311a054510Smrg  if test "x$with_glib" = x"yes"; then
26321a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26331a054510Smrg  fi
26341a054510Smrgfi
26351a054510Smrg
26361a054510Smrg# Not having GLib when it has been explicitly requested is an error
26371a054510Smrgif test "x$with_glib" = x"yes"; then
26381a054510Smrg  if test "x$have_glib" = x"no"; then
26391a054510Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26401a054510Smrg  fi
26411a054510Smrgfi
26421a054510Smrg
26431a054510SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26441a054510Smrg]) # XORG_WITH_GLIB
26451a054510Smrg
264624047306Smrg# XORG_LD_WRAP([required|optional])
264724047306Smrg# ---------------------------------
26481a054510Smrg# Minimum version: 1.13.0
26491a054510Smrg#
26501a054510Smrg# Check if linker supports -wrap, passed via compiler flags
26511a054510Smrg#
26521a054510Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26531a054510Smrg# Otherwise the value of $enable_unit_tests is blank.
26541a054510Smrg#
265524047306Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265624047306Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265724047306Smrg# available, an argument of "optional" allows use when some unit tests require
265824047306Smrg# ld -wrap and others do not.
265924047306Smrg#
26601a054510SmrgAC_DEFUN([XORG_LD_WRAP],[
266124047306SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266224047306Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266324047306Smrg                      void __wrap_exit(int status) { return; }],
266424047306Smrg                     [exit(0);])])
26651a054510Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266624047306Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26671a054510Smrg  if test "x$have_ld_wrap" = x"no"; then
26681a054510Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26691a054510Smrg  fi
26701a054510Smrgfi
26711a054510SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26721a054510Smrg#
26731a054510Smrg]) # XORG_LD_WRAP
26741a054510Smrg
26751a054510Smrg# XORG_CHECK_LINKER_FLAGS
26761a054510Smrg# -----------------------
26771a054510Smrg# SYNOPSIS
26781a054510Smrg#
267924047306Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26801a054510Smrg#
26811a054510Smrg# DESCRIPTION
26821a054510Smrg#
26831a054510Smrg#   Check whether the given linker FLAGS work with the current language's
26841a054510Smrg#   linker, or whether they give an error.
26851a054510Smrg#
26861a054510Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26871a054510Smrg#   success/failure.
26881a054510Smrg#
268924047306Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269024047306Smrg#
26911a054510Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26921a054510Smrg#
26931a054510Smrg# LICENSE
26941a054510Smrg#
26951a054510Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26961a054510Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26971a054510Smrg#   Copyright (c) 2009 Matteo Frigo
26981a054510Smrg#
26991a054510Smrg#   This program is free software: you can redistribute it and/or modify it
27001a054510Smrg#   under the terms of the GNU General Public License as published by the
27011a054510Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27021a054510Smrg#   option) any later version.
27031a054510Smrg#
27041a054510Smrg#   This program is distributed in the hope that it will be useful, but
27051a054510Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27061a054510Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27071a054510Smrg#   Public License for more details.
27081a054510Smrg#
27091a054510Smrg#   You should have received a copy of the GNU General Public License along
27101a054510Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27111a054510Smrg#
27121a054510Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27131a054510Smrg#   gives unlimited permission to copy, distribute and modify the configure
27141a054510Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27151a054510Smrg#   need not follow the terms of the GNU General Public License when using
27161a054510Smrg#   or distributing such scripts, even though portions of the text of the
27171a054510Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27181a054510Smrg#   all other use of the material that constitutes the Autoconf Macro.
27191a054510Smrg#
27201a054510Smrg#   This special exception to the GPL applies to versions of the Autoconf
27211a054510Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27221a054510Smrg#   modified version of the Autoconf Macro, you may extend this special
27231a054510Smrg#   exception to the GPL to apply to your modified version as well.#
27241a054510SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27251a054510Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27261a054510Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27271a054510SmrgAS_LITERAL_IF([$1],
27281a054510Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27291a054510Smrg      ax_save_FLAGS=$LDFLAGS
27301a054510Smrg      LDFLAGS="$1"
273124047306Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27321a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27331a054510Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27341a054510Smrg      LDFLAGS=$ax_save_FLAGS])],
27351a054510Smrg  [ax_save_FLAGS=$LDFLAGS
27361a054510Smrg   LDFLAGS="$1"
27371a054510Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27381a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27391a054510Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27401a054510Smrg   LDFLAGS=$ax_save_FLAGS])
27411a054510Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27421a054510SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27431a054510Smrgif test "x$xorg_check_linker_flags" = xyes; then
27441a054510Smrg	m4_default([$2], :)
27451a054510Smrgelse
27461a054510Smrg	m4_default([$3], :)
27471a054510Smrgfi
27481a054510Smrg]) # XORG_CHECK_LINKER_FLAGS
27491a054510Smrg
275024047306Smrg# XORG_MEMORY_CHECK_FLAGS
275124047306Smrg# -----------------------
275224047306Smrg# Minimum version: 1.16.0
275324047306Smrg#
275424047306Smrg# This macro attempts to find appropriate memory checking functionality
275524047306Smrg# for various platforms which unit testing code may use to catch various
275624047306Smrg# forms of memory allocation and access errors in testing.
275724047306Smrg#
275824047306Smrg# Interface to module:
275924047306Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276024047306Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276124047306Smrg#
276224047306Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276324047306Smrg#
276424047306SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276524047306Smrg
276624047306SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276724047306SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276824047306Smrg           [Environment variables to enable memory checking in tests])
276924047306Smrg
277024047306Smrg# Check for different types of support on different platforms
277124047306Smrgcase $host_os in
277224047306Smrg    solaris*)
277324047306Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277424047306Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277524047306Smrg        ;;
277624047306Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277724047306Smrg        # both directly and inverted, so should not be 0 or 255.
277824047306Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277924047306Smrg        ;;
278024047306Smrg    darwin*)
278124047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278224047306Smrg        ;;
278324047306Smrg    *bsd*)
278424047306Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278524047306Smrg        ;;
278624047306Smrgesac
278724047306Smrg
278824047306Smrg# User supplied flags override default flags
278924047306Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279024047306Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279124047306Smrgfi
279224047306Smrg
279324047306SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279424047306Smrg]) # XORG_WITH_LINT
279524047306Smrg
2796bf2eeab3Smrg# XORG_CHECK_MALLOC_ZERO
2797bf2eeab3Smrg# ----------------------
2798bf2eeab3Smrg# Minimum version: 1.0.0
2799bf2eeab3Smrg#
2800bf2eeab3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2801bf2eeab3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2802bf2eeab3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2803bf2eeab3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2804bf2eeab3SmrgAC_ARG_ENABLE(malloc0returnsnull,
2805bf2eeab3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2806bf2eeab3Smrg		       [malloc(0) returns NULL (default: auto)]),
2807bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2808bf2eeab3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280914c0a534Smrg
2810bf2eeab3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2811bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281224047306SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281324047306Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28141a054510Smrg#include <stdlib.h>
28151a054510Smrg],[
2816bf2eeab3Smrg    char *m0, *r0, *c0, *p;
2817bf2eeab3Smrg    m0 = malloc(0);
2818bf2eeab3Smrg    p = malloc(10);
2819bf2eeab3Smrg    r0 = realloc(p,0);
28201a054510Smrg    c0 = calloc(0,10);
28211a054510Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28221a054510Smrg])],
282324047306Smrg		[xorg_cv_malloc0_returns_null=yes],
282424047306Smrg		[xorg_cv_malloc0_returns_null=no])])
282524047306SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826bf2eeab3Smrgfi
2827bf2eeab3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282814c0a534Smrg
2829bf2eeab3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2830bf2eeab3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2831bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2832bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833bf2eeab3Smrgelse
2834bf2eeab3Smrg	MALLOC_ZERO_CFLAGS=""
2835bf2eeab3Smrg	XMALLOC_ZERO_CFLAGS=""
2836bf2eeab3Smrg	XTMALLOC_ZERO_CFLAGS=""
2837bf2eeab3Smrgfi
283814c0a534Smrg
2839bf2eeab3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2840bf2eeab3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2841bf2eeab3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2842bf2eeab3Smrg]) # XORG_CHECK_MALLOC_ZERO
284314c0a534Smrg
2844bf2eeab3Smrg# XORG_WITH_LINT()
2845bf2eeab3Smrg# ----------------
2846bf2eeab3Smrg# Minimum version: 1.1.0
284714c0a534Smrg#
2848576bae58Smrg# This macro enables the use of a tool that flags some suspicious and
2849576bae58Smrg# non-portable constructs (likely to be bugs) in C language source code.
2850576bae58Smrg# It will attempt to locate the tool and use appropriate options.
2851576bae58Smrg# There are various lint type tools on different platforms.
2852576bae58Smrg#
2853576bae58Smrg# Interface to module:
2854576bae58Smrg# LINT:		returns the path to the tool found on the platform
2855576bae58Smrg#		or the value set to LINT on the configure cmd line
2856576bae58Smrg#		also an Automake conditional
2857576bae58Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2858576bae58Smrg#
2859576bae58Smrg# --with-lint:	'yes' user instructs the module to use lint
2860576bae58Smrg#		'no' user instructs the module not to use lint (default)
2861576bae58Smrg#
2862576bae58Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2863576bae58Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
2864bf2eeab3Smrg#
2865bf2eeab3SmrgAC_DEFUN([XORG_WITH_LINT],[
2866bf2eeab3Smrg
2867576bae58SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2868576bae58SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869bf2eeab3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2870bf2eeab3Smrg		[Use a lint-style source code checker (default: disabled)])],
2871bf2eeab3Smrg		[use_lint=$withval], [use_lint=no])
2872576bae58Smrg
2873576bae58Smrg# Obtain platform specific info like program name and options
2874576bae58Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2875576bae58Smrgcase $host_os in
2876576bae58Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2877576bae58Smrg	lint_name=splint
2878576bae58Smrg	lint_options="-badflag"
2879576bae58Smrg	;;
2880576bae58Smrg  *freebsd* | *netbsd*)
2881576bae58Smrg	lint_name=lint
2882576bae58Smrg	lint_options="-u -b"
2883576bae58Smrg	;;
2884576bae58Smrg  *solaris*)
2885576bae58Smrg	lint_name=lint
2886576bae58Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2887576bae58Smrg	;;
2888576bae58Smrgesac
2889576bae58Smrg
2890576bae58Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2891576bae58Smrgif test "x$use_lint" = x"yes" ; then
2892576bae58Smrg   AC_PATH_PROG([LINT], [$lint_name])
2893576bae58Smrg   if test "x$LINT" = "x"; then
2894576bae58Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2895576bae58Smrg   fi
2896576bae58Smrgelif test "x$use_lint" = x"no" ; then
2897576bae58Smrg   if test "x$LINT" != "x"; then
2898576bae58Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2899576bae58Smrg   fi
290014c0a534Smrgelse
2901576bae58Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902bf2eeab3Smrgfi
2903576bae58Smrg
2904576bae58Smrg# User supplied flags override default flags
2905576bae58Smrgif test "x$LINT_FLAGS" != "x"; then
2906576bae58Smrg   lint_options=$LINT_FLAGS
290714c0a534Smrgfi
290814c0a534Smrg
2909576bae58SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2910576bae58SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291114c0a534Smrg
2912bf2eeab3Smrg]) # XORG_WITH_LINT
291314c0a534Smrg
2914bf2eeab3Smrg# XORG_LINT_LIBRARY(LIBNAME)
2915bf2eeab3Smrg# --------------------------
2916bf2eeab3Smrg# Minimum version: 1.1.0
2917bf2eeab3Smrg#
2918bf2eeab3Smrg# Sets up flags for building lint libraries for checking programs that call
2919bf2eeab3Smrg# functions in the library.
2920bf2eeab3Smrg#
2921576bae58Smrg# Interface to module:
2922576bae58Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2923576bae58Smrg# MAKE_LINT_LIB		- Automake conditional
2924576bae58Smrg#
2925576bae58Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2926576bae58Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292714c0a534Smrg
2928bf2eeab3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
2929bf2eeab3SmrgAC_REQUIRE([XORG_WITH_LINT])
2930bf2eeab3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2931bf2eeab3Smrg	[Create lint library (default: disabled)])],
2932bf2eeab3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2933576bae58Smrg
2934576bae58Smrgif test "x$make_lint_lib" = x"yes" ; then
2935576bae58Smrg   LINTLIB=llib-l$1.ln
2936576bae58Smrg   if test "x$LINT" = "x"; then
2937576bae58Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2938576bae58Smrg   fi
2939576bae58Smrgelif test "x$make_lint_lib" != x"no" ; then
2940576bae58Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941bf2eeab3Smrgfi
2942576bae58Smrg
2943bf2eeab3SmrgAC_SUBST(LINTLIB)
2944bf2eeab3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294514c0a534Smrg
2946bf2eeab3Smrg]) # XORG_LINT_LIBRARY
294714c0a534Smrg
29481a054510Smrg# XORG_COMPILER_BRAND
29491a054510Smrg# -------------------
29501a054510Smrg# Minimum version: 1.14.0
29511a054510Smrg#
29521a054510Smrg# Checks for various brands of compilers and sets flags as appropriate:
29531a054510Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295424047306Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29551a054510Smrg#   clang compiler - sets CLANGCC to "yes"
29561a054510Smrg#   Intel compiler - sets INTELCC to "yes"
29571a054510Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29581a054510Smrg#
29591a054510SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296024047306SmrgAC_LANG_CASE(
296124047306Smrg	[C], [
296224047306Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296324047306Smrg	],
296424047306Smrg	[C++], [
296524047306Smrg		AC_REQUIRE([AC_PROG_CXX])
296624047306Smrg	]
296724047306Smrg)
29681a054510SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29691a054510SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29701a054510SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29711a054510Smrg]) # XORG_COMPILER_BRAND
29721a054510Smrg
297324047306Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297424047306Smrg# ---------------
297524047306Smrg# Minimum version: 1.16.0
297624047306Smrg#
297724047306Smrg# Test if the compiler works when passed the given flag as a command line argument.
297824047306Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297924047306Smrg# next flag in the list until there are no more options.
298024047306Smrg#
298124047306Smrg# Note that this does not guarantee that the compiler supports the flag as some
298224047306Smrg# compilers will simply ignore arguments that they do not understand, but we do
298324047306Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298424047306Smrg# -Werror=unused-command-line-argument
298524047306Smrg#
298624047306SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298724047306Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298824047306Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298924047306Smrg
299024047306SmrgAC_LANG_COMPILER_REQUIRE
299124047306Smrg
299224047306SmrgAC_LANG_CASE(
299324047306Smrg	[C], [
299424047306Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299524047306Smrg		define([PREFIX], [C])
299624047306Smrg		define([CACHE_PREFIX], [cc])
299724047306Smrg		define([COMPILER], [$CC])
299824047306Smrg	],
299924047306Smrg	[C++], [
300024047306Smrg		define([PREFIX], [CXX])
300124047306Smrg		define([CACHE_PREFIX], [cxx])
300224047306Smrg		define([COMPILER], [$CXX])
300324047306Smrg	]
300424047306Smrg)
300524047306Smrg
300624047306Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300724047306Smrg
300824047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300924047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301024047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301124047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301224047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301324047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301424047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301524047306Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301624047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301724047306Smrgfi
301824047306Smrg
301924047306Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302024047306Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302124047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302224047306Smrg	fi
302324047306Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302424047306Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302524047306Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302624047306Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302724047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302824047306Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302924047306Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303024047306Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303124047306Smrgfi
303224047306Smrg
303324047306Smrgfound="no"
303424047306Smrgm4_foreach([flag], m4_cdr($@), [
303524047306Smrg	if test $found = "no" ; then
303624047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303724047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303824047306Smrg		fi
303924047306Smrg
304024047306Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304124047306Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304224047306Smrg		fi
304324047306Smrg
304424047306Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304524047306Smrg
304624047306Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304724047306Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304824047306Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304924047306Smrg		AC_CACHE_VAL($cacheid,
305024047306Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305124047306Smrg					     [eval $cacheid=yes],
305224047306Smrg					     [eval $cacheid=no])])
305324047306Smrg
305424047306Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305524047306Smrg
305624047306Smrg		eval supported=\$$cacheid
305724047306Smrg		AC_MSG_RESULT([$supported])
305824047306Smrg		if test "$supported" = "yes" ; then
305924047306Smrg			$1="$$1 ]flag["
306024047306Smrg			found="yes"
306124047306Smrg		fi
306224047306Smrg	fi
306324047306Smrg])
306424047306Smrg]) # XORG_TESTSET_CFLAG
306524047306Smrg
306624047306Smrg# XORG_COMPILER_FLAGS
306724047306Smrg# ---------------
306824047306Smrg# Minimum version: 1.16.0
306924047306Smrg#
307024047306Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307124047306Smrg# arguments supported by the selected compiler which do NOT alter the generated
307224047306Smrg# code.  These arguments will cause the compiler to print various warnings
307324047306Smrg# during compilation AND turn a conservative set of warnings into errors.
307424047306Smrg#
307524047306Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307624047306Smrg# future versions of util-macros as options are added to new compilers.
307724047306Smrg#
307824047306SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307924047306SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308024047306Smrg
308124047306SmrgAC_ARG_ENABLE(selective-werror,
308224047306Smrg              AS_HELP_STRING([--disable-selective-werror],
308324047306Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308424047306Smrg              [SELECTIVE_WERROR=$enableval],
308524047306Smrg              [SELECTIVE_WERROR=yes])
308624047306Smrg
308724047306SmrgAC_LANG_CASE(
308824047306Smrg        [C], [
308924047306Smrg                define([PREFIX], [C])
309024047306Smrg        ],
309124047306Smrg        [C++], [
309224047306Smrg                define([PREFIX], [CXX])
309324047306Smrg        ]
309424047306Smrg)
309524047306Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309624047306Smrgif test "x$SUNCC" = "xyes"; then
309724047306Smrg    [BASE_]PREFIX[FLAGS]="-v"
309824047306Smrgelse
309924047306Smrg    [BASE_]PREFIX[FLAGS]=""
310024047306Smrgfi
310124047306Smrg
310224047306Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
310724047306Smrg
310824047306SmrgAC_LANG_CASE(
310924047306Smrg	[C], [
311024047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311124047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311224047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311324047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311424047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311524047306Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311624047306Smrg	]
311724047306Smrg)
311824047306Smrg
311924047306Smrg# This chunk adds additional warnings that could catch undesired effects.
312024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
312724047306Smrg
312824047306Smrg# These are currently disabled because they are noisy.  They will be enabled
312924047306Smrg# in the future once the codebase is sufficiently modernized to silence
313024047306Smrg# them.  For now, I don't want them to drown out the other warnings.
313124047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313224047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313324047306Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
313424047306Smrg
313524047306Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313624047306Smrg# when there are problems that should be fixed.
313724047306Smrg
313824047306Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315224047306Smrgelse
315324047306SmrgAC_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])
315424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315724047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315824047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315924047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316024047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316124047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316224047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316324047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316424047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316524047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316624047306SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316724047306Smrgfi
316824047306Smrg
316924047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317024047306Smrg]) # XORG_COMPILER_FLAGS
317124047306Smrg
3172bf2eeab3Smrg# XORG_CWARNFLAGS
3173bf2eeab3Smrg# ---------------
3174bf2eeab3Smrg# Minimum version: 1.2.0
317524047306Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176bf2eeab3Smrg#
3177bf2eeab3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3178bf2eeab3Smrg#
317924047306Smrg# This function is deprecated because it defines -fno-strict-aliasing
318024047306Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318124047306Smrg# is needed, then it should be added explicitly in the module when
318224047306Smrg# it is updated to use BASE_CFLAGS.
318324047306Smrg#
3184bf2eeab3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318524047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31861a054510SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318724047306SmrgAC_LANG_CASE(
318824047306Smrg	[C], [
318924047306Smrg		CWARNFLAGS="$BASE_CFLAGS"
319024047306Smrg		if  test "x$GCC" = xyes ; then
319124047306Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319224047306Smrg		fi
319324047306Smrg		AC_SUBST(CWARNFLAGS)
319424047306Smrg	]
319524047306Smrg)
3196bf2eeab3Smrg]) # XORG_CWARNFLAGS
319714c0a534Smrg
3198bf2eeab3Smrg# XORG_STRICT_OPTION
3199bf2eeab3Smrg# -----------------------
3200bf2eeab3Smrg# Minimum version: 1.3.0
320114c0a534Smrg#
32021a054510Smrg# Add configure option to enable strict compilation flags, such as treating
32031a054510Smrg# warnings as fatal errors.
32041a054510Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320524047306Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32061a054510Smrg#
32071a054510Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32081a054510Smrg# when strict compilation is unconditionally desired.
3209bf2eeab3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3210bf2eeab3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321124047306SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212bf2eeab3Smrg
3213bf2eeab3SmrgAC_ARG_ENABLE(strict-compilation,
3214bf2eeab3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3215bf2eeab3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3216bf2eeab3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321724047306Smrg
321824047306SmrgAC_LANG_CASE(
321924047306Smrg        [C], [
322024047306Smrg                define([PREFIX], [C])
322124047306Smrg        ],
322224047306Smrg        [C++], [
322324047306Smrg                define([PREFIX], [CXX])
322424047306Smrg        ]
322524047306Smrg)
322624047306Smrg
322724047306Smrg[STRICT_]PREFIX[FLAGS]=""
322824047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322924047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323024047306Smrg
323124047306Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323224047306Smrg# activate it with -Werror, so we add it here explicitly.
323324047306SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323424047306Smrg
3235bf2eeab3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323624047306Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323724047306Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3238bf2eeab3Smrgfi
323924047306SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324024047306SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324124047306SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3242bf2eeab3Smrg]) # XORG_STRICT_OPTION
324314c0a534Smrg
3244bf2eeab3Smrg# XORG_DEFAULT_OPTIONS
3245bf2eeab3Smrg# --------------------
3246bf2eeab3Smrg# Minimum version: 1.3.0
3247bf2eeab3Smrg#
3248bf2eeab3Smrg# Defines default options for X.Org modules.
3249bf2eeab3Smrg#
3250bf2eeab3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3251576bae58SmrgAC_REQUIRE([AC_PROG_INSTALL])
325224047306SmrgXORG_COMPILER_FLAGS
3253bf2eeab3SmrgXORG_CWARNFLAGS
3254bf2eeab3SmrgXORG_STRICT_OPTION
3255bf2eeab3SmrgXORG_RELEASE_VERSION
3256bf2eeab3SmrgXORG_CHANGELOG
3257576bae58SmrgXORG_INSTALL
3258bf2eeab3SmrgXORG_MANPAGE_SECTIONS
3259576bae58Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3260576bae58Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3261bf2eeab3Smrg]) # XORG_DEFAULT_OPTIONS
3262576bae58Smrg
3263576bae58Smrg# XORG_INSTALL()
3264576bae58Smrg# ----------------
3265576bae58Smrg# Minimum version: 1.4.0
3266576bae58Smrg#
3267576bae58Smrg# Defines the variable INSTALL_CMD as the command to copy
3268576bae58Smrg# INSTALL from $prefix/share/util-macros.
3269576bae58Smrg#
3270576bae58SmrgAC_DEFUN([XORG_INSTALL], [
3271576bae58SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3272576bae58Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3273576bae58SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3274576bae58Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3275bdc460c5Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3276bdc460c5Smrgtouch \$(top_srcdir)/INSTALL; \
3277bdc460c5Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3278576bae58SmrgAC_SUBST([INSTALL_CMD])
3279576bae58Smrg]) # XORG_INSTALL
3280bf2eeab3Smrgdnl Copyright 2005 Red Hat, Inc
3281bf2eeab3Smrgdnl
3282bf2eeab3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3283bf2eeab3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
3284bf2eeab3Smrgdnl the above copyright notice appear in all copies and that both that
3285bf2eeab3Smrgdnl copyright notice and this permission notice appear in supporting
3286bf2eeab3Smrgdnl documentation.
3287bf2eeab3Smrgdnl
3288bf2eeab3Smrgdnl The above copyright notice and this permission notice shall be included
3289bf2eeab3Smrgdnl in all copies or substantial portions of the Software.
3290bf2eeab3Smrgdnl
3291bf2eeab3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3292bf2eeab3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3293bf2eeab3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3294bf2eeab3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3295bf2eeab3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3296bf2eeab3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3297bf2eeab3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
3298bf2eeab3Smrgdnl
3299bf2eeab3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
3300bf2eeab3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
3301bf2eeab3Smrgdnl other dealings in this Software without prior written authorization
3302bf2eeab3Smrgdnl from the copyright holders.
3303bf2eeab3Smrgdnl
330414c0a534Smrg
3305bf2eeab3Smrg# XORG_RELEASE_VERSION
3306bf2eeab3Smrg# --------------------
3307576bae58Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
330824047306Smrg
3309bf2eeab3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
3310bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3311bf2eeab3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3312bf2eeab3Smrg		[Major version of this package])
3313bf2eeab3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3314bf2eeab3Smrg	if test "x$PVM" = "x"; then
3315bf2eeab3Smrg		PVM="0"
3316bf2eeab3Smrg	fi
3317bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3318bf2eeab3Smrg		[$PVM],
3319bf2eeab3Smrg		[Minor version of this package])
3320bf2eeab3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3321bf2eeab3Smrg	if test "x$PVP" = "x"; then
3322bf2eeab3Smrg		PVP="0"
3323bf2eeab3Smrg	fi
3324bf2eeab3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3325bf2eeab3Smrg		[$PVP],
3326bf2eeab3Smrg		[Patch version of this package])
332714c0a534Smrg])
332814c0a534Smrg
3329bf2eeab3Smrg# XORG_CHANGELOG()
3330bf2eeab3Smrg# ----------------
3331bf2eeab3Smrg# Minimum version: 1.2.0
3332bf2eeab3Smrg#
3333bf2eeab3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3334bf2eeab3Smrg# ChangeLog from git.
3335bf2eeab3Smrg#
3336bf2eeab3Smrg#
3337bf2eeab3SmrgAC_DEFUN([XORG_CHANGELOG], [
3338bdc460c5SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3339576bae58Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3340bdc460c5Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3341bdc460c5Smrgtouch \$(top_srcdir)/ChangeLog; \
3342bdc460c5Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3343bf2eeab3SmrgAC_SUBST([CHANGELOG_CMD])
3344bf2eeab3Smrg]) # XORG_CHANGELOG
334514c0a534Smrg
3346