16d1874b2Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
26a45684fSmrg
36d1874b2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4e6232409Smrg
5e6232409Smrg# This file is free software; the Free Software Foundation
6e6232409Smrg# gives unlimited permission to copy and/or distribute it,
7e6232409Smrg# with or without modifications, as long as this notice is preserved.
8e6232409Smrg
9e6232409Smrg# This program is distributed in the hope that it will be useful,
10e6232409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e6232409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e6232409Smrg# PARTICULAR PURPOSE.
13e6232409Smrg
146a45684fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158fff3f40Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168fff3f40Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1761d7a284Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1861d7a284Smrg[m4_warning([this file was generated for autoconf 2.72.
198fff3f40SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208fff3f40SmrgIf you have problems, you may need to regenerate the build system entirely.
216a45684fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22e6232409Smrg
236d1874b2Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
246d1874b2Smrg#
256d1874b2Smrg# This file is free software; the Free Software Foundation
266d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
276d1874b2Smrg# with or without modifications, as long as this notice is preserved.
28c05e7a3eSmrg
296d1874b2Smrg# AM_AUTOMAKE_VERSION(VERSION)
306d1874b2Smrg# ----------------------------
316d1874b2Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
326d1874b2Smrg# generated from the m4 files accompanying Automake X.Y.
336d1874b2Smrg# (This private macro should not be called outside this file.)
346d1874b2SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356d1874b2Smrg[am__api_version='1.16'
366d1874b2Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
376d1874b2Smrgdnl require some minimum version.  Point them to the right macro.
386d1874b2Smrgm4_if([$1], [1.16.5], [],
396d1874b2Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
406d1874b2Smrg])
41c05e7a3eSmrg
426d1874b2Smrg# _AM_AUTOCONF_VERSION(VERSION)
436d1874b2Smrg# -----------------------------
446d1874b2Smrg# aclocal traces this macro to find the Autoconf version.
456d1874b2Smrg# This is a private macro too.  Using m4_define simplifies
466d1874b2Smrg# the logic in aclocal, which can simply ignore this definition.
476d1874b2Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48e6232409Smrg
496d1874b2Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
506d1874b2Smrg# -------------------------------
516d1874b2Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
526d1874b2Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
536d1874b2SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546d1874b2Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
556d1874b2Smrgm4_ifndef([AC_AUTOCONF_VERSION],
566d1874b2Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
576d1874b2Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58e6232409Smrg
596d1874b2Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
608fff3f40Smrg
616d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
626d1874b2Smrg#
636d1874b2Smrg# This file is free software; the Free Software Foundation
646d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
656d1874b2Smrg# with or without modifications, as long as this notice is preserved.
668fff3f40Smrg
676d1874b2Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
686d1874b2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
696d1874b2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
706d1874b2Smrg#
716d1874b2Smrg# Of course, Automake must honor this variable whenever it calls a
726d1874b2Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
736d1874b2Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
746d1874b2Smrg# depending on how configure is run.  This is pretty annoying, since
756d1874b2Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
766d1874b2Smrg# source directory, any form will work fine, but in subdirectories a
776d1874b2Smrg# relative path needs to be adjusted first.
786d1874b2Smrg#
796d1874b2Smrg# $ac_aux_dir/missing
806d1874b2Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
816d1874b2Smrg# $top_srcdir/$ac_aux_dir/missing
826d1874b2Smrg#    fails if $ac_aux_dir is absolute,
836d1874b2Smrg#    fails when called from a subdirectory in a VPATH build with
846d1874b2Smrg#          a relative $ac_aux_dir
856d1874b2Smrg#
866d1874b2Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
876d1874b2Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
886d1874b2Smrg# harmless because $srcdir is '.', but things will broke when you
896d1874b2Smrg# start a VPATH build or use an absolute $srcdir.
906d1874b2Smrg#
916d1874b2Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
926d1874b2Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
936d1874b2Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
946d1874b2Smrg# and then we would define $MISSING as
956d1874b2Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
966d1874b2Smrg# This will work as long as MISSING is not called from configure, because
976d1874b2Smrg# unfortunately $(top_srcdir) has no meaning in configure.
986d1874b2Smrg# However there are other variables, like CC, which are often used in
996d1874b2Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1006d1874b2Smrg#
1016d1874b2Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1026d1874b2Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1036d1874b2Smrg# configured tree to be moved without reconfiguration.
1048fff3f40Smrg
1056d1874b2SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1066d1874b2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1076d1874b2Smrg# Expand $ac_aux_dir to an absolute path.
1086d1874b2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1096d1874b2Smrg])
1108fff3f40Smrg
1116d1874b2Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112e6232409Smrg
1136d1874b2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1146d1874b2Smrg#
1156d1874b2Smrg# This file is free software; the Free Software Foundation
1166d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
1176d1874b2Smrg# with or without modifications, as long as this notice is preserved.
118e6232409Smrg
1196d1874b2Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1206d1874b2Smrg# -------------------------------------
1216d1874b2Smrg# Define a conditional.
1226d1874b2SmrgAC_DEFUN([AM_CONDITIONAL],
1236d1874b2Smrg[AC_PREREQ([2.52])dnl
1246d1874b2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1256d1874b2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1266d1874b2SmrgAC_SUBST([$1_TRUE])dnl
1276d1874b2SmrgAC_SUBST([$1_FALSE])dnl
1286d1874b2Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1296d1874b2Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1306d1874b2Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1316d1874b2Smrgif $2; then
1326d1874b2Smrg  $1_TRUE=
1336d1874b2Smrg  $1_FALSE='#'
1346d1874b2Smrgelse
1356d1874b2Smrg  $1_TRUE='#'
1366d1874b2Smrg  $1_FALSE=
1376d1874b2Smrgfi
1386d1874b2SmrgAC_CONFIG_COMMANDS_PRE(
1396d1874b2Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1406d1874b2Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1416d1874b2SmrgUsually this means the macro was only invoked conditionally.]])
1426d1874b2Smrgfi])])
143e6232409Smrg
1446d1874b2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1456d1874b2Smrg#
1466d1874b2Smrg# This file is free software; the Free Software Foundation
1476d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
1486d1874b2Smrg# with or without modifications, as long as this notice is preserved.
149e6232409Smrg
150e6232409Smrg
1516d1874b2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1526d1874b2Smrg# written in clear, in which case automake, when reading aclocal.m4,
1536d1874b2Smrg# will think it sees a *use*, and therefore will trigger all it's
1546d1874b2Smrg# C support machinery.  Also note that it means that autoscan, seeing
1556d1874b2Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156e6232409Smrg
157e6232409Smrg
1586d1874b2Smrg# _AM_DEPENDENCIES(NAME)
1596d1874b2Smrg# ----------------------
1606d1874b2Smrg# See how the compiler implements dependency checking.
1616d1874b2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1626d1874b2Smrg# We try a few techniques and use that to set a single cache variable.
1636d1874b2Smrg#
1646d1874b2Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1656d1874b2Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1666d1874b2Smrg# dependency, and given that the user is not expected to run this macro,
1676d1874b2Smrg# just rely on AC_PROG_CC.
1686d1874b2SmrgAC_DEFUN([_AM_DEPENDENCIES],
1696d1874b2Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1706d1874b2SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1716d1874b2SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1726d1874b2SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173e6232409Smrg
1746d1874b2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1756d1874b2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1766d1874b2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1776d1874b2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1786d1874b2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1796d1874b2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1806d1874b2Smrg                    [depcc="$$1"   am_compiler_list=])
181e6232409Smrg
1826d1874b2SmrgAC_CACHE_CHECK([dependency style of $depcc],
1836d1874b2Smrg               [am_cv_$1_dependencies_compiler_type],
1846d1874b2Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1856d1874b2Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1866d1874b2Smrg  # making bogus files that we don't know about and never remove.  For
1876d1874b2Smrg  # instance it was reported that on HP-UX the gcc test will end up
1886d1874b2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1896d1874b2Smrg  # in D".
1906d1874b2Smrg  rm -rf conftest.dir
1916d1874b2Smrg  mkdir conftest.dir
1926d1874b2Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1936d1874b2Smrg  # using a relative directory.
1946d1874b2Smrg  cp "$am_depcomp" conftest.dir
1956d1874b2Smrg  cd conftest.dir
1966d1874b2Smrg  # We will build objects and dependencies in a subdirectory because
1976d1874b2Smrg  # it helps to detect inapplicable dependency modes.  For instance
1986d1874b2Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1996d1874b2Smrg  # side effect of compilation, but ICC will put the dependencies in
2006d1874b2Smrg  # the current directory while Tru64 will put them in the object
2016d1874b2Smrg  # directory.
2026d1874b2Smrg  mkdir sub
203e6232409Smrg
2046d1874b2Smrg  am_cv_$1_dependencies_compiler_type=none
2056d1874b2Smrg  if test "$am_compiler_list" = ""; then
2066d1874b2Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2076d1874b2Smrg  fi
2086d1874b2Smrg  am__universal=false
2096d1874b2Smrg  m4_case([$1], [CC],
2106d1874b2Smrg    [case " $depcc " in #(
2116d1874b2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2126d1874b2Smrg     esac],
2136d1874b2Smrg    [CXX],
2146d1874b2Smrg    [case " $depcc " in #(
2156d1874b2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2166d1874b2Smrg     esac])
217e6232409Smrg
2186d1874b2Smrg  for depmode in $am_compiler_list; do
2196d1874b2Smrg    # Setup a source with many dependencies, because some compilers
2206d1874b2Smrg    # like to wrap large dependency lists on column 80 (with \), and
2216d1874b2Smrg    # we should not choose a depcomp mode which is confused by this.
2226d1874b2Smrg    #
2236d1874b2Smrg    # We need to recreate these files for each test, as the compiler may
2246d1874b2Smrg    # overwrite some of them when testing with obscure command lines.
2256d1874b2Smrg    # This happens at least with the AIX C compiler.
2266d1874b2Smrg    : > sub/conftest.c
2276d1874b2Smrg    for i in 1 2 3 4 5 6; do
2286d1874b2Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2296d1874b2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2306d1874b2Smrg      # Solaris 10 /bin/sh.
2316d1874b2Smrg      echo '/* dummy */' > sub/conftst$i.h
2326d1874b2Smrg    done
2336d1874b2Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234e6232409Smrg
2356d1874b2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2366d1874b2Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2376d1874b2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2386d1874b2Smrg    # versions had trouble with output in subdirs.
2396d1874b2Smrg    am__obj=sub/conftest.${OBJEXT-o}
2406d1874b2Smrg    am__minus_obj="-o $am__obj"
2416d1874b2Smrg    case $depmode in
2426d1874b2Smrg    gcc)
2436d1874b2Smrg      # This depmode causes a compiler race in universal mode.
2446d1874b2Smrg      test "$am__universal" = false || continue
2456d1874b2Smrg      ;;
2466d1874b2Smrg    nosideeffect)
2476d1874b2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2486d1874b2Smrg      # only be used when explicitly requested.
2496d1874b2Smrg      if test "x$enable_dependency_tracking" = xyes; then
2506d1874b2Smrg	continue
2516d1874b2Smrg      else
2526d1874b2Smrg	break
2536d1874b2Smrg      fi
2546d1874b2Smrg      ;;
2556d1874b2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2566d1874b2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2576d1874b2Smrg      # not run yet.  These depmodes are late enough in the game, and
2586d1874b2Smrg      # so weak that their functioning should not be impacted.
2596d1874b2Smrg      am__obj=conftest.${OBJEXT-o}
2606d1874b2Smrg      am__minus_obj=
2616d1874b2Smrg      ;;
2626d1874b2Smrg    none) break ;;
2636d1874b2Smrg    esac
2646d1874b2Smrg    if depmode=$depmode \
2656d1874b2Smrg       source=sub/conftest.c object=$am__obj \
2666d1874b2Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2676d1874b2Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2686d1874b2Smrg         >/dev/null 2>conftest.err &&
2696d1874b2Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2706d1874b2Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2716d1874b2Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2726d1874b2Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2736d1874b2Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2746d1874b2Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2756d1874b2Smrg      # that says an option was ignored or not supported.
2766d1874b2Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2776d1874b2Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2786d1874b2Smrg      # The diagnosis changed in icc 8.0:
2796d1874b2Smrg      #   icc: Command line remark: option '-MP' not supported
2806d1874b2Smrg      if (grep 'ignoring option' conftest.err ||
2816d1874b2Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2826d1874b2Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2836d1874b2Smrg        break
2846d1874b2Smrg      fi
2856d1874b2Smrg    fi
2866d1874b2Smrg  done
287e6232409Smrg
2886d1874b2Smrg  cd ..
2896d1874b2Smrg  rm -rf conftest.dir
2906d1874b2Smrgelse
2916d1874b2Smrg  am_cv_$1_dependencies_compiler_type=none
2926d1874b2Smrgfi
2936d1874b2Smrg])
2946d1874b2SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2956d1874b2SmrgAM_CONDITIONAL([am__fastdep$1], [
2966d1874b2Smrg  test "x$enable_dependency_tracking" != xno \
2976d1874b2Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2986d1874b2Smrg])
299e6232409Smrg
300c05e7a3eSmrg
3016d1874b2Smrg# AM_SET_DEPDIR
3026d1874b2Smrg# -------------
3036d1874b2Smrg# Choose a directory name for dependency files.
3046d1874b2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3056d1874b2SmrgAC_DEFUN([AM_SET_DEPDIR],
3066d1874b2Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3076d1874b2SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3086d1874b2Smrg])
309c05e7a3eSmrg
310c05e7a3eSmrg
3116d1874b2Smrg# AM_DEP_TRACK
3126d1874b2Smrg# ------------
3136d1874b2SmrgAC_DEFUN([AM_DEP_TRACK],
3146d1874b2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3156d1874b2SmrgAS_HELP_STRING(
3166d1874b2Smrg  [--enable-dependency-tracking],
3176d1874b2Smrg  [do not reject slow dependency extractors])
3186d1874b2SmrgAS_HELP_STRING(
3196d1874b2Smrg  [--disable-dependency-tracking],
3206d1874b2Smrg  [speeds up one-time build])])
3216d1874b2Smrgif test "x$enable_dependency_tracking" != xno; then
3226d1874b2Smrg  am_depcomp="$ac_aux_dir/depcomp"
3236d1874b2Smrg  AMDEPBACKSLASH='\'
3246d1874b2Smrg  am__nodep='_no'
3256d1874b2Smrgfi
3266d1874b2SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3276d1874b2SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3286d1874b2Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3296d1874b2SmrgAC_SUBST([am__nodep])dnl
3306d1874b2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3316d1874b2Smrg])
332c05e7a3eSmrg
3336d1874b2Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334c05e7a3eSmrg
3356d1874b2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336c05e7a3eSmrg#
3376d1874b2Smrg# This file is free software; the Free Software Foundation
3386d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
3396d1874b2Smrg# with or without modifications, as long as this notice is preserved.
340c05e7a3eSmrg
3416d1874b2Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3426d1874b2Smrg# ------------------------------
3436d1874b2SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3446d1874b2Smrg[{
3456d1874b2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3466d1874b2Smrg  # are listed without --file.  Let's play safe and only enable the eval
3476d1874b2Smrg  # if we detect the quoting.
3486d1874b2Smrg  # TODO: see whether this extra hack can be removed once we start
3496d1874b2Smrg  # requiring Autoconf 2.70 or later.
3506d1874b2Smrg  AS_CASE([$CONFIG_FILES],
3516d1874b2Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3526d1874b2Smrg          [*], [set x $CONFIG_FILES])
3536d1874b2Smrg  shift
3546d1874b2Smrg  # Used to flag and report bootstrapping failures.
3556d1874b2Smrg  am_rc=0
3566d1874b2Smrg  for am_mf
3576d1874b2Smrg  do
3586d1874b2Smrg    # Strip MF so we end up with the name of the file.
3596d1874b2Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3606d1874b2Smrg    # Check whether this is an Automake generated Makefile which includes
3616d1874b2Smrg    # dependency-tracking related rules and includes.
3626d1874b2Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3636d1874b2Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3646d1874b2Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3656d1874b2Smrg      || continue
3666d1874b2Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3676d1874b2Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3686d1874b2Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3696d1874b2Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3706d1874b2Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3716d1874b2Smrg  done
3726d1874b2Smrg  if test $am_rc -ne 0; then
3736d1874b2Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3746d1874b2Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3756d1874b2Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3766d1874b2Smrg    necessary).  You can also try re-running configure with the
3776d1874b2Smrg    '--disable-dependency-tracking' option to at least be able to build
3786d1874b2Smrg    the package (albeit without support for automatic dependency tracking).])
3796d1874b2Smrg  fi
3806d1874b2Smrg  AS_UNSET([am_dirpart])
3816d1874b2Smrg  AS_UNSET([am_filepart])
3826d1874b2Smrg  AS_UNSET([am_mf])
3836d1874b2Smrg  AS_UNSET([am_rc])
3846d1874b2Smrg  rm -f conftest-deps.mk
3856d1874b2Smrg}
3866d1874b2Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387e6232409Smrg
388e6232409Smrg
3896d1874b2Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3906d1874b2Smrg# -----------------------------
3916d1874b2Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392c05e7a3eSmrg#
3936d1874b2Smrg# This code is only required when automatic dependency tracking is enabled.
3946d1874b2Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3956d1874b2Smrg# order to bootstrap the dependency handling code.
3966d1874b2SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3976d1874b2Smrg[AC_CONFIG_COMMANDS([depfiles],
3986d1874b2Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3996d1874b2Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400e6232409Smrg
4016d1874b2Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402e6232409Smrg
4036d1874b2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4046d1874b2Smrg#
4056d1874b2Smrg# This file is free software; the Free Software Foundation
4066d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
4076d1874b2Smrg# with or without modifications, as long as this notice is preserved.
408e6232409Smrg
4096d1874b2Smrg# This macro actually does too much.  Some checks are only needed if
4106d1874b2Smrg# your package does certain things.  But this isn't really a big deal.
411e6232409Smrg
4126d1874b2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4136d1874b2Smrgm4_define([AC_PROG_CC],
4146d1874b2Smrgm4_defn([AC_PROG_CC])
4156d1874b2Smrg[_AM_PROG_CC_C_O
4166d1874b2Smrg])
417e6232409Smrg
4186d1874b2Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4196d1874b2Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4206d1874b2Smrg# -----------------------------------------------
4216d1874b2Smrg# The call with PACKAGE and VERSION arguments is the old style
4226d1874b2Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4236d1874b2Smrg# and VERSION should now be passed to AC_INIT and removed from
4246d1874b2Smrg# the call to AM_INIT_AUTOMAKE.
4256d1874b2Smrg# We support both call styles for the transition.  After
4266d1874b2Smrg# the next Automake release, Autoconf can make the AC_INIT
4276d1874b2Smrg# arguments mandatory, and then we can depend on a new Autoconf
4286d1874b2Smrg# release and drop the old call support.
4296d1874b2SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4306d1874b2Smrg[AC_PREREQ([2.65])dnl
4316d1874b2Smrgm4_ifdef([_$0_ALREADY_INIT],
4326d1874b2Smrg  [m4_fatal([$0 expanded multiple times
4336d1874b2Smrg]m4_defn([_$0_ALREADY_INIT]))],
4346d1874b2Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4356d1874b2Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4366d1874b2Smrgdnl the ones we care about.
4376d1874b2Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4386d1874b2SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4396d1874b2SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4406d1874b2Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4416d1874b2Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4426d1874b2Smrg  # is not polluted with repeated "-I."
4436d1874b2Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4446d1874b2Smrg  # test to see if srcdir already configured
4456d1874b2Smrg  if test -f $srcdir/config.status; then
4466d1874b2Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4476d1874b2Smrg  fi
448c05e7a3eSmrgfi
449e6232409Smrg
4506d1874b2Smrg# test whether we have cygpath
4516d1874b2Smrgif test -z "$CYGPATH_W"; then
4526d1874b2Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4536d1874b2Smrg    CYGPATH_W='cygpath -w'
4546d1874b2Smrg  else
4556d1874b2Smrg    CYGPATH_W=echo
4566d1874b2Smrg  fi
457c05e7a3eSmrgfi
4586d1874b2SmrgAC_SUBST([CYGPATH_W])
459c05e7a3eSmrg
4606d1874b2Smrg# Define the identity of the package.
4616d1874b2Smrgdnl Distinguish between old-style and new-style calls.
4626d1874b2Smrgm4_ifval([$2],
4636d1874b2Smrg[AC_DIAGNOSE([obsolete],
4646d1874b2Smrg             [$0: two- and three-arguments forms are deprecated.])
4656d1874b2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4666d1874b2Smrg AC_SUBST([PACKAGE], [$1])dnl
4676d1874b2Smrg AC_SUBST([VERSION], [$2])],
4686d1874b2Smrg[_AM_SET_OPTIONS([$1])dnl
4696d1874b2Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4706d1874b2Smrgm4_if(
4716d1874b2Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4726d1874b2Smrg  [ok:ok],,
4736d1874b2Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4746d1874b2Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4756d1874b2Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476e6232409Smrg
4776d1874b2Smrg_AM_IF_OPTION([no-define],,
4786d1874b2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4796d1874b2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480e6232409Smrg
4816d1874b2Smrg# Some tools Automake needs.
4826d1874b2SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4836d1874b2SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4846d1874b2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4856d1874b2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4866d1874b2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4876d1874b2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4886d1874b2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4896d1874b2SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4906d1874b2SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4916d1874b2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4926d1874b2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4936d1874b2Smrg# dies out for good.  For more background, see:
4946d1874b2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4956d1874b2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4966d1874b2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4976d1874b2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4986d1874b2Smrg# system "awk" is bad on some platforms.
4996d1874b2SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5006d1874b2SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5016d1874b2SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5026d1874b2Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5036d1874b2Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5046d1874b2Smrg			     [_AM_PROG_TAR([v7])])])
5056d1874b2Smrg_AM_IF_OPTION([no-dependencies],,
5066d1874b2Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5076d1874b2Smrg		  [_AM_DEPENDENCIES([CC])],
5086d1874b2Smrg		  [m4_define([AC_PROG_CC],
5096d1874b2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5106d1874b2SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5116d1874b2Smrg		  [_AM_DEPENDENCIES([CXX])],
5126d1874b2Smrg		  [m4_define([AC_PROG_CXX],
5136d1874b2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5146d1874b2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5156d1874b2Smrg		  [_AM_DEPENDENCIES([OBJC])],
5166d1874b2Smrg		  [m4_define([AC_PROG_OBJC],
5176d1874b2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5186d1874b2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5196d1874b2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5206d1874b2Smrg		  [m4_define([AC_PROG_OBJCXX],
5216d1874b2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5226d1874b2Smrg])
5236d1874b2Smrg# Variables for tags utilities; see am/tags.am
5246d1874b2Smrgif test -z "$CTAGS"; then
5256d1874b2Smrg  CTAGS=ctags
5266d1874b2Smrgfi
5276d1874b2SmrgAC_SUBST([CTAGS])
5286d1874b2Smrgif test -z "$ETAGS"; then
5296d1874b2Smrg  ETAGS=etags
5306d1874b2Smrgfi
5316d1874b2SmrgAC_SUBST([ETAGS])
5326d1874b2Smrgif test -z "$CSCOPE"; then
5336d1874b2Smrg  CSCOPE=cscope
5346d1874b2Smrgfi
5356d1874b2SmrgAC_SUBST([CSCOPE])
536c05e7a3eSmrg
5376d1874b2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5386d1874b2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5396d1874b2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5406d1874b2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5416d1874b2SmrgAC_CONFIG_COMMANDS_PRE(dnl
5426d1874b2Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5436d1874b2Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544c05e7a3eSmrg
5456d1874b2Smrg# POSIX will say in a future version that running "rm -f" with no argument
5466d1874b2Smrg# is OK; and we want to be able to make that assumption in our Makefile
5476d1874b2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5486d1874b2Smrg# actually supported "in the wild" to an acceptable degree.
5496d1874b2Smrg# See automake bug#10828.
5506d1874b2Smrg# To make any issue more visible, cause the running configure to be aborted
5516d1874b2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5526d1874b2Smrg# user can still override this though.
5536d1874b2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5546d1874b2Smrg  cat >&2 <<'END'
5556d1874b2SmrgOops!
556e6232409Smrg
5576d1874b2SmrgYour 'rm' program seems unable to run without file operands specified
5586d1874b2Smrgon the command line, even when the '-f' option is present.  This is contrary
5596d1874b2Smrgto the behaviour of most rm programs out there, and not conforming with
5606d1874b2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561e6232409Smrg
5626d1874b2SmrgPlease tell bug-automake@gnu.org about your system, including the value
5636d1874b2Smrgof your $PATH and any error possibly output before this message.  This
5646d1874b2Smrgcan help us improve future automake versions.
565c05e7a3eSmrg
5666d1874b2SmrgEND
5676d1874b2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5686d1874b2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5696d1874b2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5706d1874b2Smrg    echo >&2
5716d1874b2Smrg  else
5726d1874b2Smrg    cat >&2 <<'END'
5736d1874b2SmrgAborting the configuration process, to ensure you take notice of the issue.
574e6232409Smrg
5756d1874b2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5766d1874b2Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577e6232409Smrg
5786d1874b2SmrgIf you want to complete the configuration process using your problematic
5796d1874b2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5806d1874b2Smrgto "yes", and re-run configure.
5816a45684fSmrg
5826d1874b2SmrgEND
5836d1874b2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5846d1874b2Smrg  fi
585e6232409Smrgfi
5866d1874b2Smrgdnl The trailing newline in this macro's definition is deliberate, for
5876d1874b2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5886d1874b2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5896d1874b2Smrg])
590e6232409Smrg
5916d1874b2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5926d1874b2Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5936d1874b2Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5946d1874b2Smrgm4_define([_AC_COMPILER_EXEEXT],
5956d1874b2Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596c05e7a3eSmrg
5976d1874b2Smrg# When config.status generates a header, we must update the stamp-h file.
5986d1874b2Smrg# This file resides in the same directory as the config header
5996d1874b2Smrg# that is generated.  The stamp files are numbered to have different names.
600c05e7a3eSmrg
6016d1874b2Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6026d1874b2Smrg# loop where config.status creates the headers, so we can generate
6036d1874b2Smrg# our stamp files there.
6046d1874b2SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6056d1874b2Smrg[# Compute $1's index in $config_headers.
6066d1874b2Smrg_am_arg=$1
6076d1874b2Smrg_am_stamp_count=1
6086d1874b2Smrgfor _am_header in $config_headers :; do
6096d1874b2Smrg  case $_am_header in
6106d1874b2Smrg    $_am_arg | $_am_arg:* )
6116d1874b2Smrg      break ;;
6126d1874b2Smrg    * )
6136d1874b2Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6146d1874b2Smrg  esac
6156d1874b2Smrgdone
6166d1874b2Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617c05e7a3eSmrg
6186d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6196d1874b2Smrg#
6206d1874b2Smrg# This file is free software; the Free Software Foundation
6216d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
6226d1874b2Smrg# with or without modifications, as long as this notice is preserved.
6236d1874b2Smrg
6246d1874b2Smrg# AM_PROG_INSTALL_SH
6256d1874b2Smrg# ------------------
6266d1874b2Smrg# Define $install_sh.
6276d1874b2SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6286d1874b2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6296d1874b2Smrgif test x"${install_sh+set}" != xset; then
6306d1874b2Smrg  case $am_aux_dir in
6316d1874b2Smrg  *\ * | *\	*)
6326d1874b2Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6336d1874b2Smrg  *)
6346d1874b2Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6356d1874b2Smrg  esac
6366d1874b2Smrgfi
6376d1874b2SmrgAC_SUBST([install_sh])])
6386d1874b2Smrg
6396d1874b2Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6406d1874b2Smrg#
6416d1874b2Smrg# This file is free software; the Free Software Foundation
6426d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
6436d1874b2Smrg# with or without modifications, as long as this notice is preserved.
6446d1874b2Smrg
6456d1874b2Smrg# Check whether the underlying file-system supports filenames
6466d1874b2Smrg# with a leading dot.  For instance MS-DOS doesn't.
6476d1874b2SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6486d1874b2Smrg[rm -rf .tst 2>/dev/null
6496d1874b2Smrgmkdir .tst 2>/dev/null
6506d1874b2Smrgif test -d .tst; then
6516d1874b2Smrg  am__leading_dot=.
652c05e7a3eSmrgelse
6536d1874b2Smrg  am__leading_dot=_
65494a251fdSmrgfi
6556d1874b2Smrgrmdir .tst 2>/dev/null
6566d1874b2SmrgAC_SUBST([am__leading_dot])])
657e6232409Smrg
6586d1874b2Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659e6232409Smrg
6606d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6616d1874b2Smrg#
6626d1874b2Smrg# This file is free software; the Free Software Foundation
6636d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
6646d1874b2Smrg# with or without modifications, as long as this notice is preserved.
665e6232409Smrg
6666d1874b2Smrg# AM_MAKE_INCLUDE()
6676d1874b2Smrg# -----------------
6686d1874b2Smrg# Check whether make has an 'include' directive that can support all
6696d1874b2Smrg# the idioms we need for our automatic dependency tracking code.
6706d1874b2SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6716d1874b2Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6726d1874b2Smrgcat > confinc.mk << 'END'
6736d1874b2Smrgam__doit:
6746d1874b2Smrg	@echo this is the am__doit target >confinc.out
6756d1874b2Smrg.PHONY: am__doit
6766d1874b2SmrgEND
6776d1874b2Smrgam__include="#"
6786d1874b2Smrgam__quote=
6796d1874b2Smrg# BSD make does it like this.
6806d1874b2Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6816d1874b2Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6826d1874b2Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6836d1874b2Smrg_am_result=no
6846d1874b2Smrgfor s in GNU BSD; do
6856d1874b2Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6866d1874b2Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6876d1874b2Smrg      ['0:this is the am__doit target'],
6886d1874b2Smrg      [AS_CASE([$s],
6896d1874b2Smrg          [BSD], [am__include='.include' am__quote='"'],
6906d1874b2Smrg          [am__include='include' am__quote=''])])
6916d1874b2Smrg  if test "$am__include" != "#"; then
6926d1874b2Smrg    _am_result="yes ($s style)"
6936d1874b2Smrg    break
6946d1874b2Smrg  fi
6956d1874b2Smrgdone
6966d1874b2Smrgrm -f confinc.* confmf.*
6976d1874b2SmrgAC_MSG_RESULT([${_am_result}])
6986d1874b2SmrgAC_SUBST([am__include])])
6996d1874b2SmrgAC_SUBST([am__quote])])
7006a45684fSmrg
7016d1874b2Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7026a45684fSmrg
7036d1874b2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704c05e7a3eSmrg#
7056d1874b2Smrg# This file is free software; the Free Software Foundation
7066d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
7076d1874b2Smrg# with or without modifications, as long as this notice is preserved.
7086a45684fSmrg
7096d1874b2Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7106d1874b2Smrg# ------------------------------
7116d1874b2SmrgAC_DEFUN([AM_MISSING_PROG],
7126d1874b2Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7136d1874b2Smrg$1=${$1-"${am_missing_run}$2"}
7146d1874b2SmrgAC_SUBST($1)])
7156a45684fSmrg
7166d1874b2Smrg# AM_MISSING_HAS_RUN
7176d1874b2Smrg# ------------------
7186d1874b2Smrg# Define MISSING if not defined so far and test if it is modern enough.
7196d1874b2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7206d1874b2SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7216d1874b2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7226d1874b2SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7236d1874b2Smrgif test x"${MISSING+set}" != xset; then
7246d1874b2Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725c05e7a3eSmrgfi
7266d1874b2Smrg# Use eval to expand $SHELL
7276d1874b2Smrgif eval "$MISSING --is-lightweight"; then
7286d1874b2Smrg  am_missing_run="$MISSING "
7296d1874b2Smrgelse
7306d1874b2Smrg  am_missing_run=
7316d1874b2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732c05e7a3eSmrgfi
7336d1874b2Smrg])
7346a45684fSmrg
7356d1874b2Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736e6232409Smrg
7376d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7386d1874b2Smrg#
7396d1874b2Smrg# This file is free software; the Free Software Foundation
7406d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
7416d1874b2Smrg# with or without modifications, as long as this notice is preserved.
742e6232409Smrg
7436d1874b2Smrg# _AM_MANGLE_OPTION(NAME)
7446d1874b2Smrg# -----------------------
7456d1874b2SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7466d1874b2Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747e6232409Smrg
7486d1874b2Smrg# _AM_SET_OPTION(NAME)
7496d1874b2Smrg# --------------------
7506d1874b2Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7516d1874b2SmrgAC_DEFUN([_AM_SET_OPTION],
7526d1874b2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753e6232409Smrg
7546d1874b2Smrg# _AM_SET_OPTIONS(OPTIONS)
7556d1874b2Smrg# ------------------------
7566d1874b2Smrg# OPTIONS is a space-separated list of Automake options.
7576d1874b2SmrgAC_DEFUN([_AM_SET_OPTIONS],
7586d1874b2Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7596d1874b2Smrg
7606d1874b2Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7616d1874b2Smrg# -------------------------------------------
7626d1874b2Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7636d1874b2SmrgAC_DEFUN([_AM_IF_OPTION],
7646d1874b2Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7656d1874b2Smrg
7666d1874b2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767c05e7a3eSmrg#
7686d1874b2Smrg# This file is free software; the Free Software Foundation
7696d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
7706d1874b2Smrg# with or without modifications, as long as this notice is preserved.
771e6232409Smrg
7726d1874b2Smrg# _AM_PROG_CC_C_O
7736d1874b2Smrg# ---------------
7746d1874b2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7756d1874b2Smrg# to automatically call this.
7766d1874b2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7776d1874b2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7786d1874b2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7796d1874b2SmrgAC_LANG_PUSH([C])dnl
7806d1874b2SmrgAC_CACHE_CHECK(
7816d1874b2Smrg  [whether $CC understands -c and -o together],
7826d1874b2Smrg  [am_cv_prog_cc_c_o],
7836d1874b2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7846d1874b2Smrg  # Make sure it works both with $CC and with simple cc.
7856d1874b2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7866d1874b2Smrg  # compilers refuse to overwrite an existing .o file with -o,
7876d1874b2Smrg  # though they will create one.
7886d1874b2Smrg  am_cv_prog_cc_c_o=yes
7896d1874b2Smrg  for am_i in 1 2; do
7906d1874b2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7916d1874b2Smrg         && test -f conftest2.$ac_objext; then
7926d1874b2Smrg      : OK
7936d1874b2Smrg    else
7946d1874b2Smrg      am_cv_prog_cc_c_o=no
7956d1874b2Smrg      break
7966d1874b2Smrg    fi
7976d1874b2Smrg  done
7986d1874b2Smrg  rm -f core conftest*
7996d1874b2Smrg  unset am_i])
8006d1874b2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8016d1874b2Smrg   # Losing compiler, so override with the script.
8026d1874b2Smrg   # FIXME: It is wrong to rewrite CC.
8036d1874b2Smrg   # But if we don't then we get into trouble of one sort or another.
8046d1874b2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8056d1874b2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8066d1874b2Smrg   CC="$am_aux_dir/compile $CC"
8078fff3f40Smrgfi
8086d1874b2SmrgAC_LANG_POP([C])])
809e6232409Smrg
8106d1874b2Smrg# For backward compatibility.
8116d1874b2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81294a251fdSmrg
8136d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8148fff3f40Smrg#
8156d1874b2Smrg# This file is free software; the Free Software Foundation
8166d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
8176d1874b2Smrg# with or without modifications, as long as this notice is preserved.
81894a251fdSmrg
8196d1874b2Smrg# AM_RUN_LOG(COMMAND)
8206d1874b2Smrg# -------------------
8216d1874b2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8226d1874b2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8236d1874b2SmrgAC_DEFUN([AM_RUN_LOG],
8246d1874b2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8256d1874b2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8266d1874b2Smrg   ac_status=$?
8276d1874b2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8286d1874b2Smrg   (exit $ac_status); }])
8296d1874b2Smrg
8306d1874b2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8316d1874b2Smrg
8326d1874b2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833c05e7a3eSmrg#
8346d1874b2Smrg# This file is free software; the Free Software Foundation
8356d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
8366d1874b2Smrg# with or without modifications, as long as this notice is preserved.
83794a251fdSmrg
8386d1874b2Smrg# AM_SANITY_CHECK
8396d1874b2Smrg# ---------------
8406d1874b2SmrgAC_DEFUN([AM_SANITY_CHECK],
8416d1874b2Smrg[AC_MSG_CHECKING([whether build environment is sane])
8426d1874b2Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8436d1874b2Smrg# name.  Accept space and tab only in the latter.
8446d1874b2Smrgam_lf='
8456d1874b2Smrg'
8466d1874b2Smrgcase `pwd` in
8476d1874b2Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8486d1874b2Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8496d1874b2Smrgesac
8506d1874b2Smrgcase $srcdir in
8516d1874b2Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8526d1874b2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8536d1874b2Smrgesac
8546d1874b2Smrg
8556d1874b2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8566d1874b2Smrg# arguments.  Must try -L first in case configure is actually a
8576d1874b2Smrg# symlink; some systems play weird games with the mod time of symlinks
8586d1874b2Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8596d1874b2Smrg# directory).
8606d1874b2Smrgif (
8616d1874b2Smrg   am_has_slept=no
8626d1874b2Smrg   for am_try in 1 2; do
8636d1874b2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8646d1874b2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8656d1874b2Smrg     if test "$[*]" = "X"; then
8666d1874b2Smrg	# -L didn't work.
8676d1874b2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8686d1874b2Smrg     fi
8696d1874b2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8706d1874b2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8716d1874b2Smrg
8726d1874b2Smrg	# If neither matched, then we have a broken ls.  This can happen
8736d1874b2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8746d1874b2Smrg	# broken ls alias from the environment.  This has actually
8756d1874b2Smrg	# happened.  Such a system could not be considered "sane".
8766d1874b2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8776d1874b2Smrg  alias in your environment])
8786d1874b2Smrg     fi
8796d1874b2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8806d1874b2Smrg       break
8816d1874b2Smrg     fi
8826d1874b2Smrg     # Just in case.
8836d1874b2Smrg     sleep 1
8846d1874b2Smrg     am_has_slept=yes
8856d1874b2Smrg   done
8866d1874b2Smrg   test "$[2]" = conftest.file
8876d1874b2Smrg   )
8886d1874b2Smrgthen
8896d1874b2Smrg   # Ok.
8906d1874b2Smrg   :
891e6232409Smrgelse
8926d1874b2Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8936d1874b2SmrgCheck your system clock])
894e6232409Smrgfi
8956d1874b2SmrgAC_MSG_RESULT([yes])
8966d1874b2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8976d1874b2Smrg# generated files are strictly newer.
8986d1874b2Smrgam_sleep_pid=
8996d1874b2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9006d1874b2Smrg  ( sleep 1 ) &
9016d1874b2Smrg  am_sleep_pid=$!
9026d1874b2Smrgfi
9036d1874b2SmrgAC_CONFIG_COMMANDS_PRE(
9046d1874b2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9056d1874b2Smrg   if test -n "$am_sleep_pid"; then
9066d1874b2Smrg     # Hide warnings about reused PIDs.
9076d1874b2Smrg     wait $am_sleep_pid 2>/dev/null
9086d1874b2Smrg   fi
9096d1874b2Smrg   AC_MSG_RESULT([done])])
9106d1874b2Smrgrm -f conftest.file
9116d1874b2Smrg])
912e6232409Smrg
9136d1874b2Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914c05e7a3eSmrg#
9156d1874b2Smrg# This file is free software; the Free Software Foundation
9166d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
9176d1874b2Smrg# with or without modifications, as long as this notice is preserved.
91894a251fdSmrg
9196d1874b2Smrg# AM_SILENT_RULES([DEFAULT])
9206d1874b2Smrg# --------------------------
9216d1874b2Smrg# Enable less verbose build rules; with the default set to DEFAULT
9226d1874b2Smrg# ("yes" being less verbose, "no" or empty being verbose).
9236d1874b2SmrgAC_DEFUN([AM_SILENT_RULES],
9246d1874b2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9256d1874b2SmrgAS_HELP_STRING(
9266d1874b2Smrg  [--enable-silent-rules],
9276d1874b2Smrg  [less verbose build output (undo: "make V=1")])
9286d1874b2SmrgAS_HELP_STRING(
9296d1874b2Smrg  [--disable-silent-rules],
9306d1874b2Smrg  [verbose build output (undo: "make V=0")])dnl
9316d1874b2Smrg])
9326d1874b2Smrgcase $enable_silent_rules in @%:@ (((
9336d1874b2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9346d1874b2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9356d1874b2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9366d1874b2Smrgesac
9376d1874b2Smrgdnl
9386d1874b2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9396d1874b2Smrgdnl do not support nested variable expansions.
9406d1874b2Smrgdnl See automake bug#9928 and bug#10237.
9416d1874b2Smrgam_make=${MAKE-make}
9426d1874b2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9436d1874b2Smrg   [am_cv_make_support_nested_variables],
9446d1874b2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9456d1874b2SmrgBAR0=false
9466d1874b2SmrgBAR1=true
9476d1874b2SmrgV=1
9486d1874b2Smrgam__doit:
9496d1874b2Smrg	@$(TRUE)
9506d1874b2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9516d1874b2Smrg  am_cv_make_support_nested_variables=yes
952c05e7a3eSmrgelse
9536d1874b2Smrg  am_cv_make_support_nested_variables=no
9546d1874b2Smrgfi])
9556d1874b2Smrgif test $am_cv_make_support_nested_variables = yes; then
9566d1874b2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9576d1874b2Smrg  AM_V='$(V)'
9586d1874b2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9596d1874b2Smrgelse
9606d1874b2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9616d1874b2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962c05e7a3eSmrgfi
9636d1874b2SmrgAC_SUBST([AM_V])dnl
9646d1874b2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9656d1874b2SmrgAC_SUBST([AM_DEFAULT_V])dnl
9666d1874b2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9676d1874b2SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9686d1874b2SmrgAM_BACKSLASH='\'
9696d1874b2SmrgAC_SUBST([AM_BACKSLASH])dnl
9706d1874b2Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9716d1874b2Smrg])
97294a251fdSmrg
9736d1874b2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974c05e7a3eSmrg#
9756d1874b2Smrg# This file is free software; the Free Software Foundation
9766d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
9776d1874b2Smrg# with or without modifications, as long as this notice is preserved.
97894a251fdSmrg
9796d1874b2Smrg# AM_PROG_INSTALL_STRIP
9806d1874b2Smrg# ---------------------
9816d1874b2Smrg# One issue with vendor 'install' (even GNU) is that you can't
9826d1874b2Smrg# specify the program used to strip binaries.  This is especially
9836d1874b2Smrg# annoying in cross-compiling environments, where the build's strip
9846d1874b2Smrg# is unlikely to handle the host's binaries.
9856d1874b2Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9866d1874b2Smrg# always use install-sh in "make install-strip", and initialize
9876d1874b2Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9886d1874b2SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9896d1874b2Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9906d1874b2Smrg# Installed binaries are usually stripped using 'strip' when the user
9916d1874b2Smrg# run "make install-strip".  However 'strip' might not be the right
9926d1874b2Smrg# tool to use in cross-compilation environments, therefore Automake
9936d1874b2Smrg# will honor the 'STRIP' environment variable to overrule this program.
9946d1874b2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9956d1874b2Smrgif test "$cross_compiling" != no; then
9966d1874b2Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9976a45684fSmrgfi
9986d1874b2SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9996d1874b2SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10006a45684fSmrg
10016d1874b2Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002c05e7a3eSmrg#
10036d1874b2Smrg# This file is free software; the Free Software Foundation
10046d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
10056d1874b2Smrg# with or without modifications, as long as this notice is preserved.
10066a45684fSmrg
10076d1874b2Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10086d1874b2Smrg# ---------------------------
10096d1874b2Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10106d1874b2Smrg# This macro is traced by Automake.
10116d1874b2SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012c05e7a3eSmrg
10136d1874b2Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10146d1874b2Smrg# --------------------------
10156d1874b2Smrg# Public sister of _AM_SUBST_NOTMAKE.
10166d1874b2SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017e6232409Smrg
10186d1874b2Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10198fff3f40Smrg
10206d1874b2Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021c05e7a3eSmrg#
10226d1874b2Smrg# This file is free software; the Free Software Foundation
10236d1874b2Smrg# gives unlimited permission to copy and/or distribute it,
10246d1874b2Smrg# with or without modifications, as long as this notice is preserved.
10256d1874b2Smrg
10266d1874b2Smrg# _AM_PROG_TAR(FORMAT)
10276d1874b2Smrg# --------------------
10286d1874b2Smrg# Check how to create a tarball in format FORMAT.
10296d1874b2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030c05e7a3eSmrg#
10316d1874b2Smrg# Substitute a variable $(am__tar) that is a command
10326d1874b2Smrg# writing to stdout a FORMAT-tarball containing the directory
10336d1874b2Smrg# $tardir.
10346d1874b2Smrg#     tardir=directory && $(am__tar) > result.tar
1035c05e7a3eSmrg#
10366d1874b2Smrg# Substitute a variable $(am__untar) that extract such
10376d1874b2Smrg# a tarball read from stdin.
10386d1874b2Smrg#     $(am__untar) < result.tar
1039c05e7a3eSmrg#
10406d1874b2SmrgAC_DEFUN([_AM_PROG_TAR],
10416d1874b2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10426d1874b2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10436d1874b2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10448fff3f40Smrg
10456d1874b2Smrg# We'll loop over all known methods to create a tar archive until one works.
10466d1874b2Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047e6232409Smrg
10486d1874b2Smrgm4_if([$1], [v7],
10496d1874b2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105094a251fdSmrg
10516d1874b2Smrg  [m4_case([$1],
10526d1874b2Smrg    [ustar],
10536d1874b2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10546d1874b2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10556d1874b2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10566d1874b2Smrg      # and bug#13588).
10576d1874b2Smrg      am_max_uid=2097151 # 2^21 - 1
10586d1874b2Smrg      am_max_gid=$am_max_uid
10596d1874b2Smrg      # The $UID and $GID variables are not portable, so we need to resort
10606d1874b2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10616d1874b2Smrg      # below are definitely unexpected, so allow the users to see them
10626d1874b2Smrg      # (that is, avoid stderr redirection).
10636d1874b2Smrg      am_uid=`id -u || echo unknown`
10646d1874b2Smrg      am_gid=`id -g || echo unknown`
10656d1874b2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10666d1874b2Smrg      if test $am_uid -le $am_max_uid; then
10676d1874b2Smrg         AC_MSG_RESULT([yes])
10686d1874b2Smrg      else
10696d1874b2Smrg         AC_MSG_RESULT([no])
10706d1874b2Smrg         _am_tools=none
10716d1874b2Smrg      fi
10726d1874b2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10736d1874b2Smrg      if test $am_gid -le $am_max_gid; then
10746d1874b2Smrg         AC_MSG_RESULT([yes])
10756d1874b2Smrg      else
10766d1874b2Smrg        AC_MSG_RESULT([no])
10776d1874b2Smrg        _am_tools=none
10786d1874b2Smrg      fi],
107994a251fdSmrg
10806d1874b2Smrg  [pax],
10816d1874b2Smrg    [],
1082e6232409Smrg
10836d1874b2Smrg  [m4_fatal([Unknown tar format])])
1084e6232409Smrg
10856d1874b2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10868fff3f40Smrg
10876d1874b2Smrg  # Go ahead even if we have the value already cached.  We do so because we
10886d1874b2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10896d1874b2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10908fff3f40Smrg
10916d1874b2Smrg  for _am_tool in $_am_tools; do
10926d1874b2Smrg    case $_am_tool in
10936d1874b2Smrg    gnutar)
10946d1874b2Smrg      for _am_tar in tar gnutar gtar; do
10956d1874b2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10966d1874b2Smrg      done
10976d1874b2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10986d1874b2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10996d1874b2Smrg      am__untar="$_am_tar -xf -"
11006d1874b2Smrg      ;;
11016d1874b2Smrg    plaintar)
11026d1874b2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11036d1874b2Smrg      # ustar tarball either.
11046d1874b2Smrg      (tar --version) >/dev/null 2>&1 && continue
11056d1874b2Smrg      am__tar='tar chf - "$$tardir"'
11066d1874b2Smrg      am__tar_='tar chf - "$tardir"'
11076d1874b2Smrg      am__untar='tar xf -'
11086d1874b2Smrg      ;;
11096d1874b2Smrg    pax)
11106d1874b2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11116d1874b2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11126d1874b2Smrg      am__untar='pax -r'
11136d1874b2Smrg      ;;
11146d1874b2Smrg    cpio)
11156d1874b2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11166d1874b2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11176d1874b2Smrg      am__untar='cpio -i -H $1 -d'
11186d1874b2Smrg      ;;
11196d1874b2Smrg    none)
11206d1874b2Smrg      am__tar=false
11216d1874b2Smrg      am__tar_=false
11226d1874b2Smrg      am__untar=false
11236d1874b2Smrg      ;;
11246d1874b2Smrg    esac
1125e6232409Smrg
11266d1874b2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11276d1874b2Smrg    # and am__untar set.
11286d1874b2Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129e6232409Smrg
11306d1874b2Smrg    # tar/untar a dummy directory, and stop if the command works.
11316d1874b2Smrg    rm -rf conftest.dir
11326d1874b2Smrg    mkdir conftest.dir
11336d1874b2Smrg    echo GrepMe > conftest.dir/file
11346d1874b2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11356d1874b2Smrg    rm -rf conftest.dir
11366d1874b2Smrg    if test -s conftest.tar; then
11376d1874b2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11386d1874b2Smrg      AM_RUN_LOG([cat conftest.dir/file])
11396d1874b2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11406d1874b2Smrg    fi
11416d1874b2Smrg  done
11426d1874b2Smrg  rm -rf conftest.dir
1143e6232409Smrg
11446d1874b2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11456d1874b2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146e6232409Smrg
11476d1874b2SmrgAC_SUBST([am__tar])
11486d1874b2SmrgAC_SUBST([am__untar])
11496d1874b2Smrg]) # _AM_PROG_TAR
11508fff3f40Smrg
11516d1874b2Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11526d1874b2Smrgdnl serial 11 (pkg-config-0.29)
11536d1874b2Smrgdnl
11546d1874b2Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11556d1874b2Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11566d1874b2Smrgdnl
11576d1874b2Smrgdnl This program is free software; you can redistribute it and/or modify
11586d1874b2Smrgdnl it under the terms of the GNU General Public License as published by
11596d1874b2Smrgdnl the Free Software Foundation; either version 2 of the License, or
11606d1874b2Smrgdnl (at your option) any later version.
11616d1874b2Smrgdnl
11626d1874b2Smrgdnl This program is distributed in the hope that it will be useful, but
11636d1874b2Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11646d1874b2Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11656d1874b2Smrgdnl General Public License for more details.
11666d1874b2Smrgdnl
11676d1874b2Smrgdnl You should have received a copy of the GNU General Public License
11686d1874b2Smrgdnl along with this program; if not, write to the Free Software
11696d1874b2Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11706d1874b2Smrgdnl 02111-1307, USA.
11716d1874b2Smrgdnl
11726d1874b2Smrgdnl As a special exception to the GNU General Public License, if you
11736d1874b2Smrgdnl distribute this file as part of a program that contains a
11746d1874b2Smrgdnl configuration script generated by Autoconf, you may include it under
11756d1874b2Smrgdnl the same distribution terms that you use for the rest of that
11766d1874b2Smrgdnl program.
1177e6232409Smrg
11786d1874b2Smrgdnl PKG_PREREQ(MIN-VERSION)
11796d1874b2Smrgdnl -----------------------
11806d1874b2Smrgdnl Since: 0.29
11816d1874b2Smrgdnl
11826d1874b2Smrgdnl Verify that the version of the pkg-config macros are at least
11836d1874b2Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11846d1874b2Smrgdnl installed version of pkg-config, this checks the developer's version
11856d1874b2Smrgdnl of pkg.m4 when generating configure.
11866d1874b2Smrgdnl
11876d1874b2Smrgdnl To ensure that this macro is defined, also add:
11886d1874b2Smrgdnl m4_ifndef([PKG_PREREQ],
11896d1874b2Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11906d1874b2Smrgdnl
11916d1874b2Smrgdnl See the "Since" comment for each macro you use to see what version
11926d1874b2Smrgdnl of the macros you require.
11936d1874b2Smrgm4_defun([PKG_PREREQ],
11946d1874b2Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11956d1874b2Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11966d1874b2Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11976d1874b2Smrg])dnl PKG_PREREQ
11988fff3f40Smrg
11996d1874b2Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12006d1874b2Smrgdnl ----------------------------------
12016d1874b2Smrgdnl Since: 0.16
12026d1874b2Smrgdnl
12036d1874b2Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12046d1874b2Smrgdnl first found in the path. Checks that the version of pkg-config found
12056d1874b2Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12066d1874b2Smrgdnl used since that's the first version where most current features of
12076d1874b2Smrgdnl pkg-config existed.
12086d1874b2SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12096d1874b2Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12106d1874b2Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12116d1874b2Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12126d1874b2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12136d1874b2SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12146d1874b2SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215e6232409Smrg
12166d1874b2Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12176d1874b2Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121894a251fdSmrgfi
12196d1874b2Smrgif test -n "$PKG_CONFIG"; then
12206d1874b2Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12216d1874b2Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12226d1874b2Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12236d1874b2Smrg		AC_MSG_RESULT([yes])
12246d1874b2Smrg	else
12256d1874b2Smrg		AC_MSG_RESULT([no])
12266d1874b2Smrg		PKG_CONFIG=""
12276d1874b2Smrg	fi
12286d1874b2Smrgfi[]dnl
12296d1874b2Smrg])dnl PKG_PROG_PKG_CONFIG
123094a251fdSmrg
12316d1874b2Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12326d1874b2Smrgdnl -------------------------------------------------------------------
12336d1874b2Smrgdnl Since: 0.18
12346d1874b2Smrgdnl
12356d1874b2Smrgdnl Check to see whether a particular set of modules exists. Similar to
12366d1874b2Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12376d1874b2Smrgdnl
12386d1874b2Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12396d1874b2Smrgdnl only at the first occurence in configure.ac, so if the first place
12406d1874b2Smrgdnl it's called might be skipped (such as if it is within an "if", you
12416d1874b2Smrgdnl have to call PKG_CHECK_EXISTS manually
12426d1874b2SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12436d1874b2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12446d1874b2Smrgif test -n "$PKG_CONFIG" && \
12456d1874b2Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12466d1874b2Smrg  m4_default([$2], [:])
12476d1874b2Smrgm4_ifvaln([$3], [else
12486d1874b2Smrg  $3])dnl
12496d1874b2Smrgfi])
12506d1874b2Smrg
12516d1874b2Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12526d1874b2Smrgdnl ---------------------------------------------
12536d1874b2Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12546d1874b2Smrgdnl pkg_failed based on the result.
12556d1874b2Smrgm4_define([_PKG_CONFIG],
12566d1874b2Smrg[if test -n "$$1"; then
12576d1874b2Smrg    pkg_cv_[]$1="$$1"
12586d1874b2Smrg elif test -n "$PKG_CONFIG"; then
12596d1874b2Smrg    PKG_CHECK_EXISTS([$3],
12606d1874b2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12616d1874b2Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12626d1874b2Smrg		     [pkg_failed=yes])
12636d1874b2Smrg else
12646d1874b2Smrg    pkg_failed=untried
12656d1874b2Smrgfi[]dnl
12666d1874b2Smrg])dnl _PKG_CONFIG
12676d1874b2Smrg
12686d1874b2Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12696d1874b2Smrgdnl ---------------------------
12706d1874b2Smrgdnl Internal check to see if pkg-config supports short errors.
12716d1874b2SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12726d1874b2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12736d1874b2Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12746d1874b2Smrg        _pkg_short_errors_supported=yes
127594a251fdSmrgelse
12766d1874b2Smrg        _pkg_short_errors_supported=no
12776d1874b2Smrgfi[]dnl
12786d1874b2Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279e6232409Smrg
12808fff3f40Smrg
12816d1874b2Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12826d1874b2Smrgdnl   [ACTION-IF-NOT-FOUND])
12836d1874b2Smrgdnl --------------------------------------------------------------
12846d1874b2Smrgdnl Since: 0.4.0
12856d1874b2Smrgdnl
12866d1874b2Smrgdnl Note that if there is a possibility the first call to
12876d1874b2Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12886d1874b2Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12896d1874b2SmrgAC_DEFUN([PKG_CHECK_MODULES],
12906d1874b2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12916d1874b2SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12926d1874b2SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293e6232409Smrg
12946d1874b2Smrgpkg_failed=no
12956d1874b2SmrgAC_MSG_CHECKING([for $1])
1296e6232409Smrg
12976d1874b2Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12986d1874b2Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299e6232409Smrg
13006d1874b2Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13016d1874b2Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13026d1874b2SmrgSee the pkg-config man page for more details.])
1303e6232409Smrg
13046d1874b2Smrgif test $pkg_failed = yes; then
13056d1874b2Smrg   	AC_MSG_RESULT([no])
13066d1874b2Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13076d1874b2Smrg        if test $_pkg_short_errors_supported = yes; then
13086d1874b2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13096d1874b2Smrg        else 
13106d1874b2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13116d1874b2Smrg        fi
13126d1874b2Smrg	# Put the nasty error message in config.log where it belongs
13136d1874b2Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314e6232409Smrg
13156d1874b2Smrg	m4_default([$4], [AC_MSG_ERROR(
13166d1874b2Smrg[Package requirements ($2) were not met:
131794a251fdSmrg
13186d1874b2Smrg$$1_PKG_ERRORS
13196d1874b2Smrg
13206d1874b2SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13216d1874b2Smrginstalled software in a non-standard prefix.
13226d1874b2Smrg
13236d1874b2Smrg_PKG_TEXT])[]dnl
13246d1874b2Smrg        ])
13256d1874b2Smrgelif test $pkg_failed = untried; then
13266d1874b2Smrg     	AC_MSG_RESULT([no])
13276d1874b2Smrg	m4_default([$4], [AC_MSG_FAILURE(
13286d1874b2Smrg[The pkg-config script could not be found or is too old.  Make sure it
13296d1874b2Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13306d1874b2Smrgpath to pkg-config.
13316d1874b2Smrg
13326d1874b2Smrg_PKG_TEXT
13336d1874b2Smrg
13346d1874b2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13356d1874b2Smrg        ])
133694a251fdSmrgelse
13376d1874b2Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13386d1874b2Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13396d1874b2Smrg        AC_MSG_RESULT([yes])
13406d1874b2Smrg	$3
13416d1874b2Smrgfi[]dnl
13426d1874b2Smrg])dnl PKG_CHECK_MODULES
134394a251fdSmrg
134494a251fdSmrg
13456d1874b2Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13466d1874b2Smrgdnl   [ACTION-IF-NOT-FOUND])
13476d1874b2Smrgdnl ---------------------------------------------------------------------
13486d1874b2Smrgdnl Since: 0.29
13496d1874b2Smrgdnl
13506d1874b2Smrgdnl Checks for existence of MODULES and gathers its build flags with
13516d1874b2Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13526d1874b2Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13536d1874b2Smrgdnl
13546d1874b2Smrgdnl Note that if there is a possibility the first call to
13556d1874b2Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13566d1874b2Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13576d1874b2Smrgdnl configure.ac.
13586d1874b2SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13596d1874b2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13606d1874b2Smrg_save_PKG_CONFIG=$PKG_CONFIG
13616d1874b2SmrgPKG_CONFIG="$PKG_CONFIG --static"
13626d1874b2SmrgPKG_CHECK_MODULES($@)
13636d1874b2SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13646d1874b2Smrg])dnl PKG_CHECK_MODULES_STATIC
1365e6232409Smrg
1366e6232409Smrg
13676d1874b2Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13686d1874b2Smrgdnl -------------------------
13696d1874b2Smrgdnl Since: 0.27
13706d1874b2Smrgdnl
13716d1874b2Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13726d1874b2Smrgdnl should install pkg-config .pc files. By default the directory is
13736d1874b2Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13746d1874b2Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13756d1874b2Smrgdnl parameter.
13766d1874b2SmrgAC_DEFUN([PKG_INSTALLDIR],
13776d1874b2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13786d1874b2Smrgm4_pushdef([pkg_description],
13796d1874b2Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13806d1874b2SmrgAC_ARG_WITH([pkgconfigdir],
13816d1874b2Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13826d1874b2Smrg    [with_pkgconfigdir=]pkg_default)
13836d1874b2SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13846d1874b2Smrgm4_popdef([pkg_default])
13856d1874b2Smrgm4_popdef([pkg_description])
13866d1874b2Smrg])dnl PKG_INSTALLDIR
13876d1874b2Smrg
13886d1874b2Smrg
13896d1874b2Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13906d1874b2Smrgdnl --------------------------------
13916d1874b2Smrgdnl Since: 0.27
13926d1874b2Smrgdnl
13936d1874b2Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13946d1874b2Smrgdnl module should install arch-independent pkg-config .pc files. By
13956d1874b2Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13966d1874b2Smrgdnl changed by passing DIRECTORY. The user can override through the
13976d1874b2Smrgdnl --with-noarch-pkgconfigdir parameter.
13986d1874b2SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13996d1874b2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14006d1874b2Smrgm4_pushdef([pkg_description],
14016d1874b2Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14026d1874b2SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14036d1874b2Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14046d1874b2Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14056d1874b2SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14066d1874b2Smrgm4_popdef([pkg_default])
14076d1874b2Smrgm4_popdef([pkg_description])
14086d1874b2Smrg])dnl PKG_NOARCH_INSTALLDIR
14096d1874b2Smrg
1410e6232409Smrg
14116d1874b2Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14126d1874b2Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14136d1874b2Smrgdnl -------------------------------------------
14146d1874b2Smrgdnl Since: 0.28
14156d1874b2Smrgdnl
14166d1874b2Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14176d1874b2SmrgAC_DEFUN([PKG_CHECK_VAR],
14186d1874b2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14196d1874b2SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420e6232409Smrg
14216d1874b2Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14226d1874b2SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423e6232409Smrg
14246d1874b2SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14256d1874b2Smrg])dnl PKG_CHECK_VAR
1426e6232409Smrg
14276d1874b2Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14286d1874b2Smrgdnl
142961d7a284Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14306d1874b2Smrgdnl
14316d1874b2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14326d1874b2Smrgdnl copy of this software and associated documentation files (the "Software"),
14336d1874b2Smrgdnl to deal in the Software without restriction, including without limitation
14346d1874b2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14356d1874b2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14366d1874b2Smrgdnl Software is furnished to do so, subject to the following conditions:
14376d1874b2Smrgdnl
14386d1874b2Smrgdnl The above copyright notice and this permission notice (including the next
14396d1874b2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14406d1874b2Smrgdnl Software.
14416d1874b2Smrgdnl
14426d1874b2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14436d1874b2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14446d1874b2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14456d1874b2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14466d1874b2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14476d1874b2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14486d1874b2Smrgdnl DEALINGS IN THE SOFTWARE.
1449e6232409Smrg
14506d1874b2Smrg# XORG_MACROS_VERSION(required-version)
14516d1874b2Smrg# -------------------------------------
1452c05e7a3eSmrg# Minimum version: 1.1.0
14538fff3f40Smrg#
14546d1874b2Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14556d1874b2Smrg# your configure.ac with the minimum required version, such as:
14566d1874b2Smrg# XORG_MACROS_VERSION(1.1)
1457c05e7a3eSmrg#
14586d1874b2Smrg# To ensure that this macro is defined, also add:
14596d1874b2Smrg# m4_ifndef([XORG_MACROS_VERSION],
14606d1874b2Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461c05e7a3eSmrg#
14626d1874b2Smrg#
14636d1874b2Smrg# See the "minimum version" comment for each macro you use to see what
14646d1874b2Smrg# version you require.
14656d1874b2Smrgm4_defun([XORG_MACROS_VERSION],[
146661d7a284Smrgm4_define([vers_have], [1.20.0])
14676d1874b2Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14686d1874b2Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14696d1874b2Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14706d1874b2Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14716d1874b2Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14726d1874b2Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14736d1874b2Smrgm4_undefine([vers_have])
14746d1874b2Smrgm4_undefine([maj_have])
14756d1874b2Smrgm4_undefine([maj_needed])
14766d1874b2Smrg]) # XORG_MACROS_VERSION
1477e6232409Smrg
14786d1874b2Smrg# XORG_PROG_RAWCPP()
14796d1874b2Smrg# ------------------
14806d1874b2Smrg# Minimum version: 1.0.0
14816d1874b2Smrg#
14826d1874b2Smrg# Find cpp program and necessary flags for use in pre-processing text files
14836d1874b2Smrg# such as man pages and config files
14846d1874b2SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14856d1874b2SmrgAC_REQUIRE([AC_PROG_CPP])
14866d1874b2SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14876d1874b2Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488e6232409Smrg
14896d1874b2Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14906d1874b2Smrg# which is not the best choice for supporting other OS'es, but covers most
14916d1874b2Smrg# of the ones we need for now.
14926d1874b2SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14936d1874b2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14946d1874b2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14956d1874b2Smrg	AC_MSG_RESULT([no])
14966d1874b2Smrgelse
14976d1874b2Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14986d1874b2Smrg		RAWCPPFLAGS=-undef
14996d1874b2Smrg		AC_MSG_RESULT([yes])
15006d1874b2Smrg	# under Cygwin unix is still defined even with -undef
15016d1874b2Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15026d1874b2Smrg		RAWCPPFLAGS="-undef -ansi"
15036d1874b2Smrg		AC_MSG_RESULT([yes, with -ansi])
15046d1874b2Smrg	else
15056d1874b2Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15066d1874b2Smrg	fi
150794a251fdSmrgfi
15086d1874b2Smrgrm -f conftest.$ac_ext
1509e6232409Smrg
15106d1874b2SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15116d1874b2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151261d7a284Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15136d1874b2Smrg	AC_MSG_RESULT([no])
15146d1874b2Smrgelse
151561d7a284Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15166d1874b2Smrg		TRADITIONALCPPFLAGS="-traditional"
15176d1874b2Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15186d1874b2Smrg		AC_MSG_RESULT([yes])
15196d1874b2Smrg	else
15206d1874b2Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15216d1874b2Smrg	fi
15226d1874b2Smrgfi
15236d1874b2Smrgrm -f conftest.$ac_ext
15246d1874b2SmrgAC_SUBST(RAWCPPFLAGS)
15256d1874b2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15266d1874b2Smrg]) # XORG_PROG_RAWCPP
152794a251fdSmrg
15286d1874b2Smrg# XORG_MANPAGE_SECTIONS()
15296d1874b2Smrg# -----------------------
15306d1874b2Smrg# Minimum version: 1.0.0
153194a251fdSmrg#
15326d1874b2Smrg# Determine which sections man pages go in for the different man page types
15336d1874b2Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15346d1874b2Smrg# Not sure if there's any better way than just hardcoding by OS name.
15356d1874b2Smrg# Override default settings by setting environment variables
15366d1874b2Smrg# Added MAN_SUBSTS in version 1.8
15376d1874b2Smrg# Added AC_PROG_SED in version 1.8
1538c05e7a3eSmrg
15396d1874b2SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15406d1874b2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15416d1874b2SmrgAC_REQUIRE([AC_PROG_SED])
154294a251fdSmrg
15436d1874b2Smrgcase $host_os in
15446d1874b2Smrg    solaris*)
15456d1874b2Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15466d1874b2Smrg        # check for a man page file found in later versions that use
15476d1874b2Smrg        # traditional section numbers instead
15486d1874b2Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15496d1874b2Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15506d1874b2Smrg        ;;
15516d1874b2Smrg    *) SYSV_MAN_SECTIONS=false ;;
15526d1874b2Smrgesac
1553c05e7a3eSmrg
15546d1874b2Smrgif test x$APP_MAN_SUFFIX = x    ; then
15556d1874b2Smrg    APP_MAN_SUFFIX=1
15566d1874b2Smrgfi
15576d1874b2Smrgif test x$APP_MAN_DIR = x    ; then
15586d1874b2Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15596d1874b2Smrgfi
1560c05e7a3eSmrg
15616d1874b2Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15626d1874b2Smrg    LIB_MAN_SUFFIX=3
15636d1874b2Smrgfi
15646d1874b2Smrgif test x$LIB_MAN_DIR = x    ; then
15656d1874b2Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15666d1874b2Smrgfi
1567c05e7a3eSmrg
15686d1874b2Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15696d1874b2Smrg    case $SYSV_MAN_SECTIONS in
15706d1874b2Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15716d1874b2Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15726d1874b2Smrg    esac
15736d1874b2Smrgfi
15746d1874b2Smrgif test x$FILE_MAN_DIR = x    ; then
15756d1874b2Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157694a251fdSmrgfi
157794a251fdSmrg
15786d1874b2Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15796d1874b2Smrg    case $SYSV_MAN_SECTIONS in
15806d1874b2Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15816d1874b2Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15826d1874b2Smrg    esac
15836d1874b2Smrgfi
15846d1874b2Smrgif test x$MISC_MAN_DIR = x    ; then
15856d1874b2Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586c05e7a3eSmrgfi
1587e6232409Smrg
15886d1874b2Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15896d1874b2Smrg    case $SYSV_MAN_SECTIONS in
15906d1874b2Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15916d1874b2Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15926d1874b2Smrg    esac
15936d1874b2Smrgfi
15946d1874b2Smrgif test x$DRIVER_MAN_DIR = x    ; then
15956d1874b2Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15966d1874b2Smrgfi
159794a251fdSmrg
15986d1874b2Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15996d1874b2Smrg    case $SYSV_MAN_SECTIONS in
16006d1874b2Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16016d1874b2Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16026d1874b2Smrg    esac
16036d1874b2Smrgfi
16046d1874b2Smrgif test x$ADMIN_MAN_DIR = x    ; then
16056d1874b2Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16066d1874b2Smrgfi
1607c05e7a3eSmrg
1608c05e7a3eSmrg
16096d1874b2SmrgAC_SUBST([APP_MAN_SUFFIX])
16106d1874b2SmrgAC_SUBST([LIB_MAN_SUFFIX])
16116d1874b2SmrgAC_SUBST([FILE_MAN_SUFFIX])
16126d1874b2SmrgAC_SUBST([MISC_MAN_SUFFIX])
16136d1874b2SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16146d1874b2SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16156d1874b2SmrgAC_SUBST([APP_MAN_DIR])
16166d1874b2SmrgAC_SUBST([LIB_MAN_DIR])
16176d1874b2SmrgAC_SUBST([FILE_MAN_DIR])
16186d1874b2SmrgAC_SUBST([MISC_MAN_DIR])
16196d1874b2SmrgAC_SUBST([DRIVER_MAN_DIR])
16206d1874b2SmrgAC_SUBST([ADMIN_MAN_DIR])
1621c05e7a3eSmrg
16226d1874b2SmrgXORG_MAN_PAGE="X Version 11"
16236d1874b2SmrgAC_SUBST([XORG_MAN_PAGE])
16246d1874b2SmrgMAN_SUBSTS="\
16256d1874b2Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16266d1874b2Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16276d1874b2Smrg	-e 's|__xservername__|Xorg|g' \
16286d1874b2Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16296d1874b2Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16306d1874b2Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16316d1874b2Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16326d1874b2Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16336d1874b2Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16346d1874b2Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16356d1874b2Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16366d1874b2Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16376d1874b2SmrgAC_SUBST([MAN_SUBSTS])
1638c05e7a3eSmrg
16396d1874b2Smrg]) # XORG_MANPAGE_SECTIONS
1640c05e7a3eSmrg
16416d1874b2Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16426d1874b2Smrg# ------------------------
16436d1874b2Smrg# Minimum version: 1.7.0
164494a251fdSmrg#
16456d1874b2Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16466d1874b2Smrg# provided by xorg-sgml-doctools, if installed.
16476d1874b2SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16486d1874b2SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16496d1874b2SmrgXORG_SGML_PATH=
16506d1874b2SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16516d1874b2Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16526d1874b2Smrg    [m4_ifval([$1],[:],
16536d1874b2Smrg        [if test x"$cross_compiling" != x"yes" ; then
16546d1874b2Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16556d1874b2Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16566d1874b2Smrg         fi])
16576d1874b2Smrg    ])
16586d1874b2Smrg
16596d1874b2Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16606d1874b2Smrg# the path and the name of the doc stylesheet
16616d1874b2Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16626d1874b2Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16636d1874b2Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16646d1874b2Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16656d1874b2Smrgelse
16666d1874b2Smrg   AC_MSG_RESULT([no])
16676d1874b2Smrgfi
16686d1874b2Smrg
16696d1874b2SmrgAC_SUBST(XORG_SGML_PATH)
16706d1874b2SmrgAC_SUBST(STYLESHEET_SRCDIR)
16716d1874b2SmrgAC_SUBST(XSL_STYLESHEET)
16726d1874b2SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16736d1874b2Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16746d1874b2Smrg
16756d1874b2Smrg# XORG_CHECK_LINUXDOC
16766d1874b2Smrg# -------------------
16776d1874b2Smrg# Minimum version: 1.0.0
167894a251fdSmrg#
16796d1874b2Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16806d1874b2Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16816d1874b2Smrg# Whether or not the necessary tools and files are found can be checked
16826d1874b2Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16836d1874b2SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16846d1874b2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16856d1874b2SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168694a251fdSmrg
16876d1874b2SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688c05e7a3eSmrg
16896d1874b2SmrgAC_MSG_CHECKING([whether to build documentation])
16906d1874b2Smrg
16916d1874b2Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16926d1874b2Smrg   BUILDDOC=yes
16938fff3f40Smrgelse
16946d1874b2Smrg   BUILDDOC=no
1695e6232409Smrgfi
1696e6232409Smrg
16976d1874b2SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698e6232409Smrg
16996d1874b2SmrgAC_MSG_RESULT([$BUILDDOC])
1700c05e7a3eSmrg
17016d1874b2SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17026d1874b2Smrg
17036d1874b2Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17046d1874b2Smrg   BUILDPDFDOC=yes
17056d1874b2Smrgelse
17066d1874b2Smrg   BUILDPDFDOC=no
17076d1874b2Smrgfi
17086d1874b2Smrg
17096d1874b2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17106d1874b2Smrg
17116d1874b2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17126d1874b2Smrg
17136d1874b2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17146d1874b2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17156d1874b2SmrgMAKE_PDF="$PS2PDF"
17166d1874b2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17176d1874b2Smrg
17186d1874b2SmrgAC_SUBST(MAKE_TEXT)
17196d1874b2SmrgAC_SUBST(MAKE_PS)
17206d1874b2SmrgAC_SUBST(MAKE_PDF)
17216d1874b2SmrgAC_SUBST(MAKE_HTML)
17226d1874b2Smrg]) # XORG_CHECK_LINUXDOC
17236d1874b2Smrg
17246d1874b2Smrg# XORG_CHECK_DOCBOOK
17256d1874b2Smrg# -------------------
17266d1874b2Smrg# Minimum version: 1.0.0
17276d1874b2Smrg#
17286d1874b2Smrg# Checks for the ability to build output formats from SGML DocBook source.
17296d1874b2Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17306d1874b2Smrg# indicates whether the necessary tools and files are found and, if set,
17316d1874b2Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17326d1874b2SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17336d1874b2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17346d1874b2Smrg
17356d1874b2SmrgBUILDTXTDOC=no
17366d1874b2SmrgBUILDPDFDOC=no
17376d1874b2SmrgBUILDPSDOC=no
17386d1874b2SmrgBUILDHTMLDOC=no
17396d1874b2Smrg
17406d1874b2SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17416d1874b2SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17426d1874b2SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17436d1874b2SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744c05e7a3eSmrg
17456d1874b2SmrgAC_MSG_CHECKING([whether to build text documentation])
17466d1874b2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17476d1874b2Smrg   test x$BUILD_TXTDOC != xno; then
17486d1874b2Smrg	BUILDTXTDOC=yes
17496d1874b2Smrgfi
17506d1874b2SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17516d1874b2SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752c05e7a3eSmrg
17536d1874b2SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17546d1874b2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17556d1874b2Smrg   test x$BUILD_PDFDOC != xno; then
17566d1874b2Smrg	BUILDPDFDOC=yes
17576d1874b2Smrgfi
17586d1874b2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17596d1874b2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760c05e7a3eSmrg
17616d1874b2SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17626d1874b2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17636d1874b2Smrg   test x$BUILD_PSDOC != xno; then
17646d1874b2Smrg	BUILDPSDOC=yes
1765c05e7a3eSmrgfi
17666d1874b2SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17676d1874b2SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768c05e7a3eSmrg
17696d1874b2SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17706d1874b2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17716d1874b2Smrg   test x$BUILD_HTMLDOC != xno; then
17726d1874b2Smrg	BUILDHTMLDOC=yes
17736d1874b2Smrgfi
17746d1874b2SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17756d1874b2SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776c05e7a3eSmrg
17776d1874b2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17786d1874b2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17796d1874b2SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17806d1874b2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17816d1874b2Smrg
17826d1874b2SmrgAC_SUBST(MAKE_TEXT)
17836d1874b2SmrgAC_SUBST(MAKE_PS)
17846d1874b2SmrgAC_SUBST(MAKE_PDF)
17856d1874b2SmrgAC_SUBST(MAKE_HTML)
17866d1874b2Smrg]) # XORG_CHECK_DOCBOOK
17876d1874b2Smrg
17886d1874b2Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17896d1874b2Smrg# ----------------
17906d1874b2Smrg# Minimum version: 1.5.0
17916d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179294a251fdSmrg#
17936d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
17946d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
17956d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179661d7a284Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17976d1874b2Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17986d1874b2Smrg# --with-xmlto assumes 'auto'.
179994a251fdSmrg#
18006d1874b2Smrg# Interface to module:
18016d1874b2Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18026d1874b2Smrg# XMLTO:	returns the path of the xmlto program found
18036d1874b2Smrg#		returns the path set by the user in the environment
18046d1874b2Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18056d1874b2Smrg#		'no' user instructs the module not to use xmlto
180694a251fdSmrg#
18076d1874b2Smrg# Added in version 1.10.0
18086d1874b2Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18096d1874b2Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181094a251fdSmrg#
18116d1874b2Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181294a251fdSmrg#
18136d1874b2SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18146d1874b2SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18156d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
18166d1874b2SmrgAC_ARG_WITH(xmlto,
18176d1874b2Smrg	AS_HELP_STRING([--with-xmlto],
18186d1874b2Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18196d1874b2Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18206d1874b2Smrgm4_undefine([_defopt])
182194a251fdSmrg
18226d1874b2Smrgif test "x$use_xmlto" = x"auto"; then
18236d1874b2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18246d1874b2Smrg   if test "x$XMLTO" = "x"; then
18256d1874b2Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18266d1874b2Smrg	have_xmlto=no
18276d1874b2Smrg   else
18286d1874b2Smrg        have_xmlto=yes
18296d1874b2Smrg   fi
18306d1874b2Smrgelif test "x$use_xmlto" = x"yes" ; then
18316d1874b2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18326d1874b2Smrg   if test "x$XMLTO" = "x"; then
18336d1874b2Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18346d1874b2Smrg   fi
18356d1874b2Smrg   have_xmlto=yes
18366d1874b2Smrgelif test "x$use_xmlto" = x"no" ; then
18376d1874b2Smrg   if test "x$XMLTO" != "x"; then
18386d1874b2Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18396d1874b2Smrg   fi
18406d1874b2Smrg   have_xmlto=no
18416d1874b2Smrgelse
18426d1874b2Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18436d1874b2Smrgfi
1844e6232409Smrg
18456d1874b2Smrg# Test for a minimum version of xmlto, if provided.
18466d1874b2Smrgm4_ifval([$1],
18476d1874b2Smrg[if test "$have_xmlto" = yes; then
18486d1874b2Smrg    # scrape the xmlto version
18496d1874b2Smrg    AC_MSG_CHECKING([the xmlto version])
18506d1874b2Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18516d1874b2Smrg    AC_MSG_RESULT([$xmlto_version])
18526d1874b2Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18536d1874b2Smrg        [if test "x$use_xmlto" = xauto; then
18546d1874b2Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18556d1874b2Smrg            have_xmlto=no
18566d1874b2Smrg        else
18576d1874b2Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18586d1874b2Smrg        fi])
18596d1874b2Smrgfi])
1860e6232409Smrg
18616d1874b2Smrg# Test for the ability of xmlto to generate a text target
18626d1874b2Smrg#
18636d1874b2Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18646d1874b2Smrg# following test for empty XML docbook files.
18656d1874b2Smrg# For compatibility reasons use the following empty XML docbook file and if
18666d1874b2Smrg# it fails try it again with a non-empty XML file.
18676d1874b2Smrghave_xmlto_text=no
18686d1874b2Smrgcat > conftest.xml << "EOF"
18696d1874b2SmrgEOF
18706d1874b2SmrgAS_IF([test "$have_xmlto" = yes],
18716d1874b2Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18726d1874b2Smrg             [have_xmlto_text=yes],
18736d1874b2Smrg             [# Try it again with a non-empty XML file.
18746d1874b2Smrg              cat > conftest.xml << "EOF"
18756d1874b2Smrg<x></x>
18766d1874b2SmrgEOF
18776d1874b2Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18786d1874b2Smrg                    [have_xmlto_text=yes],
18796d1874b2Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18806d1874b2Smrgrm -f conftest.xml
18816d1874b2SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18826d1874b2SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18836d1874b2Smrg]) # XORG_WITH_XMLTO
1884c05e7a3eSmrg
18856d1874b2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18866d1874b2Smrg# --------------------------------------------
18876d1874b2Smrg# Minimum version: 1.12.0
18886d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18896d1874b2Smrg#
18906d1874b2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18916d1874b2Smrg# XML-based language used for the transformation of XML documents.
18926d1874b2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18936d1874b2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18946d1874b2Smrg# The XSLT processor is often used as a standalone tool for transformations.
18956d1874b2Smrg# It should not be assumed that this tool is used only to work with documnetation.
18966d1874b2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18976d1874b2Smrg#
18986d1874b2Smrg# Interface to module:
18996d1874b2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19006d1874b2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19016d1874b2Smrg#		 returns the path set by the user in the environment
19026d1874b2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19036d1874b2Smrg#		  'no' user instructs the module not to use xsltproc
19046d1874b2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19056d1874b2Smrg#
19066d1874b2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19076d1874b2Smrg#
19086d1874b2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19096d1874b2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19106d1874b2Smrg# Preserves the interface, should it be implemented later
19116d1874b2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19126d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
19136d1874b2SmrgAC_ARG_WITH(xsltproc,
19146d1874b2Smrg	AS_HELP_STRING([--with-xsltproc],
19156d1874b2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19166d1874b2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19176d1874b2Smrgm4_undefine([_defopt])
1918c05e7a3eSmrg
19196d1874b2Smrgif test "x$use_xsltproc" = x"auto"; then
19206d1874b2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19216d1874b2Smrg   if test "x$XSLTPROC" = "x"; then
19226d1874b2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19236d1874b2Smrg	have_xsltproc=no
19246d1874b2Smrg   else
19256d1874b2Smrg        have_xsltproc=yes
19266d1874b2Smrg   fi
19276d1874b2Smrgelif test "x$use_xsltproc" = x"yes" ; then
19286d1874b2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19296d1874b2Smrg   if test "x$XSLTPROC" = "x"; then
19306d1874b2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19316d1874b2Smrg   fi
19326d1874b2Smrg   have_xsltproc=yes
19336d1874b2Smrgelif test "x$use_xsltproc" = x"no" ; then
19346d1874b2Smrg   if test "x$XSLTPROC" != "x"; then
19356d1874b2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19366d1874b2Smrg   fi
19376d1874b2Smrg   have_xsltproc=no
19386d1874b2Smrgelse
19396d1874b2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940c05e7a3eSmrgfi
1941c05e7a3eSmrg
19426d1874b2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19436d1874b2Smrg]) # XORG_WITH_XSLTPROC
19446d1874b2Smrg
19456d1874b2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19466d1874b2Smrg# ----------------------------------------
19476d1874b2Smrg# Minimum version: 1.15.0
1948e6232409Smrg#
19496d1874b2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19506d1874b2Smrg# scanning arbitrary text files, extracting information from those text files,
19516d1874b2Smrg# and printing reports based on that information.
195294a251fdSmrg#
19536d1874b2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195494a251fdSmrg#
19556d1874b2Smrg# Interface to module:
19566d1874b2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19576d1874b2Smrg# PERL:	     returns the path of the perl program found
19586d1874b2Smrg#	     returns the path set by the user in the environment
19596d1874b2Smrg# --with-perl: 'yes' user instructs the module to use perl
19606d1874b2Smrg#	       'no' user instructs the module not to use perl
19616d1874b2Smrg# have_perl: returns yes if perl found in PATH or no
196294a251fdSmrg#
19636d1874b2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19646d1874b2Smrg#
19656d1874b2SmrgAC_DEFUN([XORG_WITH_PERL],[
19666d1874b2SmrgAC_ARG_VAR([PERL], [Path to perl command])
19676d1874b2Smrg# Preserves the interface, should it be implemented later
19686d1874b2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19696d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
19706d1874b2SmrgAC_ARG_WITH(perl,
19716d1874b2Smrg	AS_HELP_STRING([--with-perl],
19726d1874b2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19736d1874b2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19746d1874b2Smrgm4_undefine([_defopt])
1975e6232409Smrg
19766d1874b2Smrgif test "x$use_perl" = x"auto"; then
19776d1874b2Smrg   AC_PATH_PROG([PERL], [perl])
19786d1874b2Smrg   if test "x$PERL" = "x"; then
19796d1874b2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19806d1874b2Smrg	have_perl=no
19816d1874b2Smrg   else
19826d1874b2Smrg        have_perl=yes
19836d1874b2Smrg   fi
19846d1874b2Smrgelif test "x$use_perl" = x"yes" ; then
19856d1874b2Smrg   AC_PATH_PROG([PERL], [perl])
19866d1874b2Smrg   if test "x$PERL" = "x"; then
19876d1874b2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19886d1874b2Smrg   fi
19896d1874b2Smrg   have_perl=yes
19906d1874b2Smrgelif test "x$use_perl" = x"no" ; then
19916d1874b2Smrg   if test "x$PERL" != "x"; then
19926d1874b2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19936d1874b2Smrg   fi
19946d1874b2Smrg   have_perl=no
19956d1874b2Smrgelse
19966d1874b2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19976d1874b2Smrgfi
1998c05e7a3eSmrg
19996d1874b2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20006d1874b2Smrg]) # XORG_WITH_PERL
2001c05e7a3eSmrg
20026d1874b2Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003c05e7a3eSmrg# ----------------
20046d1874b2Smrg# Minimum version: 1.5.0
20056d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200694a251fdSmrg#
20076d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
20086d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
20096d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201061d7a284Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20116d1874b2Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20126d1874b2Smrg# --with-asciidoc assumes 'auto'.
201394a251fdSmrg#
20146d1874b2Smrg# Interface to module:
20156d1874b2Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20166d1874b2Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20176d1874b2Smrg#		 returns the path set by the user in the environment
20186d1874b2Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20196d1874b2Smrg#		  'no' user instructs the module not to use asciidoc
202094a251fdSmrg#
20216d1874b2Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202294a251fdSmrg#
20236d1874b2SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20246d1874b2SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20256d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
20266d1874b2SmrgAC_ARG_WITH(asciidoc,
20276d1874b2Smrg	AS_HELP_STRING([--with-asciidoc],
20286d1874b2Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20296d1874b2Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20306d1874b2Smrgm4_undefine([_defopt])
2031c05e7a3eSmrg
20326d1874b2Smrgif test "x$use_asciidoc" = x"auto"; then
20336d1874b2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20346d1874b2Smrg   if test "x$ASCIIDOC" = "x"; then
20356d1874b2Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20366d1874b2Smrg	have_asciidoc=no
20376d1874b2Smrg   else
20386d1874b2Smrg        have_asciidoc=yes
20396d1874b2Smrg   fi
20406d1874b2Smrgelif test "x$use_asciidoc" = x"yes" ; then
20416d1874b2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20426d1874b2Smrg   if test "x$ASCIIDOC" = "x"; then
20436d1874b2Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20446d1874b2Smrg   fi
20456d1874b2Smrg   have_asciidoc=yes
20466d1874b2Smrgelif test "x$use_asciidoc" = x"no" ; then
20476d1874b2Smrg   if test "x$ASCIIDOC" != "x"; then
20486d1874b2Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20496d1874b2Smrg   fi
20506d1874b2Smrg   have_asciidoc=no
20516d1874b2Smrgelse
20526d1874b2Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20536d1874b2Smrgfi
20546d1874b2Smrgm4_ifval([$1],
20556d1874b2Smrg[if test "$have_asciidoc" = yes; then
20566d1874b2Smrg    # scrape the asciidoc version
20576d1874b2Smrg    AC_MSG_CHECKING([the asciidoc version])
20586d1874b2Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20596d1874b2Smrg    AC_MSG_RESULT([$asciidoc_version])
20606d1874b2Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20616d1874b2Smrg        [if test "x$use_asciidoc" = xauto; then
20626d1874b2Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20636d1874b2Smrg            have_asciidoc=no
20646d1874b2Smrg        else
20656d1874b2Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20666d1874b2Smrg        fi])
20676d1874b2Smrgfi])
20686d1874b2SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20696d1874b2Smrg]) # XORG_WITH_ASCIIDOC
2070c05e7a3eSmrg
20716d1874b2Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20726d1874b2Smrg# -------------------------------------------
20736d1874b2Smrg# Minimum version: 1.5.0
20746d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20756d1874b2Smrg# Minimum version for optional DOT checking: 1.18.0
2076e6232409Smrg#
20776d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
20786d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
20796d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208061d7a284Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20816d1874b2Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20826d1874b2Smrg# --with-doxygen assumes 'auto'.
208394a251fdSmrg#
20846d1874b2Smrg# Interface to module:
20856d1874b2Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20866d1874b2Smrg# DOXYGEN:	 returns the path of the doxygen program found
20876d1874b2Smrg#		 returns the path set by the user in the environment
20886d1874b2Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20896d1874b2Smrg#		  'no' user instructs the module not to use doxygen
209094a251fdSmrg#
20916d1874b2Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092c05e7a3eSmrg#
20936d1874b2SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20946d1874b2SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20956d1874b2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20966d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
20976d1874b2SmrgAC_ARG_WITH(doxygen,
20986d1874b2Smrg	AS_HELP_STRING([--with-doxygen],
20996d1874b2Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21006d1874b2Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21016d1874b2Smrgm4_undefine([_defopt])
2102c05e7a3eSmrg
21036d1874b2Smrgif test "x$use_doxygen" = x"auto"; then
21046d1874b2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21056d1874b2Smrg   if test "x$DOXYGEN" = "x"; then
21066d1874b2Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21076d1874b2Smrg	have_doxygen=no
21086d1874b2Smrg   else
21096d1874b2Smrg        have_doxygen=yes
21106d1874b2Smrg   fi
21116d1874b2Smrgelif test "x$use_doxygen" = x"yes" ; then
21126d1874b2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21136d1874b2Smrg   if test "x$DOXYGEN" = "x"; then
21146d1874b2Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21156d1874b2Smrg   fi
21166d1874b2Smrg   have_doxygen=yes
21176d1874b2Smrgelif test "x$use_doxygen" = x"no" ; then
21186d1874b2Smrg   if test "x$DOXYGEN" != "x"; then
21196d1874b2Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21206d1874b2Smrg   fi
21216d1874b2Smrg   have_doxygen=no
212294a251fdSmrgelse
21236d1874b2Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124e6232409Smrgfi
21256d1874b2Smrgm4_ifval([$1],
21266d1874b2Smrg[if test "$have_doxygen" = yes; then
21276d1874b2Smrg    # scrape the doxygen version
21286d1874b2Smrg    AC_MSG_CHECKING([the doxygen version])
21296d1874b2Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21306d1874b2Smrg    AC_MSG_RESULT([$doxygen_version])
21316d1874b2Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21326d1874b2Smrg        [if test "x$use_doxygen" = xauto; then
21336d1874b2Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21346d1874b2Smrg            have_doxygen=no
21356d1874b2Smrg        else
21366d1874b2Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21376d1874b2Smrg        fi])
21386d1874b2Smrgfi])
21398fff3f40Smrg
21406d1874b2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21416d1874b2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21426d1874b2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21436d1874b2SmrgHAVE_DOT=no
21446d1874b2Smrgif test "x$have_doxygen" = "xyes"; then
21456d1874b2Smrg  AC_PATH_PROG([DOT], [dot])
21466d1874b2Smrg    if test "x$DOT" != "x"; then
21476d1874b2Smrg      HAVE_DOT=yes
21486d1874b2Smrg    fi
21496d1874b2Smrgfi
21508fff3f40Smrg
21516d1874b2SmrgAC_SUBST([HAVE_DOT])
21526d1874b2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21536d1874b2SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21546d1874b2Smrg]) # XORG_WITH_DOXYGEN
2155c05e7a3eSmrg
21566d1874b2Smrg# XORG_WITH_GROFF([DEFAULT])
21576d1874b2Smrg# ----------------
21586d1874b2Smrg# Minimum version: 1.6.0
21596d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216094a251fdSmrg#
21616d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
21626d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
21636d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216461d7a284Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21656d1874b2Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21666d1874b2Smrg# --with-groff assumes 'auto'.
21676d1874b2Smrg#
21686d1874b2Smrg# Interface to module:
21696d1874b2Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21706d1874b2Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21716d1874b2Smrg# HAVE_GROFF_MS: the -ms macros package
21726d1874b2Smrg# GROFF:	 returns the path of the groff program found
21736d1874b2Smrg#		 returns the path set by the user in the environment
21746d1874b2Smrg# --with-groff:	 'yes' user instructs the module to use groff
21756d1874b2Smrg#		 'no' user instructs the module not to use groff
21766d1874b2Smrg#
21776d1874b2Smrg# Added in version 1.9.0:
21786d1874b2Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21796d1874b2Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21806d1874b2Smrg#		   psselect from the psutils package.
21816d1874b2Smrg#		   the ghostcript package. Refer to the grohtml man pages
21826d1874b2Smrg#
21836d1874b2Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21846d1874b2Smrg#
21856d1874b2Smrg# OS and distros often splits groff in a basic and full package, the former
21866d1874b2Smrg# having the groff program and the later having devices, fonts and macros
21876d1874b2Smrg# Checking for the groff executable is not enough.
21886d1874b2Smrg#
21896d1874b2Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21906d1874b2Smrg# unset HAVE_GROFF or GROFF env variables.
21916d1874b2Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21926d1874b2Smrg#
21936d1874b2SmrgAC_DEFUN([XORG_WITH_GROFF],[
21946d1874b2SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21956d1874b2Smrgm4_define([_defopt], m4_default([$1], [auto]))
21966d1874b2SmrgAC_ARG_WITH(groff,
21976d1874b2Smrg	AS_HELP_STRING([--with-groff],
21986d1874b2Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21996d1874b2Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22006d1874b2Smrgm4_undefine([_defopt])
22016a45684fSmrg
22026d1874b2Smrgif test "x$use_groff" = x"auto"; then
22036d1874b2Smrg   AC_PATH_PROG([GROFF], [groff])
22046d1874b2Smrg   if test "x$GROFF" = "x"; then
22056d1874b2Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22066d1874b2Smrg	have_groff=no
22076d1874b2Smrg   else
22086d1874b2Smrg        have_groff=yes
22096d1874b2Smrg   fi
22106d1874b2Smrgelif test "x$use_groff" = x"yes" ; then
22116d1874b2Smrg   AC_PATH_PROG([GROFF], [groff])
22126d1874b2Smrg   if test "x$GROFF" = "x"; then
22136d1874b2Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22146d1874b2Smrg   fi
22156d1874b2Smrg   have_groff=yes
22166d1874b2Smrgelif test "x$use_groff" = x"no" ; then
22176d1874b2Smrg   if test "x$GROFF" != "x"; then
22186d1874b2Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22196d1874b2Smrg   fi
22206d1874b2Smrg   have_groff=no
22216d1874b2Smrgelse
22226d1874b2Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22236d1874b2Smrgfi
22246a45684fSmrg
22256d1874b2Smrg# We have groff, test for the presence of the macro packages
22266d1874b2Smrgif test "x$have_groff" = x"yes"; then
22276d1874b2Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22286d1874b2Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22296d1874b2Smrg        groff_ms_works=yes
22306d1874b2Smrg    else
22316d1874b2Smrg        groff_ms_works=no
2232c05e7a3eSmrg    fi
22336d1874b2Smrg    AC_MSG_RESULT([$groff_ms_works])
22346d1874b2Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22356d1874b2Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22366d1874b2Smrg        groff_mm_works=yes
22376d1874b2Smrg    else
22386d1874b2Smrg        groff_mm_works=no
22396d1874b2Smrg    fi
22406d1874b2Smrg    AC_MSG_RESULT([$groff_mm_works])
22416d1874b2Smrgfi
22428fff3f40Smrg
22436d1874b2Smrg# We have groff, test for HTML dependencies, one command per package
22446d1874b2Smrgif test "x$have_groff" = x"yes"; then
22456d1874b2Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22466d1874b2Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22476d1874b2Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22486d1874b2Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22496d1874b2Smrg      have_groff_html=yes
22506d1874b2Smrg   else
22516d1874b2Smrg      have_groff_html=no
22526d1874b2Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22536d1874b2Smrg   fi
22546d1874b2Smrgfi
22556d1874b2Smrg
22566d1874b2Smrg# Set Automake conditionals for Makefiles
22576d1874b2SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22586d1874b2SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22596d1874b2SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22606d1874b2SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22616d1874b2Smrg]) # XORG_WITH_GROFF
22626d1874b2Smrg
22636d1874b2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22646d1874b2Smrg# ---------------------------------------
22656d1874b2Smrg# Minimum version: 1.6.0
22666d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22676d1874b2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22686d1874b2Smrg#
22696d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
22706d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
22716d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227261d7a284Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22736d1874b2Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22746d1874b2Smrg# --with-fop assumes 'auto'.
22756d1874b2Smrg#
22766d1874b2Smrg# Interface to module:
22776d1874b2Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22786d1874b2Smrg# FOP:	 	returns the path of the fop program found
22796d1874b2Smrg#		returns the path set by the user in the environment
22806d1874b2Smrg# --with-fop: 	'yes' user instructs the module to use fop
22816d1874b2Smrg#		'no' user instructs the module not to use fop
22826d1874b2Smrg#
22836d1874b2Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22846d1874b2Smrg#
22856d1874b2SmrgAC_DEFUN([XORG_WITH_FOP],[
22866d1874b2SmrgAC_ARG_VAR([FOP], [Path to fop command])
22876d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
22886d1874b2SmrgAC_ARG_WITH(fop,
22896d1874b2Smrg	AS_HELP_STRING([--with-fop],
22906d1874b2Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22916d1874b2Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22926d1874b2Smrgm4_undefine([_defopt])
22936d1874b2Smrg
22946d1874b2Smrgif test "x$use_fop" = x"auto"; then
22956d1874b2Smrg   AC_PATH_PROG([FOP], [fop])
22966d1874b2Smrg   if test "x$FOP" = "x"; then
22976d1874b2Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22986d1874b2Smrg	have_fop=no
22996d1874b2Smrg   else
23006d1874b2Smrg        have_fop=yes
23016d1874b2Smrg   fi
23026d1874b2Smrgelif test "x$use_fop" = x"yes" ; then
23036d1874b2Smrg   AC_PATH_PROG([FOP], [fop])
23046d1874b2Smrg   if test "x$FOP" = "x"; then
23056d1874b2Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23066d1874b2Smrg   fi
23076d1874b2Smrg   have_fop=yes
23086d1874b2Smrgelif test "x$use_fop" = x"no" ; then
23096d1874b2Smrg   if test "x$FOP" != "x"; then
23106d1874b2Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23116d1874b2Smrg   fi
23126d1874b2Smrg   have_fop=no
23138fff3f40Smrgelse
23146d1874b2Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23158fff3f40Smrgfi
23168fff3f40Smrg
23176d1874b2Smrg# Test for a minimum version of fop, if provided.
23186d1874b2Smrgm4_ifval([$1],
23196d1874b2Smrg[if test "$have_fop" = yes; then
23206d1874b2Smrg    # scrape the fop version
23216d1874b2Smrg    AC_MSG_CHECKING([for fop minimum version])
23226d1874b2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23236d1874b2Smrg    AC_MSG_RESULT([$fop_version])
23246d1874b2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23256d1874b2Smrg        [if test "x$use_fop" = xauto; then
23266d1874b2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23276d1874b2Smrg            have_fop=no
23286d1874b2Smrg        else
23296d1874b2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23306d1874b2Smrg        fi])
23316d1874b2Smrgfi])
23326d1874b2SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23336d1874b2Smrg]) # XORG_WITH_FOP
23346d1874b2Smrg
23356d1874b2Smrg# XORG_WITH_M4([MIN-VERSION])
23366d1874b2Smrg# ---------------------------
23376d1874b2Smrg# Minimum version: 1.19.0
23386d1874b2Smrg#
23396d1874b2Smrg# This macro attempts to locate an m4 macro processor which supports
23406d1874b2Smrg# -I option and is only useful for modules relying on M4 in order to
23416d1874b2Smrg# expand macros in source code files.
23426d1874b2Smrg#
23436d1874b2Smrg# Interface to module:
23446d1874b2Smrg# M4:	 	returns the path of the m4 program found
23456d1874b2Smrg#		returns the path set by the user in the environment
23466d1874b2Smrg#
23476d1874b2SmrgAC_DEFUN([XORG_WITH_M4], [
23486d1874b2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23496d1874b2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23506d1874b2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23516d1874b2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23526d1874b2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23536d1874b2Smrg   [$PATH:/usr/gnu/bin])])
23548fff3f40Smrg
23556d1874b2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23566d1874b2Smrg]) # XORG_WITH_M4
2357c05e7a3eSmrg
23586d1874b2Smrg# XORG_WITH_PS2PDF([DEFAULT])
23596d1874b2Smrg# ----------------
23606d1874b2Smrg# Minimum version: 1.6.0
23616d1874b2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23626d1874b2Smrg#
23636d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
23646d1874b2Smrg# not at the appropriate level. This macro enables a module to test for the
23656d1874b2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236661d7a284Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23676d1874b2Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23686d1874b2Smrg# --with-ps2pdf assumes 'auto'.
23696d1874b2Smrg#
23706d1874b2Smrg# Interface to module:
23716d1874b2Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23726d1874b2Smrg# PS2PDF:	returns the path of the ps2pdf program found
23736d1874b2Smrg#		returns the path set by the user in the environment
23746d1874b2Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23756d1874b2Smrg#		 'no' user instructs the module not to use ps2pdf
23766d1874b2Smrg#
23776d1874b2Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23786d1874b2Smrg#
23796d1874b2SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23806d1874b2SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23816d1874b2Smrgm4_define([_defopt], m4_default([$1], [auto]))
23826d1874b2SmrgAC_ARG_WITH(ps2pdf,
23836d1874b2Smrg	AS_HELP_STRING([--with-ps2pdf],
23846d1874b2Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23856d1874b2Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23866d1874b2Smrgm4_undefine([_defopt])
2387c05e7a3eSmrg
23886d1874b2Smrgif test "x$use_ps2pdf" = x"auto"; then
23896d1874b2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23906d1874b2Smrg   if test "x$PS2PDF" = "x"; then
23916d1874b2Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23926d1874b2Smrg	have_ps2pdf=no
23936d1874b2Smrg   else
23946d1874b2Smrg        have_ps2pdf=yes
23956d1874b2Smrg   fi
23966d1874b2Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23976d1874b2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23986d1874b2Smrg   if test "x$PS2PDF" = "x"; then
23996d1874b2Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24006d1874b2Smrg   fi
24016d1874b2Smrg   have_ps2pdf=yes
24026d1874b2Smrgelif test "x$use_ps2pdf" = x"no" ; then
24036d1874b2Smrg   if test "x$PS2PDF" != "x"; then
24046d1874b2Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24056d1874b2Smrg   fi
24066d1874b2Smrg   have_ps2pdf=no
24076d1874b2Smrgelse
24086d1874b2Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409c05e7a3eSmrgfi
24106d1874b2SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24116d1874b2Smrg]) # XORG_WITH_PS2PDF
24128fff3f40Smrg
24136d1874b2Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24146d1874b2Smrg# ----------------
24156d1874b2Smrg# Minimum version: 1.6.0
241694a251fdSmrg#
24176d1874b2Smrg# Documentation tools are not always available on all platforms and sometimes
24186d1874b2Smrg# not at the appropriate level. This macro enables a builder to skip all
24196d1874b2Smrg# documentation targets except traditional man pages.
24206d1874b2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242161d7a284Smrg# maximum flexibility in controlling documentation building.
24226d1874b2Smrg# Refer to:
24236d1874b2Smrg# XORG_WITH_XMLTO         --with-xmlto
24246d1874b2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24256d1874b2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24266d1874b2Smrg# XORG_WITH_FOP           --with-fop
24276d1874b2Smrg# XORG_WITH_GROFF         --with-groff
24286d1874b2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24296d1874b2Smrg#
24306d1874b2Smrg# Interface to module:
24316d1874b2Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24326d1874b2Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24336d1874b2Smrg#		 'no' user instructs the module not to generate docs
24346d1874b2Smrg# parm1:	specify the default value, yes or no.
24356d1874b2Smrg#
24366d1874b2SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24376d1874b2Smrgm4_define([docs_default], m4_default([$1], [yes]))
24386d1874b2SmrgAC_ARG_ENABLE(docs,
24396d1874b2Smrg	AS_HELP_STRING([--enable-docs],
24406d1874b2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24416d1874b2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24426d1874b2Smrgm4_undefine([docs_default])
24436d1874b2SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24446d1874b2SmrgAC_MSG_CHECKING([whether to build documentation])
24456d1874b2SmrgAC_MSG_RESULT([$build_docs])
24466d1874b2Smrg]) # XORG_ENABLE_DOCS
244794a251fdSmrg
24486d1874b2Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24496d1874b2Smrg# ----------------
24506d1874b2Smrg# Minimum version: 1.6.0
24516d1874b2Smrg#
24526d1874b2Smrg# This macro enables a builder to skip all developer documentation.
24536d1874b2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245461d7a284Smrg# maximum flexibility in controlling documentation building.
24556d1874b2Smrg# Refer to:
24566d1874b2Smrg# XORG_WITH_XMLTO         --with-xmlto
24576d1874b2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24586d1874b2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24596d1874b2Smrg# XORG_WITH_FOP           --with-fop
24606d1874b2Smrg# XORG_WITH_GROFF         --with-groff
24616d1874b2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24626d1874b2Smrg#
24636d1874b2Smrg# Interface to module:
24646d1874b2Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24656d1874b2Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24666d1874b2Smrg#			'no' user instructs the module not to generate developer docs
24676d1874b2Smrg# parm1:		specify the default value, yes or no.
24686d1874b2Smrg#
24696d1874b2SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24706d1874b2Smrgm4_define([devel_default], m4_default([$1], [yes]))
24716d1874b2SmrgAC_ARG_ENABLE(devel-docs,
24726d1874b2Smrg	AS_HELP_STRING([--enable-devel-docs],
24736d1874b2Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24746d1874b2Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24756d1874b2Smrgm4_undefine([devel_default])
24766d1874b2SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24776d1874b2SmrgAC_MSG_CHECKING([whether to build developer documentation])
24786d1874b2SmrgAC_MSG_RESULT([$build_devel_docs])
24796d1874b2Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480c05e7a3eSmrg
24816d1874b2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24826d1874b2Smrg# ----------------
24836d1874b2Smrg# Minimum version: 1.6.0
24846d1874b2Smrg#
24856d1874b2Smrg# This macro enables a builder to skip all functional specification targets.
24866d1874b2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248761d7a284Smrg# maximum flexibility in controlling documentation building.
24886d1874b2Smrg# Refer to:
24896d1874b2Smrg# XORG_WITH_XMLTO         --with-xmlto
24906d1874b2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24916d1874b2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24926d1874b2Smrg# XORG_WITH_FOP           --with-fop
24936d1874b2Smrg# XORG_WITH_GROFF         --with-groff
24946d1874b2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24956d1874b2Smrg#
24966d1874b2Smrg# Interface to module:
24976d1874b2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24986d1874b2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24996d1874b2Smrg#			'no' user instructs the module not to generate specs
25006d1874b2Smrg# parm1:		specify the default value, yes or no.
25016d1874b2Smrg#
25026d1874b2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25036d1874b2Smrgm4_define([spec_default], m4_default([$1], [yes]))
25046d1874b2SmrgAC_ARG_ENABLE(specs,
25056d1874b2Smrg	AS_HELP_STRING([--enable-specs],
25066d1874b2Smrg	   [Enable building the specs (default: ]spec_default[)]),
25076d1874b2Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25086d1874b2Smrgm4_undefine([spec_default])
25096d1874b2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25106d1874b2SmrgAC_MSG_CHECKING([whether to build functional specifications])
25116d1874b2SmrgAC_MSG_RESULT([$build_specs])
25126d1874b2Smrg]) # XORG_ENABLE_SPECS
2513c05e7a3eSmrg
25146d1874b2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25156d1874b2Smrg# ----------------------------------------------
25166d1874b2Smrg# Minimum version: 1.13.0
251794a251fdSmrg#
25186d1874b2Smrg# This macro enables a builder to enable/disable unit testing
25196d1874b2Smrg# It makes no assumption about the test cases implementation
25206d1874b2Smrg# Test cases may or may not use Automake "Support for test suites"
25216d1874b2Smrg# They may or may not use the software utility library GLib
25226d1874b2Smrg#
25236d1874b2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25246d1874b2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25256d1874b2Smrg# The variable enable_unit_tests is used by other macros in this file.
25266d1874b2Smrg#
25276d1874b2Smrg# Interface to module:
25286d1874b2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25296d1874b2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25306d1874b2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25316d1874b2Smrg#			'no' user instructs the module not to build tests
25326d1874b2Smrg# parm1:		specify the default value, yes or no.
25336d1874b2Smrg#
25346d1874b2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25356d1874b2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25366d1874b2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25376d1874b2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25386d1874b2Smrgm4_define([_defopt], m4_default([$1], [auto]))
25396d1874b2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25406d1874b2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25416d1874b2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25426d1874b2Smrgm4_undefine([_defopt])
25436d1874b2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25446d1874b2SmrgAC_MSG_CHECKING([whether to build unit test cases])
25456d1874b2SmrgAC_MSG_RESULT([$enable_unit_tests])
25466d1874b2Smrg]) # XORG_ENABLE_UNIT_TESTS
2547c05e7a3eSmrg
25486d1874b2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25496d1874b2Smrg# ------------------------------------------------------
25506d1874b2Smrg# Minimum version: 1.17.0
25516d1874b2Smrg#
25526d1874b2Smrg# This macro enables a builder to enable/disable integration testing
25536d1874b2Smrg# It makes no assumption about the test cases' implementation
25546d1874b2Smrg# Test cases may or may not use Automake "Support for test suites"
25556d1874b2Smrg#
25566d1874b2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25576d1874b2Smrg# usually requires less dependencies and may be built and run under less
25586d1874b2Smrg# stringent environments than integration tests.
25596d1874b2Smrg#
25606d1874b2Smrg# Interface to module:
25616d1874b2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25626d1874b2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25636d1874b2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25646d1874b2Smrg#                             'no' user instructs the module not to build tests
25656d1874b2Smrg# parm1:                      specify the default value, yes or no.
25666d1874b2Smrg#
25676d1874b2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25686d1874b2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25696d1874b2Smrgm4_define([_defopt], m4_default([$1], [auto]))
25706d1874b2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25716d1874b2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25726d1874b2Smrg	[enable_integration_tests=$enableval],
25736d1874b2Smrg	[enable_integration_tests=]_defopt)
25746d1874b2Smrgm4_undefine([_defopt])
25756d1874b2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25766d1874b2Smrg	[test "x$enable_integration_tests" != xno])
25776d1874b2SmrgAC_MSG_CHECKING([whether to build unit test cases])
25786d1874b2SmrgAC_MSG_RESULT([$enable_integration_tests])
25796d1874b2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580c05e7a3eSmrg
25816d1874b2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25826d1874b2Smrg# ----------------------------------------
25836d1874b2Smrg# Minimum version: 1.13.0
25846d1874b2Smrg#
25856d1874b2Smrg# GLib is a library which provides advanced data structures and functions.
25866d1874b2Smrg# This macro enables a module to test for the presence of Glib.
25876d1874b2Smrg#
25886d1874b2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25896d1874b2Smrg# Otherwise the value of $enable_unit_tests is blank.
25906d1874b2Smrg#
25916d1874b2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25926d1874b2Smrg# test support usually requires less dependencies and may be built and run under
25936d1874b2Smrg# less stringent environments than integration tests.
259494a251fdSmrg#
25956d1874b2Smrg# Interface to module:
25966d1874b2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25976d1874b2Smrg# with_glib: used in configure.ac to know if GLib has been found
25986d1874b2Smrg# --with-glib:	'yes' user instructs the module to use glib
25996d1874b2Smrg#		'no' user instructs the module not to use glib
26006d1874b2Smrg#
26016d1874b2SmrgAC_DEFUN([XORG_WITH_GLIB],[
26026d1874b2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26036d1874b2Smrgm4_define([_defopt], m4_default([$2], [auto]))
26046d1874b2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26056d1874b2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26066d1874b2Smrg	[with_glib=$withval], [with_glib=]_defopt)
26076d1874b2Smrgm4_undefine([_defopt])
26088fff3f40Smrg
26096d1874b2Smrghave_glib=no
26106d1874b2Smrg# Do not probe GLib if user explicitly disabled unit testing
26116d1874b2Smrgif test "x$enable_unit_tests" != x"no"; then
26126d1874b2Smrg  # Do not probe GLib if user explicitly disabled it
26136d1874b2Smrg  if test "x$with_glib" != x"no"; then
26146d1874b2Smrg    m4_ifval(
26156d1874b2Smrg      [$1],
26166d1874b2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26176d1874b2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26186d1874b2Smrg    )
261994a251fdSmrg  fi
262094a251fdSmrgfi
262194a251fdSmrg
26226d1874b2Smrg# Not having GLib when unit testing has been explicitly requested is an error
26236d1874b2Smrgif test "x$enable_unit_tests" = x"yes"; then
26246d1874b2Smrg  if test "x$have_glib" = x"no"; then
26256d1874b2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262694a251fdSmrg  fi
262794a251fdSmrgfi
26288fff3f40Smrg
26296d1874b2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26306d1874b2Smrgif test "x$enable_unit_tests" = x"no"; then
26316d1874b2Smrg  if test "x$with_glib" = x"yes"; then
26326d1874b2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26336d1874b2Smrg  fi
26346d1874b2Smrgfi
263594a251fdSmrg
26366d1874b2Smrg# Not having GLib when it has been explicitly requested is an error
26376d1874b2Smrgif test "x$with_glib" = x"yes"; then
26386d1874b2Smrg  if test "x$have_glib" = x"no"; then
26396d1874b2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26406d1874b2Smrg  fi
26416d1874b2Smrgfi
26428fff3f40Smrg
26436d1874b2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26446d1874b2Smrg]) # XORG_WITH_GLIB
26458fff3f40Smrg
26466d1874b2Smrg# XORG_LD_WRAP([required|optional])
26476d1874b2Smrg# ---------------------------------
26486d1874b2Smrg# Minimum version: 1.13.0
26496d1874b2Smrg#
26506d1874b2Smrg# Check if linker supports -wrap, passed via compiler flags
26516d1874b2Smrg#
26526d1874b2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26536d1874b2Smrg# Otherwise the value of $enable_unit_tests is blank.
26546d1874b2Smrg#
26556d1874b2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26566d1874b2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26576d1874b2Smrg# available, an argument of "optional" allows use when some unit tests require
26586d1874b2Smrg# ld -wrap and others do not.
26596d1874b2Smrg#
26606d1874b2SmrgAC_DEFUN([XORG_LD_WRAP],[
26616d1874b2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26626d1874b2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26636d1874b2Smrg                      void __wrap_exit(int status) { return; }],
26646d1874b2Smrg                     [exit(0);])])
26656d1874b2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26666d1874b2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26676d1874b2Smrg  if test "x$have_ld_wrap" = x"no"; then
26686d1874b2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26696d1874b2Smrg  fi
26706d1874b2Smrgfi
26716d1874b2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26726d1874b2Smrg#
26736d1874b2Smrg]) # XORG_LD_WRAP
267494a251fdSmrg
26756d1874b2Smrg# XORG_CHECK_LINKER_FLAGS
26766d1874b2Smrg# -----------------------
26776d1874b2Smrg# SYNOPSIS
26786d1874b2Smrg#
26796d1874b2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26806d1874b2Smrg#
26816d1874b2Smrg# DESCRIPTION
26826d1874b2Smrg#
26836d1874b2Smrg#   Check whether the given linker FLAGS work with the current language's
26846d1874b2Smrg#   linker, or whether they give an error.
26856d1874b2Smrg#
26866d1874b2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26876d1874b2Smrg#   success/failure.
26886d1874b2Smrg#
26896d1874b2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26906d1874b2Smrg#
26916d1874b2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26926d1874b2Smrg#
26936d1874b2Smrg# LICENSE
26946d1874b2Smrg#
26956d1874b2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26966d1874b2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26976d1874b2Smrg#   Copyright (c) 2009 Matteo Frigo
26986d1874b2Smrg#
26996d1874b2Smrg#   This program is free software: you can redistribute it and/or modify it
27006d1874b2Smrg#   under the terms of the GNU General Public License as published by the
27016d1874b2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27026d1874b2Smrg#   option) any later version.
27036d1874b2Smrg#
27046d1874b2Smrg#   This program is distributed in the hope that it will be useful, but
27056d1874b2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27066d1874b2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27076d1874b2Smrg#   Public License for more details.
27086d1874b2Smrg#
27096d1874b2Smrg#   You should have received a copy of the GNU General Public License along
27106d1874b2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27116d1874b2Smrg#
27126d1874b2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27136d1874b2Smrg#   gives unlimited permission to copy, distribute and modify the configure
27146d1874b2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27156d1874b2Smrg#   need not follow the terms of the GNU General Public License when using
27166d1874b2Smrg#   or distributing such scripts, even though portions of the text of the
27176d1874b2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27186d1874b2Smrg#   all other use of the material that constitutes the Autoconf Macro.
27196d1874b2Smrg#
27206d1874b2Smrg#   This special exception to the GPL applies to versions of the Autoconf
27216d1874b2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27226d1874b2Smrg#   modified version of the Autoconf Macro, you may extend this special
27236d1874b2Smrg#   exception to the GPL to apply to your modified version as well.#
27246d1874b2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27256d1874b2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27266d1874b2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27276d1874b2SmrgAS_LITERAL_IF([$1],
27286d1874b2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27296d1874b2Smrg      ax_save_FLAGS=$LDFLAGS
27306d1874b2Smrg      LDFLAGS="$1"
27316d1874b2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27326d1874b2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27336d1874b2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27346d1874b2Smrg      LDFLAGS=$ax_save_FLAGS])],
27356d1874b2Smrg  [ax_save_FLAGS=$LDFLAGS
27366d1874b2Smrg   LDFLAGS="$1"
27376d1874b2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27386d1874b2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27396d1874b2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27406d1874b2Smrg   LDFLAGS=$ax_save_FLAGS])
27416d1874b2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27426d1874b2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27436d1874b2Smrgif test "x$xorg_check_linker_flags" = xyes; then
27446d1874b2Smrg	m4_default([$2], :)
27456d1874b2Smrgelse
27466d1874b2Smrg	m4_default([$3], :)
27476d1874b2Smrgfi
27486d1874b2Smrg]) # XORG_CHECK_LINKER_FLAGS
27498fff3f40Smrg
27506d1874b2Smrg# XORG_MEMORY_CHECK_FLAGS
27516d1874b2Smrg# -----------------------
27526d1874b2Smrg# Minimum version: 1.16.0
27536d1874b2Smrg#
27546d1874b2Smrg# This macro attempts to find appropriate memory checking functionality
27556d1874b2Smrg# for various platforms which unit testing code may use to catch various
27566d1874b2Smrg# forms of memory allocation and access errors in testing.
27576d1874b2Smrg#
27586d1874b2Smrg# Interface to module:
27596d1874b2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27606d1874b2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27616d1874b2Smrg#
27626d1874b2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27636d1874b2Smrg#
27646d1874b2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765e6232409Smrg
27666d1874b2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27676d1874b2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27686d1874b2Smrg           [Environment variables to enable memory checking in tests])
2769e6232409Smrg
27706d1874b2Smrg# Check for different types of support on different platforms
27716d1874b2Smrgcase $host_os in
27726d1874b2Smrg    solaris*)
27736d1874b2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27746d1874b2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27756d1874b2Smrg        ;;
27766d1874b2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27776d1874b2Smrg        # both directly and inverted, so should not be 0 or 255.
27786d1874b2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27796d1874b2Smrg        ;;
27806d1874b2Smrg    darwin*)
27816d1874b2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27826d1874b2Smrg        ;;
27836d1874b2Smrg    *bsd*)
27846d1874b2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27856d1874b2Smrg        ;;
27866d1874b2Smrgesac
27878fff3f40Smrg
27886d1874b2Smrg# User supplied flags override default flags
27896d1874b2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27906d1874b2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279194a251fdSmrgfi
27928fff3f40Smrg
27936d1874b2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27946d1874b2Smrg]) # XORG_WITH_LINT
2795c05e7a3eSmrg
27966d1874b2Smrg# XORG_CHECK_MALLOC_ZERO
27976d1874b2Smrg# ----------------------
27986d1874b2Smrg# Minimum version: 1.0.0
279994a251fdSmrg#
28006d1874b2Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28016d1874b2Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28026d1874b2Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28036d1874b2SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28046d1874b2SmrgAC_ARG_ENABLE(malloc0returnsnull,
28056d1874b2Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28066d1874b2Smrg		       [malloc(0) returns NULL (default: auto)]),
28076d1874b2Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28086d1874b2Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28098fff3f40Smrg
28106d1874b2SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28116d1874b2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28126d1874b2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28136d1874b2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28146d1874b2Smrg#include <stdlib.h>
28156d1874b2Smrg],[
28166d1874b2Smrg    char *m0, *r0, *c0, *p;
28176d1874b2Smrg    m0 = malloc(0);
28186d1874b2Smrg    p = malloc(10);
28196d1874b2Smrg    r0 = realloc(p,0);
28206d1874b2Smrg    c0 = calloc(0,10);
28216d1874b2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28226d1874b2Smrg])],
28236d1874b2Smrg		[xorg_cv_malloc0_returns_null=yes],
28246d1874b2Smrg		[xorg_cv_malloc0_returns_null=no])])
28256d1874b2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826c05e7a3eSmrgfi
28276d1874b2SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28288fff3f40Smrg
28296d1874b2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28306d1874b2Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28316d1874b2Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28326d1874b2Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28338fff3f40Smrgelse
28346d1874b2Smrg	MALLOC_ZERO_CFLAGS=""
28356d1874b2Smrg	XMALLOC_ZERO_CFLAGS=""
28366d1874b2Smrg	XTMALLOC_ZERO_CFLAGS=""
283794a251fdSmrgfi
28388fff3f40Smrg
28396d1874b2SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28406d1874b2SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28416d1874b2SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28426d1874b2Smrg]) # XORG_CHECK_MALLOC_ZERO
284394a251fdSmrg
28446d1874b2Smrg# XORG_WITH_LINT()
28456d1874b2Smrg# ----------------
28466d1874b2Smrg# Minimum version: 1.1.0
284794a251fdSmrg#
28486d1874b2Smrg# This macro enables the use of a tool that flags some suspicious and
28496d1874b2Smrg# non-portable constructs (likely to be bugs) in C language source code.
28506d1874b2Smrg# It will attempt to locate the tool and use appropriate options.
28516d1874b2Smrg# There are various lint type tools on different platforms.
285294a251fdSmrg#
28536d1874b2Smrg# Interface to module:
28546d1874b2Smrg# LINT:		returns the path to the tool found on the platform
28556d1874b2Smrg#		or the value set to LINT on the configure cmd line
28566d1874b2Smrg#		also an Automake conditional
28576d1874b2Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28586d1874b2Smrg#
28596d1874b2Smrg# --with-lint:	'yes' user instructs the module to use lint
28606d1874b2Smrg#		'no' user instructs the module not to use lint (default)
28616d1874b2Smrg#
28626d1874b2Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28636d1874b2Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28646d1874b2Smrg#
28656d1874b2SmrgAC_DEFUN([XORG_WITH_LINT],[
286694a251fdSmrg
28676d1874b2SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28686d1874b2SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28696d1874b2SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28706d1874b2Smrg		[Use a lint-style source code checker (default: disabled)])],
28716d1874b2Smrg		[use_lint=$withval], [use_lint=no])
287294a251fdSmrg
28736d1874b2Smrg# Obtain platform specific info like program name and options
28746d1874b2Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28756d1874b2Smrgcase $host_os in
28766d1874b2Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28776d1874b2Smrg	lint_name=splint
28786d1874b2Smrg	lint_options="-badflag"
28796d1874b2Smrg	;;
28806d1874b2Smrg  *freebsd* | *netbsd*)
28816d1874b2Smrg	lint_name=lint
28826d1874b2Smrg	lint_options="-u -b"
28836d1874b2Smrg	;;
28846d1874b2Smrg  *solaris*)
28856d1874b2Smrg	lint_name=lint
28866d1874b2Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28876d1874b2Smrg	;;
28886d1874b2Smrgesac
28896d1874b2Smrg
28906d1874b2Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28916d1874b2Smrgif test "x$use_lint" = x"yes" ; then
28926d1874b2Smrg   AC_PATH_PROG([LINT], [$lint_name])
28936d1874b2Smrg   if test "x$LINT" = "x"; then
28946d1874b2Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28956d1874b2Smrg   fi
28966d1874b2Smrgelif test "x$use_lint" = x"no" ; then
28976d1874b2Smrg   if test "x$LINT" != "x"; then
28986d1874b2Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28996d1874b2Smrg   fi
2900c05e7a3eSmrgelse
29016d1874b2Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290294a251fdSmrgfi
290394a251fdSmrg
29046d1874b2Smrg# User supplied flags override default flags
29056d1874b2Smrgif test "x$LINT_FLAGS" != "x"; then
29066d1874b2Smrg   lint_options=$LINT_FLAGS
29076d1874b2Smrgfi
290894a251fdSmrg
29096d1874b2SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29106d1874b2SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291194a251fdSmrg
29126d1874b2Smrg]) # XORG_WITH_LINT
29138fff3f40Smrg
29146d1874b2Smrg# XORG_LINT_LIBRARY(LIBNAME)
29156d1874b2Smrg# --------------------------
29166d1874b2Smrg# Minimum version: 1.1.0
291794a251fdSmrg#
29186d1874b2Smrg# Sets up flags for building lint libraries for checking programs that call
29196d1874b2Smrg# functions in the library.
29206d1874b2Smrg#
29216d1874b2Smrg# Interface to module:
29226d1874b2Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29236d1874b2Smrg# MAKE_LINT_LIB		- Automake conditional
29246d1874b2Smrg#
29256d1874b2Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29266d1874b2Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292794a251fdSmrg
29286d1874b2SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29296d1874b2SmrgAC_REQUIRE([XORG_WITH_LINT])
29306d1874b2SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29316d1874b2Smrg	[Create lint library (default: disabled)])],
29326d1874b2Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29336d1874b2Smrg
29346d1874b2Smrgif test "x$make_lint_lib" = x"yes" ; then
29356d1874b2Smrg   LINTLIB=llib-l$1.ln
29366d1874b2Smrg   if test "x$LINT" = "x"; then
29376d1874b2Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29386d1874b2Smrg   fi
29396d1874b2Smrgelif test "x$make_lint_lib" != x"no" ; then
29406d1874b2Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294194a251fdSmrgfi
29428fff3f40Smrg
29436d1874b2SmrgAC_SUBST(LINTLIB)
29446d1874b2SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945c05e7a3eSmrg
29466d1874b2Smrg]) # XORG_LINT_LIBRARY
2947c05e7a3eSmrg
29486d1874b2Smrg# XORG_COMPILER_BRAND
2949c05e7a3eSmrg# -------------------
29506d1874b2Smrg# Minimum version: 1.14.0
2951c05e7a3eSmrg#
29526d1874b2Smrg# Checks for various brands of compilers and sets flags as appropriate:
29536d1874b2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29546d1874b2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29556d1874b2Smrg#   clang compiler - sets CLANGCC to "yes"
29566d1874b2Smrg#   Intel compiler - sets INTELCC to "yes"
29576d1874b2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29586d1874b2Smrg#
29596d1874b2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29606d1874b2SmrgAC_LANG_CASE(
29616d1874b2Smrg	[C], [
296261d7a284Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296361d7a284Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296461d7a284Smrg		m4_version_prereq([2.70],
296561d7a284Smrg			[AC_REQUIRE([AC_PROG_CC])],
296661d7a284Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29676d1874b2Smrg	],
29686d1874b2Smrg	[C++], [
29696d1874b2Smrg		AC_REQUIRE([AC_PROG_CXX])
29706d1874b2Smrg	]
29716d1874b2Smrg)
29726d1874b2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29736d1874b2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29746d1874b2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29756d1874b2Smrg]) # XORG_COMPILER_BRAND
297694a251fdSmrg
29776d1874b2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978c05e7a3eSmrg# ---------------
29796d1874b2Smrg# Minimum version: 1.16.0
29806d1874b2Smrg#
29816d1874b2Smrg# Test if the compiler works when passed the given flag as a command line argument.
298261d7a284Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29836d1874b2Smrg# next flag in the list until there are no more options.
29846d1874b2Smrg#
29856d1874b2Smrg# Note that this does not guarantee that the compiler supports the flag as some
29866d1874b2Smrg# compilers will simply ignore arguments that they do not understand, but we do
29876d1874b2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29886d1874b2Smrg# -Werror=unused-command-line-argument
29896d1874b2Smrg#
29906d1874b2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29916d1874b2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29926d1874b2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299394a251fdSmrg
29946d1874b2SmrgAC_LANG_COMPILER_REQUIRE
299594a251fdSmrg
29966d1874b2SmrgAC_LANG_CASE(
29976d1874b2Smrg	[C], [
299861d7a284Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299961d7a284Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300061d7a284Smrg		m4_version_prereq([2.70],
300161d7a284Smrg			[AC_REQUIRE([AC_PROG_CC])],
300261d7a284Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30036d1874b2Smrg		define([PREFIX], [C])
30046d1874b2Smrg		define([CACHE_PREFIX], [cc])
30056d1874b2Smrg		define([COMPILER], [$CC])
30066d1874b2Smrg	],
30076d1874b2Smrg	[C++], [
30086d1874b2Smrg		define([PREFIX], [CXX])
30096d1874b2Smrg		define([CACHE_PREFIX], [cxx])
30106d1874b2Smrg		define([COMPILER], [$CXX])
30116d1874b2Smrg	]
30126d1874b2Smrg)
30136d1874b2Smrg
30146d1874b2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30156d1874b2Smrg
30166d1874b2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30176d1874b2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30186d1874b2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30196d1874b2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30206d1874b2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30216d1874b2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30226d1874b2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30236d1874b2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30246d1874b2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025c05e7a3eSmrgfi
30266d1874b2Smrg
30276d1874b2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30286d1874b2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30296d1874b2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30306d1874b2Smrg	fi
30316d1874b2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30326d1874b2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30336d1874b2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30346d1874b2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30356d1874b2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30366d1874b2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30376d1874b2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30386d1874b2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30396d1874b2Smrgfi
30406d1874b2Smrg
30416d1874b2Smrgfound="no"
30426d1874b2Smrgm4_foreach([flag], m4_cdr($@), [
30436d1874b2Smrg	if test $found = "no" ; then
30446d1874b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30456d1874b2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30466d1874b2Smrg		fi
30476d1874b2Smrg
30486d1874b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30496d1874b2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30506d1874b2Smrg		fi
30516d1874b2Smrg
30526d1874b2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30536d1874b2Smrg
30546d1874b2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30556d1874b2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30566d1874b2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30576d1874b2Smrg		AC_CACHE_VAL($cacheid,
30586d1874b2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30596d1874b2Smrg					     [eval $cacheid=yes],
30606d1874b2Smrg					     [eval $cacheid=no])])
30616d1874b2Smrg
30626d1874b2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30636d1874b2Smrg
30646d1874b2Smrg		eval supported=\$$cacheid
30656d1874b2Smrg		AC_MSG_RESULT([$supported])
30666d1874b2Smrg		if test "$supported" = "yes" ; then
30676d1874b2Smrg			$1="$$1 ]flag["
30686d1874b2Smrg			found="yes"
30696d1874b2Smrg		fi
30706d1874b2Smrg	fi
3071c05e7a3eSmrg])
30726d1874b2Smrg]) # XORG_TESTSET_CFLAG
30738fff3f40Smrg
30746d1874b2Smrg# XORG_COMPILER_FLAGS
30756d1874b2Smrg# ---------------
30766d1874b2Smrg# Minimum version: 1.16.0
307794a251fdSmrg#
30786d1874b2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30796d1874b2Smrg# arguments supported by the selected compiler which do NOT alter the generated
30806d1874b2Smrg# code.  These arguments will cause the compiler to print various warnings
30816d1874b2Smrg# during compilation AND turn a conservative set of warnings into errors.
30826d1874b2Smrg#
30836d1874b2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30846d1874b2Smrg# future versions of util-macros as options are added to new compilers.
30856d1874b2Smrg#
30866d1874b2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30876d1874b2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088e6232409Smrg
30896d1874b2SmrgAC_ARG_ENABLE(selective-werror,
30906d1874b2Smrg              AS_HELP_STRING([--disable-selective-werror],
30916d1874b2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30926d1874b2Smrg              [SELECTIVE_WERROR=$enableval],
30936d1874b2Smrg              [SELECTIVE_WERROR=yes])
30946d1874b2Smrg
30956d1874b2SmrgAC_LANG_CASE(
30966d1874b2Smrg        [C], [
30976d1874b2Smrg                define([PREFIX], [C])
30986d1874b2Smrg        ],
30996d1874b2Smrg        [C++], [
31006d1874b2Smrg                define([PREFIX], [CXX])
31016d1874b2Smrg        ]
31026d1874b2Smrg)
31036d1874b2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31046d1874b2Smrgif test "x$SUNCC" = "xyes"; then
31056d1874b2Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106c05e7a3eSmrgelse
31076d1874b2Smrg    [BASE_]PREFIX[FLAGS]=""
3108c05e7a3eSmrgfi
3109c05e7a3eSmrg
31106d1874b2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31116d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31126d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31136d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31146d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115c05e7a3eSmrg
31166d1874b2SmrgAC_LANG_CASE(
31176d1874b2Smrg	[C], [
31186d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31196d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31206d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31216d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31226d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31236d1874b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31246d1874b2Smrg	]
31256d1874b2Smrg)
3126e6232409Smrg
31276d1874b2Smrg# This chunk adds additional warnings that could catch undesired effects.
31286d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31296d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31306d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31316d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31326d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31336d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31346d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135e6232409Smrg
31366d1874b2Smrg# These are currently disabled because they are noisy.  They will be enabled
31376d1874b2Smrg# in the future once the codebase is sufficiently modernized to silence
31386d1874b2Smrg# them.  For now, I don't want them to drown out the other warnings.
31396d1874b2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31406d1874b2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31416d1874b2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142e6232409Smrg
314361d7a284Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31446d1874b2Smrg# when there are problems that should be fixed.
3145e6232409Smrg
31466d1874b2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31476d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31486d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31496d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31506d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31516d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31526d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31536d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31546d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31556d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31566d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31576d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31586d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31596d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31606d1874b2Smrgelse
31616d1874b2SmrgAC_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])
31626d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31636d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31646d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31656d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31666d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31676d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31686d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31696d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31706d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31716d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31726d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31736d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31746d1874b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31756d1874b2Smrgfi
3176e6232409Smrg
31776d1874b2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31786d1874b2Smrg]) # XORG_COMPILER_FLAGS
3179e6232409Smrg
31806d1874b2Smrg# XORG_CWARNFLAGS
31816d1874b2Smrg# ---------------
31826d1874b2Smrg# Minimum version: 1.2.0
31836d1874b2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31848fff3f40Smrg#
31856d1874b2Smrg# Defines CWARNFLAGS to enable C compiler warnings.
318694a251fdSmrg#
31876d1874b2Smrg# This function is deprecated because it defines -fno-strict-aliasing
31886d1874b2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31896d1874b2Smrg# is needed, then it should be added explicitly in the module when
31906d1874b2Smrg# it is updated to use BASE_CFLAGS.
319194a251fdSmrg#
31926d1874b2SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31936d1874b2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31946d1874b2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31956d1874b2SmrgAC_LANG_CASE(
31966d1874b2Smrg	[C], [
31976d1874b2Smrg		CWARNFLAGS="$BASE_CFLAGS"
31986d1874b2Smrg		if  test "x$GCC" = xyes ; then
31996d1874b2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32006d1874b2Smrg		fi
32016d1874b2Smrg		AC_SUBST(CWARNFLAGS)
32026d1874b2Smrg	]
32036d1874b2Smrg)
32046d1874b2Smrg]) # XORG_CWARNFLAGS
32056a45684fSmrg
32066d1874b2Smrg# XORG_STRICT_OPTION
32076d1874b2Smrg# -----------------------
32086d1874b2Smrg# Minimum version: 1.3.0
32096d1874b2Smrg#
32106d1874b2Smrg# Add configure option to enable strict compilation flags, such as treating
32116d1874b2Smrg# warnings as fatal errors.
32126d1874b2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32136d1874b2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32146d1874b2Smrg#
32156d1874b2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32166d1874b2Smrg# when strict compilation is unconditionally desired.
32176d1874b2SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32186d1874b2SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32196d1874b2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32208fff3f40Smrg
32216d1874b2SmrgAC_ARG_ENABLE(strict-compilation,
32226d1874b2Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32236d1874b2Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32246d1874b2Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225c05e7a3eSmrg
32266d1874b2SmrgAC_LANG_CASE(
32276d1874b2Smrg        [C], [
32286d1874b2Smrg                define([PREFIX], [C])
32296d1874b2Smrg        ],
32306d1874b2Smrg        [C++], [
32316d1874b2Smrg                define([PREFIX], [CXX])
32326d1874b2Smrg        ]
32336d1874b2Smrg)
3234c05e7a3eSmrg
32356d1874b2Smrg[STRICT_]PREFIX[FLAGS]=""
32366d1874b2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32376d1874b2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238c05e7a3eSmrg
32396d1874b2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32406d1874b2Smrg# activate it with -Werror, so we add it here explicitly.
32416d1874b2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242c05e7a3eSmrg
32436d1874b2Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32446d1874b2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32456d1874b2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32466d1874b2Smrgfi
32476d1874b2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32486d1874b2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32496d1874b2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32506d1874b2Smrg]) # XORG_STRICT_OPTION
3251c05e7a3eSmrg
325261d7a284Smrg# XORG_DEFAULT_NOCODE_OPTIONS
325361d7a284Smrg# ---------------------------
325461d7a284Smrg# Minimum version: 1.20.0
325561d7a284Smrg#
325661d7a284Smrg# Defines default options for X.Org modules which don't compile code,
325761d7a284Smrg# such as fonts, bitmaps, cursors, and docs.
325861d7a284Smrg#
325961d7a284SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326061d7a284SmrgAC_REQUIRE([AC_PROG_INSTALL])
326161d7a284SmrgXORG_RELEASE_VERSION
326261d7a284SmrgXORG_CHANGELOG
326361d7a284SmrgXORG_INSTALL
326461d7a284SmrgXORG_MANPAGE_SECTIONS
326561d7a284Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326661d7a284Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326761d7a284Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326861d7a284Smrg
32696d1874b2Smrg# XORG_DEFAULT_OPTIONS
32706d1874b2Smrg# --------------------
32716d1874b2Smrg# Minimum version: 1.3.0
32726d1874b2Smrg#
327361d7a284Smrg# Defines default options for X.Org modules which compile code.
32746d1874b2Smrg#
32756d1874b2SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32766d1874b2SmrgAC_REQUIRE([AC_PROG_INSTALL])
32776d1874b2SmrgXORG_COMPILER_FLAGS
32786d1874b2SmrgXORG_CWARNFLAGS
32796d1874b2SmrgXORG_STRICT_OPTION
328061d7a284SmrgXORG_DEFAULT_NOCODE_OPTIONS
32816d1874b2Smrg]) # XORG_DEFAULT_OPTIONS
3282c05e7a3eSmrg
32836d1874b2Smrg# XORG_INSTALL()
32846d1874b2Smrg# ----------------
32856d1874b2Smrg# Minimum version: 1.4.0
32866d1874b2Smrg#
32876d1874b2Smrg# Defines the variable INSTALL_CMD as the command to copy
32886d1874b2Smrg# INSTALL from $prefix/share/util-macros.
32896d1874b2Smrg#
32906d1874b2SmrgAC_DEFUN([XORG_INSTALL], [
32916d1874b2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32926d1874b2Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32936d1874b2SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32946d1874b2Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32956d1874b2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32966d1874b2Smrgtouch \$(top_srcdir)/INSTALL; \
32976d1874b2Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32986d1874b2SmrgAC_SUBST([INSTALL_CMD])
32996d1874b2Smrg]) # XORG_INSTALL
33006d1874b2Smrgdnl Copyright 2005 Red Hat, Inc
33016d1874b2Smrgdnl
33026d1874b2Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33036d1874b2Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33046d1874b2Smrgdnl the above copyright notice appear in all copies and that both that
33056d1874b2Smrgdnl copyright notice and this permission notice appear in supporting
33066d1874b2Smrgdnl documentation.
33076d1874b2Smrgdnl
33086d1874b2Smrgdnl The above copyright notice and this permission notice shall be included
33096d1874b2Smrgdnl in all copies or substantial portions of the Software.
33106d1874b2Smrgdnl
33116d1874b2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33126d1874b2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33136d1874b2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33146d1874b2Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33156d1874b2Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33166d1874b2Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33176d1874b2Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33186d1874b2Smrgdnl
33196d1874b2Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33206d1874b2Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33216d1874b2Smrgdnl other dealings in this Software without prior written authorization
33226d1874b2Smrgdnl from the copyright holders.
33236d1874b2Smrgdnl
3324c05e7a3eSmrg
33256d1874b2Smrg# XORG_RELEASE_VERSION
33266d1874b2Smrg# --------------------
33276d1874b2Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328c05e7a3eSmrg
33296d1874b2SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33306d1874b2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33316d1874b2Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33326d1874b2Smrg		[Major version of this package])
33336d1874b2Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33346d1874b2Smrg	if test "x$PVM" = "x"; then
33356d1874b2Smrg		PVM="0"
33366d1874b2Smrg	fi
33376d1874b2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33386d1874b2Smrg		[$PVM],
33396d1874b2Smrg		[Minor version of this package])
33406d1874b2Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33416d1874b2Smrg	if test "x$PVP" = "x"; then
33426d1874b2Smrg		PVP="0"
33436d1874b2Smrg	fi
33446d1874b2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33456d1874b2Smrg		[$PVP],
33466d1874b2Smrg		[Patch version of this package])
33476d1874b2Smrg])
3348c05e7a3eSmrg
33496d1874b2Smrg# XORG_CHANGELOG()
33506d1874b2Smrg# ----------------
33516d1874b2Smrg# Minimum version: 1.2.0
33526d1874b2Smrg#
33536d1874b2Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33546d1874b2Smrg# ChangeLog from git.
33556d1874b2Smrg#
33566d1874b2Smrg#
33576d1874b2SmrgAC_DEFUN([XORG_CHANGELOG], [
33586d1874b2SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33596d1874b2Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33606d1874b2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33616d1874b2Smrgtouch \$(top_srcdir)/ChangeLog; \
33626d1874b2Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33636d1874b2SmrgAC_SUBST([CHANGELOG_CMD])
33646d1874b2Smrg]) # XORG_CHANGELOG
3365e6232409Smrg
3366