aclocal.m4 revision 14cde9d3
114cde9d3Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2f126e068Smrg
314cde9d3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
48b22bf3fSmrg
58b22bf3fSmrg# This file is free software; the Free Software Foundation
68b22bf3fSmrg# gives unlimited permission to copy and/or distribute it,
78b22bf3fSmrg# with or without modifications, as long as this notice is preserved.
88b22bf3fSmrg
98b22bf3fSmrg# This program is distributed in the hope that it will be useful,
108b22bf3fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
118b22bf3fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
128b22bf3fSmrg# PARTICULAR PURPOSE.
138b22bf3fSmrg
14f126e068Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1596a81b41Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1696a81b41Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1714cde9d3Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1814cde9d3Smrg[m4_warning([this file was generated for autoconf 2.71.
1996a81b41SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2096a81b41SmrgIf you have problems, you may need to regenerate the build system entirely.
21f126e068SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
228b22bf3fSmrg
2314cde9d3Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2414cde9d3Smrg#
2514cde9d3Smrg# This file is free software; the Free Software Foundation
2614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
2714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
28c74b14bdSmrg
2914cde9d3Smrg# AM_AUTOMAKE_VERSION(VERSION)
3014cde9d3Smrg# ----------------------------
3114cde9d3Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3214cde9d3Smrg# generated from the m4 files accompanying Automake X.Y.
3314cde9d3Smrg# (This private macro should not be called outside this file.)
3414cde9d3SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3514cde9d3Smrg[am__api_version='1.16'
3614cde9d3Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3714cde9d3Smrgdnl require some minimum version.  Point them to the right macro.
3814cde9d3Smrgm4_if([$1], [1.16.5], [],
3914cde9d3Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4014cde9d3Smrg])
41c74b14bdSmrg
4214cde9d3Smrg# _AM_AUTOCONF_VERSION(VERSION)
4314cde9d3Smrg# -----------------------------
4414cde9d3Smrg# aclocal traces this macro to find the Autoconf version.
4514cde9d3Smrg# This is a private macro too.  Using m4_define simplifies
4614cde9d3Smrg# the logic in aclocal, which can simply ignore this definition.
4714cde9d3Smrgm4_define([_AM_AUTOCONF_VERSION], [])
488b22bf3fSmrg
4914cde9d3Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5014cde9d3Smrg# -------------------------------
5114cde9d3Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5214cde9d3Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5314cde9d3SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5414cde9d3Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5514cde9d3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5614cde9d3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5714cde9d3Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
588b22bf3fSmrg
5914cde9d3Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
608b22bf3fSmrg
6114cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6214cde9d3Smrg#
6314cde9d3Smrg# This file is free software; the Free Software Foundation
6414cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
6514cde9d3Smrg# with or without modifications, as long as this notice is preserved.
668b22bf3fSmrg
6714cde9d3Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6814cde9d3Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6914cde9d3Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7014cde9d3Smrg#
7114cde9d3Smrg# Of course, Automake must honor this variable whenever it calls a
7214cde9d3Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7314cde9d3Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7414cde9d3Smrg# depending on how configure is run.  This is pretty annoying, since
7514cde9d3Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7614cde9d3Smrg# source directory, any form will work fine, but in subdirectories a
7714cde9d3Smrg# relative path needs to be adjusted first.
7814cde9d3Smrg#
7914cde9d3Smrg# $ac_aux_dir/missing
8014cde9d3Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8114cde9d3Smrg# $top_srcdir/$ac_aux_dir/missing
8214cde9d3Smrg#    fails if $ac_aux_dir is absolute,
8314cde9d3Smrg#    fails when called from a subdirectory in a VPATH build with
8414cde9d3Smrg#          a relative $ac_aux_dir
8514cde9d3Smrg#
8614cde9d3Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8714cde9d3Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8814cde9d3Smrg# harmless because $srcdir is '.', but things will broke when you
8914cde9d3Smrg# start a VPATH build or use an absolute $srcdir.
9014cde9d3Smrg#
9114cde9d3Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9214cde9d3Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9314cde9d3Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9414cde9d3Smrg# and then we would define $MISSING as
9514cde9d3Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9614cde9d3Smrg# This will work as long as MISSING is not called from configure, because
9714cde9d3Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9814cde9d3Smrg# However there are other variables, like CC, which are often used in
9914cde9d3Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10014cde9d3Smrg#
10114cde9d3Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10214cde9d3Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10314cde9d3Smrg# configured tree to be moved without reconfiguration.
1048b22bf3fSmrg
10514cde9d3SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10614cde9d3Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10714cde9d3Smrg# Expand $ac_aux_dir to an absolute path.
10814cde9d3Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10914cde9d3Smrg])
110dfab2fd6Smrg
11114cde9d3Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1128b22bf3fSmrg
11314cde9d3Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11414cde9d3Smrg#
11514cde9d3Smrg# This file is free software; the Free Software Foundation
11614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
11714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
1188b22bf3fSmrg
11914cde9d3Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12014cde9d3Smrg# -------------------------------------
12114cde9d3Smrg# Define a conditional.
12214cde9d3SmrgAC_DEFUN([AM_CONDITIONAL],
12314cde9d3Smrg[AC_PREREQ([2.52])dnl
12414cde9d3Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12514cde9d3Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12614cde9d3SmrgAC_SUBST([$1_TRUE])dnl
12714cde9d3SmrgAC_SUBST([$1_FALSE])dnl
12814cde9d3Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12914cde9d3Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13014cde9d3Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13114cde9d3Smrgif $2; then
13214cde9d3Smrg  $1_TRUE=
13314cde9d3Smrg  $1_FALSE='#'
13414cde9d3Smrgelse
13514cde9d3Smrg  $1_TRUE='#'
13614cde9d3Smrg  $1_FALSE=
13714cde9d3Smrgfi
13814cde9d3SmrgAC_CONFIG_COMMANDS_PRE(
13914cde9d3Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14014cde9d3Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14114cde9d3SmrgUsually this means the macro was only invoked conditionally.]])
14214cde9d3Smrgfi])])
1438b22bf3fSmrg
14414cde9d3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14514cde9d3Smrg#
14614cde9d3Smrg# This file is free software; the Free Software Foundation
14714cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
14814cde9d3Smrg# with or without modifications, as long as this notice is preserved.
1498b22bf3fSmrg
1508b22bf3fSmrg
15114cde9d3Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15214cde9d3Smrg# written in clear, in which case automake, when reading aclocal.m4,
15314cde9d3Smrg# will think it sees a *use*, and therefore will trigger all it's
15414cde9d3Smrg# C support machinery.  Also note that it means that autoscan, seeing
15514cde9d3Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1568b22bf3fSmrg
1578b22bf3fSmrg
15814cde9d3Smrg# _AM_DEPENDENCIES(NAME)
15914cde9d3Smrg# ----------------------
16014cde9d3Smrg# See how the compiler implements dependency checking.
16114cde9d3Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16214cde9d3Smrg# We try a few techniques and use that to set a single cache variable.
16314cde9d3Smrg#
16414cde9d3Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16514cde9d3Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16614cde9d3Smrg# dependency, and given that the user is not expected to run this macro,
16714cde9d3Smrg# just rely on AC_PROG_CC.
16814cde9d3SmrgAC_DEFUN([_AM_DEPENDENCIES],
16914cde9d3Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17014cde9d3SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17114cde9d3SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17214cde9d3SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1738b22bf3fSmrg
17414cde9d3Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17514cde9d3Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17614cde9d3Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17714cde9d3Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17814cde9d3Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17914cde9d3Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18014cde9d3Smrg                    [depcc="$$1"   am_compiler_list=])
1818b22bf3fSmrg
18214cde9d3SmrgAC_CACHE_CHECK([dependency style of $depcc],
18314cde9d3Smrg               [am_cv_$1_dependencies_compiler_type],
18414cde9d3Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18514cde9d3Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18614cde9d3Smrg  # making bogus files that we don't know about and never remove.  For
18714cde9d3Smrg  # instance it was reported that on HP-UX the gcc test will end up
18814cde9d3Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18914cde9d3Smrg  # in D".
19014cde9d3Smrg  rm -rf conftest.dir
19114cde9d3Smrg  mkdir conftest.dir
19214cde9d3Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19314cde9d3Smrg  # using a relative directory.
19414cde9d3Smrg  cp "$am_depcomp" conftest.dir
19514cde9d3Smrg  cd conftest.dir
19614cde9d3Smrg  # We will build objects and dependencies in a subdirectory because
19714cde9d3Smrg  # it helps to detect inapplicable dependency modes.  For instance
19814cde9d3Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19914cde9d3Smrg  # side effect of compilation, but ICC will put the dependencies in
20014cde9d3Smrg  # the current directory while Tru64 will put them in the object
20114cde9d3Smrg  # directory.
20214cde9d3Smrg  mkdir sub
2038b22bf3fSmrg
20414cde9d3Smrg  am_cv_$1_dependencies_compiler_type=none
20514cde9d3Smrg  if test "$am_compiler_list" = ""; then
20614cde9d3Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20714cde9d3Smrg  fi
20814cde9d3Smrg  am__universal=false
20914cde9d3Smrg  m4_case([$1], [CC],
21014cde9d3Smrg    [case " $depcc " in #(
21114cde9d3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21214cde9d3Smrg     esac],
21314cde9d3Smrg    [CXX],
21414cde9d3Smrg    [case " $depcc " in #(
21514cde9d3Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21614cde9d3Smrg     esac])
2178b22bf3fSmrg
21814cde9d3Smrg  for depmode in $am_compiler_list; do
21914cde9d3Smrg    # Setup a source with many dependencies, because some compilers
22014cde9d3Smrg    # like to wrap large dependency lists on column 80 (with \), and
22114cde9d3Smrg    # we should not choose a depcomp mode which is confused by this.
22214cde9d3Smrg    #
22314cde9d3Smrg    # We need to recreate these files for each test, as the compiler may
22414cde9d3Smrg    # overwrite some of them when testing with obscure command lines.
22514cde9d3Smrg    # This happens at least with the AIX C compiler.
22614cde9d3Smrg    : > sub/conftest.c
22714cde9d3Smrg    for i in 1 2 3 4 5 6; do
22814cde9d3Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22914cde9d3Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23014cde9d3Smrg      # Solaris 10 /bin/sh.
23114cde9d3Smrg      echo '/* dummy */' > sub/conftst$i.h
23214cde9d3Smrg    done
23314cde9d3Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23496a81b41Smrg
23514cde9d3Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23614cde9d3Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23714cde9d3Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23814cde9d3Smrg    # versions had trouble with output in subdirs.
23914cde9d3Smrg    am__obj=sub/conftest.${OBJEXT-o}
24014cde9d3Smrg    am__minus_obj="-o $am__obj"
24114cde9d3Smrg    case $depmode in
24214cde9d3Smrg    gcc)
24314cde9d3Smrg      # This depmode causes a compiler race in universal mode.
24414cde9d3Smrg      test "$am__universal" = false || continue
24514cde9d3Smrg      ;;
24614cde9d3Smrg    nosideeffect)
24714cde9d3Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24814cde9d3Smrg      # only be used when explicitly requested.
24914cde9d3Smrg      if test "x$enable_dependency_tracking" = xyes; then
25014cde9d3Smrg	continue
25114cde9d3Smrg      else
25214cde9d3Smrg	break
25314cde9d3Smrg      fi
25414cde9d3Smrg      ;;
25514cde9d3Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25614cde9d3Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25714cde9d3Smrg      # not run yet.  These depmodes are late enough in the game, and
25814cde9d3Smrg      # so weak that their functioning should not be impacted.
25914cde9d3Smrg      am__obj=conftest.${OBJEXT-o}
26014cde9d3Smrg      am__minus_obj=
26114cde9d3Smrg      ;;
26214cde9d3Smrg    none) break ;;
26314cde9d3Smrg    esac
26414cde9d3Smrg    if depmode=$depmode \
26514cde9d3Smrg       source=sub/conftest.c object=$am__obj \
26614cde9d3Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26714cde9d3Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26814cde9d3Smrg         >/dev/null 2>conftest.err &&
26914cde9d3Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27014cde9d3Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27114cde9d3Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27214cde9d3Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27314cde9d3Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27414cde9d3Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27514cde9d3Smrg      # that says an option was ignored or not supported.
27614cde9d3Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27714cde9d3Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27814cde9d3Smrg      # The diagnosis changed in icc 8.0:
27914cde9d3Smrg      #   icc: Command line remark: option '-MP' not supported
28014cde9d3Smrg      if (grep 'ignoring option' conftest.err ||
28114cde9d3Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28214cde9d3Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28314cde9d3Smrg        break
28414cde9d3Smrg      fi
28514cde9d3Smrg    fi
28614cde9d3Smrg  done
2878b22bf3fSmrg
28814cde9d3Smrg  cd ..
28914cde9d3Smrg  rm -rf conftest.dir
29014cde9d3Smrgelse
29114cde9d3Smrg  am_cv_$1_dependencies_compiler_type=none
29214cde9d3Smrgfi
29314cde9d3Smrg])
29414cde9d3SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29514cde9d3SmrgAM_CONDITIONAL([am__fastdep$1], [
29614cde9d3Smrg  test "x$enable_dependency_tracking" != xno \
29714cde9d3Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29814cde9d3Smrg])
2998b22bf3fSmrg
300c74b14bdSmrg
30114cde9d3Smrg# AM_SET_DEPDIR
30214cde9d3Smrg# -------------
30314cde9d3Smrg# Choose a directory name for dependency files.
30414cde9d3Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30514cde9d3SmrgAC_DEFUN([AM_SET_DEPDIR],
30614cde9d3Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30714cde9d3SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30814cde9d3Smrg])
309c74b14bdSmrg
310c74b14bdSmrg
31114cde9d3Smrg# AM_DEP_TRACK
31214cde9d3Smrg# ------------
31314cde9d3SmrgAC_DEFUN([AM_DEP_TRACK],
31414cde9d3Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31514cde9d3SmrgAS_HELP_STRING(
31614cde9d3Smrg  [--enable-dependency-tracking],
31714cde9d3Smrg  [do not reject slow dependency extractors])
31814cde9d3SmrgAS_HELP_STRING(
31914cde9d3Smrg  [--disable-dependency-tracking],
32014cde9d3Smrg  [speeds up one-time build])])
32114cde9d3Smrgif test "x$enable_dependency_tracking" != xno; then
32214cde9d3Smrg  am_depcomp="$ac_aux_dir/depcomp"
32314cde9d3Smrg  AMDEPBACKSLASH='\'
32414cde9d3Smrg  am__nodep='_no'
32514cde9d3Smrgfi
32614cde9d3SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32714cde9d3SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32814cde9d3Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32914cde9d3SmrgAC_SUBST([am__nodep])dnl
33014cde9d3Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33114cde9d3Smrg])
332c74b14bdSmrg
33314cde9d3Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334c74b14bdSmrg
33514cde9d3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336c74b14bdSmrg#
33714cde9d3Smrg# This file is free software; the Free Software Foundation
33814cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
33914cde9d3Smrg# with or without modifications, as long as this notice is preserved.
340c74b14bdSmrg
34114cde9d3Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34214cde9d3Smrg# ------------------------------
34314cde9d3SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34414cde9d3Smrg[{
34514cde9d3Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34614cde9d3Smrg  # are listed without --file.  Let's play safe and only enable the eval
34714cde9d3Smrg  # if we detect the quoting.
34814cde9d3Smrg  # TODO: see whether this extra hack can be removed once we start
34914cde9d3Smrg  # requiring Autoconf 2.70 or later.
35014cde9d3Smrg  AS_CASE([$CONFIG_FILES],
35114cde9d3Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35214cde9d3Smrg          [*], [set x $CONFIG_FILES])
35314cde9d3Smrg  shift
35414cde9d3Smrg  # Used to flag and report bootstrapping failures.
35514cde9d3Smrg  am_rc=0
35614cde9d3Smrg  for am_mf
35714cde9d3Smrg  do
35814cde9d3Smrg    # Strip MF so we end up with the name of the file.
35914cde9d3Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36014cde9d3Smrg    # Check whether this is an Automake generated Makefile which includes
36114cde9d3Smrg    # dependency-tracking related rules and includes.
36214cde9d3Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36314cde9d3Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36414cde9d3Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36514cde9d3Smrg      || continue
36614cde9d3Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36714cde9d3Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36814cde9d3Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36914cde9d3Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37014cde9d3Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37114cde9d3Smrg  done
37214cde9d3Smrg  if test $am_rc -ne 0; then
37314cde9d3Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37414cde9d3Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37514cde9d3Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37614cde9d3Smrg    necessary).  You can also try re-running configure with the
37714cde9d3Smrg    '--disable-dependency-tracking' option to at least be able to build
37814cde9d3Smrg    the package (albeit without support for automatic dependency tracking).])
37914cde9d3Smrg  fi
38014cde9d3Smrg  AS_UNSET([am_dirpart])
38114cde9d3Smrg  AS_UNSET([am_filepart])
38214cde9d3Smrg  AS_UNSET([am_mf])
38314cde9d3Smrg  AS_UNSET([am_rc])
38414cde9d3Smrg  rm -f conftest-deps.mk
38514cde9d3Smrg}
38614cde9d3Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3878b22bf3fSmrg
3888b22bf3fSmrg
38914cde9d3Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39014cde9d3Smrg# -----------------------------
39114cde9d3Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392c74b14bdSmrg#
39314cde9d3Smrg# This code is only required when automatic dependency tracking is enabled.
39414cde9d3Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39514cde9d3Smrg# order to bootstrap the dependency handling code.
39614cde9d3SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39714cde9d3Smrg[AC_CONFIG_COMMANDS([depfiles],
39814cde9d3Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39914cde9d3Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4008b22bf3fSmrg
40114cde9d3Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4028b22bf3fSmrg
40314cde9d3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40414cde9d3Smrg#
40514cde9d3Smrg# This file is free software; the Free Software Foundation
40614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
40714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
4088b22bf3fSmrg
40914cde9d3Smrg# This macro actually does too much.  Some checks are only needed if
41014cde9d3Smrg# your package does certain things.  But this isn't really a big deal.
4118b22bf3fSmrg
41214cde9d3Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41314cde9d3Smrgm4_define([AC_PROG_CC],
41414cde9d3Smrgm4_defn([AC_PROG_CC])
41514cde9d3Smrg[_AM_PROG_CC_C_O
41614cde9d3Smrg])
4178b22bf3fSmrg
41814cde9d3Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41914cde9d3Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42014cde9d3Smrg# -----------------------------------------------
42114cde9d3Smrg# The call with PACKAGE and VERSION arguments is the old style
42214cde9d3Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42314cde9d3Smrg# and VERSION should now be passed to AC_INIT and removed from
42414cde9d3Smrg# the call to AM_INIT_AUTOMAKE.
42514cde9d3Smrg# We support both call styles for the transition.  After
42614cde9d3Smrg# the next Automake release, Autoconf can make the AC_INIT
42714cde9d3Smrg# arguments mandatory, and then we can depend on a new Autoconf
42814cde9d3Smrg# release and drop the old call support.
42914cde9d3SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43014cde9d3Smrg[AC_PREREQ([2.65])dnl
43114cde9d3Smrgm4_ifdef([_$0_ALREADY_INIT],
43214cde9d3Smrg  [m4_fatal([$0 expanded multiple times
43314cde9d3Smrg]m4_defn([_$0_ALREADY_INIT]))],
43414cde9d3Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43514cde9d3Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43614cde9d3Smrgdnl the ones we care about.
43714cde9d3Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43814cde9d3SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43914cde9d3SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44014cde9d3Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44114cde9d3Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44214cde9d3Smrg  # is not polluted with repeated "-I."
44314cde9d3Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44414cde9d3Smrg  # test to see if srcdir already configured
44514cde9d3Smrg  if test -f $srcdir/config.status; then
44614cde9d3Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44714cde9d3Smrg  fi
448c74b14bdSmrgfi
449dfab2fd6Smrg
45014cde9d3Smrg# test whether we have cygpath
45114cde9d3Smrgif test -z "$CYGPATH_W"; then
45214cde9d3Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45314cde9d3Smrg    CYGPATH_W='cygpath -w'
45414cde9d3Smrg  else
45514cde9d3Smrg    CYGPATH_W=echo
45614cde9d3Smrg  fi
457c74b14bdSmrgfi
45814cde9d3SmrgAC_SUBST([CYGPATH_W])
459dfab2fd6Smrg
46014cde9d3Smrg# Define the identity of the package.
46114cde9d3Smrgdnl Distinguish between old-style and new-style calls.
46214cde9d3Smrgm4_ifval([$2],
46314cde9d3Smrg[AC_DIAGNOSE([obsolete],
46414cde9d3Smrg             [$0: two- and three-arguments forms are deprecated.])
46514cde9d3Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46614cde9d3Smrg AC_SUBST([PACKAGE], [$1])dnl
46714cde9d3Smrg AC_SUBST([VERSION], [$2])],
46814cde9d3Smrg[_AM_SET_OPTIONS([$1])dnl
46914cde9d3Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47014cde9d3Smrgm4_if(
47114cde9d3Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47214cde9d3Smrg  [ok:ok],,
47314cde9d3Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47414cde9d3Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47514cde9d3Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476dfab2fd6Smrg
47714cde9d3Smrg_AM_IF_OPTION([no-define],,
47814cde9d3Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47914cde9d3Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480c74b14bdSmrg
48114cde9d3Smrg# Some tools Automake needs.
48214cde9d3SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48314cde9d3SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48414cde9d3SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48514cde9d3SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48614cde9d3SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48714cde9d3SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48814cde9d3SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48914cde9d3SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49014cde9d3SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49114cde9d3SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49214cde9d3Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49314cde9d3Smrg# dies out for good.  For more background, see:
49414cde9d3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49514cde9d3Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49614cde9d3SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49714cde9d3Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49814cde9d3Smrg# system "awk" is bad on some platforms.
49914cde9d3SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50014cde9d3SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50114cde9d3SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50214cde9d3Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50314cde9d3Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50414cde9d3Smrg			     [_AM_PROG_TAR([v7])])])
50514cde9d3Smrg_AM_IF_OPTION([no-dependencies],,
50614cde9d3Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50714cde9d3Smrg		  [_AM_DEPENDENCIES([CC])],
50814cde9d3Smrg		  [m4_define([AC_PROG_CC],
50914cde9d3Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51014cde9d3SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51114cde9d3Smrg		  [_AM_DEPENDENCIES([CXX])],
51214cde9d3Smrg		  [m4_define([AC_PROG_CXX],
51314cde9d3Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51414cde9d3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51514cde9d3Smrg		  [_AM_DEPENDENCIES([OBJC])],
51614cde9d3Smrg		  [m4_define([AC_PROG_OBJC],
51714cde9d3Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51814cde9d3SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51914cde9d3Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52014cde9d3Smrg		  [m4_define([AC_PROG_OBJCXX],
52114cde9d3Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52214cde9d3Smrg])
52314cde9d3Smrg# Variables for tags utilities; see am/tags.am
52414cde9d3Smrgif test -z "$CTAGS"; then
52514cde9d3Smrg  CTAGS=ctags
52614cde9d3Smrgfi
52714cde9d3SmrgAC_SUBST([CTAGS])
52814cde9d3Smrgif test -z "$ETAGS"; then
52914cde9d3Smrg  ETAGS=etags
53014cde9d3Smrgfi
53114cde9d3SmrgAC_SUBST([ETAGS])
53214cde9d3Smrgif test -z "$CSCOPE"; then
53314cde9d3Smrg  CSCOPE=cscope
53414cde9d3Smrgfi
53514cde9d3SmrgAC_SUBST([CSCOPE])
536c74b14bdSmrg
53714cde9d3SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53814cde9d3Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53914cde9d3Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54014cde9d3Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54114cde9d3SmrgAC_CONFIG_COMMANDS_PRE(dnl
54214cde9d3Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54314cde9d3Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544c74b14bdSmrg
54514cde9d3Smrg# POSIX will say in a future version that running "rm -f" with no argument
54614cde9d3Smrg# is OK; and we want to be able to make that assumption in our Makefile
54714cde9d3Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54814cde9d3Smrg# actually supported "in the wild" to an acceptable degree.
54914cde9d3Smrg# See automake bug#10828.
55014cde9d3Smrg# To make any issue more visible, cause the running configure to be aborted
55114cde9d3Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55214cde9d3Smrg# user can still override this though.
55314cde9d3Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55414cde9d3Smrg  cat >&2 <<'END'
55514cde9d3SmrgOops!
5568b22bf3fSmrg
55714cde9d3SmrgYour 'rm' program seems unable to run without file operands specified
55814cde9d3Smrgon the command line, even when the '-f' option is present.  This is contrary
55914cde9d3Smrgto the behaviour of most rm programs out there, and not conforming with
56014cde9d3Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561c74b14bdSmrg
56214cde9d3SmrgPlease tell bug-automake@gnu.org about your system, including the value
56314cde9d3Smrgof your $PATH and any error possibly output before this message.  This
56414cde9d3Smrgcan help us improve future automake versions.
565dfab2fd6Smrg
56614cde9d3SmrgEND
56714cde9d3Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56814cde9d3Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56914cde9d3Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57014cde9d3Smrg    echo >&2
57114cde9d3Smrg  else
57214cde9d3Smrg    cat >&2 <<'END'
57314cde9d3SmrgAborting the configuration process, to ensure you take notice of the issue.
5748b22bf3fSmrg
57514cde9d3SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57614cde9d3Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5778b22bf3fSmrg
57814cde9d3SmrgIf you want to complete the configuration process using your problematic
57914cde9d3Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58014cde9d3Smrgto "yes", and re-run configure.
5818b22bf3fSmrg
58214cde9d3SmrgEND
58314cde9d3Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58414cde9d3Smrg  fi
5858b22bf3fSmrgfi
58614cde9d3Smrgdnl The trailing newline in this macro's definition is deliberate, for
58714cde9d3Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58814cde9d3Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58914cde9d3Smrg])
5908b22bf3fSmrg
59114cde9d3Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59214cde9d3Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59314cde9d3Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59414cde9d3Smrgm4_define([_AC_COMPILER_EXEEXT],
59514cde9d3Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596c74b14bdSmrg
59714cde9d3Smrg# When config.status generates a header, we must update the stamp-h file.
59814cde9d3Smrg# This file resides in the same directory as the config header
59914cde9d3Smrg# that is generated.  The stamp files are numbered to have different names.
600c74b14bdSmrg
60114cde9d3Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60214cde9d3Smrg# loop where config.status creates the headers, so we can generate
60314cde9d3Smrg# our stamp files there.
60414cde9d3SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60514cde9d3Smrg[# Compute $1's index in $config_headers.
60614cde9d3Smrg_am_arg=$1
60714cde9d3Smrg_am_stamp_count=1
60814cde9d3Smrgfor _am_header in $config_headers :; do
60914cde9d3Smrg  case $_am_header in
61014cde9d3Smrg    $_am_arg | $_am_arg:* )
61114cde9d3Smrg      break ;;
61214cde9d3Smrg    * )
61314cde9d3Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61414cde9d3Smrg  esac
61514cde9d3Smrgdone
61614cde9d3Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617c74b14bdSmrg
61814cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61914cde9d3Smrg#
62014cde9d3Smrg# This file is free software; the Free Software Foundation
62114cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
62214cde9d3Smrg# with or without modifications, as long as this notice is preserved.
62314cde9d3Smrg
62414cde9d3Smrg# AM_PROG_INSTALL_SH
62514cde9d3Smrg# ------------------
62614cde9d3Smrg# Define $install_sh.
62714cde9d3SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62814cde9d3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62914cde9d3Smrgif test x"${install_sh+set}" != xset; then
63014cde9d3Smrg  case $am_aux_dir in
63114cde9d3Smrg  *\ * | *\	*)
63214cde9d3Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63314cde9d3Smrg  *)
63414cde9d3Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63514cde9d3Smrg  esac
636f126e068Smrgfi
63714cde9d3SmrgAC_SUBST([install_sh])])
638dfab2fd6Smrg
63914cde9d3Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64014cde9d3Smrg#
64114cde9d3Smrg# This file is free software; the Free Software Foundation
64214cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
64314cde9d3Smrg# with or without modifications, as long as this notice is preserved.
644dfab2fd6Smrg
64514cde9d3Smrg# Check whether the underlying file-system supports filenames
64614cde9d3Smrg# with a leading dot.  For instance MS-DOS doesn't.
64714cde9d3SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64814cde9d3Smrg[rm -rf .tst 2>/dev/null
64914cde9d3Smrgmkdir .tst 2>/dev/null
65014cde9d3Smrgif test -d .tst; then
65114cde9d3Smrg  am__leading_dot=.
65214cde9d3Smrgelse
65314cde9d3Smrg  am__leading_dot=_
65414cde9d3Smrgfi
65514cde9d3Smrgrmdir .tst 2>/dev/null
65614cde9d3SmrgAC_SUBST([am__leading_dot])])
657dfab2fd6Smrg
65814cde9d3Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659f126e068Smrg
66014cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
661c74b14bdSmrg#
66214cde9d3Smrg# This file is free software; the Free Software Foundation
66314cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
66414cde9d3Smrg# with or without modifications, as long as this notice is preserved.
665f126e068Smrg
66614cde9d3Smrg# AM_MAKE_INCLUDE()
66714cde9d3Smrg# -----------------
66814cde9d3Smrg# Check whether make has an 'include' directive that can support all
66914cde9d3Smrg# the idioms we need for our automatic dependency tracking code.
67014cde9d3SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67114cde9d3Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67214cde9d3Smrgcat > confinc.mk << 'END'
67314cde9d3Smrgam__doit:
67414cde9d3Smrg	@echo this is the am__doit target >confinc.out
67514cde9d3Smrg.PHONY: am__doit
67614cde9d3SmrgEND
67714cde9d3Smrgam__include="#"
67814cde9d3Smrgam__quote=
67914cde9d3Smrg# BSD make does it like this.
68014cde9d3Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68114cde9d3Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68214cde9d3Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68314cde9d3Smrg_am_result=no
68414cde9d3Smrgfor s in GNU BSD; do
68514cde9d3Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68614cde9d3Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68714cde9d3Smrg      ['0:this is the am__doit target'],
68814cde9d3Smrg      [AS_CASE([$s],
68914cde9d3Smrg          [BSD], [am__include='.include' am__quote='"'],
69014cde9d3Smrg          [am__include='include' am__quote=''])])
69114cde9d3Smrg  if test "$am__include" != "#"; then
69214cde9d3Smrg    _am_result="yes ($s style)"
69314cde9d3Smrg    break
69414cde9d3Smrg  fi
69514cde9d3Smrgdone
69614cde9d3Smrgrm -f confinc.* confmf.*
69714cde9d3SmrgAC_MSG_RESULT([${_am_result}])
69814cde9d3SmrgAC_SUBST([am__include])])
69914cde9d3SmrgAC_SUBST([am__quote])])
70096a81b41Smrg
70114cde9d3Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7028b22bf3fSmrg
70314cde9d3Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70414cde9d3Smrg#
70514cde9d3Smrg# This file is free software; the Free Software Foundation
70614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
70714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
7088b22bf3fSmrg
70914cde9d3Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71014cde9d3Smrg# ------------------------------
71114cde9d3SmrgAC_DEFUN([AM_MISSING_PROG],
71214cde9d3Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71314cde9d3Smrg$1=${$1-"${am_missing_run}$2"}
71414cde9d3SmrgAC_SUBST($1)])
7158b22bf3fSmrg
71614cde9d3Smrg# AM_MISSING_HAS_RUN
71714cde9d3Smrg# ------------------
71814cde9d3Smrg# Define MISSING if not defined so far and test if it is modern enough.
71914cde9d3Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72014cde9d3SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72114cde9d3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72214cde9d3SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72314cde9d3Smrgif test x"${MISSING+set}" != xset; then
72414cde9d3Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725c74b14bdSmrgfi
72614cde9d3Smrg# Use eval to expand $SHELL
72714cde9d3Smrgif eval "$MISSING --is-lightweight"; then
72814cde9d3Smrg  am_missing_run="$MISSING "
72914cde9d3Smrgelse
73014cde9d3Smrg  am_missing_run=
73114cde9d3Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732c74b14bdSmrgfi
73314cde9d3Smrg])
7348b22bf3fSmrg
73514cde9d3Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7368b22bf3fSmrg
73714cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738c74b14bdSmrg#
73914cde9d3Smrg# This file is free software; the Free Software Foundation
74014cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
74114cde9d3Smrg# with or without modifications, as long as this notice is preserved.
7428b22bf3fSmrg
74314cde9d3Smrg# _AM_MANGLE_OPTION(NAME)
74414cde9d3Smrg# -----------------------
74514cde9d3SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74614cde9d3Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7478b22bf3fSmrg
74814cde9d3Smrg# _AM_SET_OPTION(NAME)
74914cde9d3Smrg# --------------------
75014cde9d3Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75114cde9d3SmrgAC_DEFUN([_AM_SET_OPTION],
75214cde9d3Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7538b22bf3fSmrg
75414cde9d3Smrg# _AM_SET_OPTIONS(OPTIONS)
75514cde9d3Smrg# ------------------------
75614cde9d3Smrg# OPTIONS is a space-separated list of Automake options.
75714cde9d3SmrgAC_DEFUN([_AM_SET_OPTIONS],
75814cde9d3Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759f126e068Smrg
76014cde9d3Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76114cde9d3Smrg# -------------------------------------------
76214cde9d3Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76314cde9d3SmrgAC_DEFUN([_AM_IF_OPTION],
76414cde9d3Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76514cde9d3Smrg
76614cde9d3Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767dfab2fd6Smrg#
76814cde9d3Smrg# This file is free software; the Free Software Foundation
76914cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
77014cde9d3Smrg# with or without modifications, as long as this notice is preserved.
771f126e068Smrg
77214cde9d3Smrg# _AM_PROG_CC_C_O
77314cde9d3Smrg# ---------------
77414cde9d3Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77514cde9d3Smrg# to automatically call this.
77614cde9d3SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77714cde9d3Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77814cde9d3SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77914cde9d3SmrgAC_LANG_PUSH([C])dnl
78014cde9d3SmrgAC_CACHE_CHECK(
78114cde9d3Smrg  [whether $CC understands -c and -o together],
78214cde9d3Smrg  [am_cv_prog_cc_c_o],
78314cde9d3Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78414cde9d3Smrg  # Make sure it works both with $CC and with simple cc.
78514cde9d3Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78614cde9d3Smrg  # compilers refuse to overwrite an existing .o file with -o,
78714cde9d3Smrg  # though they will create one.
78814cde9d3Smrg  am_cv_prog_cc_c_o=yes
78914cde9d3Smrg  for am_i in 1 2; do
79014cde9d3Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79114cde9d3Smrg         && test -f conftest2.$ac_objext; then
79214cde9d3Smrg      : OK
79314cde9d3Smrg    else
79414cde9d3Smrg      am_cv_prog_cc_c_o=no
79514cde9d3Smrg      break
79614cde9d3Smrg    fi
79714cde9d3Smrg  done
79814cde9d3Smrg  rm -f core conftest*
79914cde9d3Smrg  unset am_i])
80014cde9d3Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80114cde9d3Smrg   # Losing compiler, so override with the script.
80214cde9d3Smrg   # FIXME: It is wrong to rewrite CC.
80314cde9d3Smrg   # But if we don't then we get into trouble of one sort or another.
80414cde9d3Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80514cde9d3Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80614cde9d3Smrg   CC="$am_aux_dir/compile $CC"
8078b22bf3fSmrgfi
80814cde9d3SmrgAC_LANG_POP([C])])
8098b22bf3fSmrg
81014cde9d3Smrg# For backward compatibility.
81114cde9d3SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8128b22bf3fSmrg
81314cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814c74b14bdSmrg#
81514cde9d3Smrg# This file is free software; the Free Software Foundation
81614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
81714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
818f126e068Smrg
81914cde9d3Smrg# AM_RUN_LOG(COMMAND)
82014cde9d3Smrg# -------------------
82114cde9d3Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82214cde9d3Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82314cde9d3SmrgAC_DEFUN([AM_RUN_LOG],
82414cde9d3Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82514cde9d3Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82614cde9d3Smrg   ac_status=$?
82714cde9d3Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82814cde9d3Smrg   (exit $ac_status); }])
829f126e068Smrg
83014cde9d3Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831f126e068Smrg
83214cde9d3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833c74b14bdSmrg#
83414cde9d3Smrg# This file is free software; the Free Software Foundation
83514cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
83614cde9d3Smrg# with or without modifications, as long as this notice is preserved.
837f126e068Smrg
83814cde9d3Smrg# AM_SANITY_CHECK
83914cde9d3Smrg# ---------------
84014cde9d3SmrgAC_DEFUN([AM_SANITY_CHECK],
84114cde9d3Smrg[AC_MSG_CHECKING([whether build environment is sane])
84214cde9d3Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84314cde9d3Smrg# name.  Accept space and tab only in the latter.
84414cde9d3Smrgam_lf='
84514cde9d3Smrg'
84614cde9d3Smrgcase `pwd` in
84714cde9d3Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84814cde9d3Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84914cde9d3Smrgesac
85014cde9d3Smrgcase $srcdir in
85114cde9d3Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85214cde9d3Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85314cde9d3Smrgesac
85414cde9d3Smrg
85514cde9d3Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85614cde9d3Smrg# arguments.  Must try -L first in case configure is actually a
85714cde9d3Smrg# symlink; some systems play weird games with the mod time of symlinks
85814cde9d3Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85914cde9d3Smrg# directory).
86014cde9d3Smrgif (
86114cde9d3Smrg   am_has_slept=no
86214cde9d3Smrg   for am_try in 1 2; do
86314cde9d3Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86414cde9d3Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86514cde9d3Smrg     if test "$[*]" = "X"; then
86614cde9d3Smrg	# -L didn't work.
86714cde9d3Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86814cde9d3Smrg     fi
86914cde9d3Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87014cde9d3Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87114cde9d3Smrg
87214cde9d3Smrg	# If neither matched, then we have a broken ls.  This can happen
87314cde9d3Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87414cde9d3Smrg	# broken ls alias from the environment.  This has actually
87514cde9d3Smrg	# happened.  Such a system could not be considered "sane".
87614cde9d3Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87714cde9d3Smrg  alias in your environment])
87814cde9d3Smrg     fi
87914cde9d3Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88014cde9d3Smrg       break
88114cde9d3Smrg     fi
88214cde9d3Smrg     # Just in case.
88314cde9d3Smrg     sleep 1
88414cde9d3Smrg     am_has_slept=yes
88514cde9d3Smrg   done
88614cde9d3Smrg   test "$[2]" = conftest.file
88714cde9d3Smrg   )
88814cde9d3Smrgthen
88914cde9d3Smrg   # Ok.
89014cde9d3Smrg   :
8918b22bf3fSmrgelse
89214cde9d3Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89314cde9d3SmrgCheck your system clock])
894f126e068Smrgfi
89514cde9d3SmrgAC_MSG_RESULT([yes])
89614cde9d3Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89714cde9d3Smrg# generated files are strictly newer.
89814cde9d3Smrgam_sleep_pid=
89914cde9d3Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90014cde9d3Smrg  ( sleep 1 ) &
90114cde9d3Smrg  am_sleep_pid=$!
90214cde9d3Smrgfi
90314cde9d3SmrgAC_CONFIG_COMMANDS_PRE(
90414cde9d3Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90514cde9d3Smrg   if test -n "$am_sleep_pid"; then
90614cde9d3Smrg     # Hide warnings about reused PIDs.
90714cde9d3Smrg     wait $am_sleep_pid 2>/dev/null
90814cde9d3Smrg   fi
90914cde9d3Smrg   AC_MSG_RESULT([done])])
91014cde9d3Smrgrm -f conftest.file
91114cde9d3Smrg])
9128b22bf3fSmrg
91314cde9d3Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914c74b14bdSmrg#
91514cde9d3Smrg# This file is free software; the Free Software Foundation
91614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
91714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
9188b22bf3fSmrg
91914cde9d3Smrg# AM_SILENT_RULES([DEFAULT])
92014cde9d3Smrg# --------------------------
92114cde9d3Smrg# Enable less verbose build rules; with the default set to DEFAULT
92214cde9d3Smrg# ("yes" being less verbose, "no" or empty being verbose).
92314cde9d3SmrgAC_DEFUN([AM_SILENT_RULES],
92414cde9d3Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92514cde9d3SmrgAS_HELP_STRING(
92614cde9d3Smrg  [--enable-silent-rules],
92714cde9d3Smrg  [less verbose build output (undo: "make V=1")])
92814cde9d3SmrgAS_HELP_STRING(
92914cde9d3Smrg  [--disable-silent-rules],
93014cde9d3Smrg  [verbose build output (undo: "make V=0")])dnl
93114cde9d3Smrg])
93214cde9d3Smrgcase $enable_silent_rules in @%:@ (((
93314cde9d3Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93414cde9d3Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93514cde9d3Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93614cde9d3Smrgesac
93714cde9d3Smrgdnl
93814cde9d3Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93914cde9d3Smrgdnl do not support nested variable expansions.
94014cde9d3Smrgdnl See automake bug#9928 and bug#10237.
94114cde9d3Smrgam_make=${MAKE-make}
94214cde9d3SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94314cde9d3Smrg   [am_cv_make_support_nested_variables],
94414cde9d3Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94514cde9d3SmrgBAR0=false
94614cde9d3SmrgBAR1=true
94714cde9d3SmrgV=1
94814cde9d3Smrgam__doit:
94914cde9d3Smrg	@$(TRUE)
95014cde9d3Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95114cde9d3Smrg  am_cv_make_support_nested_variables=yes
952dfab2fd6Smrgelse
95314cde9d3Smrg  am_cv_make_support_nested_variables=no
954dfab2fd6Smrgfi])
95514cde9d3Smrgif test $am_cv_make_support_nested_variables = yes; then
95614cde9d3Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95714cde9d3Smrg  AM_V='$(V)'
95814cde9d3Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95914cde9d3Smrgelse
96014cde9d3Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96114cde9d3Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962f126e068Smrgfi
96314cde9d3SmrgAC_SUBST([AM_V])dnl
96414cde9d3SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96514cde9d3SmrgAC_SUBST([AM_DEFAULT_V])dnl
96614cde9d3SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96714cde9d3SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96814cde9d3SmrgAM_BACKSLASH='\'
96914cde9d3SmrgAC_SUBST([AM_BACKSLASH])dnl
97014cde9d3Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97114cde9d3Smrg])
9728b22bf3fSmrg
97314cde9d3Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974c74b14bdSmrg#
97514cde9d3Smrg# This file is free software; the Free Software Foundation
97614cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
97714cde9d3Smrg# with or without modifications, as long as this notice is preserved.
97814cde9d3Smrg
97914cde9d3Smrg# AM_PROG_INSTALL_STRIP
98014cde9d3Smrg# ---------------------
98114cde9d3Smrg# One issue with vendor 'install' (even GNU) is that you can't
98214cde9d3Smrg# specify the program used to strip binaries.  This is especially
98314cde9d3Smrg# annoying in cross-compiling environments, where the build's strip
98414cde9d3Smrg# is unlikely to handle the host's binaries.
98514cde9d3Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98614cde9d3Smrg# always use install-sh in "make install-strip", and initialize
98714cde9d3Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98814cde9d3SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98914cde9d3Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99014cde9d3Smrg# Installed binaries are usually stripped using 'strip' when the user
99114cde9d3Smrg# run "make install-strip".  However 'strip' might not be the right
99214cde9d3Smrg# tool to use in cross-compilation environments, therefore Automake
99314cde9d3Smrg# will honor the 'STRIP' environment variable to overrule this program.
99414cde9d3Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99514cde9d3Smrgif test "$cross_compiling" != no; then
99614cde9d3Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99714cde9d3Smrgfi
99814cde9d3SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99914cde9d3SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100014cde9d3Smrg
100114cde9d3Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002c74b14bdSmrg#
100314cde9d3Smrg# This file is free software; the Free Software Foundation
100414cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
100514cde9d3Smrg# with or without modifications, as long as this notice is preserved.
100614cde9d3Smrg
100714cde9d3Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100814cde9d3Smrg# ---------------------------
100914cde9d3Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101014cde9d3Smrg# This macro is traced by Automake.
101114cde9d3SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101214cde9d3Smrg
101314cde9d3Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101414cde9d3Smrg# --------------------------
101514cde9d3Smrg# Public sister of _AM_SUBST_NOTMAKE.
101614cde9d3SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101714cde9d3Smrg
101814cde9d3Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101914cde9d3Smrg
102014cde9d3Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021c74b14bdSmrg#
102214cde9d3Smrg# This file is free software; the Free Software Foundation
102314cde9d3Smrg# gives unlimited permission to copy and/or distribute it,
102414cde9d3Smrg# with or without modifications, as long as this notice is preserved.
102514cde9d3Smrg
102614cde9d3Smrg# _AM_PROG_TAR(FORMAT)
102714cde9d3Smrg# --------------------
102814cde9d3Smrg# Check how to create a tarball in format FORMAT.
102914cde9d3Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030c74b14bdSmrg#
103114cde9d3Smrg# Substitute a variable $(am__tar) that is a command
103214cde9d3Smrg# writing to stdout a FORMAT-tarball containing the directory
103314cde9d3Smrg# $tardir.
103414cde9d3Smrg#     tardir=directory && $(am__tar) > result.tar
1035c74b14bdSmrg#
103614cde9d3Smrg# Substitute a variable $(am__untar) that extract such
103714cde9d3Smrg# a tarball read from stdin.
103814cde9d3Smrg#     $(am__untar) < result.tar
1039c74b14bdSmrg#
104014cde9d3SmrgAC_DEFUN([_AM_PROG_TAR],
104114cde9d3Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104214cde9d3Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104314cde9d3SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044f126e068Smrg
104514cde9d3Smrg# We'll loop over all known methods to create a tar archive until one works.
104614cde9d3Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047f126e068Smrg
104814cde9d3Smrgm4_if([$1], [v7],
104914cde9d3Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050f126e068Smrg
105114cde9d3Smrg  [m4_case([$1],
105214cde9d3Smrg    [ustar],
105314cde9d3Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105414cde9d3Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105514cde9d3Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105614cde9d3Smrg      # and bug#13588).
105714cde9d3Smrg      am_max_uid=2097151 # 2^21 - 1
105814cde9d3Smrg      am_max_gid=$am_max_uid
105914cde9d3Smrg      # The $UID and $GID variables are not portable, so we need to resort
106014cde9d3Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106114cde9d3Smrg      # below are definitely unexpected, so allow the users to see them
106214cde9d3Smrg      # (that is, avoid stderr redirection).
106314cde9d3Smrg      am_uid=`id -u || echo unknown`
106414cde9d3Smrg      am_gid=`id -g || echo unknown`
106514cde9d3Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106614cde9d3Smrg      if test $am_uid -le $am_max_uid; then
106714cde9d3Smrg         AC_MSG_RESULT([yes])
106814cde9d3Smrg      else
106914cde9d3Smrg         AC_MSG_RESULT([no])
107014cde9d3Smrg         _am_tools=none
107114cde9d3Smrg      fi
107214cde9d3Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107314cde9d3Smrg      if test $am_gid -le $am_max_gid; then
107414cde9d3Smrg         AC_MSG_RESULT([yes])
107514cde9d3Smrg      else
107614cde9d3Smrg        AC_MSG_RESULT([no])
107714cde9d3Smrg        _am_tools=none
107814cde9d3Smrg      fi],
1079f126e068Smrg
108014cde9d3Smrg  [pax],
108114cde9d3Smrg    [],
108296a81b41Smrg
108314cde9d3Smrg  [m4_fatal([Unknown tar format])])
10848b22bf3fSmrg
108514cde9d3Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086f126e068Smrg
108714cde9d3Smrg  # Go ahead even if we have the value already cached.  We do so because we
108814cde9d3Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108914cde9d3Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109096a81b41Smrg
109114cde9d3Smrg  for _am_tool in $_am_tools; do
109214cde9d3Smrg    case $_am_tool in
109314cde9d3Smrg    gnutar)
109414cde9d3Smrg      for _am_tar in tar gnutar gtar; do
109514cde9d3Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109614cde9d3Smrg      done
109714cde9d3Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109814cde9d3Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109914cde9d3Smrg      am__untar="$_am_tar -xf -"
110014cde9d3Smrg      ;;
110114cde9d3Smrg    plaintar)
110214cde9d3Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110314cde9d3Smrg      # ustar tarball either.
110414cde9d3Smrg      (tar --version) >/dev/null 2>&1 && continue
110514cde9d3Smrg      am__tar='tar chf - "$$tardir"'
110614cde9d3Smrg      am__tar_='tar chf - "$tardir"'
110714cde9d3Smrg      am__untar='tar xf -'
110814cde9d3Smrg      ;;
110914cde9d3Smrg    pax)
111014cde9d3Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111114cde9d3Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111214cde9d3Smrg      am__untar='pax -r'
111314cde9d3Smrg      ;;
111414cde9d3Smrg    cpio)
111514cde9d3Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111614cde9d3Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111714cde9d3Smrg      am__untar='cpio -i -H $1 -d'
111814cde9d3Smrg      ;;
111914cde9d3Smrg    none)
112014cde9d3Smrg      am__tar=false
112114cde9d3Smrg      am__tar_=false
112214cde9d3Smrg      am__untar=false
112314cde9d3Smrg      ;;
112414cde9d3Smrg    esac
112596a81b41Smrg
112614cde9d3Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112714cde9d3Smrg    # and am__untar set.
112814cde9d3Smrg    test -n "${am_cv_prog_tar_$1}" && break
11298b22bf3fSmrg
113014cde9d3Smrg    # tar/untar a dummy directory, and stop if the command works.
113114cde9d3Smrg    rm -rf conftest.dir
113214cde9d3Smrg    mkdir conftest.dir
113314cde9d3Smrg    echo GrepMe > conftest.dir/file
113414cde9d3Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113514cde9d3Smrg    rm -rf conftest.dir
113614cde9d3Smrg    if test -s conftest.tar; then
113714cde9d3Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113814cde9d3Smrg      AM_RUN_LOG([cat conftest.dir/file])
113914cde9d3Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114014cde9d3Smrg    fi
114114cde9d3Smrg  done
114214cde9d3Smrg  rm -rf conftest.dir
1143d13010c3Smrg
114414cde9d3Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114514cde9d3Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146d13010c3Smrg
114714cde9d3SmrgAC_SUBST([am__tar])
114814cde9d3SmrgAC_SUBST([am__untar])
114914cde9d3Smrg]) # _AM_PROG_TAR
1150d13010c3Smrg
115114cde9d3Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115214cde9d3Smrgdnl serial 11 (pkg-config-0.29)
115314cde9d3Smrgdnl
115414cde9d3Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115514cde9d3Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115614cde9d3Smrgdnl
115714cde9d3Smrgdnl This program is free software; you can redistribute it and/or modify
115814cde9d3Smrgdnl it under the terms of the GNU General Public License as published by
115914cde9d3Smrgdnl the Free Software Foundation; either version 2 of the License, or
116014cde9d3Smrgdnl (at your option) any later version.
116114cde9d3Smrgdnl
116214cde9d3Smrgdnl This program is distributed in the hope that it will be useful, but
116314cde9d3Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116414cde9d3Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116514cde9d3Smrgdnl General Public License for more details.
116614cde9d3Smrgdnl
116714cde9d3Smrgdnl You should have received a copy of the GNU General Public License
116814cde9d3Smrgdnl along with this program; if not, write to the Free Software
116914cde9d3Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117014cde9d3Smrgdnl 02111-1307, USA.
117114cde9d3Smrgdnl
117214cde9d3Smrgdnl As a special exception to the GNU General Public License, if you
117314cde9d3Smrgdnl distribute this file as part of a program that contains a
117414cde9d3Smrgdnl configuration script generated by Autoconf, you may include it under
117514cde9d3Smrgdnl the same distribution terms that you use for the rest of that
117614cde9d3Smrgdnl program.
1177d13010c3Smrg
117814cde9d3Smrgdnl PKG_PREREQ(MIN-VERSION)
117914cde9d3Smrgdnl -----------------------
118014cde9d3Smrgdnl Since: 0.29
118114cde9d3Smrgdnl
118214cde9d3Smrgdnl Verify that the version of the pkg-config macros are at least
118314cde9d3Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118414cde9d3Smrgdnl installed version of pkg-config, this checks the developer's version
118514cde9d3Smrgdnl of pkg.m4 when generating configure.
118614cde9d3Smrgdnl
118714cde9d3Smrgdnl To ensure that this macro is defined, also add:
118814cde9d3Smrgdnl m4_ifndef([PKG_PREREQ],
118914cde9d3Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119014cde9d3Smrgdnl
119114cde9d3Smrgdnl See the "Since" comment for each macro you use to see what version
119214cde9d3Smrgdnl of the macros you require.
119314cde9d3Smrgm4_defun([PKG_PREREQ],
119414cde9d3Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119514cde9d3Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119614cde9d3Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119714cde9d3Smrg])dnl PKG_PREREQ
1198d13010c3Smrg
119914cde9d3Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120014cde9d3Smrgdnl ----------------------------------
120114cde9d3Smrgdnl Since: 0.16
120214cde9d3Smrgdnl
120314cde9d3Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120414cde9d3Smrgdnl first found in the path. Checks that the version of pkg-config found
120514cde9d3Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120614cde9d3Smrgdnl used since that's the first version where most current features of
120714cde9d3Smrgdnl pkg-config existed.
120814cde9d3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120914cde9d3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121014cde9d3Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121114cde9d3Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121214cde9d3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121314cde9d3SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121414cde9d3SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12158b22bf3fSmrg
121614cde9d3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121714cde9d3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218f126e068Smrgfi
121914cde9d3Smrgif test -n "$PKG_CONFIG"; then
122014cde9d3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122114cde9d3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122214cde9d3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122314cde9d3Smrg		AC_MSG_RESULT([yes])
122414cde9d3Smrg	else
122514cde9d3Smrg		AC_MSG_RESULT([no])
122614cde9d3Smrg		PKG_CONFIG=""
122714cde9d3Smrg	fi
122814cde9d3Smrgfi[]dnl
122914cde9d3Smrg])dnl PKG_PROG_PKG_CONFIG
1230dfab2fd6Smrg
123114cde9d3Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123214cde9d3Smrgdnl -------------------------------------------------------------------
123314cde9d3Smrgdnl Since: 0.18
123414cde9d3Smrgdnl
123514cde9d3Smrgdnl Check to see whether a particular set of modules exists. Similar to
123614cde9d3Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123714cde9d3Smrgdnl
123814cde9d3Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123914cde9d3Smrgdnl only at the first occurence in configure.ac, so if the first place
124014cde9d3Smrgdnl it's called might be skipped (such as if it is within an "if", you
124114cde9d3Smrgdnl have to call PKG_CHECK_EXISTS manually
124214cde9d3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124314cde9d3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124414cde9d3Smrgif test -n "$PKG_CONFIG" && \
124514cde9d3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124614cde9d3Smrg  m4_default([$2], [:])
124714cde9d3Smrgm4_ifvaln([$3], [else
124814cde9d3Smrg  $3])dnl
124914cde9d3Smrgfi])
12508b22bf3fSmrg
125114cde9d3Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125214cde9d3Smrgdnl ---------------------------------------------
125314cde9d3Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125414cde9d3Smrgdnl pkg_failed based on the result.
125514cde9d3Smrgm4_define([_PKG_CONFIG],
125614cde9d3Smrg[if test -n "$$1"; then
125714cde9d3Smrg    pkg_cv_[]$1="$$1"
125814cde9d3Smrg elif test -n "$PKG_CONFIG"; then
125914cde9d3Smrg    PKG_CHECK_EXISTS([$3],
126014cde9d3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126114cde9d3Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126214cde9d3Smrg		     [pkg_failed=yes])
126314cde9d3Smrg else
126414cde9d3Smrg    pkg_failed=untried
126514cde9d3Smrgfi[]dnl
126614cde9d3Smrg])dnl _PKG_CONFIG
12678b22bf3fSmrg
126814cde9d3Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126914cde9d3Smrgdnl ---------------------------
127014cde9d3Smrgdnl Internal check to see if pkg-config supports short errors.
127114cde9d3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127214cde9d3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127314cde9d3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127414cde9d3Smrg        _pkg_short_errors_supported=yes
1275c74b14bdSmrgelse
127614cde9d3Smrg        _pkg_short_errors_supported=no
127714cde9d3Smrgfi[]dnl
127814cde9d3Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12798b22bf3fSmrg
12808b22bf3fSmrg
128114cde9d3Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128214cde9d3Smrgdnl   [ACTION-IF-NOT-FOUND])
128314cde9d3Smrgdnl --------------------------------------------------------------
128414cde9d3Smrgdnl Since: 0.4.0
128514cde9d3Smrgdnl
128614cde9d3Smrgdnl Note that if there is a possibility the first call to
128714cde9d3Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128814cde9d3Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128914cde9d3SmrgAC_DEFUN([PKG_CHECK_MODULES],
129014cde9d3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129114cde9d3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129214cde9d3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12935bd32fd1Smrg
129414cde9d3Smrgpkg_failed=no
129514cde9d3SmrgAC_MSG_CHECKING([for $1])
12965bd32fd1Smrg
129714cde9d3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129814cde9d3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12995bd32fd1Smrg
130014cde9d3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130114cde9d3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130214cde9d3SmrgSee the pkg-config man page for more details.])
13035bd32fd1Smrg
130414cde9d3Smrgif test $pkg_failed = yes; then
130514cde9d3Smrg   	AC_MSG_RESULT([no])
130614cde9d3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130714cde9d3Smrg        if test $_pkg_short_errors_supported = yes; then
130814cde9d3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130914cde9d3Smrg        else 
131014cde9d3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131114cde9d3Smrg        fi
131214cde9d3Smrg	# Put the nasty error message in config.log where it belongs
131314cde9d3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13148b22bf3fSmrg
131514cde9d3Smrg	m4_default([$4], [AC_MSG_ERROR(
131614cde9d3Smrg[Package requirements ($2) were not met:
13178b22bf3fSmrg
131814cde9d3Smrg$$1_PKG_ERRORS
131914cde9d3Smrg
132014cde9d3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132114cde9d3Smrginstalled software in a non-standard prefix.
132214cde9d3Smrg
132314cde9d3Smrg_PKG_TEXT])[]dnl
132414cde9d3Smrg        ])
132514cde9d3Smrgelif test $pkg_failed = untried; then
132614cde9d3Smrg     	AC_MSG_RESULT([no])
132714cde9d3Smrg	m4_default([$4], [AC_MSG_FAILURE(
132814cde9d3Smrg[The pkg-config script could not be found or is too old.  Make sure it
132914cde9d3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133014cde9d3Smrgpath to pkg-config.
133114cde9d3Smrg
133214cde9d3Smrg_PKG_TEXT
133314cde9d3Smrg
133414cde9d3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133514cde9d3Smrg        ])
13368b22bf3fSmrgelse
133714cde9d3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133814cde9d3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133914cde9d3Smrg        AC_MSG_RESULT([yes])
134014cde9d3Smrg	$3
134114cde9d3Smrgfi[]dnl
134214cde9d3Smrg])dnl PKG_CHECK_MODULES
13438b22bf3fSmrg
13448b22bf3fSmrg
134514cde9d3Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134614cde9d3Smrgdnl   [ACTION-IF-NOT-FOUND])
134714cde9d3Smrgdnl ---------------------------------------------------------------------
134814cde9d3Smrgdnl Since: 0.29
134914cde9d3Smrgdnl
135014cde9d3Smrgdnl Checks for existence of MODULES and gathers its build flags with
135114cde9d3Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135214cde9d3Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135314cde9d3Smrgdnl
135414cde9d3Smrgdnl Note that if there is a possibility the first call to
135514cde9d3Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135614cde9d3Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135714cde9d3Smrgdnl configure.ac.
135814cde9d3SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135914cde9d3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136014cde9d3Smrg_save_PKG_CONFIG=$PKG_CONFIG
136114cde9d3SmrgPKG_CONFIG="$PKG_CONFIG --static"
136214cde9d3SmrgPKG_CHECK_MODULES($@)
136314cde9d3SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136414cde9d3Smrg])dnl PKG_CHECK_MODULES_STATIC
136514cde9d3Smrg
136614cde9d3Smrg
136714cde9d3Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136814cde9d3Smrgdnl -------------------------
136914cde9d3Smrgdnl Since: 0.27
137014cde9d3Smrgdnl
137114cde9d3Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137214cde9d3Smrgdnl should install pkg-config .pc files. By default the directory is
137314cde9d3Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137414cde9d3Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137514cde9d3Smrgdnl parameter.
137614cde9d3SmrgAC_DEFUN([PKG_INSTALLDIR],
137714cde9d3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137814cde9d3Smrgm4_pushdef([pkg_description],
137914cde9d3Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138014cde9d3SmrgAC_ARG_WITH([pkgconfigdir],
138114cde9d3Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138214cde9d3Smrg    [with_pkgconfigdir=]pkg_default)
138314cde9d3SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138414cde9d3Smrgm4_popdef([pkg_default])
138514cde9d3Smrgm4_popdef([pkg_description])
138614cde9d3Smrg])dnl PKG_INSTALLDIR
138714cde9d3Smrg
138814cde9d3Smrg
138914cde9d3Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139014cde9d3Smrgdnl --------------------------------
139114cde9d3Smrgdnl Since: 0.27
139214cde9d3Smrgdnl
139314cde9d3Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139414cde9d3Smrgdnl module should install arch-independent pkg-config .pc files. By
139514cde9d3Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139614cde9d3Smrgdnl changed by passing DIRECTORY. The user can override through the
139714cde9d3Smrgdnl --with-noarch-pkgconfigdir parameter.
139814cde9d3SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139914cde9d3Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140014cde9d3Smrgm4_pushdef([pkg_description],
140114cde9d3Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140214cde9d3SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140314cde9d3Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140414cde9d3Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140514cde9d3SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140614cde9d3Smrgm4_popdef([pkg_default])
140714cde9d3Smrgm4_popdef([pkg_description])
140814cde9d3Smrg])dnl PKG_NOARCH_INSTALLDIR
140914cde9d3Smrg
141014cde9d3Smrg
141114cde9d3Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141214cde9d3Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141314cde9d3Smrgdnl -------------------------------------------
141414cde9d3Smrgdnl Since: 0.28
141514cde9d3Smrgdnl
141614cde9d3Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141714cde9d3SmrgAC_DEFUN([PKG_CHECK_VAR],
141814cde9d3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141914cde9d3SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
142014cde9d3Smrg
142114cde9d3Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142214cde9d3SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
142314cde9d3Smrg
142414cde9d3SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142514cde9d3Smrg])dnl PKG_CHECK_VAR
142614cde9d3Smrg
142714cde9d3Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142814cde9d3Smrgdnl
142914cde9d3Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143014cde9d3Smrgdnl
143114cde9d3Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143214cde9d3Smrgdnl copy of this software and associated documentation files (the "Software"),
143314cde9d3Smrgdnl to deal in the Software without restriction, including without limitation
143414cde9d3Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143514cde9d3Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143614cde9d3Smrgdnl Software is furnished to do so, subject to the following conditions:
143714cde9d3Smrgdnl
143814cde9d3Smrgdnl The above copyright notice and this permission notice (including the next
143914cde9d3Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144014cde9d3Smrgdnl Software.
144114cde9d3Smrgdnl
144214cde9d3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144314cde9d3Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144414cde9d3Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144514cde9d3Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144614cde9d3Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144714cde9d3Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144814cde9d3Smrgdnl DEALINGS IN THE SOFTWARE.
144914cde9d3Smrg
145014cde9d3Smrg# XORG_MACROS_VERSION(required-version)
145114cde9d3Smrg# -------------------------------------
1452c74b14bdSmrg# Minimum version: 1.1.0
14538b22bf3fSmrg#
145414cde9d3Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145514cde9d3Smrg# your configure.ac with the minimum required version, such as:
145614cde9d3Smrg# XORG_MACROS_VERSION(1.1)
1457c74b14bdSmrg#
145814cde9d3Smrg# To ensure that this macro is defined, also add:
145914cde9d3Smrg# m4_ifndef([XORG_MACROS_VERSION],
146014cde9d3Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461c74b14bdSmrg#
1462c74b14bdSmrg#
146314cde9d3Smrg# See the "minimum version" comment for each macro you use to see what
146414cde9d3Smrg# version you require.
146514cde9d3Smrgm4_defun([XORG_MACROS_VERSION],[
146614cde9d3Smrgm4_define([vers_have], [1.20.0])
146714cde9d3Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146814cde9d3Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146914cde9d3Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147014cde9d3Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147114cde9d3Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147214cde9d3Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147314cde9d3Smrgm4_undefine([vers_have])
147414cde9d3Smrgm4_undefine([maj_have])
147514cde9d3Smrgm4_undefine([maj_needed])
147614cde9d3Smrg]) # XORG_MACROS_VERSION
14778b22bf3fSmrg
147814cde9d3Smrg# XORG_PROG_RAWCPP()
147914cde9d3Smrg# ------------------
148014cde9d3Smrg# Minimum version: 1.0.0
148114cde9d3Smrg#
148214cde9d3Smrg# Find cpp program and necessary flags for use in pre-processing text files
148314cde9d3Smrg# such as man pages and config files
148414cde9d3SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148514cde9d3SmrgAC_REQUIRE([AC_PROG_CPP])
148614cde9d3SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148714cde9d3Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14888b22bf3fSmrg
148914cde9d3Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149014cde9d3Smrg# which is not the best choice for supporting other OS'es, but covers most
149114cde9d3Smrg# of the ones we need for now.
149214cde9d3SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149314cde9d3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149414cde9d3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149514cde9d3Smrg	AC_MSG_RESULT([no])
1496c74b14bdSmrgelse
149714cde9d3Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149814cde9d3Smrg		RAWCPPFLAGS=-undef
149914cde9d3Smrg		AC_MSG_RESULT([yes])
150014cde9d3Smrg	# under Cygwin unix is still defined even with -undef
150114cde9d3Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150214cde9d3Smrg		RAWCPPFLAGS="-undef -ansi"
150314cde9d3Smrg		AC_MSG_RESULT([yes, with -ansi])
150414cde9d3Smrg	else
150514cde9d3Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150614cde9d3Smrg	fi
1507f126e068Smrgfi
150814cde9d3Smrgrm -f conftest.$ac_ext
15098b22bf3fSmrg
151014cde9d3SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151114cde9d3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151214cde9d3Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151314cde9d3Smrg	AC_MSG_RESULT([no])
151414cde9d3Smrgelse
151514cde9d3Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151614cde9d3Smrg		TRADITIONALCPPFLAGS="-traditional"
151714cde9d3Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151814cde9d3Smrg		AC_MSG_RESULT([yes])
151914cde9d3Smrg	else
152014cde9d3Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152114cde9d3Smrg	fi
15228b22bf3fSmrgfi
152314cde9d3Smrgrm -f conftest.$ac_ext
152414cde9d3SmrgAC_SUBST(RAWCPPFLAGS)
152514cde9d3SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152614cde9d3Smrg]) # XORG_PROG_RAWCPP
15278b22bf3fSmrg
152814cde9d3Smrg# XORG_MANPAGE_SECTIONS()
152914cde9d3Smrg# -----------------------
153014cde9d3Smrg# Minimum version: 1.0.0
153114cde9d3Smrg#
153214cde9d3Smrg# Determine which sections man pages go in for the different man page types
153314cde9d3Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153414cde9d3Smrg# Not sure if there's any better way than just hardcoding by OS name.
153514cde9d3Smrg# Override default settings by setting environment variables
153614cde9d3Smrg# Added MAN_SUBSTS in version 1.8
153714cde9d3Smrg# Added AC_PROG_SED in version 1.8
15388b22bf3fSmrg
153914cde9d3SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154014cde9d3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154114cde9d3SmrgAC_REQUIRE([AC_PROG_SED])
15428b22bf3fSmrg
154314cde9d3Smrgcase $host_os in
154414cde9d3Smrg    solaris*)
154514cde9d3Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154614cde9d3Smrg        # check for a man page file found in later versions that use
154714cde9d3Smrg        # traditional section numbers instead
154814cde9d3Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154914cde9d3Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
155014cde9d3Smrg        ;;
155114cde9d3Smrg    *) SYSV_MAN_SECTIONS=false ;;
155214cde9d3Smrgesac
15535bd32fd1Smrg
155414cde9d3Smrgif test x$APP_MAN_SUFFIX = x    ; then
155514cde9d3Smrg    APP_MAN_SUFFIX=1
155614cde9d3Smrgfi
155714cde9d3Smrgif test x$APP_MAN_DIR = x    ; then
155814cde9d3Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155914cde9d3Smrgfi
1560c74b14bdSmrg
156114cde9d3Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156214cde9d3Smrg    LIB_MAN_SUFFIX=3
156314cde9d3Smrgfi
156414cde9d3Smrgif test x$LIB_MAN_DIR = x    ; then
156514cde9d3Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15665bd32fd1Smrgfi
15675bd32fd1Smrg
156814cde9d3Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156914cde9d3Smrg    case $SYSV_MAN_SECTIONS in
157014cde9d3Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157114cde9d3Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157214cde9d3Smrg    esac
157314cde9d3Smrgfi
157414cde9d3Smrgif test x$FILE_MAN_DIR = x    ; then
157514cde9d3Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157614cde9d3Smrgfi
1577f126e068Smrg
157814cde9d3Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157914cde9d3Smrg    case $SYSV_MAN_SECTIONS in
158014cde9d3Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158114cde9d3Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158214cde9d3Smrg    esac
158314cde9d3Smrgfi
158414cde9d3Smrgif test x$MISC_MAN_DIR = x    ; then
158514cde9d3Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158614cde9d3Smrgfi
15875bd32fd1Smrg
158814cde9d3Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158914cde9d3Smrg    case $SYSV_MAN_SECTIONS in
159014cde9d3Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159114cde9d3Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159214cde9d3Smrg    esac
159314cde9d3Smrgfi
159414cde9d3Smrgif test x$DRIVER_MAN_DIR = x    ; then
159514cde9d3Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159614cde9d3Smrgfi
1597c74b14bdSmrg
159814cde9d3Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159914cde9d3Smrg    case $SYSV_MAN_SECTIONS in
160014cde9d3Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160114cde9d3Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160214cde9d3Smrg    esac
160314cde9d3Smrgfi
160414cde9d3Smrgif test x$ADMIN_MAN_DIR = x    ; then
160514cde9d3Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160614cde9d3Smrgfi
16075bd32fd1Smrg
16085bd32fd1Smrg
160914cde9d3SmrgAC_SUBST([APP_MAN_SUFFIX])
161014cde9d3SmrgAC_SUBST([LIB_MAN_SUFFIX])
161114cde9d3SmrgAC_SUBST([FILE_MAN_SUFFIX])
161214cde9d3SmrgAC_SUBST([MISC_MAN_SUFFIX])
161314cde9d3SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161414cde9d3SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161514cde9d3SmrgAC_SUBST([APP_MAN_DIR])
161614cde9d3SmrgAC_SUBST([LIB_MAN_DIR])
161714cde9d3SmrgAC_SUBST([FILE_MAN_DIR])
161814cde9d3SmrgAC_SUBST([MISC_MAN_DIR])
161914cde9d3SmrgAC_SUBST([DRIVER_MAN_DIR])
162014cde9d3SmrgAC_SUBST([ADMIN_MAN_DIR])
1621f126e068Smrg
162214cde9d3SmrgXORG_MAN_PAGE="X Version 11"
162314cde9d3SmrgAC_SUBST([XORG_MAN_PAGE])
162414cde9d3SmrgMAN_SUBSTS="\
162514cde9d3Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162614cde9d3Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162714cde9d3Smrg	-e 's|__xservername__|Xorg|g' \
162814cde9d3Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162914cde9d3Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163014cde9d3Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163114cde9d3Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163214cde9d3Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163314cde9d3Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163414cde9d3Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163514cde9d3Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163614cde9d3Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163714cde9d3SmrgAC_SUBST([MAN_SUBSTS])
16385bd32fd1Smrg
163914cde9d3Smrg]) # XORG_MANPAGE_SECTIONS
16405bd32fd1Smrg
164114cde9d3Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164214cde9d3Smrg# ------------------------
164314cde9d3Smrg# Minimum version: 1.7.0
164414cde9d3Smrg#
164514cde9d3Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164614cde9d3Smrg# provided by xorg-sgml-doctools, if installed.
164714cde9d3SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164814cde9d3SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164914cde9d3SmrgXORG_SGML_PATH=
165014cde9d3SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165114cde9d3Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165214cde9d3Smrg    [m4_ifval([$1],[:],
165314cde9d3Smrg        [if test x"$cross_compiling" != x"yes" ; then
165414cde9d3Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165514cde9d3Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165614cde9d3Smrg         fi])
165714cde9d3Smrg    ])
165814cde9d3Smrg
165914cde9d3Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166014cde9d3Smrg# the path and the name of the doc stylesheet
166114cde9d3Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166214cde9d3Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166314cde9d3Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166414cde9d3Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166514cde9d3Smrgelse
166614cde9d3Smrg   AC_MSG_RESULT([no])
1667c74b14bdSmrgfi
1668f126e068Smrg
166914cde9d3SmrgAC_SUBST(XORG_SGML_PATH)
167014cde9d3SmrgAC_SUBST(STYLESHEET_SRCDIR)
167114cde9d3SmrgAC_SUBST(XSL_STYLESHEET)
167214cde9d3SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167314cde9d3Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674c74b14bdSmrg
167514cde9d3Smrg# XORG_CHECK_LINUXDOC
167614cde9d3Smrg# -------------------
167714cde9d3Smrg# Minimum version: 1.0.0
167814cde9d3Smrg#
167914cde9d3Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168014cde9d3Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168114cde9d3Smrg# Whether or not the necessary tools and files are found can be checked
168214cde9d3Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168314cde9d3SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168414cde9d3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168514cde9d3SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686c74b14bdSmrg
168714cde9d3SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688c74b14bdSmrg
168914cde9d3SmrgAC_MSG_CHECKING([whether to build documentation])
1690c74b14bdSmrg
169114cde9d3Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169214cde9d3Smrg   BUILDDOC=yes
169314cde9d3Smrgelse
169414cde9d3Smrg   BUILDDOC=no
169514cde9d3Smrgfi
1696c74b14bdSmrg
169714cde9d3SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698c74b14bdSmrg
169914cde9d3SmrgAC_MSG_RESULT([$BUILDDOC])
1700dfab2fd6Smrg
170114cde9d3SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702c74b14bdSmrg
170314cde9d3Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170414cde9d3Smrg   BUILDPDFDOC=yes
1705f126e068Smrgelse
170614cde9d3Smrg   BUILDPDFDOC=no
1707f126e068Smrgfi
1708dfab2fd6Smrg
170914cde9d3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17105bd32fd1Smrg
171114cde9d3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712c74b14bdSmrg
171314cde9d3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171414cde9d3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171514cde9d3SmrgMAKE_PDF="$PS2PDF"
171614cde9d3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717c74b14bdSmrg
171814cde9d3SmrgAC_SUBST(MAKE_TEXT)
171914cde9d3SmrgAC_SUBST(MAKE_PS)
172014cde9d3SmrgAC_SUBST(MAKE_PDF)
172114cde9d3SmrgAC_SUBST(MAKE_HTML)
172214cde9d3Smrg]) # XORG_CHECK_LINUXDOC
1723c74b14bdSmrg
172414cde9d3Smrg# XORG_CHECK_DOCBOOK
172514cde9d3Smrg# -------------------
172614cde9d3Smrg# Minimum version: 1.0.0
172714cde9d3Smrg#
172814cde9d3Smrg# Checks for the ability to build output formats from SGML DocBook source.
172914cde9d3Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173014cde9d3Smrg# indicates whether the necessary tools and files are found and, if set,
173114cde9d3Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173214cde9d3SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173314cde9d3SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734c74b14bdSmrg
173514cde9d3SmrgBUILDTXTDOC=no
173614cde9d3SmrgBUILDPDFDOC=no
173714cde9d3SmrgBUILDPSDOC=no
173814cde9d3SmrgBUILDHTMLDOC=no
173914cde9d3Smrg
174014cde9d3SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174114cde9d3SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174214cde9d3SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174314cde9d3SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174414cde9d3Smrg
174514cde9d3SmrgAC_MSG_CHECKING([whether to build text documentation])
174614cde9d3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174714cde9d3Smrg   test x$BUILD_TXTDOC != xno; then
174814cde9d3Smrg	BUILDTXTDOC=yes
174914cde9d3Smrgfi
175014cde9d3SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175114cde9d3SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175214cde9d3Smrg
175314cde9d3SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175414cde9d3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175514cde9d3Smrg   test x$BUILD_PDFDOC != xno; then
175614cde9d3Smrg	BUILDPDFDOC=yes
1757f126e068Smrgfi
175814cde9d3SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175914cde9d3SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760dfab2fd6Smrg
176114cde9d3SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176214cde9d3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176314cde9d3Smrg   test x$BUILD_PSDOC != xno; then
176414cde9d3Smrg	BUILDPSDOC=yes
176514cde9d3Smrgfi
176614cde9d3SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176714cde9d3SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768c74b14bdSmrg
176914cde9d3SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177014cde9d3Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177114cde9d3Smrg   test x$BUILD_HTMLDOC != xno; then
177214cde9d3Smrg	BUILDHTMLDOC=yes
177314cde9d3Smrgfi
177414cde9d3SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177514cde9d3SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177614cde9d3Smrg
177714cde9d3SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177814cde9d3SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177914cde9d3SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178014cde9d3SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178114cde9d3Smrg
178214cde9d3SmrgAC_SUBST(MAKE_TEXT)
178314cde9d3SmrgAC_SUBST(MAKE_PS)
178414cde9d3SmrgAC_SUBST(MAKE_PDF)
178514cde9d3SmrgAC_SUBST(MAKE_HTML)
178614cde9d3Smrg]) # XORG_CHECK_DOCBOOK
178714cde9d3Smrg
178814cde9d3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178914cde9d3Smrg# ----------------
179014cde9d3Smrg# Minimum version: 1.5.0
179114cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792f126e068Smrg#
179314cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
179414cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
179514cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179614cde9d3Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179714cde9d3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179814cde9d3Smrg# --with-xmlto assumes 'auto'.
1799f126e068Smrg#
180014cde9d3Smrg# Interface to module:
180114cde9d3Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180214cde9d3Smrg# XMLTO:	returns the path of the xmlto program found
180314cde9d3Smrg#		returns the path set by the user in the environment
180414cde9d3Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180514cde9d3Smrg#		'no' user instructs the module not to use xmlto
1806f126e068Smrg#
180714cde9d3Smrg# Added in version 1.10.0
180814cde9d3Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180914cde9d3Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810f126e068Smrg#
181114cde9d3Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812f126e068Smrg#
181314cde9d3SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181414cde9d3SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181514cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
181614cde9d3SmrgAC_ARG_WITH(xmlto,
181714cde9d3Smrg	AS_HELP_STRING([--with-xmlto],
181814cde9d3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181914cde9d3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182014cde9d3Smrgm4_undefine([_defopt])
18215bd32fd1Smrg
182214cde9d3Smrgif test "x$use_xmlto" = x"auto"; then
182314cde9d3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182414cde9d3Smrg   if test "x$XMLTO" = "x"; then
182514cde9d3Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182614cde9d3Smrg	have_xmlto=no
182714cde9d3Smrg   else
182814cde9d3Smrg        have_xmlto=yes
182914cde9d3Smrg   fi
183014cde9d3Smrgelif test "x$use_xmlto" = x"yes" ; then
183114cde9d3Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183214cde9d3Smrg   if test "x$XMLTO" = "x"; then
183314cde9d3Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183414cde9d3Smrg   fi
183514cde9d3Smrg   have_xmlto=yes
183614cde9d3Smrgelif test "x$use_xmlto" = x"no" ; then
183714cde9d3Smrg   if test "x$XMLTO" != "x"; then
183814cde9d3Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183914cde9d3Smrg   fi
184014cde9d3Smrg   have_xmlto=no
184114cde9d3Smrgelse
184214cde9d3Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184314cde9d3Smrgfi
18445bd32fd1Smrg
184514cde9d3Smrg# Test for a minimum version of xmlto, if provided.
184614cde9d3Smrgm4_ifval([$1],
184714cde9d3Smrg[if test "$have_xmlto" = yes; then
184814cde9d3Smrg    # scrape the xmlto version
184914cde9d3Smrg    AC_MSG_CHECKING([the xmlto version])
185014cde9d3Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185114cde9d3Smrg    AC_MSG_RESULT([$xmlto_version])
185214cde9d3Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185314cde9d3Smrg        [if test "x$use_xmlto" = xauto; then
185414cde9d3Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185514cde9d3Smrg            have_xmlto=no
185614cde9d3Smrg        else
185714cde9d3Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185814cde9d3Smrg        fi])
185914cde9d3Smrgfi])
1860f126e068Smrg
186114cde9d3Smrg# Test for the ability of xmlto to generate a text target
186214cde9d3Smrg#
186314cde9d3Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186414cde9d3Smrg# following test for empty XML docbook files.
186514cde9d3Smrg# For compatibility reasons use the following empty XML docbook file and if
186614cde9d3Smrg# it fails try it again with a non-empty XML file.
186714cde9d3Smrghave_xmlto_text=no
186814cde9d3Smrgcat > conftest.xml << "EOF"
186914cde9d3SmrgEOF
187014cde9d3SmrgAS_IF([test "$have_xmlto" = yes],
187114cde9d3Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187214cde9d3Smrg             [have_xmlto_text=yes],
187314cde9d3Smrg             [# Try it again with a non-empty XML file.
187414cde9d3Smrg              cat > conftest.xml << "EOF"
187514cde9d3Smrg<x></x>
187614cde9d3SmrgEOF
187714cde9d3Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187814cde9d3Smrg                    [have_xmlto_text=yes],
187914cde9d3Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188014cde9d3Smrgrm -f conftest.xml
188114cde9d3SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188214cde9d3SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188314cde9d3Smrg]) # XORG_WITH_XMLTO
1884c74b14bdSmrg
188514cde9d3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188614cde9d3Smrg# --------------------------------------------
188714cde9d3Smrg# Minimum version: 1.12.0
188814cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1889f126e068Smrg#
189014cde9d3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189114cde9d3Smrg# XML-based language used for the transformation of XML documents.
189214cde9d3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189314cde9d3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189414cde9d3Smrg# The XSLT processor is often used as a standalone tool for transformations.
189514cde9d3Smrg# It should not be assumed that this tool is used only to work with documnetation.
189614cde9d3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1897f126e068Smrg#
189814cde9d3Smrg# Interface to module:
189914cde9d3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190014cde9d3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190114cde9d3Smrg#		 returns the path set by the user in the environment
190214cde9d3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190314cde9d3Smrg#		  'no' user instructs the module not to use xsltproc
190414cde9d3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1905f126e068Smrg#
190614cde9d3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1907f126e068Smrg#
190814cde9d3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190914cde9d3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191014cde9d3Smrg# Preserves the interface, should it be implemented later
191114cde9d3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191214cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
191314cde9d3SmrgAC_ARG_WITH(xsltproc,
191414cde9d3Smrg	AS_HELP_STRING([--with-xsltproc],
191514cde9d3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191614cde9d3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191714cde9d3Smrgm4_undefine([_defopt])
1918f126e068Smrg
191914cde9d3Smrgif test "x$use_xsltproc" = x"auto"; then
192014cde9d3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192114cde9d3Smrg   if test "x$XSLTPROC" = "x"; then
192214cde9d3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192314cde9d3Smrg	have_xsltproc=no
192414cde9d3Smrg   else
192514cde9d3Smrg        have_xsltproc=yes
192614cde9d3Smrg   fi
192714cde9d3Smrgelif test "x$use_xsltproc" = x"yes" ; then
192814cde9d3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192914cde9d3Smrg   if test "x$XSLTPROC" = "x"; then
193014cde9d3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193114cde9d3Smrg   fi
193214cde9d3Smrg   have_xsltproc=yes
193314cde9d3Smrgelif test "x$use_xsltproc" = x"no" ; then
193414cde9d3Smrg   if test "x$XSLTPROC" != "x"; then
193514cde9d3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193614cde9d3Smrg   fi
193714cde9d3Smrg   have_xsltproc=no
193814cde9d3Smrgelse
193914cde9d3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194014cde9d3Smrgfi
19415bd32fd1Smrg
194214cde9d3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194314cde9d3Smrg]) # XORG_WITH_XSLTPROC
1944dfab2fd6Smrg
194514cde9d3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194614cde9d3Smrg# ----------------------------------------
194714cde9d3Smrg# Minimum version: 1.15.0
1948f126e068Smrg#
194914cde9d3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195014cde9d3Smrg# scanning arbitrary text files, extracting information from those text files,
195114cde9d3Smrg# and printing reports based on that information.
1952f126e068Smrg#
195314cde9d3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954f126e068Smrg#
195514cde9d3Smrg# Interface to module:
195614cde9d3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195714cde9d3Smrg# PERL:	     returns the path of the perl program found
195814cde9d3Smrg#	     returns the path set by the user in the environment
195914cde9d3Smrg# --with-perl: 'yes' user instructs the module to use perl
196014cde9d3Smrg#	       'no' user instructs the module not to use perl
196114cde9d3Smrg# have_perl: returns yes if perl found in PATH or no
1962f126e068Smrg#
196314cde9d3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196414cde9d3Smrg#
196514cde9d3SmrgAC_DEFUN([XORG_WITH_PERL],[
196614cde9d3SmrgAC_ARG_VAR([PERL], [Path to perl command])
196714cde9d3Smrg# Preserves the interface, should it be implemented later
196814cde9d3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196914cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
197014cde9d3SmrgAC_ARG_WITH(perl,
197114cde9d3Smrg	AS_HELP_STRING([--with-perl],
197214cde9d3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197314cde9d3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197414cde9d3Smrgm4_undefine([_defopt])
1975dfab2fd6Smrg
197614cde9d3Smrgif test "x$use_perl" = x"auto"; then
197714cde9d3Smrg   AC_PATH_PROG([PERL], [perl])
197814cde9d3Smrg   if test "x$PERL" = "x"; then
197914cde9d3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198014cde9d3Smrg	have_perl=no
198114cde9d3Smrg   else
198214cde9d3Smrg        have_perl=yes
198314cde9d3Smrg   fi
198414cde9d3Smrgelif test "x$use_perl" = x"yes" ; then
198514cde9d3Smrg   AC_PATH_PROG([PERL], [perl])
198614cde9d3Smrg   if test "x$PERL" = "x"; then
198714cde9d3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198814cde9d3Smrg   fi
198914cde9d3Smrg   have_perl=yes
199014cde9d3Smrgelif test "x$use_perl" = x"no" ; then
199114cde9d3Smrg   if test "x$PERL" != "x"; then
199214cde9d3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199314cde9d3Smrg   fi
199414cde9d3Smrg   have_perl=no
199514cde9d3Smrgelse
199614cde9d3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199714cde9d3Smrgfi
1998dfab2fd6Smrg
199914cde9d3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200014cde9d3Smrg]) # XORG_WITH_PERL
2001c74b14bdSmrg
200214cde9d3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200314cde9d3Smrg# ----------------
200414cde9d3Smrg# Minimum version: 1.5.0
200514cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006f126e068Smrg#
200714cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
200814cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
200914cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201014cde9d3Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201114cde9d3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201214cde9d3Smrg# --with-asciidoc assumes 'auto'.
2013f126e068Smrg#
201414cde9d3Smrg# Interface to module:
201514cde9d3Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201614cde9d3Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201714cde9d3Smrg#		 returns the path set by the user in the environment
201814cde9d3Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201914cde9d3Smrg#		  'no' user instructs the module not to use asciidoc
2020f126e068Smrg#
202114cde9d3Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022f126e068Smrg#
202314cde9d3SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202414cde9d3SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202514cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
202614cde9d3SmrgAC_ARG_WITH(asciidoc,
202714cde9d3Smrg	AS_HELP_STRING([--with-asciidoc],
202814cde9d3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202914cde9d3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203014cde9d3Smrgm4_undefine([_defopt])
203114cde9d3Smrg
203214cde9d3Smrgif test "x$use_asciidoc" = x"auto"; then
203314cde9d3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203414cde9d3Smrg   if test "x$ASCIIDOC" = "x"; then
203514cde9d3Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203614cde9d3Smrg	have_asciidoc=no
203714cde9d3Smrg   else
203814cde9d3Smrg        have_asciidoc=yes
203914cde9d3Smrg   fi
204014cde9d3Smrgelif test "x$use_asciidoc" = x"yes" ; then
204114cde9d3Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204214cde9d3Smrg   if test "x$ASCIIDOC" = "x"; then
204314cde9d3Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204414cde9d3Smrg   fi
204514cde9d3Smrg   have_asciidoc=yes
204614cde9d3Smrgelif test "x$use_asciidoc" = x"no" ; then
204714cde9d3Smrg   if test "x$ASCIIDOC" != "x"; then
204814cde9d3Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204914cde9d3Smrg   fi
205014cde9d3Smrg   have_asciidoc=no
205114cde9d3Smrgelse
205214cde9d3Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205314cde9d3Smrgfi
205414cde9d3Smrgm4_ifval([$1],
205514cde9d3Smrg[if test "$have_asciidoc" = yes; then
205614cde9d3Smrg    # scrape the asciidoc version
205714cde9d3Smrg    AC_MSG_CHECKING([the asciidoc version])
205814cde9d3Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205914cde9d3Smrg    AC_MSG_RESULT([$asciidoc_version])
206014cde9d3Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206114cde9d3Smrg        [if test "x$use_asciidoc" = xauto; then
206214cde9d3Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206314cde9d3Smrg            have_asciidoc=no
206414cde9d3Smrg        else
206514cde9d3Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206614cde9d3Smrg        fi])
206714cde9d3Smrgfi])
206814cde9d3SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206914cde9d3Smrg]) # XORG_WITH_ASCIIDOC
207014cde9d3Smrg
207114cde9d3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207214cde9d3Smrg# -------------------------------------------
207314cde9d3Smrg# Minimum version: 1.5.0
207414cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207514cde9d3Smrg# Minimum version for optional DOT checking: 1.18.0
2076f126e068Smrg#
207714cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
207814cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
207914cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208014cde9d3Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208114cde9d3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208214cde9d3Smrg# --with-doxygen assumes 'auto'.
208314cde9d3Smrg#
208414cde9d3Smrg# Interface to module:
208514cde9d3Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208614cde9d3Smrg# DOXYGEN:	 returns the path of the doxygen program found
208714cde9d3Smrg#		 returns the path set by the user in the environment
208814cde9d3Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208914cde9d3Smrg#		  'no' user instructs the module not to use doxygen
20905bd32fd1Smrg#
209114cde9d3Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092f126e068Smrg#
209314cde9d3SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209414cde9d3SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209514cde9d3SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209614cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
209714cde9d3SmrgAC_ARG_WITH(doxygen,
209814cde9d3Smrg	AS_HELP_STRING([--with-doxygen],
209914cde9d3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210014cde9d3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210114cde9d3Smrgm4_undefine([_defopt])
2102dfab2fd6Smrg
210314cde9d3Smrgif test "x$use_doxygen" = x"auto"; then
210414cde9d3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210514cde9d3Smrg   if test "x$DOXYGEN" = "x"; then
210614cde9d3Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210714cde9d3Smrg	have_doxygen=no
210814cde9d3Smrg   else
210914cde9d3Smrg        have_doxygen=yes
211014cde9d3Smrg   fi
211114cde9d3Smrgelif test "x$use_doxygen" = x"yes" ; then
211214cde9d3Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211314cde9d3Smrg   if test "x$DOXYGEN" = "x"; then
211414cde9d3Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211514cde9d3Smrg   fi
211614cde9d3Smrg   have_doxygen=yes
211714cde9d3Smrgelif test "x$use_doxygen" = x"no" ; then
211814cde9d3Smrg   if test "x$DOXYGEN" != "x"; then
211914cde9d3Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212014cde9d3Smrg   fi
212114cde9d3Smrg   have_doxygen=no
2122c74b14bdSmrgelse
212314cde9d3Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124c74b14bdSmrgfi
212514cde9d3Smrgm4_ifval([$1],
212614cde9d3Smrg[if test "$have_doxygen" = yes; then
212714cde9d3Smrg    # scrape the doxygen version
212814cde9d3Smrg    AC_MSG_CHECKING([the doxygen version])
212914cde9d3Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213014cde9d3Smrg    AC_MSG_RESULT([$doxygen_version])
213114cde9d3Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213214cde9d3Smrg        [if test "x$use_doxygen" = xauto; then
213314cde9d3Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213414cde9d3Smrg            have_doxygen=no
213514cde9d3Smrg        else
213614cde9d3Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213714cde9d3Smrg        fi])
213814cde9d3Smrgfi])
2139c74b14bdSmrg
214014cde9d3Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214114cde9d3Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214214cde9d3Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214314cde9d3SmrgHAVE_DOT=no
214414cde9d3Smrgif test "x$have_doxygen" = "xyes"; then
214514cde9d3Smrg  AC_PATH_PROG([DOT], [dot])
214614cde9d3Smrg    if test "x$DOT" != "x"; then
214714cde9d3Smrg      HAVE_DOT=yes
214814cde9d3Smrg    fi
214914cde9d3Smrgfi
2150c74b14bdSmrg
215114cde9d3SmrgAC_SUBST([HAVE_DOT])
215214cde9d3SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215314cde9d3SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215414cde9d3Smrg]) # XORG_WITH_DOXYGEN
2155c74b14bdSmrg
215614cde9d3Smrg# XORG_WITH_GROFF([DEFAULT])
215714cde9d3Smrg# ----------------
215814cde9d3Smrg# Minimum version: 1.6.0
215914cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160f126e068Smrg#
216114cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
216214cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
216314cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216414cde9d3Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216514cde9d3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216614cde9d3Smrg# --with-groff assumes 'auto'.
216714cde9d3Smrg#
216814cde9d3Smrg# Interface to module:
216914cde9d3Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217014cde9d3Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217114cde9d3Smrg# HAVE_GROFF_MS: the -ms macros package
217214cde9d3Smrg# GROFF:	 returns the path of the groff program found
217314cde9d3Smrg#		 returns the path set by the user in the environment
217414cde9d3Smrg# --with-groff:	 'yes' user instructs the module to use groff
217514cde9d3Smrg#		 'no' user instructs the module not to use groff
217614cde9d3Smrg#
217714cde9d3Smrg# Added in version 1.9.0:
217814cde9d3Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217914cde9d3Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218014cde9d3Smrg#		   psselect from the psutils package.
218114cde9d3Smrg#		   the ghostcript package. Refer to the grohtml man pages
218214cde9d3Smrg#
218314cde9d3Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218414cde9d3Smrg#
218514cde9d3Smrg# OS and distros often splits groff in a basic and full package, the former
218614cde9d3Smrg# having the groff program and the later having devices, fonts and macros
218714cde9d3Smrg# Checking for the groff executable is not enough.
218814cde9d3Smrg#
218914cde9d3Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219014cde9d3Smrg# unset HAVE_GROFF or GROFF env variables.
219114cde9d3Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219214cde9d3Smrg#
219314cde9d3SmrgAC_DEFUN([XORG_WITH_GROFF],[
219414cde9d3SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219514cde9d3Smrgm4_define([_defopt], m4_default([$1], [auto]))
219614cde9d3SmrgAC_ARG_WITH(groff,
219714cde9d3Smrg	AS_HELP_STRING([--with-groff],
219814cde9d3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219914cde9d3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220014cde9d3Smrgm4_undefine([_defopt])
2201c74b14bdSmrg
220214cde9d3Smrgif test "x$use_groff" = x"auto"; then
220314cde9d3Smrg   AC_PATH_PROG([GROFF], [groff])
220414cde9d3Smrg   if test "x$GROFF" = "x"; then
220514cde9d3Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220614cde9d3Smrg	have_groff=no
220714cde9d3Smrg   else
220814cde9d3Smrg        have_groff=yes
220914cde9d3Smrg   fi
221014cde9d3Smrgelif test "x$use_groff" = x"yes" ; then
221114cde9d3Smrg   AC_PATH_PROG([GROFF], [groff])
221214cde9d3Smrg   if test "x$GROFF" = "x"; then
221314cde9d3Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221414cde9d3Smrg   fi
221514cde9d3Smrg   have_groff=yes
221614cde9d3Smrgelif test "x$use_groff" = x"no" ; then
221714cde9d3Smrg   if test "x$GROFF" != "x"; then
221814cde9d3Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221914cde9d3Smrg   fi
222014cde9d3Smrg   have_groff=no
2221c74b14bdSmrgelse
222214cde9d3Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2223f126e068Smrgfi
22245bd32fd1Smrg
222514cde9d3Smrg# We have groff, test for the presence of the macro packages
222614cde9d3Smrgif test "x$have_groff" = x"yes"; then
222714cde9d3Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222814cde9d3Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222914cde9d3Smrg        groff_ms_works=yes
223014cde9d3Smrg    else
223114cde9d3Smrg        groff_ms_works=no
223214cde9d3Smrg    fi
223314cde9d3Smrg    AC_MSG_RESULT([$groff_ms_works])
223414cde9d3Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223514cde9d3Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223614cde9d3Smrg        groff_mm_works=yes
223714cde9d3Smrg    else
223814cde9d3Smrg        groff_mm_works=no
223914cde9d3Smrg    fi
224014cde9d3Smrg    AC_MSG_RESULT([$groff_mm_works])
224114cde9d3Smrgfi
2242c74b14bdSmrg
224314cde9d3Smrg# We have groff, test for HTML dependencies, one command per package
224414cde9d3Smrgif test "x$have_groff" = x"yes"; then
224514cde9d3Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224614cde9d3Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224714cde9d3Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224814cde9d3Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224914cde9d3Smrg      have_groff_html=yes
225014cde9d3Smrg   else
225114cde9d3Smrg      have_groff_html=no
225214cde9d3Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225314cde9d3Smrg   fi
225414cde9d3Smrgfi
2255c74b14bdSmrg
225614cde9d3Smrg# Set Automake conditionals for Makefiles
225714cde9d3SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225814cde9d3SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225914cde9d3SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226014cde9d3SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226114cde9d3Smrg]) # XORG_WITH_GROFF
2262c74b14bdSmrg
226314cde9d3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226414cde9d3Smrg# ---------------------------------------
226514cde9d3Smrg# Minimum version: 1.6.0
226614cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226714cde9d3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226814cde9d3Smrg#
226914cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
227014cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
227114cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227214cde9d3Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227314cde9d3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227414cde9d3Smrg# --with-fop assumes 'auto'.
227514cde9d3Smrg#
227614cde9d3Smrg# Interface to module:
227714cde9d3Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227814cde9d3Smrg# FOP:	 	returns the path of the fop program found
227914cde9d3Smrg#		returns the path set by the user in the environment
228014cde9d3Smrg# --with-fop: 	'yes' user instructs the module to use fop
228114cde9d3Smrg#		'no' user instructs the module not to use fop
228214cde9d3Smrg#
228314cde9d3Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228414cde9d3Smrg#
228514cde9d3SmrgAC_DEFUN([XORG_WITH_FOP],[
228614cde9d3SmrgAC_ARG_VAR([FOP], [Path to fop command])
228714cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
228814cde9d3SmrgAC_ARG_WITH(fop,
228914cde9d3Smrg	AS_HELP_STRING([--with-fop],
229014cde9d3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229114cde9d3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229214cde9d3Smrgm4_undefine([_defopt])
229314cde9d3Smrg
229414cde9d3Smrgif test "x$use_fop" = x"auto"; then
229514cde9d3Smrg   AC_PATH_PROG([FOP], [fop])
229614cde9d3Smrg   if test "x$FOP" = "x"; then
229714cde9d3Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229814cde9d3Smrg	have_fop=no
229914cde9d3Smrg   else
230014cde9d3Smrg        have_fop=yes
230114cde9d3Smrg   fi
230214cde9d3Smrgelif test "x$use_fop" = x"yes" ; then
230314cde9d3Smrg   AC_PATH_PROG([FOP], [fop])
230414cde9d3Smrg   if test "x$FOP" = "x"; then
230514cde9d3Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230614cde9d3Smrg   fi
230714cde9d3Smrg   have_fop=yes
230814cde9d3Smrgelif test "x$use_fop" = x"no" ; then
230914cde9d3Smrg   if test "x$FOP" != "x"; then
231014cde9d3Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231114cde9d3Smrg   fi
231214cde9d3Smrg   have_fop=no
231314cde9d3Smrgelse
231414cde9d3Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315f126e068Smrgfi
2316c74b14bdSmrg
231714cde9d3Smrg# Test for a minimum version of fop, if provided.
231814cde9d3Smrgm4_ifval([$1],
231914cde9d3Smrg[if test "$have_fop" = yes; then
232014cde9d3Smrg    # scrape the fop version
232114cde9d3Smrg    AC_MSG_CHECKING([for fop minimum version])
232214cde9d3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232314cde9d3Smrg    AC_MSG_RESULT([$fop_version])
232414cde9d3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232514cde9d3Smrg        [if test "x$use_fop" = xauto; then
232614cde9d3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232714cde9d3Smrg            have_fop=no
232814cde9d3Smrg        else
232914cde9d3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233014cde9d3Smrg        fi])
233114cde9d3Smrgfi])
233214cde9d3SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233314cde9d3Smrg]) # XORG_WITH_FOP
2334c74b14bdSmrg
233514cde9d3Smrg# XORG_WITH_M4([MIN-VERSION])
233614cde9d3Smrg# ---------------------------
233714cde9d3Smrg# Minimum version: 1.19.0
2338c74b14bdSmrg#
233914cde9d3Smrg# This macro attempts to locate an m4 macro processor which supports
234014cde9d3Smrg# -I option and is only useful for modules relying on M4 in order to
234114cde9d3Smrg# expand macros in source code files.
234214cde9d3Smrg#
234314cde9d3Smrg# Interface to module:
234414cde9d3Smrg# M4:	 	returns the path of the m4 program found
234514cde9d3Smrg#		returns the path set by the user in the environment
234614cde9d3Smrg#
234714cde9d3SmrgAC_DEFUN([XORG_WITH_M4], [
234814cde9d3SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234914cde9d3Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235014cde9d3Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235114cde9d3Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235214cde9d3Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235314cde9d3Smrg   [$PATH:/usr/gnu/bin])])
2354c74b14bdSmrg
235514cde9d3SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235614cde9d3Smrg]) # XORG_WITH_M4
235714cde9d3Smrg
235814cde9d3Smrg# XORG_WITH_PS2PDF([DEFAULT])
235914cde9d3Smrg# ----------------
236014cde9d3Smrg# Minimum version: 1.6.0
236114cde9d3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236214cde9d3Smrg#
236314cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
236414cde9d3Smrg# not at the appropriate level. This macro enables a module to test for the
236514cde9d3Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236614cde9d3Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236714cde9d3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236814cde9d3Smrg# --with-ps2pdf assumes 'auto'.
236914cde9d3Smrg#
237014cde9d3Smrg# Interface to module:
237114cde9d3Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237214cde9d3Smrg# PS2PDF:	returns the path of the ps2pdf program found
237314cde9d3Smrg#		returns the path set by the user in the environment
237414cde9d3Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237514cde9d3Smrg#		 'no' user instructs the module not to use ps2pdf
237614cde9d3Smrg#
237714cde9d3Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237814cde9d3Smrg#
237914cde9d3SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238014cde9d3SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238114cde9d3Smrgm4_define([_defopt], m4_default([$1], [auto]))
238214cde9d3SmrgAC_ARG_WITH(ps2pdf,
238314cde9d3Smrg	AS_HELP_STRING([--with-ps2pdf],
238414cde9d3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238514cde9d3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238614cde9d3Smrgm4_undefine([_defopt])
2387c74b14bdSmrg
238814cde9d3Smrgif test "x$use_ps2pdf" = x"auto"; then
238914cde9d3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239014cde9d3Smrg   if test "x$PS2PDF" = "x"; then
239114cde9d3Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239214cde9d3Smrg	have_ps2pdf=no
239314cde9d3Smrg   else
239414cde9d3Smrg        have_ps2pdf=yes
239514cde9d3Smrg   fi
239614cde9d3Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239714cde9d3Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239814cde9d3Smrg   if test "x$PS2PDF" = "x"; then
239914cde9d3Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240014cde9d3Smrg   fi
240114cde9d3Smrg   have_ps2pdf=yes
240214cde9d3Smrgelif test "x$use_ps2pdf" = x"no" ; then
240314cde9d3Smrg   if test "x$PS2PDF" != "x"; then
240414cde9d3Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240514cde9d3Smrg   fi
240614cde9d3Smrg   have_ps2pdf=no
240714cde9d3Smrgelse
240814cde9d3Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240914cde9d3Smrgfi
241014cde9d3SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241114cde9d3Smrg]) # XORG_WITH_PS2PDF
2412c74b14bdSmrg
241314cde9d3Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241414cde9d3Smrg# ----------------
241514cde9d3Smrg# Minimum version: 1.6.0
2416c74b14bdSmrg#
241714cde9d3Smrg# Documentation tools are not always available on all platforms and sometimes
241814cde9d3Smrg# not at the appropriate level. This macro enables a builder to skip all
241914cde9d3Smrg# documentation targets except traditional man pages.
242014cde9d3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242114cde9d3Smrg# maximum flexibility in controlling documentation building.
242214cde9d3Smrg# Refer to:
242314cde9d3Smrg# XORG_WITH_XMLTO         --with-xmlto
242414cde9d3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242514cde9d3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242614cde9d3Smrg# XORG_WITH_FOP           --with-fop
242714cde9d3Smrg# XORG_WITH_GROFF         --with-groff
242814cde9d3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242914cde9d3Smrg#
243014cde9d3Smrg# Interface to module:
243114cde9d3Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243214cde9d3Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243314cde9d3Smrg#		 'no' user instructs the module not to generate docs
243414cde9d3Smrg# parm1:	specify the default value, yes or no.
243514cde9d3Smrg#
243614cde9d3SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243714cde9d3Smrgm4_define([docs_default], m4_default([$1], [yes]))
243814cde9d3SmrgAC_ARG_ENABLE(docs,
243914cde9d3Smrg	AS_HELP_STRING([--enable-docs],
244014cde9d3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244114cde9d3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244214cde9d3Smrgm4_undefine([docs_default])
244314cde9d3SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244414cde9d3SmrgAC_MSG_CHECKING([whether to build documentation])
244514cde9d3SmrgAC_MSG_RESULT([$build_docs])
244614cde9d3Smrg]) # XORG_ENABLE_DOCS
2447c74b14bdSmrg
244814cde9d3Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244914cde9d3Smrg# ----------------
245014cde9d3Smrg# Minimum version: 1.6.0
245114cde9d3Smrg#
245214cde9d3Smrg# This macro enables a builder to skip all developer documentation.
245314cde9d3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245414cde9d3Smrg# maximum flexibility in controlling documentation building.
245514cde9d3Smrg# Refer to:
245614cde9d3Smrg# XORG_WITH_XMLTO         --with-xmlto
245714cde9d3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245814cde9d3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245914cde9d3Smrg# XORG_WITH_FOP           --with-fop
246014cde9d3Smrg# XORG_WITH_GROFF         --with-groff
246114cde9d3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246214cde9d3Smrg#
246314cde9d3Smrg# Interface to module:
246414cde9d3Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246514cde9d3Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246614cde9d3Smrg#			'no' user instructs the module not to generate developer docs
246714cde9d3Smrg# parm1:		specify the default value, yes or no.
246814cde9d3Smrg#
246914cde9d3SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247014cde9d3Smrgm4_define([devel_default], m4_default([$1], [yes]))
247114cde9d3SmrgAC_ARG_ENABLE(devel-docs,
247214cde9d3Smrg	AS_HELP_STRING([--enable-devel-docs],
247314cde9d3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247414cde9d3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247514cde9d3Smrgm4_undefine([devel_default])
247614cde9d3SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247714cde9d3SmrgAC_MSG_CHECKING([whether to build developer documentation])
247814cde9d3SmrgAC_MSG_RESULT([$build_devel_docs])
247914cde9d3Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480c74b14bdSmrg
248114cde9d3Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248214cde9d3Smrg# ----------------
248314cde9d3Smrg# Minimum version: 1.6.0
2484c74b14bdSmrg#
248514cde9d3Smrg# This macro enables a builder to skip all functional specification targets.
248614cde9d3Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248714cde9d3Smrg# maximum flexibility in controlling documentation building.
248814cde9d3Smrg# Refer to:
248914cde9d3Smrg# XORG_WITH_XMLTO         --with-xmlto
249014cde9d3Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249114cde9d3Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249214cde9d3Smrg# XORG_WITH_FOP           --with-fop
249314cde9d3Smrg# XORG_WITH_GROFF         --with-groff
249414cde9d3Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249514cde9d3Smrg#
249614cde9d3Smrg# Interface to module:
249714cde9d3Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249814cde9d3Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249914cde9d3Smrg#			'no' user instructs the module not to generate specs
250014cde9d3Smrg# parm1:		specify the default value, yes or no.
250114cde9d3Smrg#
250214cde9d3SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250314cde9d3Smrgm4_define([spec_default], m4_default([$1], [yes]))
250414cde9d3SmrgAC_ARG_ENABLE(specs,
250514cde9d3Smrg	AS_HELP_STRING([--enable-specs],
250614cde9d3Smrg	   [Enable building the specs (default: ]spec_default[)]),
250714cde9d3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250814cde9d3Smrgm4_undefine([spec_default])
250914cde9d3SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251014cde9d3SmrgAC_MSG_CHECKING([whether to build functional specifications])
251114cde9d3SmrgAC_MSG_RESULT([$build_specs])
251214cde9d3Smrg]) # XORG_ENABLE_SPECS
2513c74b14bdSmrg
251414cde9d3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251514cde9d3Smrg# ----------------------------------------------
251614cde9d3Smrg# Minimum version: 1.13.0
251714cde9d3Smrg#
251814cde9d3Smrg# This macro enables a builder to enable/disable unit testing
251914cde9d3Smrg# It makes no assumption about the test cases implementation
252014cde9d3Smrg# Test cases may or may not use Automake "Support for test suites"
252114cde9d3Smrg# They may or may not use the software utility library GLib
252214cde9d3Smrg#
252314cde9d3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252414cde9d3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252514cde9d3Smrg# The variable enable_unit_tests is used by other macros in this file.
252614cde9d3Smrg#
252714cde9d3Smrg# Interface to module:
252814cde9d3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252914cde9d3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253014cde9d3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253114cde9d3Smrg#			'no' user instructs the module not to build tests
253214cde9d3Smrg# parm1:		specify the default value, yes or no.
253314cde9d3Smrg#
253414cde9d3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253514cde9d3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253614cde9d3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253714cde9d3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253814cde9d3Smrgm4_define([_defopt], m4_default([$1], [auto]))
253914cde9d3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254014cde9d3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254114cde9d3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254214cde9d3Smrgm4_undefine([_defopt])
254314cde9d3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254414cde9d3SmrgAC_MSG_CHECKING([whether to build unit test cases])
254514cde9d3SmrgAC_MSG_RESULT([$enable_unit_tests])
254614cde9d3Smrg]) # XORG_ENABLE_UNIT_TESTS
25475bd32fd1Smrg
254814cde9d3Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254914cde9d3Smrg# ------------------------------------------------------
255014cde9d3Smrg# Minimum version: 1.17.0
255114cde9d3Smrg#
255214cde9d3Smrg# This macro enables a builder to enable/disable integration testing
255314cde9d3Smrg# It makes no assumption about the test cases' implementation
255414cde9d3Smrg# Test cases may or may not use Automake "Support for test suites"
255514cde9d3Smrg#
255614cde9d3Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255714cde9d3Smrg# usually requires less dependencies and may be built and run under less
255814cde9d3Smrg# stringent environments than integration tests.
255914cde9d3Smrg#
256014cde9d3Smrg# Interface to module:
256114cde9d3Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256214cde9d3Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256314cde9d3Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256414cde9d3Smrg#                             'no' user instructs the module not to build tests
256514cde9d3Smrg# parm1:                      specify the default value, yes or no.
256614cde9d3Smrg#
256714cde9d3SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256814cde9d3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256914cde9d3Smrgm4_define([_defopt], m4_default([$1], [auto]))
257014cde9d3SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257114cde9d3Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257214cde9d3Smrg	[enable_integration_tests=$enableval],
257314cde9d3Smrg	[enable_integration_tests=]_defopt)
257414cde9d3Smrgm4_undefine([_defopt])
257514cde9d3SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257614cde9d3Smrg	[test "x$enable_integration_tests" != xno])
257714cde9d3SmrgAC_MSG_CHECKING([whether to build unit test cases])
257814cde9d3SmrgAC_MSG_RESULT([$enable_integration_tests])
257914cde9d3Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25805bd32fd1Smrg
258114cde9d3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258214cde9d3Smrg# ----------------------------------------
258314cde9d3Smrg# Minimum version: 1.13.0
258414cde9d3Smrg#
258514cde9d3Smrg# GLib is a library which provides advanced data structures and functions.
258614cde9d3Smrg# This macro enables a module to test for the presence of Glib.
258714cde9d3Smrg#
258814cde9d3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258914cde9d3Smrg# Otherwise the value of $enable_unit_tests is blank.
259014cde9d3Smrg#
259114cde9d3Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259214cde9d3Smrg# test support usually requires less dependencies and may be built and run under
259314cde9d3Smrg# less stringent environments than integration tests.
259414cde9d3Smrg#
259514cde9d3Smrg# Interface to module:
259614cde9d3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259714cde9d3Smrg# with_glib: used in configure.ac to know if GLib has been found
259814cde9d3Smrg# --with-glib:	'yes' user instructs the module to use glib
259914cde9d3Smrg#		'no' user instructs the module not to use glib
260014cde9d3Smrg#
260114cde9d3SmrgAC_DEFUN([XORG_WITH_GLIB],[
260214cde9d3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260314cde9d3Smrgm4_define([_defopt], m4_default([$2], [auto]))
260414cde9d3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260514cde9d3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260614cde9d3Smrg	[with_glib=$withval], [with_glib=]_defopt)
260714cde9d3Smrgm4_undefine([_defopt])
260814cde9d3Smrg
260914cde9d3Smrghave_glib=no
261014cde9d3Smrg# Do not probe GLib if user explicitly disabled unit testing
261114cde9d3Smrgif test "x$enable_unit_tests" != x"no"; then
261214cde9d3Smrg  # Do not probe GLib if user explicitly disabled it
261314cde9d3Smrg  if test "x$with_glib" != x"no"; then
261414cde9d3Smrg    m4_ifval(
261514cde9d3Smrg      [$1],
261614cde9d3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261714cde9d3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261814cde9d3Smrg    )
2619f126e068Smrg  fi
2620f126e068Smrgfi
2621dfab2fd6Smrg
262214cde9d3Smrg# Not having GLib when unit testing has been explicitly requested is an error
262314cde9d3Smrgif test "x$enable_unit_tests" = x"yes"; then
262414cde9d3Smrg  if test "x$have_glib" = x"no"; then
262514cde9d3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626f126e068Smrg  fi
2627f126e068Smrgfi
2628dfab2fd6Smrg
262914cde9d3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263014cde9d3Smrgif test "x$enable_unit_tests" = x"no"; then
263114cde9d3Smrg  if test "x$with_glib" = x"yes"; then
263214cde9d3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263314cde9d3Smrg  fi
263414cde9d3Smrgfi
2635f126e068Smrg
263614cde9d3Smrg# Not having GLib when it has been explicitly requested is an error
263714cde9d3Smrgif test "x$with_glib" = x"yes"; then
263814cde9d3Smrg  if test "x$have_glib" = x"no"; then
263914cde9d3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264014cde9d3Smrg  fi
264114cde9d3Smrgfi
2642dfab2fd6Smrg
264314cde9d3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264414cde9d3Smrg]) # XORG_WITH_GLIB
2645dfab2fd6Smrg
264614cde9d3Smrg# XORG_LD_WRAP([required|optional])
264714cde9d3Smrg# ---------------------------------
264814cde9d3Smrg# Minimum version: 1.13.0
264914cde9d3Smrg#
265014cde9d3Smrg# Check if linker supports -wrap, passed via compiler flags
265114cde9d3Smrg#
265214cde9d3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265314cde9d3Smrg# Otherwise the value of $enable_unit_tests is blank.
265414cde9d3Smrg#
265514cde9d3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265614cde9d3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265714cde9d3Smrg# available, an argument of "optional" allows use when some unit tests require
265814cde9d3Smrg# ld -wrap and others do not.
265914cde9d3Smrg#
266014cde9d3SmrgAC_DEFUN([XORG_LD_WRAP],[
266114cde9d3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266214cde9d3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266314cde9d3Smrg                      void __wrap_exit(int status) { return; }],
266414cde9d3Smrg                     [exit(0);])])
266514cde9d3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266614cde9d3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266714cde9d3Smrg  if test "x$have_ld_wrap" = x"no"; then
266814cde9d3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266914cde9d3Smrg  fi
267014cde9d3Smrgfi
267114cde9d3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267214cde9d3Smrg#
267314cde9d3Smrg]) # XORG_LD_WRAP
2674dfab2fd6Smrg
267514cde9d3Smrg# XORG_CHECK_LINKER_FLAGS
267614cde9d3Smrg# -----------------------
267714cde9d3Smrg# SYNOPSIS
267814cde9d3Smrg#
267914cde9d3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268014cde9d3Smrg#
268114cde9d3Smrg# DESCRIPTION
268214cde9d3Smrg#
268314cde9d3Smrg#   Check whether the given linker FLAGS work with the current language's
268414cde9d3Smrg#   linker, or whether they give an error.
268514cde9d3Smrg#
268614cde9d3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268714cde9d3Smrg#   success/failure.
268814cde9d3Smrg#
268914cde9d3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269014cde9d3Smrg#
269114cde9d3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269214cde9d3Smrg#
269314cde9d3Smrg# LICENSE
269414cde9d3Smrg#
269514cde9d3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269614cde9d3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269714cde9d3Smrg#   Copyright (c) 2009 Matteo Frigo
269814cde9d3Smrg#
269914cde9d3Smrg#   This program is free software: you can redistribute it and/or modify it
270014cde9d3Smrg#   under the terms of the GNU General Public License as published by the
270114cde9d3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270214cde9d3Smrg#   option) any later version.
270314cde9d3Smrg#
270414cde9d3Smrg#   This program is distributed in the hope that it will be useful, but
270514cde9d3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270614cde9d3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270714cde9d3Smrg#   Public License for more details.
270814cde9d3Smrg#
270914cde9d3Smrg#   You should have received a copy of the GNU General Public License along
271014cde9d3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271114cde9d3Smrg#
271214cde9d3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271314cde9d3Smrg#   gives unlimited permission to copy, distribute and modify the configure
271414cde9d3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271514cde9d3Smrg#   need not follow the terms of the GNU General Public License when using
271614cde9d3Smrg#   or distributing such scripts, even though portions of the text of the
271714cde9d3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271814cde9d3Smrg#   all other use of the material that constitutes the Autoconf Macro.
271914cde9d3Smrg#
272014cde9d3Smrg#   This special exception to the GPL applies to versions of the Autoconf
272114cde9d3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272214cde9d3Smrg#   modified version of the Autoconf Macro, you may extend this special
272314cde9d3Smrg#   exception to the GPL to apply to your modified version as well.#
272414cde9d3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272514cde9d3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272614cde9d3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272714cde9d3SmrgAS_LITERAL_IF([$1],
272814cde9d3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272914cde9d3Smrg      ax_save_FLAGS=$LDFLAGS
273014cde9d3Smrg      LDFLAGS="$1"
273114cde9d3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273214cde9d3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273314cde9d3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273414cde9d3Smrg      LDFLAGS=$ax_save_FLAGS])],
273514cde9d3Smrg  [ax_save_FLAGS=$LDFLAGS
273614cde9d3Smrg   LDFLAGS="$1"
273714cde9d3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273814cde9d3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273914cde9d3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274014cde9d3Smrg   LDFLAGS=$ax_save_FLAGS])
274114cde9d3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274214cde9d3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274314cde9d3Smrgif test "x$xorg_check_linker_flags" = xyes; then
274414cde9d3Smrg	m4_default([$2], :)
274514cde9d3Smrgelse
274614cde9d3Smrg	m4_default([$3], :)
274714cde9d3Smrgfi
274814cde9d3Smrg]) # XORG_CHECK_LINKER_FLAGS
2749f126e068Smrg
275014cde9d3Smrg# XORG_MEMORY_CHECK_FLAGS
275114cde9d3Smrg# -----------------------
275214cde9d3Smrg# Minimum version: 1.16.0
275314cde9d3Smrg#
275414cde9d3Smrg# This macro attempts to find appropriate memory checking functionality
275514cde9d3Smrg# for various platforms which unit testing code may use to catch various
275614cde9d3Smrg# forms of memory allocation and access errors in testing.
275714cde9d3Smrg#
275814cde9d3Smrg# Interface to module:
275914cde9d3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276014cde9d3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276114cde9d3Smrg#
276214cde9d3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276314cde9d3Smrg#
276414cde9d3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765c74b14bdSmrg
276614cde9d3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276714cde9d3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276814cde9d3Smrg           [Environment variables to enable memory checking in tests])
27698b22bf3fSmrg
277014cde9d3Smrg# Check for different types of support on different platforms
277114cde9d3Smrgcase $host_os in
277214cde9d3Smrg    solaris*)
277314cde9d3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277414cde9d3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277514cde9d3Smrg        ;;
277614cde9d3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277714cde9d3Smrg        # both directly and inverted, so should not be 0 or 255.
277814cde9d3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277914cde9d3Smrg        ;;
278014cde9d3Smrg    darwin*)
278114cde9d3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278214cde9d3Smrg        ;;
278314cde9d3Smrg    *bsd*)
278414cde9d3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278514cde9d3Smrg        ;;
278614cde9d3Smrgesac
2787f126e068Smrg
278814cde9d3Smrg# User supplied flags override default flags
278914cde9d3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279014cde9d3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279114cde9d3Smrgfi
2792dfab2fd6Smrg
279314cde9d3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279414cde9d3Smrg]) # XORG_WITH_LINT
2795f126e068Smrg
279614cde9d3Smrg# XORG_CHECK_MALLOC_ZERO
279714cde9d3Smrg# ----------------------
279814cde9d3Smrg# Minimum version: 1.0.0
2799c74b14bdSmrg#
280014cde9d3Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280114cde9d3Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280214cde9d3Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280314cde9d3SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280414cde9d3SmrgAC_ARG_ENABLE(malloc0returnsnull,
280514cde9d3Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280614cde9d3Smrg		       [malloc(0) returns NULL (default: auto)]),
280714cde9d3Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280814cde9d3Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809dfab2fd6Smrg
281014cde9d3SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281114cde9d3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281214cde9d3SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281314cde9d3Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281414cde9d3Smrg#include <stdlib.h>
281514cde9d3Smrg],[
281614cde9d3Smrg    char *m0, *r0, *c0, *p;
281714cde9d3Smrg    m0 = malloc(0);
281814cde9d3Smrg    p = malloc(10);
281914cde9d3Smrg    r0 = realloc(p,0);
282014cde9d3Smrg    c0 = calloc(0,10);
282114cde9d3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282214cde9d3Smrg])],
282314cde9d3Smrg		[xorg_cv_malloc0_returns_null=yes],
282414cde9d3Smrg		[xorg_cv_malloc0_returns_null=no])])
282514cde9d3SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826f126e068Smrgfi
282714cde9d3SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828dfab2fd6Smrg
282914cde9d3Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283014cde9d3Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283114cde9d3Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283214cde9d3Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833c74b14bdSmrgelse
283414cde9d3Smrg	MALLOC_ZERO_CFLAGS=""
283514cde9d3Smrg	XMALLOC_ZERO_CFLAGS=""
283614cde9d3Smrg	XTMALLOC_ZERO_CFLAGS=""
2837c74b14bdSmrgfi
2838dfab2fd6Smrg
283914cde9d3SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284014cde9d3SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284114cde9d3SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284214cde9d3Smrg]) # XORG_CHECK_MALLOC_ZERO
2843dfab2fd6Smrg
284414cde9d3Smrg# XORG_WITH_LINT()
284514cde9d3Smrg# ----------------
284614cde9d3Smrg# Minimum version: 1.1.0
2847f126e068Smrg#
284814cde9d3Smrg# This macro enables the use of a tool that flags some suspicious and
284914cde9d3Smrg# non-portable constructs (likely to be bugs) in C language source code.
285014cde9d3Smrg# It will attempt to locate the tool and use appropriate options.
285114cde9d3Smrg# There are various lint type tools on different platforms.
2852f126e068Smrg#
285314cde9d3Smrg# Interface to module:
285414cde9d3Smrg# LINT:		returns the path to the tool found on the platform
285514cde9d3Smrg#		or the value set to LINT on the configure cmd line
285614cde9d3Smrg#		also an Automake conditional
285714cde9d3Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285814cde9d3Smrg#
285914cde9d3Smrg# --with-lint:	'yes' user instructs the module to use lint
286014cde9d3Smrg#		'no' user instructs the module not to use lint (default)
286114cde9d3Smrg#
286214cde9d3Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286314cde9d3Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286414cde9d3Smrg#
286514cde9d3SmrgAC_DEFUN([XORG_WITH_LINT],[
28665bd32fd1Smrg
286714cde9d3SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286814cde9d3SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286914cde9d3SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287014cde9d3Smrg		[Use a lint-style source code checker (default: disabled)])],
287114cde9d3Smrg		[use_lint=$withval], [use_lint=no])
2872f126e068Smrg
287314cde9d3Smrg# Obtain platform specific info like program name and options
287414cde9d3Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287514cde9d3Smrgcase $host_os in
287614cde9d3Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287714cde9d3Smrg	lint_name=splint
287814cde9d3Smrg	lint_options="-badflag"
287914cde9d3Smrg	;;
288014cde9d3Smrg  *freebsd* | *netbsd*)
288114cde9d3Smrg	lint_name=lint
288214cde9d3Smrg	lint_options="-u -b"
288314cde9d3Smrg	;;
288414cde9d3Smrg  *solaris*)
288514cde9d3Smrg	lint_name=lint
288614cde9d3Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288714cde9d3Smrg	;;
288814cde9d3Smrgesac
288914cde9d3Smrg
289014cde9d3Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289114cde9d3Smrgif test "x$use_lint" = x"yes" ; then
289214cde9d3Smrg   AC_PATH_PROG([LINT], [$lint_name])
289314cde9d3Smrg   if test "x$LINT" = "x"; then
289414cde9d3Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289514cde9d3Smrg   fi
289614cde9d3Smrgelif test "x$use_lint" = x"no" ; then
289714cde9d3Smrg   if test "x$LINT" != "x"; then
289814cde9d3Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289914cde9d3Smrg   fi
2900c74b14bdSmrgelse
290114cde9d3Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902f126e068Smrgfi
2903f126e068Smrg
290414cde9d3Smrg# User supplied flags override default flags
290514cde9d3Smrgif test "x$LINT_FLAGS" != "x"; then
290614cde9d3Smrg   lint_options=$LINT_FLAGS
290714cde9d3Smrgfi
2908f126e068Smrg
290914cde9d3SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291014cde9d3SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911f126e068Smrg
291214cde9d3Smrg]) # XORG_WITH_LINT
29138b22bf3fSmrg
291414cde9d3Smrg# XORG_LINT_LIBRARY(LIBNAME)
291514cde9d3Smrg# --------------------------
291614cde9d3Smrg# Minimum version: 1.1.0
2917f126e068Smrg#
291814cde9d3Smrg# Sets up flags for building lint libraries for checking programs that call
291914cde9d3Smrg# functions in the library.
292014cde9d3Smrg#
292114cde9d3Smrg# Interface to module:
292214cde9d3Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292314cde9d3Smrg# MAKE_LINT_LIB		- Automake conditional
292414cde9d3Smrg#
292514cde9d3Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292614cde9d3Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927f126e068Smrg
292814cde9d3SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292914cde9d3SmrgAC_REQUIRE([XORG_WITH_LINT])
293014cde9d3SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293114cde9d3Smrg	[Create lint library (default: disabled)])],
293214cde9d3Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293314cde9d3Smrg
293414cde9d3Smrgif test "x$make_lint_lib" = x"yes" ; then
293514cde9d3Smrg   LINTLIB=llib-l$1.ln
293614cde9d3Smrg   if test "x$LINT" = "x"; then
293714cde9d3Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293814cde9d3Smrg   fi
293914cde9d3Smrgelif test "x$make_lint_lib" != x"no" ; then
294014cde9d3Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941f126e068Smrgfi
29425bd32fd1Smrg
294314cde9d3SmrgAC_SUBST(LINTLIB)
294414cde9d3SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945c74b14bdSmrg
294614cde9d3Smrg]) # XORG_LINT_LIBRARY
2947f126e068Smrg
294814cde9d3Smrg# XORG_COMPILER_BRAND
2949c74b14bdSmrg# -------------------
295014cde9d3Smrg# Minimum version: 1.14.0
2951c74b14bdSmrg#
295214cde9d3Smrg# Checks for various brands of compilers and sets flags as appropriate:
295314cde9d3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295414cde9d3Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295514cde9d3Smrg#   clang compiler - sets CLANGCC to "yes"
295614cde9d3Smrg#   Intel compiler - sets INTELCC to "yes"
295714cde9d3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295814cde9d3Smrg#
295914cde9d3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296014cde9d3SmrgAC_LANG_CASE(
296114cde9d3Smrg	[C], [
296214cde9d3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296314cde9d3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296414cde9d3Smrg		m4_version_prereq([2.70],
296514cde9d3Smrg			[AC_REQUIRE([AC_PROG_CC])],
296614cde9d3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296714cde9d3Smrg	],
296814cde9d3Smrg	[C++], [
296914cde9d3Smrg		AC_REQUIRE([AC_PROG_CXX])
297014cde9d3Smrg	]
297114cde9d3Smrg)
297214cde9d3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297314cde9d3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297414cde9d3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297514cde9d3Smrg]) # XORG_COMPILER_BRAND
2976f126e068Smrg
297714cde9d3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978c74b14bdSmrg# ---------------
297914cde9d3Smrg# Minimum version: 1.16.0
298014cde9d3Smrg#
298114cde9d3Smrg# Test if the compiler works when passed the given flag as a command line argument.
298214cde9d3Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298314cde9d3Smrg# next flag in the list until there are no more options.
298414cde9d3Smrg#
298514cde9d3Smrg# Note that this does not guarantee that the compiler supports the flag as some
298614cde9d3Smrg# compilers will simply ignore arguments that they do not understand, but we do
298714cde9d3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298814cde9d3Smrg# -Werror=unused-command-line-argument
298914cde9d3Smrg#
299014cde9d3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299114cde9d3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299214cde9d3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993f126e068Smrg
299414cde9d3SmrgAC_LANG_COMPILER_REQUIRE
2995c74b14bdSmrg
299614cde9d3SmrgAC_LANG_CASE(
299714cde9d3Smrg	[C], [
299814cde9d3Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299914cde9d3Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300014cde9d3Smrg		m4_version_prereq([2.70],
300114cde9d3Smrg			[AC_REQUIRE([AC_PROG_CC])],
300214cde9d3Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300314cde9d3Smrg		define([PREFIX], [C])
300414cde9d3Smrg		define([CACHE_PREFIX], [cc])
300514cde9d3Smrg		define([COMPILER], [$CC])
300614cde9d3Smrg	],
300714cde9d3Smrg	[C++], [
300814cde9d3Smrg		define([PREFIX], [CXX])
300914cde9d3Smrg		define([CACHE_PREFIX], [cxx])
301014cde9d3Smrg		define([COMPILER], [$CXX])
301114cde9d3Smrg	]
301214cde9d3Smrg)
301314cde9d3Smrg
301414cde9d3Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301514cde9d3Smrg
301614cde9d3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301714cde9d3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301814cde9d3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301914cde9d3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302014cde9d3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302114cde9d3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302214cde9d3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302314cde9d3Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302414cde9d3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025c74b14bdSmrgfi
302614cde9d3Smrg
302714cde9d3Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302814cde9d3Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302914cde9d3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303014cde9d3Smrg	fi
303114cde9d3Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303214cde9d3Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303314cde9d3Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303414cde9d3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303514cde9d3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303614cde9d3Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303714cde9d3Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303814cde9d3Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303914cde9d3Smrgfi
304014cde9d3Smrg
304114cde9d3Smrgfound="no"
304214cde9d3Smrgm4_foreach([flag], m4_cdr($@), [
304314cde9d3Smrg	if test $found = "no" ; then
304414cde9d3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304514cde9d3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304614cde9d3Smrg		fi
304714cde9d3Smrg
304814cde9d3Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304914cde9d3Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305014cde9d3Smrg		fi
305114cde9d3Smrg
305214cde9d3Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305314cde9d3Smrg
305414cde9d3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305514cde9d3Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305614cde9d3Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305714cde9d3Smrg		AC_CACHE_VAL($cacheid,
305814cde9d3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305914cde9d3Smrg					     [eval $cacheid=yes],
306014cde9d3Smrg					     [eval $cacheid=no])])
306114cde9d3Smrg
306214cde9d3Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306314cde9d3Smrg
306414cde9d3Smrg		eval supported=\$$cacheid
306514cde9d3Smrg		AC_MSG_RESULT([$supported])
306614cde9d3Smrg		if test "$supported" = "yes" ; then
306714cde9d3Smrg			$1="$$1 ]flag["
306814cde9d3Smrg			found="yes"
306914cde9d3Smrg		fi
307014cde9d3Smrg	fi
3071c74b14bdSmrg])
307214cde9d3Smrg]) # XORG_TESTSET_CFLAG
30735bd32fd1Smrg
307414cde9d3Smrg# XORG_COMPILER_FLAGS
307514cde9d3Smrg# ---------------
307614cde9d3Smrg# Minimum version: 1.16.0
3077dfab2fd6Smrg#
307814cde9d3Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307914cde9d3Smrg# arguments supported by the selected compiler which do NOT alter the generated
308014cde9d3Smrg# code.  These arguments will cause the compiler to print various warnings
308114cde9d3Smrg# during compilation AND turn a conservative set of warnings into errors.
308214cde9d3Smrg#
308314cde9d3Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308414cde9d3Smrg# future versions of util-macros as options are added to new compilers.
308514cde9d3Smrg#
308614cde9d3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308714cde9d3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30888b22bf3fSmrg
308914cde9d3SmrgAC_ARG_ENABLE(selective-werror,
309014cde9d3Smrg              AS_HELP_STRING([--disable-selective-werror],
309114cde9d3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
309214cde9d3Smrg              [SELECTIVE_WERROR=$enableval],
309314cde9d3Smrg              [SELECTIVE_WERROR=yes])
309414cde9d3Smrg
309514cde9d3SmrgAC_LANG_CASE(
309614cde9d3Smrg        [C], [
309714cde9d3Smrg                define([PREFIX], [C])
309814cde9d3Smrg        ],
309914cde9d3Smrg        [C++], [
310014cde9d3Smrg                define([PREFIX], [CXX])
310114cde9d3Smrg        ]
310214cde9d3Smrg)
310314cde9d3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310414cde9d3Smrgif test "x$SUNCC" = "xyes"; then
310514cde9d3Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106c74b14bdSmrgelse
310714cde9d3Smrg    [BASE_]PREFIX[FLAGS]=""
3108c74b14bdSmrgfi
3109c74b14bdSmrg
311014cde9d3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311114cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311214cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311314cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311414cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115c74b14bdSmrg
311614cde9d3SmrgAC_LANG_CASE(
311714cde9d3Smrg	[C], [
311814cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311914cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312014cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312114cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312214cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312314cde9d3Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312414cde9d3Smrg	]
312514cde9d3Smrg)
31268b22bf3fSmrg
312714cde9d3Smrg# This chunk adds additional warnings that could catch undesired effects.
312814cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312914cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313014cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313114cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313214cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313314cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313414cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
313596a81b41Smrg
313614cde9d3Smrg# These are currently disabled because they are noisy.  They will be enabled
313714cde9d3Smrg# in the future once the codebase is sufficiently modernized to silence
313814cde9d3Smrg# them.  For now, I don't want them to drown out the other warnings.
313914cde9d3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314014cde9d3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314114cde9d3Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142dfab2fd6Smrg
314314cde9d3Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314414cde9d3Smrg# when there are problems that should be fixed.
3145dfab2fd6Smrg
314614cde9d3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314714cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314814cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314914cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315014cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315114cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315214cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315314cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315414cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315514cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315614cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315714cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315814cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315914cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316014cde9d3Smrgelse
316114cde9d3SmrgAC_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])
316214cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316314cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316414cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316514cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316614cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316714cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316814cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316914cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317014cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317114cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317214cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317314cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317414cde9d3SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317514cde9d3Smrgfi
317696a81b41Smrg
317714cde9d3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317814cde9d3Smrg]) # XORG_COMPILER_FLAGS
317996a81b41Smrg
318014cde9d3Smrg# XORG_CWARNFLAGS
318114cde9d3Smrg# ---------------
318214cde9d3Smrg# Minimum version: 1.2.0
318314cde9d3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
318496a81b41Smrg#
318514cde9d3Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186f126e068Smrg#
318714cde9d3Smrg# This function is deprecated because it defines -fno-strict-aliasing
318814cde9d3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318914cde9d3Smrg# is needed, then it should be added explicitly in the module when
319014cde9d3Smrg# it is updated to use BASE_CFLAGS.
3191f126e068Smrg#
319214cde9d3SmrgAC_DEFUN([XORG_CWARNFLAGS], [
319314cde9d3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319414cde9d3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319514cde9d3SmrgAC_LANG_CASE(
319614cde9d3Smrg	[C], [
319714cde9d3Smrg		CWARNFLAGS="$BASE_CFLAGS"
319814cde9d3Smrg		if  test "x$GCC" = xyes ; then
319914cde9d3Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320014cde9d3Smrg		fi
320114cde9d3Smrg		AC_SUBST(CWARNFLAGS)
320214cde9d3Smrg	]
320314cde9d3Smrg)
320414cde9d3Smrg]) # XORG_CWARNFLAGS
32055bd32fd1Smrg
320614cde9d3Smrg# XORG_STRICT_OPTION
320714cde9d3Smrg# -----------------------
320814cde9d3Smrg# Minimum version: 1.3.0
320914cde9d3Smrg#
321014cde9d3Smrg# Add configure option to enable strict compilation flags, such as treating
321114cde9d3Smrg# warnings as fatal errors.
321214cde9d3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321314cde9d3Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321414cde9d3Smrg#
321514cde9d3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321614cde9d3Smrg# when strict compilation is unconditionally desired.
321714cde9d3SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321814cde9d3SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321914cde9d3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32208b22bf3fSmrg
322114cde9d3SmrgAC_ARG_ENABLE(strict-compilation,
322214cde9d3Smrg			  AS_HELP_STRING([--enable-strict-compilation],
322314cde9d3Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322414cde9d3Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32258b22bf3fSmrg
322614cde9d3SmrgAC_LANG_CASE(
322714cde9d3Smrg        [C], [
322814cde9d3Smrg                define([PREFIX], [C])
322914cde9d3Smrg        ],
323014cde9d3Smrg        [C++], [
323114cde9d3Smrg                define([PREFIX], [CXX])
323214cde9d3Smrg        ]
323314cde9d3Smrg)
3234c74b14bdSmrg
323514cde9d3Smrg[STRICT_]PREFIX[FLAGS]=""
323614cde9d3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323714cde9d3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238c74b14bdSmrg
323914cde9d3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324014cde9d3Smrg# activate it with -Werror, so we add it here explicitly.
324114cde9d3SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242c74b14bdSmrg
324314cde9d3Smrgif test "x$STRICT_COMPILE" = "xyes"; then
324414cde9d3Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324514cde9d3Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324614cde9d3Smrgfi
324714cde9d3SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324814cde9d3SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324914cde9d3SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325014cde9d3Smrg]) # XORG_STRICT_OPTION
3251c74b14bdSmrg
325214cde9d3Smrg# XORG_DEFAULT_NOCODE_OPTIONS
325314cde9d3Smrg# ---------------------------
325414cde9d3Smrg# Minimum version: 1.20.0
325514cde9d3Smrg#
325614cde9d3Smrg# Defines default options for X.Org modules which don't compile code,
325714cde9d3Smrg# such as fonts, bitmaps, cursors, and docs.
325814cde9d3Smrg#
325914cde9d3SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326014cde9d3SmrgAC_REQUIRE([AC_PROG_INSTALL])
326114cde9d3SmrgXORG_RELEASE_VERSION
326214cde9d3SmrgXORG_CHANGELOG
326314cde9d3SmrgXORG_INSTALL
326414cde9d3SmrgXORG_MANPAGE_SECTIONS
326514cde9d3Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326614cde9d3Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326714cde9d3Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268c74b14bdSmrg
326914cde9d3Smrg# XORG_DEFAULT_OPTIONS
327014cde9d3Smrg# --------------------
327114cde9d3Smrg# Minimum version: 1.3.0
327214cde9d3Smrg#
327314cde9d3Smrg# Defines default options for X.Org modules which compile code.
327414cde9d3Smrg#
327514cde9d3SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327614cde9d3SmrgAC_REQUIRE([AC_PROG_INSTALL])
327714cde9d3SmrgXORG_COMPILER_FLAGS
327814cde9d3SmrgXORG_CWARNFLAGS
327914cde9d3SmrgXORG_STRICT_OPTION
328014cde9d3SmrgXORG_DEFAULT_NOCODE_OPTIONS
328114cde9d3Smrg]) # XORG_DEFAULT_OPTIONS
3282c74b14bdSmrg
328314cde9d3Smrg# XORG_INSTALL()
328414cde9d3Smrg# ----------------
328514cde9d3Smrg# Minimum version: 1.4.0
328614cde9d3Smrg#
328714cde9d3Smrg# Defines the variable INSTALL_CMD as the command to copy
328814cde9d3Smrg# INSTALL from $prefix/share/util-macros.
328914cde9d3Smrg#
329014cde9d3SmrgAC_DEFUN([XORG_INSTALL], [
329114cde9d3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329214cde9d3Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329314cde9d3SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329414cde9d3Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329514cde9d3Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329614cde9d3Smrgtouch \$(top_srcdir)/INSTALL; \
329714cde9d3Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329814cde9d3SmrgAC_SUBST([INSTALL_CMD])
329914cde9d3Smrg]) # XORG_INSTALL
330014cde9d3Smrgdnl Copyright 2005 Red Hat, Inc
330114cde9d3Smrgdnl
330214cde9d3Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330314cde9d3Smrgdnl documentation for any purpose is hereby granted without fee, provided that
330414cde9d3Smrgdnl the above copyright notice appear in all copies and that both that
330514cde9d3Smrgdnl copyright notice and this permission notice appear in supporting
330614cde9d3Smrgdnl documentation.
330714cde9d3Smrgdnl
330814cde9d3Smrgdnl The above copyright notice and this permission notice shall be included
330914cde9d3Smrgdnl in all copies or substantial portions of the Software.
331014cde9d3Smrgdnl
331114cde9d3Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331214cde9d3Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331314cde9d3Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331414cde9d3Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331514cde9d3Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331614cde9d3Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331714cde9d3Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
331814cde9d3Smrgdnl
331914cde9d3Smrgdnl Except as contained in this notice, the name of the copyright holders shall
332014cde9d3Smrgdnl not be used in advertising or otherwise to promote the sale, use or
332114cde9d3Smrgdnl other dealings in this Software without prior written authorization
332214cde9d3Smrgdnl from the copyright holders.
332314cde9d3Smrgdnl
3324c74b14bdSmrg
332514cde9d3Smrg# XORG_RELEASE_VERSION
332614cde9d3Smrg# --------------------
332714cde9d3Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328c74b14bdSmrg
332914cde9d3SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333014cde9d3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333114cde9d3Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333214cde9d3Smrg		[Major version of this package])
333314cde9d3Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333414cde9d3Smrg	if test "x$PVM" = "x"; then
333514cde9d3Smrg		PVM="0"
333614cde9d3Smrg	fi
333714cde9d3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333814cde9d3Smrg		[$PVM],
333914cde9d3Smrg		[Minor version of this package])
334014cde9d3Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334114cde9d3Smrg	if test "x$PVP" = "x"; then
334214cde9d3Smrg		PVP="0"
334314cde9d3Smrg	fi
334414cde9d3Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334514cde9d3Smrg		[$PVP],
334614cde9d3Smrg		[Patch version of this package])
334714cde9d3Smrg])
3348c74b14bdSmrg
334914cde9d3Smrg# XORG_CHANGELOG()
335014cde9d3Smrg# ----------------
335114cde9d3Smrg# Minimum version: 1.2.0
335214cde9d3Smrg#
335314cde9d3Smrg# Defines the variable CHANGELOG_CMD as the command to generate
335414cde9d3Smrg# ChangeLog from git.
335514cde9d3Smrg#
335614cde9d3Smrg#
335714cde9d3SmrgAC_DEFUN([XORG_CHANGELOG], [
335814cde9d3SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335914cde9d3Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336014cde9d3Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336114cde9d3Smrgtouch \$(top_srcdir)/ChangeLog; \
336214cde9d3Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336314cde9d3SmrgAC_SUBST([CHANGELOG_CMD])
336414cde9d3Smrg]) # XORG_CHANGELOG
336596a81b41Smrg
3366