aclocal.m4 revision 9f1d9476
19f1d9476Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2f33d31a3Smrg
39f1d9476Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4f33d31a3Smrg
5f33d31a3Smrg# This file is free software; the Free Software Foundation
6f33d31a3Smrg# gives unlimited permission to copy and/or distribute it,
7f33d31a3Smrg# with or without modifications, as long as this notice is preserved.
8f33d31a3Smrg
9f33d31a3Smrg# This program is distributed in the hope that it will be useful,
10f33d31a3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11f33d31a3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12f33d31a3Smrg# PARTICULAR PURPOSE.
13f33d31a3Smrg
14f33d31a3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f33d31a3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f33d31a3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179f1d9476Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
189f1d9476Smrg[m4_warning([this file was generated for autoconf 2.71.
19f33d31a3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f33d31a3SmrgIf you have problems, you may need to regenerate the build system entirely.
21f33d31a3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f33d31a3Smrg
239f1d9476Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
249f1d9476Smrg#
259f1d9476Smrg# This file is free software; the Free Software Foundation
269f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
279f1d9476Smrg# with or without modifications, as long as this notice is preserved.
28f33d31a3Smrg
299f1d9476Smrg# AM_AUTOMAKE_VERSION(VERSION)
309f1d9476Smrg# ----------------------------
319f1d9476Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
329f1d9476Smrg# generated from the m4 files accompanying Automake X.Y.
339f1d9476Smrg# (This private macro should not be called outside this file.)
349f1d9476SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
359f1d9476Smrg[am__api_version='1.16'
369f1d9476Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379f1d9476Smrgdnl require some minimum version.  Point them to the right macro.
389f1d9476Smrgm4_if([$1], [1.16.5], [],
399f1d9476Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409f1d9476Smrg])
41f33d31a3Smrg
429f1d9476Smrg# _AM_AUTOCONF_VERSION(VERSION)
439f1d9476Smrg# -----------------------------
449f1d9476Smrg# aclocal traces this macro to find the Autoconf version.
459f1d9476Smrg# This is a private macro too.  Using m4_define simplifies
469f1d9476Smrg# the logic in aclocal, which can simply ignore this definition.
479f1d9476Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48f33d31a3Smrg
499f1d9476Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
509f1d9476Smrg# -------------------------------
519f1d9476Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
529f1d9476Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
539f1d9476SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
549f1d9476Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
559f1d9476Smrgm4_ifndef([AC_AUTOCONF_VERSION],
569f1d9476Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
579f1d9476Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58f33d31a3Smrg
599f1d9476Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60f33d31a3Smrg
619f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
629f1d9476Smrg#
639f1d9476Smrg# This file is free software; the Free Software Foundation
649f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
659f1d9476Smrg# with or without modifications, as long as this notice is preserved.
66f33d31a3Smrg
679f1d9476Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
689f1d9476Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
699f1d9476Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
709f1d9476Smrg#
719f1d9476Smrg# Of course, Automake must honor this variable whenever it calls a
729f1d9476Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
739f1d9476Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
749f1d9476Smrg# depending on how configure is run.  This is pretty annoying, since
759f1d9476Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
769f1d9476Smrg# source directory, any form will work fine, but in subdirectories a
779f1d9476Smrg# relative path needs to be adjusted first.
789f1d9476Smrg#
799f1d9476Smrg# $ac_aux_dir/missing
809f1d9476Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
819f1d9476Smrg# $top_srcdir/$ac_aux_dir/missing
829f1d9476Smrg#    fails if $ac_aux_dir is absolute,
839f1d9476Smrg#    fails when called from a subdirectory in a VPATH build with
849f1d9476Smrg#          a relative $ac_aux_dir
859f1d9476Smrg#
869f1d9476Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
879f1d9476Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
889f1d9476Smrg# harmless because $srcdir is '.', but things will broke when you
899f1d9476Smrg# start a VPATH build or use an absolute $srcdir.
909f1d9476Smrg#
919f1d9476Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
929f1d9476Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
939f1d9476Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
949f1d9476Smrg# and then we would define $MISSING as
959f1d9476Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
969f1d9476Smrg# This will work as long as MISSING is not called from configure, because
979f1d9476Smrg# unfortunately $(top_srcdir) has no meaning in configure.
989f1d9476Smrg# However there are other variables, like CC, which are often used in
999f1d9476Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1009f1d9476Smrg#
1019f1d9476Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1029f1d9476Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1039f1d9476Smrg# configured tree to be moved without reconfiguration.
104f33d31a3Smrg
1059f1d9476SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1069f1d9476Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1079f1d9476Smrg# Expand $ac_aux_dir to an absolute path.
1089f1d9476Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1099f1d9476Smrg])
110f33d31a3Smrg
1119f1d9476Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112f33d31a3Smrg
1139f1d9476Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1149f1d9476Smrg#
1159f1d9476Smrg# This file is free software; the Free Software Foundation
1169f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
1179f1d9476Smrg# with or without modifications, as long as this notice is preserved.
118f33d31a3Smrg
1199f1d9476Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1209f1d9476Smrg# -------------------------------------
1219f1d9476Smrg# Define a conditional.
1229f1d9476SmrgAC_DEFUN([AM_CONDITIONAL],
1239f1d9476Smrg[AC_PREREQ([2.52])dnl
1249f1d9476Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1259f1d9476Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1269f1d9476SmrgAC_SUBST([$1_TRUE])dnl
1279f1d9476SmrgAC_SUBST([$1_FALSE])dnl
1289f1d9476Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1299f1d9476Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1309f1d9476Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1319f1d9476Smrgif $2; then
1329f1d9476Smrg  $1_TRUE=
1339f1d9476Smrg  $1_FALSE='#'
1349f1d9476Smrgelse
1359f1d9476Smrg  $1_TRUE='#'
1369f1d9476Smrg  $1_FALSE=
1379f1d9476Smrgfi
1389f1d9476SmrgAC_CONFIG_COMMANDS_PRE(
1399f1d9476Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1409f1d9476Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1419f1d9476SmrgUsually this means the macro was only invoked conditionally.]])
1429f1d9476Smrgfi])])
143f33d31a3Smrg
1449f1d9476Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1459f1d9476Smrg#
1469f1d9476Smrg# This file is free software; the Free Software Foundation
1479f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
1489f1d9476Smrg# with or without modifications, as long as this notice is preserved.
149f33d31a3Smrg
150f33d31a3Smrg
1519f1d9476Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1529f1d9476Smrg# written in clear, in which case automake, when reading aclocal.m4,
1539f1d9476Smrg# will think it sees a *use*, and therefore will trigger all it's
1549f1d9476Smrg# C support machinery.  Also note that it means that autoscan, seeing
1559f1d9476Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156f33d31a3Smrg
157f33d31a3Smrg
1589f1d9476Smrg# _AM_DEPENDENCIES(NAME)
1599f1d9476Smrg# ----------------------
1609f1d9476Smrg# See how the compiler implements dependency checking.
1619f1d9476Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1629f1d9476Smrg# We try a few techniques and use that to set a single cache variable.
1639f1d9476Smrg#
1649f1d9476Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1659f1d9476Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1669f1d9476Smrg# dependency, and given that the user is not expected to run this macro,
1679f1d9476Smrg# just rely on AC_PROG_CC.
1689f1d9476SmrgAC_DEFUN([_AM_DEPENDENCIES],
1699f1d9476Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1709f1d9476SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1719f1d9476SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1729f1d9476SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173f33d31a3Smrg
1749f1d9476Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1759f1d9476Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1769f1d9476Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1779f1d9476Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1789f1d9476Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1799f1d9476Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1809f1d9476Smrg                    [depcc="$$1"   am_compiler_list=])
181f33d31a3Smrg
1829f1d9476SmrgAC_CACHE_CHECK([dependency style of $depcc],
1839f1d9476Smrg               [am_cv_$1_dependencies_compiler_type],
1849f1d9476Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1859f1d9476Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1869f1d9476Smrg  # making bogus files that we don't know about and never remove.  For
1879f1d9476Smrg  # instance it was reported that on HP-UX the gcc test will end up
1889f1d9476Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1899f1d9476Smrg  # in D".
1909f1d9476Smrg  rm -rf conftest.dir
1919f1d9476Smrg  mkdir conftest.dir
1929f1d9476Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1939f1d9476Smrg  # using a relative directory.
1949f1d9476Smrg  cp "$am_depcomp" conftest.dir
1959f1d9476Smrg  cd conftest.dir
1969f1d9476Smrg  # We will build objects and dependencies in a subdirectory because
1979f1d9476Smrg  # it helps to detect inapplicable dependency modes.  For instance
1989f1d9476Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1999f1d9476Smrg  # side effect of compilation, but ICC will put the dependencies in
2009f1d9476Smrg  # the current directory while Tru64 will put them in the object
2019f1d9476Smrg  # directory.
2029f1d9476Smrg  mkdir sub
203f33d31a3Smrg
2049f1d9476Smrg  am_cv_$1_dependencies_compiler_type=none
2059f1d9476Smrg  if test "$am_compiler_list" = ""; then
2069f1d9476Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2079f1d9476Smrg  fi
2089f1d9476Smrg  am__universal=false
2099f1d9476Smrg  m4_case([$1], [CC],
2109f1d9476Smrg    [case " $depcc " in #(
2119f1d9476Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2129f1d9476Smrg     esac],
2139f1d9476Smrg    [CXX],
2149f1d9476Smrg    [case " $depcc " in #(
2159f1d9476Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2169f1d9476Smrg     esac])
217f33d31a3Smrg
2189f1d9476Smrg  for depmode in $am_compiler_list; do
2199f1d9476Smrg    # Setup a source with many dependencies, because some compilers
2209f1d9476Smrg    # like to wrap large dependency lists on column 80 (with \), and
2219f1d9476Smrg    # we should not choose a depcomp mode which is confused by this.
2229f1d9476Smrg    #
2239f1d9476Smrg    # We need to recreate these files for each test, as the compiler may
2249f1d9476Smrg    # overwrite some of them when testing with obscure command lines.
2259f1d9476Smrg    # This happens at least with the AIX C compiler.
2269f1d9476Smrg    : > sub/conftest.c
2279f1d9476Smrg    for i in 1 2 3 4 5 6; do
2289f1d9476Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2299f1d9476Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2309f1d9476Smrg      # Solaris 10 /bin/sh.
2319f1d9476Smrg      echo '/* dummy */' > sub/conftst$i.h
2329f1d9476Smrg    done
2339f1d9476Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234f33d31a3Smrg
2359f1d9476Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2369f1d9476Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2379f1d9476Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2389f1d9476Smrg    # versions had trouble with output in subdirs.
2399f1d9476Smrg    am__obj=sub/conftest.${OBJEXT-o}
2409f1d9476Smrg    am__minus_obj="-o $am__obj"
2419f1d9476Smrg    case $depmode in
2429f1d9476Smrg    gcc)
2439f1d9476Smrg      # This depmode causes a compiler race in universal mode.
2449f1d9476Smrg      test "$am__universal" = false || continue
2459f1d9476Smrg      ;;
2469f1d9476Smrg    nosideeffect)
2479f1d9476Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2489f1d9476Smrg      # only be used when explicitly requested.
2499f1d9476Smrg      if test "x$enable_dependency_tracking" = xyes; then
2509f1d9476Smrg	continue
2519f1d9476Smrg      else
2529f1d9476Smrg	break
2539f1d9476Smrg      fi
2549f1d9476Smrg      ;;
2559f1d9476Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569f1d9476Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2579f1d9476Smrg      # not run yet.  These depmodes are late enough in the game, and
2589f1d9476Smrg      # so weak that their functioning should not be impacted.
2599f1d9476Smrg      am__obj=conftest.${OBJEXT-o}
2609f1d9476Smrg      am__minus_obj=
2619f1d9476Smrg      ;;
2629f1d9476Smrg    none) break ;;
2639f1d9476Smrg    esac
2649f1d9476Smrg    if depmode=$depmode \
2659f1d9476Smrg       source=sub/conftest.c object=$am__obj \
2669f1d9476Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2679f1d9476Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2689f1d9476Smrg         >/dev/null 2>conftest.err &&
2699f1d9476Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2709f1d9476Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2719f1d9476Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2729f1d9476Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2739f1d9476Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2749f1d9476Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2759f1d9476Smrg      # that says an option was ignored or not supported.
2769f1d9476Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2779f1d9476Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2789f1d9476Smrg      # The diagnosis changed in icc 8.0:
2799f1d9476Smrg      #   icc: Command line remark: option '-MP' not supported
2809f1d9476Smrg      if (grep 'ignoring option' conftest.err ||
2819f1d9476Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2829f1d9476Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2839f1d9476Smrg        break
2849f1d9476Smrg      fi
2859f1d9476Smrg    fi
2869f1d9476Smrg  done
287f33d31a3Smrg
2889f1d9476Smrg  cd ..
2899f1d9476Smrg  rm -rf conftest.dir
2909f1d9476Smrgelse
2919f1d9476Smrg  am_cv_$1_dependencies_compiler_type=none
2929f1d9476Smrgfi
2939f1d9476Smrg])
2949f1d9476SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2959f1d9476SmrgAM_CONDITIONAL([am__fastdep$1], [
2969f1d9476Smrg  test "x$enable_dependency_tracking" != xno \
2979f1d9476Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2989f1d9476Smrg])
299f33d31a3Smrg
300f33d31a3Smrg
3019f1d9476Smrg# AM_SET_DEPDIR
3029f1d9476Smrg# -------------
3039f1d9476Smrg# Choose a directory name for dependency files.
3049f1d9476Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3059f1d9476SmrgAC_DEFUN([AM_SET_DEPDIR],
3069f1d9476Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3079f1d9476SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3089f1d9476Smrg])
309f33d31a3Smrg
310f33d31a3Smrg
3119f1d9476Smrg# AM_DEP_TRACK
3129f1d9476Smrg# ------------
3139f1d9476SmrgAC_DEFUN([AM_DEP_TRACK],
3149f1d9476Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3159f1d9476SmrgAS_HELP_STRING(
3169f1d9476Smrg  [--enable-dependency-tracking],
3179f1d9476Smrg  [do not reject slow dependency extractors])
3189f1d9476SmrgAS_HELP_STRING(
3199f1d9476Smrg  [--disable-dependency-tracking],
3209f1d9476Smrg  [speeds up one-time build])])
3219f1d9476Smrgif test "x$enable_dependency_tracking" != xno; then
3229f1d9476Smrg  am_depcomp="$ac_aux_dir/depcomp"
3239f1d9476Smrg  AMDEPBACKSLASH='\'
3249f1d9476Smrg  am__nodep='_no'
3259f1d9476Smrgfi
3269f1d9476SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3279f1d9476SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3289f1d9476Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3299f1d9476SmrgAC_SUBST([am__nodep])dnl
3309f1d9476Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3319f1d9476Smrg])
332f33d31a3Smrg
3339f1d9476Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334f33d31a3Smrg
3359f1d9476Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336f33d31a3Smrg#
3379f1d9476Smrg# This file is free software; the Free Software Foundation
3389f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
3399f1d9476Smrg# with or without modifications, as long as this notice is preserved.
340f33d31a3Smrg
3419f1d9476Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3429f1d9476Smrg# ------------------------------
3439f1d9476SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3449f1d9476Smrg[{
3459f1d9476Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3469f1d9476Smrg  # are listed without --file.  Let's play safe and only enable the eval
3479f1d9476Smrg  # if we detect the quoting.
3489f1d9476Smrg  # TODO: see whether this extra hack can be removed once we start
3499f1d9476Smrg  # requiring Autoconf 2.70 or later.
3509f1d9476Smrg  AS_CASE([$CONFIG_FILES],
3519f1d9476Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3529f1d9476Smrg          [*], [set x $CONFIG_FILES])
3539f1d9476Smrg  shift
3549f1d9476Smrg  # Used to flag and report bootstrapping failures.
3559f1d9476Smrg  am_rc=0
3569f1d9476Smrg  for am_mf
3579f1d9476Smrg  do
3589f1d9476Smrg    # Strip MF so we end up with the name of the file.
3599f1d9476Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3609f1d9476Smrg    # Check whether this is an Automake generated Makefile which includes
3619f1d9476Smrg    # dependency-tracking related rules and includes.
3629f1d9476Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3639f1d9476Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3649f1d9476Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3659f1d9476Smrg      || continue
3669f1d9476Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3679f1d9476Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3689f1d9476Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3699f1d9476Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3709f1d9476Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3719f1d9476Smrg  done
3729f1d9476Smrg  if test $am_rc -ne 0; then
3739f1d9476Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3749f1d9476Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3759f1d9476Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3769f1d9476Smrg    necessary).  You can also try re-running configure with the
3779f1d9476Smrg    '--disable-dependency-tracking' option to at least be able to build
3789f1d9476Smrg    the package (albeit without support for automatic dependency tracking).])
3799f1d9476Smrg  fi
3809f1d9476Smrg  AS_UNSET([am_dirpart])
3819f1d9476Smrg  AS_UNSET([am_filepart])
3829f1d9476Smrg  AS_UNSET([am_mf])
3839f1d9476Smrg  AS_UNSET([am_rc])
3849f1d9476Smrg  rm -f conftest-deps.mk
3859f1d9476Smrg}
3869f1d9476Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387f33d31a3Smrg
388f33d31a3Smrg
3899f1d9476Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3909f1d9476Smrg# -----------------------------
3919f1d9476Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392f33d31a3Smrg#
3939f1d9476Smrg# This code is only required when automatic dependency tracking is enabled.
3949f1d9476Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3959f1d9476Smrg# order to bootstrap the dependency handling code.
3969f1d9476SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3979f1d9476Smrg[AC_CONFIG_COMMANDS([depfiles],
3989f1d9476Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3999f1d9476Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400f33d31a3Smrg
4019f1d9476Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402f33d31a3Smrg
4039f1d9476Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4049f1d9476Smrg#
4059f1d9476Smrg# This file is free software; the Free Software Foundation
4069f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
4079f1d9476Smrg# with or without modifications, as long as this notice is preserved.
408f33d31a3Smrg
4099f1d9476Smrg# This macro actually does too much.  Some checks are only needed if
4109f1d9476Smrg# your package does certain things.  But this isn't really a big deal.
411f33d31a3Smrg
4129f1d9476Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4139f1d9476Smrgm4_define([AC_PROG_CC],
4149f1d9476Smrgm4_defn([AC_PROG_CC])
4159f1d9476Smrg[_AM_PROG_CC_C_O
4169f1d9476Smrg])
417f33d31a3Smrg
4189f1d9476Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4199f1d9476Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4209f1d9476Smrg# -----------------------------------------------
4219f1d9476Smrg# The call with PACKAGE and VERSION arguments is the old style
4229f1d9476Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4239f1d9476Smrg# and VERSION should now be passed to AC_INIT and removed from
4249f1d9476Smrg# the call to AM_INIT_AUTOMAKE.
4259f1d9476Smrg# We support both call styles for the transition.  After
4269f1d9476Smrg# the next Automake release, Autoconf can make the AC_INIT
4279f1d9476Smrg# arguments mandatory, and then we can depend on a new Autoconf
4289f1d9476Smrg# release and drop the old call support.
4299f1d9476SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4309f1d9476Smrg[AC_PREREQ([2.65])dnl
4319f1d9476Smrgm4_ifdef([_$0_ALREADY_INIT],
4329f1d9476Smrg  [m4_fatal([$0 expanded multiple times
4339f1d9476Smrg]m4_defn([_$0_ALREADY_INIT]))],
4349f1d9476Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4359f1d9476Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4369f1d9476Smrgdnl the ones we care about.
4379f1d9476Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4389f1d9476SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4399f1d9476SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4409f1d9476Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4419f1d9476Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4429f1d9476Smrg  # is not polluted with repeated "-I."
4439f1d9476Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4449f1d9476Smrg  # test to see if srcdir already configured
4459f1d9476Smrg  if test -f $srcdir/config.status; then
4469f1d9476Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4479f1d9476Smrg  fi
448f33d31a3Smrgfi
449f33d31a3Smrg
4509f1d9476Smrg# test whether we have cygpath
4519f1d9476Smrgif test -z "$CYGPATH_W"; then
4529f1d9476Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4539f1d9476Smrg    CYGPATH_W='cygpath -w'
4549f1d9476Smrg  else
4559f1d9476Smrg    CYGPATH_W=echo
4569f1d9476Smrg  fi
457f33d31a3Smrgfi
4589f1d9476SmrgAC_SUBST([CYGPATH_W])
459f33d31a3Smrg
4609f1d9476Smrg# Define the identity of the package.
4619f1d9476Smrgdnl Distinguish between old-style and new-style calls.
4629f1d9476Smrgm4_ifval([$2],
4639f1d9476Smrg[AC_DIAGNOSE([obsolete],
4649f1d9476Smrg             [$0: two- and three-arguments forms are deprecated.])
4659f1d9476Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4669f1d9476Smrg AC_SUBST([PACKAGE], [$1])dnl
4679f1d9476Smrg AC_SUBST([VERSION], [$2])],
4689f1d9476Smrg[_AM_SET_OPTIONS([$1])dnl
4699f1d9476Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4709f1d9476Smrgm4_if(
4719f1d9476Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4729f1d9476Smrg  [ok:ok],,
4739f1d9476Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4749f1d9476Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4759f1d9476Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476f33d31a3Smrg
4779f1d9476Smrg_AM_IF_OPTION([no-define],,
4789f1d9476Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4799f1d9476Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480f33d31a3Smrg
4819f1d9476Smrg# Some tools Automake needs.
4829f1d9476SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4839f1d9476SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4849f1d9476SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4859f1d9476SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4869f1d9476SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4879f1d9476SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4889f1d9476SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4899f1d9476SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4909f1d9476SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4919f1d9476SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4929f1d9476Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4939f1d9476Smrg# dies out for good.  For more background, see:
4949f1d9476Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4959f1d9476Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4969f1d9476SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4979f1d9476Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4989f1d9476Smrg# system "awk" is bad on some platforms.
4999f1d9476SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5009f1d9476SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5019f1d9476SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5029f1d9476Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5039f1d9476Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5049f1d9476Smrg			     [_AM_PROG_TAR([v7])])])
5059f1d9476Smrg_AM_IF_OPTION([no-dependencies],,
5069f1d9476Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5079f1d9476Smrg		  [_AM_DEPENDENCIES([CC])],
5089f1d9476Smrg		  [m4_define([AC_PROG_CC],
5099f1d9476Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5109f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5119f1d9476Smrg		  [_AM_DEPENDENCIES([CXX])],
5129f1d9476Smrg		  [m4_define([AC_PROG_CXX],
5139f1d9476Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5149f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5159f1d9476Smrg		  [_AM_DEPENDENCIES([OBJC])],
5169f1d9476Smrg		  [m4_define([AC_PROG_OBJC],
5179f1d9476Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5189f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5199f1d9476Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5209f1d9476Smrg		  [m4_define([AC_PROG_OBJCXX],
5219f1d9476Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5229f1d9476Smrg])
5239f1d9476Smrg# Variables for tags utilities; see am/tags.am
5249f1d9476Smrgif test -z "$CTAGS"; then
5259f1d9476Smrg  CTAGS=ctags
5269f1d9476Smrgfi
5279f1d9476SmrgAC_SUBST([CTAGS])
5289f1d9476Smrgif test -z "$ETAGS"; then
5299f1d9476Smrg  ETAGS=etags
5309f1d9476Smrgfi
5319f1d9476SmrgAC_SUBST([ETAGS])
5329f1d9476Smrgif test -z "$CSCOPE"; then
5339f1d9476Smrg  CSCOPE=cscope
5349f1d9476Smrgfi
5359f1d9476SmrgAC_SUBST([CSCOPE])
536f33d31a3Smrg
5379f1d9476SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5389f1d9476Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5399f1d9476Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5409f1d9476Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5419f1d9476SmrgAC_CONFIG_COMMANDS_PRE(dnl
5429f1d9476Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5439f1d9476Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544f33d31a3Smrg
5459f1d9476Smrg# POSIX will say in a future version that running "rm -f" with no argument
5469f1d9476Smrg# is OK; and we want to be able to make that assumption in our Makefile
5479f1d9476Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5489f1d9476Smrg# actually supported "in the wild" to an acceptable degree.
5499f1d9476Smrg# See automake bug#10828.
5509f1d9476Smrg# To make any issue more visible, cause the running configure to be aborted
5519f1d9476Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5529f1d9476Smrg# user can still override this though.
5539f1d9476Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5549f1d9476Smrg  cat >&2 <<'END'
5559f1d9476SmrgOops!
556f33d31a3Smrg
5579f1d9476SmrgYour 'rm' program seems unable to run without file operands specified
5589f1d9476Smrgon the command line, even when the '-f' option is present.  This is contrary
5599f1d9476Smrgto the behaviour of most rm programs out there, and not conforming with
5609f1d9476Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561f33d31a3Smrg
5629f1d9476SmrgPlease tell bug-automake@gnu.org about your system, including the value
5639f1d9476Smrgof your $PATH and any error possibly output before this message.  This
5649f1d9476Smrgcan help us improve future automake versions.
565f33d31a3Smrg
5669f1d9476SmrgEND
5679f1d9476Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5689f1d9476Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5699f1d9476Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5709f1d9476Smrg    echo >&2
5719f1d9476Smrg  else
5729f1d9476Smrg    cat >&2 <<'END'
5739f1d9476SmrgAborting the configuration process, to ensure you take notice of the issue.
574f33d31a3Smrg
5759f1d9476SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5769f1d9476Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577f33d31a3Smrg
5789f1d9476SmrgIf you want to complete the configuration process using your problematic
5799f1d9476Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5809f1d9476Smrgto "yes", and re-run configure.
581f33d31a3Smrg
5829f1d9476SmrgEND
5839f1d9476Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5849f1d9476Smrg  fi
585f33d31a3Smrgfi
5869f1d9476Smrgdnl The trailing newline in this macro's definition is deliberate, for
5879f1d9476Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5889f1d9476Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5899f1d9476Smrg])
590f33d31a3Smrg
5919f1d9476Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5929f1d9476Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5939f1d9476Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5949f1d9476Smrgm4_define([_AC_COMPILER_EXEEXT],
5959f1d9476Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596f33d31a3Smrg
5979f1d9476Smrg# When config.status generates a header, we must update the stamp-h file.
5989f1d9476Smrg# This file resides in the same directory as the config header
5999f1d9476Smrg# that is generated.  The stamp files are numbered to have different names.
600f33d31a3Smrg
6019f1d9476Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6029f1d9476Smrg# loop where config.status creates the headers, so we can generate
6039f1d9476Smrg# our stamp files there.
6049f1d9476SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6059f1d9476Smrg[# Compute $1's index in $config_headers.
6069f1d9476Smrg_am_arg=$1
6079f1d9476Smrg_am_stamp_count=1
6089f1d9476Smrgfor _am_header in $config_headers :; do
6099f1d9476Smrg  case $_am_header in
6109f1d9476Smrg    $_am_arg | $_am_arg:* )
6119f1d9476Smrg      break ;;
6129f1d9476Smrg    * )
6139f1d9476Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6149f1d9476Smrg  esac
6159f1d9476Smrgdone
6169f1d9476Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617f33d31a3Smrg
6189f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6199f1d9476Smrg#
6209f1d9476Smrg# This file is free software; the Free Software Foundation
6219f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6229f1d9476Smrg# with or without modifications, as long as this notice is preserved.
6239f1d9476Smrg
6249f1d9476Smrg# AM_PROG_INSTALL_SH
6259f1d9476Smrg# ------------------
6269f1d9476Smrg# Define $install_sh.
6279f1d9476SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6289f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6299f1d9476Smrgif test x"${install_sh+set}" != xset; then
6309f1d9476Smrg  case $am_aux_dir in
6319f1d9476Smrg  *\ * | *\	*)
6329f1d9476Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6339f1d9476Smrg  *)
6349f1d9476Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6359f1d9476Smrg  esac
6369f1d9476Smrgfi
6379f1d9476SmrgAC_SUBST([install_sh])])
6389f1d9476Smrg
6399f1d9476Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6409f1d9476Smrg#
6419f1d9476Smrg# This file is free software; the Free Software Foundation
6429f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6439f1d9476Smrg# with or without modifications, as long as this notice is preserved.
6449f1d9476Smrg
6459f1d9476Smrg# Check whether the underlying file-system supports filenames
6469f1d9476Smrg# with a leading dot.  For instance MS-DOS doesn't.
6479f1d9476SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6489f1d9476Smrg[rm -rf .tst 2>/dev/null
6499f1d9476Smrgmkdir .tst 2>/dev/null
6509f1d9476Smrgif test -d .tst; then
6519f1d9476Smrg  am__leading_dot=.
652f33d31a3Smrgelse
6539f1d9476Smrg  am__leading_dot=_
654f33d31a3Smrgfi
6559f1d9476Smrgrmdir .tst 2>/dev/null
6569f1d9476SmrgAC_SUBST([am__leading_dot])])
657f33d31a3Smrg
6589f1d9476Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659f33d31a3Smrg
6609f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6619f1d9476Smrg#
6629f1d9476Smrg# This file is free software; the Free Software Foundation
6639f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6649f1d9476Smrg# with or without modifications, as long as this notice is preserved.
665f33d31a3Smrg
6669f1d9476Smrg# AM_MAKE_INCLUDE()
6679f1d9476Smrg# -----------------
6689f1d9476Smrg# Check whether make has an 'include' directive that can support all
6699f1d9476Smrg# the idioms we need for our automatic dependency tracking code.
6709f1d9476SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6719f1d9476Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6729f1d9476Smrgcat > confinc.mk << 'END'
6739f1d9476Smrgam__doit:
6749f1d9476Smrg	@echo this is the am__doit target >confinc.out
6759f1d9476Smrg.PHONY: am__doit
6769f1d9476SmrgEND
6779f1d9476Smrgam__include="#"
6789f1d9476Smrgam__quote=
6799f1d9476Smrg# BSD make does it like this.
6809f1d9476Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6819f1d9476Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6829f1d9476Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6839f1d9476Smrg_am_result=no
6849f1d9476Smrgfor s in GNU BSD; do
6859f1d9476Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6869f1d9476Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6879f1d9476Smrg      ['0:this is the am__doit target'],
6889f1d9476Smrg      [AS_CASE([$s],
6899f1d9476Smrg          [BSD], [am__include='.include' am__quote='"'],
6909f1d9476Smrg          [am__include='include' am__quote=''])])
6919f1d9476Smrg  if test "$am__include" != "#"; then
6929f1d9476Smrg    _am_result="yes ($s style)"
6939f1d9476Smrg    break
6949f1d9476Smrg  fi
6959f1d9476Smrgdone
6969f1d9476Smrgrm -f confinc.* confmf.*
6979f1d9476SmrgAC_MSG_RESULT([${_am_result}])
6989f1d9476SmrgAC_SUBST([am__include])])
6999f1d9476SmrgAC_SUBST([am__quote])])
700f33d31a3Smrg
7019f1d9476Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702f33d31a3Smrg
7039f1d9476Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704f33d31a3Smrg#
7059f1d9476Smrg# This file is free software; the Free Software Foundation
7069f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7079f1d9476Smrg# with or without modifications, as long as this notice is preserved.
708f33d31a3Smrg
7099f1d9476Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7109f1d9476Smrg# ------------------------------
7119f1d9476SmrgAC_DEFUN([AM_MISSING_PROG],
7129f1d9476Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7139f1d9476Smrg$1=${$1-"${am_missing_run}$2"}
7149f1d9476SmrgAC_SUBST($1)])
715f33d31a3Smrg
7169f1d9476Smrg# AM_MISSING_HAS_RUN
7179f1d9476Smrg# ------------------
7189f1d9476Smrg# Define MISSING if not defined so far and test if it is modern enough.
7199f1d9476Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7209f1d9476SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7219f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7229f1d9476SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7239f1d9476Smrgif test x"${MISSING+set}" != xset; then
7249f1d9476Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725f33d31a3Smrgfi
7269f1d9476Smrg# Use eval to expand $SHELL
7279f1d9476Smrgif eval "$MISSING --is-lightweight"; then
7289f1d9476Smrg  am_missing_run="$MISSING "
7299f1d9476Smrgelse
7309f1d9476Smrg  am_missing_run=
7319f1d9476Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732f33d31a3Smrgfi
7339f1d9476Smrg])
734f33d31a3Smrg
7359f1d9476Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736f33d31a3Smrg
7379f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7389f1d9476Smrg#
7399f1d9476Smrg# This file is free software; the Free Software Foundation
7409f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7419f1d9476Smrg# with or without modifications, as long as this notice is preserved.
742f33d31a3Smrg
7439f1d9476Smrg# _AM_MANGLE_OPTION(NAME)
7449f1d9476Smrg# -----------------------
7459f1d9476SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7469f1d9476Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747f33d31a3Smrg
7489f1d9476Smrg# _AM_SET_OPTION(NAME)
7499f1d9476Smrg# --------------------
7509f1d9476Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7519f1d9476SmrgAC_DEFUN([_AM_SET_OPTION],
7529f1d9476Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753f33d31a3Smrg
7549f1d9476Smrg# _AM_SET_OPTIONS(OPTIONS)
7559f1d9476Smrg# ------------------------
7569f1d9476Smrg# OPTIONS is a space-separated list of Automake options.
7579f1d9476SmrgAC_DEFUN([_AM_SET_OPTIONS],
7589f1d9476Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7599f1d9476Smrg
7609f1d9476Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7619f1d9476Smrg# -------------------------------------------
7629f1d9476Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7639f1d9476SmrgAC_DEFUN([_AM_IF_OPTION],
7649f1d9476Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7659f1d9476Smrg
7669f1d9476Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767f33d31a3Smrg#
7689f1d9476Smrg# This file is free software; the Free Software Foundation
7699f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7709f1d9476Smrg# with or without modifications, as long as this notice is preserved.
771f33d31a3Smrg
7729f1d9476Smrg# _AM_PROG_CC_C_O
7739f1d9476Smrg# ---------------
7749f1d9476Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7759f1d9476Smrg# to automatically call this.
7769f1d9476SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7779f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7789f1d9476SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7799f1d9476SmrgAC_LANG_PUSH([C])dnl
7809f1d9476SmrgAC_CACHE_CHECK(
7819f1d9476Smrg  [whether $CC understands -c and -o together],
7829f1d9476Smrg  [am_cv_prog_cc_c_o],
7839f1d9476Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7849f1d9476Smrg  # Make sure it works both with $CC and with simple cc.
7859f1d9476Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7869f1d9476Smrg  # compilers refuse to overwrite an existing .o file with -o,
7879f1d9476Smrg  # though they will create one.
7889f1d9476Smrg  am_cv_prog_cc_c_o=yes
7899f1d9476Smrg  for am_i in 1 2; do
7909f1d9476Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7919f1d9476Smrg         && test -f conftest2.$ac_objext; then
7929f1d9476Smrg      : OK
7939f1d9476Smrg    else
7949f1d9476Smrg      am_cv_prog_cc_c_o=no
7959f1d9476Smrg      break
7969f1d9476Smrg    fi
7979f1d9476Smrg  done
7989f1d9476Smrg  rm -f core conftest*
7999f1d9476Smrg  unset am_i])
8009f1d9476Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8019f1d9476Smrg   # Losing compiler, so override with the script.
8029f1d9476Smrg   # FIXME: It is wrong to rewrite CC.
8039f1d9476Smrg   # But if we don't then we get into trouble of one sort or another.
8049f1d9476Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8059f1d9476Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8069f1d9476Smrg   CC="$am_aux_dir/compile $CC"
807f33d31a3Smrgfi
8089f1d9476SmrgAC_LANG_POP([C])])
809f33d31a3Smrg
8109f1d9476Smrg# For backward compatibility.
8119f1d9476SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812f33d31a3Smrg
8139f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814f33d31a3Smrg#
8159f1d9476Smrg# This file is free software; the Free Software Foundation
8169f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
8179f1d9476Smrg# with or without modifications, as long as this notice is preserved.
818f33d31a3Smrg
8199f1d9476Smrg# AM_RUN_LOG(COMMAND)
8209f1d9476Smrg# -------------------
8219f1d9476Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8229f1d9476Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8239f1d9476SmrgAC_DEFUN([AM_RUN_LOG],
8249f1d9476Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8259f1d9476Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8269f1d9476Smrg   ac_status=$?
8279f1d9476Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8289f1d9476Smrg   (exit $ac_status); }])
8299f1d9476Smrg
8309f1d9476Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8319f1d9476Smrg
8329f1d9476Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833f33d31a3Smrg#
8349f1d9476Smrg# This file is free software; the Free Software Foundation
8359f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
8369f1d9476Smrg# with or without modifications, as long as this notice is preserved.
837f33d31a3Smrg
8389f1d9476Smrg# AM_SANITY_CHECK
8399f1d9476Smrg# ---------------
8409f1d9476SmrgAC_DEFUN([AM_SANITY_CHECK],
8419f1d9476Smrg[AC_MSG_CHECKING([whether build environment is sane])
8429f1d9476Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8439f1d9476Smrg# name.  Accept space and tab only in the latter.
8449f1d9476Smrgam_lf='
8459f1d9476Smrg'
8469f1d9476Smrgcase `pwd` in
8479f1d9476Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8489f1d9476Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8499f1d9476Smrgesac
8509f1d9476Smrgcase $srcdir in
8519f1d9476Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8529f1d9476Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8539f1d9476Smrgesac
8549f1d9476Smrg
8559f1d9476Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8569f1d9476Smrg# arguments.  Must try -L first in case configure is actually a
8579f1d9476Smrg# symlink; some systems play weird games with the mod time of symlinks
8589f1d9476Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8599f1d9476Smrg# directory).
8609f1d9476Smrgif (
8619f1d9476Smrg   am_has_slept=no
8629f1d9476Smrg   for am_try in 1 2; do
8639f1d9476Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8649f1d9476Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8659f1d9476Smrg     if test "$[*]" = "X"; then
8669f1d9476Smrg	# -L didn't work.
8679f1d9476Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8689f1d9476Smrg     fi
8699f1d9476Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8709f1d9476Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8719f1d9476Smrg
8729f1d9476Smrg	# If neither matched, then we have a broken ls.  This can happen
8739f1d9476Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8749f1d9476Smrg	# broken ls alias from the environment.  This has actually
8759f1d9476Smrg	# happened.  Such a system could not be considered "sane".
8769f1d9476Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8779f1d9476Smrg  alias in your environment])
8789f1d9476Smrg     fi
8799f1d9476Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8809f1d9476Smrg       break
8819f1d9476Smrg     fi
8829f1d9476Smrg     # Just in case.
8839f1d9476Smrg     sleep 1
8849f1d9476Smrg     am_has_slept=yes
8859f1d9476Smrg   done
8869f1d9476Smrg   test "$[2]" = conftest.file
8879f1d9476Smrg   )
8889f1d9476Smrgthen
8899f1d9476Smrg   # Ok.
8909f1d9476Smrg   :
891f33d31a3Smrgelse
8929f1d9476Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8939f1d9476SmrgCheck your system clock])
894f33d31a3Smrgfi
8959f1d9476SmrgAC_MSG_RESULT([yes])
8969f1d9476Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8979f1d9476Smrg# generated files are strictly newer.
8989f1d9476Smrgam_sleep_pid=
8999f1d9476Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9009f1d9476Smrg  ( sleep 1 ) &
9019f1d9476Smrg  am_sleep_pid=$!
9029f1d9476Smrgfi
9039f1d9476SmrgAC_CONFIG_COMMANDS_PRE(
9049f1d9476Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9059f1d9476Smrg   if test -n "$am_sleep_pid"; then
9069f1d9476Smrg     # Hide warnings about reused PIDs.
9079f1d9476Smrg     wait $am_sleep_pid 2>/dev/null
9089f1d9476Smrg   fi
9099f1d9476Smrg   AC_MSG_RESULT([done])])
9109f1d9476Smrgrm -f conftest.file
9119f1d9476Smrg])
912f33d31a3Smrg
9139f1d9476Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914f33d31a3Smrg#
9159f1d9476Smrg# This file is free software; the Free Software Foundation
9169f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
9179f1d9476Smrg# with or without modifications, as long as this notice is preserved.
918f33d31a3Smrg
9199f1d9476Smrg# AM_SILENT_RULES([DEFAULT])
9209f1d9476Smrg# --------------------------
9219f1d9476Smrg# Enable less verbose build rules; with the default set to DEFAULT
9229f1d9476Smrg# ("yes" being less verbose, "no" or empty being verbose).
9239f1d9476SmrgAC_DEFUN([AM_SILENT_RULES],
9249f1d9476Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9259f1d9476SmrgAS_HELP_STRING(
9269f1d9476Smrg  [--enable-silent-rules],
9279f1d9476Smrg  [less verbose build output (undo: "make V=1")])
9289f1d9476SmrgAS_HELP_STRING(
9299f1d9476Smrg  [--disable-silent-rules],
9309f1d9476Smrg  [verbose build output (undo: "make V=0")])dnl
9319f1d9476Smrg])
9329f1d9476Smrgcase $enable_silent_rules in @%:@ (((
9339f1d9476Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9349f1d9476Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9359f1d9476Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9369f1d9476Smrgesac
9379f1d9476Smrgdnl
9389f1d9476Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9399f1d9476Smrgdnl do not support nested variable expansions.
9409f1d9476Smrgdnl See automake bug#9928 and bug#10237.
9419f1d9476Smrgam_make=${MAKE-make}
9429f1d9476SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9439f1d9476Smrg   [am_cv_make_support_nested_variables],
9449f1d9476Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9459f1d9476SmrgBAR0=false
9469f1d9476SmrgBAR1=true
9479f1d9476SmrgV=1
9489f1d9476Smrgam__doit:
9499f1d9476Smrg	@$(TRUE)
9509f1d9476Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9519f1d9476Smrg  am_cv_make_support_nested_variables=yes
952f33d31a3Smrgelse
9539f1d9476Smrg  am_cv_make_support_nested_variables=no
9549f1d9476Smrgfi])
9559f1d9476Smrgif test $am_cv_make_support_nested_variables = yes; then
9569f1d9476Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9579f1d9476Smrg  AM_V='$(V)'
9589f1d9476Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9599f1d9476Smrgelse
9609f1d9476Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9619f1d9476Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962f33d31a3Smrgfi
9639f1d9476SmrgAC_SUBST([AM_V])dnl
9649f1d9476SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9659f1d9476SmrgAC_SUBST([AM_DEFAULT_V])dnl
9669f1d9476SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9679f1d9476SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9689f1d9476SmrgAM_BACKSLASH='\'
9699f1d9476SmrgAC_SUBST([AM_BACKSLASH])dnl
9709f1d9476Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9719f1d9476Smrg])
972f33d31a3Smrg
9739f1d9476Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974f33d31a3Smrg#
9759f1d9476Smrg# This file is free software; the Free Software Foundation
9769f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
9779f1d9476Smrg# with or without modifications, as long as this notice is preserved.
978f33d31a3Smrg
9799f1d9476Smrg# AM_PROG_INSTALL_STRIP
9809f1d9476Smrg# ---------------------
9819f1d9476Smrg# One issue with vendor 'install' (even GNU) is that you can't
9829f1d9476Smrg# specify the program used to strip binaries.  This is especially
9839f1d9476Smrg# annoying in cross-compiling environments, where the build's strip
9849f1d9476Smrg# is unlikely to handle the host's binaries.
9859f1d9476Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9869f1d9476Smrg# always use install-sh in "make install-strip", and initialize
9879f1d9476Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9889f1d9476SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9899f1d9476Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9909f1d9476Smrg# Installed binaries are usually stripped using 'strip' when the user
9919f1d9476Smrg# run "make install-strip".  However 'strip' might not be the right
9929f1d9476Smrg# tool to use in cross-compilation environments, therefore Automake
9939f1d9476Smrg# will honor the 'STRIP' environment variable to overrule this program.
9949f1d9476Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9959f1d9476Smrgif test "$cross_compiling" != no; then
9969f1d9476Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997f33d31a3Smrgfi
9989f1d9476SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9999f1d9476SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000f33d31a3Smrg
10019f1d9476Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002f33d31a3Smrg#
10039f1d9476Smrg# This file is free software; the Free Software Foundation
10049f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
10059f1d9476Smrg# with or without modifications, as long as this notice is preserved.
1006f33d31a3Smrg
10079f1d9476Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10089f1d9476Smrg# ---------------------------
10099f1d9476Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10109f1d9476Smrg# This macro is traced by Automake.
10119f1d9476SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012f33d31a3Smrg
10139f1d9476Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10149f1d9476Smrg# --------------------------
10159f1d9476Smrg# Public sister of _AM_SUBST_NOTMAKE.
10169f1d9476SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017f33d31a3Smrg
10189f1d9476Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019f33d31a3Smrg
10209f1d9476Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021f33d31a3Smrg#
10229f1d9476Smrg# This file is free software; the Free Software Foundation
10239f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
10249f1d9476Smrg# with or without modifications, as long as this notice is preserved.
10259f1d9476Smrg
10269f1d9476Smrg# _AM_PROG_TAR(FORMAT)
10279f1d9476Smrg# --------------------
10289f1d9476Smrg# Check how to create a tarball in format FORMAT.
10299f1d9476Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030f33d31a3Smrg#
10319f1d9476Smrg# Substitute a variable $(am__tar) that is a command
10329f1d9476Smrg# writing to stdout a FORMAT-tarball containing the directory
10339f1d9476Smrg# $tardir.
10349f1d9476Smrg#     tardir=directory && $(am__tar) > result.tar
1035f33d31a3Smrg#
10369f1d9476Smrg# Substitute a variable $(am__untar) that extract such
10379f1d9476Smrg# a tarball read from stdin.
10389f1d9476Smrg#     $(am__untar) < result.tar
1039f33d31a3Smrg#
10409f1d9476SmrgAC_DEFUN([_AM_PROG_TAR],
10419f1d9476Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10429f1d9476Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10439f1d9476SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044f33d31a3Smrg
10459f1d9476Smrg# We'll loop over all known methods to create a tar archive until one works.
10469f1d9476Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047f33d31a3Smrg
10489f1d9476Smrgm4_if([$1], [v7],
10499f1d9476Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050f33d31a3Smrg
10519f1d9476Smrg  [m4_case([$1],
10529f1d9476Smrg    [ustar],
10539f1d9476Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10549f1d9476Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10559f1d9476Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10569f1d9476Smrg      # and bug#13588).
10579f1d9476Smrg      am_max_uid=2097151 # 2^21 - 1
10589f1d9476Smrg      am_max_gid=$am_max_uid
10599f1d9476Smrg      # The $UID and $GID variables are not portable, so we need to resort
10609f1d9476Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10619f1d9476Smrg      # below are definitely unexpected, so allow the users to see them
10629f1d9476Smrg      # (that is, avoid stderr redirection).
10639f1d9476Smrg      am_uid=`id -u || echo unknown`
10649f1d9476Smrg      am_gid=`id -g || echo unknown`
10659f1d9476Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10669f1d9476Smrg      if test $am_uid -le $am_max_uid; then
10679f1d9476Smrg         AC_MSG_RESULT([yes])
10689f1d9476Smrg      else
10699f1d9476Smrg         AC_MSG_RESULT([no])
10709f1d9476Smrg         _am_tools=none
10719f1d9476Smrg      fi
10729f1d9476Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10739f1d9476Smrg      if test $am_gid -le $am_max_gid; then
10749f1d9476Smrg         AC_MSG_RESULT([yes])
10759f1d9476Smrg      else
10769f1d9476Smrg        AC_MSG_RESULT([no])
10779f1d9476Smrg        _am_tools=none
10789f1d9476Smrg      fi],
1079f33d31a3Smrg
10809f1d9476Smrg  [pax],
10819f1d9476Smrg    [],
1082f33d31a3Smrg
10839f1d9476Smrg  [m4_fatal([Unknown tar format])])
1084f33d31a3Smrg
10859f1d9476Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086f33d31a3Smrg
10879f1d9476Smrg  # Go ahead even if we have the value already cached.  We do so because we
10889f1d9476Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10899f1d9476Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090f33d31a3Smrg
10919f1d9476Smrg  for _am_tool in $_am_tools; do
10929f1d9476Smrg    case $_am_tool in
10939f1d9476Smrg    gnutar)
10949f1d9476Smrg      for _am_tar in tar gnutar gtar; do
10959f1d9476Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10969f1d9476Smrg      done
10979f1d9476Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10989f1d9476Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10999f1d9476Smrg      am__untar="$_am_tar -xf -"
11009f1d9476Smrg      ;;
11019f1d9476Smrg    plaintar)
11029f1d9476Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11039f1d9476Smrg      # ustar tarball either.
11049f1d9476Smrg      (tar --version) >/dev/null 2>&1 && continue
11059f1d9476Smrg      am__tar='tar chf - "$$tardir"'
11069f1d9476Smrg      am__tar_='tar chf - "$tardir"'
11079f1d9476Smrg      am__untar='tar xf -'
11089f1d9476Smrg      ;;
11099f1d9476Smrg    pax)
11109f1d9476Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11119f1d9476Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11129f1d9476Smrg      am__untar='pax -r'
11139f1d9476Smrg      ;;
11149f1d9476Smrg    cpio)
11159f1d9476Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11169f1d9476Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11179f1d9476Smrg      am__untar='cpio -i -H $1 -d'
11189f1d9476Smrg      ;;
11199f1d9476Smrg    none)
11209f1d9476Smrg      am__tar=false
11219f1d9476Smrg      am__tar_=false
11229f1d9476Smrg      am__untar=false
11239f1d9476Smrg      ;;
11249f1d9476Smrg    esac
1125f33d31a3Smrg
11269f1d9476Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11279f1d9476Smrg    # and am__untar set.
11289f1d9476Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129f33d31a3Smrg
11309f1d9476Smrg    # tar/untar a dummy directory, and stop if the command works.
11319f1d9476Smrg    rm -rf conftest.dir
11329f1d9476Smrg    mkdir conftest.dir
11339f1d9476Smrg    echo GrepMe > conftest.dir/file
11349f1d9476Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11359f1d9476Smrg    rm -rf conftest.dir
11369f1d9476Smrg    if test -s conftest.tar; then
11379f1d9476Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11389f1d9476Smrg      AM_RUN_LOG([cat conftest.dir/file])
11399f1d9476Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11409f1d9476Smrg    fi
11419f1d9476Smrg  done
11429f1d9476Smrg  rm -rf conftest.dir
1143f33d31a3Smrg
11449f1d9476Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11459f1d9476Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146f33d31a3Smrg
11479f1d9476SmrgAC_SUBST([am__tar])
11489f1d9476SmrgAC_SUBST([am__untar])
11499f1d9476Smrg]) # _AM_PROG_TAR
1150f33d31a3Smrg
11519f1d9476Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11529f1d9476Smrgdnl serial 11 (pkg-config-0.29)
11539f1d9476Smrgdnl
11549f1d9476Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11559f1d9476Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11569f1d9476Smrgdnl
11579f1d9476Smrgdnl This program is free software; you can redistribute it and/or modify
11589f1d9476Smrgdnl it under the terms of the GNU General Public License as published by
11599f1d9476Smrgdnl the Free Software Foundation; either version 2 of the License, or
11609f1d9476Smrgdnl (at your option) any later version.
11619f1d9476Smrgdnl
11629f1d9476Smrgdnl This program is distributed in the hope that it will be useful, but
11639f1d9476Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11649f1d9476Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11659f1d9476Smrgdnl General Public License for more details.
11669f1d9476Smrgdnl
11679f1d9476Smrgdnl You should have received a copy of the GNU General Public License
11689f1d9476Smrgdnl along with this program; if not, write to the Free Software
11699f1d9476Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11709f1d9476Smrgdnl 02111-1307, USA.
11719f1d9476Smrgdnl
11729f1d9476Smrgdnl As a special exception to the GNU General Public License, if you
11739f1d9476Smrgdnl distribute this file as part of a program that contains a
11749f1d9476Smrgdnl configuration script generated by Autoconf, you may include it under
11759f1d9476Smrgdnl the same distribution terms that you use for the rest of that
11769f1d9476Smrgdnl program.
1177f33d31a3Smrg
11789f1d9476Smrgdnl PKG_PREREQ(MIN-VERSION)
11799f1d9476Smrgdnl -----------------------
11809f1d9476Smrgdnl Since: 0.29
11819f1d9476Smrgdnl
11829f1d9476Smrgdnl Verify that the version of the pkg-config macros are at least
11839f1d9476Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11849f1d9476Smrgdnl installed version of pkg-config, this checks the developer's version
11859f1d9476Smrgdnl of pkg.m4 when generating configure.
11869f1d9476Smrgdnl
11879f1d9476Smrgdnl To ensure that this macro is defined, also add:
11889f1d9476Smrgdnl m4_ifndef([PKG_PREREQ],
11899f1d9476Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11909f1d9476Smrgdnl
11919f1d9476Smrgdnl See the "Since" comment for each macro you use to see what version
11929f1d9476Smrgdnl of the macros you require.
11939f1d9476Smrgm4_defun([PKG_PREREQ],
11949f1d9476Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11959f1d9476Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11969f1d9476Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11979f1d9476Smrg])dnl PKG_PREREQ
1198f33d31a3Smrg
11999f1d9476Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12009f1d9476Smrgdnl ----------------------------------
12019f1d9476Smrgdnl Since: 0.16
12029f1d9476Smrgdnl
12039f1d9476Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12049f1d9476Smrgdnl first found in the path. Checks that the version of pkg-config found
12059f1d9476Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12069f1d9476Smrgdnl used since that's the first version where most current features of
12079f1d9476Smrgdnl pkg-config existed.
12089f1d9476SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12099f1d9476Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12109f1d9476Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12119f1d9476Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12129f1d9476SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12139f1d9476SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12149f1d9476SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215f33d31a3Smrg
12169f1d9476Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12179f1d9476Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218f33d31a3Smrgfi
12199f1d9476Smrgif test -n "$PKG_CONFIG"; then
12209f1d9476Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12219f1d9476Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12229f1d9476Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12239f1d9476Smrg		AC_MSG_RESULT([yes])
12249f1d9476Smrg	else
12259f1d9476Smrg		AC_MSG_RESULT([no])
12269f1d9476Smrg		PKG_CONFIG=""
12279f1d9476Smrg	fi
12289f1d9476Smrgfi[]dnl
12299f1d9476Smrg])dnl PKG_PROG_PKG_CONFIG
1230f33d31a3Smrg
12319f1d9476Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12329f1d9476Smrgdnl -------------------------------------------------------------------
12339f1d9476Smrgdnl Since: 0.18
12349f1d9476Smrgdnl
12359f1d9476Smrgdnl Check to see whether a particular set of modules exists. Similar to
12369f1d9476Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12379f1d9476Smrgdnl
12389f1d9476Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12399f1d9476Smrgdnl only at the first occurence in configure.ac, so if the first place
12409f1d9476Smrgdnl it's called might be skipped (such as if it is within an "if", you
12419f1d9476Smrgdnl have to call PKG_CHECK_EXISTS manually
12429f1d9476SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12439f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12449f1d9476Smrgif test -n "$PKG_CONFIG" && \
12459f1d9476Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12469f1d9476Smrg  m4_default([$2], [:])
12479f1d9476Smrgm4_ifvaln([$3], [else
12489f1d9476Smrg  $3])dnl
12499f1d9476Smrgfi])
12509f1d9476Smrg
12519f1d9476Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12529f1d9476Smrgdnl ---------------------------------------------
12539f1d9476Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12549f1d9476Smrgdnl pkg_failed based on the result.
12559f1d9476Smrgm4_define([_PKG_CONFIG],
12569f1d9476Smrg[if test -n "$$1"; then
12579f1d9476Smrg    pkg_cv_[]$1="$$1"
12589f1d9476Smrg elif test -n "$PKG_CONFIG"; then
12599f1d9476Smrg    PKG_CHECK_EXISTS([$3],
12609f1d9476Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12619f1d9476Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12629f1d9476Smrg		     [pkg_failed=yes])
12639f1d9476Smrg else
12649f1d9476Smrg    pkg_failed=untried
12659f1d9476Smrgfi[]dnl
12669f1d9476Smrg])dnl _PKG_CONFIG
12679f1d9476Smrg
12689f1d9476Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12699f1d9476Smrgdnl ---------------------------
12709f1d9476Smrgdnl Internal check to see if pkg-config supports short errors.
12719f1d9476SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12729f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12739f1d9476Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12749f1d9476Smrg        _pkg_short_errors_supported=yes
1275f33d31a3Smrgelse
12769f1d9476Smrg        _pkg_short_errors_supported=no
12779f1d9476Smrgfi[]dnl
12789f1d9476Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279f33d31a3Smrg
1280f33d31a3Smrg
12819f1d9476Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12829f1d9476Smrgdnl   [ACTION-IF-NOT-FOUND])
12839f1d9476Smrgdnl --------------------------------------------------------------
12849f1d9476Smrgdnl Since: 0.4.0
12859f1d9476Smrgdnl
12869f1d9476Smrgdnl Note that if there is a possibility the first call to
12879f1d9476Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12889f1d9476Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12899f1d9476SmrgAC_DEFUN([PKG_CHECK_MODULES],
12909f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12919f1d9476SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12929f1d9476SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293f33d31a3Smrg
12949f1d9476Smrgpkg_failed=no
12959f1d9476SmrgAC_MSG_CHECKING([for $1])
1296f33d31a3Smrg
12979f1d9476Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12989f1d9476Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299f33d31a3Smrg
13009f1d9476Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13019f1d9476Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13029f1d9476SmrgSee the pkg-config man page for more details.])
1303f33d31a3Smrg
13049f1d9476Smrgif test $pkg_failed = yes; then
13059f1d9476Smrg   	AC_MSG_RESULT([no])
13069f1d9476Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13079f1d9476Smrg        if test $_pkg_short_errors_supported = yes; then
13089f1d9476Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13099f1d9476Smrg        else 
13109f1d9476Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13119f1d9476Smrg        fi
13129f1d9476Smrg	# Put the nasty error message in config.log where it belongs
13139f1d9476Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314f33d31a3Smrg
13159f1d9476Smrg	m4_default([$4], [AC_MSG_ERROR(
13169f1d9476Smrg[Package requirements ($2) were not met:
1317f33d31a3Smrg
13189f1d9476Smrg$$1_PKG_ERRORS
13199f1d9476Smrg
13209f1d9476SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13219f1d9476Smrginstalled software in a non-standard prefix.
13229f1d9476Smrg
13239f1d9476Smrg_PKG_TEXT])[]dnl
13249f1d9476Smrg        ])
13259f1d9476Smrgelif test $pkg_failed = untried; then
13269f1d9476Smrg     	AC_MSG_RESULT([no])
13279f1d9476Smrg	m4_default([$4], [AC_MSG_FAILURE(
13289f1d9476Smrg[The pkg-config script could not be found or is too old.  Make sure it
13299f1d9476Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13309f1d9476Smrgpath to pkg-config.
13319f1d9476Smrg
13329f1d9476Smrg_PKG_TEXT
13339f1d9476Smrg
13349f1d9476SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13359f1d9476Smrg        ])
1336f33d31a3Smrgelse
13379f1d9476Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13389f1d9476Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13399f1d9476Smrg        AC_MSG_RESULT([yes])
13409f1d9476Smrg	$3
13419f1d9476Smrgfi[]dnl
13429f1d9476Smrg])dnl PKG_CHECK_MODULES
1343f33d31a3Smrg
1344f33d31a3Smrg
13459f1d9476Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13469f1d9476Smrgdnl   [ACTION-IF-NOT-FOUND])
13479f1d9476Smrgdnl ---------------------------------------------------------------------
13489f1d9476Smrgdnl Since: 0.29
13499f1d9476Smrgdnl
13509f1d9476Smrgdnl Checks for existence of MODULES and gathers its build flags with
13519f1d9476Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13529f1d9476Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13539f1d9476Smrgdnl
13549f1d9476Smrgdnl Note that if there is a possibility the first call to
13559f1d9476Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13569f1d9476Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13579f1d9476Smrgdnl configure.ac.
13589f1d9476SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13599f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13609f1d9476Smrg_save_PKG_CONFIG=$PKG_CONFIG
13619f1d9476SmrgPKG_CONFIG="$PKG_CONFIG --static"
13629f1d9476SmrgPKG_CHECK_MODULES($@)
13639f1d9476SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13649f1d9476Smrg])dnl PKG_CHECK_MODULES_STATIC
1365f33d31a3Smrg
1366f33d31a3Smrg
13679f1d9476Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13689f1d9476Smrgdnl -------------------------
13699f1d9476Smrgdnl Since: 0.27
13709f1d9476Smrgdnl
13719f1d9476Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13729f1d9476Smrgdnl should install pkg-config .pc files. By default the directory is
13739f1d9476Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13749f1d9476Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13759f1d9476Smrgdnl parameter.
13769f1d9476SmrgAC_DEFUN([PKG_INSTALLDIR],
13779f1d9476Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13789f1d9476Smrgm4_pushdef([pkg_description],
13799f1d9476Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13809f1d9476SmrgAC_ARG_WITH([pkgconfigdir],
13819f1d9476Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13829f1d9476Smrg    [with_pkgconfigdir=]pkg_default)
13839f1d9476SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13849f1d9476Smrgm4_popdef([pkg_default])
13859f1d9476Smrgm4_popdef([pkg_description])
13869f1d9476Smrg])dnl PKG_INSTALLDIR
13879f1d9476Smrg
13889f1d9476Smrg
13899f1d9476Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13909f1d9476Smrgdnl --------------------------------
13919f1d9476Smrgdnl Since: 0.27
13929f1d9476Smrgdnl
13939f1d9476Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13949f1d9476Smrgdnl module should install arch-independent pkg-config .pc files. By
13959f1d9476Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13969f1d9476Smrgdnl changed by passing DIRECTORY. The user can override through the
13979f1d9476Smrgdnl --with-noarch-pkgconfigdir parameter.
13989f1d9476SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13999f1d9476Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14009f1d9476Smrgm4_pushdef([pkg_description],
14019f1d9476Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14029f1d9476SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14039f1d9476Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14049f1d9476Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14059f1d9476SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14069f1d9476Smrgm4_popdef([pkg_default])
14079f1d9476Smrgm4_popdef([pkg_description])
14089f1d9476Smrg])dnl PKG_NOARCH_INSTALLDIR
14099f1d9476Smrg
1410f33d31a3Smrg
14119f1d9476Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14129f1d9476Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14139f1d9476Smrgdnl -------------------------------------------
14149f1d9476Smrgdnl Since: 0.28
14159f1d9476Smrgdnl
14169f1d9476Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14179f1d9476SmrgAC_DEFUN([PKG_CHECK_VAR],
14189f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14199f1d9476SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420f33d31a3Smrg
14219f1d9476Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14229f1d9476SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423f33d31a3Smrg
14249f1d9476SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14259f1d9476Smrg])dnl PKG_CHECK_VAR
1426f33d31a3Smrg
14279f1d9476Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14289f1d9476Smrgdnl
14299f1d9476Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14309f1d9476Smrgdnl
14319f1d9476Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14329f1d9476Smrgdnl copy of this software and associated documentation files (the "Software"),
14339f1d9476Smrgdnl to deal in the Software without restriction, including without limitation
14349f1d9476Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14359f1d9476Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14369f1d9476Smrgdnl Software is furnished to do so, subject to the following conditions:
14379f1d9476Smrgdnl
14389f1d9476Smrgdnl The above copyright notice and this permission notice (including the next
14399f1d9476Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14409f1d9476Smrgdnl Software.
14419f1d9476Smrgdnl
14429f1d9476Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14439f1d9476Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14449f1d9476Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14459f1d9476Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14469f1d9476Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14479f1d9476Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14489f1d9476Smrgdnl DEALINGS IN THE SOFTWARE.
1449f33d31a3Smrg
14509f1d9476Smrg# XORG_MACROS_VERSION(required-version)
14519f1d9476Smrg# -------------------------------------
1452f33d31a3Smrg# Minimum version: 1.1.0
1453f33d31a3Smrg#
14549f1d9476Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14559f1d9476Smrg# your configure.ac with the minimum required version, such as:
14569f1d9476Smrg# XORG_MACROS_VERSION(1.1)
1457f33d31a3Smrg#
14589f1d9476Smrg# To ensure that this macro is defined, also add:
14599f1d9476Smrg# m4_ifndef([XORG_MACROS_VERSION],
14609f1d9476Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461f33d31a3Smrg#
14629f1d9476Smrg#
14639f1d9476Smrg# See the "minimum version" comment for each macro you use to see what
14649f1d9476Smrg# version you require.
14659f1d9476Smrgm4_defun([XORG_MACROS_VERSION],[
14669f1d9476Smrgm4_define([vers_have], [1.19.3])
14679f1d9476Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14689f1d9476Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14699f1d9476Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14709f1d9476Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14719f1d9476Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14729f1d9476Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14739f1d9476Smrgm4_undefine([vers_have])
14749f1d9476Smrgm4_undefine([maj_have])
14759f1d9476Smrgm4_undefine([maj_needed])
14769f1d9476Smrg]) # XORG_MACROS_VERSION
1477f33d31a3Smrg
14789f1d9476Smrg# XORG_PROG_RAWCPP()
14799f1d9476Smrg# ------------------
14809f1d9476Smrg# Minimum version: 1.0.0
14819f1d9476Smrg#
14829f1d9476Smrg# Find cpp program and necessary flags for use in pre-processing text files
14839f1d9476Smrg# such as man pages and config files
14849f1d9476SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14859f1d9476SmrgAC_REQUIRE([AC_PROG_CPP])
14869f1d9476SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14879f1d9476Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488f33d31a3Smrg
14899f1d9476Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14909f1d9476Smrg# which is not the best choice for supporting other OS'es, but covers most
14919f1d9476Smrg# of the ones we need for now.
14929f1d9476SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14939f1d9476SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14949f1d9476Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14959f1d9476Smrg	AC_MSG_RESULT([no])
14969f1d9476Smrgelse
14979f1d9476Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14989f1d9476Smrg		RAWCPPFLAGS=-undef
14999f1d9476Smrg		AC_MSG_RESULT([yes])
15009f1d9476Smrg	# under Cygwin unix is still defined even with -undef
15019f1d9476Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15029f1d9476Smrg		RAWCPPFLAGS="-undef -ansi"
15039f1d9476Smrg		AC_MSG_RESULT([yes, with -ansi])
15049f1d9476Smrg	else
15059f1d9476Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15069f1d9476Smrg	fi
1507f33d31a3Smrgfi
15089f1d9476Smrgrm -f conftest.$ac_ext
1509f33d31a3Smrg
15109f1d9476SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15119f1d9476SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15129f1d9476Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15139f1d9476Smrg	AC_MSG_RESULT([no])
15149f1d9476Smrgelse
15159f1d9476Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15169f1d9476Smrg		TRADITIONALCPPFLAGS="-traditional"
15179f1d9476Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15189f1d9476Smrg		AC_MSG_RESULT([yes])
15199f1d9476Smrg	else
15209f1d9476Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15219f1d9476Smrg	fi
15229f1d9476Smrgfi
15239f1d9476Smrgrm -f conftest.$ac_ext
15249f1d9476SmrgAC_SUBST(RAWCPPFLAGS)
15259f1d9476SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15269f1d9476Smrg]) # XORG_PROG_RAWCPP
1527f33d31a3Smrg
15289f1d9476Smrg# XORG_MANPAGE_SECTIONS()
15299f1d9476Smrg# -----------------------
15309f1d9476Smrg# Minimum version: 1.0.0
1531f33d31a3Smrg#
15329f1d9476Smrg# Determine which sections man pages go in for the different man page types
15339f1d9476Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15349f1d9476Smrg# Not sure if there's any better way than just hardcoding by OS name.
15359f1d9476Smrg# Override default settings by setting environment variables
15369f1d9476Smrg# Added MAN_SUBSTS in version 1.8
15379f1d9476Smrg# Added AC_PROG_SED in version 1.8
1538f33d31a3Smrg
15399f1d9476SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15409f1d9476SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15419f1d9476SmrgAC_REQUIRE([AC_PROG_SED])
1542f33d31a3Smrg
15439f1d9476Smrgcase $host_os in
15449f1d9476Smrg    solaris*)
15459f1d9476Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15469f1d9476Smrg        # check for a man page file found in later versions that use
15479f1d9476Smrg        # traditional section numbers instead
15489f1d9476Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15499f1d9476Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15509f1d9476Smrg        ;;
15519f1d9476Smrg    *) SYSV_MAN_SECTIONS=false ;;
15529f1d9476Smrgesac
1553f33d31a3Smrg
15549f1d9476Smrgif test x$APP_MAN_SUFFIX = x    ; then
15559f1d9476Smrg    APP_MAN_SUFFIX=1
15569f1d9476Smrgfi
15579f1d9476Smrgif test x$APP_MAN_DIR = x    ; then
15589f1d9476Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15599f1d9476Smrgfi
1560f33d31a3Smrg
15619f1d9476Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15629f1d9476Smrg    LIB_MAN_SUFFIX=3
15639f1d9476Smrgfi
15649f1d9476Smrgif test x$LIB_MAN_DIR = x    ; then
15659f1d9476Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15669f1d9476Smrgfi
1567f33d31a3Smrg
15689f1d9476Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15699f1d9476Smrg    case $SYSV_MAN_SECTIONS in
15709f1d9476Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15719f1d9476Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15729f1d9476Smrg    esac
15739f1d9476Smrgfi
15749f1d9476Smrgif test x$FILE_MAN_DIR = x    ; then
15759f1d9476Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576f33d31a3Smrgfi
1577f33d31a3Smrg
15789f1d9476Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15799f1d9476Smrg    case $SYSV_MAN_SECTIONS in
15809f1d9476Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15819f1d9476Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15829f1d9476Smrg    esac
15839f1d9476Smrgfi
15849f1d9476Smrgif test x$MISC_MAN_DIR = x    ; then
15859f1d9476Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586f33d31a3Smrgfi
1587f33d31a3Smrg
15889f1d9476Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15899f1d9476Smrg    case $SYSV_MAN_SECTIONS in
15909f1d9476Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15919f1d9476Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15929f1d9476Smrg    esac
15939f1d9476Smrgfi
15949f1d9476Smrgif test x$DRIVER_MAN_DIR = x    ; then
15959f1d9476Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15969f1d9476Smrgfi
1597f33d31a3Smrg
15989f1d9476Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15999f1d9476Smrg    case $SYSV_MAN_SECTIONS in
16009f1d9476Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16019f1d9476Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16029f1d9476Smrg    esac
16039f1d9476Smrgfi
16049f1d9476Smrgif test x$ADMIN_MAN_DIR = x    ; then
16059f1d9476Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16069f1d9476Smrgfi
1607f33d31a3Smrg
1608f33d31a3Smrg
16099f1d9476SmrgAC_SUBST([APP_MAN_SUFFIX])
16109f1d9476SmrgAC_SUBST([LIB_MAN_SUFFIX])
16119f1d9476SmrgAC_SUBST([FILE_MAN_SUFFIX])
16129f1d9476SmrgAC_SUBST([MISC_MAN_SUFFIX])
16139f1d9476SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16149f1d9476SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16159f1d9476SmrgAC_SUBST([APP_MAN_DIR])
16169f1d9476SmrgAC_SUBST([LIB_MAN_DIR])
16179f1d9476SmrgAC_SUBST([FILE_MAN_DIR])
16189f1d9476SmrgAC_SUBST([MISC_MAN_DIR])
16199f1d9476SmrgAC_SUBST([DRIVER_MAN_DIR])
16209f1d9476SmrgAC_SUBST([ADMIN_MAN_DIR])
1621f33d31a3Smrg
16229f1d9476SmrgXORG_MAN_PAGE="X Version 11"
16239f1d9476SmrgAC_SUBST([XORG_MAN_PAGE])
16249f1d9476SmrgMAN_SUBSTS="\
16259f1d9476Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16269f1d9476Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16279f1d9476Smrg	-e 's|__xservername__|Xorg|g' \
16289f1d9476Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16299f1d9476Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16309f1d9476Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16319f1d9476Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16329f1d9476Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16339f1d9476Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16349f1d9476Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16359f1d9476Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16369f1d9476Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16379f1d9476SmrgAC_SUBST([MAN_SUBSTS])
1638f33d31a3Smrg
16399f1d9476Smrg]) # XORG_MANPAGE_SECTIONS
1640f33d31a3Smrg
16419f1d9476Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16429f1d9476Smrg# ------------------------
16439f1d9476Smrg# Minimum version: 1.7.0
1644f33d31a3Smrg#
16459f1d9476Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16469f1d9476Smrg# provided by xorg-sgml-doctools, if installed.
16479f1d9476SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16489f1d9476SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16499f1d9476SmrgXORG_SGML_PATH=
16509f1d9476SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16519f1d9476Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16529f1d9476Smrg    [m4_ifval([$1],[:],
16539f1d9476Smrg        [if test x"$cross_compiling" != x"yes" ; then
16549f1d9476Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16559f1d9476Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16569f1d9476Smrg         fi])
16579f1d9476Smrg    ])
16589f1d9476Smrg
16599f1d9476Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16609f1d9476Smrg# the path and the name of the doc stylesheet
16619f1d9476Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16629f1d9476Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16639f1d9476Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16649f1d9476Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16659f1d9476Smrgelse
16669f1d9476Smrg   AC_MSG_RESULT([no])
16679f1d9476Smrgfi
16689f1d9476Smrg
16699f1d9476SmrgAC_SUBST(XORG_SGML_PATH)
16709f1d9476SmrgAC_SUBST(STYLESHEET_SRCDIR)
16719f1d9476SmrgAC_SUBST(XSL_STYLESHEET)
16729f1d9476SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16739f1d9476Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16749f1d9476Smrg
16759f1d9476Smrg# XORG_CHECK_LINUXDOC
16769f1d9476Smrg# -------------------
16779f1d9476Smrg# Minimum version: 1.0.0
1678f33d31a3Smrg#
16799f1d9476Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16809f1d9476Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16819f1d9476Smrg# Whether or not the necessary tools and files are found can be checked
16829f1d9476Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16839f1d9476SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16849f1d9476SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16859f1d9476SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686f33d31a3Smrg
16879f1d9476SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688f33d31a3Smrg
16899f1d9476SmrgAC_MSG_CHECKING([whether to build documentation])
16909f1d9476Smrg
16919f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16929f1d9476Smrg   BUILDDOC=yes
1693f33d31a3Smrgelse
16949f1d9476Smrg   BUILDDOC=no
1695f33d31a3Smrgfi
1696f33d31a3Smrg
16979f1d9476SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698f33d31a3Smrg
16999f1d9476SmrgAC_MSG_RESULT([$BUILDDOC])
1700f33d31a3Smrg
17019f1d9476SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17029f1d9476Smrg
17039f1d9476Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17049f1d9476Smrg   BUILDPDFDOC=yes
17059f1d9476Smrgelse
17069f1d9476Smrg   BUILDPDFDOC=no
17079f1d9476Smrgfi
17089f1d9476Smrg
17099f1d9476SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17109f1d9476Smrg
17119f1d9476SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17129f1d9476Smrg
17139f1d9476SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17149f1d9476SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17159f1d9476SmrgMAKE_PDF="$PS2PDF"
17169f1d9476SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17179f1d9476Smrg
17189f1d9476SmrgAC_SUBST(MAKE_TEXT)
17199f1d9476SmrgAC_SUBST(MAKE_PS)
17209f1d9476SmrgAC_SUBST(MAKE_PDF)
17219f1d9476SmrgAC_SUBST(MAKE_HTML)
17229f1d9476Smrg]) # XORG_CHECK_LINUXDOC
17239f1d9476Smrg
17249f1d9476Smrg# XORG_CHECK_DOCBOOK
17259f1d9476Smrg# -------------------
17269f1d9476Smrg# Minimum version: 1.0.0
17279f1d9476Smrg#
17289f1d9476Smrg# Checks for the ability to build output formats from SGML DocBook source.
17299f1d9476Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17309f1d9476Smrg# indicates whether the necessary tools and files are found and, if set,
17319f1d9476Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17329f1d9476SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17339f1d9476SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17349f1d9476Smrg
17359f1d9476SmrgBUILDTXTDOC=no
17369f1d9476SmrgBUILDPDFDOC=no
17379f1d9476SmrgBUILDPSDOC=no
17389f1d9476SmrgBUILDHTMLDOC=no
17399f1d9476Smrg
17409f1d9476SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17419f1d9476SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17429f1d9476SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17439f1d9476SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744f33d31a3Smrg
17459f1d9476SmrgAC_MSG_CHECKING([whether to build text documentation])
17469f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17479f1d9476Smrg   test x$BUILD_TXTDOC != xno; then
17489f1d9476Smrg	BUILDTXTDOC=yes
17499f1d9476Smrgfi
17509f1d9476SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17519f1d9476SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752f33d31a3Smrg
17539f1d9476SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17549f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17559f1d9476Smrg   test x$BUILD_PDFDOC != xno; then
17569f1d9476Smrg	BUILDPDFDOC=yes
17579f1d9476Smrgfi
17589f1d9476SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17599f1d9476SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760f33d31a3Smrg
17619f1d9476SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17629f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17639f1d9476Smrg   test x$BUILD_PSDOC != xno; then
17649f1d9476Smrg	BUILDPSDOC=yes
1765f33d31a3Smrgfi
17669f1d9476SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17679f1d9476SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768f33d31a3Smrg
17699f1d9476SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17709f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17719f1d9476Smrg   test x$BUILD_HTMLDOC != xno; then
17729f1d9476Smrg	BUILDHTMLDOC=yes
17739f1d9476Smrgfi
17749f1d9476SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17759f1d9476SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776f33d31a3Smrg
17779f1d9476SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17789f1d9476SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17799f1d9476SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17809f1d9476SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17819f1d9476Smrg
17829f1d9476SmrgAC_SUBST(MAKE_TEXT)
17839f1d9476SmrgAC_SUBST(MAKE_PS)
17849f1d9476SmrgAC_SUBST(MAKE_PDF)
17859f1d9476SmrgAC_SUBST(MAKE_HTML)
17869f1d9476Smrg]) # XORG_CHECK_DOCBOOK
17879f1d9476Smrg
17889f1d9476Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17899f1d9476Smrg# ----------------
17909f1d9476Smrg# Minimum version: 1.5.0
17919f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792f33d31a3Smrg#
17939f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
17949f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
17959f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17969f1d9476Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17979f1d9476Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17989f1d9476Smrg# --with-xmlto assumes 'auto'.
1799f33d31a3Smrg#
18009f1d9476Smrg# Interface to module:
18019f1d9476Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18029f1d9476Smrg# XMLTO:	returns the path of the xmlto program found
18039f1d9476Smrg#		returns the path set by the user in the environment
18049f1d9476Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18059f1d9476Smrg#		'no' user instructs the module not to use xmlto
1806f33d31a3Smrg#
18079f1d9476Smrg# Added in version 1.10.0
18089f1d9476Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18099f1d9476Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810f33d31a3Smrg#
18119f1d9476Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812f33d31a3Smrg#
18139f1d9476SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18149f1d9476SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18159f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
18169f1d9476SmrgAC_ARG_WITH(xmlto,
18179f1d9476Smrg	AS_HELP_STRING([--with-xmlto],
18189f1d9476Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18199f1d9476Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18209f1d9476Smrgm4_undefine([_defopt])
1821f33d31a3Smrg
18229f1d9476Smrgif test "x$use_xmlto" = x"auto"; then
18239f1d9476Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18249f1d9476Smrg   if test "x$XMLTO" = "x"; then
18259f1d9476Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18269f1d9476Smrg	have_xmlto=no
18279f1d9476Smrg   else
18289f1d9476Smrg        have_xmlto=yes
18299f1d9476Smrg   fi
18309f1d9476Smrgelif test "x$use_xmlto" = x"yes" ; then
18319f1d9476Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18329f1d9476Smrg   if test "x$XMLTO" = "x"; then
18339f1d9476Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18349f1d9476Smrg   fi
18359f1d9476Smrg   have_xmlto=yes
18369f1d9476Smrgelif test "x$use_xmlto" = x"no" ; then
18379f1d9476Smrg   if test "x$XMLTO" != "x"; then
18389f1d9476Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18399f1d9476Smrg   fi
18409f1d9476Smrg   have_xmlto=no
18419f1d9476Smrgelse
18429f1d9476Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18439f1d9476Smrgfi
1844f33d31a3Smrg
18459f1d9476Smrg# Test for a minimum version of xmlto, if provided.
18469f1d9476Smrgm4_ifval([$1],
18479f1d9476Smrg[if test "$have_xmlto" = yes; then
18489f1d9476Smrg    # scrape the xmlto version
18499f1d9476Smrg    AC_MSG_CHECKING([the xmlto version])
18509f1d9476Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18519f1d9476Smrg    AC_MSG_RESULT([$xmlto_version])
18529f1d9476Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18539f1d9476Smrg        [if test "x$use_xmlto" = xauto; then
18549f1d9476Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18559f1d9476Smrg            have_xmlto=no
18569f1d9476Smrg        else
18579f1d9476Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18589f1d9476Smrg        fi])
18599f1d9476Smrgfi])
1860f33d31a3Smrg
18619f1d9476Smrg# Test for the ability of xmlto to generate a text target
18629f1d9476Smrg#
18639f1d9476Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18649f1d9476Smrg# following test for empty XML docbook files.
18659f1d9476Smrg# For compatibility reasons use the following empty XML docbook file and if
18669f1d9476Smrg# it fails try it again with a non-empty XML file.
18679f1d9476Smrghave_xmlto_text=no
18689f1d9476Smrgcat > conftest.xml << "EOF"
18699f1d9476SmrgEOF
18709f1d9476SmrgAS_IF([test "$have_xmlto" = yes],
18719f1d9476Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18729f1d9476Smrg             [have_xmlto_text=yes],
18739f1d9476Smrg             [# Try it again with a non-empty XML file.
18749f1d9476Smrg              cat > conftest.xml << "EOF"
18759f1d9476Smrg<x></x>
18769f1d9476SmrgEOF
18779f1d9476Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18789f1d9476Smrg                    [have_xmlto_text=yes],
18799f1d9476Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18809f1d9476Smrgrm -f conftest.xml
18819f1d9476SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18829f1d9476SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18839f1d9476Smrg]) # XORG_WITH_XMLTO
1884f33d31a3Smrg
18859f1d9476Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18869f1d9476Smrg# --------------------------------------------
18879f1d9476Smrg# Minimum version: 1.12.0
18889f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18899f1d9476Smrg#
18909f1d9476Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18919f1d9476Smrg# XML-based language used for the transformation of XML documents.
18929f1d9476Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18939f1d9476Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18949f1d9476Smrg# The XSLT processor is often used as a standalone tool for transformations.
18959f1d9476Smrg# It should not be assumed that this tool is used only to work with documnetation.
18969f1d9476Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18979f1d9476Smrg#
18989f1d9476Smrg# Interface to module:
18999f1d9476Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19009f1d9476Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19019f1d9476Smrg#		 returns the path set by the user in the environment
19029f1d9476Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19039f1d9476Smrg#		  'no' user instructs the module not to use xsltproc
19049f1d9476Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19059f1d9476Smrg#
19069f1d9476Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19079f1d9476Smrg#
19089f1d9476SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19099f1d9476SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19109f1d9476Smrg# Preserves the interface, should it be implemented later
19119f1d9476Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19129f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
19139f1d9476SmrgAC_ARG_WITH(xsltproc,
19149f1d9476Smrg	AS_HELP_STRING([--with-xsltproc],
19159f1d9476Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19169f1d9476Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19179f1d9476Smrgm4_undefine([_defopt])
1918f33d31a3Smrg
19199f1d9476Smrgif test "x$use_xsltproc" = x"auto"; then
19209f1d9476Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19219f1d9476Smrg   if test "x$XSLTPROC" = "x"; then
19229f1d9476Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19239f1d9476Smrg	have_xsltproc=no
19249f1d9476Smrg   else
19259f1d9476Smrg        have_xsltproc=yes
19269f1d9476Smrg   fi
19279f1d9476Smrgelif test "x$use_xsltproc" = x"yes" ; then
19289f1d9476Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19299f1d9476Smrg   if test "x$XSLTPROC" = "x"; then
19309f1d9476Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19319f1d9476Smrg   fi
19329f1d9476Smrg   have_xsltproc=yes
19339f1d9476Smrgelif test "x$use_xsltproc" = x"no" ; then
19349f1d9476Smrg   if test "x$XSLTPROC" != "x"; then
19359f1d9476Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19369f1d9476Smrg   fi
19379f1d9476Smrg   have_xsltproc=no
19389f1d9476Smrgelse
19399f1d9476Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940f33d31a3Smrgfi
1941f33d31a3Smrg
19429f1d9476SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19439f1d9476Smrg]) # XORG_WITH_XSLTPROC
19449f1d9476Smrg
19459f1d9476Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19469f1d9476Smrg# ----------------------------------------
19479f1d9476Smrg# Minimum version: 1.15.0
1948f33d31a3Smrg#
19499f1d9476Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19509f1d9476Smrg# scanning arbitrary text files, extracting information from those text files,
19519f1d9476Smrg# and printing reports based on that information.
1952f33d31a3Smrg#
19539f1d9476Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954f33d31a3Smrg#
19559f1d9476Smrg# Interface to module:
19569f1d9476Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19579f1d9476Smrg# PERL:	     returns the path of the perl program found
19589f1d9476Smrg#	     returns the path set by the user in the environment
19599f1d9476Smrg# --with-perl: 'yes' user instructs the module to use perl
19609f1d9476Smrg#	       'no' user instructs the module not to use perl
19619f1d9476Smrg# have_perl: returns yes if perl found in PATH or no
1962f33d31a3Smrg#
19639f1d9476Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19649f1d9476Smrg#
19659f1d9476SmrgAC_DEFUN([XORG_WITH_PERL],[
19669f1d9476SmrgAC_ARG_VAR([PERL], [Path to perl command])
19679f1d9476Smrg# Preserves the interface, should it be implemented later
19689f1d9476Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19699f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
19709f1d9476SmrgAC_ARG_WITH(perl,
19719f1d9476Smrg	AS_HELP_STRING([--with-perl],
19729f1d9476Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19739f1d9476Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19749f1d9476Smrgm4_undefine([_defopt])
1975f33d31a3Smrg
19769f1d9476Smrgif test "x$use_perl" = x"auto"; then
19779f1d9476Smrg   AC_PATH_PROG([PERL], [perl])
19789f1d9476Smrg   if test "x$PERL" = "x"; then
19799f1d9476Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19809f1d9476Smrg	have_perl=no
19819f1d9476Smrg   else
19829f1d9476Smrg        have_perl=yes
19839f1d9476Smrg   fi
19849f1d9476Smrgelif test "x$use_perl" = x"yes" ; then
19859f1d9476Smrg   AC_PATH_PROG([PERL], [perl])
19869f1d9476Smrg   if test "x$PERL" = "x"; then
19879f1d9476Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19889f1d9476Smrg   fi
19899f1d9476Smrg   have_perl=yes
19909f1d9476Smrgelif test "x$use_perl" = x"no" ; then
19919f1d9476Smrg   if test "x$PERL" != "x"; then
19929f1d9476Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19939f1d9476Smrg   fi
19949f1d9476Smrg   have_perl=no
19959f1d9476Smrgelse
19969f1d9476Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19979f1d9476Smrgfi
1998f33d31a3Smrg
19999f1d9476SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20009f1d9476Smrg]) # XORG_WITH_PERL
2001f33d31a3Smrg
20029f1d9476Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003f33d31a3Smrg# ----------------
20049f1d9476Smrg# Minimum version: 1.5.0
20059f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006f33d31a3Smrg#
20079f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
20089f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
20099f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20109f1d9476Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20119f1d9476Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20129f1d9476Smrg# --with-asciidoc assumes 'auto'.
2013f33d31a3Smrg#
20149f1d9476Smrg# Interface to module:
20159f1d9476Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20169f1d9476Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20179f1d9476Smrg#		 returns the path set by the user in the environment
20189f1d9476Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20199f1d9476Smrg#		  'no' user instructs the module not to use asciidoc
2020f33d31a3Smrg#
20219f1d9476Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022f33d31a3Smrg#
20239f1d9476SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20249f1d9476SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20259f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
20269f1d9476SmrgAC_ARG_WITH(asciidoc,
20279f1d9476Smrg	AS_HELP_STRING([--with-asciidoc],
20289f1d9476Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20299f1d9476Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20309f1d9476Smrgm4_undefine([_defopt])
2031f33d31a3Smrg
20329f1d9476Smrgif test "x$use_asciidoc" = x"auto"; then
20339f1d9476Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20349f1d9476Smrg   if test "x$ASCIIDOC" = "x"; then
20359f1d9476Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20369f1d9476Smrg	have_asciidoc=no
20379f1d9476Smrg   else
20389f1d9476Smrg        have_asciidoc=yes
20399f1d9476Smrg   fi
20409f1d9476Smrgelif test "x$use_asciidoc" = x"yes" ; then
20419f1d9476Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20429f1d9476Smrg   if test "x$ASCIIDOC" = "x"; then
20439f1d9476Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20449f1d9476Smrg   fi
20459f1d9476Smrg   have_asciidoc=yes
20469f1d9476Smrgelif test "x$use_asciidoc" = x"no" ; then
20479f1d9476Smrg   if test "x$ASCIIDOC" != "x"; then
20489f1d9476Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20499f1d9476Smrg   fi
20509f1d9476Smrg   have_asciidoc=no
20519f1d9476Smrgelse
20529f1d9476Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20539f1d9476Smrgfi
20549f1d9476Smrgm4_ifval([$1],
20559f1d9476Smrg[if test "$have_asciidoc" = yes; then
20569f1d9476Smrg    # scrape the asciidoc version
20579f1d9476Smrg    AC_MSG_CHECKING([the asciidoc version])
20589f1d9476Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20599f1d9476Smrg    AC_MSG_RESULT([$asciidoc_version])
20609f1d9476Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20619f1d9476Smrg        [if test "x$use_asciidoc" = xauto; then
20629f1d9476Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20639f1d9476Smrg            have_asciidoc=no
20649f1d9476Smrg        else
20659f1d9476Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20669f1d9476Smrg        fi])
20679f1d9476Smrgfi])
20689f1d9476SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20699f1d9476Smrg]) # XORG_WITH_ASCIIDOC
2070f33d31a3Smrg
20719f1d9476Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20729f1d9476Smrg# -------------------------------------------
20739f1d9476Smrg# Minimum version: 1.5.0
20749f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20759f1d9476Smrg# Minimum version for optional DOT checking: 1.18.0
2076f33d31a3Smrg#
20779f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
20789f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
20799f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20809f1d9476Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20819f1d9476Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20829f1d9476Smrg# --with-doxygen assumes 'auto'.
2083f33d31a3Smrg#
20849f1d9476Smrg# Interface to module:
20859f1d9476Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20869f1d9476Smrg# DOXYGEN:	 returns the path of the doxygen program found
20879f1d9476Smrg#		 returns the path set by the user in the environment
20889f1d9476Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20899f1d9476Smrg#		  'no' user instructs the module not to use doxygen
2090f33d31a3Smrg#
20919f1d9476Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092f33d31a3Smrg#
20939f1d9476SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20949f1d9476SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20959f1d9476SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20969f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
20979f1d9476SmrgAC_ARG_WITH(doxygen,
20989f1d9476Smrg	AS_HELP_STRING([--with-doxygen],
20999f1d9476Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21009f1d9476Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21019f1d9476Smrgm4_undefine([_defopt])
2102f33d31a3Smrg
21039f1d9476Smrgif test "x$use_doxygen" = x"auto"; then
21049f1d9476Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21059f1d9476Smrg   if test "x$DOXYGEN" = "x"; then
21069f1d9476Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21079f1d9476Smrg	have_doxygen=no
21089f1d9476Smrg   else
21099f1d9476Smrg        have_doxygen=yes
21109f1d9476Smrg   fi
21119f1d9476Smrgelif test "x$use_doxygen" = x"yes" ; then
21129f1d9476Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21139f1d9476Smrg   if test "x$DOXYGEN" = "x"; then
21149f1d9476Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21159f1d9476Smrg   fi
21169f1d9476Smrg   have_doxygen=yes
21179f1d9476Smrgelif test "x$use_doxygen" = x"no" ; then
21189f1d9476Smrg   if test "x$DOXYGEN" != "x"; then
21199f1d9476Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21209f1d9476Smrg   fi
21219f1d9476Smrg   have_doxygen=no
2122f33d31a3Smrgelse
21239f1d9476Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124f33d31a3Smrgfi
21259f1d9476Smrgm4_ifval([$1],
21269f1d9476Smrg[if test "$have_doxygen" = yes; then
21279f1d9476Smrg    # scrape the doxygen version
21289f1d9476Smrg    AC_MSG_CHECKING([the doxygen version])
21299f1d9476Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21309f1d9476Smrg    AC_MSG_RESULT([$doxygen_version])
21319f1d9476Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21329f1d9476Smrg        [if test "x$use_doxygen" = xauto; then
21339f1d9476Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21349f1d9476Smrg            have_doxygen=no
21359f1d9476Smrg        else
21369f1d9476Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21379f1d9476Smrg        fi])
21389f1d9476Smrgfi])
2139f33d31a3Smrg
21409f1d9476Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21419f1d9476Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21429f1d9476Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21439f1d9476SmrgHAVE_DOT=no
21449f1d9476Smrgif test "x$have_doxygen" = "xyes"; then
21459f1d9476Smrg  AC_PATH_PROG([DOT], [dot])
21469f1d9476Smrg    if test "x$DOT" != "x"; then
21479f1d9476Smrg      HAVE_DOT=yes
21489f1d9476Smrg    fi
21499f1d9476Smrgfi
2150f33d31a3Smrg
21519f1d9476SmrgAC_SUBST([HAVE_DOT])
21529f1d9476SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21539f1d9476SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21549f1d9476Smrg]) # XORG_WITH_DOXYGEN
2155f33d31a3Smrg
21569f1d9476Smrg# XORG_WITH_GROFF([DEFAULT])
21579f1d9476Smrg# ----------------
21589f1d9476Smrg# Minimum version: 1.6.0
21599f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160f33d31a3Smrg#
21619f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
21629f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
21639f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21649f1d9476Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
21659f1d9476Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21669f1d9476Smrg# --with-groff assumes 'auto'.
21679f1d9476Smrg#
21689f1d9476Smrg# Interface to module:
21699f1d9476Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21709f1d9476Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21719f1d9476Smrg# HAVE_GROFF_MS: the -ms macros package
21729f1d9476Smrg# GROFF:	 returns the path of the groff program found
21739f1d9476Smrg#		 returns the path set by the user in the environment
21749f1d9476Smrg# --with-groff:	 'yes' user instructs the module to use groff
21759f1d9476Smrg#		 'no' user instructs the module not to use groff
21769f1d9476Smrg#
21779f1d9476Smrg# Added in version 1.9.0:
21789f1d9476Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21799f1d9476Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21809f1d9476Smrg#		   psselect from the psutils package.
21819f1d9476Smrg#		   the ghostcript package. Refer to the grohtml man pages
21829f1d9476Smrg#
21839f1d9476Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21849f1d9476Smrg#
21859f1d9476Smrg# OS and distros often splits groff in a basic and full package, the former
21869f1d9476Smrg# having the groff program and the later having devices, fonts and macros
21879f1d9476Smrg# Checking for the groff executable is not enough.
21889f1d9476Smrg#
21899f1d9476Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21909f1d9476Smrg# unset HAVE_GROFF or GROFF env variables.
21919f1d9476Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21929f1d9476Smrg#
21939f1d9476SmrgAC_DEFUN([XORG_WITH_GROFF],[
21949f1d9476SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21959f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
21969f1d9476SmrgAC_ARG_WITH(groff,
21979f1d9476Smrg	AS_HELP_STRING([--with-groff],
21989f1d9476Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21999f1d9476Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22009f1d9476Smrgm4_undefine([_defopt])
2201f33d31a3Smrg
22029f1d9476Smrgif test "x$use_groff" = x"auto"; then
22039f1d9476Smrg   AC_PATH_PROG([GROFF], [groff])
22049f1d9476Smrg   if test "x$GROFF" = "x"; then
22059f1d9476Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22069f1d9476Smrg	have_groff=no
22079f1d9476Smrg   else
22089f1d9476Smrg        have_groff=yes
22099f1d9476Smrg   fi
22109f1d9476Smrgelif test "x$use_groff" = x"yes" ; then
22119f1d9476Smrg   AC_PATH_PROG([GROFF], [groff])
22129f1d9476Smrg   if test "x$GROFF" = "x"; then
22139f1d9476Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22149f1d9476Smrg   fi
22159f1d9476Smrg   have_groff=yes
22169f1d9476Smrgelif test "x$use_groff" = x"no" ; then
22179f1d9476Smrg   if test "x$GROFF" != "x"; then
22189f1d9476Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22199f1d9476Smrg   fi
22209f1d9476Smrg   have_groff=no
22219f1d9476Smrgelse
22229f1d9476Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22239f1d9476Smrgfi
2224f33d31a3Smrg
22259f1d9476Smrg# We have groff, test for the presence of the macro packages
22269f1d9476Smrgif test "x$have_groff" = x"yes"; then
22279f1d9476Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22289f1d9476Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22299f1d9476Smrg        groff_ms_works=yes
22309f1d9476Smrg    else
22319f1d9476Smrg        groff_ms_works=no
2232f33d31a3Smrg    fi
22339f1d9476Smrg    AC_MSG_RESULT([$groff_ms_works])
22349f1d9476Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22359f1d9476Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22369f1d9476Smrg        groff_mm_works=yes
22379f1d9476Smrg    else
22389f1d9476Smrg        groff_mm_works=no
22399f1d9476Smrg    fi
22409f1d9476Smrg    AC_MSG_RESULT([$groff_mm_works])
22419f1d9476Smrgfi
2242f33d31a3Smrg
22439f1d9476Smrg# We have groff, test for HTML dependencies, one command per package
22449f1d9476Smrgif test "x$have_groff" = x"yes"; then
22459f1d9476Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22469f1d9476Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22479f1d9476Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22489f1d9476Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22499f1d9476Smrg      have_groff_html=yes
22509f1d9476Smrg   else
22519f1d9476Smrg      have_groff_html=no
22529f1d9476Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22539f1d9476Smrg   fi
22549f1d9476Smrgfi
22559f1d9476Smrg
22569f1d9476Smrg# Set Automake conditionals for Makefiles
22579f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22589f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22599f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22609f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22619f1d9476Smrg]) # XORG_WITH_GROFF
22629f1d9476Smrg
22639f1d9476Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22649f1d9476Smrg# ---------------------------------------
22659f1d9476Smrg# Minimum version: 1.6.0
22669f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22679f1d9476Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22689f1d9476Smrg#
22699f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
22709f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
22719f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22729f1d9476Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
22739f1d9476Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22749f1d9476Smrg# --with-fop assumes 'auto'.
22759f1d9476Smrg#
22769f1d9476Smrg# Interface to module:
22779f1d9476Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22789f1d9476Smrg# FOP:	 	returns the path of the fop program found
22799f1d9476Smrg#		returns the path set by the user in the environment
22809f1d9476Smrg# --with-fop: 	'yes' user instructs the module to use fop
22819f1d9476Smrg#		'no' user instructs the module not to use fop
22829f1d9476Smrg#
22839f1d9476Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22849f1d9476Smrg#
22859f1d9476SmrgAC_DEFUN([XORG_WITH_FOP],[
22869f1d9476SmrgAC_ARG_VAR([FOP], [Path to fop command])
22879f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
22889f1d9476SmrgAC_ARG_WITH(fop,
22899f1d9476Smrg	AS_HELP_STRING([--with-fop],
22909f1d9476Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22919f1d9476Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22929f1d9476Smrgm4_undefine([_defopt])
22939f1d9476Smrg
22949f1d9476Smrgif test "x$use_fop" = x"auto"; then
22959f1d9476Smrg   AC_PATH_PROG([FOP], [fop])
22969f1d9476Smrg   if test "x$FOP" = "x"; then
22979f1d9476Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22989f1d9476Smrg	have_fop=no
22999f1d9476Smrg   else
23009f1d9476Smrg        have_fop=yes
23019f1d9476Smrg   fi
23029f1d9476Smrgelif test "x$use_fop" = x"yes" ; then
23039f1d9476Smrg   AC_PATH_PROG([FOP], [fop])
23049f1d9476Smrg   if test "x$FOP" = "x"; then
23059f1d9476Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23069f1d9476Smrg   fi
23079f1d9476Smrg   have_fop=yes
23089f1d9476Smrgelif test "x$use_fop" = x"no" ; then
23099f1d9476Smrg   if test "x$FOP" != "x"; then
23109f1d9476Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23119f1d9476Smrg   fi
23129f1d9476Smrg   have_fop=no
2313f33d31a3Smrgelse
23149f1d9476Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315f33d31a3Smrgfi
2316f33d31a3Smrg
23179f1d9476Smrg# Test for a minimum version of fop, if provided.
23189f1d9476Smrgm4_ifval([$1],
23199f1d9476Smrg[if test "$have_fop" = yes; then
23209f1d9476Smrg    # scrape the fop version
23219f1d9476Smrg    AC_MSG_CHECKING([for fop minimum version])
23229f1d9476Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23239f1d9476Smrg    AC_MSG_RESULT([$fop_version])
23249f1d9476Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23259f1d9476Smrg        [if test "x$use_fop" = xauto; then
23269f1d9476Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23279f1d9476Smrg            have_fop=no
23289f1d9476Smrg        else
23299f1d9476Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23309f1d9476Smrg        fi])
23319f1d9476Smrgfi])
23329f1d9476SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23339f1d9476Smrg]) # XORG_WITH_FOP
23349f1d9476Smrg
23359f1d9476Smrg# XORG_WITH_M4([MIN-VERSION])
23369f1d9476Smrg# ---------------------------
23379f1d9476Smrg# Minimum version: 1.19.0
23389f1d9476Smrg#
23399f1d9476Smrg# This macro attempts to locate an m4 macro processor which supports
23409f1d9476Smrg# -I option and is only useful for modules relying on M4 in order to
23419f1d9476Smrg# expand macros in source code files.
23429f1d9476Smrg#
23439f1d9476Smrg# Interface to module:
23449f1d9476Smrg# M4:	 	returns the path of the m4 program found
23459f1d9476Smrg#		returns the path set by the user in the environment
23469f1d9476Smrg#
23479f1d9476SmrgAC_DEFUN([XORG_WITH_M4], [
23489f1d9476SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23499f1d9476Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23509f1d9476Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23519f1d9476Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23529f1d9476Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23539f1d9476Smrg   [$PATH:/usr/gnu/bin])])
2354f33d31a3Smrg
23559f1d9476SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23569f1d9476Smrg]) # XORG_WITH_M4
2357f33d31a3Smrg
23589f1d9476Smrg# XORG_WITH_PS2PDF([DEFAULT])
23599f1d9476Smrg# ----------------
23609f1d9476Smrg# Minimum version: 1.6.0
23619f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23629f1d9476Smrg#
23639f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
23649f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
23659f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23669f1d9476Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23679f1d9476Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23689f1d9476Smrg# --with-ps2pdf assumes 'auto'.
23699f1d9476Smrg#
23709f1d9476Smrg# Interface to module:
23719f1d9476Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23729f1d9476Smrg# PS2PDF:	returns the path of the ps2pdf program found
23739f1d9476Smrg#		returns the path set by the user in the environment
23749f1d9476Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23759f1d9476Smrg#		 'no' user instructs the module not to use ps2pdf
23769f1d9476Smrg#
23779f1d9476Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23789f1d9476Smrg#
23799f1d9476SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23809f1d9476SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23819f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
23829f1d9476SmrgAC_ARG_WITH(ps2pdf,
23839f1d9476Smrg	AS_HELP_STRING([--with-ps2pdf],
23849f1d9476Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23859f1d9476Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23869f1d9476Smrgm4_undefine([_defopt])
2387f33d31a3Smrg
23889f1d9476Smrgif test "x$use_ps2pdf" = x"auto"; then
23899f1d9476Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23909f1d9476Smrg   if test "x$PS2PDF" = "x"; then
23919f1d9476Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23929f1d9476Smrg	have_ps2pdf=no
23939f1d9476Smrg   else
23949f1d9476Smrg        have_ps2pdf=yes
23959f1d9476Smrg   fi
23969f1d9476Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23979f1d9476Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23989f1d9476Smrg   if test "x$PS2PDF" = "x"; then
23999f1d9476Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24009f1d9476Smrg   fi
24019f1d9476Smrg   have_ps2pdf=yes
24029f1d9476Smrgelif test "x$use_ps2pdf" = x"no" ; then
24039f1d9476Smrg   if test "x$PS2PDF" != "x"; then
24049f1d9476Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24059f1d9476Smrg   fi
24069f1d9476Smrg   have_ps2pdf=no
24079f1d9476Smrgelse
24089f1d9476Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409f33d31a3Smrgfi
24109f1d9476SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24119f1d9476Smrg]) # XORG_WITH_PS2PDF
2412f33d31a3Smrg
24139f1d9476Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24149f1d9476Smrg# ----------------
24159f1d9476Smrg# Minimum version: 1.6.0
2416f33d31a3Smrg#
24179f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
24189f1d9476Smrg# not at the appropriate level. This macro enables a builder to skip all
24199f1d9476Smrg# documentation targets except traditional man pages.
24209f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24219f1d9476Smrg# maximum flexibilty in controlling documentation building.
24229f1d9476Smrg# Refer to:
24239f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
24249f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24259f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24269f1d9476Smrg# XORG_WITH_FOP           --with-fop
24279f1d9476Smrg# XORG_WITH_GROFF         --with-groff
24289f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24299f1d9476Smrg#
24309f1d9476Smrg# Interface to module:
24319f1d9476Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24329f1d9476Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24339f1d9476Smrg#		 'no' user instructs the module not to generate docs
24349f1d9476Smrg# parm1:	specify the default value, yes or no.
24359f1d9476Smrg#
24369f1d9476SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24379f1d9476Smrgm4_define([docs_default], m4_default([$1], [yes]))
24389f1d9476SmrgAC_ARG_ENABLE(docs,
24399f1d9476Smrg	AS_HELP_STRING([--enable-docs],
24409f1d9476Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24419f1d9476Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24429f1d9476Smrgm4_undefine([docs_default])
24439f1d9476SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24449f1d9476SmrgAC_MSG_CHECKING([whether to build documentation])
24459f1d9476SmrgAC_MSG_RESULT([$build_docs])
24469f1d9476Smrg]) # XORG_ENABLE_DOCS
2447f33d31a3Smrg
24489f1d9476Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24499f1d9476Smrg# ----------------
24509f1d9476Smrg# Minimum version: 1.6.0
24519f1d9476Smrg#
24529f1d9476Smrg# This macro enables a builder to skip all developer documentation.
24539f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24549f1d9476Smrg# maximum flexibilty in controlling documentation building.
24559f1d9476Smrg# Refer to:
24569f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
24579f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24589f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24599f1d9476Smrg# XORG_WITH_FOP           --with-fop
24609f1d9476Smrg# XORG_WITH_GROFF         --with-groff
24619f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24629f1d9476Smrg#
24639f1d9476Smrg# Interface to module:
24649f1d9476Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24659f1d9476Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24669f1d9476Smrg#			'no' user instructs the module not to generate developer docs
24679f1d9476Smrg# parm1:		specify the default value, yes or no.
24689f1d9476Smrg#
24699f1d9476SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24709f1d9476Smrgm4_define([devel_default], m4_default([$1], [yes]))
24719f1d9476SmrgAC_ARG_ENABLE(devel-docs,
24729f1d9476Smrg	AS_HELP_STRING([--enable-devel-docs],
24739f1d9476Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24749f1d9476Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24759f1d9476Smrgm4_undefine([devel_default])
24769f1d9476SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24779f1d9476SmrgAC_MSG_CHECKING([whether to build developer documentation])
24789f1d9476SmrgAC_MSG_RESULT([$build_devel_docs])
24799f1d9476Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480f33d31a3Smrg
24819f1d9476Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24829f1d9476Smrg# ----------------
24839f1d9476Smrg# Minimum version: 1.6.0
24849f1d9476Smrg#
24859f1d9476Smrg# This macro enables a builder to skip all functional specification targets.
24869f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24879f1d9476Smrg# maximum flexibilty in controlling documentation building.
24889f1d9476Smrg# Refer to:
24899f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
24909f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24919f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24929f1d9476Smrg# XORG_WITH_FOP           --with-fop
24939f1d9476Smrg# XORG_WITH_GROFF         --with-groff
24949f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24959f1d9476Smrg#
24969f1d9476Smrg# Interface to module:
24979f1d9476Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24989f1d9476Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24999f1d9476Smrg#			'no' user instructs the module not to generate specs
25009f1d9476Smrg# parm1:		specify the default value, yes or no.
25019f1d9476Smrg#
25029f1d9476SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25039f1d9476Smrgm4_define([spec_default], m4_default([$1], [yes]))
25049f1d9476SmrgAC_ARG_ENABLE(specs,
25059f1d9476Smrg	AS_HELP_STRING([--enable-specs],
25069f1d9476Smrg	   [Enable building the specs (default: ]spec_default[)]),
25079f1d9476Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25089f1d9476Smrgm4_undefine([spec_default])
25099f1d9476SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25109f1d9476SmrgAC_MSG_CHECKING([whether to build functional specifications])
25119f1d9476SmrgAC_MSG_RESULT([$build_specs])
25129f1d9476Smrg]) # XORG_ENABLE_SPECS
2513f33d31a3Smrg
25149f1d9476Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25159f1d9476Smrg# ----------------------------------------------
25169f1d9476Smrg# Minimum version: 1.13.0
2517f33d31a3Smrg#
25189f1d9476Smrg# This macro enables a builder to enable/disable unit testing
25199f1d9476Smrg# It makes no assumption about the test cases implementation
25209f1d9476Smrg# Test cases may or may not use Automake "Support for test suites"
25219f1d9476Smrg# They may or may not use the software utility library GLib
25229f1d9476Smrg#
25239f1d9476Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25249f1d9476Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25259f1d9476Smrg# The variable enable_unit_tests is used by other macros in this file.
25269f1d9476Smrg#
25279f1d9476Smrg# Interface to module:
25289f1d9476Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25299f1d9476Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25309f1d9476Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25319f1d9476Smrg#			'no' user instructs the module not to build tests
25329f1d9476Smrg# parm1:		specify the default value, yes or no.
25339f1d9476Smrg#
25349f1d9476SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25359f1d9476SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25369f1d9476SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25379f1d9476SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25389f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
25399f1d9476SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25409f1d9476Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25419f1d9476Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25429f1d9476Smrgm4_undefine([_defopt])
25439f1d9476SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25449f1d9476SmrgAC_MSG_CHECKING([whether to build unit test cases])
25459f1d9476SmrgAC_MSG_RESULT([$enable_unit_tests])
25469f1d9476Smrg]) # XORG_ENABLE_UNIT_TESTS
2547f33d31a3Smrg
25489f1d9476Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25499f1d9476Smrg# ------------------------------------------------------
25509f1d9476Smrg# Minimum version: 1.17.0
25519f1d9476Smrg#
25529f1d9476Smrg# This macro enables a builder to enable/disable integration testing
25539f1d9476Smrg# It makes no assumption about the test cases' implementation
25549f1d9476Smrg# Test cases may or may not use Automake "Support for test suites"
25559f1d9476Smrg#
25569f1d9476Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25579f1d9476Smrg# usually requires less dependencies and may be built and run under less
25589f1d9476Smrg# stringent environments than integration tests.
25599f1d9476Smrg#
25609f1d9476Smrg# Interface to module:
25619f1d9476Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25629f1d9476Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25639f1d9476Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25649f1d9476Smrg#                             'no' user instructs the module not to build tests
25659f1d9476Smrg# parm1:                      specify the default value, yes or no.
25669f1d9476Smrg#
25679f1d9476SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25689f1d9476SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25699f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
25709f1d9476SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25719f1d9476Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25729f1d9476Smrg	[enable_integration_tests=$enableval],
25739f1d9476Smrg	[enable_integration_tests=]_defopt)
25749f1d9476Smrgm4_undefine([_defopt])
25759f1d9476SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25769f1d9476Smrg	[test "x$enable_integration_tests" != xno])
25779f1d9476SmrgAC_MSG_CHECKING([whether to build unit test cases])
25789f1d9476SmrgAC_MSG_RESULT([$enable_integration_tests])
25799f1d9476Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580f33d31a3Smrg
25819f1d9476Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25829f1d9476Smrg# ----------------------------------------
25839f1d9476Smrg# Minimum version: 1.13.0
25849f1d9476Smrg#
25859f1d9476Smrg# GLib is a library which provides advanced data structures and functions.
25869f1d9476Smrg# This macro enables a module to test for the presence of Glib.
25879f1d9476Smrg#
25889f1d9476Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25899f1d9476Smrg# Otherwise the value of $enable_unit_tests is blank.
25909f1d9476Smrg#
25919f1d9476Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25929f1d9476Smrg# test support usually requires less dependencies and may be built and run under
25939f1d9476Smrg# less stringent environments than integration tests.
2594f33d31a3Smrg#
25959f1d9476Smrg# Interface to module:
25969f1d9476Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25979f1d9476Smrg# with_glib: used in configure.ac to know if GLib has been found
25989f1d9476Smrg# --with-glib:	'yes' user instructs the module to use glib
25999f1d9476Smrg#		'no' user instructs the module not to use glib
26009f1d9476Smrg#
26019f1d9476SmrgAC_DEFUN([XORG_WITH_GLIB],[
26029f1d9476SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26039f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
26049f1d9476SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26059f1d9476Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26069f1d9476Smrg	[with_glib=$withval], [with_glib=]_defopt)
26079f1d9476Smrgm4_undefine([_defopt])
2608f33d31a3Smrg
26099f1d9476Smrghave_glib=no
26109f1d9476Smrg# Do not probe GLib if user explicitly disabled unit testing
26119f1d9476Smrgif test "x$enable_unit_tests" != x"no"; then
26129f1d9476Smrg  # Do not probe GLib if user explicitly disabled it
26139f1d9476Smrg  if test "x$with_glib" != x"no"; then
26149f1d9476Smrg    m4_ifval(
26159f1d9476Smrg      [$1],
26169f1d9476Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26179f1d9476Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26189f1d9476Smrg    )
2619f33d31a3Smrg  fi
2620f33d31a3Smrgfi
2621f33d31a3Smrg
26229f1d9476Smrg# Not having GLib when unit testing has been explicitly requested is an error
26239f1d9476Smrgif test "x$enable_unit_tests" = x"yes"; then
26249f1d9476Smrg  if test "x$have_glib" = x"no"; then
26259f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626f33d31a3Smrg  fi
2627f33d31a3Smrgfi
2628f33d31a3Smrg
26299f1d9476Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26309f1d9476Smrgif test "x$enable_unit_tests" = x"no"; then
26319f1d9476Smrg  if test "x$with_glib" = x"yes"; then
26329f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26339f1d9476Smrg  fi
26349f1d9476Smrgfi
2635f33d31a3Smrg
26369f1d9476Smrg# Not having GLib when it has been explicitly requested is an error
26379f1d9476Smrgif test "x$with_glib" = x"yes"; then
26389f1d9476Smrg  if test "x$have_glib" = x"no"; then
26399f1d9476Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26409f1d9476Smrg  fi
26419f1d9476Smrgfi
2642f33d31a3Smrg
26439f1d9476SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26449f1d9476Smrg]) # XORG_WITH_GLIB
2645f33d31a3Smrg
26469f1d9476Smrg# XORG_LD_WRAP([required|optional])
26479f1d9476Smrg# ---------------------------------
26489f1d9476Smrg# Minimum version: 1.13.0
26499f1d9476Smrg#
26509f1d9476Smrg# Check if linker supports -wrap, passed via compiler flags
26519f1d9476Smrg#
26529f1d9476Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26539f1d9476Smrg# Otherwise the value of $enable_unit_tests is blank.
26549f1d9476Smrg#
26559f1d9476Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26569f1d9476Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26579f1d9476Smrg# available, an argument of "optional" allows use when some unit tests require
26589f1d9476Smrg# ld -wrap and others do not.
26599f1d9476Smrg#
26609f1d9476SmrgAC_DEFUN([XORG_LD_WRAP],[
26619f1d9476SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26629f1d9476Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26639f1d9476Smrg                      void __wrap_exit(int status) { return; }],
26649f1d9476Smrg                     [exit(0);])])
26659f1d9476Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26669f1d9476Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26679f1d9476Smrg  if test "x$have_ld_wrap" = x"no"; then
26689f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26699f1d9476Smrg  fi
26709f1d9476Smrgfi
26719f1d9476SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26729f1d9476Smrg#
26739f1d9476Smrg]) # XORG_LD_WRAP
2674f33d31a3Smrg
26759f1d9476Smrg# XORG_CHECK_LINKER_FLAGS
26769f1d9476Smrg# -----------------------
26779f1d9476Smrg# SYNOPSIS
26789f1d9476Smrg#
26799f1d9476Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26809f1d9476Smrg#
26819f1d9476Smrg# DESCRIPTION
26829f1d9476Smrg#
26839f1d9476Smrg#   Check whether the given linker FLAGS work with the current language's
26849f1d9476Smrg#   linker, or whether they give an error.
26859f1d9476Smrg#
26869f1d9476Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26879f1d9476Smrg#   success/failure.
26889f1d9476Smrg#
26899f1d9476Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26909f1d9476Smrg#
26919f1d9476Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26929f1d9476Smrg#
26939f1d9476Smrg# LICENSE
26949f1d9476Smrg#
26959f1d9476Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26969f1d9476Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26979f1d9476Smrg#   Copyright (c) 2009 Matteo Frigo
26989f1d9476Smrg#
26999f1d9476Smrg#   This program is free software: you can redistribute it and/or modify it
27009f1d9476Smrg#   under the terms of the GNU General Public License as published by the
27019f1d9476Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27029f1d9476Smrg#   option) any later version.
27039f1d9476Smrg#
27049f1d9476Smrg#   This program is distributed in the hope that it will be useful, but
27059f1d9476Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27069f1d9476Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27079f1d9476Smrg#   Public License for more details.
27089f1d9476Smrg#
27099f1d9476Smrg#   You should have received a copy of the GNU General Public License along
27109f1d9476Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27119f1d9476Smrg#
27129f1d9476Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27139f1d9476Smrg#   gives unlimited permission to copy, distribute and modify the configure
27149f1d9476Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27159f1d9476Smrg#   need not follow the terms of the GNU General Public License when using
27169f1d9476Smrg#   or distributing such scripts, even though portions of the text of the
27179f1d9476Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27189f1d9476Smrg#   all other use of the material that constitutes the Autoconf Macro.
27199f1d9476Smrg#
27209f1d9476Smrg#   This special exception to the GPL applies to versions of the Autoconf
27219f1d9476Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27229f1d9476Smrg#   modified version of the Autoconf Macro, you may extend this special
27239f1d9476Smrg#   exception to the GPL to apply to your modified version as well.#
27249f1d9476SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27259f1d9476Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27269f1d9476Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27279f1d9476SmrgAS_LITERAL_IF([$1],
27289f1d9476Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27299f1d9476Smrg      ax_save_FLAGS=$LDFLAGS
27309f1d9476Smrg      LDFLAGS="$1"
27319f1d9476Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27329f1d9476Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27339f1d9476Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27349f1d9476Smrg      LDFLAGS=$ax_save_FLAGS])],
27359f1d9476Smrg  [ax_save_FLAGS=$LDFLAGS
27369f1d9476Smrg   LDFLAGS="$1"
27379f1d9476Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27389f1d9476Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27399f1d9476Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27409f1d9476Smrg   LDFLAGS=$ax_save_FLAGS])
27419f1d9476Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27429f1d9476SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27439f1d9476Smrgif test "x$xorg_check_linker_flags" = xyes; then
27449f1d9476Smrg	m4_default([$2], :)
27459f1d9476Smrgelse
27469f1d9476Smrg	m4_default([$3], :)
27479f1d9476Smrgfi
27489f1d9476Smrg]) # XORG_CHECK_LINKER_FLAGS
2749f33d31a3Smrg
27509f1d9476Smrg# XORG_MEMORY_CHECK_FLAGS
27519f1d9476Smrg# -----------------------
27529f1d9476Smrg# Minimum version: 1.16.0
27539f1d9476Smrg#
27549f1d9476Smrg# This macro attempts to find appropriate memory checking functionality
27559f1d9476Smrg# for various platforms which unit testing code may use to catch various
27569f1d9476Smrg# forms of memory allocation and access errors in testing.
27579f1d9476Smrg#
27589f1d9476Smrg# Interface to module:
27599f1d9476Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27609f1d9476Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27619f1d9476Smrg#
27629f1d9476Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27639f1d9476Smrg#
27649f1d9476SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765f33d31a3Smrg
27669f1d9476SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27679f1d9476SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27689f1d9476Smrg           [Environment variables to enable memory checking in tests])
2769f33d31a3Smrg
27709f1d9476Smrg# Check for different types of support on different platforms
27719f1d9476Smrgcase $host_os in
27729f1d9476Smrg    solaris*)
27739f1d9476Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27749f1d9476Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27759f1d9476Smrg        ;;
27769f1d9476Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27779f1d9476Smrg        # both directly and inverted, so should not be 0 or 255.
27789f1d9476Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27799f1d9476Smrg        ;;
27809f1d9476Smrg    darwin*)
27819f1d9476Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27829f1d9476Smrg        ;;
27839f1d9476Smrg    *bsd*)
27849f1d9476Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27859f1d9476Smrg        ;;
27869f1d9476Smrgesac
2787f33d31a3Smrg
27889f1d9476Smrg# User supplied flags override default flags
27899f1d9476Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27909f1d9476Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791f33d31a3Smrgfi
2792f33d31a3Smrg
27939f1d9476SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27949f1d9476Smrg]) # XORG_WITH_LINT
2795f33d31a3Smrg
27969f1d9476Smrg# XORG_CHECK_MALLOC_ZERO
27979f1d9476Smrg# ----------------------
27989f1d9476Smrg# Minimum version: 1.0.0
2799f33d31a3Smrg#
28009f1d9476Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28019f1d9476Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28029f1d9476Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28039f1d9476SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28049f1d9476SmrgAC_ARG_ENABLE(malloc0returnsnull,
28059f1d9476Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28069f1d9476Smrg		       [malloc(0) returns NULL (default: auto)]),
28079f1d9476Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28089f1d9476Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809f33d31a3Smrg
28109f1d9476SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28119f1d9476Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28129f1d9476SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28139f1d9476Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28149f1d9476Smrg#include <stdlib.h>
28159f1d9476Smrg],[
28169f1d9476Smrg    char *m0, *r0, *c0, *p;
28179f1d9476Smrg    m0 = malloc(0);
28189f1d9476Smrg    p = malloc(10);
28199f1d9476Smrg    r0 = realloc(p,0);
28209f1d9476Smrg    c0 = calloc(0,10);
28219f1d9476Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28229f1d9476Smrg])],
28239f1d9476Smrg		[xorg_cv_malloc0_returns_null=yes],
28249f1d9476Smrg		[xorg_cv_malloc0_returns_null=no])])
28259f1d9476SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826f33d31a3Smrgfi
28279f1d9476SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828f33d31a3Smrg
28299f1d9476Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28309f1d9476Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28319f1d9476Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28329f1d9476Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833f33d31a3Smrgelse
28349f1d9476Smrg	MALLOC_ZERO_CFLAGS=""
28359f1d9476Smrg	XMALLOC_ZERO_CFLAGS=""
28369f1d9476Smrg	XTMALLOC_ZERO_CFLAGS=""
2837f33d31a3Smrgfi
2838f33d31a3Smrg
28399f1d9476SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28409f1d9476SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28419f1d9476SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28429f1d9476Smrg]) # XORG_CHECK_MALLOC_ZERO
2843f33d31a3Smrg
28449f1d9476Smrg# XORG_WITH_LINT()
28459f1d9476Smrg# ----------------
28469f1d9476Smrg# Minimum version: 1.1.0
2847f33d31a3Smrg#
28489f1d9476Smrg# This macro enables the use of a tool that flags some suspicious and
28499f1d9476Smrg# non-portable constructs (likely to be bugs) in C language source code.
28509f1d9476Smrg# It will attempt to locate the tool and use appropriate options.
28519f1d9476Smrg# There are various lint type tools on different platforms.
2852f33d31a3Smrg#
28539f1d9476Smrg# Interface to module:
28549f1d9476Smrg# LINT:		returns the path to the tool found on the platform
28559f1d9476Smrg#		or the value set to LINT on the configure cmd line
28569f1d9476Smrg#		also an Automake conditional
28579f1d9476Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28589f1d9476Smrg#
28599f1d9476Smrg# --with-lint:	'yes' user instructs the module to use lint
28609f1d9476Smrg#		'no' user instructs the module not to use lint (default)
28619f1d9476Smrg#
28629f1d9476Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28639f1d9476Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28649f1d9476Smrg#
28659f1d9476SmrgAC_DEFUN([XORG_WITH_LINT],[
2866f33d31a3Smrg
28679f1d9476SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28689f1d9476SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28699f1d9476SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28709f1d9476Smrg		[Use a lint-style source code checker (default: disabled)])],
28719f1d9476Smrg		[use_lint=$withval], [use_lint=no])
2872f33d31a3Smrg
28739f1d9476Smrg# Obtain platform specific info like program name and options
28749f1d9476Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28759f1d9476Smrgcase $host_os in
28769f1d9476Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28779f1d9476Smrg	lint_name=splint
28789f1d9476Smrg	lint_options="-badflag"
28799f1d9476Smrg	;;
28809f1d9476Smrg  *freebsd* | *netbsd*)
28819f1d9476Smrg	lint_name=lint
28829f1d9476Smrg	lint_options="-u -b"
28839f1d9476Smrg	;;
28849f1d9476Smrg  *solaris*)
28859f1d9476Smrg	lint_name=lint
28869f1d9476Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28879f1d9476Smrg	;;
28889f1d9476Smrgesac
28899f1d9476Smrg
28909f1d9476Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28919f1d9476Smrgif test "x$use_lint" = x"yes" ; then
28929f1d9476Smrg   AC_PATH_PROG([LINT], [$lint_name])
28939f1d9476Smrg   if test "x$LINT" = "x"; then
28949f1d9476Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28959f1d9476Smrg   fi
28969f1d9476Smrgelif test "x$use_lint" = x"no" ; then
28979f1d9476Smrg   if test "x$LINT" != "x"; then
28989f1d9476Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28999f1d9476Smrg   fi
2900f33d31a3Smrgelse
29019f1d9476Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902f33d31a3Smrgfi
2903f33d31a3Smrg
29049f1d9476Smrg# User supplied flags override default flags
29059f1d9476Smrgif test "x$LINT_FLAGS" != "x"; then
29069f1d9476Smrg   lint_options=$LINT_FLAGS
29079f1d9476Smrgfi
2908f33d31a3Smrg
29099f1d9476SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29109f1d9476SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911f33d31a3Smrg
29129f1d9476Smrg]) # XORG_WITH_LINT
2913f33d31a3Smrg
29149f1d9476Smrg# XORG_LINT_LIBRARY(LIBNAME)
29159f1d9476Smrg# --------------------------
29169f1d9476Smrg# Minimum version: 1.1.0
2917f33d31a3Smrg#
29189f1d9476Smrg# Sets up flags for building lint libraries for checking programs that call
29199f1d9476Smrg# functions in the library.
29209f1d9476Smrg#
29219f1d9476Smrg# Interface to module:
29229f1d9476Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29239f1d9476Smrg# MAKE_LINT_LIB		- Automake conditional
29249f1d9476Smrg#
29259f1d9476Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29269f1d9476Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927f33d31a3Smrg
29289f1d9476SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29299f1d9476SmrgAC_REQUIRE([XORG_WITH_LINT])
29309f1d9476SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29319f1d9476Smrg	[Create lint library (default: disabled)])],
29329f1d9476Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29339f1d9476Smrg
29349f1d9476Smrgif test "x$make_lint_lib" = x"yes" ; then
29359f1d9476Smrg   LINTLIB=llib-l$1.ln
29369f1d9476Smrg   if test "x$LINT" = "x"; then
29379f1d9476Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29389f1d9476Smrg   fi
29399f1d9476Smrgelif test "x$make_lint_lib" != x"no" ; then
29409f1d9476Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941f33d31a3Smrgfi
2942f33d31a3Smrg
29439f1d9476SmrgAC_SUBST(LINTLIB)
29449f1d9476SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945f33d31a3Smrg
29469f1d9476Smrg]) # XORG_LINT_LIBRARY
2947f33d31a3Smrg
29489f1d9476Smrg# XORG_COMPILER_BRAND
2949f33d31a3Smrg# -------------------
29509f1d9476Smrg# Minimum version: 1.14.0
2951f33d31a3Smrg#
29529f1d9476Smrg# Checks for various brands of compilers and sets flags as appropriate:
29539f1d9476Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29549f1d9476Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29559f1d9476Smrg#   clang compiler - sets CLANGCC to "yes"
29569f1d9476Smrg#   Intel compiler - sets INTELCC to "yes"
29579f1d9476Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29589f1d9476Smrg#
29599f1d9476SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29609f1d9476SmrgAC_LANG_CASE(
29619f1d9476Smrg	[C], [
29629f1d9476Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29639f1d9476Smrg	],
29649f1d9476Smrg	[C++], [
29659f1d9476Smrg		AC_REQUIRE([AC_PROG_CXX])
29669f1d9476Smrg	]
29679f1d9476Smrg)
29689f1d9476SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29699f1d9476SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29709f1d9476SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29719f1d9476Smrg]) # XORG_COMPILER_BRAND
2972f33d31a3Smrg
29739f1d9476Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974f33d31a3Smrg# ---------------
29759f1d9476Smrg# Minimum version: 1.16.0
29769f1d9476Smrg#
29779f1d9476Smrg# Test if the compiler works when passed the given flag as a command line argument.
29789f1d9476Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
29799f1d9476Smrg# next flag in the list until there are no more options.
29809f1d9476Smrg#
29819f1d9476Smrg# Note that this does not guarantee that the compiler supports the flag as some
29829f1d9476Smrg# compilers will simply ignore arguments that they do not understand, but we do
29839f1d9476Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29849f1d9476Smrg# -Werror=unused-command-line-argument
29859f1d9476Smrg#
29869f1d9476SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29879f1d9476Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29889f1d9476Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2989f33d31a3Smrg
29909f1d9476SmrgAC_LANG_COMPILER_REQUIRE
2991f33d31a3Smrg
29929f1d9476SmrgAC_LANG_CASE(
29939f1d9476Smrg	[C], [
29949f1d9476Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29959f1d9476Smrg		define([PREFIX], [C])
29969f1d9476Smrg		define([CACHE_PREFIX], [cc])
29979f1d9476Smrg		define([COMPILER], [$CC])
29989f1d9476Smrg	],
29999f1d9476Smrg	[C++], [
30009f1d9476Smrg		define([PREFIX], [CXX])
30019f1d9476Smrg		define([CACHE_PREFIX], [cxx])
30029f1d9476Smrg		define([COMPILER], [$CXX])
30039f1d9476Smrg	]
30049f1d9476Smrg)
30059f1d9476Smrg
30069f1d9476Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30079f1d9476Smrg
30089f1d9476Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30099f1d9476Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30109f1d9476Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30119f1d9476Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30129f1d9476Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30139f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30149f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30159f1d9476Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30169f1d9476Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017f33d31a3Smrgfi
30189f1d9476Smrg
30199f1d9476Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30209f1d9476Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30219f1d9476Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30229f1d9476Smrg	fi
30239f1d9476Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30249f1d9476Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30259f1d9476Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30269f1d9476Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30279f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30289f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30299f1d9476Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30309f1d9476Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30319f1d9476Smrgfi
30329f1d9476Smrg
30339f1d9476Smrgfound="no"
30349f1d9476Smrgm4_foreach([flag], m4_cdr($@), [
30359f1d9476Smrg	if test $found = "no" ; then
30369f1d9476Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30379f1d9476Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30389f1d9476Smrg		fi
30399f1d9476Smrg
30409f1d9476Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30419f1d9476Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30429f1d9476Smrg		fi
30439f1d9476Smrg
30449f1d9476Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30459f1d9476Smrg
30469f1d9476Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30479f1d9476Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30489f1d9476Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30499f1d9476Smrg		AC_CACHE_VAL($cacheid,
30509f1d9476Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30519f1d9476Smrg					     [eval $cacheid=yes],
30529f1d9476Smrg					     [eval $cacheid=no])])
30539f1d9476Smrg
30549f1d9476Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30559f1d9476Smrg
30569f1d9476Smrg		eval supported=\$$cacheid
30579f1d9476Smrg		AC_MSG_RESULT([$supported])
30589f1d9476Smrg		if test "$supported" = "yes" ; then
30599f1d9476Smrg			$1="$$1 ]flag["
30609f1d9476Smrg			found="yes"
30619f1d9476Smrg		fi
30629f1d9476Smrg	fi
3063f33d31a3Smrg])
30649f1d9476Smrg]) # XORG_TESTSET_CFLAG
3065f33d31a3Smrg
30669f1d9476Smrg# XORG_COMPILER_FLAGS
30679f1d9476Smrg# ---------------
30689f1d9476Smrg# Minimum version: 1.16.0
3069f33d31a3Smrg#
30709f1d9476Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30719f1d9476Smrg# arguments supported by the selected compiler which do NOT alter the generated
30729f1d9476Smrg# code.  These arguments will cause the compiler to print various warnings
30739f1d9476Smrg# during compilation AND turn a conservative set of warnings into errors.
30749f1d9476Smrg#
30759f1d9476Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30769f1d9476Smrg# future versions of util-macros as options are added to new compilers.
30779f1d9476Smrg#
30789f1d9476SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30799f1d9476SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080f33d31a3Smrg
30819f1d9476SmrgAC_ARG_ENABLE(selective-werror,
30829f1d9476Smrg              AS_HELP_STRING([--disable-selective-werror],
30839f1d9476Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30849f1d9476Smrg              [SELECTIVE_WERROR=$enableval],
30859f1d9476Smrg              [SELECTIVE_WERROR=yes])
30869f1d9476Smrg
30879f1d9476SmrgAC_LANG_CASE(
30889f1d9476Smrg        [C], [
30899f1d9476Smrg                define([PREFIX], [C])
30909f1d9476Smrg        ],
30919f1d9476Smrg        [C++], [
30929f1d9476Smrg                define([PREFIX], [CXX])
30939f1d9476Smrg        ]
30949f1d9476Smrg)
30959f1d9476Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30969f1d9476Smrgif test "x$SUNCC" = "xyes"; then
30979f1d9476Smrg    [BASE_]PREFIX[FLAGS]="-v"
3098f33d31a3Smrgelse
30999f1d9476Smrg    [BASE_]PREFIX[FLAGS]=""
3100f33d31a3Smrgfi
3101f33d31a3Smrg
31029f1d9476Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31039f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31049f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31059f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31069f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107f33d31a3Smrg
31089f1d9476SmrgAC_LANG_CASE(
31099f1d9476Smrg	[C], [
31109f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31119f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31129f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31139f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31149f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31159f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31169f1d9476Smrg	]
31179f1d9476Smrg)
3118f33d31a3Smrg
31199f1d9476Smrg# This chunk adds additional warnings that could catch undesired effects.
31209f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31219f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31229f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31239f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31249f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31259f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31269f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127f33d31a3Smrg
31289f1d9476Smrg# These are currently disabled because they are noisy.  They will be enabled
31299f1d9476Smrg# in the future once the codebase is sufficiently modernized to silence
31309f1d9476Smrg# them.  For now, I don't want them to drown out the other warnings.
31319f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31329f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31339f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134f33d31a3Smrg
31359f1d9476Smrg# Turn some warnings into errors, so we don't accidently get successful builds
31369f1d9476Smrg# when there are problems that should be fixed.
3137f33d31a3Smrg
31389f1d9476Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31399f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31409f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31419f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31429f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31439f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31449f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31459f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31469f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31479f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31489f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31499f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31509f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31519f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31529f1d9476Smrgelse
31539f1d9476SmrgAC_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])
31549f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31559f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31569f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31579f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31589f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31599f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31609f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31619f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31629f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31639f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31649f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31659f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31669f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31679f1d9476Smrgfi
3168f33d31a3Smrg
31699f1d9476SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31709f1d9476Smrg]) # XORG_COMPILER_FLAGS
3171f33d31a3Smrg
31729f1d9476Smrg# XORG_CWARNFLAGS
31739f1d9476Smrg# ---------------
31749f1d9476Smrg# Minimum version: 1.2.0
31759f1d9476Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176f33d31a3Smrg#
31779f1d9476Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3178f33d31a3Smrg#
31799f1d9476Smrg# This function is deprecated because it defines -fno-strict-aliasing
31809f1d9476Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31819f1d9476Smrg# is needed, then it should be added explicitly in the module when
31829f1d9476Smrg# it is updated to use BASE_CFLAGS.
3183f33d31a3Smrg#
31849f1d9476SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31859f1d9476SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31869f1d9476SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31879f1d9476SmrgAC_LANG_CASE(
31889f1d9476Smrg	[C], [
31899f1d9476Smrg		CWARNFLAGS="$BASE_CFLAGS"
31909f1d9476Smrg		if  test "x$GCC" = xyes ; then
31919f1d9476Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31929f1d9476Smrg		fi
31939f1d9476Smrg		AC_SUBST(CWARNFLAGS)
31949f1d9476Smrg	]
31959f1d9476Smrg)
31969f1d9476Smrg]) # XORG_CWARNFLAGS
3197f33d31a3Smrg
31989f1d9476Smrg# XORG_STRICT_OPTION
31999f1d9476Smrg# -----------------------
32009f1d9476Smrg# Minimum version: 1.3.0
32019f1d9476Smrg#
32029f1d9476Smrg# Add configure option to enable strict compilation flags, such as treating
32039f1d9476Smrg# warnings as fatal errors.
32049f1d9476Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32059f1d9476Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32069f1d9476Smrg#
32079f1d9476Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32089f1d9476Smrg# when strict compilation is unconditionally desired.
32099f1d9476SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32109f1d9476SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32119f1d9476SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212f33d31a3Smrg
32139f1d9476SmrgAC_ARG_ENABLE(strict-compilation,
32149f1d9476Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32159f1d9476Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32169f1d9476Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217f33d31a3Smrg
32189f1d9476SmrgAC_LANG_CASE(
32199f1d9476Smrg        [C], [
32209f1d9476Smrg                define([PREFIX], [C])
32219f1d9476Smrg        ],
32229f1d9476Smrg        [C++], [
32239f1d9476Smrg                define([PREFIX], [CXX])
32249f1d9476Smrg        ]
32259f1d9476Smrg)
3226f33d31a3Smrg
32279f1d9476Smrg[STRICT_]PREFIX[FLAGS]=""
32289f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32299f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230f33d31a3Smrg
32319f1d9476Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32329f1d9476Smrg# activate it with -Werror, so we add it here explicitly.
32339f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234f33d31a3Smrg
32359f1d9476Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32369f1d9476Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32379f1d9476Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32389f1d9476Smrgfi
32399f1d9476SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32409f1d9476SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32419f1d9476SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32429f1d9476Smrg]) # XORG_STRICT_OPTION
3243f33d31a3Smrg
32449f1d9476Smrg# XORG_DEFAULT_OPTIONS
32459f1d9476Smrg# --------------------
32469f1d9476Smrg# Minimum version: 1.3.0
32479f1d9476Smrg#
32489f1d9476Smrg# Defines default options for X.Org modules.
32499f1d9476Smrg#
32509f1d9476SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32519f1d9476SmrgAC_REQUIRE([AC_PROG_INSTALL])
32529f1d9476SmrgXORG_COMPILER_FLAGS
32539f1d9476SmrgXORG_CWARNFLAGS
32549f1d9476SmrgXORG_STRICT_OPTION
32559f1d9476SmrgXORG_RELEASE_VERSION
32569f1d9476SmrgXORG_CHANGELOG
32579f1d9476SmrgXORG_INSTALL
32589f1d9476SmrgXORG_MANPAGE_SECTIONS
32599f1d9476Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32609f1d9476Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32619f1d9476Smrg]) # XORG_DEFAULT_OPTIONS
3262f33d31a3Smrg
32639f1d9476Smrg# XORG_INSTALL()
32649f1d9476Smrg# ----------------
32659f1d9476Smrg# Minimum version: 1.4.0
32669f1d9476Smrg#
32679f1d9476Smrg# Defines the variable INSTALL_CMD as the command to copy
32689f1d9476Smrg# INSTALL from $prefix/share/util-macros.
32699f1d9476Smrg#
32709f1d9476SmrgAC_DEFUN([XORG_INSTALL], [
32719f1d9476SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32729f1d9476Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32739f1d9476SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32749f1d9476Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32759f1d9476Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32769f1d9476Smrgtouch \$(top_srcdir)/INSTALL; \
32779f1d9476Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32789f1d9476SmrgAC_SUBST([INSTALL_CMD])
32799f1d9476Smrg]) # XORG_INSTALL
32809f1d9476Smrgdnl Copyright 2005 Red Hat, Inc
32819f1d9476Smrgdnl
32829f1d9476Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32839f1d9476Smrgdnl documentation for any purpose is hereby granted without fee, provided that
32849f1d9476Smrgdnl the above copyright notice appear in all copies and that both that
32859f1d9476Smrgdnl copyright notice and this permission notice appear in supporting
32869f1d9476Smrgdnl documentation.
32879f1d9476Smrgdnl
32889f1d9476Smrgdnl The above copyright notice and this permission notice shall be included
32899f1d9476Smrgdnl in all copies or substantial portions of the Software.
32909f1d9476Smrgdnl
32919f1d9476Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32929f1d9476Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32939f1d9476Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32949f1d9476Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32959f1d9476Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32969f1d9476Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32979f1d9476Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
32989f1d9476Smrgdnl
32999f1d9476Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33009f1d9476Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33019f1d9476Smrgdnl other dealings in this Software without prior written authorization
33029f1d9476Smrgdnl from the copyright holders.
33039f1d9476Smrgdnl
3304f33d31a3Smrg
33059f1d9476Smrg# XORG_RELEASE_VERSION
33069f1d9476Smrg# --------------------
33079f1d9476Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308f33d31a3Smrg
33099f1d9476SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33109f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33119f1d9476Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33129f1d9476Smrg		[Major version of this package])
33139f1d9476Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33149f1d9476Smrg	if test "x$PVM" = "x"; then
33159f1d9476Smrg		PVM="0"
33169f1d9476Smrg	fi
33179f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33189f1d9476Smrg		[$PVM],
33199f1d9476Smrg		[Minor version of this package])
33209f1d9476Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33219f1d9476Smrg	if test "x$PVP" = "x"; then
33229f1d9476Smrg		PVP="0"
33239f1d9476Smrg	fi
33249f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33259f1d9476Smrg		[$PVP],
33269f1d9476Smrg		[Patch version of this package])
33279f1d9476Smrg])
3328f33d31a3Smrg
33299f1d9476Smrg# XORG_CHANGELOG()
33309f1d9476Smrg# ----------------
33319f1d9476Smrg# Minimum version: 1.2.0
33329f1d9476Smrg#
33339f1d9476Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33349f1d9476Smrg# ChangeLog from git.
33359f1d9476Smrg#
33369f1d9476Smrg#
33379f1d9476SmrgAC_DEFUN([XORG_CHANGELOG], [
33389f1d9476SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33399f1d9476Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33409f1d9476Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33419f1d9476Smrgtouch \$(top_srcdir)/ChangeLog; \
33429f1d9476Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33439f1d9476SmrgAC_SUBST([CHANGELOG_CMD])
33449f1d9476Smrg]) # XORG_CHANGELOG
3345f33d31a3Smrg
3346