17ed541caSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
233dddc75Smrg
37ed541caSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
472b4363aSmrg
572b4363aSmrg# This file is free software; the Free Software Foundation
672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
772b4363aSmrg# with or without modifications, as long as this notice is preserved.
872b4363aSmrg
972b4363aSmrg# This program is distributed in the hope that it will be useful,
1072b4363aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1172b4363aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1272b4363aSmrg# PARTICULAR PURPOSE.
1372b4363aSmrg
1433dddc75Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
177ed541caSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
187ed541caSmrg[m4_warning([this file was generated for autoconf 2.71.
19dd77ae96SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20dd77ae96SmrgIf you have problems, you may need to regenerate the build system entirely.
2133dddc75SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2272b4363aSmrg
237ed541caSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2472b4363aSmrg#
2572b4363aSmrg# This file is free software; the Free Software Foundation
2672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
2772b4363aSmrg# with or without modifications, as long as this notice is preserved.
2872b4363aSmrg
2972b4363aSmrg# AM_AUTOMAKE_VERSION(VERSION)
3072b4363aSmrg# ----------------------------
3172b4363aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3272b4363aSmrg# generated from the m4 files accompanying Automake X.Y.
3372b4363aSmrg# (This private macro should not be called outside this file.)
3472b4363aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
357ed541caSmrg[am__api_version='1.16'
3672b4363aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3772b4363aSmrgdnl require some minimum version.  Point them to the right macro.
387ed541caSmrgm4_if([$1], [1.16.5], [],
3972b4363aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4072b4363aSmrg])
4172b4363aSmrg
4272b4363aSmrg# _AM_AUTOCONF_VERSION(VERSION)
4372b4363aSmrg# -----------------------------
4472b4363aSmrg# aclocal traces this macro to find the Autoconf version.
4572b4363aSmrg# This is a private macro too.  Using m4_define simplifies
4672b4363aSmrg# the logic in aclocal, which can simply ignore this definition.
4772b4363aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4872b4363aSmrg
4972b4363aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5072b4363aSmrg# -------------------------------
5172b4363aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52dd77ae96Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5372b4363aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
547ed541caSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
55dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57dd77ae96Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5872b4363aSmrg
5972b4363aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6072b4363aSmrg
617ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6272b4363aSmrg#
6372b4363aSmrg# This file is free software; the Free Software Foundation
6472b4363aSmrg# gives unlimited permission to copy and/or distribute it,
6572b4363aSmrg# with or without modifications, as long as this notice is preserved.
6672b4363aSmrg
6772b4363aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6833dddc75Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6933dddc75Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7072b4363aSmrg#
7172b4363aSmrg# Of course, Automake must honor this variable whenever it calls a
7272b4363aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7372b4363aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7472b4363aSmrg# depending on how configure is run.  This is pretty annoying, since
7572b4363aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7672b4363aSmrg# source directory, any form will work fine, but in subdirectories a
7772b4363aSmrg# relative path needs to be adjusted first.
7872b4363aSmrg#
7972b4363aSmrg# $ac_aux_dir/missing
8072b4363aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8172b4363aSmrg# $top_srcdir/$ac_aux_dir/missing
8272b4363aSmrg#    fails if $ac_aux_dir is absolute,
8372b4363aSmrg#    fails when called from a subdirectory in a VPATH build with
8472b4363aSmrg#          a relative $ac_aux_dir
8572b4363aSmrg#
8672b4363aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8772b4363aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8833dddc75Smrg# harmless because $srcdir is '.', but things will broke when you
8972b4363aSmrg# start a VPATH build or use an absolute $srcdir.
9072b4363aSmrg#
9172b4363aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9272b4363aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9372b4363aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9472b4363aSmrg# and then we would define $MISSING as
9572b4363aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9672b4363aSmrg# This will work as long as MISSING is not called from configure, because
9772b4363aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9872b4363aSmrg# However there are other variables, like CC, which are often used in
9972b4363aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10072b4363aSmrg#
10172b4363aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10272b4363aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10372b4363aSmrg# configured tree to be moved without reconfiguration.
10472b4363aSmrg
10572b4363aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10633dddc75Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10733dddc75Smrg# Expand $ac_aux_dir to an absolute path.
10833dddc75Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10972b4363aSmrg])
11072b4363aSmrg
11172b4363aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11272b4363aSmrg
1137ed541caSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11472b4363aSmrg#
11572b4363aSmrg# This file is free software; the Free Software Foundation
11672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
11772b4363aSmrg# with or without modifications, as long as this notice is preserved.
11872b4363aSmrg
11972b4363aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12072b4363aSmrg# -------------------------------------
12172b4363aSmrg# Define a conditional.
12272b4363aSmrgAC_DEFUN([AM_CONDITIONAL],
12333dddc75Smrg[AC_PREREQ([2.52])dnl
12433dddc75Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12533dddc75Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12672b4363aSmrgAC_SUBST([$1_TRUE])dnl
12772b4363aSmrgAC_SUBST([$1_FALSE])dnl
12872b4363aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12972b4363aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130dd77ae96Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13172b4363aSmrgif $2; then
13272b4363aSmrg  $1_TRUE=
13372b4363aSmrg  $1_FALSE='#'
13472b4363aSmrgelse
13572b4363aSmrg  $1_TRUE='#'
13672b4363aSmrg  $1_FALSE=
13772b4363aSmrgfi
13872b4363aSmrgAC_CONFIG_COMMANDS_PRE(
13972b4363aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14072b4363aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14172b4363aSmrgUsually this means the macro was only invoked conditionally.]])
14272b4363aSmrgfi])])
14372b4363aSmrg
1447ed541caSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14572b4363aSmrg#
14672b4363aSmrg# This file is free software; the Free Software Foundation
14772b4363aSmrg# gives unlimited permission to copy and/or distribute it,
14872b4363aSmrg# with or without modifications, as long as this notice is preserved.
14972b4363aSmrg
15072b4363aSmrg
15133dddc75Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15272b4363aSmrg# written in clear, in which case automake, when reading aclocal.m4,
15372b4363aSmrg# will think it sees a *use*, and therefore will trigger all it's
15472b4363aSmrg# C support machinery.  Also note that it means that autoscan, seeing
15572b4363aSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15672b4363aSmrg
15772b4363aSmrg
15872b4363aSmrg# _AM_DEPENDENCIES(NAME)
15972b4363aSmrg# ----------------------
16072b4363aSmrg# See how the compiler implements dependency checking.
16133dddc75Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16272b4363aSmrg# We try a few techniques and use that to set a single cache variable.
16372b4363aSmrg#
16472b4363aSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16572b4363aSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16672b4363aSmrg# dependency, and given that the user is not expected to run this macro,
16772b4363aSmrg# just rely on AC_PROG_CC.
16872b4363aSmrgAC_DEFUN([_AM_DEPENDENCIES],
16972b4363aSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17072b4363aSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17172b4363aSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17272b4363aSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17372b4363aSmrg
17433dddc75Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17533dddc75Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17633dddc75Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17733dddc75Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17833dddc75Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17933dddc75Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18033dddc75Smrg                    [depcc="$$1"   am_compiler_list=])
18172b4363aSmrg
18272b4363aSmrgAC_CACHE_CHECK([dependency style of $depcc],
18372b4363aSmrg               [am_cv_$1_dependencies_compiler_type],
18472b4363aSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18572b4363aSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18672b4363aSmrg  # making bogus files that we don't know about and never remove.  For
18772b4363aSmrg  # instance it was reported that on HP-UX the gcc test will end up
18833dddc75Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18933dddc75Smrg  # in D".
19033dddc75Smrg  rm -rf conftest.dir
19172b4363aSmrg  mkdir conftest.dir
19272b4363aSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19372b4363aSmrg  # using a relative directory.
19472b4363aSmrg  cp "$am_depcomp" conftest.dir
19572b4363aSmrg  cd conftest.dir
19672b4363aSmrg  # We will build objects and dependencies in a subdirectory because
19772b4363aSmrg  # it helps to detect inapplicable dependency modes.  For instance
19872b4363aSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19972b4363aSmrg  # side effect of compilation, but ICC will put the dependencies in
20072b4363aSmrg  # the current directory while Tru64 will put them in the object
20172b4363aSmrg  # directory.
20272b4363aSmrg  mkdir sub
20372b4363aSmrg
20472b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
20572b4363aSmrg  if test "$am_compiler_list" = ""; then
20672b4363aSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20772b4363aSmrg  fi
208dd77ae96Smrg  am__universal=false
209dd77ae96Smrg  m4_case([$1], [CC],
210dd77ae96Smrg    [case " $depcc " in #(
211dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212dd77ae96Smrg     esac],
213dd77ae96Smrg    [CXX],
214dd77ae96Smrg    [case " $depcc " in #(
215dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216dd77ae96Smrg     esac])
217dd77ae96Smrg
21872b4363aSmrg  for depmode in $am_compiler_list; do
21972b4363aSmrg    # Setup a source with many dependencies, because some compilers
22072b4363aSmrg    # like to wrap large dependency lists on column 80 (with \), and
22172b4363aSmrg    # we should not choose a depcomp mode which is confused by this.
22272b4363aSmrg    #
22372b4363aSmrg    # We need to recreate these files for each test, as the compiler may
22472b4363aSmrg    # overwrite some of them when testing with obscure command lines.
22572b4363aSmrg    # This happens at least with the AIX C compiler.
22672b4363aSmrg    : > sub/conftest.c
22772b4363aSmrg    for i in 1 2 3 4 5 6; do
22872b4363aSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22933dddc75Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23033dddc75Smrg      # Solaris 10 /bin/sh.
23133dddc75Smrg      echo '/* dummy */' > sub/conftst$i.h
23272b4363aSmrg    done
23372b4363aSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23472b4363aSmrg
23533dddc75Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236dd77ae96Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23733dddc75Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23833dddc75Smrg    # versions had trouble with output in subdirs.
239dd77ae96Smrg    am__obj=sub/conftest.${OBJEXT-o}
240dd77ae96Smrg    am__minus_obj="-o $am__obj"
24172b4363aSmrg    case $depmode in
242dd77ae96Smrg    gcc)
243dd77ae96Smrg      # This depmode causes a compiler race in universal mode.
244dd77ae96Smrg      test "$am__universal" = false || continue
245dd77ae96Smrg      ;;
24672b4363aSmrg    nosideeffect)
24733dddc75Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24833dddc75Smrg      # only be used when explicitly requested.
24972b4363aSmrg      if test "x$enable_dependency_tracking" = xyes; then
25072b4363aSmrg	continue
25172b4363aSmrg      else
25272b4363aSmrg	break
25372b4363aSmrg      fi
25472b4363aSmrg      ;;
25533dddc75Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25633dddc75Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257dd77ae96Smrg      # not run yet.  These depmodes are late enough in the game, and
258dd77ae96Smrg      # so weak that their functioning should not be impacted.
259dd77ae96Smrg      am__obj=conftest.${OBJEXT-o}
260dd77ae96Smrg      am__minus_obj=
261dd77ae96Smrg      ;;
26272b4363aSmrg    none) break ;;
26372b4363aSmrg    esac
26472b4363aSmrg    if depmode=$depmode \
265dd77ae96Smrg       source=sub/conftest.c object=$am__obj \
26672b4363aSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267dd77ae96Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26872b4363aSmrg         >/dev/null 2>conftest.err &&
26972b4363aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27072b4363aSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271dd77ae96Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27272b4363aSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27372b4363aSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27472b4363aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27572b4363aSmrg      # that says an option was ignored or not supported.
27672b4363aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27772b4363aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27872b4363aSmrg      # The diagnosis changed in icc 8.0:
27972b4363aSmrg      #   icc: Command line remark: option '-MP' not supported
28072b4363aSmrg      if (grep 'ignoring option' conftest.err ||
28172b4363aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28272b4363aSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28372b4363aSmrg        break
28472b4363aSmrg      fi
28572b4363aSmrg    fi
28672b4363aSmrg  done
28772b4363aSmrg
28872b4363aSmrg  cd ..
28972b4363aSmrg  rm -rf conftest.dir
29072b4363aSmrgelse
29172b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
29272b4363aSmrgfi
29372b4363aSmrg])
29472b4363aSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29572b4363aSmrgAM_CONDITIONAL([am__fastdep$1], [
29672b4363aSmrg  test "x$enable_dependency_tracking" != xno \
29772b4363aSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29872b4363aSmrg])
29972b4363aSmrg
30072b4363aSmrg
30172b4363aSmrg# AM_SET_DEPDIR
30272b4363aSmrg# -------------
30372b4363aSmrg# Choose a directory name for dependency files.
30433dddc75Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30572b4363aSmrgAC_DEFUN([AM_SET_DEPDIR],
30672b4363aSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30772b4363aSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30872b4363aSmrg])
30972b4363aSmrg
31072b4363aSmrg
31172b4363aSmrg# AM_DEP_TRACK
31272b4363aSmrg# ------------
31372b4363aSmrgAC_DEFUN([AM_DEP_TRACK],
31433dddc75Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31533dddc75SmrgAS_HELP_STRING(
31633dddc75Smrg  [--enable-dependency-tracking],
31733dddc75Smrg  [do not reject slow dependency extractors])
31833dddc75SmrgAS_HELP_STRING(
31933dddc75Smrg  [--disable-dependency-tracking],
32033dddc75Smrg  [speeds up one-time build])])
32172b4363aSmrgif test "x$enable_dependency_tracking" != xno; then
32272b4363aSmrg  am_depcomp="$ac_aux_dir/depcomp"
32372b4363aSmrg  AMDEPBACKSLASH='\'
32433dddc75Smrg  am__nodep='_no'
32572b4363aSmrgfi
32672b4363aSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32772b4363aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32872b4363aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32933dddc75SmrgAC_SUBST([am__nodep])dnl
33033dddc75Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33172b4363aSmrg])
33272b4363aSmrg
33372b4363aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33472b4363aSmrg
3357ed541caSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33672b4363aSmrg#
33772b4363aSmrg# This file is free software; the Free Software Foundation
33872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
33972b4363aSmrg# with or without modifications, as long as this notice is preserved.
34072b4363aSmrg
34172b4363aSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34272b4363aSmrg# ------------------------------
34372b4363aSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344dd77ae96Smrg[{
34533dddc75Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
346dd77ae96Smrg  # are listed without --file.  Let's play safe and only enable the eval
347dd77ae96Smrg  # if we detect the quoting.
3487ed541caSmrg  # TODO: see whether this extra hack can be removed once we start
3497ed541caSmrg  # requiring Autoconf 2.70 or later.
3507ed541caSmrg  AS_CASE([$CONFIG_FILES],
3517ed541caSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
3527ed541caSmrg          [*], [set x $CONFIG_FILES])
353dd77ae96Smrg  shift
3547ed541caSmrg  # Used to flag and report bootstrapping failures.
3557ed541caSmrg  am_rc=0
3567ed541caSmrg  for am_mf
357dd77ae96Smrg  do
358dd77ae96Smrg    # Strip MF so we end up with the name of the file.
3597ed541caSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3607ed541caSmrg    # Check whether this is an Automake generated Makefile which includes
3617ed541caSmrg    # dependency-tracking related rules and includes.
3627ed541caSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
363dd77ae96Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3647ed541caSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3657ed541caSmrg      || continue
3667ed541caSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3677ed541caSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3687ed541caSmrg    AM_RUN_LOG([cd "$am_dirpart" \
3697ed541caSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3707ed541caSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37172b4363aSmrg  done
3727ed541caSmrg  if test $am_rc -ne 0; then
3737ed541caSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3747ed541caSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3757ed541caSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3767ed541caSmrg    necessary).  You can also try re-running configure with the
3777ed541caSmrg    '--disable-dependency-tracking' option to at least be able to build
3787ed541caSmrg    the package (albeit without support for automatic dependency tracking).])
3797ed541caSmrg  fi
3807ed541caSmrg  AS_UNSET([am_dirpart])
3817ed541caSmrg  AS_UNSET([am_filepart])
3827ed541caSmrg  AS_UNSET([am_mf])
3837ed541caSmrg  AS_UNSET([am_rc])
3847ed541caSmrg  rm -f conftest-deps.mk
385dd77ae96Smrg}
38672b4363aSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38772b4363aSmrg
38872b4363aSmrg
38972b4363aSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39072b4363aSmrg# -----------------------------
39172b4363aSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39272b4363aSmrg#
3937ed541caSmrg# This code is only required when automatic dependency tracking is enabled.
3947ed541caSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3957ed541caSmrg# order to bootstrap the dependency handling code.
39672b4363aSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39772b4363aSmrg[AC_CONFIG_COMMANDS([depfiles],
39872b4363aSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3997ed541caSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40072b4363aSmrg
40172b4363aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
40272b4363aSmrg
4037ed541caSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40472b4363aSmrg#
40572b4363aSmrg# This file is free software; the Free Software Foundation
40672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
40772b4363aSmrg# with or without modifications, as long as this notice is preserved.
40872b4363aSmrg
40972b4363aSmrg# This macro actually does too much.  Some checks are only needed if
41072b4363aSmrg# your package does certain things.  But this isn't really a big deal.
41172b4363aSmrg
41233dddc75Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41333dddc75Smrgm4_define([AC_PROG_CC],
41433dddc75Smrgm4_defn([AC_PROG_CC])
41533dddc75Smrg[_AM_PROG_CC_C_O
41633dddc75Smrg])
41733dddc75Smrg
41872b4363aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41972b4363aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42072b4363aSmrg# -----------------------------------------------
42172b4363aSmrg# The call with PACKAGE and VERSION arguments is the old style
42272b4363aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42372b4363aSmrg# and VERSION should now be passed to AC_INIT and removed from
42472b4363aSmrg# the call to AM_INIT_AUTOMAKE.
42572b4363aSmrg# We support both call styles for the transition.  After
42672b4363aSmrg# the next Automake release, Autoconf can make the AC_INIT
42772b4363aSmrg# arguments mandatory, and then we can depend on a new Autoconf
42872b4363aSmrg# release and drop the old call support.
42972b4363aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43033dddc75Smrg[AC_PREREQ([2.65])dnl
4317ed541caSmrgm4_ifdef([_$0_ALREADY_INIT],
4327ed541caSmrg  [m4_fatal([$0 expanded multiple times
4337ed541caSmrg]m4_defn([_$0_ALREADY_INIT]))],
4347ed541caSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43572b4363aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43672b4363aSmrgdnl the ones we care about.
43772b4363aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43872b4363aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43972b4363aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44072b4363aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44172b4363aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44272b4363aSmrg  # is not polluted with repeated "-I."
44372b4363aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44472b4363aSmrg  # test to see if srcdir already configured
44572b4363aSmrg  if test -f $srcdir/config.status; then
44672b4363aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44772b4363aSmrg  fi
44872b4363aSmrgfi
44972b4363aSmrg
45072b4363aSmrg# test whether we have cygpath
45172b4363aSmrgif test -z "$CYGPATH_W"; then
45272b4363aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45372b4363aSmrg    CYGPATH_W='cygpath -w'
45472b4363aSmrg  else
45572b4363aSmrg    CYGPATH_W=echo
45672b4363aSmrg  fi
45772b4363aSmrgfi
45872b4363aSmrgAC_SUBST([CYGPATH_W])
45972b4363aSmrg
46072b4363aSmrg# Define the identity of the package.
46172b4363aSmrgdnl Distinguish between old-style and new-style calls.
46272b4363aSmrgm4_ifval([$2],
46333dddc75Smrg[AC_DIAGNOSE([obsolete],
46433dddc75Smrg             [$0: two- and three-arguments forms are deprecated.])
46533dddc75Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46672b4363aSmrg AC_SUBST([PACKAGE], [$1])dnl
46772b4363aSmrg AC_SUBST([VERSION], [$2])],
46872b4363aSmrg[_AM_SET_OPTIONS([$1])dnl
46972b4363aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47033dddc75Smrgm4_if(
4717ed541caSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47233dddc75Smrg  [ok:ok],,
47372b4363aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47472b4363aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47572b4363aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47672b4363aSmrg
47772b4363aSmrg_AM_IF_OPTION([no-define],,
47833dddc75Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47933dddc75Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48072b4363aSmrg
48172b4363aSmrg# Some tools Automake needs.
48272b4363aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48372b4363aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48433dddc75SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48533dddc75SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48633dddc75SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48733dddc75SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48833dddc75SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
489dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
490dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49133dddc75SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49233dddc75Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49333dddc75Smrg# dies out for good.  For more background, see:
4947ed541caSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4957ed541caSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49633dddc75SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49733dddc75Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49833dddc75Smrg# system "awk" is bad on some platforms.
49972b4363aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50072b4363aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50172b4363aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50272b4363aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
503dd77ae96Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
504dd77ae96Smrg			     [_AM_PROG_TAR([v7])])])
50572b4363aSmrg_AM_IF_OPTION([no-dependencies],,
50672b4363aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50733dddc75Smrg		  [_AM_DEPENDENCIES([CC])],
50833dddc75Smrg		  [m4_define([AC_PROG_CC],
50933dddc75Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51072b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51133dddc75Smrg		  [_AM_DEPENDENCIES([CXX])],
51233dddc75Smrg		  [m4_define([AC_PROG_CXX],
51333dddc75Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51472b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51533dddc75Smrg		  [_AM_DEPENDENCIES([OBJC])],
51633dddc75Smrg		  [m4_define([AC_PROG_OBJC],
51733dddc75Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51833dddc75SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51933dddc75Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52033dddc75Smrg		  [m4_define([AC_PROG_OBJCXX],
52133dddc75Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52272b4363aSmrg])
5237ed541caSmrg# Variables for tags utilities; see am/tags.am
5247ed541caSmrgif test -z "$CTAGS"; then
5257ed541caSmrg  CTAGS=ctags
5267ed541caSmrgfi
5277ed541caSmrgAC_SUBST([CTAGS])
5287ed541caSmrgif test -z "$ETAGS"; then
5297ed541caSmrg  ETAGS=etags
5307ed541caSmrgfi
5317ed541caSmrgAC_SUBST([ETAGS])
5327ed541caSmrgif test -z "$CSCOPE"; then
5337ed541caSmrg  CSCOPE=cscope
5347ed541caSmrgfi
5357ed541caSmrgAC_SUBST([CSCOPE])
5367ed541caSmrg
53733dddc75SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53833dddc75Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53933dddc75Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54033dddc75Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
541dd77ae96SmrgAC_CONFIG_COMMANDS_PRE(dnl
542dd77ae96Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
543dd77ae96Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54433dddc75Smrg
54533dddc75Smrg# POSIX will say in a future version that running "rm -f" with no argument
54633dddc75Smrg# is OK; and we want to be able to make that assumption in our Makefile
54733dddc75Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54833dddc75Smrg# actually supported "in the wild" to an acceptable degree.
54933dddc75Smrg# See automake bug#10828.
55033dddc75Smrg# To make any issue more visible, cause the running configure to be aborted
55133dddc75Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55233dddc75Smrg# user can still override this though.
55333dddc75Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55433dddc75Smrg  cat >&2 <<'END'
55533dddc75SmrgOops!
55633dddc75Smrg
55733dddc75SmrgYour 'rm' program seems unable to run without file operands specified
55833dddc75Smrgon the command line, even when the '-f' option is present.  This is contrary
55933dddc75Smrgto the behaviour of most rm programs out there, and not conforming with
56033dddc75Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56133dddc75Smrg
56233dddc75SmrgPlease tell bug-automake@gnu.org about your system, including the value
56333dddc75Smrgof your $PATH and any error possibly output before this message.  This
56433dddc75Smrgcan help us improve future automake versions.
56533dddc75Smrg
56633dddc75SmrgEND
56733dddc75Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56833dddc75Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56933dddc75Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57033dddc75Smrg    echo >&2
57133dddc75Smrg  else
57233dddc75Smrg    cat >&2 <<'END'
57333dddc75SmrgAborting the configuration process, to ensure you take notice of the issue.
57433dddc75Smrg
57533dddc75SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5767ed541caSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57733dddc75Smrg
57833dddc75SmrgIf you want to complete the configuration process using your problematic
57933dddc75Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58033dddc75Smrgto "yes", and re-run configure.
58133dddc75Smrg
58233dddc75SmrgEND
58333dddc75Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58433dddc75Smrg  fi
58533dddc75Smrgfi
58633dddc75Smrgdnl The trailing newline in this macro's definition is deliberate, for
58733dddc75Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58833dddc75Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58972b4363aSmrg])
59072b4363aSmrg
59133dddc75Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
592dd77ae96Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
593dd77ae96Smrgdnl mangled by Autoconf and run in a shell conditional statement.
594dd77ae96Smrgm4_define([_AC_COMPILER_EXEEXT],
595dd77ae96Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596dd77ae96Smrg
59772b4363aSmrg# When config.status generates a header, we must update the stamp-h file.
59872b4363aSmrg# This file resides in the same directory as the config header
59972b4363aSmrg# that is generated.  The stamp files are numbered to have different names.
60072b4363aSmrg
60172b4363aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60272b4363aSmrg# loop where config.status creates the headers, so we can generate
60372b4363aSmrg# our stamp files there.
60472b4363aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60572b4363aSmrg[# Compute $1's index in $config_headers.
606dd77ae96Smrg_am_arg=$1
60772b4363aSmrg_am_stamp_count=1
60872b4363aSmrgfor _am_header in $config_headers :; do
60972b4363aSmrg  case $_am_header in
610dd77ae96Smrg    $_am_arg | $_am_arg:* )
61172b4363aSmrg      break ;;
61272b4363aSmrg    * )
61372b4363aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61472b4363aSmrg  esac
61572b4363aSmrgdone
616dd77ae96Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61772b4363aSmrg
6187ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61972b4363aSmrg#
62072b4363aSmrg# This file is free software; the Free Software Foundation
62172b4363aSmrg# gives unlimited permission to copy and/or distribute it,
62272b4363aSmrg# with or without modifications, as long as this notice is preserved.
62372b4363aSmrg
62472b4363aSmrg# AM_PROG_INSTALL_SH
62572b4363aSmrg# ------------------
62672b4363aSmrg# Define $install_sh.
62772b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62872b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62933dddc75Smrgif test x"${install_sh+set}" != xset; then
630dd77ae96Smrg  case $am_aux_dir in
631dd77ae96Smrg  *\ * | *\	*)
632dd77ae96Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
633dd77ae96Smrg  *)
634dd77ae96Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
635dd77ae96Smrg  esac
636dd77ae96Smrgfi
63733dddc75SmrgAC_SUBST([install_sh])])
63872b4363aSmrg
6397ed541caSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64072b4363aSmrg#
64172b4363aSmrg# This file is free software; the Free Software Foundation
64272b4363aSmrg# gives unlimited permission to copy and/or distribute it,
64372b4363aSmrg# with or without modifications, as long as this notice is preserved.
64472b4363aSmrg
64572b4363aSmrg# Check whether the underlying file-system supports filenames
64672b4363aSmrg# with a leading dot.  For instance MS-DOS doesn't.
64772b4363aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64872b4363aSmrg[rm -rf .tst 2>/dev/null
64972b4363aSmrgmkdir .tst 2>/dev/null
65072b4363aSmrgif test -d .tst; then
65172b4363aSmrg  am__leading_dot=.
65272b4363aSmrgelse
65372b4363aSmrg  am__leading_dot=_
65472b4363aSmrgfi
65572b4363aSmrgrmdir .tst 2>/dev/null
65672b4363aSmrgAC_SUBST([am__leading_dot])])
65772b4363aSmrg
65872b4363aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65972b4363aSmrg
6607ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66172b4363aSmrg#
66272b4363aSmrg# This file is free software; the Free Software Foundation
66372b4363aSmrg# gives unlimited permission to copy and/or distribute it,
66472b4363aSmrg# with or without modifications, as long as this notice is preserved.
66572b4363aSmrg
66672b4363aSmrg# AM_MAKE_INCLUDE()
66772b4363aSmrg# -----------------
6687ed541caSmrg# Check whether make has an 'include' directive that can support all
6697ed541caSmrg# the idioms we need for our automatic dependency tracking code.
67072b4363aSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6717ed541caSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6727ed541caSmrgcat > confinc.mk << 'END'
67372b4363aSmrgam__doit:
6747ed541caSmrg	@echo this is the am__doit target >confinc.out
67572b4363aSmrg.PHONY: am__doit
67672b4363aSmrgEND
67772b4363aSmrgam__include="#"
67872b4363aSmrgam__quote=
6797ed541caSmrg# BSD make does it like this.
6807ed541caSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6817ed541caSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6827ed541caSmrgecho 'include confinc.mk # ignored' > confmf.GNU
6837ed541caSmrg_am_result=no
6847ed541caSmrgfor s in GNU BSD; do
6857ed541caSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6867ed541caSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6877ed541caSmrg      ['0:this is the am__doit target'],
6887ed541caSmrg      [AS_CASE([$s],
6897ed541caSmrg          [BSD], [am__include='.include' am__quote='"'],
6907ed541caSmrg          [am__include='include' am__quote=''])])
6917ed541caSmrg  if test "$am__include" != "#"; then
6927ed541caSmrg    _am_result="yes ($s style)"
6937ed541caSmrg    break
6947ed541caSmrg  fi
6957ed541caSmrgdone
6967ed541caSmrgrm -f confinc.* confmf.*
6977ed541caSmrgAC_MSG_RESULT([${_am_result}])
6987ed541caSmrgAC_SUBST([am__include])])
6997ed541caSmrgAC_SUBST([am__quote])])
70072b4363aSmrg
70172b4363aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70272b4363aSmrg
7037ed541caSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70472b4363aSmrg#
70572b4363aSmrg# This file is free software; the Free Software Foundation
70672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
70772b4363aSmrg# with or without modifications, as long as this notice is preserved.
70872b4363aSmrg
70972b4363aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
71072b4363aSmrg# ------------------------------
71172b4363aSmrgAC_DEFUN([AM_MISSING_PROG],
71272b4363aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71372b4363aSmrg$1=${$1-"${am_missing_run}$2"}
71472b4363aSmrgAC_SUBST($1)])
71572b4363aSmrg
71672b4363aSmrg# AM_MISSING_HAS_RUN
71772b4363aSmrg# ------------------
71833dddc75Smrg# Define MISSING if not defined so far and test if it is modern enough.
71933dddc75Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72072b4363aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72172b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72272b4363aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
723dd77ae96Smrgif test x"${MISSING+set}" != xset; then
7247ed541caSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725dd77ae96Smrgfi
72672b4363aSmrg# Use eval to expand $SHELL
72733dddc75Smrgif eval "$MISSING --is-lightweight"; then
72833dddc75Smrg  am_missing_run="$MISSING "
72972b4363aSmrgelse
73072b4363aSmrg  am_missing_run=
73133dddc75Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73272b4363aSmrgfi
73372b4363aSmrg])
73472b4363aSmrg
73572b4363aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73672b4363aSmrg
7377ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73872b4363aSmrg#
73972b4363aSmrg# This file is free software; the Free Software Foundation
74072b4363aSmrg# gives unlimited permission to copy and/or distribute it,
74172b4363aSmrg# with or without modifications, as long as this notice is preserved.
74272b4363aSmrg
74372b4363aSmrg# _AM_MANGLE_OPTION(NAME)
74472b4363aSmrg# -----------------------
74572b4363aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74672b4363aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74772b4363aSmrg
74872b4363aSmrg# _AM_SET_OPTION(NAME)
74933dddc75Smrg# --------------------
75072b4363aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75172b4363aSmrgAC_DEFUN([_AM_SET_OPTION],
75233dddc75Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75372b4363aSmrg
75472b4363aSmrg# _AM_SET_OPTIONS(OPTIONS)
75533dddc75Smrg# ------------------------
75672b4363aSmrg# OPTIONS is a space-separated list of Automake options.
75772b4363aSmrgAC_DEFUN([_AM_SET_OPTIONS],
758dd77ae96Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75972b4363aSmrg
76072b4363aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76172b4363aSmrg# -------------------------------------------
76272b4363aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76372b4363aSmrgAC_DEFUN([_AM_IF_OPTION],
76472b4363aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76572b4363aSmrg
7667ed541caSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76733dddc75Smrg#
76833dddc75Smrg# This file is free software; the Free Software Foundation
76933dddc75Smrg# gives unlimited permission to copy and/or distribute it,
77033dddc75Smrg# with or without modifications, as long as this notice is preserved.
77172b4363aSmrg
77233dddc75Smrg# _AM_PROG_CC_C_O
77333dddc75Smrg# ---------------
77433dddc75Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77533dddc75Smrg# to automatically call this.
77633dddc75SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77733dddc75Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77833dddc75SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77933dddc75SmrgAC_LANG_PUSH([C])dnl
78033dddc75SmrgAC_CACHE_CHECK(
78133dddc75Smrg  [whether $CC understands -c and -o together],
78233dddc75Smrg  [am_cv_prog_cc_c_o],
78333dddc75Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78433dddc75Smrg  # Make sure it works both with $CC and with simple cc.
78533dddc75Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78633dddc75Smrg  # compilers refuse to overwrite an existing .o file with -o,
78733dddc75Smrg  # though they will create one.
78833dddc75Smrg  am_cv_prog_cc_c_o=yes
78933dddc75Smrg  for am_i in 1 2; do
79033dddc75Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79133dddc75Smrg         && test -f conftest2.$ac_objext; then
79233dddc75Smrg      : OK
79333dddc75Smrg    else
79433dddc75Smrg      am_cv_prog_cc_c_o=no
79533dddc75Smrg      break
79633dddc75Smrg    fi
79733dddc75Smrg  done
79833dddc75Smrg  rm -f core conftest*
79933dddc75Smrg  unset am_i])
80033dddc75Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80133dddc75Smrg   # Losing compiler, so override with the script.
80233dddc75Smrg   # FIXME: It is wrong to rewrite CC.
80333dddc75Smrg   # But if we don't then we get into trouble of one sort or another.
80433dddc75Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80533dddc75Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80633dddc75Smrg   CC="$am_aux_dir/compile $CC"
80733dddc75Smrgfi
80833dddc75SmrgAC_LANG_POP([C])])
80933dddc75Smrg
81033dddc75Smrg# For backward compatibility.
81133dddc75SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81233dddc75Smrg
8137ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81472b4363aSmrg#
81572b4363aSmrg# This file is free software; the Free Software Foundation
81672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
81772b4363aSmrg# with or without modifications, as long as this notice is preserved.
81872b4363aSmrg
81933dddc75Smrg# AM_RUN_LOG(COMMAND)
82033dddc75Smrg# -------------------
82133dddc75Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82233dddc75Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82333dddc75SmrgAC_DEFUN([AM_RUN_LOG],
82433dddc75Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82533dddc75Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82633dddc75Smrg   ac_status=$?
82733dddc75Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82833dddc75Smrg   (exit $ac_status); }])
82933dddc75Smrg
83033dddc75Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83133dddc75Smrg
8327ed541caSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83333dddc75Smrg#
83433dddc75Smrg# This file is free software; the Free Software Foundation
83533dddc75Smrg# gives unlimited permission to copy and/or distribute it,
83633dddc75Smrg# with or without modifications, as long as this notice is preserved.
83772b4363aSmrg
83872b4363aSmrg# AM_SANITY_CHECK
83972b4363aSmrg# ---------------
84072b4363aSmrgAC_DEFUN([AM_SANITY_CHECK],
84172b4363aSmrg[AC_MSG_CHECKING([whether build environment is sane])
842dd77ae96Smrg# Reject unsafe characters in $srcdir or the absolute working directory
843dd77ae96Smrg# name.  Accept space and tab only in the latter.
844dd77ae96Smrgam_lf='
845dd77ae96Smrg'
846dd77ae96Smrgcase `pwd` in
847dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
848dd77ae96Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
849dd77ae96Smrgesac
850dd77ae96Smrgcase $srcdir in
851dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85233dddc75Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
853dd77ae96Smrgesac
854dd77ae96Smrg
85533dddc75Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85672b4363aSmrg# arguments.  Must try -L first in case configure is actually a
85772b4363aSmrg# symlink; some systems play weird games with the mod time of symlinks
85872b4363aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85972b4363aSmrg# directory).
86072b4363aSmrgif (
86133dddc75Smrg   am_has_slept=no
86233dddc75Smrg   for am_try in 1 2; do
86333dddc75Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86433dddc75Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86533dddc75Smrg     if test "$[*]" = "X"; then
86633dddc75Smrg	# -L didn't work.
86733dddc75Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86833dddc75Smrg     fi
86933dddc75Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87033dddc75Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87133dddc75Smrg
87233dddc75Smrg	# If neither matched, then we have a broken ls.  This can happen
87333dddc75Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87433dddc75Smrg	# broken ls alias from the environment.  This has actually
87533dddc75Smrg	# happened.  Such a system could not be considered "sane".
87633dddc75Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87733dddc75Smrg  alias in your environment])
87833dddc75Smrg     fi
87933dddc75Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88033dddc75Smrg       break
88133dddc75Smrg     fi
88233dddc75Smrg     # Just in case.
88333dddc75Smrg     sleep 1
88433dddc75Smrg     am_has_slept=yes
88533dddc75Smrg   done
88672b4363aSmrg   test "$[2]" = conftest.file
88772b4363aSmrg   )
88872b4363aSmrgthen
88972b4363aSmrg   # Ok.
89072b4363aSmrg   :
89172b4363aSmrgelse
89272b4363aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89372b4363aSmrgCheck your system clock])
89472b4363aSmrgfi
89533dddc75SmrgAC_MSG_RESULT([yes])
89633dddc75Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89733dddc75Smrg# generated files are strictly newer.
89833dddc75Smrgam_sleep_pid=
89933dddc75Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90033dddc75Smrg  ( sleep 1 ) &
90133dddc75Smrg  am_sleep_pid=$!
90233dddc75Smrgfi
90333dddc75SmrgAC_CONFIG_COMMANDS_PRE(
90433dddc75Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90533dddc75Smrg   if test -n "$am_sleep_pid"; then
90633dddc75Smrg     # Hide warnings about reused PIDs.
90733dddc75Smrg     wait $am_sleep_pid 2>/dev/null
90833dddc75Smrg   fi
90933dddc75Smrg   AC_MSG_RESULT([done])])
91033dddc75Smrgrm -f conftest.file
91133dddc75Smrg])
91272b4363aSmrg
9137ed541caSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914dd77ae96Smrg#
915dd77ae96Smrg# This file is free software; the Free Software Foundation
916dd77ae96Smrg# gives unlimited permission to copy and/or distribute it,
917dd77ae96Smrg# with or without modifications, as long as this notice is preserved.
918dd77ae96Smrg
919dd77ae96Smrg# AM_SILENT_RULES([DEFAULT])
920dd77ae96Smrg# --------------------------
921dd77ae96Smrg# Enable less verbose build rules; with the default set to DEFAULT
92233dddc75Smrg# ("yes" being less verbose, "no" or empty being verbose).
923dd77ae96SmrgAC_DEFUN([AM_SILENT_RULES],
92433dddc75Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92533dddc75SmrgAS_HELP_STRING(
92633dddc75Smrg  [--enable-silent-rules],
92733dddc75Smrg  [less verbose build output (undo: "make V=1")])
92833dddc75SmrgAS_HELP_STRING(
92933dddc75Smrg  [--disable-silent-rules],
93033dddc75Smrg  [verbose build output (undo: "make V=0")])dnl
93133dddc75Smrg])
93233dddc75Smrgcase $enable_silent_rules in @%:@ (((
93333dddc75Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93433dddc75Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93533dddc75Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
936dd77ae96Smrgesac
93733dddc75Smrgdnl
93833dddc75Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93933dddc75Smrgdnl do not support nested variable expansions.
94033dddc75Smrgdnl See automake bug#9928 and bug#10237.
94133dddc75Smrgam_make=${MAKE-make}
94233dddc75SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94333dddc75Smrg   [am_cv_make_support_nested_variables],
94433dddc75Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94533dddc75SmrgBAR0=false
94633dddc75SmrgBAR1=true
94733dddc75SmrgV=1
94833dddc75Smrgam__doit:
94933dddc75Smrg	@$(TRUE)
95033dddc75Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95133dddc75Smrg  am_cv_make_support_nested_variables=yes
95233dddc75Smrgelse
95333dddc75Smrg  am_cv_make_support_nested_variables=no
95433dddc75Smrgfi])
95533dddc75Smrgif test $am_cv_make_support_nested_variables = yes; then
95633dddc75Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95733dddc75Smrg  AM_V='$(V)'
95833dddc75Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95933dddc75Smrgelse
96033dddc75Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96133dddc75Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96233dddc75Smrgfi
96333dddc75SmrgAC_SUBST([AM_V])dnl
96433dddc75SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96533dddc75SmrgAC_SUBST([AM_DEFAULT_V])dnl
96633dddc75SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
967dd77ae96SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
968dd77ae96SmrgAM_BACKSLASH='\'
969dd77ae96SmrgAC_SUBST([AM_BACKSLASH])dnl
970dd77ae96Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971dd77ae96Smrg])
972dd77ae96Smrg
9737ed541caSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97472b4363aSmrg#
97572b4363aSmrg# This file is free software; the Free Software Foundation
97672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
97772b4363aSmrg# with or without modifications, as long as this notice is preserved.
97872b4363aSmrg
97972b4363aSmrg# AM_PROG_INSTALL_STRIP
98072b4363aSmrg# ---------------------
98133dddc75Smrg# One issue with vendor 'install' (even GNU) is that you can't
98272b4363aSmrg# specify the program used to strip binaries.  This is especially
98372b4363aSmrg# annoying in cross-compiling environments, where the build's strip
98472b4363aSmrg# is unlikely to handle the host's binaries.
98572b4363aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98633dddc75Smrg# always use install-sh in "make install-strip", and initialize
98772b4363aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98872b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98972b4363aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99033dddc75Smrg# Installed binaries are usually stripped using 'strip' when the user
99133dddc75Smrg# run "make install-strip".  However 'strip' might not be the right
99272b4363aSmrg# tool to use in cross-compilation environments, therefore Automake
99333dddc75Smrg# will honor the 'STRIP' environment variable to overrule this program.
99433dddc75Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99572b4363aSmrgif test "$cross_compiling" != no; then
99672b4363aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99772b4363aSmrgfi
99872b4363aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99972b4363aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100072b4363aSmrg
10017ed541caSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100272b4363aSmrg#
100372b4363aSmrg# This file is free software; the Free Software Foundation
100472b4363aSmrg# gives unlimited permission to copy and/or distribute it,
100572b4363aSmrg# with or without modifications, as long as this notice is preserved.
100672b4363aSmrg
100772b4363aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
100872b4363aSmrg# ---------------------------
1009dd77ae96Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101072b4363aSmrg# This macro is traced by Automake.
101172b4363aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101272b4363aSmrg
1013dd77ae96Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101433dddc75Smrg# --------------------------
1015dd77ae96Smrg# Public sister of _AM_SUBST_NOTMAKE.
1016dd77ae96SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017dd77ae96Smrg
101872b4363aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101972b4363aSmrg
10207ed541caSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102172b4363aSmrg#
102272b4363aSmrg# This file is free software; the Free Software Foundation
102372b4363aSmrg# gives unlimited permission to copy and/or distribute it,
102472b4363aSmrg# with or without modifications, as long as this notice is preserved.
102572b4363aSmrg
102672b4363aSmrg# _AM_PROG_TAR(FORMAT)
102772b4363aSmrg# --------------------
102872b4363aSmrg# Check how to create a tarball in format FORMAT.
102933dddc75Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103072b4363aSmrg#
103172b4363aSmrg# Substitute a variable $(am__tar) that is a command
103272b4363aSmrg# writing to stdout a FORMAT-tarball containing the directory
103372b4363aSmrg# $tardir.
103472b4363aSmrg#     tardir=directory && $(am__tar) > result.tar
103572b4363aSmrg#
103672b4363aSmrg# Substitute a variable $(am__untar) that extract such
103772b4363aSmrg# a tarball read from stdin.
103872b4363aSmrg#     $(am__untar) < result.tar
103933dddc75Smrg#
104072b4363aSmrgAC_DEFUN([_AM_PROG_TAR],
104133dddc75Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104233dddc75Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104333dddc75SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104433dddc75Smrg
104533dddc75Smrg# We'll loop over all known methods to create a tar archive until one works.
104672b4363aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104772b4363aSmrg
104833dddc75Smrgm4_if([$1], [v7],
104933dddc75Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105033dddc75Smrg
105133dddc75Smrg  [m4_case([$1],
105233dddc75Smrg    [ustar],
105333dddc75Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105433dddc75Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105533dddc75Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105633dddc75Smrg      # and bug#13588).
105733dddc75Smrg      am_max_uid=2097151 # 2^21 - 1
105833dddc75Smrg      am_max_gid=$am_max_uid
105933dddc75Smrg      # The $UID and $GID variables are not portable, so we need to resort
106033dddc75Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106133dddc75Smrg      # below are definitely unexpected, so allow the users to see them
106233dddc75Smrg      # (that is, avoid stderr redirection).
106333dddc75Smrg      am_uid=`id -u || echo unknown`
106433dddc75Smrg      am_gid=`id -g || echo unknown`
106533dddc75Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106633dddc75Smrg      if test $am_uid -le $am_max_uid; then
106733dddc75Smrg         AC_MSG_RESULT([yes])
106833dddc75Smrg      else
106933dddc75Smrg         AC_MSG_RESULT([no])
107033dddc75Smrg         _am_tools=none
107133dddc75Smrg      fi
107233dddc75Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107333dddc75Smrg      if test $am_gid -le $am_max_gid; then
107433dddc75Smrg         AC_MSG_RESULT([yes])
107533dddc75Smrg      else
107633dddc75Smrg        AC_MSG_RESULT([no])
107733dddc75Smrg        _am_tools=none
107833dddc75Smrg      fi],
107933dddc75Smrg
108033dddc75Smrg  [pax],
108133dddc75Smrg    [],
108233dddc75Smrg
108333dddc75Smrg  [m4_fatal([Unknown tar format])])
108433dddc75Smrg
108533dddc75Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108633dddc75Smrg
108733dddc75Smrg  # Go ahead even if we have the value already cached.  We do so because we
108833dddc75Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108933dddc75Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109033dddc75Smrg
109133dddc75Smrg  for _am_tool in $_am_tools; do
109233dddc75Smrg    case $_am_tool in
109333dddc75Smrg    gnutar)
109433dddc75Smrg      for _am_tar in tar gnutar gtar; do
109533dddc75Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109633dddc75Smrg      done
109733dddc75Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109833dddc75Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109933dddc75Smrg      am__untar="$_am_tar -xf -"
110033dddc75Smrg      ;;
110133dddc75Smrg    plaintar)
110233dddc75Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110333dddc75Smrg      # ustar tarball either.
110433dddc75Smrg      (tar --version) >/dev/null 2>&1 && continue
110533dddc75Smrg      am__tar='tar chf - "$$tardir"'
110633dddc75Smrg      am__tar_='tar chf - "$tardir"'
110733dddc75Smrg      am__untar='tar xf -'
110833dddc75Smrg      ;;
110933dddc75Smrg    pax)
111033dddc75Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111133dddc75Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111233dddc75Smrg      am__untar='pax -r'
111333dddc75Smrg      ;;
111433dddc75Smrg    cpio)
111533dddc75Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111633dddc75Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111733dddc75Smrg      am__untar='cpio -i -H $1 -d'
111833dddc75Smrg      ;;
111933dddc75Smrg    none)
112033dddc75Smrg      am__tar=false
112133dddc75Smrg      am__tar_=false
112233dddc75Smrg      am__untar=false
112333dddc75Smrg      ;;
112433dddc75Smrg    esac
112572b4363aSmrg
112633dddc75Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112733dddc75Smrg    # and am__untar set.
112833dddc75Smrg    test -n "${am_cv_prog_tar_$1}" && break
112933dddc75Smrg
113033dddc75Smrg    # tar/untar a dummy directory, and stop if the command works.
113133dddc75Smrg    rm -rf conftest.dir
113233dddc75Smrg    mkdir conftest.dir
113333dddc75Smrg    echo GrepMe > conftest.dir/file
113433dddc75Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113533dddc75Smrg    rm -rf conftest.dir
113633dddc75Smrg    if test -s conftest.tar; then
113733dddc75Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113833dddc75Smrg      AM_RUN_LOG([cat conftest.dir/file])
113933dddc75Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114033dddc75Smrg    fi
114133dddc75Smrg  done
114272b4363aSmrg  rm -rf conftest.dir
114372b4363aSmrg
114433dddc75Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114533dddc75Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114633dddc75Smrg
114772b4363aSmrgAC_SUBST([am__tar])
114872b4363aSmrgAC_SUBST([am__untar])
114972b4363aSmrg]) # _AM_PROG_TAR
115072b4363aSmrg
11517ed541caSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11527ed541caSmrgdnl serial 11 (pkg-config-0.29)
11537ed541caSmrgdnl
11547ed541caSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11557ed541caSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11567ed541caSmrgdnl
11577ed541caSmrgdnl This program is free software; you can redistribute it and/or modify
11587ed541caSmrgdnl it under the terms of the GNU General Public License as published by
11597ed541caSmrgdnl the Free Software Foundation; either version 2 of the License, or
11607ed541caSmrgdnl (at your option) any later version.
11617ed541caSmrgdnl
11627ed541caSmrgdnl This program is distributed in the hope that it will be useful, but
11637ed541caSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11647ed541caSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11657ed541caSmrgdnl General Public License for more details.
11667ed541caSmrgdnl
11677ed541caSmrgdnl You should have received a copy of the GNU General Public License
11687ed541caSmrgdnl along with this program; if not, write to the Free Software
11697ed541caSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11707ed541caSmrgdnl 02111-1307, USA.
11717ed541caSmrgdnl
11727ed541caSmrgdnl As a special exception to the GNU General Public License, if you
11737ed541caSmrgdnl distribute this file as part of a program that contains a
11747ed541caSmrgdnl configuration script generated by Autoconf, you may include it under
11757ed541caSmrgdnl the same distribution terms that you use for the rest of that
11767ed541caSmrgdnl program.
11777ed541caSmrg
11787ed541caSmrgdnl PKG_PREREQ(MIN-VERSION)
11797ed541caSmrgdnl -----------------------
11807ed541caSmrgdnl Since: 0.29
11817ed541caSmrgdnl
11827ed541caSmrgdnl Verify that the version of the pkg-config macros are at least
11837ed541caSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11847ed541caSmrgdnl installed version of pkg-config, this checks the developer's version
11857ed541caSmrgdnl of pkg.m4 when generating configure.
11867ed541caSmrgdnl
11877ed541caSmrgdnl To ensure that this macro is defined, also add:
11887ed541caSmrgdnl m4_ifndef([PKG_PREREQ],
11897ed541caSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11907ed541caSmrgdnl
11917ed541caSmrgdnl See the "Since" comment for each macro you use to see what version
11927ed541caSmrgdnl of the macros you require.
11937ed541caSmrgm4_defun([PKG_PREREQ],
11947ed541caSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
11957ed541caSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11967ed541caSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11977ed541caSmrg])dnl PKG_PREREQ
11987ed541caSmrg
11997ed541caSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12007ed541caSmrgdnl ----------------------------------
12017ed541caSmrgdnl Since: 0.16
12027ed541caSmrgdnl
12037ed541caSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12047ed541caSmrgdnl first found in the path. Checks that the version of pkg-config found
12057ed541caSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12067ed541caSmrgdnl used since that's the first version where most current features of
12077ed541caSmrgdnl pkg-config existed.
1208eea2e341SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209eea2e341Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12107ed541caSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12117ed541caSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12127ed541caSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12137ed541caSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12147ed541caSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12157ed541caSmrg
1216eea2e341Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217eea2e341Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218eea2e341Smrgfi
1219eea2e341Smrgif test -n "$PKG_CONFIG"; then
1220eea2e341Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221eea2e341Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222eea2e341Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223eea2e341Smrg		AC_MSG_RESULT([yes])
1224eea2e341Smrg	else
1225eea2e341Smrg		AC_MSG_RESULT([no])
1226eea2e341Smrg		PKG_CONFIG=""
1227eea2e341Smrg	fi
1228eea2e341Smrgfi[]dnl
12297ed541caSmrg])dnl PKG_PROG_PKG_CONFIG
1230eea2e341Smrg
12317ed541caSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12327ed541caSmrgdnl -------------------------------------------------------------------
12337ed541caSmrgdnl Since: 0.18
12347ed541caSmrgdnl
12357ed541caSmrgdnl Check to see whether a particular set of modules exists. Similar to
12367ed541caSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12377ed541caSmrgdnl
12387ed541caSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12397ed541caSmrgdnl only at the first occurence in configure.ac, so if the first place
12407ed541caSmrgdnl it's called might be skipped (such as if it is within an "if", you
12417ed541caSmrgdnl have to call PKG_CHECK_EXISTS manually
1242eea2e341SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244eea2e341Smrgif test -n "$PKG_CONFIG" && \
1245eea2e341Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12467ed541caSmrg  m4_default([$2], [:])
1247eea2e341Smrgm4_ifvaln([$3], [else
1248eea2e341Smrg  $3])dnl
1249eea2e341Smrgfi])
1250eea2e341Smrg
12517ed541caSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12527ed541caSmrgdnl ---------------------------------------------
12537ed541caSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12547ed541caSmrgdnl pkg_failed based on the result.
1255eea2e341Smrgm4_define([_PKG_CONFIG],
1256eea2e341Smrg[if test -n "$$1"; then
1257eea2e341Smrg    pkg_cv_[]$1="$$1"
1258eea2e341Smrg elif test -n "$PKG_CONFIG"; then
1259eea2e341Smrg    PKG_CHECK_EXISTS([$3],
12607ed541caSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12617ed541caSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262eea2e341Smrg		     [pkg_failed=yes])
1263eea2e341Smrg else
1264eea2e341Smrg    pkg_failed=untried
1265eea2e341Smrgfi[]dnl
12667ed541caSmrg])dnl _PKG_CONFIG
1267eea2e341Smrg
12687ed541caSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12697ed541caSmrgdnl ---------------------------
12707ed541caSmrgdnl Internal check to see if pkg-config supports short errors.
1271eea2e341SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273eea2e341Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274eea2e341Smrg        _pkg_short_errors_supported=yes
1275eea2e341Smrgelse
1276eea2e341Smrg        _pkg_short_errors_supported=no
1277eea2e341Smrgfi[]dnl
12787ed541caSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279eea2e341Smrg
1280eea2e341Smrg
12817ed541caSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12827ed541caSmrgdnl   [ACTION-IF-NOT-FOUND])
12837ed541caSmrgdnl --------------------------------------------------------------
12847ed541caSmrgdnl Since: 0.4.0
12857ed541caSmrgdnl
12867ed541caSmrgdnl Note that if there is a possibility the first call to
12877ed541caSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12887ed541caSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289eea2e341SmrgAC_DEFUN([PKG_CHECK_MODULES],
1290eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291eea2e341SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292eea2e341SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293eea2e341Smrg
1294eea2e341Smrgpkg_failed=no
1295eea2e341SmrgAC_MSG_CHECKING([for $1])
1296eea2e341Smrg
1297eea2e341Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298eea2e341Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299eea2e341Smrg
1300eea2e341Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301eea2e341Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1302eea2e341SmrgSee the pkg-config man page for more details.])
1303eea2e341Smrg
1304eea2e341Smrgif test $pkg_failed = yes; then
13057ed541caSmrg   	AC_MSG_RESULT([no])
1306eea2e341Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1307eea2e341Smrg        if test $_pkg_short_errors_supported = yes; then
13087ed541caSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309eea2e341Smrg        else 
13107ed541caSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311eea2e341Smrg        fi
1312eea2e341Smrg	# Put the nasty error message in config.log where it belongs
1313eea2e341Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314eea2e341Smrg
13157ed541caSmrg	m4_default([$4], [AC_MSG_ERROR(
1316eea2e341Smrg[Package requirements ($2) were not met:
1317eea2e341Smrg
1318eea2e341Smrg$$1_PKG_ERRORS
1319eea2e341Smrg
1320eea2e341SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321eea2e341Smrginstalled software in a non-standard prefix.
1322eea2e341Smrg
13237ed541caSmrg_PKG_TEXT])[]dnl
13247ed541caSmrg        ])
1325eea2e341Smrgelif test $pkg_failed = untried; then
13267ed541caSmrg     	AC_MSG_RESULT([no])
13277ed541caSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328eea2e341Smrg[The pkg-config script could not be found or is too old.  Make sure it
1329eea2e341Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330eea2e341Smrgpath to pkg-config.
1331eea2e341Smrg
1332eea2e341Smrg_PKG_TEXT
1333eea2e341Smrg
13347ed541caSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13357ed541caSmrg        ])
1336eea2e341Smrgelse
1337eea2e341Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338eea2e341Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339eea2e341Smrg        AC_MSG_RESULT([yes])
13407ed541caSmrg	$3
1341eea2e341Smrgfi[]dnl
13427ed541caSmrg])dnl PKG_CHECK_MODULES
13437ed541caSmrg
13447ed541caSmrg
13457ed541caSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13467ed541caSmrgdnl   [ACTION-IF-NOT-FOUND])
13477ed541caSmrgdnl ---------------------------------------------------------------------
13487ed541caSmrgdnl Since: 0.29
13497ed541caSmrgdnl
13507ed541caSmrgdnl Checks for existence of MODULES and gathers its build flags with
13517ed541caSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13527ed541caSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13537ed541caSmrgdnl
13547ed541caSmrgdnl Note that if there is a possibility the first call to
13557ed541caSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13567ed541caSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13577ed541caSmrgdnl configure.ac.
13587ed541caSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13597ed541caSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13607ed541caSmrg_save_PKG_CONFIG=$PKG_CONFIG
13617ed541caSmrgPKG_CONFIG="$PKG_CONFIG --static"
13627ed541caSmrgPKG_CHECK_MODULES($@)
13637ed541caSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13647ed541caSmrg])dnl PKG_CHECK_MODULES_STATIC
13657ed541caSmrg
13667ed541caSmrg
13677ed541caSmrgdnl PKG_INSTALLDIR([DIRECTORY])
13687ed541caSmrgdnl -------------------------
13697ed541caSmrgdnl Since: 0.27
13707ed541caSmrgdnl
13717ed541caSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
13727ed541caSmrgdnl should install pkg-config .pc files. By default the directory is
13737ed541caSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
13747ed541caSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13757ed541caSmrgdnl parameter.
13767ed541caSmrgAC_DEFUN([PKG_INSTALLDIR],
13777ed541caSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13787ed541caSmrgm4_pushdef([pkg_description],
13797ed541caSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13807ed541caSmrgAC_ARG_WITH([pkgconfigdir],
13817ed541caSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13827ed541caSmrg    [with_pkgconfigdir=]pkg_default)
13837ed541caSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13847ed541caSmrgm4_popdef([pkg_default])
13857ed541caSmrgm4_popdef([pkg_description])
13867ed541caSmrg])dnl PKG_INSTALLDIR
13877ed541caSmrg
13887ed541caSmrg
13897ed541caSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13907ed541caSmrgdnl --------------------------------
13917ed541caSmrgdnl Since: 0.27
13927ed541caSmrgdnl
13937ed541caSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13947ed541caSmrgdnl module should install arch-independent pkg-config .pc files. By
13957ed541caSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
13967ed541caSmrgdnl changed by passing DIRECTORY. The user can override through the
13977ed541caSmrgdnl --with-noarch-pkgconfigdir parameter.
13987ed541caSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13997ed541caSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14007ed541caSmrgm4_pushdef([pkg_description],
14017ed541caSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14027ed541caSmrgAC_ARG_WITH([noarch-pkgconfigdir],
14037ed541caSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14047ed541caSmrg    [with_noarch_pkgconfigdir=]pkg_default)
14057ed541caSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14067ed541caSmrgm4_popdef([pkg_default])
14077ed541caSmrgm4_popdef([pkg_description])
14087ed541caSmrg])dnl PKG_NOARCH_INSTALLDIR
14097ed541caSmrg
14107ed541caSmrg
14117ed541caSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14127ed541caSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14137ed541caSmrgdnl -------------------------------------------
14147ed541caSmrgdnl Since: 0.28
14157ed541caSmrgdnl
14167ed541caSmrgdnl Retrieves the value of the pkg-config variable for the given module.
14177ed541caSmrgAC_DEFUN([PKG_CHECK_VAR],
14187ed541caSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14197ed541caSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14207ed541caSmrg
14217ed541caSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14227ed541caSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14237ed541caSmrg
14247ed541caSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14257ed541caSmrg])dnl PKG_CHECK_VAR
1426eea2e341Smrg
1427dd77ae96Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142872b4363aSmrgdnl
14297ed541caSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
143033dddc75Smrgdnl
143172b4363aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143208e312fdSmrgdnl copy of this software and associated documentation files (the "Software"),
143308e312fdSmrgdnl to deal in the Software without restriction, including without limitation
143408e312fdSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143508e312fdSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
143608e312fdSmrgdnl Software is furnished to do so, subject to the following conditions:
143772b4363aSmrgdnl
143808e312fdSmrgdnl The above copyright notice and this permission notice (including the next
143908e312fdSmrgdnl paragraph) shall be included in all copies or substantial portions of the
144008e312fdSmrgdnl Software.
144172b4363aSmrgdnl
144208e312fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144308e312fdSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144408e312fdSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144508e312fdSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144608e312fdSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144708e312fdSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144808e312fdSmrgdnl DEALINGS IN THE SOFTWARE.
144972b4363aSmrg
145072b4363aSmrg# XORG_MACROS_VERSION(required-version)
145172b4363aSmrg# -------------------------------------
145272b4363aSmrg# Minimum version: 1.1.0
145372b4363aSmrg#
145472b4363aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
145572b4363aSmrg# your configure.ac with the minimum required version, such as:
145672b4363aSmrg# XORG_MACROS_VERSION(1.1)
145772b4363aSmrg#
1458dd77ae96Smrg# To ensure that this macro is defined, also add:
1459dd77ae96Smrg# m4_ifndef([XORG_MACROS_VERSION],
1460dd77ae96Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
146172b4363aSmrg#
146272b4363aSmrg#
146333dddc75Smrg# See the "minimum version" comment for each macro you use to see what
146472b4363aSmrg# version you require.
1465dd77ae96Smrgm4_defun([XORG_MACROS_VERSION],[
14667ed541caSmrgm4_define([vers_have], [1.19.3])
1467dd77ae96Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468dd77ae96Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469dd77ae96Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470dd77ae96Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471dd77ae96Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472dd77ae96Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473dd77ae96Smrgm4_undefine([vers_have])
1474dd77ae96Smrgm4_undefine([maj_have])
1475dd77ae96Smrgm4_undefine([maj_needed])
147672b4363aSmrg]) # XORG_MACROS_VERSION
147772b4363aSmrg
147872b4363aSmrg# XORG_PROG_RAWCPP()
147972b4363aSmrg# ------------------
148072b4363aSmrg# Minimum version: 1.0.0
148172b4363aSmrg#
148272b4363aSmrg# Find cpp program and necessary flags for use in pre-processing text files
148372b4363aSmrg# such as man pages and config files
148472b4363aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148572b4363aSmrgAC_REQUIRE([AC_PROG_CPP])
14867ed541caSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148772b4363aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148872b4363aSmrg
148972b4363aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149072b4363aSmrg# which is not the best choice for supporting other OS'es, but covers most
149172b4363aSmrg# of the ones we need for now.
149272b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1493eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149472b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149572b4363aSmrg	AC_MSG_RESULT([no])
149672b4363aSmrgelse
149772b4363aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149872b4363aSmrg		RAWCPPFLAGS=-undef
149972b4363aSmrg		AC_MSG_RESULT([yes])
1500dd77ae96Smrg	# under Cygwin unix is still defined even with -undef
1501dd77ae96Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1502dd77ae96Smrg		RAWCPPFLAGS="-undef -ansi"
1503dd77ae96Smrg		AC_MSG_RESULT([yes, with -ansi])
150472b4363aSmrg	else
150572b4363aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150672b4363aSmrg	fi
150772b4363aSmrgfi
150872b4363aSmrgrm -f conftest.$ac_ext
150972b4363aSmrg
151072b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1511eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151272b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151372b4363aSmrg	AC_MSG_RESULT([no])
151472b4363aSmrgelse
151572b4363aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151633dddc75Smrg		TRADITIONALCPPFLAGS="-traditional"
151772b4363aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151872b4363aSmrg		AC_MSG_RESULT([yes])
151972b4363aSmrg	else
152072b4363aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152172b4363aSmrg	fi
152272b4363aSmrgfi
152372b4363aSmrgrm -f conftest.$ac_ext
152472b4363aSmrgAC_SUBST(RAWCPPFLAGS)
152533dddc75SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152672b4363aSmrg]) # XORG_PROG_RAWCPP
152772b4363aSmrg
152872b4363aSmrg# XORG_MANPAGE_SECTIONS()
152972b4363aSmrg# -----------------------
153072b4363aSmrg# Minimum version: 1.0.0
153172b4363aSmrg#
153272b4363aSmrg# Determine which sections man pages go in for the different man page types
153372b4363aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153472b4363aSmrg# Not sure if there's any better way than just hardcoding by OS name.
153572b4363aSmrg# Override default settings by setting environment variables
153608e312fdSmrg# Added MAN_SUBSTS in version 1.8
153708e312fdSmrg# Added AC_PROG_SED in version 1.8
153872b4363aSmrg
153972b4363aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154072b4363aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154108e312fdSmrgAC_REQUIRE([AC_PROG_SED])
154272b4363aSmrg
15437ed541caSmrgcase $host_os in
15447ed541caSmrg    solaris*)
15457ed541caSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15467ed541caSmrg        # check for a man page file found in later versions that use
15477ed541caSmrg        # traditional section numbers instead
15487ed541caSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15497ed541caSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15507ed541caSmrg        ;;
15517ed541caSmrg    *) SYSV_MAN_SECTIONS=false ;;
15527ed541caSmrgesac
15537ed541caSmrg
155472b4363aSmrgif test x$APP_MAN_SUFFIX = x    ; then
155572b4363aSmrg    APP_MAN_SUFFIX=1
155672b4363aSmrgfi
155772b4363aSmrgif test x$APP_MAN_DIR = x    ; then
155872b4363aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155972b4363aSmrgfi
156072b4363aSmrg
156172b4363aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
156272b4363aSmrg    LIB_MAN_SUFFIX=3
156372b4363aSmrgfi
156472b4363aSmrgif test x$LIB_MAN_DIR = x    ; then
156572b4363aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156672b4363aSmrgfi
156772b4363aSmrg
156872b4363aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15697ed541caSmrg    case $SYSV_MAN_SECTIONS in
15707ed541caSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15717ed541caSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157272b4363aSmrg    esac
157372b4363aSmrgfi
157472b4363aSmrgif test x$FILE_MAN_DIR = x    ; then
157572b4363aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157672b4363aSmrgfi
157772b4363aSmrg
157872b4363aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15797ed541caSmrg    case $SYSV_MAN_SECTIONS in
15807ed541caSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15817ed541caSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158272b4363aSmrg    esac
158372b4363aSmrgfi
158472b4363aSmrgif test x$MISC_MAN_DIR = x    ; then
158572b4363aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158672b4363aSmrgfi
158772b4363aSmrg
158872b4363aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15897ed541caSmrg    case $SYSV_MAN_SECTIONS in
15907ed541caSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15917ed541caSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159272b4363aSmrg    esac
159372b4363aSmrgfi
159472b4363aSmrgif test x$DRIVER_MAN_DIR = x    ; then
159572b4363aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159672b4363aSmrgfi
159772b4363aSmrg
159872b4363aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15997ed541caSmrg    case $SYSV_MAN_SECTIONS in
16007ed541caSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16017ed541caSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160272b4363aSmrg    esac
160372b4363aSmrgfi
160472b4363aSmrgif test x$ADMIN_MAN_DIR = x    ; then
160572b4363aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160672b4363aSmrgfi
160772b4363aSmrg
160872b4363aSmrg
160972b4363aSmrgAC_SUBST([APP_MAN_SUFFIX])
161072b4363aSmrgAC_SUBST([LIB_MAN_SUFFIX])
161172b4363aSmrgAC_SUBST([FILE_MAN_SUFFIX])
161272b4363aSmrgAC_SUBST([MISC_MAN_SUFFIX])
161372b4363aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161472b4363aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161572b4363aSmrgAC_SUBST([APP_MAN_DIR])
161672b4363aSmrgAC_SUBST([LIB_MAN_DIR])
161772b4363aSmrgAC_SUBST([FILE_MAN_DIR])
161872b4363aSmrgAC_SUBST([MISC_MAN_DIR])
161972b4363aSmrgAC_SUBST([DRIVER_MAN_DIR])
162072b4363aSmrgAC_SUBST([ADMIN_MAN_DIR])
162108e312fdSmrg
162208e312fdSmrgXORG_MAN_PAGE="X Version 11"
162308e312fdSmrgAC_SUBST([XORG_MAN_PAGE])
162408e312fdSmrgMAN_SUBSTS="\
162508e312fdSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162608e312fdSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162708e312fdSmrg	-e 's|__xservername__|Xorg|g' \
162808e312fdSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
162908e312fdSmrg	-e 's|__projectroot__|\$(prefix)|g' \
163008e312fdSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163108e312fdSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163208e312fdSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163308e312fdSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163408e312fdSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163508e312fdSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163608e312fdSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163708e312fdSmrgAC_SUBST([MAN_SUBSTS])
163808e312fdSmrg
163972b4363aSmrg]) # XORG_MANPAGE_SECTIONS
164072b4363aSmrg
164108e312fdSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164208e312fdSmrg# ------------------------
164308e312fdSmrg# Minimum version: 1.7.0
164408e312fdSmrg#
164508e312fdSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164608e312fdSmrg# provided by xorg-sgml-doctools, if installed.
164708e312fdSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164808e312fdSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164908e312fdSmrgXORG_SGML_PATH=
165008e312fdSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165108e312fdSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165208e312fdSmrg    [m4_ifval([$1],[:],
165308e312fdSmrg        [if test x"$cross_compiling" != x"yes" ; then
165408e312fdSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165508e312fdSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165608e312fdSmrg         fi])
165708e312fdSmrg    ])
165808e312fdSmrg
165908e312fdSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166008e312fdSmrg# the path and the name of the doc stylesheet
166108e312fdSmrgif test "x$XORG_SGML_PATH" != "x" ; then
166208e312fdSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166308e312fdSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166408e312fdSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166508e312fdSmrgelse
166608e312fdSmrg   AC_MSG_RESULT([no])
166708e312fdSmrgfi
166808e312fdSmrg
166908e312fdSmrgAC_SUBST(XORG_SGML_PATH)
167008e312fdSmrgAC_SUBST(STYLESHEET_SRCDIR)
167108e312fdSmrgAC_SUBST(XSL_STYLESHEET)
167208e312fdSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167308e312fdSmrg]) # XORG_CHECK_SGML_DOCTOOLS
167408e312fdSmrg
167572b4363aSmrg# XORG_CHECK_LINUXDOC
167672b4363aSmrg# -------------------
167772b4363aSmrg# Minimum version: 1.0.0
167872b4363aSmrg#
167972b4363aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
168072b4363aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168172b4363aSmrg# Whether or not the necessary tools and files are found can be checked
168272b4363aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168372b4363aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168408e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168508e312fdSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168672b4363aSmrg
168772b4363aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168872b4363aSmrg
168908e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
169072b4363aSmrg
169108e312fdSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169272b4363aSmrg   BUILDDOC=yes
169372b4363aSmrgelse
169472b4363aSmrg   BUILDDOC=no
169572b4363aSmrgfi
169672b4363aSmrg
169772b4363aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169872b4363aSmrg
169972b4363aSmrgAC_MSG_RESULT([$BUILDDOC])
170072b4363aSmrg
170108e312fdSmrgAC_MSG_CHECKING([whether to build pdf documentation])
170272b4363aSmrg
170308e312fdSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170472b4363aSmrg   BUILDPDFDOC=yes
170572b4363aSmrgelse
170672b4363aSmrg   BUILDPDFDOC=no
170772b4363aSmrgfi
170872b4363aSmrg
170972b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171072b4363aSmrg
171172b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
171272b4363aSmrg
171308e312fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171472b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171572b4363aSmrgMAKE_PDF="$PS2PDF"
171672b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171772b4363aSmrg
171872b4363aSmrgAC_SUBST(MAKE_TEXT)
171972b4363aSmrgAC_SUBST(MAKE_PS)
172072b4363aSmrgAC_SUBST(MAKE_PDF)
172172b4363aSmrgAC_SUBST(MAKE_HTML)
172272b4363aSmrg]) # XORG_CHECK_LINUXDOC
172372b4363aSmrg
172472b4363aSmrg# XORG_CHECK_DOCBOOK
172572b4363aSmrg# -------------------
172672b4363aSmrg# Minimum version: 1.0.0
172772b4363aSmrg#
172872b4363aSmrg# Checks for the ability to build output formats from SGML DocBook source.
172972b4363aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173072b4363aSmrg# indicates whether the necessary tools and files are found and, if set,
173172b4363aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173272b4363aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173308e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173408e312fdSmrg
173572b4363aSmrgBUILDTXTDOC=no
173672b4363aSmrgBUILDPDFDOC=no
173772b4363aSmrgBUILDPSDOC=no
173872b4363aSmrgBUILDHTMLDOC=no
173972b4363aSmrg
174072b4363aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174172b4363aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174272b4363aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174372b4363aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174472b4363aSmrg
174508e312fdSmrgAC_MSG_CHECKING([whether to build text documentation])
174608e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174772b4363aSmrg   test x$BUILD_TXTDOC != xno; then
174872b4363aSmrg	BUILDTXTDOC=yes
174972b4363aSmrgfi
175072b4363aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175172b4363aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
175272b4363aSmrg
175308e312fdSmrgAC_MSG_CHECKING([whether to build PDF documentation])
175408e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175572b4363aSmrg   test x$BUILD_PDFDOC != xno; then
175672b4363aSmrg	BUILDPDFDOC=yes
175772b4363aSmrgfi
175872b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175972b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
176072b4363aSmrg
176108e312fdSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176208e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176372b4363aSmrg   test x$BUILD_PSDOC != xno; then
176472b4363aSmrg	BUILDPSDOC=yes
176572b4363aSmrgfi
176672b4363aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176772b4363aSmrgAC_MSG_RESULT([$BUILDPSDOC])
176872b4363aSmrg
176908e312fdSmrgAC_MSG_CHECKING([whether to build HTML documentation])
177008e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177172b4363aSmrg   test x$BUILD_HTMLDOC != xno; then
177272b4363aSmrg	BUILDHTMLDOC=yes
177372b4363aSmrgfi
177472b4363aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177572b4363aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177672b4363aSmrg
177772b4363aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177872b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177972b4363aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178072b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178172b4363aSmrg
178272b4363aSmrgAC_SUBST(MAKE_TEXT)
178372b4363aSmrgAC_SUBST(MAKE_PS)
178472b4363aSmrgAC_SUBST(MAKE_PDF)
178572b4363aSmrgAC_SUBST(MAKE_HTML)
178672b4363aSmrg]) # XORG_CHECK_DOCBOOK
178772b4363aSmrg
178808e312fdSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178908e312fdSmrg# ----------------
179008e312fdSmrg# Minimum version: 1.5.0
179108e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179208e312fdSmrg#
179308e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
179408e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
179508e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
179608e312fdSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179708e312fdSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179808e312fdSmrg# --with-xmlto assumes 'auto'.
179908e312fdSmrg#
180008e312fdSmrg# Interface to module:
180108e312fdSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180208e312fdSmrg# XMLTO:	returns the path of the xmlto program found
180308e312fdSmrg#		returns the path set by the user in the environment
180408e312fdSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180508e312fdSmrg#		'no' user instructs the module not to use xmlto
180608e312fdSmrg#
180708e312fdSmrg# Added in version 1.10.0
180808e312fdSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180908e312fdSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181008e312fdSmrg#
181108e312fdSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181208e312fdSmrg#
181308e312fdSmrgAC_DEFUN([XORG_WITH_XMLTO],[
181408e312fdSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181508e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
181608e312fdSmrgAC_ARG_WITH(xmlto,
181708e312fdSmrg	AS_HELP_STRING([--with-xmlto],
181808e312fdSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181908e312fdSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182008e312fdSmrgm4_undefine([_defopt])
182108e312fdSmrg
182208e312fdSmrgif test "x$use_xmlto" = x"auto"; then
182308e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
182408e312fdSmrg   if test "x$XMLTO" = "x"; then
182508e312fdSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182608e312fdSmrg	have_xmlto=no
182708e312fdSmrg   else
182808e312fdSmrg        have_xmlto=yes
182908e312fdSmrg   fi
183008e312fdSmrgelif test "x$use_xmlto" = x"yes" ; then
183108e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
183208e312fdSmrg   if test "x$XMLTO" = "x"; then
183308e312fdSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183408e312fdSmrg   fi
183508e312fdSmrg   have_xmlto=yes
183608e312fdSmrgelif test "x$use_xmlto" = x"no" ; then
183708e312fdSmrg   if test "x$XMLTO" != "x"; then
183808e312fdSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183908e312fdSmrg   fi
184008e312fdSmrg   have_xmlto=no
184108e312fdSmrgelse
184208e312fdSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184308e312fdSmrgfi
184408e312fdSmrg
184508e312fdSmrg# Test for a minimum version of xmlto, if provided.
184608e312fdSmrgm4_ifval([$1],
184708e312fdSmrg[if test "$have_xmlto" = yes; then
184808e312fdSmrg    # scrape the xmlto version
184908e312fdSmrg    AC_MSG_CHECKING([the xmlto version])
185008e312fdSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185108e312fdSmrg    AC_MSG_RESULT([$xmlto_version])
185208e312fdSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185308e312fdSmrg        [if test "x$use_xmlto" = xauto; then
185408e312fdSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185508e312fdSmrg            have_xmlto=no
185608e312fdSmrg        else
185708e312fdSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185808e312fdSmrg        fi])
185908e312fdSmrgfi])
186008e312fdSmrg
186108e312fdSmrg# Test for the ability of xmlto to generate a text target
18627ed541caSmrg#
18637ed541caSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18647ed541caSmrg# following test for empty XML docbook files.
18657ed541caSmrg# For compatibility reasons use the following empty XML docbook file and if
18667ed541caSmrg# it fails try it again with a non-empty XML file.
186708e312fdSmrghave_xmlto_text=no
186808e312fdSmrgcat > conftest.xml << "EOF"
186908e312fdSmrgEOF
187008e312fdSmrgAS_IF([test "$have_xmlto" = yes],
187108e312fdSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187208e312fdSmrg             [have_xmlto_text=yes],
18737ed541caSmrg             [# Try it again with a non-empty XML file.
18747ed541caSmrg              cat > conftest.xml << "EOF"
18757ed541caSmrg<x></x>
18767ed541caSmrgEOF
18777ed541caSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18787ed541caSmrg                    [have_xmlto_text=yes],
18797ed541caSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188008e312fdSmrgrm -f conftest.xml
188108e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188208e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188308e312fdSmrg]) # XORG_WITH_XMLTO
188408e312fdSmrg
1885eea2e341Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1886eea2e341Smrg# --------------------------------------------
1887eea2e341Smrg# Minimum version: 1.12.0
1888eea2e341Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889eea2e341Smrg#
1890eea2e341Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1891eea2e341Smrg# XML-based language used for the transformation of XML documents.
1892eea2e341Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1893eea2e341Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1894eea2e341Smrg# The XSLT processor is often used as a standalone tool for transformations.
1895eea2e341Smrg# It should not be assumed that this tool is used only to work with documnetation.
1896eea2e341Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897eea2e341Smrg#
1898eea2e341Smrg# Interface to module:
1899eea2e341Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1900eea2e341Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1901eea2e341Smrg#		 returns the path set by the user in the environment
1902eea2e341Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1903eea2e341Smrg#		  'no' user instructs the module not to use xsltproc
1904eea2e341Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905eea2e341Smrg#
1906eea2e341Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907eea2e341Smrg#
1908eea2e341SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1909eea2e341SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1910eea2e341Smrg# Preserves the interface, should it be implemented later
1911eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1912eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1913eea2e341SmrgAC_ARG_WITH(xsltproc,
1914eea2e341Smrg	AS_HELP_STRING([--with-xsltproc],
1915eea2e341Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1916eea2e341Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1917eea2e341Smrgm4_undefine([_defopt])
1918eea2e341Smrg
1919eea2e341Smrgif test "x$use_xsltproc" = x"auto"; then
1920eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1921eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1922eea2e341Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1923eea2e341Smrg	have_xsltproc=no
1924eea2e341Smrg   else
1925eea2e341Smrg        have_xsltproc=yes
1926eea2e341Smrg   fi
1927eea2e341Smrgelif test "x$use_xsltproc" = x"yes" ; then
1928eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1929eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1930eea2e341Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1931eea2e341Smrg   fi
1932eea2e341Smrg   have_xsltproc=yes
1933eea2e341Smrgelif test "x$use_xsltproc" = x"no" ; then
1934eea2e341Smrg   if test "x$XSLTPROC" != "x"; then
1935eea2e341Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1936eea2e341Smrg   fi
1937eea2e341Smrg   have_xsltproc=no
1938eea2e341Smrgelse
1939eea2e341Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940eea2e341Smrgfi
1941eea2e341Smrg
1942eea2e341SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1943eea2e341Smrg]) # XORG_WITH_XSLTPROC
1944eea2e341Smrg
1945eea2e341Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1946eea2e341Smrg# ----------------------------------------
1947eea2e341Smrg# Minimum version: 1.15.0
1948eea2e341Smrg#
1949eea2e341Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1950eea2e341Smrg# scanning arbitrary text files, extracting information from those text files,
1951eea2e341Smrg# and printing reports based on that information.
1952eea2e341Smrg#
1953eea2e341Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954eea2e341Smrg#
1955eea2e341Smrg# Interface to module:
1956eea2e341Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1957eea2e341Smrg# PERL:	     returns the path of the perl program found
1958eea2e341Smrg#	     returns the path set by the user in the environment
1959eea2e341Smrg# --with-perl: 'yes' user instructs the module to use perl
1960eea2e341Smrg#	       'no' user instructs the module not to use perl
1961eea2e341Smrg# have_perl: returns yes if perl found in PATH or no
1962eea2e341Smrg#
1963eea2e341Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1964eea2e341Smrg#
1965eea2e341SmrgAC_DEFUN([XORG_WITH_PERL],[
1966eea2e341SmrgAC_ARG_VAR([PERL], [Path to perl command])
1967eea2e341Smrg# Preserves the interface, should it be implemented later
1968eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1969eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1970eea2e341SmrgAC_ARG_WITH(perl,
1971eea2e341Smrg	AS_HELP_STRING([--with-perl],
1972eea2e341Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1973eea2e341Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1974eea2e341Smrgm4_undefine([_defopt])
1975eea2e341Smrg
1976eea2e341Smrgif test "x$use_perl" = x"auto"; then
1977eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1978eea2e341Smrg   if test "x$PERL" = "x"; then
1979eea2e341Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1980eea2e341Smrg	have_perl=no
1981eea2e341Smrg   else
1982eea2e341Smrg        have_perl=yes
1983eea2e341Smrg   fi
1984eea2e341Smrgelif test "x$use_perl" = x"yes" ; then
1985eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1986eea2e341Smrg   if test "x$PERL" = "x"; then
1987eea2e341Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1988eea2e341Smrg   fi
1989eea2e341Smrg   have_perl=yes
1990eea2e341Smrgelif test "x$use_perl" = x"no" ; then
1991eea2e341Smrg   if test "x$PERL" != "x"; then
1992eea2e341Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1993eea2e341Smrg   fi
1994eea2e341Smrg   have_perl=no
1995eea2e341Smrgelse
1996eea2e341Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997eea2e341Smrgfi
1998eea2e341Smrg
1999eea2e341SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2000eea2e341Smrg]) # XORG_WITH_PERL
2001eea2e341Smrg
200208e312fdSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200308e312fdSmrg# ----------------
200408e312fdSmrg# Minimum version: 1.5.0
200508e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200608e312fdSmrg#
200708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
200808e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
200908e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
201008e312fdSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201108e312fdSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201208e312fdSmrg# --with-asciidoc assumes 'auto'.
201308e312fdSmrg#
201408e312fdSmrg# Interface to module:
201508e312fdSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201608e312fdSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
201708e312fdSmrg#		 returns the path set by the user in the environment
201808e312fdSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201908e312fdSmrg#		  'no' user instructs the module not to use asciidoc
202008e312fdSmrg#
202108e312fdSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202208e312fdSmrg#
202308e312fdSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202408e312fdSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202508e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
202608e312fdSmrgAC_ARG_WITH(asciidoc,
202708e312fdSmrg	AS_HELP_STRING([--with-asciidoc],
202808e312fdSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202908e312fdSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203008e312fdSmrgm4_undefine([_defopt])
203108e312fdSmrg
203208e312fdSmrgif test "x$use_asciidoc" = x"auto"; then
203308e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203408e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
203508e312fdSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203608e312fdSmrg	have_asciidoc=no
203708e312fdSmrg   else
203808e312fdSmrg        have_asciidoc=yes
203908e312fdSmrg   fi
204008e312fdSmrgelif test "x$use_asciidoc" = x"yes" ; then
204108e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204208e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
204308e312fdSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204408e312fdSmrg   fi
204508e312fdSmrg   have_asciidoc=yes
204608e312fdSmrgelif test "x$use_asciidoc" = x"no" ; then
204708e312fdSmrg   if test "x$ASCIIDOC" != "x"; then
204808e312fdSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204908e312fdSmrg   fi
205008e312fdSmrg   have_asciidoc=no
205108e312fdSmrgelse
205208e312fdSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205308e312fdSmrgfi
205408e312fdSmrgm4_ifval([$1],
205508e312fdSmrg[if test "$have_asciidoc" = yes; then
205608e312fdSmrg    # scrape the asciidoc version
205708e312fdSmrg    AC_MSG_CHECKING([the asciidoc version])
205808e312fdSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205908e312fdSmrg    AC_MSG_RESULT([$asciidoc_version])
206008e312fdSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206108e312fdSmrg        [if test "x$use_asciidoc" = xauto; then
206208e312fdSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206308e312fdSmrg            have_asciidoc=no
206408e312fdSmrg        else
206508e312fdSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206608e312fdSmrg        fi])
206708e312fdSmrgfi])
206808e312fdSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206908e312fdSmrg]) # XORG_WITH_ASCIIDOC
207008e312fdSmrg
207108e312fdSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207233dddc75Smrg# -------------------------------------------
207308e312fdSmrg# Minimum version: 1.5.0
207408e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
207533dddc75Smrg# Minimum version for optional DOT checking: 1.18.0
207608e312fdSmrg#
207708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
207808e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
207908e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
208008e312fdSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208108e312fdSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208208e312fdSmrg# --with-doxygen assumes 'auto'.
208308e312fdSmrg#
208408e312fdSmrg# Interface to module:
208508e312fdSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208608e312fdSmrg# DOXYGEN:	 returns the path of the doxygen program found
208708e312fdSmrg#		 returns the path set by the user in the environment
208808e312fdSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208908e312fdSmrg#		  'no' user instructs the module not to use doxygen
209008e312fdSmrg#
209108e312fdSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209208e312fdSmrg#
209308e312fdSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209408e312fdSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209533dddc75SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209608e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
209708e312fdSmrgAC_ARG_WITH(doxygen,
209808e312fdSmrg	AS_HELP_STRING([--with-doxygen],
209908e312fdSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210008e312fdSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210108e312fdSmrgm4_undefine([_defopt])
210208e312fdSmrg
210308e312fdSmrgif test "x$use_doxygen" = x"auto"; then
210408e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210508e312fdSmrg   if test "x$DOXYGEN" = "x"; then
210608e312fdSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210708e312fdSmrg	have_doxygen=no
210808e312fdSmrg   else
210908e312fdSmrg        have_doxygen=yes
211008e312fdSmrg   fi
211108e312fdSmrgelif test "x$use_doxygen" = x"yes" ; then
211208e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211308e312fdSmrg   if test "x$DOXYGEN" = "x"; then
211408e312fdSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211508e312fdSmrg   fi
211608e312fdSmrg   have_doxygen=yes
211708e312fdSmrgelif test "x$use_doxygen" = x"no" ; then
211808e312fdSmrg   if test "x$DOXYGEN" != "x"; then
211908e312fdSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212008e312fdSmrg   fi
212108e312fdSmrg   have_doxygen=no
212208e312fdSmrgelse
212308e312fdSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212408e312fdSmrgfi
212508e312fdSmrgm4_ifval([$1],
212608e312fdSmrg[if test "$have_doxygen" = yes; then
212708e312fdSmrg    # scrape the doxygen version
212808e312fdSmrg    AC_MSG_CHECKING([the doxygen version])
212908e312fdSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213008e312fdSmrg    AC_MSG_RESULT([$doxygen_version])
213108e312fdSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213208e312fdSmrg        [if test "x$use_doxygen" = xauto; then
213308e312fdSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213408e312fdSmrg            have_doxygen=no
213508e312fdSmrg        else
213608e312fdSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213708e312fdSmrg        fi])
213808e312fdSmrgfi])
213933dddc75Smrg
214033dddc75Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214133dddc75Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214233dddc75Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214333dddc75SmrgHAVE_DOT=no
214433dddc75Smrgif test "x$have_doxygen" = "xyes"; then
214533dddc75Smrg  AC_PATH_PROG([DOT], [dot])
214633dddc75Smrg    if test "x$DOT" != "x"; then
214733dddc75Smrg      HAVE_DOT=yes
214833dddc75Smrg    fi
214933dddc75Smrgfi
215033dddc75Smrg
215133dddc75SmrgAC_SUBST([HAVE_DOT])
215233dddc75SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215308e312fdSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215408e312fdSmrg]) # XORG_WITH_DOXYGEN
215508e312fdSmrg
215608e312fdSmrg# XORG_WITH_GROFF([DEFAULT])
215708e312fdSmrg# ----------------
215808e312fdSmrg# Minimum version: 1.6.0
215908e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
216008e312fdSmrg#
216108e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
216208e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
216308e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
216408e312fdSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
216508e312fdSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
216608e312fdSmrg# --with-groff assumes 'auto'.
216708e312fdSmrg#
216808e312fdSmrg# Interface to module:
216908e312fdSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217008e312fdSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217108e312fdSmrg# HAVE_GROFF_MS: the -ms macros package
217208e312fdSmrg# GROFF:	 returns the path of the groff program found
217308e312fdSmrg#		 returns the path set by the user in the environment
217408e312fdSmrg# --with-groff:	 'yes' user instructs the module to use groff
217508e312fdSmrg#		 'no' user instructs the module not to use groff
217608e312fdSmrg#
217708e312fdSmrg# Added in version 1.9.0:
217808e312fdSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217908e312fdSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218008e312fdSmrg#		   psselect from the psutils package.
218108e312fdSmrg#		   the ghostcript package. Refer to the grohtml man pages
218208e312fdSmrg#
218308e312fdSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218408e312fdSmrg#
218508e312fdSmrg# OS and distros often splits groff in a basic and full package, the former
218608e312fdSmrg# having the groff program and the later having devices, fonts and macros
218708e312fdSmrg# Checking for the groff executable is not enough.
218808e312fdSmrg#
218908e312fdSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
219008e312fdSmrg# unset HAVE_GROFF or GROFF env variables.
219108e312fdSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219208e312fdSmrg#
219308e312fdSmrgAC_DEFUN([XORG_WITH_GROFF],[
219408e312fdSmrgAC_ARG_VAR([GROFF], [Path to groff command])
219508e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
219608e312fdSmrgAC_ARG_WITH(groff,
219708e312fdSmrg	AS_HELP_STRING([--with-groff],
219808e312fdSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219908e312fdSmrg	   [use_groff=$withval], [use_groff=]_defopt)
220008e312fdSmrgm4_undefine([_defopt])
220108e312fdSmrg
220208e312fdSmrgif test "x$use_groff" = x"auto"; then
220308e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
220408e312fdSmrg   if test "x$GROFF" = "x"; then
220508e312fdSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220608e312fdSmrg	have_groff=no
220708e312fdSmrg   else
220808e312fdSmrg        have_groff=yes
220908e312fdSmrg   fi
221008e312fdSmrgelif test "x$use_groff" = x"yes" ; then
221108e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
221208e312fdSmrg   if test "x$GROFF" = "x"; then
221308e312fdSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221408e312fdSmrg   fi
221508e312fdSmrg   have_groff=yes
221608e312fdSmrgelif test "x$use_groff" = x"no" ; then
221708e312fdSmrg   if test "x$GROFF" != "x"; then
221808e312fdSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221908e312fdSmrg   fi
222008e312fdSmrg   have_groff=no
222108e312fdSmrgelse
222208e312fdSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222308e312fdSmrgfi
222408e312fdSmrg
222508e312fdSmrg# We have groff, test for the presence of the macro packages
222608e312fdSmrgif test "x$have_groff" = x"yes"; then
222708e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222808e312fdSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222908e312fdSmrg        groff_ms_works=yes
223008e312fdSmrg    else
223108e312fdSmrg        groff_ms_works=no
223208e312fdSmrg    fi
223308e312fdSmrg    AC_MSG_RESULT([$groff_ms_works])
223408e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223508e312fdSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223608e312fdSmrg        groff_mm_works=yes
223708e312fdSmrg    else
223808e312fdSmrg        groff_mm_works=no
223908e312fdSmrg    fi
224008e312fdSmrg    AC_MSG_RESULT([$groff_mm_works])
224108e312fdSmrgfi
224208e312fdSmrg
224308e312fdSmrg# We have groff, test for HTML dependencies, one command per package
224408e312fdSmrgif test "x$have_groff" = x"yes"; then
224508e312fdSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224608e312fdSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224708e312fdSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224808e312fdSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224908e312fdSmrg      have_groff_html=yes
225008e312fdSmrg   else
225108e312fdSmrg      have_groff_html=no
225208e312fdSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225308e312fdSmrg   fi
225408e312fdSmrgfi
225508e312fdSmrg
225608e312fdSmrg# Set Automake conditionals for Makefiles
225708e312fdSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225808e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225908e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226008e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226108e312fdSmrg]) # XORG_WITH_GROFF
226208e312fdSmrg
2263eea2e341Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2264eea2e341Smrg# ---------------------------------------
226508e312fdSmrg# Minimum version: 1.6.0
226608e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2267eea2e341Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226808e312fdSmrg#
226908e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
227008e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
227108e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
227208e312fdSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
227308e312fdSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
227408e312fdSmrg# --with-fop assumes 'auto'.
227508e312fdSmrg#
227608e312fdSmrg# Interface to module:
227708e312fdSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227808e312fdSmrg# FOP:	 	returns the path of the fop program found
227908e312fdSmrg#		returns the path set by the user in the environment
228008e312fdSmrg# --with-fop: 	'yes' user instructs the module to use fop
228108e312fdSmrg#		'no' user instructs the module not to use fop
228208e312fdSmrg#
228308e312fdSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228408e312fdSmrg#
228508e312fdSmrgAC_DEFUN([XORG_WITH_FOP],[
228608e312fdSmrgAC_ARG_VAR([FOP], [Path to fop command])
2287eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
228808e312fdSmrgAC_ARG_WITH(fop,
228908e312fdSmrg	AS_HELP_STRING([--with-fop],
229008e312fdSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229108e312fdSmrg	   [use_fop=$withval], [use_fop=]_defopt)
229208e312fdSmrgm4_undefine([_defopt])
229308e312fdSmrg
229408e312fdSmrgif test "x$use_fop" = x"auto"; then
229508e312fdSmrg   AC_PATH_PROG([FOP], [fop])
229608e312fdSmrg   if test "x$FOP" = "x"; then
229708e312fdSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229808e312fdSmrg	have_fop=no
229908e312fdSmrg   else
230008e312fdSmrg        have_fop=yes
230108e312fdSmrg   fi
230208e312fdSmrgelif test "x$use_fop" = x"yes" ; then
230308e312fdSmrg   AC_PATH_PROG([FOP], [fop])
230408e312fdSmrg   if test "x$FOP" = "x"; then
230508e312fdSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230608e312fdSmrg   fi
230708e312fdSmrg   have_fop=yes
230808e312fdSmrgelif test "x$use_fop" = x"no" ; then
230908e312fdSmrg   if test "x$FOP" != "x"; then
231008e312fdSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231108e312fdSmrg   fi
231208e312fdSmrg   have_fop=no
231308e312fdSmrgelse
231408e312fdSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231508e312fdSmrgfi
2316eea2e341Smrg
2317eea2e341Smrg# Test for a minimum version of fop, if provided.
2318eea2e341Smrgm4_ifval([$1],
2319eea2e341Smrg[if test "$have_fop" = yes; then
2320eea2e341Smrg    # scrape the fop version
2321eea2e341Smrg    AC_MSG_CHECKING([for fop minimum version])
2322eea2e341Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2323eea2e341Smrg    AC_MSG_RESULT([$fop_version])
2324eea2e341Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2325eea2e341Smrg        [if test "x$use_fop" = xauto; then
2326eea2e341Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2327eea2e341Smrg            have_fop=no
2328eea2e341Smrg        else
2329eea2e341Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2330eea2e341Smrg        fi])
2331eea2e341Smrgfi])
233208e312fdSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233308e312fdSmrg]) # XORG_WITH_FOP
233408e312fdSmrg
233533dddc75Smrg# XORG_WITH_M4([MIN-VERSION])
233633dddc75Smrg# ---------------------------
233733dddc75Smrg# Minimum version: 1.19.0
233833dddc75Smrg#
233933dddc75Smrg# This macro attempts to locate an m4 macro processor which supports
234033dddc75Smrg# -I option and is only useful for modules relying on M4 in order to
234133dddc75Smrg# expand macros in source code files.
234233dddc75Smrg#
234333dddc75Smrg# Interface to module:
234433dddc75Smrg# M4:	 	returns the path of the m4 program found
234533dddc75Smrg#		returns the path set by the user in the environment
234633dddc75Smrg#
234733dddc75SmrgAC_DEFUN([XORG_WITH_M4], [
234833dddc75SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234933dddc75Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235033dddc75Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235133dddc75Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235233dddc75Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235333dddc75Smrg   [$PATH:/usr/gnu/bin])])
235433dddc75Smrg
235533dddc75SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235633dddc75Smrg]) # XORG_WITH_M4
235733dddc75Smrg
235808e312fdSmrg# XORG_WITH_PS2PDF([DEFAULT])
235908e312fdSmrg# ----------------
236008e312fdSmrg# Minimum version: 1.6.0
236108e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
236208e312fdSmrg#
236308e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
236408e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
236508e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
236608e312fdSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236708e312fdSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236808e312fdSmrg# --with-ps2pdf assumes 'auto'.
236908e312fdSmrg#
237008e312fdSmrg# Interface to module:
237108e312fdSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237208e312fdSmrg# PS2PDF:	returns the path of the ps2pdf program found
237308e312fdSmrg#		returns the path set by the user in the environment
237408e312fdSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237508e312fdSmrg#		 'no' user instructs the module not to use ps2pdf
237608e312fdSmrg#
237708e312fdSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237808e312fdSmrg#
237908e312fdSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238008e312fdSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238108e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
238208e312fdSmrgAC_ARG_WITH(ps2pdf,
238308e312fdSmrg	AS_HELP_STRING([--with-ps2pdf],
238408e312fdSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238508e312fdSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238608e312fdSmrgm4_undefine([_defopt])
238708e312fdSmrg
238808e312fdSmrgif test "x$use_ps2pdf" = x"auto"; then
238908e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239008e312fdSmrg   if test "x$PS2PDF" = "x"; then
239108e312fdSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239208e312fdSmrg	have_ps2pdf=no
239308e312fdSmrg   else
239408e312fdSmrg        have_ps2pdf=yes
239508e312fdSmrg   fi
239608e312fdSmrgelif test "x$use_ps2pdf" = x"yes" ; then
239708e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239808e312fdSmrg   if test "x$PS2PDF" = "x"; then
239908e312fdSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240008e312fdSmrg   fi
240108e312fdSmrg   have_ps2pdf=yes
240208e312fdSmrgelif test "x$use_ps2pdf" = x"no" ; then
240308e312fdSmrg   if test "x$PS2PDF" != "x"; then
240408e312fdSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240508e312fdSmrg   fi
240608e312fdSmrg   have_ps2pdf=no
240708e312fdSmrgelse
240808e312fdSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240908e312fdSmrgfi
241008e312fdSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241108e312fdSmrg]) # XORG_WITH_PS2PDF
241208e312fdSmrg
241308e312fdSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
241408e312fdSmrg# ----------------
241508e312fdSmrg# Minimum version: 1.6.0
241608e312fdSmrg#
241708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
241808e312fdSmrg# not at the appropriate level. This macro enables a builder to skip all
241908e312fdSmrg# documentation targets except traditional man pages.
242008e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242108e312fdSmrg# maximum flexibilty in controlling documentation building.
242208e312fdSmrg# Refer to:
242308e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
242408e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242508e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
242608e312fdSmrg# XORG_WITH_FOP           --with-fop
242708e312fdSmrg# XORG_WITH_GROFF         --with-groff
242808e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
242908e312fdSmrg#
243008e312fdSmrg# Interface to module:
243108e312fdSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243208e312fdSmrg# --enable-docs: 'yes' user instructs the module to generate docs
243308e312fdSmrg#		 'no' user instructs the module not to generate docs
243408e312fdSmrg# parm1:	specify the default value, yes or no.
243508e312fdSmrg#
243608e312fdSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2437eea2e341Smrgm4_define([docs_default], m4_default([$1], [yes]))
243808e312fdSmrgAC_ARG_ENABLE(docs,
243908e312fdSmrg	AS_HELP_STRING([--enable-docs],
2440eea2e341Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2441eea2e341Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2442eea2e341Smrgm4_undefine([docs_default])
244308e312fdSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244408e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
244508e312fdSmrgAC_MSG_RESULT([$build_docs])
244608e312fdSmrg]) # XORG_ENABLE_DOCS
244708e312fdSmrg
244808e312fdSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244908e312fdSmrg# ----------------
245008e312fdSmrg# Minimum version: 1.6.0
245108e312fdSmrg#
245208e312fdSmrg# This macro enables a builder to skip all developer documentation.
245308e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245408e312fdSmrg# maximum flexibilty in controlling documentation building.
245508e312fdSmrg# Refer to:
245608e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
245708e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245808e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
245908e312fdSmrg# XORG_WITH_FOP           --with-fop
246008e312fdSmrg# XORG_WITH_GROFF         --with-groff
246108e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
246208e312fdSmrg#
246308e312fdSmrg# Interface to module:
246408e312fdSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246508e312fdSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246608e312fdSmrg#			'no' user instructs the module not to generate developer docs
246708e312fdSmrg# parm1:		specify the default value, yes or no.
246808e312fdSmrg#
246908e312fdSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247008e312fdSmrgm4_define([devel_default], m4_default([$1], [yes]))
247108e312fdSmrgAC_ARG_ENABLE(devel-docs,
247208e312fdSmrg	AS_HELP_STRING([--enable-devel-docs],
247308e312fdSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247408e312fdSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247508e312fdSmrgm4_undefine([devel_default])
247608e312fdSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247708e312fdSmrgAC_MSG_CHECKING([whether to build developer documentation])
247808e312fdSmrgAC_MSG_RESULT([$build_devel_docs])
247908e312fdSmrg]) # XORG_ENABLE_DEVEL_DOCS
248008e312fdSmrg
248108e312fdSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
248208e312fdSmrg# ----------------
248308e312fdSmrg# Minimum version: 1.6.0
248408e312fdSmrg#
248508e312fdSmrg# This macro enables a builder to skip all functional specification targets.
248608e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248708e312fdSmrg# maximum flexibilty in controlling documentation building.
248808e312fdSmrg# Refer to:
248908e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
249008e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249108e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
249208e312fdSmrg# XORG_WITH_FOP           --with-fop
249308e312fdSmrg# XORG_WITH_GROFF         --with-groff
249408e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
249508e312fdSmrg#
249608e312fdSmrg# Interface to module:
249708e312fdSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249808e312fdSmrg# --enable-specs:	'yes' user instructs the module to generate specs
249908e312fdSmrg#			'no' user instructs the module not to generate specs
250008e312fdSmrg# parm1:		specify the default value, yes or no.
250108e312fdSmrg#
250208e312fdSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250308e312fdSmrgm4_define([spec_default], m4_default([$1], [yes]))
250408e312fdSmrgAC_ARG_ENABLE(specs,
250508e312fdSmrg	AS_HELP_STRING([--enable-specs],
250608e312fdSmrg	   [Enable building the specs (default: ]spec_default[)]),
250708e312fdSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
250808e312fdSmrgm4_undefine([spec_default])
250908e312fdSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251008e312fdSmrgAC_MSG_CHECKING([whether to build functional specifications])
251108e312fdSmrgAC_MSG_RESULT([$build_specs])
251208e312fdSmrg]) # XORG_ENABLE_SPECS
251308e312fdSmrg
2514eea2e341Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2515eea2e341Smrg# ----------------------------------------------
2516eea2e341Smrg# Minimum version: 1.13.0
2517eea2e341Smrg#
2518eea2e341Smrg# This macro enables a builder to enable/disable unit testing
2519eea2e341Smrg# It makes no assumption about the test cases implementation
2520eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2521eea2e341Smrg# They may or may not use the software utility library GLib
2522eea2e341Smrg#
2523eea2e341Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2524eea2e341Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2525eea2e341Smrg# The variable enable_unit_tests is used by other macros in this file.
2526eea2e341Smrg#
2527eea2e341Smrg# Interface to module:
2528eea2e341Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2529eea2e341Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2530eea2e341Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2531eea2e341Smrg#			'no' user instructs the module not to build tests
2532eea2e341Smrg# parm1:		specify the default value, yes or no.
2533eea2e341Smrg#
2534eea2e341SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2535eea2e341SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2536eea2e341SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2537eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2538eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2539eea2e341SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2540eea2e341Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2541eea2e341Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2542eea2e341Smrgm4_undefine([_defopt])
2543eea2e341SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2544eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2545eea2e341SmrgAC_MSG_RESULT([$enable_unit_tests])
2546eea2e341Smrg]) # XORG_ENABLE_UNIT_TESTS
2547eea2e341Smrg
2548eea2e341Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2549eea2e341Smrg# ------------------------------------------------------
2550eea2e341Smrg# Minimum version: 1.17.0
2551eea2e341Smrg#
2552eea2e341Smrg# This macro enables a builder to enable/disable integration testing
2553eea2e341Smrg# It makes no assumption about the test cases' implementation
2554eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2555eea2e341Smrg#
2556eea2e341Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2557eea2e341Smrg# usually requires less dependencies and may be built and run under less
2558eea2e341Smrg# stringent environments than integration tests.
2559eea2e341Smrg#
2560eea2e341Smrg# Interface to module:
2561eea2e341Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2562eea2e341Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2563eea2e341Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2564eea2e341Smrg#                             'no' user instructs the module not to build tests
2565eea2e341Smrg# parm1:                      specify the default value, yes or no.
2566eea2e341Smrg#
2567eea2e341SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2568eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2569eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2570eea2e341SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2571eea2e341Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2572eea2e341Smrg	[enable_integration_tests=$enableval],
2573eea2e341Smrg	[enable_integration_tests=]_defopt)
2574eea2e341Smrgm4_undefine([_defopt])
2575eea2e341SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2576eea2e341Smrg	[test "x$enable_integration_tests" != xno])
2577eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2578eea2e341SmrgAC_MSG_RESULT([$enable_integration_tests])
2579eea2e341Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580eea2e341Smrg
2581eea2e341Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2582eea2e341Smrg# ----------------------------------------
2583eea2e341Smrg# Minimum version: 1.13.0
2584eea2e341Smrg#
2585eea2e341Smrg# GLib is a library which provides advanced data structures and functions.
2586eea2e341Smrg# This macro enables a module to test for the presence of Glib.
2587eea2e341Smrg#
2588eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2589eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2590eea2e341Smrg#
2591eea2e341Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2592eea2e341Smrg# test support usually requires less dependencies and may be built and run under
2593eea2e341Smrg# less stringent environments than integration tests.
2594eea2e341Smrg#
2595eea2e341Smrg# Interface to module:
2596eea2e341Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2597eea2e341Smrg# with_glib: used in configure.ac to know if GLib has been found
2598eea2e341Smrg# --with-glib:	'yes' user instructs the module to use glib
2599eea2e341Smrg#		'no' user instructs the module not to use glib
2600eea2e341Smrg#
2601eea2e341SmrgAC_DEFUN([XORG_WITH_GLIB],[
2602eea2e341SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2603eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
2604eea2e341SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2605eea2e341Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2606eea2e341Smrg	[with_glib=$withval], [with_glib=]_defopt)
2607eea2e341Smrgm4_undefine([_defopt])
2608eea2e341Smrg
2609eea2e341Smrghave_glib=no
2610eea2e341Smrg# Do not probe GLib if user explicitly disabled unit testing
2611eea2e341Smrgif test "x$enable_unit_tests" != x"no"; then
2612eea2e341Smrg  # Do not probe GLib if user explicitly disabled it
2613eea2e341Smrg  if test "x$with_glib" != x"no"; then
2614eea2e341Smrg    m4_ifval(
2615eea2e341Smrg      [$1],
2616eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2617eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2618eea2e341Smrg    )
2619eea2e341Smrg  fi
2620eea2e341Smrgfi
2621eea2e341Smrg
2622eea2e341Smrg# Not having GLib when unit testing has been explicitly requested is an error
2623eea2e341Smrgif test "x$enable_unit_tests" = x"yes"; then
2624eea2e341Smrg  if test "x$have_glib" = x"no"; then
2625eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626eea2e341Smrg  fi
2627eea2e341Smrgfi
2628eea2e341Smrg
2629eea2e341Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2630eea2e341Smrgif test "x$enable_unit_tests" = x"no"; then
2631eea2e341Smrg  if test "x$with_glib" = x"yes"; then
2632eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2633eea2e341Smrg  fi
2634eea2e341Smrgfi
2635eea2e341Smrg
2636eea2e341Smrg# Not having GLib when it has been explicitly requested is an error
2637eea2e341Smrgif test "x$with_glib" = x"yes"; then
2638eea2e341Smrg  if test "x$have_glib" = x"no"; then
2639eea2e341Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2640eea2e341Smrg  fi
2641eea2e341Smrgfi
2642eea2e341Smrg
2643eea2e341SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2644eea2e341Smrg]) # XORG_WITH_GLIB
2645eea2e341Smrg
2646eea2e341Smrg# XORG_LD_WRAP([required|optional])
2647eea2e341Smrg# ---------------------------------
2648eea2e341Smrg# Minimum version: 1.13.0
2649eea2e341Smrg#
2650eea2e341Smrg# Check if linker supports -wrap, passed via compiler flags
2651eea2e341Smrg#
2652eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2653eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2654eea2e341Smrg#
2655eea2e341Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2656eea2e341Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2657eea2e341Smrg# available, an argument of "optional" allows use when some unit tests require
2658eea2e341Smrg# ld -wrap and others do not.
2659eea2e341Smrg#
2660eea2e341SmrgAC_DEFUN([XORG_LD_WRAP],[
2661eea2e341SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2662eea2e341Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2663eea2e341Smrg                      void __wrap_exit(int status) { return; }],
2664eea2e341Smrg                     [exit(0);])])
2665eea2e341Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2666eea2e341Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2667eea2e341Smrg  if test "x$have_ld_wrap" = x"no"; then
2668eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2669eea2e341Smrg  fi
2670eea2e341Smrgfi
2671eea2e341SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2672eea2e341Smrg#
2673eea2e341Smrg]) # XORG_LD_WRAP
2674eea2e341Smrg
2675eea2e341Smrg# XORG_CHECK_LINKER_FLAGS
2676eea2e341Smrg# -----------------------
2677eea2e341Smrg# SYNOPSIS
2678eea2e341Smrg#
2679eea2e341Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2680eea2e341Smrg#
2681eea2e341Smrg# DESCRIPTION
2682eea2e341Smrg#
2683eea2e341Smrg#   Check whether the given linker FLAGS work with the current language's
2684eea2e341Smrg#   linker, or whether they give an error.
2685eea2e341Smrg#
2686eea2e341Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2687eea2e341Smrg#   success/failure.
2688eea2e341Smrg#
2689eea2e341Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2690eea2e341Smrg#
2691eea2e341Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2692eea2e341Smrg#
2693eea2e341Smrg# LICENSE
2694eea2e341Smrg#
2695eea2e341Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2696eea2e341Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2697eea2e341Smrg#   Copyright (c) 2009 Matteo Frigo
2698eea2e341Smrg#
2699eea2e341Smrg#   This program is free software: you can redistribute it and/or modify it
2700eea2e341Smrg#   under the terms of the GNU General Public License as published by the
2701eea2e341Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2702eea2e341Smrg#   option) any later version.
2703eea2e341Smrg#
2704eea2e341Smrg#   This program is distributed in the hope that it will be useful, but
2705eea2e341Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2706eea2e341Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2707eea2e341Smrg#   Public License for more details.
2708eea2e341Smrg#
2709eea2e341Smrg#   You should have received a copy of the GNU General Public License along
2710eea2e341Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2711eea2e341Smrg#
2712eea2e341Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2713eea2e341Smrg#   gives unlimited permission to copy, distribute and modify the configure
2714eea2e341Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2715eea2e341Smrg#   need not follow the terms of the GNU General Public License when using
2716eea2e341Smrg#   or distributing such scripts, even though portions of the text of the
2717eea2e341Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2718eea2e341Smrg#   all other use of the material that constitutes the Autoconf Macro.
2719eea2e341Smrg#
2720eea2e341Smrg#   This special exception to the GPL applies to versions of the Autoconf
2721eea2e341Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2722eea2e341Smrg#   modified version of the Autoconf Macro, you may extend this special
2723eea2e341Smrg#   exception to the GPL to apply to your modified version as well.#
2724eea2e341SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2725eea2e341Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2726eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2727eea2e341SmrgAS_LITERAL_IF([$1],
2728eea2e341Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2729eea2e341Smrg      ax_save_FLAGS=$LDFLAGS
2730eea2e341Smrg      LDFLAGS="$1"
2731eea2e341Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2732eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2733eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2734eea2e341Smrg      LDFLAGS=$ax_save_FLAGS])],
2735eea2e341Smrg  [ax_save_FLAGS=$LDFLAGS
2736eea2e341Smrg   LDFLAGS="$1"
2737eea2e341Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2738eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2739eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2740eea2e341Smrg   LDFLAGS=$ax_save_FLAGS])
2741eea2e341Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2742eea2e341SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2743eea2e341Smrgif test "x$xorg_check_linker_flags" = xyes; then
2744eea2e341Smrg	m4_default([$2], :)
2745eea2e341Smrgelse
2746eea2e341Smrg	m4_default([$3], :)
2747eea2e341Smrgfi
2748eea2e341Smrg]) # XORG_CHECK_LINKER_FLAGS
2749eea2e341Smrg
2750eea2e341Smrg# XORG_MEMORY_CHECK_FLAGS
2751eea2e341Smrg# -----------------------
2752eea2e341Smrg# Minimum version: 1.16.0
2753eea2e341Smrg#
2754eea2e341Smrg# This macro attempts to find appropriate memory checking functionality
2755eea2e341Smrg# for various platforms which unit testing code may use to catch various
2756eea2e341Smrg# forms of memory allocation and access errors in testing.
2757eea2e341Smrg#
2758eea2e341Smrg# Interface to module:
2759eea2e341Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2760eea2e341Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2761eea2e341Smrg#
2762eea2e341Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2763eea2e341Smrg#
2764eea2e341SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765eea2e341Smrg
2766eea2e341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2767eea2e341SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2768eea2e341Smrg           [Environment variables to enable memory checking in tests])
2769eea2e341Smrg
2770eea2e341Smrg# Check for different types of support on different platforms
2771eea2e341Smrgcase $host_os in
2772eea2e341Smrg    solaris*)
2773eea2e341Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2774eea2e341Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2775eea2e341Smrg        ;;
2776eea2e341Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2777eea2e341Smrg        # both directly and inverted, so should not be 0 or 255.
2778eea2e341Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2779eea2e341Smrg        ;;
2780eea2e341Smrg    darwin*)
2781eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2782eea2e341Smrg        ;;
2783eea2e341Smrg    *bsd*)
2784eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2785eea2e341Smrg        ;;
2786eea2e341Smrgesac
2787eea2e341Smrg
2788eea2e341Smrg# User supplied flags override default flags
2789eea2e341Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2790eea2e341Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791eea2e341Smrgfi
2792eea2e341Smrg
2793eea2e341SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2794eea2e341Smrg]) # XORG_WITH_LINT
2795eea2e341Smrg
279672b4363aSmrg# XORG_CHECK_MALLOC_ZERO
279772b4363aSmrg# ----------------------
279872b4363aSmrg# Minimum version: 1.0.0
279972b4363aSmrg#
280072b4363aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280172b4363aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280272b4363aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280372b4363aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280472b4363aSmrgAC_ARG_ENABLE(malloc0returnsnull,
2805dd77ae96Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280672b4363aSmrg		       [malloc(0) returns NULL (default: auto)]),
280772b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280872b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280972b4363aSmrg
281072b4363aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281172b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281233dddc75SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281333dddc75Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2814eea2e341Smrg#include <stdlib.h>
2815eea2e341Smrg],[
281672b4363aSmrg    char *m0, *r0, *c0, *p;
281772b4363aSmrg    m0 = malloc(0);
281872b4363aSmrg    p = malloc(10);
281972b4363aSmrg    r0 = realloc(p,0);
2820eea2e341Smrg    c0 = calloc(0,10);
2821eea2e341Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2822eea2e341Smrg])],
282333dddc75Smrg		[xorg_cv_malloc0_returns_null=yes],
282433dddc75Smrg		[xorg_cv_malloc0_returns_null=no])])
282533dddc75SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282672b4363aSmrgfi
282772b4363aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282872b4363aSmrg
282972b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283072b4363aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283172b4363aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283272b4363aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283372b4363aSmrgelse
283472b4363aSmrg	MALLOC_ZERO_CFLAGS=""
283572b4363aSmrg	XMALLOC_ZERO_CFLAGS=""
283672b4363aSmrg	XTMALLOC_ZERO_CFLAGS=""
283772b4363aSmrgfi
283872b4363aSmrg
283972b4363aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284072b4363aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284172b4363aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284272b4363aSmrg]) # XORG_CHECK_MALLOC_ZERO
284372b4363aSmrg
284472b4363aSmrg# XORG_WITH_LINT()
284572b4363aSmrg# ----------------
284672b4363aSmrg# Minimum version: 1.1.0
284772b4363aSmrg#
284808e312fdSmrg# This macro enables the use of a tool that flags some suspicious and
284908e312fdSmrg# non-portable constructs (likely to be bugs) in C language source code.
285008e312fdSmrg# It will attempt to locate the tool and use appropriate options.
285108e312fdSmrg# There are various lint type tools on different platforms.
285208e312fdSmrg#
285308e312fdSmrg# Interface to module:
285408e312fdSmrg# LINT:		returns the path to the tool found on the platform
285508e312fdSmrg#		or the value set to LINT on the configure cmd line
285608e312fdSmrg#		also an Automake conditional
285708e312fdSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
285808e312fdSmrg#
285908e312fdSmrg# --with-lint:	'yes' user instructs the module to use lint
286008e312fdSmrg#		'no' user instructs the module not to use lint (default)
286108e312fdSmrg#
286208e312fdSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286308e312fdSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286472b4363aSmrg#
286572b4363aSmrgAC_DEFUN([XORG_WITH_LINT],[
286672b4363aSmrg
286708e312fdSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286808e312fdSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2869dd77ae96SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287072b4363aSmrg		[Use a lint-style source code checker (default: disabled)])],
287172b4363aSmrg		[use_lint=$withval], [use_lint=no])
287208e312fdSmrg
287308e312fdSmrg# Obtain platform specific info like program name and options
287408e312fdSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287508e312fdSmrgcase $host_os in
287608e312fdSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287708e312fdSmrg	lint_name=splint
287808e312fdSmrg	lint_options="-badflag"
287908e312fdSmrg	;;
288008e312fdSmrg  *freebsd* | *netbsd*)
288108e312fdSmrg	lint_name=lint
288208e312fdSmrg	lint_options="-u -b"
288308e312fdSmrg	;;
288408e312fdSmrg  *solaris*)
288508e312fdSmrg	lint_name=lint
288608e312fdSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288708e312fdSmrg	;;
288808e312fdSmrgesac
288908e312fdSmrg
289008e312fdSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289108e312fdSmrgif test "x$use_lint" = x"yes" ; then
289208e312fdSmrg   AC_PATH_PROG([LINT], [$lint_name])
289308e312fdSmrg   if test "x$LINT" = "x"; then
289408e312fdSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289508e312fdSmrg   fi
289608e312fdSmrgelif test "x$use_lint" = x"no" ; then
289708e312fdSmrg   if test "x$LINT" != "x"; then
289808e312fdSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289908e312fdSmrg   fi
290072b4363aSmrgelse
290108e312fdSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290272b4363aSmrgfi
290308e312fdSmrg
290408e312fdSmrg# User supplied flags override default flags
290508e312fdSmrgif test "x$LINT_FLAGS" != "x"; then
290608e312fdSmrg   lint_options=$LINT_FLAGS
290772b4363aSmrgfi
290872b4363aSmrg
290908e312fdSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291008e312fdSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291172b4363aSmrg
291272b4363aSmrg]) # XORG_WITH_LINT
291372b4363aSmrg
291472b4363aSmrg# XORG_LINT_LIBRARY(LIBNAME)
291572b4363aSmrg# --------------------------
291672b4363aSmrg# Minimum version: 1.1.0
291772b4363aSmrg#
291872b4363aSmrg# Sets up flags for building lint libraries for checking programs that call
291972b4363aSmrg# functions in the library.
292072b4363aSmrg#
292108e312fdSmrg# Interface to module:
292208e312fdSmrg# LINTLIB		- Automake variable with the name of lint library file to make
292308e312fdSmrg# MAKE_LINT_LIB		- Automake conditional
292408e312fdSmrg#
292508e312fdSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292608e312fdSmrg#			  - 'no' user instructs the module not to create a lint library (default)
292772b4363aSmrg
292872b4363aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292972b4363aSmrgAC_REQUIRE([XORG_WITH_LINT])
2930dd77ae96SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293172b4363aSmrg	[Create lint library (default: disabled)])],
293272b4363aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293308e312fdSmrg
293408e312fdSmrgif test "x$make_lint_lib" = x"yes" ; then
293508e312fdSmrg   LINTLIB=llib-l$1.ln
293608e312fdSmrg   if test "x$LINT" = "x"; then
293708e312fdSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293808e312fdSmrg   fi
293908e312fdSmrgelif test "x$make_lint_lib" != x"no" ; then
294008e312fdSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294172b4363aSmrgfi
294208e312fdSmrg
294372b4363aSmrgAC_SUBST(LINTLIB)
294472b4363aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294572b4363aSmrg
294672b4363aSmrg]) # XORG_LINT_LIBRARY
294772b4363aSmrg
2948eea2e341Smrg# XORG_COMPILER_BRAND
2949eea2e341Smrg# -------------------
2950eea2e341Smrg# Minimum version: 1.14.0
2951eea2e341Smrg#
2952eea2e341Smrg# Checks for various brands of compilers and sets flags as appropriate:
2953eea2e341Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2954eea2e341Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2955eea2e341Smrg#   clang compiler - sets CLANGCC to "yes"
2956eea2e341Smrg#   Intel compiler - sets INTELCC to "yes"
2957eea2e341Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2958eea2e341Smrg#
2959eea2e341SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2960eea2e341SmrgAC_LANG_CASE(
2961eea2e341Smrg	[C], [
2962eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2963eea2e341Smrg	],
2964eea2e341Smrg	[C++], [
2965eea2e341Smrg		AC_REQUIRE([AC_PROG_CXX])
2966eea2e341Smrg	]
2967eea2e341Smrg)
2968eea2e341SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2969eea2e341SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2970eea2e341SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2971eea2e341Smrg]) # XORG_COMPILER_BRAND
2972eea2e341Smrg
2973eea2e341Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974eea2e341Smrg# ---------------
2975eea2e341Smrg# Minimum version: 1.16.0
2976eea2e341Smrg#
2977eea2e341Smrg# Test if the compiler works when passed the given flag as a command line argument.
2978eea2e341Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2979eea2e341Smrg# next flag in the list until there are no more options.
2980eea2e341Smrg#
2981eea2e341Smrg# Note that this does not guarantee that the compiler supports the flag as some
2982eea2e341Smrg# compilers will simply ignore arguments that they do not understand, but we do
2983eea2e341Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2984eea2e341Smrg# -Werror=unused-command-line-argument
2985eea2e341Smrg#
2986eea2e341SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2987eea2e341Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2988eea2e341Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989eea2e341Smrg
2990eea2e341SmrgAC_LANG_COMPILER_REQUIRE
2991eea2e341Smrg
2992eea2e341SmrgAC_LANG_CASE(
2993eea2e341Smrg	[C], [
2994eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2995eea2e341Smrg		define([PREFIX], [C])
2996eea2e341Smrg		define([CACHE_PREFIX], [cc])
2997eea2e341Smrg		define([COMPILER], [$CC])
2998eea2e341Smrg	],
2999eea2e341Smrg	[C++], [
3000eea2e341Smrg		define([PREFIX], [CXX])
3001eea2e341Smrg		define([CACHE_PREFIX], [cxx])
3002eea2e341Smrg		define([COMPILER], [$CXX])
3003eea2e341Smrg	]
3004eea2e341Smrg)
3005eea2e341Smrg
3006eea2e341Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3007eea2e341Smrg
3008eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3009eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3010eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3011eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3012eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3013eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3014eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3015eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3016eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017eea2e341Smrgfi
3018eea2e341Smrg
3019eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3020eea2e341Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3021eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3022eea2e341Smrg	fi
3023eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3024eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3025eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3026eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3027eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3028eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3029eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3030eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3031eea2e341Smrgfi
3032eea2e341Smrg
3033eea2e341Smrgfound="no"
3034eea2e341Smrgm4_foreach([flag], m4_cdr($@), [
3035eea2e341Smrg	if test $found = "no" ; then
303633dddc75Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3037eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3038eea2e341Smrg		fi
3039eea2e341Smrg
304033dddc75Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3041eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3042eea2e341Smrg		fi
3043eea2e341Smrg
3044eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3045eea2e341Smrg
3046eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304733dddc75Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3048eea2e341Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3049eea2e341Smrg		AC_CACHE_VAL($cacheid,
3050eea2e341Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3051eea2e341Smrg					     [eval $cacheid=yes],
3052eea2e341Smrg					     [eval $cacheid=no])])
3053eea2e341Smrg
3054eea2e341Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3055eea2e341Smrg
3056eea2e341Smrg		eval supported=\$$cacheid
3057eea2e341Smrg		AC_MSG_RESULT([$supported])
3058eea2e341Smrg		if test "$supported" = "yes" ; then
3059eea2e341Smrg			$1="$$1 ]flag["
3060eea2e341Smrg			found="yes"
3061eea2e341Smrg		fi
3062eea2e341Smrg	fi
3063eea2e341Smrg])
3064eea2e341Smrg]) # XORG_TESTSET_CFLAG
3065eea2e341Smrg
3066eea2e341Smrg# XORG_COMPILER_FLAGS
3067eea2e341Smrg# ---------------
3068eea2e341Smrg# Minimum version: 1.16.0
3069eea2e341Smrg#
3070eea2e341Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3071eea2e341Smrg# arguments supported by the selected compiler which do NOT alter the generated
3072eea2e341Smrg# code.  These arguments will cause the compiler to print various warnings
3073eea2e341Smrg# during compilation AND turn a conservative set of warnings into errors.
3074eea2e341Smrg#
3075eea2e341Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3076eea2e341Smrg# future versions of util-macros as options are added to new compilers.
3077eea2e341Smrg#
3078eea2e341SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
3079eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080eea2e341Smrg
3081eea2e341SmrgAC_ARG_ENABLE(selective-werror,
3082eea2e341Smrg              AS_HELP_STRING([--disable-selective-werror],
3083eea2e341Smrg                             [Turn off selective compiler errors. (default: enabled)]),
3084eea2e341Smrg              [SELECTIVE_WERROR=$enableval],
3085eea2e341Smrg              [SELECTIVE_WERROR=yes])
3086eea2e341Smrg
3087eea2e341SmrgAC_LANG_CASE(
3088eea2e341Smrg        [C], [
3089eea2e341Smrg                define([PREFIX], [C])
3090eea2e341Smrg        ],
3091eea2e341Smrg        [C++], [
3092eea2e341Smrg                define([PREFIX], [CXX])
3093eea2e341Smrg        ]
3094eea2e341Smrg)
3095eea2e341Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
3096eea2e341Smrgif test "x$SUNCC" = "xyes"; then
3097eea2e341Smrg    [BASE_]PREFIX[FLAGS]="-v"
3098eea2e341Smrgelse
3099eea2e341Smrg    [BASE_]PREFIX[FLAGS]=""
3100eea2e341Smrgfi
3101eea2e341Smrg
3102eea2e341Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3103eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3104eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3105eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3106eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107eea2e341Smrg
3108eea2e341SmrgAC_LANG_CASE(
3109eea2e341Smrg	[C], [
3110eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3111eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3112eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3113eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311433dddc75Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3115eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3116eea2e341Smrg	]
3117eea2e341Smrg)
3118eea2e341Smrg
3119eea2e341Smrg# This chunk adds additional warnings that could catch undesired effects.
3120eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3121eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3122eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3123eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3124eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3125eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312633dddc75SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127eea2e341Smrg
3128eea2e341Smrg# These are currently disabled because they are noisy.  They will be enabled
3129eea2e341Smrg# in the future once the codebase is sufficiently modernized to silence
3130eea2e341Smrg# them.  For now, I don't want them to drown out the other warnings.
3131eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3132eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313333dddc75Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134eea2e341Smrg
3135eea2e341Smrg# Turn some warnings into errors, so we don't accidently get successful builds
3136eea2e341Smrg# when there are problems that should be fixed.
3137eea2e341Smrg
3138eea2e341Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
3139eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3140eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3141eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3142eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3143eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3144eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3145eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3146eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3147eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3148eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3149eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3150eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3151eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3152eea2e341Smrgelse
3153eea2e341SmrgAC_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])
3154eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3155eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3156eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3157eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3158eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3159eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3160eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3161eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3162eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3163eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3164eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3165eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3166eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3167eea2e341Smrgfi
3168eea2e341Smrg
3169eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3170eea2e341Smrg]) # XORG_COMPILER_FLAGS
3171eea2e341Smrg
3172dd77ae96Smrg# XORG_CWARNFLAGS
3173dd77ae96Smrg# ---------------
3174dd77ae96Smrg# Minimum version: 1.2.0
3175eea2e341Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176dd77ae96Smrg#
3177dd77ae96Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3178dd77ae96Smrg#
3179eea2e341Smrg# This function is deprecated because it defines -fno-strict-aliasing
3180eea2e341Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3181eea2e341Smrg# is needed, then it should be added explicitly in the module when
3182eea2e341Smrg# it is updated to use BASE_CFLAGS.
3183eea2e341Smrg#
3184dd77ae96SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3185eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3186eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3187eea2e341SmrgAC_LANG_CASE(
3188eea2e341Smrg	[C], [
3189eea2e341Smrg		CWARNFLAGS="$BASE_CFLAGS"
3190eea2e341Smrg		if  test "x$GCC" = xyes ; then
3191eea2e341Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3192eea2e341Smrg		fi
3193eea2e341Smrg		AC_SUBST(CWARNFLAGS)
3194eea2e341Smrg	]
3195eea2e341Smrg)
3196dd77ae96Smrg]) # XORG_CWARNFLAGS
3197dd77ae96Smrg
3198dd77ae96Smrg# XORG_STRICT_OPTION
3199dd77ae96Smrg# -----------------------
3200dd77ae96Smrg# Minimum version: 1.3.0
3201dd77ae96Smrg#
3202eea2e341Smrg# Add configure option to enable strict compilation flags, such as treating
3203eea2e341Smrg# warnings as fatal errors.
3204eea2e341Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3205eea2e341Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3206eea2e341Smrg#
3207eea2e341Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3208eea2e341Smrg# when strict compilation is unconditionally desired.
3209dd77ae96SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3210dd77ae96SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3211eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212dd77ae96Smrg
3213dd77ae96SmrgAC_ARG_ENABLE(strict-compilation,
3214dd77ae96Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3215dd77ae96Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3216dd77ae96Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217eea2e341Smrg
3218eea2e341SmrgAC_LANG_CASE(
3219eea2e341Smrg        [C], [
3220eea2e341Smrg                define([PREFIX], [C])
3221eea2e341Smrg        ],
3222eea2e341Smrg        [C++], [
3223eea2e341Smrg                define([PREFIX], [CXX])
3224eea2e341Smrg        ]
3225eea2e341Smrg)
3226eea2e341Smrg
3227eea2e341Smrg[STRICT_]PREFIX[FLAGS]=""
3228eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3229eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230eea2e341Smrg
3231eea2e341Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3232eea2e341Smrg# activate it with -Werror, so we add it here explicitly.
3233eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234eea2e341Smrg
3235dd77ae96Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3236eea2e341Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3237eea2e341Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3238dd77ae96Smrgfi
3239eea2e341SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3240eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3241eea2e341SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3242dd77ae96Smrg]) # XORG_STRICT_OPTION
3243dd77ae96Smrg
3244dd77ae96Smrg# XORG_DEFAULT_OPTIONS
3245dd77ae96Smrg# --------------------
3246dd77ae96Smrg# Minimum version: 1.3.0
3247dd77ae96Smrg#
3248dd77ae96Smrg# Defines default options for X.Org modules.
3249dd77ae96Smrg#
3250dd77ae96SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325108e312fdSmrgAC_REQUIRE([AC_PROG_INSTALL])
3252eea2e341SmrgXORG_COMPILER_FLAGS
3253dd77ae96SmrgXORG_CWARNFLAGS
3254dd77ae96SmrgXORG_STRICT_OPTION
3255dd77ae96SmrgXORG_RELEASE_VERSION
3256dd77ae96SmrgXORG_CHANGELOG
325708e312fdSmrgXORG_INSTALL
3258dd77ae96SmrgXORG_MANPAGE_SECTIONS
325908e312fdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326008e312fdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3261dd77ae96Smrg]) # XORG_DEFAULT_OPTIONS
326208e312fdSmrg
326308e312fdSmrg# XORG_INSTALL()
326408e312fdSmrg# ----------------
326508e312fdSmrg# Minimum version: 1.4.0
326608e312fdSmrg#
326708e312fdSmrg# Defines the variable INSTALL_CMD as the command to copy
326808e312fdSmrg# INSTALL from $prefix/share/util-macros.
326908e312fdSmrg#
327008e312fdSmrgAC_DEFUN([XORG_INSTALL], [
327108e312fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327208e312fdSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327308e312fdSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327408e312fdSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32757ed541caSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32767ed541caSmrgtouch \$(top_srcdir)/INSTALL; \
32777ed541caSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327808e312fdSmrgAC_SUBST([INSTALL_CMD])
327908e312fdSmrg]) # XORG_INSTALL
328072b4363aSmrgdnl Copyright 2005 Red Hat, Inc
328172b4363aSmrgdnl
328272b4363aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328372b4363aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
328472b4363aSmrgdnl the above copyright notice appear in all copies and that both that
328572b4363aSmrgdnl copyright notice and this permission notice appear in supporting
328672b4363aSmrgdnl documentation.
328772b4363aSmrgdnl
328872b4363aSmrgdnl The above copyright notice and this permission notice shall be included
328972b4363aSmrgdnl in all copies or substantial portions of the Software.
329072b4363aSmrgdnl
329172b4363aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329272b4363aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329372b4363aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329472b4363aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329572b4363aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329672b4363aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329772b4363aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
329872b4363aSmrgdnl
329972b4363aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
330072b4363aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
330172b4363aSmrgdnl other dealings in this Software without prior written authorization
330272b4363aSmrgdnl from the copyright holders.
330372b4363aSmrgdnl
330472b4363aSmrg
330572b4363aSmrg# XORG_RELEASE_VERSION
330672b4363aSmrg# --------------------
330708e312fdSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
330833dddc75Smrg
330972b4363aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331072b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331172b4363aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331272b4363aSmrg		[Major version of this package])
3313dd77ae96Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331472b4363aSmrg	if test "x$PVM" = "x"; then
331572b4363aSmrg		PVM="0"
331672b4363aSmrg	fi
331772b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331872b4363aSmrg		[$PVM],
331972b4363aSmrg		[Minor version of this package])
3320dd77ae96Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332172b4363aSmrg	if test "x$PVP" = "x"; then
332272b4363aSmrg		PVP="0"
332372b4363aSmrg	fi
332472b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332572b4363aSmrg		[$PVP],
332672b4363aSmrg		[Patch version of this package])
332772b4363aSmrg])
332872b4363aSmrg
3329dd77ae96Smrg# XORG_CHANGELOG()
3330dd77ae96Smrg# ----------------
3331dd77ae96Smrg# Minimum version: 1.2.0
3332dd77ae96Smrg#
3333dd77ae96Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3334dd77ae96Smrg# ChangeLog from git.
3335dd77ae96Smrg#
3336dd77ae96Smrg#
3337dd77ae96SmrgAC_DEFUN([XORG_CHANGELOG], [
33387ed541caSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333908e312fdSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33407ed541caSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33417ed541caSmrgtouch \$(top_srcdir)/ChangeLog; \
33427ed541caSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3343dd77ae96SmrgAC_SUBST([CHANGELOG_CMD])
3344dd77ae96Smrg]) # XORG_CHANGELOG
3345dd77ae96Smrg
3346