aclocal.m4 revision e39ce84c
1e39ce84cSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
20c7e83b2Smrg
3e39ce84cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
49aa228fdSmrg
59aa228fdSmrg# This file is free software; the Free Software Foundation
69aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
79aa228fdSmrg# with or without modifications, as long as this notice is preserved.
89aa228fdSmrg
99aa228fdSmrg# This program is distributed in the hope that it will be useful,
109aa228fdSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
119aa228fdSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
129aa228fdSmrg# PARTICULAR PURPOSE.
139aa228fdSmrg
140c7e83b2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
168f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e39ce84cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18e39ce84cSmrg[m4_warning([this file was generated for autoconf 2.71.
198f65982aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208f65982aSmrgIf you have problems, you may need to regenerate the build system entirely.
210c7e83b2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
229aa228fdSmrg
23e39ce84cSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
249aa228fdSmrg#
259aa228fdSmrg# This file is free software; the Free Software Foundation
269aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
279aa228fdSmrg# with or without modifications, as long as this notice is preserved.
289aa228fdSmrg
299aa228fdSmrg# AM_AUTOMAKE_VERSION(VERSION)
309aa228fdSmrg# ----------------------------
319aa228fdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
329aa228fdSmrg# generated from the m4 files accompanying Automake X.Y.
339aa228fdSmrg# (This private macro should not be called outside this file.)
349aa228fdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35e39ce84cSmrg[am__api_version='1.16'
369aa228fdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379aa228fdSmrgdnl require some minimum version.  Point them to the right macro.
38e39ce84cSmrgm4_if([$1], [1.16.5], [],
399aa228fdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409aa228fdSmrg])
419aa228fdSmrg
429aa228fdSmrg# _AM_AUTOCONF_VERSION(VERSION)
439aa228fdSmrg# -----------------------------
449aa228fdSmrg# aclocal traces this macro to find the Autoconf version.
459aa228fdSmrg# This is a private macro too.  Using m4_define simplifies
469aa228fdSmrg# the logic in aclocal, which can simply ignore this definition.
479aa228fdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
489aa228fdSmrg
499aa228fdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
509aa228fdSmrg# -------------------------------
519aa228fdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528f65982aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
539aa228fdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54e39ce84cSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
558f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
568f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578f65982aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
589aa228fdSmrg
599aa228fdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
609aa228fdSmrg
61e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
629aa228fdSmrg#
639aa228fdSmrg# This file is free software; the Free Software Foundation
649aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
659aa228fdSmrg# with or without modifications, as long as this notice is preserved.
669aa228fdSmrg
679aa228fdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680c7e83b2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690c7e83b2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
709aa228fdSmrg#
719aa228fdSmrg# Of course, Automake must honor this variable whenever it calls a
729aa228fdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
739aa228fdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
749aa228fdSmrg# depending on how configure is run.  This is pretty annoying, since
759aa228fdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
769aa228fdSmrg# source directory, any form will work fine, but in subdirectories a
779aa228fdSmrg# relative path needs to be adjusted first.
789aa228fdSmrg#
799aa228fdSmrg# $ac_aux_dir/missing
809aa228fdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
819aa228fdSmrg# $top_srcdir/$ac_aux_dir/missing
829aa228fdSmrg#    fails if $ac_aux_dir is absolute,
839aa228fdSmrg#    fails when called from a subdirectory in a VPATH build with
849aa228fdSmrg#          a relative $ac_aux_dir
859aa228fdSmrg#
869aa228fdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
879aa228fdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
880c7e83b2Smrg# harmless because $srcdir is '.', but things will broke when you
899aa228fdSmrg# start a VPATH build or use an absolute $srcdir.
909aa228fdSmrg#
919aa228fdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
929aa228fdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
939aa228fdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
949aa228fdSmrg# and then we would define $MISSING as
959aa228fdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
969aa228fdSmrg# This will work as long as MISSING is not called from configure, because
979aa228fdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
989aa228fdSmrg# However there are other variables, like CC, which are often used in
999aa228fdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1009aa228fdSmrg#
1019aa228fdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1029aa228fdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1039aa228fdSmrg# configured tree to be moved without reconfiguration.
1049aa228fdSmrg
1059aa228fdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060c7e83b2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070c7e83b2Smrg# Expand $ac_aux_dir to an absolute path.
1080c7e83b2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1099aa228fdSmrg])
1109aa228fdSmrg
1119aa228fdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1129aa228fdSmrg
113e39ce84cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1149aa228fdSmrg#
1159aa228fdSmrg# This file is free software; the Free Software Foundation
1169aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1179aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1189aa228fdSmrg
1199aa228fdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1209aa228fdSmrg# -------------------------------------
1219aa228fdSmrg# Define a conditional.
1229aa228fdSmrgAC_DEFUN([AM_CONDITIONAL],
1230c7e83b2Smrg[AC_PREREQ([2.52])dnl
1240c7e83b2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250c7e83b2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1269aa228fdSmrgAC_SUBST([$1_TRUE])dnl
1279aa228fdSmrgAC_SUBST([$1_FALSE])dnl
1289aa228fdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1299aa228fdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1308f65982aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1319aa228fdSmrgif $2; then
1329aa228fdSmrg  $1_TRUE=
1339aa228fdSmrg  $1_FALSE='#'
1349aa228fdSmrgelse
1359aa228fdSmrg  $1_TRUE='#'
1369aa228fdSmrg  $1_FALSE=
1379aa228fdSmrgfi
1389aa228fdSmrgAC_CONFIG_COMMANDS_PRE(
1399aa228fdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1409aa228fdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1419aa228fdSmrgUsually this means the macro was only invoked conditionally.]])
1429aa228fdSmrgfi])])
1439aa228fdSmrg
144e39ce84cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1459aa228fdSmrg#
1469aa228fdSmrg# This file is free software; the Free Software Foundation
1479aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1489aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1499aa228fdSmrg
1509aa228fdSmrg
1510c7e83b2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1529aa228fdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1539aa228fdSmrg# will think it sees a *use*, and therefore will trigger all it's
1549aa228fdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1559aa228fdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1569aa228fdSmrg
1579aa228fdSmrg
1589aa228fdSmrg# _AM_DEPENDENCIES(NAME)
1599aa228fdSmrg# ----------------------
1609aa228fdSmrg# See how the compiler implements dependency checking.
1610c7e83b2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1629aa228fdSmrg# We try a few techniques and use that to set a single cache variable.
1639aa228fdSmrg#
1649aa228fdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1659aa228fdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1669aa228fdSmrg# dependency, and given that the user is not expected to run this macro,
1679aa228fdSmrg# just rely on AC_PROG_CC.
1689aa228fdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1699aa228fdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1709aa228fdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1719aa228fdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1729aa228fdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1739aa228fdSmrg
1740c7e83b2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1750c7e83b2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1760c7e83b2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1770c7e83b2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1780c7e83b2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1790c7e83b2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1800c7e83b2Smrg                    [depcc="$$1"   am_compiler_list=])
1819aa228fdSmrg
1829aa228fdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1839aa228fdSmrg               [am_cv_$1_dependencies_compiler_type],
1849aa228fdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1859aa228fdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1869aa228fdSmrg  # making bogus files that we don't know about and never remove.  For
1879aa228fdSmrg  # instance it was reported that on HP-UX the gcc test will end up
1880c7e83b2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1890c7e83b2Smrg  # in D".
19080b026c6Smrg  rm -rf conftest.dir
1919aa228fdSmrg  mkdir conftest.dir
1929aa228fdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1939aa228fdSmrg  # using a relative directory.
1949aa228fdSmrg  cp "$am_depcomp" conftest.dir
1959aa228fdSmrg  cd conftest.dir
1969aa228fdSmrg  # We will build objects and dependencies in a subdirectory because
1979aa228fdSmrg  # it helps to detect inapplicable dependency modes.  For instance
1989aa228fdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1999aa228fdSmrg  # side effect of compilation, but ICC will put the dependencies in
2009aa228fdSmrg  # the current directory while Tru64 will put them in the object
2019aa228fdSmrg  # directory.
2029aa228fdSmrg  mkdir sub
2039aa228fdSmrg
2049aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
2059aa228fdSmrg  if test "$am_compiler_list" = ""; then
2069aa228fdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2079aa228fdSmrg  fi
2088f65982aSmrg  am__universal=false
2098f65982aSmrg  m4_case([$1], [CC],
2108f65982aSmrg    [case " $depcc " in #(
2118f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2128f65982aSmrg     esac],
2138f65982aSmrg    [CXX],
2148f65982aSmrg    [case " $depcc " in #(
2158f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2168f65982aSmrg     esac])
2178f65982aSmrg
2189aa228fdSmrg  for depmode in $am_compiler_list; do
2199aa228fdSmrg    # Setup a source with many dependencies, because some compilers
2209aa228fdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2219aa228fdSmrg    # we should not choose a depcomp mode which is confused by this.
2229aa228fdSmrg    #
2239aa228fdSmrg    # We need to recreate these files for each test, as the compiler may
2249aa228fdSmrg    # overwrite some of them when testing with obscure command lines.
2259aa228fdSmrg    # This happens at least with the AIX C compiler.
2269aa228fdSmrg    : > sub/conftest.c
2279aa228fdSmrg    for i in 1 2 3 4 5 6; do
2289aa228fdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2290c7e83b2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2300c7e83b2Smrg      # Solaris 10 /bin/sh.
2310c7e83b2Smrg      echo '/* dummy */' > sub/conftst$i.h
2329aa228fdSmrg    done
2339aa228fdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2349aa228fdSmrg
2350c7e83b2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2368f65982aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2370c7e83b2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2380c7e83b2Smrg    # versions had trouble with output in subdirs.
2398f65982aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2408f65982aSmrg    am__minus_obj="-o $am__obj"
2419aa228fdSmrg    case $depmode in
2428f65982aSmrg    gcc)
2438f65982aSmrg      # This depmode causes a compiler race in universal mode.
2448f65982aSmrg      test "$am__universal" = false || continue
2458f65982aSmrg      ;;
2469aa228fdSmrg    nosideeffect)
2470c7e83b2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2480c7e83b2Smrg      # only be used when explicitly requested.
2499aa228fdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2509aa228fdSmrg	continue
2519aa228fdSmrg      else
2529aa228fdSmrg	break
2539aa228fdSmrg      fi
2549aa228fdSmrg      ;;
25580b026c6Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2560c7e83b2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2578f65982aSmrg      # not run yet.  These depmodes are late enough in the game, and
2588f65982aSmrg      # so weak that their functioning should not be impacted.
2598f65982aSmrg      am__obj=conftest.${OBJEXT-o}
2608f65982aSmrg      am__minus_obj=
2618f65982aSmrg      ;;
2629aa228fdSmrg    none) break ;;
2639aa228fdSmrg    esac
2649aa228fdSmrg    if depmode=$depmode \
2658f65982aSmrg       source=sub/conftest.c object=$am__obj \
2669aa228fdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2678f65982aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2689aa228fdSmrg         >/dev/null 2>conftest.err &&
2699aa228fdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2709aa228fdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2718f65982aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2729aa228fdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2739aa228fdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2749aa228fdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2759aa228fdSmrg      # that says an option was ignored or not supported.
2769aa228fdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2779aa228fdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2789aa228fdSmrg      # The diagnosis changed in icc 8.0:
2799aa228fdSmrg      #   icc: Command line remark: option '-MP' not supported
2809aa228fdSmrg      if (grep 'ignoring option' conftest.err ||
2819aa228fdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2829aa228fdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2839aa228fdSmrg        break
2849aa228fdSmrg      fi
2859aa228fdSmrg    fi
2869aa228fdSmrg  done
2879aa228fdSmrg
2889aa228fdSmrg  cd ..
2899aa228fdSmrg  rm -rf conftest.dir
2909aa228fdSmrgelse
2919aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
2929aa228fdSmrgfi
2939aa228fdSmrg])
2949aa228fdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2959aa228fdSmrgAM_CONDITIONAL([am__fastdep$1], [
2969aa228fdSmrg  test "x$enable_dependency_tracking" != xno \
2979aa228fdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2989aa228fdSmrg])
2999aa228fdSmrg
3009aa228fdSmrg
3019aa228fdSmrg# AM_SET_DEPDIR
3029aa228fdSmrg# -------------
3039aa228fdSmrg# Choose a directory name for dependency files.
3040c7e83b2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3059aa228fdSmrgAC_DEFUN([AM_SET_DEPDIR],
3069aa228fdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3079aa228fdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3089aa228fdSmrg])
3099aa228fdSmrg
3109aa228fdSmrg
3119aa228fdSmrg# AM_DEP_TRACK
3129aa228fdSmrg# ------------
3139aa228fdSmrgAC_DEFUN([AM_DEP_TRACK],
3140c7e83b2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3150c7e83b2SmrgAS_HELP_STRING(
3160c7e83b2Smrg  [--enable-dependency-tracking],
3170c7e83b2Smrg  [do not reject slow dependency extractors])
3180c7e83b2SmrgAS_HELP_STRING(
3190c7e83b2Smrg  [--disable-dependency-tracking],
3200c7e83b2Smrg  [speeds up one-time build])])
3219aa228fdSmrgif test "x$enable_dependency_tracking" != xno; then
3229aa228fdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3239aa228fdSmrg  AMDEPBACKSLASH='\'
32480b026c6Smrg  am__nodep='_no'
3259aa228fdSmrgfi
3269aa228fdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3279aa228fdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3289aa228fdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32980b026c6SmrgAC_SUBST([am__nodep])dnl
33080b026c6Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3319aa228fdSmrg])
3329aa228fdSmrg
3339aa228fdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3349aa228fdSmrg
335e39ce84cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3369aa228fdSmrg#
3379aa228fdSmrg# This file is free software; the Free Software Foundation
3389aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
3399aa228fdSmrg# with or without modifications, as long as this notice is preserved.
3409aa228fdSmrg
3419aa228fdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3429aa228fdSmrg# ------------------------------
3439aa228fdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3448f65982aSmrg[{
3450c7e83b2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3468f65982aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3478f65982aSmrg  # if we detect the quoting.
348e39ce84cSmrg  # TODO: see whether this extra hack can be removed once we start
349e39ce84cSmrg  # requiring Autoconf 2.70 or later.
350e39ce84cSmrg  AS_CASE([$CONFIG_FILES],
351e39ce84cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352e39ce84cSmrg          [*], [set x $CONFIG_FILES])
3538f65982aSmrg  shift
354e39ce84cSmrg  # Used to flag and report bootstrapping failures.
355e39ce84cSmrg  am_rc=0
356e39ce84cSmrg  for am_mf
3578f65982aSmrg  do
3588f65982aSmrg    # Strip MF so we end up with the name of the file.
359e39ce84cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360e39ce84cSmrg    # Check whether this is an Automake generated Makefile which includes
361e39ce84cSmrg    # dependency-tracking related rules and includes.
362e39ce84cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3638f65982aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364e39ce84cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365e39ce84cSmrg      || continue
366e39ce84cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367e39ce84cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368e39ce84cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369e39ce84cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370e39ce84cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3719aa228fdSmrg  done
372e39ce84cSmrg  if test $am_rc -ne 0; then
373e39ce84cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374e39ce84cSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375e39ce84cSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376e39ce84cSmrg    necessary).  You can also try re-running configure with the
377e39ce84cSmrg    '--disable-dependency-tracking' option to at least be able to build
378e39ce84cSmrg    the package (albeit without support for automatic dependency tracking).])
379e39ce84cSmrg  fi
380e39ce84cSmrg  AS_UNSET([am_dirpart])
381e39ce84cSmrg  AS_UNSET([am_filepart])
382e39ce84cSmrg  AS_UNSET([am_mf])
383e39ce84cSmrg  AS_UNSET([am_rc])
384e39ce84cSmrg  rm -f conftest-deps.mk
3858f65982aSmrg}
3869aa228fdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3879aa228fdSmrg
3889aa228fdSmrg
3899aa228fdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3909aa228fdSmrg# -----------------------------
3919aa228fdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3929aa228fdSmrg#
393e39ce84cSmrg# This code is only required when automatic dependency tracking is enabled.
394e39ce84cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395e39ce84cSmrg# order to bootstrap the dependency handling code.
3969aa228fdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3979aa228fdSmrg[AC_CONFIG_COMMANDS([depfiles],
3989aa228fdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399e39ce84cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4009aa228fdSmrg
4019aa228fdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4029aa228fdSmrg
403e39ce84cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4049aa228fdSmrg#
4059aa228fdSmrg# This file is free software; the Free Software Foundation
4069aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
4079aa228fdSmrg# with or without modifications, as long as this notice is preserved.
4089aa228fdSmrg
4099aa228fdSmrg# This macro actually does too much.  Some checks are only needed if
4109aa228fdSmrg# your package does certain things.  But this isn't really a big deal.
4119aa228fdSmrg
4120c7e83b2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4130c7e83b2Smrgm4_define([AC_PROG_CC],
4140c7e83b2Smrgm4_defn([AC_PROG_CC])
4150c7e83b2Smrg[_AM_PROG_CC_C_O
4160c7e83b2Smrg])
4170c7e83b2Smrg
4189aa228fdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4199aa228fdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4209aa228fdSmrg# -----------------------------------------------
4219aa228fdSmrg# The call with PACKAGE and VERSION arguments is the old style
4229aa228fdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4239aa228fdSmrg# and VERSION should now be passed to AC_INIT and removed from
4249aa228fdSmrg# the call to AM_INIT_AUTOMAKE.
4259aa228fdSmrg# We support both call styles for the transition.  After
4269aa228fdSmrg# the next Automake release, Autoconf can make the AC_INIT
4279aa228fdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4289aa228fdSmrg# release and drop the old call support.
4299aa228fdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4300c7e83b2Smrg[AC_PREREQ([2.65])dnl
431e39ce84cSmrgm4_ifdef([_$0_ALREADY_INIT],
432e39ce84cSmrg  [m4_fatal([$0 expanded multiple times
433e39ce84cSmrg]m4_defn([_$0_ALREADY_INIT]))],
434e39ce84cSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4359aa228fdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4369aa228fdSmrgdnl the ones we care about.
4379aa228fdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4389aa228fdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4399aa228fdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4409aa228fdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4419aa228fdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4429aa228fdSmrg  # is not polluted with repeated "-I."
4439aa228fdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4449aa228fdSmrg  # test to see if srcdir already configured
4459aa228fdSmrg  if test -f $srcdir/config.status; then
4469aa228fdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4479aa228fdSmrg  fi
4489aa228fdSmrgfi
4499aa228fdSmrg
4509aa228fdSmrg# test whether we have cygpath
4519aa228fdSmrgif test -z "$CYGPATH_W"; then
4529aa228fdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4539aa228fdSmrg    CYGPATH_W='cygpath -w'
4549aa228fdSmrg  else
4559aa228fdSmrg    CYGPATH_W=echo
4569aa228fdSmrg  fi
4579aa228fdSmrgfi
4589aa228fdSmrgAC_SUBST([CYGPATH_W])
4599aa228fdSmrg
4609aa228fdSmrg# Define the identity of the package.
4619aa228fdSmrgdnl Distinguish between old-style and new-style calls.
4629aa228fdSmrgm4_ifval([$2],
4630c7e83b2Smrg[AC_DIAGNOSE([obsolete],
4640c7e83b2Smrg             [$0: two- and three-arguments forms are deprecated.])
4650c7e83b2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4669aa228fdSmrg AC_SUBST([PACKAGE], [$1])dnl
4679aa228fdSmrg AC_SUBST([VERSION], [$2])],
4689aa228fdSmrg[_AM_SET_OPTIONS([$1])dnl
4699aa228fdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4700c7e83b2Smrgm4_if(
471e39ce84cSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4720c7e83b2Smrg  [ok:ok],,
4739aa228fdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4749aa228fdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4759aa228fdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4769aa228fdSmrg
4779aa228fdSmrg_AM_IF_OPTION([no-define],,
4780c7e83b2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4790c7e83b2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4809aa228fdSmrg
4819aa228fdSmrg# Some tools Automake needs.
4829aa228fdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4839aa228fdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4840c7e83b2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4850c7e83b2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4860c7e83b2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4870c7e83b2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4880c7e83b2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4898f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4908f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4910c7e83b2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4920c7e83b2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4930c7e83b2Smrg# dies out for good.  For more background, see:
494e39ce84cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495e39ce84cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4960c7e83b2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4970c7e83b2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4980c7e83b2Smrg# system "awk" is bad on some platforms.
4999aa228fdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5009aa228fdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5019aa228fdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5029aa228fdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5038f65982aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5048f65982aSmrg			     [_AM_PROG_TAR([v7])])])
5059aa228fdSmrg_AM_IF_OPTION([no-dependencies],,
5069aa228fdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5070c7e83b2Smrg		  [_AM_DEPENDENCIES([CC])],
5080c7e83b2Smrg		  [m4_define([AC_PROG_CC],
5090c7e83b2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5109aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5110c7e83b2Smrg		  [_AM_DEPENDENCIES([CXX])],
5120c7e83b2Smrg		  [m4_define([AC_PROG_CXX],
5130c7e83b2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5149aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5150c7e83b2Smrg		  [_AM_DEPENDENCIES([OBJC])],
5160c7e83b2Smrg		  [m4_define([AC_PROG_OBJC],
5170c7e83b2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5180c7e83b2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5190c7e83b2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5200c7e83b2Smrg		  [m4_define([AC_PROG_OBJCXX],
5210c7e83b2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5229aa228fdSmrg])
523e39ce84cSmrg# Variables for tags utilities; see am/tags.am
524e39ce84cSmrgif test -z "$CTAGS"; then
525e39ce84cSmrg  CTAGS=ctags
526e39ce84cSmrgfi
527e39ce84cSmrgAC_SUBST([CTAGS])
528e39ce84cSmrgif test -z "$ETAGS"; then
529e39ce84cSmrg  ETAGS=etags
530e39ce84cSmrgfi
531e39ce84cSmrgAC_SUBST([ETAGS])
532e39ce84cSmrgif test -z "$CSCOPE"; then
533e39ce84cSmrg  CSCOPE=cscope
534e39ce84cSmrgfi
535e39ce84cSmrgAC_SUBST([CSCOPE])
536e39ce84cSmrg
5370c7e83b2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5380c7e83b2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5390c7e83b2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5400c7e83b2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5418f65982aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5428f65982aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5438f65982aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5440c7e83b2Smrg
5450c7e83b2Smrg# POSIX will say in a future version that running "rm -f" with no argument
5460c7e83b2Smrg# is OK; and we want to be able to make that assumption in our Makefile
5470c7e83b2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5480c7e83b2Smrg# actually supported "in the wild" to an acceptable degree.
5490c7e83b2Smrg# See automake bug#10828.
5500c7e83b2Smrg# To make any issue more visible, cause the running configure to be aborted
5510c7e83b2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5520c7e83b2Smrg# user can still override this though.
5530c7e83b2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5540c7e83b2Smrg  cat >&2 <<'END'
5550c7e83b2SmrgOops!
5560c7e83b2Smrg
5570c7e83b2SmrgYour 'rm' program seems unable to run without file operands specified
5580c7e83b2Smrgon the command line, even when the '-f' option is present.  This is contrary
5590c7e83b2Smrgto the behaviour of most rm programs out there, and not conforming with
5600c7e83b2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5610c7e83b2Smrg
5620c7e83b2SmrgPlease tell bug-automake@gnu.org about your system, including the value
5630c7e83b2Smrgof your $PATH and any error possibly output before this message.  This
5640c7e83b2Smrgcan help us improve future automake versions.
5650c7e83b2Smrg
5660c7e83b2SmrgEND
5670c7e83b2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5680c7e83b2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5690c7e83b2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5700c7e83b2Smrg    echo >&2
5710c7e83b2Smrg  else
5720c7e83b2Smrg    cat >&2 <<'END'
5730c7e83b2SmrgAborting the configuration process, to ensure you take notice of the issue.
5740c7e83b2Smrg
5750c7e83b2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576e39ce84cSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5770c7e83b2Smrg
5780c7e83b2SmrgIf you want to complete the configuration process using your problematic
5790c7e83b2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5800c7e83b2Smrgto "yes", and re-run configure.
5810c7e83b2Smrg
5820c7e83b2SmrgEND
5830c7e83b2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5840c7e83b2Smrg  fi
5850c7e83b2Smrgfi
5860c7e83b2Smrgdnl The trailing newline in this macro's definition is deliberate, for
5870c7e83b2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5880c7e83b2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5899aa228fdSmrg])
5909aa228fdSmrg
5910c7e83b2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5928f65982aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5938f65982aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5948f65982aSmrgm4_define([_AC_COMPILER_EXEEXT],
5958f65982aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5968f65982aSmrg
5979aa228fdSmrg# When config.status generates a header, we must update the stamp-h file.
5989aa228fdSmrg# This file resides in the same directory as the config header
5999aa228fdSmrg# that is generated.  The stamp files are numbered to have different names.
6009aa228fdSmrg
6019aa228fdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6029aa228fdSmrg# loop where config.status creates the headers, so we can generate
6039aa228fdSmrg# our stamp files there.
6049aa228fdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6059aa228fdSmrg[# Compute $1's index in $config_headers.
6068f65982aSmrg_am_arg=$1
6079aa228fdSmrg_am_stamp_count=1
6089aa228fdSmrgfor _am_header in $config_headers :; do
6099aa228fdSmrg  case $_am_header in
6108f65982aSmrg    $_am_arg | $_am_arg:* )
6119aa228fdSmrg      break ;;
6129aa228fdSmrg    * )
6139aa228fdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6149aa228fdSmrg  esac
6159aa228fdSmrgdone
6168f65982aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6179aa228fdSmrg
618e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6199aa228fdSmrg#
6209aa228fdSmrg# This file is free software; the Free Software Foundation
6219aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6229aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6239aa228fdSmrg
6249aa228fdSmrg# AM_PROG_INSTALL_SH
6259aa228fdSmrg# ------------------
6269aa228fdSmrg# Define $install_sh.
6279aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6289aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6290c7e83b2Smrgif test x"${install_sh+set}" != xset; then
6308f65982aSmrg  case $am_aux_dir in
6318f65982aSmrg  *\ * | *\	*)
6328f65982aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6338f65982aSmrg  *)
6348f65982aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6358f65982aSmrg  esac
6368f65982aSmrgfi
6370c7e83b2SmrgAC_SUBST([install_sh])])
6389aa228fdSmrg
639e39ce84cSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6409aa228fdSmrg#
6419aa228fdSmrg# This file is free software; the Free Software Foundation
6429aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6439aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6449aa228fdSmrg
6459aa228fdSmrg# Check whether the underlying file-system supports filenames
6469aa228fdSmrg# with a leading dot.  For instance MS-DOS doesn't.
6479aa228fdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6489aa228fdSmrg[rm -rf .tst 2>/dev/null
6499aa228fdSmrgmkdir .tst 2>/dev/null
6509aa228fdSmrgif test -d .tst; then
6519aa228fdSmrg  am__leading_dot=.
6529aa228fdSmrgelse
6539aa228fdSmrg  am__leading_dot=_
6549aa228fdSmrgfi
6559aa228fdSmrgrmdir .tst 2>/dev/null
6569aa228fdSmrgAC_SUBST([am__leading_dot])])
6579aa228fdSmrg
6589aa228fdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6599aa228fdSmrg
660e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6619aa228fdSmrg#
6629aa228fdSmrg# This file is free software; the Free Software Foundation
6639aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6649aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6659aa228fdSmrg
6669aa228fdSmrg# AM_MAKE_INCLUDE()
6679aa228fdSmrg# -----------------
668e39ce84cSmrg# Check whether make has an 'include' directive that can support all
669e39ce84cSmrg# the idioms we need for our automatic dependency tracking code.
6709aa228fdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
671e39ce84cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672e39ce84cSmrgcat > confinc.mk << 'END'
6739aa228fdSmrgam__doit:
674e39ce84cSmrg	@echo this is the am__doit target >confinc.out
6759aa228fdSmrg.PHONY: am__doit
6769aa228fdSmrgEND
6779aa228fdSmrgam__include="#"
6789aa228fdSmrgam__quote=
679e39ce84cSmrg# BSD make does it like this.
680e39ce84cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681e39ce84cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682e39ce84cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683e39ce84cSmrg_am_result=no
684e39ce84cSmrgfor s in GNU BSD; do
685e39ce84cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686e39ce84cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687e39ce84cSmrg      ['0:this is the am__doit target'],
688e39ce84cSmrg      [AS_CASE([$s],
689e39ce84cSmrg          [BSD], [am__include='.include' am__quote='"'],
690e39ce84cSmrg          [am__include='include' am__quote=''])])
691e39ce84cSmrg  if test "$am__include" != "#"; then
692e39ce84cSmrg    _am_result="yes ($s style)"
693e39ce84cSmrg    break
694e39ce84cSmrg  fi
695e39ce84cSmrgdone
696e39ce84cSmrgrm -f confinc.* confmf.*
697e39ce84cSmrgAC_MSG_RESULT([${_am_result}])
698e39ce84cSmrgAC_SUBST([am__include])])
699e39ce84cSmrgAC_SUBST([am__quote])])
7009aa228fdSmrg
7019aa228fdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7029aa228fdSmrg
703e39ce84cSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7049aa228fdSmrg#
7059aa228fdSmrg# This file is free software; the Free Software Foundation
7069aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7079aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7089aa228fdSmrg
7099aa228fdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7109aa228fdSmrg# ------------------------------
7119aa228fdSmrgAC_DEFUN([AM_MISSING_PROG],
7129aa228fdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7139aa228fdSmrg$1=${$1-"${am_missing_run}$2"}
7149aa228fdSmrgAC_SUBST($1)])
7159aa228fdSmrg
7169aa228fdSmrg# AM_MISSING_HAS_RUN
7179aa228fdSmrg# ------------------
7180c7e83b2Smrg# Define MISSING if not defined so far and test if it is modern enough.
7190c7e83b2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7209aa228fdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7219aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7229aa228fdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7238f65982aSmrgif test x"${MISSING+set}" != xset; then
724e39ce84cSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7258f65982aSmrgfi
7269aa228fdSmrg# Use eval to expand $SHELL
7270c7e83b2Smrgif eval "$MISSING --is-lightweight"; then
7280c7e83b2Smrg  am_missing_run="$MISSING "
7299aa228fdSmrgelse
7309aa228fdSmrg  am_missing_run=
7310c7e83b2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7329aa228fdSmrgfi
7339aa228fdSmrg])
7349aa228fdSmrg
7359aa228fdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
7369aa228fdSmrg
737e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7389aa228fdSmrg#
7399aa228fdSmrg# This file is free software; the Free Software Foundation
7409aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7419aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7429aa228fdSmrg
7439aa228fdSmrg# _AM_MANGLE_OPTION(NAME)
7449aa228fdSmrg# -----------------------
7459aa228fdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7469aa228fdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7479aa228fdSmrg
7489aa228fdSmrg# _AM_SET_OPTION(NAME)
74980b026c6Smrg# --------------------
7509aa228fdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7519aa228fdSmrgAC_DEFUN([_AM_SET_OPTION],
7520c7e83b2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7539aa228fdSmrg
7549aa228fdSmrg# _AM_SET_OPTIONS(OPTIONS)
75580b026c6Smrg# ------------------------
7569aa228fdSmrg# OPTIONS is a space-separated list of Automake options.
7579aa228fdSmrgAC_DEFUN([_AM_SET_OPTIONS],
7588f65982aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7599aa228fdSmrg
7609aa228fdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7619aa228fdSmrg# -------------------------------------------
7629aa228fdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7639aa228fdSmrgAC_DEFUN([_AM_IF_OPTION],
7649aa228fdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7659aa228fdSmrg
766e39ce84cSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7670c7e83b2Smrg#
7680c7e83b2Smrg# This file is free software; the Free Software Foundation
7690c7e83b2Smrg# gives unlimited permission to copy and/or distribute it,
7700c7e83b2Smrg# with or without modifications, as long as this notice is preserved.
7719aa228fdSmrg
7720c7e83b2Smrg# _AM_PROG_CC_C_O
7730c7e83b2Smrg# ---------------
7740c7e83b2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7750c7e83b2Smrg# to automatically call this.
7760c7e83b2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7770c7e83b2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7780c7e83b2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7790c7e83b2SmrgAC_LANG_PUSH([C])dnl
7800c7e83b2SmrgAC_CACHE_CHECK(
7810c7e83b2Smrg  [whether $CC understands -c and -o together],
7820c7e83b2Smrg  [am_cv_prog_cc_c_o],
7830c7e83b2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7840c7e83b2Smrg  # Make sure it works both with $CC and with simple cc.
7850c7e83b2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7860c7e83b2Smrg  # compilers refuse to overwrite an existing .o file with -o,
7870c7e83b2Smrg  # though they will create one.
7880c7e83b2Smrg  am_cv_prog_cc_c_o=yes
7890c7e83b2Smrg  for am_i in 1 2; do
7900c7e83b2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7910c7e83b2Smrg         && test -f conftest2.$ac_objext; then
7920c7e83b2Smrg      : OK
7930c7e83b2Smrg    else
7940c7e83b2Smrg      am_cv_prog_cc_c_o=no
7950c7e83b2Smrg      break
7960c7e83b2Smrg    fi
7970c7e83b2Smrg  done
7980c7e83b2Smrg  rm -f core conftest*
7990c7e83b2Smrg  unset am_i])
8000c7e83b2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8010c7e83b2Smrg   # Losing compiler, so override with the script.
8020c7e83b2Smrg   # FIXME: It is wrong to rewrite CC.
8030c7e83b2Smrg   # But if we don't then we get into trouble of one sort or another.
8040c7e83b2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8050c7e83b2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8060c7e83b2Smrg   CC="$am_aux_dir/compile $CC"
8070c7e83b2Smrgfi
8080c7e83b2SmrgAC_LANG_POP([C])])
8090c7e83b2Smrg
8100c7e83b2Smrg# For backward compatibility.
8110c7e83b2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8120c7e83b2Smrg
813e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8149aa228fdSmrg#
8159aa228fdSmrg# This file is free software; the Free Software Foundation
8169aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
8179aa228fdSmrg# with or without modifications, as long as this notice is preserved.
8189aa228fdSmrg
8190c7e83b2Smrg# AM_RUN_LOG(COMMAND)
8200c7e83b2Smrg# -------------------
8210c7e83b2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8220c7e83b2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8230c7e83b2SmrgAC_DEFUN([AM_RUN_LOG],
8240c7e83b2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8250c7e83b2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8260c7e83b2Smrg   ac_status=$?
8270c7e83b2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8280c7e83b2Smrg   (exit $ac_status); }])
8290c7e83b2Smrg
8300c7e83b2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8310c7e83b2Smrg
832e39ce84cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8330c7e83b2Smrg#
8340c7e83b2Smrg# This file is free software; the Free Software Foundation
8350c7e83b2Smrg# gives unlimited permission to copy and/or distribute it,
8360c7e83b2Smrg# with or without modifications, as long as this notice is preserved.
8379aa228fdSmrg
8389aa228fdSmrg# AM_SANITY_CHECK
8399aa228fdSmrg# ---------------
8409aa228fdSmrgAC_DEFUN([AM_SANITY_CHECK],
8419aa228fdSmrg[AC_MSG_CHECKING([whether build environment is sane])
8428f65982aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8438f65982aSmrg# name.  Accept space and tab only in the latter.
8448f65982aSmrgam_lf='
8458f65982aSmrg'
8468f65982aSmrgcase `pwd` in
8478f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8488f65982aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8498f65982aSmrgesac
8508f65982aSmrgcase $srcdir in
8518f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8520c7e83b2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8538f65982aSmrgesac
8548f65982aSmrg
8550c7e83b2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8569aa228fdSmrg# arguments.  Must try -L first in case configure is actually a
8579aa228fdSmrg# symlink; some systems play weird games with the mod time of symlinks
8589aa228fdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8599aa228fdSmrg# directory).
8609aa228fdSmrgif (
8610c7e83b2Smrg   am_has_slept=no
8620c7e83b2Smrg   for am_try in 1 2; do
8630c7e83b2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8640c7e83b2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8650c7e83b2Smrg     if test "$[*]" = "X"; then
8660c7e83b2Smrg	# -L didn't work.
8670c7e83b2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8680c7e83b2Smrg     fi
8690c7e83b2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8700c7e83b2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8710c7e83b2Smrg
8720c7e83b2Smrg	# If neither matched, then we have a broken ls.  This can happen
8730c7e83b2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8740c7e83b2Smrg	# broken ls alias from the environment.  This has actually
8750c7e83b2Smrg	# happened.  Such a system could not be considered "sane".
8760c7e83b2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8770c7e83b2Smrg  alias in your environment])
8780c7e83b2Smrg     fi
8790c7e83b2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8800c7e83b2Smrg       break
8810c7e83b2Smrg     fi
8820c7e83b2Smrg     # Just in case.
8830c7e83b2Smrg     sleep 1
8840c7e83b2Smrg     am_has_slept=yes
8850c7e83b2Smrg   done
8869aa228fdSmrg   test "$[2]" = conftest.file
8879aa228fdSmrg   )
8889aa228fdSmrgthen
8899aa228fdSmrg   # Ok.
8909aa228fdSmrg   :
8919aa228fdSmrgelse
8929aa228fdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8939aa228fdSmrgCheck your system clock])
8949aa228fdSmrgfi
8950c7e83b2SmrgAC_MSG_RESULT([yes])
8960c7e83b2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8970c7e83b2Smrg# generated files are strictly newer.
8980c7e83b2Smrgam_sleep_pid=
8990c7e83b2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9000c7e83b2Smrg  ( sleep 1 ) &
9010c7e83b2Smrg  am_sleep_pid=$!
9020c7e83b2Smrgfi
9030c7e83b2SmrgAC_CONFIG_COMMANDS_PRE(
9040c7e83b2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9050c7e83b2Smrg   if test -n "$am_sleep_pid"; then
9060c7e83b2Smrg     # Hide warnings about reused PIDs.
9070c7e83b2Smrg     wait $am_sleep_pid 2>/dev/null
9080c7e83b2Smrg   fi
9090c7e83b2Smrg   AC_MSG_RESULT([done])])
9100c7e83b2Smrgrm -f conftest.file
9110c7e83b2Smrg])
9129aa228fdSmrg
913e39ce84cSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9148f65982aSmrg#
9158f65982aSmrg# This file is free software; the Free Software Foundation
9168f65982aSmrg# gives unlimited permission to copy and/or distribute it,
9178f65982aSmrg# with or without modifications, as long as this notice is preserved.
9188f65982aSmrg
9198f65982aSmrg# AM_SILENT_RULES([DEFAULT])
9208f65982aSmrg# --------------------------
9218f65982aSmrg# Enable less verbose build rules; with the default set to DEFAULT
9220c7e83b2Smrg# ("yes" being less verbose, "no" or empty being verbose).
9238f65982aSmrgAC_DEFUN([AM_SILENT_RULES],
9240c7e83b2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9250c7e83b2SmrgAS_HELP_STRING(
9260c7e83b2Smrg  [--enable-silent-rules],
9270c7e83b2Smrg  [less verbose build output (undo: "make V=1")])
9280c7e83b2SmrgAS_HELP_STRING(
9290c7e83b2Smrg  [--disable-silent-rules],
9300c7e83b2Smrg  [verbose build output (undo: "make V=0")])dnl
9310c7e83b2Smrg])
9320c7e83b2Smrgcase $enable_silent_rules in @%:@ (((
9330c7e83b2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9340c7e83b2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9350c7e83b2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9368f65982aSmrgesac
9370c7e83b2Smrgdnl
9380c7e83b2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9390c7e83b2Smrgdnl do not support nested variable expansions.
9400c7e83b2Smrgdnl See automake bug#9928 and bug#10237.
9410c7e83b2Smrgam_make=${MAKE-make}
9420c7e83b2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9430c7e83b2Smrg   [am_cv_make_support_nested_variables],
9440c7e83b2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9450c7e83b2SmrgBAR0=false
9460c7e83b2SmrgBAR1=true
9470c7e83b2SmrgV=1
9480c7e83b2Smrgam__doit:
9490c7e83b2Smrg	@$(TRUE)
9500c7e83b2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9510c7e83b2Smrg  am_cv_make_support_nested_variables=yes
9520c7e83b2Smrgelse
9530c7e83b2Smrg  am_cv_make_support_nested_variables=no
9540c7e83b2Smrgfi])
9550c7e83b2Smrgif test $am_cv_make_support_nested_variables = yes; then
9560c7e83b2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9570c7e83b2Smrg  AM_V='$(V)'
9580c7e83b2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9590c7e83b2Smrgelse
9600c7e83b2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9610c7e83b2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9620c7e83b2Smrgfi
9630c7e83b2SmrgAC_SUBST([AM_V])dnl
9640c7e83b2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9650c7e83b2SmrgAC_SUBST([AM_DEFAULT_V])dnl
9660c7e83b2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9678f65982aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9688f65982aSmrgAM_BACKSLASH='\'
9698f65982aSmrgAC_SUBST([AM_BACKSLASH])dnl
9708f65982aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9718f65982aSmrg])
9728f65982aSmrg
973e39ce84cSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9749aa228fdSmrg#
9759aa228fdSmrg# This file is free software; the Free Software Foundation
9769aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
9779aa228fdSmrg# with or without modifications, as long as this notice is preserved.
9789aa228fdSmrg
9799aa228fdSmrg# AM_PROG_INSTALL_STRIP
9809aa228fdSmrg# ---------------------
9810c7e83b2Smrg# One issue with vendor 'install' (even GNU) is that you can't
9829aa228fdSmrg# specify the program used to strip binaries.  This is especially
9839aa228fdSmrg# annoying in cross-compiling environments, where the build's strip
9849aa228fdSmrg# is unlikely to handle the host's binaries.
9859aa228fdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9860c7e83b2Smrg# always use install-sh in "make install-strip", and initialize
9879aa228fdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9889aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9899aa228fdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9900c7e83b2Smrg# Installed binaries are usually stripped using 'strip' when the user
9910c7e83b2Smrg# run "make install-strip".  However 'strip' might not be the right
9929aa228fdSmrg# tool to use in cross-compilation environments, therefore Automake
9930c7e83b2Smrg# will honor the 'STRIP' environment variable to overrule this program.
9940c7e83b2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9959aa228fdSmrgif test "$cross_compiling" != no; then
9969aa228fdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9979aa228fdSmrgfi
9989aa228fdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9999aa228fdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10009aa228fdSmrg
1001e39ce84cSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10029aa228fdSmrg#
10039aa228fdSmrg# This file is free software; the Free Software Foundation
10049aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
10059aa228fdSmrg# with or without modifications, as long as this notice is preserved.
10069aa228fdSmrg
10079aa228fdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10089aa228fdSmrg# ---------------------------
10098f65982aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10109aa228fdSmrg# This macro is traced by Automake.
10119aa228fdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10129aa228fdSmrg
10138f65982aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
101480b026c6Smrg# --------------------------
10158f65982aSmrg# Public sister of _AM_SUBST_NOTMAKE.
10168f65982aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10178f65982aSmrg
10189aa228fdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
10199aa228fdSmrg
1020e39ce84cSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10219aa228fdSmrg#
10229aa228fdSmrg# This file is free software; the Free Software Foundation
10239aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
10249aa228fdSmrg# with or without modifications, as long as this notice is preserved.
10259aa228fdSmrg
10269aa228fdSmrg# _AM_PROG_TAR(FORMAT)
10279aa228fdSmrg# --------------------
10289aa228fdSmrg# Check how to create a tarball in format FORMAT.
10290c7e83b2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10309aa228fdSmrg#
10319aa228fdSmrg# Substitute a variable $(am__tar) that is a command
10329aa228fdSmrg# writing to stdout a FORMAT-tarball containing the directory
10339aa228fdSmrg# $tardir.
10349aa228fdSmrg#     tardir=directory && $(am__tar) > result.tar
10359aa228fdSmrg#
10369aa228fdSmrg# Substitute a variable $(am__untar) that extract such
10379aa228fdSmrg# a tarball read from stdin.
10389aa228fdSmrg#     $(am__untar) < result.tar
10390c7e83b2Smrg#
10409aa228fdSmrgAC_DEFUN([_AM_PROG_TAR],
10410c7e83b2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10420c7e83b2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10430c7e83b2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10440c7e83b2Smrg
10450c7e83b2Smrg# We'll loop over all known methods to create a tar archive until one works.
10469aa228fdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10479aa228fdSmrg
10480c7e83b2Smrgm4_if([$1], [v7],
10490c7e83b2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10500c7e83b2Smrg
10510c7e83b2Smrg  [m4_case([$1],
10520c7e83b2Smrg    [ustar],
10530c7e83b2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10540c7e83b2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10550c7e83b2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10560c7e83b2Smrg      # and bug#13588).
10570c7e83b2Smrg      am_max_uid=2097151 # 2^21 - 1
10580c7e83b2Smrg      am_max_gid=$am_max_uid
10590c7e83b2Smrg      # The $UID and $GID variables are not portable, so we need to resort
10600c7e83b2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10610c7e83b2Smrg      # below are definitely unexpected, so allow the users to see them
10620c7e83b2Smrg      # (that is, avoid stderr redirection).
10630c7e83b2Smrg      am_uid=`id -u || echo unknown`
10640c7e83b2Smrg      am_gid=`id -g || echo unknown`
10650c7e83b2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10660c7e83b2Smrg      if test $am_uid -le $am_max_uid; then
10670c7e83b2Smrg         AC_MSG_RESULT([yes])
10680c7e83b2Smrg      else
10690c7e83b2Smrg         AC_MSG_RESULT([no])
10700c7e83b2Smrg         _am_tools=none
10710c7e83b2Smrg      fi
10720c7e83b2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10730c7e83b2Smrg      if test $am_gid -le $am_max_gid; then
10740c7e83b2Smrg         AC_MSG_RESULT([yes])
10750c7e83b2Smrg      else
10760c7e83b2Smrg        AC_MSG_RESULT([no])
10770c7e83b2Smrg        _am_tools=none
10780c7e83b2Smrg      fi],
10790c7e83b2Smrg
10800c7e83b2Smrg  [pax],
10810c7e83b2Smrg    [],
10820c7e83b2Smrg
10830c7e83b2Smrg  [m4_fatal([Unknown tar format])])
10840c7e83b2Smrg
10850c7e83b2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10860c7e83b2Smrg
10870c7e83b2Smrg  # Go ahead even if we have the value already cached.  We do so because we
10880c7e83b2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10890c7e83b2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10900c7e83b2Smrg
10910c7e83b2Smrg  for _am_tool in $_am_tools; do
10920c7e83b2Smrg    case $_am_tool in
10930c7e83b2Smrg    gnutar)
10940c7e83b2Smrg      for _am_tar in tar gnutar gtar; do
10950c7e83b2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10960c7e83b2Smrg      done
10970c7e83b2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10980c7e83b2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10990c7e83b2Smrg      am__untar="$_am_tar -xf -"
11000c7e83b2Smrg      ;;
11010c7e83b2Smrg    plaintar)
11020c7e83b2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11030c7e83b2Smrg      # ustar tarball either.
11040c7e83b2Smrg      (tar --version) >/dev/null 2>&1 && continue
11050c7e83b2Smrg      am__tar='tar chf - "$$tardir"'
11060c7e83b2Smrg      am__tar_='tar chf - "$tardir"'
11070c7e83b2Smrg      am__untar='tar xf -'
11080c7e83b2Smrg      ;;
11090c7e83b2Smrg    pax)
11100c7e83b2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11110c7e83b2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11120c7e83b2Smrg      am__untar='pax -r'
11130c7e83b2Smrg      ;;
11140c7e83b2Smrg    cpio)
11150c7e83b2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11160c7e83b2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11170c7e83b2Smrg      am__untar='cpio -i -H $1 -d'
11180c7e83b2Smrg      ;;
11190c7e83b2Smrg    none)
11200c7e83b2Smrg      am__tar=false
11210c7e83b2Smrg      am__tar_=false
11220c7e83b2Smrg      am__untar=false
11230c7e83b2Smrg      ;;
11240c7e83b2Smrg    esac
11259aa228fdSmrg
11260c7e83b2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11270c7e83b2Smrg    # and am__untar set.
11280c7e83b2Smrg    test -n "${am_cv_prog_tar_$1}" && break
11290c7e83b2Smrg
11300c7e83b2Smrg    # tar/untar a dummy directory, and stop if the command works.
11310c7e83b2Smrg    rm -rf conftest.dir
11320c7e83b2Smrg    mkdir conftest.dir
11330c7e83b2Smrg    echo GrepMe > conftest.dir/file
11340c7e83b2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11350c7e83b2Smrg    rm -rf conftest.dir
11360c7e83b2Smrg    if test -s conftest.tar; then
11370c7e83b2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11380c7e83b2Smrg      AM_RUN_LOG([cat conftest.dir/file])
11390c7e83b2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11400c7e83b2Smrg    fi
11410c7e83b2Smrg  done
11429aa228fdSmrg  rm -rf conftest.dir
11439aa228fdSmrg
11440c7e83b2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11450c7e83b2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11460c7e83b2Smrg
11479aa228fdSmrgAC_SUBST([am__tar])
11489aa228fdSmrgAC_SUBST([am__untar])
11499aa228fdSmrg]) # _AM_PROG_TAR
11509aa228fdSmrg
1151e39ce84cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152e39ce84cSmrgdnl serial 11 (pkg-config-0.29)
1153e39ce84cSmrgdnl
1154e39ce84cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155e39ce84cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1156e39ce84cSmrgdnl
1157e39ce84cSmrgdnl This program is free software; you can redistribute it and/or modify
1158e39ce84cSmrgdnl it under the terms of the GNU General Public License as published by
1159e39ce84cSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160e39ce84cSmrgdnl (at your option) any later version.
1161e39ce84cSmrgdnl
1162e39ce84cSmrgdnl This program is distributed in the hope that it will be useful, but
1163e39ce84cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164e39ce84cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165e39ce84cSmrgdnl General Public License for more details.
1166e39ce84cSmrgdnl
1167e39ce84cSmrgdnl You should have received a copy of the GNU General Public License
1168e39ce84cSmrgdnl along with this program; if not, write to the Free Software
1169e39ce84cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170e39ce84cSmrgdnl 02111-1307, USA.
1171e39ce84cSmrgdnl
1172e39ce84cSmrgdnl As a special exception to the GNU General Public License, if you
1173e39ce84cSmrgdnl distribute this file as part of a program that contains a
1174e39ce84cSmrgdnl configuration script generated by Autoconf, you may include it under
1175e39ce84cSmrgdnl the same distribution terms that you use for the rest of that
1176e39ce84cSmrgdnl program.
1177e39ce84cSmrg
1178e39ce84cSmrgdnl PKG_PREREQ(MIN-VERSION)
1179e39ce84cSmrgdnl -----------------------
1180e39ce84cSmrgdnl Since: 0.29
1181e39ce84cSmrgdnl
1182e39ce84cSmrgdnl Verify that the version of the pkg-config macros are at least
1183e39ce84cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184e39ce84cSmrgdnl installed version of pkg-config, this checks the developer's version
1185e39ce84cSmrgdnl of pkg.m4 when generating configure.
1186e39ce84cSmrgdnl
1187e39ce84cSmrgdnl To ensure that this macro is defined, also add:
1188e39ce84cSmrgdnl m4_ifndef([PKG_PREREQ],
1189e39ce84cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190e39ce84cSmrgdnl
1191e39ce84cSmrgdnl See the "Since" comment for each macro you use to see what version
1192e39ce84cSmrgdnl of the macros you require.
1193e39ce84cSmrgm4_defun([PKG_PREREQ],
1194e39ce84cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195e39ce84cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196e39ce84cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197e39ce84cSmrg])dnl PKG_PREREQ
1198e39ce84cSmrg
1199e39ce84cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200e39ce84cSmrgdnl ----------------------------------
1201e39ce84cSmrgdnl Since: 0.16
1202e39ce84cSmrgdnl
1203e39ce84cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204e39ce84cSmrgdnl first found in the path. Checks that the version of pkg-config found
1205e39ce84cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206e39ce84cSmrgdnl used since that's the first version where most current features of
1207e39ce84cSmrgdnl pkg-config existed.
120880b026c6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120980b026c6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210e39ce84cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211e39ce84cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215e39ce84cSmrg
121680b026c6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121780b026c6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121880b026c6Smrgfi
121980b026c6Smrgif test -n "$PKG_CONFIG"; then
122080b026c6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122180b026c6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122280b026c6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122380b026c6Smrg		AC_MSG_RESULT([yes])
122480b026c6Smrg	else
122580b026c6Smrg		AC_MSG_RESULT([no])
122680b026c6Smrg		PKG_CONFIG=""
122780b026c6Smrg	fi
122880b026c6Smrgfi[]dnl
1229e39ce84cSmrg])dnl PKG_PROG_PKG_CONFIG
123080b026c6Smrg
1231e39ce84cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232e39ce84cSmrgdnl -------------------------------------------------------------------
1233e39ce84cSmrgdnl Since: 0.18
1234e39ce84cSmrgdnl
1235e39ce84cSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236e39ce84cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237e39ce84cSmrgdnl
1238e39ce84cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239e39ce84cSmrgdnl only at the first occurence in configure.ac, so if the first place
1240e39ce84cSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241e39ce84cSmrgdnl have to call PKG_CHECK_EXISTS manually
124280b026c6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124380b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124480b026c6Smrgif test -n "$PKG_CONFIG" && \
124580b026c6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246e39ce84cSmrg  m4_default([$2], [:])
124780b026c6Smrgm4_ifvaln([$3], [else
124880b026c6Smrg  $3])dnl
124980b026c6Smrgfi])
125080b026c6Smrg
1251e39ce84cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252e39ce84cSmrgdnl ---------------------------------------------
1253e39ce84cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254e39ce84cSmrgdnl pkg_failed based on the result.
125580b026c6Smrgm4_define([_PKG_CONFIG],
125680b026c6Smrg[if test -n "$$1"; then
125780b026c6Smrg    pkg_cv_[]$1="$$1"
125880b026c6Smrg elif test -n "$PKG_CONFIG"; then
125980b026c6Smrg    PKG_CHECK_EXISTS([$3],
1260e39ce84cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261e39ce84cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
126280b026c6Smrg		     [pkg_failed=yes])
126380b026c6Smrg else
126480b026c6Smrg    pkg_failed=untried
126580b026c6Smrgfi[]dnl
1266e39ce84cSmrg])dnl _PKG_CONFIG
126780b026c6Smrg
1268e39ce84cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269e39ce84cSmrgdnl ---------------------------
1270e39ce84cSmrgdnl Internal check to see if pkg-config supports short errors.
127180b026c6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127280b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127380b026c6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127480b026c6Smrg        _pkg_short_errors_supported=yes
127580b026c6Smrgelse
127680b026c6Smrg        _pkg_short_errors_supported=no
127780b026c6Smrgfi[]dnl
1278e39ce84cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127980b026c6Smrg
128080b026c6Smrg
1281e39ce84cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282e39ce84cSmrgdnl   [ACTION-IF-NOT-FOUND])
1283e39ce84cSmrgdnl --------------------------------------------------------------
1284e39ce84cSmrgdnl Since: 0.4.0
1285e39ce84cSmrgdnl
1286e39ce84cSmrgdnl Note that if there is a possibility the first call to
1287e39ce84cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288e39ce84cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128980b026c6SmrgAC_DEFUN([PKG_CHECK_MODULES],
129080b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129180b026c6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129280b026c6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129380b026c6Smrg
129480b026c6Smrgpkg_failed=no
129580b026c6SmrgAC_MSG_CHECKING([for $1])
129680b026c6Smrg
129780b026c6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129880b026c6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129980b026c6Smrg
130080b026c6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130180b026c6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130280b026c6SmrgSee the pkg-config man page for more details.])
130380b026c6Smrg
130480b026c6Smrgif test $pkg_failed = yes; then
1305e39ce84cSmrg   	AC_MSG_RESULT([no])
130680b026c6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130780b026c6Smrg        if test $_pkg_short_errors_supported = yes; then
1308e39ce84cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130980b026c6Smrg        else 
1310e39ce84cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131180b026c6Smrg        fi
131280b026c6Smrg	# Put the nasty error message in config.log where it belongs
131380b026c6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131480b026c6Smrg
1315e39ce84cSmrg	m4_default([$4], [AC_MSG_ERROR(
131680b026c6Smrg[Package requirements ($2) were not met:
131780b026c6Smrg
131880b026c6Smrg$$1_PKG_ERRORS
131980b026c6Smrg
132080b026c6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132180b026c6Smrginstalled software in a non-standard prefix.
132280b026c6Smrg
1323e39ce84cSmrg_PKG_TEXT])[]dnl
1324e39ce84cSmrg        ])
132580b026c6Smrgelif test $pkg_failed = untried; then
1326e39ce84cSmrg     	AC_MSG_RESULT([no])
1327e39ce84cSmrg	m4_default([$4], [AC_MSG_FAILURE(
132880b026c6Smrg[The pkg-config script could not be found or is too old.  Make sure it
132980b026c6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133080b026c6Smrgpath to pkg-config.
133180b026c6Smrg
133280b026c6Smrg_PKG_TEXT
133380b026c6Smrg
1334e39ce84cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335e39ce84cSmrg        ])
133680b026c6Smrgelse
133780b026c6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133880b026c6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133980b026c6Smrg        AC_MSG_RESULT([yes])
1340e39ce84cSmrg	$3
134180b026c6Smrgfi[]dnl
1342e39ce84cSmrg])dnl PKG_CHECK_MODULES
1343e39ce84cSmrg
1344e39ce84cSmrg
1345e39ce84cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346e39ce84cSmrgdnl   [ACTION-IF-NOT-FOUND])
1347e39ce84cSmrgdnl ---------------------------------------------------------------------
1348e39ce84cSmrgdnl Since: 0.29
1349e39ce84cSmrgdnl
1350e39ce84cSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351e39ce84cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352e39ce84cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353e39ce84cSmrgdnl
1354e39ce84cSmrgdnl Note that if there is a possibility the first call to
1355e39ce84cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356e39ce84cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357e39ce84cSmrgdnl configure.ac.
1358e39ce84cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359e39ce84cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360e39ce84cSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361e39ce84cSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362e39ce84cSmrgPKG_CHECK_MODULES($@)
1363e39ce84cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364e39ce84cSmrg])dnl PKG_CHECK_MODULES_STATIC
1365e39ce84cSmrg
1366e39ce84cSmrg
1367e39ce84cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368e39ce84cSmrgdnl -------------------------
1369e39ce84cSmrgdnl Since: 0.27
1370e39ce84cSmrgdnl
1371e39ce84cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372e39ce84cSmrgdnl should install pkg-config .pc files. By default the directory is
1373e39ce84cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374e39ce84cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375e39ce84cSmrgdnl parameter.
1376e39ce84cSmrgAC_DEFUN([PKG_INSTALLDIR],
1377e39ce84cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378e39ce84cSmrgm4_pushdef([pkg_description],
1379e39ce84cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380e39ce84cSmrgAC_ARG_WITH([pkgconfigdir],
1381e39ce84cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382e39ce84cSmrg    [with_pkgconfigdir=]pkg_default)
1383e39ce84cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384e39ce84cSmrgm4_popdef([pkg_default])
1385e39ce84cSmrgm4_popdef([pkg_description])
1386e39ce84cSmrg])dnl PKG_INSTALLDIR
1387e39ce84cSmrg
1388e39ce84cSmrg
1389e39ce84cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390e39ce84cSmrgdnl --------------------------------
1391e39ce84cSmrgdnl Since: 0.27
1392e39ce84cSmrgdnl
1393e39ce84cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394e39ce84cSmrgdnl module should install arch-independent pkg-config .pc files. By
1395e39ce84cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396e39ce84cSmrgdnl changed by passing DIRECTORY. The user can override through the
1397e39ce84cSmrgdnl --with-noarch-pkgconfigdir parameter.
1398e39ce84cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399e39ce84cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400e39ce84cSmrgm4_pushdef([pkg_description],
1401e39ce84cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402e39ce84cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403e39ce84cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404e39ce84cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405e39ce84cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406e39ce84cSmrgm4_popdef([pkg_default])
1407e39ce84cSmrgm4_popdef([pkg_description])
1408e39ce84cSmrg])dnl PKG_NOARCH_INSTALLDIR
1409e39ce84cSmrg
1410e39ce84cSmrg
1411e39ce84cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412e39ce84cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413e39ce84cSmrgdnl -------------------------------------------
1414e39ce84cSmrgdnl Since: 0.28
1415e39ce84cSmrgdnl
1416e39ce84cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417e39ce84cSmrgAC_DEFUN([PKG_CHECK_VAR],
1418e39ce84cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419e39ce84cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420e39ce84cSmrg
1421e39ce84cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422e39ce84cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423e39ce84cSmrg
1424e39ce84cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425e39ce84cSmrg])dnl PKG_CHECK_VAR
142680b026c6Smrg
142783d7c197Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14289aa228fdSmrgdnl
1429e39ce84cSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14300c7e83b2Smrgdnl
14319aa228fdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14328f65982aSmrgdnl copy of this software and associated documentation files (the "Software"),
14338f65982aSmrgdnl to deal in the Software without restriction, including without limitation
14348f65982aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14358f65982aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14368f65982aSmrgdnl Software is furnished to do so, subject to the following conditions:
14379aa228fdSmrgdnl
14388f65982aSmrgdnl The above copyright notice and this permission notice (including the next
14398f65982aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14408f65982aSmrgdnl Software.
14419aa228fdSmrgdnl
14428f65982aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14438f65982aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14448f65982aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14458f65982aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14468f65982aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14478f65982aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14488f65982aSmrgdnl DEALINGS IN THE SOFTWARE.
14499aa228fdSmrg
14509aa228fdSmrg# XORG_MACROS_VERSION(required-version)
14519aa228fdSmrg# -------------------------------------
14529aa228fdSmrg# Minimum version: 1.1.0
14539aa228fdSmrg#
14549aa228fdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14559aa228fdSmrg# your configure.ac with the minimum required version, such as:
14569aa228fdSmrg# XORG_MACROS_VERSION(1.1)
14579aa228fdSmrg#
145883d7c197Smrg# To ensure that this macro is defined, also add:
145983d7c197Smrg# m4_ifndef([XORG_MACROS_VERSION],
146083d7c197Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14619aa228fdSmrg#
14629aa228fdSmrg#
14630c7e83b2Smrg# See the "minimum version" comment for each macro you use to see what
14649aa228fdSmrg# version you require.
146583d7c197Smrgm4_defun([XORG_MACROS_VERSION],[
1466e39ce84cSmrgm4_define([vers_have], [1.19.3])
146783d7c197Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146883d7c197Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146983d7c197Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147083d7c197Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147183d7c197Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147283d7c197Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147383d7c197Smrgm4_undefine([vers_have])
147483d7c197Smrgm4_undefine([maj_have])
147583d7c197Smrgm4_undefine([maj_needed])
14769aa228fdSmrg]) # XORG_MACROS_VERSION
14779aa228fdSmrg
14789aa228fdSmrg# XORG_PROG_RAWCPP()
14799aa228fdSmrg# ------------------
14809aa228fdSmrg# Minimum version: 1.0.0
14819aa228fdSmrg#
14829aa228fdSmrg# Find cpp program and necessary flags for use in pre-processing text files
14839aa228fdSmrg# such as man pages and config files
14849aa228fdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14859aa228fdSmrgAC_REQUIRE([AC_PROG_CPP])
1486e39ce84cSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14879aa228fdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14889aa228fdSmrg
14899aa228fdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14909aa228fdSmrg# which is not the best choice for supporting other OS'es, but covers most
14919aa228fdSmrg# of the ones we need for now.
14929aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149380b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14949aa228fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14959aa228fdSmrg	AC_MSG_RESULT([no])
14969aa228fdSmrgelse
14979aa228fdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14989aa228fdSmrg		RAWCPPFLAGS=-undef
14999aa228fdSmrg		AC_MSG_RESULT([yes])
150083d7c197Smrg	# under Cygwin unix is still defined even with -undef
150183d7c197Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150283d7c197Smrg		RAWCPPFLAGS="-undef -ansi"
150383d7c197Smrg		AC_MSG_RESULT([yes, with -ansi])
15049aa228fdSmrg	else
15059aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15069aa228fdSmrg	fi
15079aa228fdSmrgfi
15089aa228fdSmrgrm -f conftest.$ac_ext
15099aa228fdSmrg
15109aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151180b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15129aa228fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15139aa228fdSmrg	AC_MSG_RESULT([no])
15149aa228fdSmrgelse
15159aa228fdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15160c7e83b2Smrg		TRADITIONALCPPFLAGS="-traditional"
15179aa228fdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15189aa228fdSmrg		AC_MSG_RESULT([yes])
15199aa228fdSmrg	else
15209aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15219aa228fdSmrg	fi
15229aa228fdSmrgfi
15239aa228fdSmrgrm -f conftest.$ac_ext
15249aa228fdSmrgAC_SUBST(RAWCPPFLAGS)
15250c7e83b2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15269aa228fdSmrg]) # XORG_PROG_RAWCPP
15279aa228fdSmrg
15289aa228fdSmrg# XORG_MANPAGE_SECTIONS()
15299aa228fdSmrg# -----------------------
15309aa228fdSmrg# Minimum version: 1.0.0
15319aa228fdSmrg#
15329aa228fdSmrg# Determine which sections man pages go in for the different man page types
15339aa228fdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15349aa228fdSmrg# Not sure if there's any better way than just hardcoding by OS name.
15359aa228fdSmrg# Override default settings by setting environment variables
15368f65982aSmrg# Added MAN_SUBSTS in version 1.8
15378f65982aSmrg# Added AC_PROG_SED in version 1.8
15389aa228fdSmrg
15399aa228fdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15409aa228fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15418f65982aSmrgAC_REQUIRE([AC_PROG_SED])
15429aa228fdSmrg
1543e39ce84cSmrgcase $host_os in
1544e39ce84cSmrg    solaris*)
1545e39ce84cSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546e39ce84cSmrg        # check for a man page file found in later versions that use
1547e39ce84cSmrg        # traditional section numbers instead
1548e39ce84cSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549e39ce84cSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550e39ce84cSmrg        ;;
1551e39ce84cSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552e39ce84cSmrgesac
1553e39ce84cSmrg
15549aa228fdSmrgif test x$APP_MAN_SUFFIX = x    ; then
15559aa228fdSmrg    APP_MAN_SUFFIX=1
15569aa228fdSmrgfi
15579aa228fdSmrgif test x$APP_MAN_DIR = x    ; then
15589aa228fdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15599aa228fdSmrgfi
15609aa228fdSmrg
15619aa228fdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15629aa228fdSmrg    LIB_MAN_SUFFIX=3
15639aa228fdSmrgfi
15649aa228fdSmrgif test x$LIB_MAN_DIR = x    ; then
15659aa228fdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15669aa228fdSmrgfi
15679aa228fdSmrg
15689aa228fdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1569e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1570e39ce84cSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1571e39ce84cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15729aa228fdSmrg    esac
15739aa228fdSmrgfi
15749aa228fdSmrgif test x$FILE_MAN_DIR = x    ; then
15759aa228fdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15769aa228fdSmrgfi
15779aa228fdSmrg
15789aa228fdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1579e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1580e39ce84cSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1581e39ce84cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15829aa228fdSmrg    esac
15839aa228fdSmrgfi
15849aa228fdSmrgif test x$MISC_MAN_DIR = x    ; then
15859aa228fdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15869aa228fdSmrgfi
15879aa228fdSmrg
15889aa228fdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1590e39ce84cSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591e39ce84cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15929aa228fdSmrg    esac
15939aa228fdSmrgfi
15949aa228fdSmrgif test x$DRIVER_MAN_DIR = x    ; then
15959aa228fdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15969aa228fdSmrgfi
15979aa228fdSmrg
15989aa228fdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1600e39ce84cSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601e39ce84cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16029aa228fdSmrg    esac
16039aa228fdSmrgfi
16049aa228fdSmrgif test x$ADMIN_MAN_DIR = x    ; then
16059aa228fdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16069aa228fdSmrgfi
16079aa228fdSmrg
16089aa228fdSmrg
16099aa228fdSmrgAC_SUBST([APP_MAN_SUFFIX])
16109aa228fdSmrgAC_SUBST([LIB_MAN_SUFFIX])
16119aa228fdSmrgAC_SUBST([FILE_MAN_SUFFIX])
16129aa228fdSmrgAC_SUBST([MISC_MAN_SUFFIX])
16139aa228fdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16149aa228fdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16159aa228fdSmrgAC_SUBST([APP_MAN_DIR])
16169aa228fdSmrgAC_SUBST([LIB_MAN_DIR])
16179aa228fdSmrgAC_SUBST([FILE_MAN_DIR])
16189aa228fdSmrgAC_SUBST([MISC_MAN_DIR])
16199aa228fdSmrgAC_SUBST([DRIVER_MAN_DIR])
16209aa228fdSmrgAC_SUBST([ADMIN_MAN_DIR])
16218f65982aSmrg
16228f65982aSmrgXORG_MAN_PAGE="X Version 11"
16238f65982aSmrgAC_SUBST([XORG_MAN_PAGE])
16248f65982aSmrgMAN_SUBSTS="\
16258f65982aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16268f65982aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16278f65982aSmrg	-e 's|__xservername__|Xorg|g' \
16288f65982aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16298f65982aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16308f65982aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16318f65982aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16328f65982aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16338f65982aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16348f65982aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16358f65982aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16368f65982aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16378f65982aSmrgAC_SUBST([MAN_SUBSTS])
16388f65982aSmrg
16399aa228fdSmrg]) # XORG_MANPAGE_SECTIONS
16409aa228fdSmrg
16418f65982aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16428f65982aSmrg# ------------------------
16438f65982aSmrg# Minimum version: 1.7.0
16448f65982aSmrg#
16458f65982aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16468f65982aSmrg# provided by xorg-sgml-doctools, if installed.
16478f65982aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16488f65982aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16498f65982aSmrgXORG_SGML_PATH=
16508f65982aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16518f65982aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16528f65982aSmrg    [m4_ifval([$1],[:],
16538f65982aSmrg        [if test x"$cross_compiling" != x"yes" ; then
16548f65982aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16558f65982aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16568f65982aSmrg         fi])
16578f65982aSmrg    ])
16588f65982aSmrg
16598f65982aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16608f65982aSmrg# the path and the name of the doc stylesheet
16618f65982aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16628f65982aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16638f65982aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16648f65982aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16658f65982aSmrgelse
16668f65982aSmrg   AC_MSG_RESULT([no])
16678f65982aSmrgfi
16688f65982aSmrg
16698f65982aSmrgAC_SUBST(XORG_SGML_PATH)
16708f65982aSmrgAC_SUBST(STYLESHEET_SRCDIR)
16718f65982aSmrgAC_SUBST(XSL_STYLESHEET)
16728f65982aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16738f65982aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16748f65982aSmrg
16759aa228fdSmrg# XORG_CHECK_LINUXDOC
16769aa228fdSmrg# -------------------
16779aa228fdSmrg# Minimum version: 1.0.0
16789aa228fdSmrg#
16799aa228fdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16809aa228fdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16819aa228fdSmrg# Whether or not the necessary tools and files are found can be checked
16829aa228fdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16839aa228fdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16848f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16858f65982aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16869aa228fdSmrg
16879aa228fdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16889aa228fdSmrg
16898f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
16909aa228fdSmrg
16918f65982aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16929aa228fdSmrg   BUILDDOC=yes
16939aa228fdSmrgelse
16949aa228fdSmrg   BUILDDOC=no
16959aa228fdSmrgfi
16969aa228fdSmrg
16979aa228fdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16989aa228fdSmrg
16999aa228fdSmrgAC_MSG_RESULT([$BUILDDOC])
17009aa228fdSmrg
17018f65982aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17029aa228fdSmrg
17038f65982aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17049aa228fdSmrg   BUILDPDFDOC=yes
17059aa228fdSmrgelse
17069aa228fdSmrg   BUILDPDFDOC=no
17079aa228fdSmrgfi
17089aa228fdSmrg
17099aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17109aa228fdSmrg
17119aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17129aa228fdSmrg
17138f65982aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17149aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17159aa228fdSmrgMAKE_PDF="$PS2PDF"
17169aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17179aa228fdSmrg
17189aa228fdSmrgAC_SUBST(MAKE_TEXT)
17199aa228fdSmrgAC_SUBST(MAKE_PS)
17209aa228fdSmrgAC_SUBST(MAKE_PDF)
17219aa228fdSmrgAC_SUBST(MAKE_HTML)
17229aa228fdSmrg]) # XORG_CHECK_LINUXDOC
17239aa228fdSmrg
17249aa228fdSmrg# XORG_CHECK_DOCBOOK
17259aa228fdSmrg# -------------------
17269aa228fdSmrg# Minimum version: 1.0.0
17279aa228fdSmrg#
17289aa228fdSmrg# Checks for the ability to build output formats from SGML DocBook source.
17299aa228fdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17309aa228fdSmrg# indicates whether the necessary tools and files are found and, if set,
17319aa228fdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17329aa228fdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17338f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17348f65982aSmrg
17359aa228fdSmrgBUILDTXTDOC=no
17369aa228fdSmrgBUILDPDFDOC=no
17379aa228fdSmrgBUILDPSDOC=no
17389aa228fdSmrgBUILDHTMLDOC=no
17399aa228fdSmrg
17409aa228fdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17419aa228fdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17429aa228fdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17439aa228fdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17449aa228fdSmrg
17458f65982aSmrgAC_MSG_CHECKING([whether to build text documentation])
17468f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17479aa228fdSmrg   test x$BUILD_TXTDOC != xno; then
17489aa228fdSmrg	BUILDTXTDOC=yes
17499aa228fdSmrgfi
17509aa228fdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17519aa228fdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
17529aa228fdSmrg
17538f65982aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17548f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17559aa228fdSmrg   test x$BUILD_PDFDOC != xno; then
17569aa228fdSmrg	BUILDPDFDOC=yes
17579aa228fdSmrgfi
17589aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17599aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17609aa228fdSmrg
17618f65982aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17628f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17639aa228fdSmrg   test x$BUILD_PSDOC != xno; then
17649aa228fdSmrg	BUILDPSDOC=yes
17659aa228fdSmrgfi
17669aa228fdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17679aa228fdSmrgAC_MSG_RESULT([$BUILDPSDOC])
17689aa228fdSmrg
17698f65982aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17708f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17719aa228fdSmrg   test x$BUILD_HTMLDOC != xno; then
17729aa228fdSmrg	BUILDHTMLDOC=yes
17739aa228fdSmrgfi
17749aa228fdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17759aa228fdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17769aa228fdSmrg
17779aa228fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17789aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17799aa228fdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17809aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17819aa228fdSmrg
17829aa228fdSmrgAC_SUBST(MAKE_TEXT)
17839aa228fdSmrgAC_SUBST(MAKE_PS)
17849aa228fdSmrgAC_SUBST(MAKE_PDF)
17859aa228fdSmrgAC_SUBST(MAKE_HTML)
17869aa228fdSmrg]) # XORG_CHECK_DOCBOOK
17879aa228fdSmrg
17888f65982aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17898f65982aSmrg# ----------------
17908f65982aSmrg# Minimum version: 1.5.0
17918f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
17928f65982aSmrg#
17938f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
17948f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
17958f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17968f65982aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17978f65982aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17988f65982aSmrg# --with-xmlto assumes 'auto'.
17998f65982aSmrg#
18008f65982aSmrg# Interface to module:
18018f65982aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18028f65982aSmrg# XMLTO:	returns the path of the xmlto program found
18038f65982aSmrg#		returns the path set by the user in the environment
18048f65982aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18058f65982aSmrg#		'no' user instructs the module not to use xmlto
18068f65982aSmrg#
18078f65982aSmrg# Added in version 1.10.0
18088f65982aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18098f65982aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18108f65982aSmrg#
18118f65982aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18128f65982aSmrg#
18138f65982aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18148f65982aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18158f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
18168f65982aSmrgAC_ARG_WITH(xmlto,
18178f65982aSmrg	AS_HELP_STRING([--with-xmlto],
18188f65982aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18198f65982aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18208f65982aSmrgm4_undefine([_defopt])
18218f65982aSmrg
18228f65982aSmrgif test "x$use_xmlto" = x"auto"; then
18238f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18248f65982aSmrg   if test "x$XMLTO" = "x"; then
18258f65982aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18268f65982aSmrg	have_xmlto=no
18278f65982aSmrg   else
18288f65982aSmrg        have_xmlto=yes
18298f65982aSmrg   fi
18308f65982aSmrgelif test "x$use_xmlto" = x"yes" ; then
18318f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18328f65982aSmrg   if test "x$XMLTO" = "x"; then
18338f65982aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18348f65982aSmrg   fi
18358f65982aSmrg   have_xmlto=yes
18368f65982aSmrgelif test "x$use_xmlto" = x"no" ; then
18378f65982aSmrg   if test "x$XMLTO" != "x"; then
18388f65982aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18398f65982aSmrg   fi
18408f65982aSmrg   have_xmlto=no
18418f65982aSmrgelse
18428f65982aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18438f65982aSmrgfi
18448f65982aSmrg
18458f65982aSmrg# Test for a minimum version of xmlto, if provided.
18468f65982aSmrgm4_ifval([$1],
18478f65982aSmrg[if test "$have_xmlto" = yes; then
18488f65982aSmrg    # scrape the xmlto version
18498f65982aSmrg    AC_MSG_CHECKING([the xmlto version])
18508f65982aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18518f65982aSmrg    AC_MSG_RESULT([$xmlto_version])
18528f65982aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18538f65982aSmrg        [if test "x$use_xmlto" = xauto; then
18548f65982aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18558f65982aSmrg            have_xmlto=no
18568f65982aSmrg        else
18578f65982aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18588f65982aSmrg        fi])
18598f65982aSmrgfi])
18608f65982aSmrg
18618f65982aSmrg# Test for the ability of xmlto to generate a text target
1862e39ce84cSmrg#
1863e39ce84cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864e39ce84cSmrg# following test for empty XML docbook files.
1865e39ce84cSmrg# For compatibility reasons use the following empty XML docbook file and if
1866e39ce84cSmrg# it fails try it again with a non-empty XML file.
18678f65982aSmrghave_xmlto_text=no
18688f65982aSmrgcat > conftest.xml << "EOF"
18698f65982aSmrgEOF
18708f65982aSmrgAS_IF([test "$have_xmlto" = yes],
18718f65982aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18728f65982aSmrg             [have_xmlto_text=yes],
1873e39ce84cSmrg             [# Try it again with a non-empty XML file.
1874e39ce84cSmrg              cat > conftest.xml << "EOF"
1875e39ce84cSmrg<x></x>
1876e39ce84cSmrgEOF
1877e39ce84cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878e39ce84cSmrg                    [have_xmlto_text=yes],
1879e39ce84cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18808f65982aSmrgrm -f conftest.xml
18818f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18828f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18838f65982aSmrg]) # XORG_WITH_XMLTO
18848f65982aSmrg
188580b026c6Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188680b026c6Smrg# --------------------------------------------
188780b026c6Smrg# Minimum version: 1.12.0
188880b026c6Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188980b026c6Smrg#
189080b026c6Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189180b026c6Smrg# XML-based language used for the transformation of XML documents.
189280b026c6Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189380b026c6Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189480b026c6Smrg# The XSLT processor is often used as a standalone tool for transformations.
189580b026c6Smrg# It should not be assumed that this tool is used only to work with documnetation.
189680b026c6Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189780b026c6Smrg#
189880b026c6Smrg# Interface to module:
189980b026c6Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190080b026c6Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190180b026c6Smrg#		 returns the path set by the user in the environment
190280b026c6Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190380b026c6Smrg#		  'no' user instructs the module not to use xsltproc
190480b026c6Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190580b026c6Smrg#
190680b026c6Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190780b026c6Smrg#
190880b026c6SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190980b026c6SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191080b026c6Smrg# Preserves the interface, should it be implemented later
191180b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191280b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
191380b026c6SmrgAC_ARG_WITH(xsltproc,
191480b026c6Smrg	AS_HELP_STRING([--with-xsltproc],
191580b026c6Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191680b026c6Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191780b026c6Smrgm4_undefine([_defopt])
191880b026c6Smrg
191980b026c6Smrgif test "x$use_xsltproc" = x"auto"; then
192080b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192180b026c6Smrg   if test "x$XSLTPROC" = "x"; then
192280b026c6Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192380b026c6Smrg	have_xsltproc=no
192480b026c6Smrg   else
192580b026c6Smrg        have_xsltproc=yes
192680b026c6Smrg   fi
192780b026c6Smrgelif test "x$use_xsltproc" = x"yes" ; then
192880b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192980b026c6Smrg   if test "x$XSLTPROC" = "x"; then
193080b026c6Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193180b026c6Smrg   fi
193280b026c6Smrg   have_xsltproc=yes
193380b026c6Smrgelif test "x$use_xsltproc" = x"no" ; then
193480b026c6Smrg   if test "x$XSLTPROC" != "x"; then
193580b026c6Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193680b026c6Smrg   fi
193780b026c6Smrg   have_xsltproc=no
193880b026c6Smrgelse
193980b026c6Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194080b026c6Smrgfi
194180b026c6Smrg
194280b026c6SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194380b026c6Smrg]) # XORG_WITH_XSLTPROC
194480b026c6Smrg
194580b026c6Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194680b026c6Smrg# ----------------------------------------
194780b026c6Smrg# Minimum version: 1.15.0
194880b026c6Smrg#
194980b026c6Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195080b026c6Smrg# scanning arbitrary text files, extracting information from those text files,
195180b026c6Smrg# and printing reports based on that information.
195280b026c6Smrg#
195380b026c6Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195480b026c6Smrg#
195580b026c6Smrg# Interface to module:
195680b026c6Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195780b026c6Smrg# PERL:	     returns the path of the perl program found
195880b026c6Smrg#	     returns the path set by the user in the environment
195980b026c6Smrg# --with-perl: 'yes' user instructs the module to use perl
196080b026c6Smrg#	       'no' user instructs the module not to use perl
196180b026c6Smrg# have_perl: returns yes if perl found in PATH or no
196280b026c6Smrg#
196380b026c6Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196480b026c6Smrg#
196580b026c6SmrgAC_DEFUN([XORG_WITH_PERL],[
196680b026c6SmrgAC_ARG_VAR([PERL], [Path to perl command])
196780b026c6Smrg# Preserves the interface, should it be implemented later
196880b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196980b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
197080b026c6SmrgAC_ARG_WITH(perl,
197180b026c6Smrg	AS_HELP_STRING([--with-perl],
197280b026c6Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197380b026c6Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197480b026c6Smrgm4_undefine([_defopt])
197580b026c6Smrg
197680b026c6Smrgif test "x$use_perl" = x"auto"; then
197780b026c6Smrg   AC_PATH_PROG([PERL], [perl])
197880b026c6Smrg   if test "x$PERL" = "x"; then
197980b026c6Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198080b026c6Smrg	have_perl=no
198180b026c6Smrg   else
198280b026c6Smrg        have_perl=yes
198380b026c6Smrg   fi
198480b026c6Smrgelif test "x$use_perl" = x"yes" ; then
198580b026c6Smrg   AC_PATH_PROG([PERL], [perl])
198680b026c6Smrg   if test "x$PERL" = "x"; then
198780b026c6Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198880b026c6Smrg   fi
198980b026c6Smrg   have_perl=yes
199080b026c6Smrgelif test "x$use_perl" = x"no" ; then
199180b026c6Smrg   if test "x$PERL" != "x"; then
199280b026c6Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199380b026c6Smrg   fi
199480b026c6Smrg   have_perl=no
199580b026c6Smrgelse
199680b026c6Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199780b026c6Smrgfi
199880b026c6Smrg
199980b026c6SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200080b026c6Smrg]) # XORG_WITH_PERL
200180b026c6Smrg
20028f65982aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20038f65982aSmrg# ----------------
20048f65982aSmrg# Minimum version: 1.5.0
20058f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20068f65982aSmrg#
20078f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
20088f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
20098f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20108f65982aSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20118f65982aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20128f65982aSmrg# --with-asciidoc assumes 'auto'.
20138f65982aSmrg#
20148f65982aSmrg# Interface to module:
20158f65982aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20168f65982aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20178f65982aSmrg#		 returns the path set by the user in the environment
20188f65982aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20198f65982aSmrg#		  'no' user instructs the module not to use asciidoc
20208f65982aSmrg#
20218f65982aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20228f65982aSmrg#
20238f65982aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20248f65982aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20258f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
20268f65982aSmrgAC_ARG_WITH(asciidoc,
20278f65982aSmrg	AS_HELP_STRING([--with-asciidoc],
20288f65982aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20298f65982aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20308f65982aSmrgm4_undefine([_defopt])
20318f65982aSmrg
20328f65982aSmrgif test "x$use_asciidoc" = x"auto"; then
20338f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20348f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
20358f65982aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20368f65982aSmrg	have_asciidoc=no
20378f65982aSmrg   else
20388f65982aSmrg        have_asciidoc=yes
20398f65982aSmrg   fi
20408f65982aSmrgelif test "x$use_asciidoc" = x"yes" ; then
20418f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20428f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
20438f65982aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20448f65982aSmrg   fi
20458f65982aSmrg   have_asciidoc=yes
20468f65982aSmrgelif test "x$use_asciidoc" = x"no" ; then
20478f65982aSmrg   if test "x$ASCIIDOC" != "x"; then
20488f65982aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20498f65982aSmrg   fi
20508f65982aSmrg   have_asciidoc=no
20518f65982aSmrgelse
20528f65982aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20538f65982aSmrgfi
20548f65982aSmrgm4_ifval([$1],
20558f65982aSmrg[if test "$have_asciidoc" = yes; then
20568f65982aSmrg    # scrape the asciidoc version
20578f65982aSmrg    AC_MSG_CHECKING([the asciidoc version])
20588f65982aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20598f65982aSmrg    AC_MSG_RESULT([$asciidoc_version])
20608f65982aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20618f65982aSmrg        [if test "x$use_asciidoc" = xauto; then
20628f65982aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20638f65982aSmrg            have_asciidoc=no
20648f65982aSmrg        else
20658f65982aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20668f65982aSmrg        fi])
20678f65982aSmrgfi])
20688f65982aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20698f65982aSmrg]) # XORG_WITH_ASCIIDOC
20708f65982aSmrg
20718f65982aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20720c7e83b2Smrg# -------------------------------------------
20738f65982aSmrg# Minimum version: 1.5.0
20748f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20750c7e83b2Smrg# Minimum version for optional DOT checking: 1.18.0
20768f65982aSmrg#
20778f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
20788f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
20798f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20808f65982aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20818f65982aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20828f65982aSmrg# --with-doxygen assumes 'auto'.
20838f65982aSmrg#
20848f65982aSmrg# Interface to module:
20858f65982aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20868f65982aSmrg# DOXYGEN:	 returns the path of the doxygen program found
20878f65982aSmrg#		 returns the path set by the user in the environment
20888f65982aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20898f65982aSmrg#		  'no' user instructs the module not to use doxygen
20908f65982aSmrg#
20918f65982aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20928f65982aSmrg#
20938f65982aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20948f65982aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20950c7e83b2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20968f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
20978f65982aSmrgAC_ARG_WITH(doxygen,
20988f65982aSmrg	AS_HELP_STRING([--with-doxygen],
20998f65982aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21008f65982aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21018f65982aSmrgm4_undefine([_defopt])
21028f65982aSmrg
21038f65982aSmrgif test "x$use_doxygen" = x"auto"; then
21048f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21058f65982aSmrg   if test "x$DOXYGEN" = "x"; then
21068f65982aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21078f65982aSmrg	have_doxygen=no
21088f65982aSmrg   else
21098f65982aSmrg        have_doxygen=yes
21108f65982aSmrg   fi
21118f65982aSmrgelif test "x$use_doxygen" = x"yes" ; then
21128f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21138f65982aSmrg   if test "x$DOXYGEN" = "x"; then
21148f65982aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21158f65982aSmrg   fi
21168f65982aSmrg   have_doxygen=yes
21178f65982aSmrgelif test "x$use_doxygen" = x"no" ; then
21188f65982aSmrg   if test "x$DOXYGEN" != "x"; then
21198f65982aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21208f65982aSmrg   fi
21218f65982aSmrg   have_doxygen=no
21228f65982aSmrgelse
21238f65982aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21248f65982aSmrgfi
21258f65982aSmrgm4_ifval([$1],
21268f65982aSmrg[if test "$have_doxygen" = yes; then
21278f65982aSmrg    # scrape the doxygen version
21288f65982aSmrg    AC_MSG_CHECKING([the doxygen version])
21298f65982aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21308f65982aSmrg    AC_MSG_RESULT([$doxygen_version])
21318f65982aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21328f65982aSmrg        [if test "x$use_doxygen" = xauto; then
21338f65982aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21348f65982aSmrg            have_doxygen=no
21358f65982aSmrg        else
21368f65982aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21378f65982aSmrg        fi])
21388f65982aSmrgfi])
21390c7e83b2Smrg
21400c7e83b2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21410c7e83b2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21420c7e83b2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21430c7e83b2SmrgHAVE_DOT=no
21440c7e83b2Smrgif test "x$have_doxygen" = "xyes"; then
21450c7e83b2Smrg  AC_PATH_PROG([DOT], [dot])
21460c7e83b2Smrg    if test "x$DOT" != "x"; then
21470c7e83b2Smrg      HAVE_DOT=yes
21480c7e83b2Smrg    fi
21490c7e83b2Smrgfi
21500c7e83b2Smrg
21510c7e83b2SmrgAC_SUBST([HAVE_DOT])
21520c7e83b2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21538f65982aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21548f65982aSmrg]) # XORG_WITH_DOXYGEN
21558f65982aSmrg
21568f65982aSmrg# XORG_WITH_GROFF([DEFAULT])
21578f65982aSmrg# ----------------
21588f65982aSmrg# Minimum version: 1.6.0
21598f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21608f65982aSmrg#
21618f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
21628f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
21638f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21648f65982aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
21658f65982aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21668f65982aSmrg# --with-groff assumes 'auto'.
21678f65982aSmrg#
21688f65982aSmrg# Interface to module:
21698f65982aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21708f65982aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21718f65982aSmrg# HAVE_GROFF_MS: the -ms macros package
21728f65982aSmrg# GROFF:	 returns the path of the groff program found
21738f65982aSmrg#		 returns the path set by the user in the environment
21748f65982aSmrg# --with-groff:	 'yes' user instructs the module to use groff
21758f65982aSmrg#		 'no' user instructs the module not to use groff
21768f65982aSmrg#
21778f65982aSmrg# Added in version 1.9.0:
21788f65982aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21798f65982aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21808f65982aSmrg#		   psselect from the psutils package.
21818f65982aSmrg#		   the ghostcript package. Refer to the grohtml man pages
21828f65982aSmrg#
21838f65982aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21848f65982aSmrg#
21858f65982aSmrg# OS and distros often splits groff in a basic and full package, the former
21868f65982aSmrg# having the groff program and the later having devices, fonts and macros
21878f65982aSmrg# Checking for the groff executable is not enough.
21888f65982aSmrg#
21898f65982aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21908f65982aSmrg# unset HAVE_GROFF or GROFF env variables.
21918f65982aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21928f65982aSmrg#
21938f65982aSmrgAC_DEFUN([XORG_WITH_GROFF],[
21948f65982aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21958f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
21968f65982aSmrgAC_ARG_WITH(groff,
21978f65982aSmrg	AS_HELP_STRING([--with-groff],
21988f65982aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21998f65982aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22008f65982aSmrgm4_undefine([_defopt])
22018f65982aSmrg
22028f65982aSmrgif test "x$use_groff" = x"auto"; then
22038f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
22048f65982aSmrg   if test "x$GROFF" = "x"; then
22058f65982aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22068f65982aSmrg	have_groff=no
22078f65982aSmrg   else
22088f65982aSmrg        have_groff=yes
22098f65982aSmrg   fi
22108f65982aSmrgelif test "x$use_groff" = x"yes" ; then
22118f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
22128f65982aSmrg   if test "x$GROFF" = "x"; then
22138f65982aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22148f65982aSmrg   fi
22158f65982aSmrg   have_groff=yes
22168f65982aSmrgelif test "x$use_groff" = x"no" ; then
22178f65982aSmrg   if test "x$GROFF" != "x"; then
22188f65982aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22198f65982aSmrg   fi
22208f65982aSmrg   have_groff=no
22218f65982aSmrgelse
22228f65982aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22238f65982aSmrgfi
22248f65982aSmrg
22258f65982aSmrg# We have groff, test for the presence of the macro packages
22268f65982aSmrgif test "x$have_groff" = x"yes"; then
22278f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22288f65982aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22298f65982aSmrg        groff_ms_works=yes
22308f65982aSmrg    else
22318f65982aSmrg        groff_ms_works=no
22328f65982aSmrg    fi
22338f65982aSmrg    AC_MSG_RESULT([$groff_ms_works])
22348f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22358f65982aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22368f65982aSmrg        groff_mm_works=yes
22378f65982aSmrg    else
22388f65982aSmrg        groff_mm_works=no
22398f65982aSmrg    fi
22408f65982aSmrg    AC_MSG_RESULT([$groff_mm_works])
22418f65982aSmrgfi
22428f65982aSmrg
22438f65982aSmrg# We have groff, test for HTML dependencies, one command per package
22448f65982aSmrgif test "x$have_groff" = x"yes"; then
22458f65982aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22468f65982aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22478f65982aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22488f65982aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22498f65982aSmrg      have_groff_html=yes
22508f65982aSmrg   else
22518f65982aSmrg      have_groff_html=no
22528f65982aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22538f65982aSmrg   fi
22548f65982aSmrgfi
22558f65982aSmrg
22568f65982aSmrg# Set Automake conditionals for Makefiles
22578f65982aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22588f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22598f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22608f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22618f65982aSmrg]) # XORG_WITH_GROFF
22628f65982aSmrg
226380b026c6Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226480b026c6Smrg# ---------------------------------------
22658f65982aSmrg# Minimum version: 1.6.0
22668f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
226780b026c6Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22688f65982aSmrg#
22698f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
22708f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
22718f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22728f65982aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
22738f65982aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22748f65982aSmrg# --with-fop assumes 'auto'.
22758f65982aSmrg#
22768f65982aSmrg# Interface to module:
22778f65982aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22788f65982aSmrg# FOP:	 	returns the path of the fop program found
22798f65982aSmrg#		returns the path set by the user in the environment
22808f65982aSmrg# --with-fop: 	'yes' user instructs the module to use fop
22818f65982aSmrg#		'no' user instructs the module not to use fop
22828f65982aSmrg#
22838f65982aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22848f65982aSmrg#
22858f65982aSmrgAC_DEFUN([XORG_WITH_FOP],[
22868f65982aSmrgAC_ARG_VAR([FOP], [Path to fop command])
228780b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
22888f65982aSmrgAC_ARG_WITH(fop,
22898f65982aSmrg	AS_HELP_STRING([--with-fop],
22908f65982aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22918f65982aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22928f65982aSmrgm4_undefine([_defopt])
22938f65982aSmrg
22948f65982aSmrgif test "x$use_fop" = x"auto"; then
22958f65982aSmrg   AC_PATH_PROG([FOP], [fop])
22968f65982aSmrg   if test "x$FOP" = "x"; then
22978f65982aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22988f65982aSmrg	have_fop=no
22998f65982aSmrg   else
23008f65982aSmrg        have_fop=yes
23018f65982aSmrg   fi
23028f65982aSmrgelif test "x$use_fop" = x"yes" ; then
23038f65982aSmrg   AC_PATH_PROG([FOP], [fop])
23048f65982aSmrg   if test "x$FOP" = "x"; then
23058f65982aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23068f65982aSmrg   fi
23078f65982aSmrg   have_fop=yes
23088f65982aSmrgelif test "x$use_fop" = x"no" ; then
23098f65982aSmrg   if test "x$FOP" != "x"; then
23108f65982aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23118f65982aSmrg   fi
23128f65982aSmrg   have_fop=no
23138f65982aSmrgelse
23148f65982aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23158f65982aSmrgfi
231680b026c6Smrg
231780b026c6Smrg# Test for a minimum version of fop, if provided.
231880b026c6Smrgm4_ifval([$1],
231980b026c6Smrg[if test "$have_fop" = yes; then
232080b026c6Smrg    # scrape the fop version
232180b026c6Smrg    AC_MSG_CHECKING([for fop minimum version])
232280b026c6Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232380b026c6Smrg    AC_MSG_RESULT([$fop_version])
232480b026c6Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232580b026c6Smrg        [if test "x$use_fop" = xauto; then
232680b026c6Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232780b026c6Smrg            have_fop=no
232880b026c6Smrg        else
232980b026c6Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233080b026c6Smrg        fi])
233180b026c6Smrgfi])
23328f65982aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23338f65982aSmrg]) # XORG_WITH_FOP
23348f65982aSmrg
23350c7e83b2Smrg# XORG_WITH_M4([MIN-VERSION])
23360c7e83b2Smrg# ---------------------------
23370c7e83b2Smrg# Minimum version: 1.19.0
23380c7e83b2Smrg#
23390c7e83b2Smrg# This macro attempts to locate an m4 macro processor which supports
23400c7e83b2Smrg# -I option and is only useful for modules relying on M4 in order to
23410c7e83b2Smrg# expand macros in source code files.
23420c7e83b2Smrg#
23430c7e83b2Smrg# Interface to module:
23440c7e83b2Smrg# M4:	 	returns the path of the m4 program found
23450c7e83b2Smrg#		returns the path set by the user in the environment
23460c7e83b2Smrg#
23470c7e83b2SmrgAC_DEFUN([XORG_WITH_M4], [
23480c7e83b2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23490c7e83b2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23500c7e83b2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23510c7e83b2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23520c7e83b2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23530c7e83b2Smrg   [$PATH:/usr/gnu/bin])])
23540c7e83b2Smrg
23550c7e83b2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23560c7e83b2Smrg]) # XORG_WITH_M4
23570c7e83b2Smrg
23588f65982aSmrg# XORG_WITH_PS2PDF([DEFAULT])
23598f65982aSmrg# ----------------
23608f65982aSmrg# Minimum version: 1.6.0
23618f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23628f65982aSmrg#
23638f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
23648f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
23658f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23668f65982aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23678f65982aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23688f65982aSmrg# --with-ps2pdf assumes 'auto'.
23698f65982aSmrg#
23708f65982aSmrg# Interface to module:
23718f65982aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23728f65982aSmrg# PS2PDF:	returns the path of the ps2pdf program found
23738f65982aSmrg#		returns the path set by the user in the environment
23748f65982aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23758f65982aSmrg#		 'no' user instructs the module not to use ps2pdf
23768f65982aSmrg#
23778f65982aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23788f65982aSmrg#
23798f65982aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23808f65982aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23818f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
23828f65982aSmrgAC_ARG_WITH(ps2pdf,
23838f65982aSmrg	AS_HELP_STRING([--with-ps2pdf],
23848f65982aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23858f65982aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23868f65982aSmrgm4_undefine([_defopt])
23878f65982aSmrg
23888f65982aSmrgif test "x$use_ps2pdf" = x"auto"; then
23898f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23908f65982aSmrg   if test "x$PS2PDF" = "x"; then
23918f65982aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23928f65982aSmrg	have_ps2pdf=no
23938f65982aSmrg   else
23948f65982aSmrg        have_ps2pdf=yes
23958f65982aSmrg   fi
23968f65982aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23978f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23988f65982aSmrg   if test "x$PS2PDF" = "x"; then
23998f65982aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24008f65982aSmrg   fi
24018f65982aSmrg   have_ps2pdf=yes
24028f65982aSmrgelif test "x$use_ps2pdf" = x"no" ; then
24038f65982aSmrg   if test "x$PS2PDF" != "x"; then
24048f65982aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24058f65982aSmrg   fi
24068f65982aSmrg   have_ps2pdf=no
24078f65982aSmrgelse
24088f65982aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24098f65982aSmrgfi
24108f65982aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24118f65982aSmrg]) # XORG_WITH_PS2PDF
24128f65982aSmrg
24138f65982aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24148f65982aSmrg# ----------------
24158f65982aSmrg# Minimum version: 1.6.0
24168f65982aSmrg#
24178f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
24188f65982aSmrg# not at the appropriate level. This macro enables a builder to skip all
24198f65982aSmrg# documentation targets except traditional man pages.
24208f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24218f65982aSmrg# maximum flexibilty in controlling documentation building.
24228f65982aSmrg# Refer to:
24238f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
24248f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24258f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24268f65982aSmrg# XORG_WITH_FOP           --with-fop
24278f65982aSmrg# XORG_WITH_GROFF         --with-groff
24288f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24298f65982aSmrg#
24308f65982aSmrg# Interface to module:
24318f65982aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24328f65982aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24338f65982aSmrg#		 'no' user instructs the module not to generate docs
24348f65982aSmrg# parm1:	specify the default value, yes or no.
24358f65982aSmrg#
24368f65982aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243780b026c6Smrgm4_define([docs_default], m4_default([$1], [yes]))
24388f65982aSmrgAC_ARG_ENABLE(docs,
24398f65982aSmrg	AS_HELP_STRING([--enable-docs],
244080b026c6Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244180b026c6Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244280b026c6Smrgm4_undefine([docs_default])
24438f65982aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24448f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
24458f65982aSmrgAC_MSG_RESULT([$build_docs])
24468f65982aSmrg]) # XORG_ENABLE_DOCS
24478f65982aSmrg
24488f65982aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24498f65982aSmrg# ----------------
24508f65982aSmrg# Minimum version: 1.6.0
24518f65982aSmrg#
24528f65982aSmrg# This macro enables a builder to skip all developer documentation.
24538f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24548f65982aSmrg# maximum flexibilty in controlling documentation building.
24558f65982aSmrg# Refer to:
24568f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
24578f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24588f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24598f65982aSmrg# XORG_WITH_FOP           --with-fop
24608f65982aSmrg# XORG_WITH_GROFF         --with-groff
24618f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24628f65982aSmrg#
24638f65982aSmrg# Interface to module:
24648f65982aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24658f65982aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24668f65982aSmrg#			'no' user instructs the module not to generate developer docs
24678f65982aSmrg# parm1:		specify the default value, yes or no.
24688f65982aSmrg#
24698f65982aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24708f65982aSmrgm4_define([devel_default], m4_default([$1], [yes]))
24718f65982aSmrgAC_ARG_ENABLE(devel-docs,
24728f65982aSmrg	AS_HELP_STRING([--enable-devel-docs],
24738f65982aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24748f65982aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24758f65982aSmrgm4_undefine([devel_default])
24768f65982aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24778f65982aSmrgAC_MSG_CHECKING([whether to build developer documentation])
24788f65982aSmrgAC_MSG_RESULT([$build_devel_docs])
24798f65982aSmrg]) # XORG_ENABLE_DEVEL_DOCS
24808f65982aSmrg
24818f65982aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24828f65982aSmrg# ----------------
24838f65982aSmrg# Minimum version: 1.6.0
24848f65982aSmrg#
24858f65982aSmrg# This macro enables a builder to skip all functional specification targets.
24868f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24878f65982aSmrg# maximum flexibilty in controlling documentation building.
24888f65982aSmrg# Refer to:
24898f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
24908f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24918f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24928f65982aSmrg# XORG_WITH_FOP           --with-fop
24938f65982aSmrg# XORG_WITH_GROFF         --with-groff
24948f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24958f65982aSmrg#
24968f65982aSmrg# Interface to module:
24978f65982aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24988f65982aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24998f65982aSmrg#			'no' user instructs the module not to generate specs
25008f65982aSmrg# parm1:		specify the default value, yes or no.
25018f65982aSmrg#
25028f65982aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25038f65982aSmrgm4_define([spec_default], m4_default([$1], [yes]))
25048f65982aSmrgAC_ARG_ENABLE(specs,
25058f65982aSmrg	AS_HELP_STRING([--enable-specs],
25068f65982aSmrg	   [Enable building the specs (default: ]spec_default[)]),
25078f65982aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25088f65982aSmrgm4_undefine([spec_default])
25098f65982aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25108f65982aSmrgAC_MSG_CHECKING([whether to build functional specifications])
25118f65982aSmrgAC_MSG_RESULT([$build_specs])
25128f65982aSmrg]) # XORG_ENABLE_SPECS
25138f65982aSmrg
251480b026c6Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251580b026c6Smrg# ----------------------------------------------
251680b026c6Smrg# Minimum version: 1.13.0
251780b026c6Smrg#
251880b026c6Smrg# This macro enables a builder to enable/disable unit testing
251980b026c6Smrg# It makes no assumption about the test cases implementation
252080b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
252180b026c6Smrg# They may or may not use the software utility library GLib
252280b026c6Smrg#
252380b026c6Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252480b026c6Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252580b026c6Smrg# The variable enable_unit_tests is used by other macros in this file.
252680b026c6Smrg#
252780b026c6Smrg# Interface to module:
252880b026c6Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252980b026c6Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253080b026c6Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253180b026c6Smrg#			'no' user instructs the module not to build tests
253280b026c6Smrg# parm1:		specify the default value, yes or no.
253380b026c6Smrg#
253480b026c6SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253580b026c6SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253680b026c6SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253780b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253880b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
253980b026c6SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254080b026c6Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254180b026c6Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254280b026c6Smrgm4_undefine([_defopt])
254380b026c6SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254480b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
254580b026c6SmrgAC_MSG_RESULT([$enable_unit_tests])
254680b026c6Smrg]) # XORG_ENABLE_UNIT_TESTS
254780b026c6Smrg
254880b026c6Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254980b026c6Smrg# ------------------------------------------------------
255080b026c6Smrg# Minimum version: 1.17.0
255180b026c6Smrg#
255280b026c6Smrg# This macro enables a builder to enable/disable integration testing
255380b026c6Smrg# It makes no assumption about the test cases' implementation
255480b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
255580b026c6Smrg#
255680b026c6Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255780b026c6Smrg# usually requires less dependencies and may be built and run under less
255880b026c6Smrg# stringent environments than integration tests.
255980b026c6Smrg#
256080b026c6Smrg# Interface to module:
256180b026c6Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256280b026c6Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256380b026c6Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256480b026c6Smrg#                             'no' user instructs the module not to build tests
256580b026c6Smrg# parm1:                      specify the default value, yes or no.
256680b026c6Smrg#
256780b026c6SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256880b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256980b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
257080b026c6SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257180b026c6Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257280b026c6Smrg	[enable_integration_tests=$enableval],
257380b026c6Smrg	[enable_integration_tests=]_defopt)
257480b026c6Smrgm4_undefine([_defopt])
257580b026c6SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257680b026c6Smrg	[test "x$enable_integration_tests" != xno])
257780b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
257880b026c6SmrgAC_MSG_RESULT([$enable_integration_tests])
257980b026c6Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258080b026c6Smrg
258180b026c6Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258280b026c6Smrg# ----------------------------------------
258380b026c6Smrg# Minimum version: 1.13.0
258480b026c6Smrg#
258580b026c6Smrg# GLib is a library which provides advanced data structures and functions.
258680b026c6Smrg# This macro enables a module to test for the presence of Glib.
258780b026c6Smrg#
258880b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258980b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
259080b026c6Smrg#
259180b026c6Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259280b026c6Smrg# test support usually requires less dependencies and may be built and run under
259380b026c6Smrg# less stringent environments than integration tests.
259480b026c6Smrg#
259580b026c6Smrg# Interface to module:
259680b026c6Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259780b026c6Smrg# with_glib: used in configure.ac to know if GLib has been found
259880b026c6Smrg# --with-glib:	'yes' user instructs the module to use glib
259980b026c6Smrg#		'no' user instructs the module not to use glib
260080b026c6Smrg#
260180b026c6SmrgAC_DEFUN([XORG_WITH_GLIB],[
260280b026c6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260380b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
260480b026c6SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260580b026c6Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260680b026c6Smrg	[with_glib=$withval], [with_glib=]_defopt)
260780b026c6Smrgm4_undefine([_defopt])
260880b026c6Smrg
260980b026c6Smrghave_glib=no
261080b026c6Smrg# Do not probe GLib if user explicitly disabled unit testing
261180b026c6Smrgif test "x$enable_unit_tests" != x"no"; then
261280b026c6Smrg  # Do not probe GLib if user explicitly disabled it
261380b026c6Smrg  if test "x$with_glib" != x"no"; then
261480b026c6Smrg    m4_ifval(
261580b026c6Smrg      [$1],
261680b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261780b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261880b026c6Smrg    )
261980b026c6Smrg  fi
262080b026c6Smrgfi
262180b026c6Smrg
262280b026c6Smrg# Not having GLib when unit testing has been explicitly requested is an error
262380b026c6Smrgif test "x$enable_unit_tests" = x"yes"; then
262480b026c6Smrg  if test "x$have_glib" = x"no"; then
262580b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262680b026c6Smrg  fi
262780b026c6Smrgfi
262880b026c6Smrg
262980b026c6Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263080b026c6Smrgif test "x$enable_unit_tests" = x"no"; then
263180b026c6Smrg  if test "x$with_glib" = x"yes"; then
263280b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263380b026c6Smrg  fi
263480b026c6Smrgfi
263580b026c6Smrg
263680b026c6Smrg# Not having GLib when it has been explicitly requested is an error
263780b026c6Smrgif test "x$with_glib" = x"yes"; then
263880b026c6Smrg  if test "x$have_glib" = x"no"; then
263980b026c6Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264080b026c6Smrg  fi
264180b026c6Smrgfi
264280b026c6Smrg
264380b026c6SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264480b026c6Smrg]) # XORG_WITH_GLIB
264580b026c6Smrg
264680b026c6Smrg# XORG_LD_WRAP([required|optional])
264780b026c6Smrg# ---------------------------------
264880b026c6Smrg# Minimum version: 1.13.0
264980b026c6Smrg#
265080b026c6Smrg# Check if linker supports -wrap, passed via compiler flags
265180b026c6Smrg#
265280b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265380b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
265480b026c6Smrg#
265580b026c6Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265680b026c6Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265780b026c6Smrg# available, an argument of "optional" allows use when some unit tests require
265880b026c6Smrg# ld -wrap and others do not.
265980b026c6Smrg#
266080b026c6SmrgAC_DEFUN([XORG_LD_WRAP],[
266180b026c6SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266280b026c6Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266380b026c6Smrg                      void __wrap_exit(int status) { return; }],
266480b026c6Smrg                     [exit(0);])])
266580b026c6Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266680b026c6Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266780b026c6Smrg  if test "x$have_ld_wrap" = x"no"; then
266880b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266980b026c6Smrg  fi
267080b026c6Smrgfi
267180b026c6SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267280b026c6Smrg#
267380b026c6Smrg]) # XORG_LD_WRAP
267480b026c6Smrg
267580b026c6Smrg# XORG_CHECK_LINKER_FLAGS
267680b026c6Smrg# -----------------------
267780b026c6Smrg# SYNOPSIS
267880b026c6Smrg#
267980b026c6Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268080b026c6Smrg#
268180b026c6Smrg# DESCRIPTION
268280b026c6Smrg#
268380b026c6Smrg#   Check whether the given linker FLAGS work with the current language's
268480b026c6Smrg#   linker, or whether they give an error.
268580b026c6Smrg#
268680b026c6Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268780b026c6Smrg#   success/failure.
268880b026c6Smrg#
268980b026c6Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269080b026c6Smrg#
269180b026c6Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269280b026c6Smrg#
269380b026c6Smrg# LICENSE
269480b026c6Smrg#
269580b026c6Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269680b026c6Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269780b026c6Smrg#   Copyright (c) 2009 Matteo Frigo
269880b026c6Smrg#
269980b026c6Smrg#   This program is free software: you can redistribute it and/or modify it
270080b026c6Smrg#   under the terms of the GNU General Public License as published by the
270180b026c6Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270280b026c6Smrg#   option) any later version.
270380b026c6Smrg#
270480b026c6Smrg#   This program is distributed in the hope that it will be useful, but
270580b026c6Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270680b026c6Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270780b026c6Smrg#   Public License for more details.
270880b026c6Smrg#
270980b026c6Smrg#   You should have received a copy of the GNU General Public License along
271080b026c6Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271180b026c6Smrg#
271280b026c6Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271380b026c6Smrg#   gives unlimited permission to copy, distribute and modify the configure
271480b026c6Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271580b026c6Smrg#   need not follow the terms of the GNU General Public License when using
271680b026c6Smrg#   or distributing such scripts, even though portions of the text of the
271780b026c6Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271880b026c6Smrg#   all other use of the material that constitutes the Autoconf Macro.
271980b026c6Smrg#
272080b026c6Smrg#   This special exception to the GPL applies to versions of the Autoconf
272180b026c6Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272280b026c6Smrg#   modified version of the Autoconf Macro, you may extend this special
272380b026c6Smrg#   exception to the GPL to apply to your modified version as well.#
272480b026c6SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272580b026c6Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272680b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272780b026c6SmrgAS_LITERAL_IF([$1],
272880b026c6Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272980b026c6Smrg      ax_save_FLAGS=$LDFLAGS
273080b026c6Smrg      LDFLAGS="$1"
273180b026c6Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273280b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273380b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273480b026c6Smrg      LDFLAGS=$ax_save_FLAGS])],
273580b026c6Smrg  [ax_save_FLAGS=$LDFLAGS
273680b026c6Smrg   LDFLAGS="$1"
273780b026c6Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273880b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273980b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274080b026c6Smrg   LDFLAGS=$ax_save_FLAGS])
274180b026c6Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274280b026c6SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274380b026c6Smrgif test "x$xorg_check_linker_flags" = xyes; then
274480b026c6Smrg	m4_default([$2], :)
274580b026c6Smrgelse
274680b026c6Smrg	m4_default([$3], :)
274780b026c6Smrgfi
274880b026c6Smrg]) # XORG_CHECK_LINKER_FLAGS
274980b026c6Smrg
275080b026c6Smrg# XORG_MEMORY_CHECK_FLAGS
275180b026c6Smrg# -----------------------
275280b026c6Smrg# Minimum version: 1.16.0
275380b026c6Smrg#
275480b026c6Smrg# This macro attempts to find appropriate memory checking functionality
275580b026c6Smrg# for various platforms which unit testing code may use to catch various
275680b026c6Smrg# forms of memory allocation and access errors in testing.
275780b026c6Smrg#
275880b026c6Smrg# Interface to module:
275980b026c6Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276080b026c6Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276180b026c6Smrg#
276280b026c6Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276380b026c6Smrg#
276480b026c6SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276580b026c6Smrg
276680b026c6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276780b026c6SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276880b026c6Smrg           [Environment variables to enable memory checking in tests])
276980b026c6Smrg
277080b026c6Smrg# Check for different types of support on different platforms
277180b026c6Smrgcase $host_os in
277280b026c6Smrg    solaris*)
277380b026c6Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277480b026c6Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277580b026c6Smrg        ;;
277680b026c6Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277780b026c6Smrg        # both directly and inverted, so should not be 0 or 255.
277880b026c6Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277980b026c6Smrg        ;;
278080b026c6Smrg    darwin*)
278180b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278280b026c6Smrg        ;;
278380b026c6Smrg    *bsd*)
278480b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278580b026c6Smrg        ;;
278680b026c6Smrgesac
278780b026c6Smrg
278880b026c6Smrg# User supplied flags override default flags
278980b026c6Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279080b026c6Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279180b026c6Smrgfi
279280b026c6Smrg
279380b026c6SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279480b026c6Smrg]) # XORG_WITH_LINT
279580b026c6Smrg
27969aa228fdSmrg# XORG_CHECK_MALLOC_ZERO
27979aa228fdSmrg# ----------------------
27989aa228fdSmrg# Minimum version: 1.0.0
27999aa228fdSmrg#
28009aa228fdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28019aa228fdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28029aa228fdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28039aa228fdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28049aa228fdSmrgAC_ARG_ENABLE(malloc0returnsnull,
28058f65982aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28069aa228fdSmrg		       [malloc(0) returns NULL (default: auto)]),
28079aa228fdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28089aa228fdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28099aa228fdSmrg
28109aa228fdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28119aa228fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28120c7e83b2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28130c7e83b2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281480b026c6Smrg#include <stdlib.h>
281580b026c6Smrg],[
28169aa228fdSmrg    char *m0, *r0, *c0, *p;
28179aa228fdSmrg    m0 = malloc(0);
28189aa228fdSmrg    p = malloc(10);
28199aa228fdSmrg    r0 = realloc(p,0);
282080b026c6Smrg    c0 = calloc(0,10);
282180b026c6Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282280b026c6Smrg])],
28230c7e83b2Smrg		[xorg_cv_malloc0_returns_null=yes],
28240c7e83b2Smrg		[xorg_cv_malloc0_returns_null=no])])
28250c7e83b2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28269aa228fdSmrgfi
28279aa228fdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28289aa228fdSmrg
28299aa228fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28309aa228fdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28319aa228fdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28329aa228fdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28339aa228fdSmrgelse
28349aa228fdSmrg	MALLOC_ZERO_CFLAGS=""
28359aa228fdSmrg	XMALLOC_ZERO_CFLAGS=""
28369aa228fdSmrg	XTMALLOC_ZERO_CFLAGS=""
28379aa228fdSmrgfi
28389aa228fdSmrg
28399aa228fdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28409aa228fdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28419aa228fdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28429aa228fdSmrg]) # XORG_CHECK_MALLOC_ZERO
28439aa228fdSmrg
28449aa228fdSmrg# XORG_WITH_LINT()
28459aa228fdSmrg# ----------------
28469aa228fdSmrg# Minimum version: 1.1.0
28479aa228fdSmrg#
28488f65982aSmrg# This macro enables the use of a tool that flags some suspicious and
28498f65982aSmrg# non-portable constructs (likely to be bugs) in C language source code.
28508f65982aSmrg# It will attempt to locate the tool and use appropriate options.
28518f65982aSmrg# There are various lint type tools on different platforms.
28528f65982aSmrg#
28538f65982aSmrg# Interface to module:
28548f65982aSmrg# LINT:		returns the path to the tool found on the platform
28558f65982aSmrg#		or the value set to LINT on the configure cmd line
28568f65982aSmrg#		also an Automake conditional
28578f65982aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28588f65982aSmrg#
28598f65982aSmrg# --with-lint:	'yes' user instructs the module to use lint
28608f65982aSmrg#		'no' user instructs the module not to use lint (default)
28618f65982aSmrg#
28628f65982aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28638f65982aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28649aa228fdSmrg#
28659aa228fdSmrgAC_DEFUN([XORG_WITH_LINT],[
28669aa228fdSmrg
28678f65982aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28688f65982aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28698f65982aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28709aa228fdSmrg		[Use a lint-style source code checker (default: disabled)])],
28719aa228fdSmrg		[use_lint=$withval], [use_lint=no])
28728f65982aSmrg
28738f65982aSmrg# Obtain platform specific info like program name and options
28748f65982aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28758f65982aSmrgcase $host_os in
28768f65982aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28778f65982aSmrg	lint_name=splint
28788f65982aSmrg	lint_options="-badflag"
28798f65982aSmrg	;;
28808f65982aSmrg  *freebsd* | *netbsd*)
28818f65982aSmrg	lint_name=lint
28828f65982aSmrg	lint_options="-u -b"
28838f65982aSmrg	;;
28848f65982aSmrg  *solaris*)
28858f65982aSmrg	lint_name=lint
28868f65982aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28878f65982aSmrg	;;
28888f65982aSmrgesac
28898f65982aSmrg
28908f65982aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28918f65982aSmrgif test "x$use_lint" = x"yes" ; then
28928f65982aSmrg   AC_PATH_PROG([LINT], [$lint_name])
28938f65982aSmrg   if test "x$LINT" = "x"; then
28948f65982aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28958f65982aSmrg   fi
28968f65982aSmrgelif test "x$use_lint" = x"no" ; then
28978f65982aSmrg   if test "x$LINT" != "x"; then
28988f65982aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28998f65982aSmrg   fi
29009aa228fdSmrgelse
29018f65982aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29029aa228fdSmrgfi
29038f65982aSmrg
29048f65982aSmrg# User supplied flags override default flags
29058f65982aSmrgif test "x$LINT_FLAGS" != "x"; then
29068f65982aSmrg   lint_options=$LINT_FLAGS
29079aa228fdSmrgfi
29089aa228fdSmrg
29098f65982aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29108f65982aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29119aa228fdSmrg
29129aa228fdSmrg]) # XORG_WITH_LINT
29139aa228fdSmrg
29149aa228fdSmrg# XORG_LINT_LIBRARY(LIBNAME)
29159aa228fdSmrg# --------------------------
29169aa228fdSmrg# Minimum version: 1.1.0
29179aa228fdSmrg#
29189aa228fdSmrg# Sets up flags for building lint libraries for checking programs that call
29199aa228fdSmrg# functions in the library.
29209aa228fdSmrg#
29218f65982aSmrg# Interface to module:
29228f65982aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29238f65982aSmrg# MAKE_LINT_LIB		- Automake conditional
29248f65982aSmrg#
29258f65982aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29268f65982aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
29279aa228fdSmrg
29289aa228fdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29299aa228fdSmrgAC_REQUIRE([XORG_WITH_LINT])
29308f65982aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29319aa228fdSmrg	[Create lint library (default: disabled)])],
29329aa228fdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29338f65982aSmrg
29348f65982aSmrgif test "x$make_lint_lib" = x"yes" ; then
29358f65982aSmrg   LINTLIB=llib-l$1.ln
29368f65982aSmrg   if test "x$LINT" = "x"; then
29378f65982aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29388f65982aSmrg   fi
29398f65982aSmrgelif test "x$make_lint_lib" != x"no" ; then
29408f65982aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29419aa228fdSmrgfi
29428f65982aSmrg
29439aa228fdSmrgAC_SUBST(LINTLIB)
29449aa228fdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29459aa228fdSmrg
29469aa228fdSmrg]) # XORG_LINT_LIBRARY
29479aa228fdSmrg
294880b026c6Smrg# XORG_COMPILER_BRAND
294980b026c6Smrg# -------------------
295080b026c6Smrg# Minimum version: 1.14.0
295180b026c6Smrg#
295280b026c6Smrg# Checks for various brands of compilers and sets flags as appropriate:
295380b026c6Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295480b026c6Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295580b026c6Smrg#   clang compiler - sets CLANGCC to "yes"
295680b026c6Smrg#   Intel compiler - sets INTELCC to "yes"
295780b026c6Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295880b026c6Smrg#
295980b026c6SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296080b026c6SmrgAC_LANG_CASE(
296180b026c6Smrg	[C], [
296280b026c6Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296380b026c6Smrg	],
296480b026c6Smrg	[C++], [
296580b026c6Smrg		AC_REQUIRE([AC_PROG_CXX])
296680b026c6Smrg	]
296780b026c6Smrg)
296880b026c6SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296980b026c6SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297080b026c6SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297180b026c6Smrg]) # XORG_COMPILER_BRAND
297280b026c6Smrg
297380b026c6Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297480b026c6Smrg# ---------------
297580b026c6Smrg# Minimum version: 1.16.0
297680b026c6Smrg#
297780b026c6Smrg# Test if the compiler works when passed the given flag as a command line argument.
297880b026c6Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297980b026c6Smrg# next flag in the list until there are no more options.
298080b026c6Smrg#
298180b026c6Smrg# Note that this does not guarantee that the compiler supports the flag as some
298280b026c6Smrg# compilers will simply ignore arguments that they do not understand, but we do
298380b026c6Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298480b026c6Smrg# -Werror=unused-command-line-argument
298580b026c6Smrg#
298680b026c6SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298780b026c6Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298880b026c6Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298980b026c6Smrg
299080b026c6SmrgAC_LANG_COMPILER_REQUIRE
299180b026c6Smrg
299280b026c6SmrgAC_LANG_CASE(
299380b026c6Smrg	[C], [
299480b026c6Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299580b026c6Smrg		define([PREFIX], [C])
299680b026c6Smrg		define([CACHE_PREFIX], [cc])
299780b026c6Smrg		define([COMPILER], [$CC])
299880b026c6Smrg	],
299980b026c6Smrg	[C++], [
300080b026c6Smrg		define([PREFIX], [CXX])
300180b026c6Smrg		define([CACHE_PREFIX], [cxx])
300280b026c6Smrg		define([COMPILER], [$CXX])
300380b026c6Smrg	]
300480b026c6Smrg)
300580b026c6Smrg
300680b026c6Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300780b026c6Smrg
300880b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300980b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301080b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301180b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301280b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301380b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301480b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301580b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301680b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301780b026c6Smrgfi
301880b026c6Smrg
301980b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302080b026c6Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302180b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302280b026c6Smrg	fi
302380b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302480b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302580b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302680b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302780b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302880b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302980b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303080b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303180b026c6Smrgfi
303280b026c6Smrg
303380b026c6Smrgfound="no"
303480b026c6Smrgm4_foreach([flag], m4_cdr($@), [
303580b026c6Smrg	if test $found = "no" ; then
30360c7e83b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303780b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303880b026c6Smrg		fi
303980b026c6Smrg
30400c7e83b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304180b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304280b026c6Smrg		fi
304380b026c6Smrg
304480b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304580b026c6Smrg
304680b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304780b026c6Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304880b026c6Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304980b026c6Smrg		AC_CACHE_VAL($cacheid,
305080b026c6Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305180b026c6Smrg					     [eval $cacheid=yes],
305280b026c6Smrg					     [eval $cacheid=no])])
305380b026c6Smrg
305480b026c6Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305580b026c6Smrg
305680b026c6Smrg		eval supported=\$$cacheid
305780b026c6Smrg		AC_MSG_RESULT([$supported])
305880b026c6Smrg		if test "$supported" = "yes" ; then
305980b026c6Smrg			$1="$$1 ]flag["
306080b026c6Smrg			found="yes"
306180b026c6Smrg		fi
306280b026c6Smrg	fi
306380b026c6Smrg])
306480b026c6Smrg]) # XORG_TESTSET_CFLAG
306580b026c6Smrg
306680b026c6Smrg# XORG_COMPILER_FLAGS
306780b026c6Smrg# ---------------
306880b026c6Smrg# Minimum version: 1.16.0
306980b026c6Smrg#
307080b026c6Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307180b026c6Smrg# arguments supported by the selected compiler which do NOT alter the generated
307280b026c6Smrg# code.  These arguments will cause the compiler to print various warnings
307380b026c6Smrg# during compilation AND turn a conservative set of warnings into errors.
307480b026c6Smrg#
307580b026c6Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307680b026c6Smrg# future versions of util-macros as options are added to new compilers.
307780b026c6Smrg#
307880b026c6SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307980b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308080b026c6Smrg
308180b026c6SmrgAC_ARG_ENABLE(selective-werror,
308280b026c6Smrg              AS_HELP_STRING([--disable-selective-werror],
308380b026c6Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308480b026c6Smrg              [SELECTIVE_WERROR=$enableval],
308580b026c6Smrg              [SELECTIVE_WERROR=yes])
308680b026c6Smrg
308780b026c6SmrgAC_LANG_CASE(
308880b026c6Smrg        [C], [
308980b026c6Smrg                define([PREFIX], [C])
309080b026c6Smrg        ],
309180b026c6Smrg        [C++], [
309280b026c6Smrg                define([PREFIX], [CXX])
309380b026c6Smrg        ]
309480b026c6Smrg)
309580b026c6Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309680b026c6Smrgif test "x$SUNCC" = "xyes"; then
309780b026c6Smrg    [BASE_]PREFIX[FLAGS]="-v"
309880b026c6Smrgelse
309980b026c6Smrg    [BASE_]PREFIX[FLAGS]=""
310080b026c6Smrgfi
310180b026c6Smrg
310280b026c6Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
310780b026c6Smrg
310880b026c6SmrgAC_LANG_CASE(
310980b026c6Smrg	[C], [
311080b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311180b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311280b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311380b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31140c7e83b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311580b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311680b026c6Smrg	]
311780b026c6Smrg)
311880b026c6Smrg
311980b026c6Smrg# This chunk adds additional warnings that could catch undesired effects.
312080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31260c7e83b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
312780b026c6Smrg
312880b026c6Smrg# These are currently disabled because they are noisy.  They will be enabled
312980b026c6Smrg# in the future once the codebase is sufficiently modernized to silence
313080b026c6Smrg# them.  For now, I don't want them to drown out the other warnings.
313180b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313280b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31330c7e83b2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
313480b026c6Smrg
313580b026c6Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313680b026c6Smrg# when there are problems that should be fixed.
313780b026c6Smrg
313880b026c6Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315280b026c6Smrgelse
315380b026c6SmrgAC_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])
315480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316780b026c6Smrgfi
316880b026c6Smrg
316980b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317080b026c6Smrg]) # XORG_COMPILER_FLAGS
317180b026c6Smrg
317283d7c197Smrg# XORG_CWARNFLAGS
317383d7c197Smrg# ---------------
317483d7c197Smrg# Minimum version: 1.2.0
317580b026c6Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
317683d7c197Smrg#
317783d7c197Smrg# Defines CWARNFLAGS to enable C compiler warnings.
317883d7c197Smrg#
317980b026c6Smrg# This function is deprecated because it defines -fno-strict-aliasing
318080b026c6Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318180b026c6Smrg# is needed, then it should be added explicitly in the module when
318280b026c6Smrg# it is updated to use BASE_CFLAGS.
318380b026c6Smrg#
318483d7c197SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318580b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318680b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318780b026c6SmrgAC_LANG_CASE(
318880b026c6Smrg	[C], [
318980b026c6Smrg		CWARNFLAGS="$BASE_CFLAGS"
319080b026c6Smrg		if  test "x$GCC" = xyes ; then
319180b026c6Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319280b026c6Smrg		fi
319380b026c6Smrg		AC_SUBST(CWARNFLAGS)
319480b026c6Smrg	]
319580b026c6Smrg)
319683d7c197Smrg]) # XORG_CWARNFLAGS
31978f65982aSmrg
31988f65982aSmrg# XORG_STRICT_OPTION
31998f65982aSmrg# -----------------------
32008f65982aSmrg# Minimum version: 1.3.0
32018f65982aSmrg#
320280b026c6Smrg# Add configure option to enable strict compilation flags, such as treating
320380b026c6Smrg# warnings as fatal errors.
320480b026c6Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320580b026c6Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320680b026c6Smrg#
320780b026c6Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320880b026c6Smrg# when strict compilation is unconditionally desired.
32098f65982aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32108f65982aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
321180b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32128f65982aSmrg
32138f65982aSmrgAC_ARG_ENABLE(strict-compilation,
32148f65982aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32158f65982aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32168f65982aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321780b026c6Smrg
321880b026c6SmrgAC_LANG_CASE(
321980b026c6Smrg        [C], [
322080b026c6Smrg                define([PREFIX], [C])
322180b026c6Smrg        ],
322280b026c6Smrg        [C++], [
322380b026c6Smrg                define([PREFIX], [CXX])
322480b026c6Smrg        ]
322580b026c6Smrg)
322680b026c6Smrg
322780b026c6Smrg[STRICT_]PREFIX[FLAGS]=""
322880b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322980b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323080b026c6Smrg
323180b026c6Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323280b026c6Smrg# activate it with -Werror, so we add it here explicitly.
323380b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323480b026c6Smrg
32358f65982aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
323680b026c6Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323780b026c6Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32388f65982aSmrgfi
323980b026c6SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324080b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324180b026c6SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32428f65982aSmrg]) # XORG_STRICT_OPTION
32438f65982aSmrg
32448f65982aSmrg# XORG_DEFAULT_OPTIONS
32458f65982aSmrg# --------------------
32468f65982aSmrg# Minimum version: 1.3.0
32478f65982aSmrg#
32488f65982aSmrg# Defines default options for X.Org modules.
32498f65982aSmrg#
32508f65982aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32518f65982aSmrgAC_REQUIRE([AC_PROG_INSTALL])
325280b026c6SmrgXORG_COMPILER_FLAGS
32538f65982aSmrgXORG_CWARNFLAGS
32548f65982aSmrgXORG_STRICT_OPTION
32558f65982aSmrgXORG_RELEASE_VERSION
32568f65982aSmrgXORG_CHANGELOG
32578f65982aSmrgXORG_INSTALL
32588f65982aSmrgXORG_MANPAGE_SECTIONS
32598f65982aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32608f65982aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32618f65982aSmrg]) # XORG_DEFAULT_OPTIONS
32628f65982aSmrg
32638f65982aSmrg# XORG_INSTALL()
32648f65982aSmrg# ----------------
32658f65982aSmrg# Minimum version: 1.4.0
32668f65982aSmrg#
32678f65982aSmrg# Defines the variable INSTALL_CMD as the command to copy
32688f65982aSmrg# INSTALL from $prefix/share/util-macros.
32698f65982aSmrg#
32708f65982aSmrgAC_DEFUN([XORG_INSTALL], [
32718f65982aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32728f65982aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32738f65982aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32748f65982aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3275e39ce84cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3276e39ce84cSmrgtouch \$(top_srcdir)/INSTALL; \
3277e39ce84cSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32788f65982aSmrgAC_SUBST([INSTALL_CMD])
32798f65982aSmrg]) # XORG_INSTALL
32809aa228fdSmrgdnl Copyright 2005 Red Hat, Inc
32819aa228fdSmrgdnl
32829aa228fdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32839aa228fdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32849aa228fdSmrgdnl the above copyright notice appear in all copies and that both that
32859aa228fdSmrgdnl copyright notice and this permission notice appear in supporting
32869aa228fdSmrgdnl documentation.
32879aa228fdSmrgdnl
32889aa228fdSmrgdnl The above copyright notice and this permission notice shall be included
32899aa228fdSmrgdnl in all copies or substantial portions of the Software.
32909aa228fdSmrgdnl
32919aa228fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32929aa228fdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32939aa228fdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32949aa228fdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32959aa228fdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32969aa228fdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32979aa228fdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
32989aa228fdSmrgdnl
32999aa228fdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33009aa228fdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33019aa228fdSmrgdnl other dealings in this Software without prior written authorization
33029aa228fdSmrgdnl from the copyright holders.
33039aa228fdSmrgdnl
33049aa228fdSmrg
33059aa228fdSmrg# XORG_RELEASE_VERSION
33069aa228fdSmrg# --------------------
33078f65982aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33080c7e83b2Smrg
33099aa228fdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33109aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33119aa228fdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33129aa228fdSmrg		[Major version of this package])
331383d7c197Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33149aa228fdSmrg	if test "x$PVM" = "x"; then
33159aa228fdSmrg		PVM="0"
33169aa228fdSmrg	fi
33179aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33189aa228fdSmrg		[$PVM],
33199aa228fdSmrg		[Minor version of this package])
332083d7c197Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33219aa228fdSmrg	if test "x$PVP" = "x"; then
33229aa228fdSmrg		PVP="0"
33239aa228fdSmrg	fi
33249aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33259aa228fdSmrg		[$PVP],
33269aa228fdSmrg		[Patch version of this package])
33279aa228fdSmrg])
33289aa228fdSmrg
332983d7c197Smrg# XORG_CHANGELOG()
333083d7c197Smrg# ----------------
333183d7c197Smrg# Minimum version: 1.2.0
333283d7c197Smrg#
333383d7c197Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333483d7c197Smrg# ChangeLog from git.
333583d7c197Smrg#
333683d7c197Smrg#
333783d7c197SmrgAC_DEFUN([XORG_CHANGELOG], [
3338e39ce84cSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33398f65982aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3340e39ce84cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3341e39ce84cSmrgtouch \$(top_srcdir)/ChangeLog; \
3342e39ce84cSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334383d7c197SmrgAC_SUBST([CHANGELOG_CMD])
334483d7c197Smrg]) # XORG_CHANGELOG
334583d7c197Smrg
3346