aclocal.m4 revision 3458e6c2
13458e6c2Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
22becc446Smrg
33458e6c2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
42c7c4e3dSmrg
52c7c4e3dSmrg# This file is free software; the Free Software Foundation
62c7c4e3dSmrg# gives unlimited permission to copy and/or distribute it,
72c7c4e3dSmrg# with or without modifications, as long as this notice is preserved.
82c7c4e3dSmrg
92c7c4e3dSmrg# This program is distributed in the hope that it will be useful,
102c7c4e3dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
112c7c4e3dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
122c7c4e3dSmrg# PARTICULAR PURPOSE.
132c7c4e3dSmrg
142becc446Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
173458e6c2Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
183458e6c2Smrg[m4_warning([this file was generated for autoconf 2.71.
198650bb69SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208650bb69SmrgIf you have problems, you may need to regenerate the build system entirely.
212becc446SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
222c7c4e3dSmrg
233458e6c2Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
248650bb69Smrg#
258650bb69Smrg# This file is free software; the Free Software Foundation
268650bb69Smrg# gives unlimited permission to copy and/or distribute it,
278650bb69Smrg# with or without modifications, as long as this notice is preserved.
282c7c4e3dSmrg
292c7c4e3dSmrg# AM_AUTOMAKE_VERSION(VERSION)
302c7c4e3dSmrg# ----------------------------
312c7c4e3dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
322c7c4e3dSmrg# generated from the m4 files accompanying Automake X.Y.
338650bb69Smrg# (This private macro should not be called outside this file.)
348650bb69SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
353458e6c2Smrg[am__api_version='1.16'
368650bb69Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
378650bb69Smrgdnl require some minimum version.  Point them to the right macro.
383458e6c2Smrgm4_if([$1], [1.16.5], [],
398650bb69Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
408650bb69Smrg])
418650bb69Smrg
428650bb69Smrg# _AM_AUTOCONF_VERSION(VERSION)
438650bb69Smrg# -----------------------------
448650bb69Smrg# aclocal traces this macro to find the Autoconf version.
458650bb69Smrg# This is a private macro too.  Using m4_define simplifies
468650bb69Smrg# the logic in aclocal, which can simply ignore this definition.
478650bb69Smrgm4_define([_AM_AUTOCONF_VERSION], [])
482c7c4e3dSmrg
492c7c4e3dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
502c7c4e3dSmrg# -------------------------------
518650bb69Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528650bb69Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
532c7c4e3dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543458e6c2Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
558650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
568650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578650bb69Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
582c7c4e3dSmrg
598650bb69Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
602c7c4e3dSmrg
613458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
622c7c4e3dSmrg#
638650bb69Smrg# This file is free software; the Free Software Foundation
648650bb69Smrg# gives unlimited permission to copy and/or distribute it,
658650bb69Smrg# with or without modifications, as long as this notice is preserved.
662c7c4e3dSmrg
672c7c4e3dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
682becc446Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
692becc446Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
702c7c4e3dSmrg#
712c7c4e3dSmrg# Of course, Automake must honor this variable whenever it calls a
722c7c4e3dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
732c7c4e3dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
742c7c4e3dSmrg# depending on how configure is run.  This is pretty annoying, since
752c7c4e3dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
762c7c4e3dSmrg# source directory, any form will work fine, but in subdirectories a
772c7c4e3dSmrg# relative path needs to be adjusted first.
782c7c4e3dSmrg#
792c7c4e3dSmrg# $ac_aux_dir/missing
802c7c4e3dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
812c7c4e3dSmrg# $top_srcdir/$ac_aux_dir/missing
822c7c4e3dSmrg#    fails if $ac_aux_dir is absolute,
832c7c4e3dSmrg#    fails when called from a subdirectory in a VPATH build with
842c7c4e3dSmrg#          a relative $ac_aux_dir
852c7c4e3dSmrg#
862c7c4e3dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
872c7c4e3dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
882becc446Smrg# harmless because $srcdir is '.', but things will broke when you
892c7c4e3dSmrg# start a VPATH build or use an absolute $srcdir.
902c7c4e3dSmrg#
912c7c4e3dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
922c7c4e3dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
932c7c4e3dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
942c7c4e3dSmrg# and then we would define $MISSING as
952c7c4e3dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
962c7c4e3dSmrg# This will work as long as MISSING is not called from configure, because
972c7c4e3dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
982c7c4e3dSmrg# However there are other variables, like CC, which are often used in
992c7c4e3dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1002c7c4e3dSmrg#
1012c7c4e3dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1022c7c4e3dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1032c7c4e3dSmrg# configured tree to be moved without reconfiguration.
1042c7c4e3dSmrg
1058650bb69SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1062becc446Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1072becc446Smrg# Expand $ac_aux_dir to an absolute path.
1082becc446Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1092c7c4e3dSmrg])
1102c7c4e3dSmrg
1118650bb69Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1122c7c4e3dSmrg
1133458e6c2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1148650bb69Smrg#
1158650bb69Smrg# This file is free software; the Free Software Foundation
1168650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1178650bb69Smrg# with or without modifications, as long as this notice is preserved.
1182c7c4e3dSmrg
1198650bb69Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1208650bb69Smrg# -------------------------------------
1218650bb69Smrg# Define a conditional.
1228650bb69SmrgAC_DEFUN([AM_CONDITIONAL],
1232becc446Smrg[AC_PREREQ([2.52])dnl
1242becc446Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1252becc446Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1268650bb69SmrgAC_SUBST([$1_TRUE])dnl
1278650bb69SmrgAC_SUBST([$1_FALSE])dnl
1288650bb69Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1298650bb69Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1308650bb69Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1318650bb69Smrgif $2; then
1328650bb69Smrg  $1_TRUE=
1338650bb69Smrg  $1_FALSE='#'
1342c7c4e3dSmrgelse
1358650bb69Smrg  $1_TRUE='#'
1368650bb69Smrg  $1_FALSE=
1372c7c4e3dSmrgfi
1388650bb69SmrgAC_CONFIG_COMMANDS_PRE(
1398650bb69Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1408650bb69Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1418650bb69SmrgUsually this means the macro was only invoked conditionally.]])
1428650bb69Smrgfi])])
1432c7c4e3dSmrg
1443458e6c2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1458650bb69Smrg#
1468650bb69Smrg# This file is free software; the Free Software Foundation
1478650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1488650bb69Smrg# with or without modifications, as long as this notice is preserved.
1492c7c4e3dSmrg
1502c7c4e3dSmrg
1512becc446Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1522c7c4e3dSmrg# written in clear, in which case automake, when reading aclocal.m4,
1532c7c4e3dSmrg# will think it sees a *use*, and therefore will trigger all it's
1542c7c4e3dSmrg# C support machinery.  Also note that it means that autoscan, seeing
1552c7c4e3dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1562c7c4e3dSmrg
1572c7c4e3dSmrg
1582c7c4e3dSmrg# _AM_DEPENDENCIES(NAME)
1592c7c4e3dSmrg# ----------------------
1602c7c4e3dSmrg# See how the compiler implements dependency checking.
1612becc446Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1622c7c4e3dSmrg# We try a few techniques and use that to set a single cache variable.
1632c7c4e3dSmrg#
1642c7c4e3dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1652c7c4e3dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1662c7c4e3dSmrg# dependency, and given that the user is not expected to run this macro,
1672c7c4e3dSmrg# just rely on AC_PROG_CC.
1682c7c4e3dSmrgAC_DEFUN([_AM_DEPENDENCIES],
1692c7c4e3dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1702c7c4e3dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1712c7c4e3dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1722c7c4e3dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1732c7c4e3dSmrg
1742becc446Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1752becc446Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1762becc446Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1772becc446Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1782becc446Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1792becc446Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1802becc446Smrg                    [depcc="$$1"   am_compiler_list=])
1812c7c4e3dSmrg
1822c7c4e3dSmrgAC_CACHE_CHECK([dependency style of $depcc],
1832c7c4e3dSmrg               [am_cv_$1_dependencies_compiler_type],
1842c7c4e3dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1852c7c4e3dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1862c7c4e3dSmrg  # making bogus files that we don't know about and never remove.  For
1872c7c4e3dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1882becc446Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1892becc446Smrg  # in D".
1902becc446Smrg  rm -rf conftest.dir
1912c7c4e3dSmrg  mkdir conftest.dir
1922c7c4e3dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1932c7c4e3dSmrg  # using a relative directory.
1942c7c4e3dSmrg  cp "$am_depcomp" conftest.dir
1952c7c4e3dSmrg  cd conftest.dir
1962c7c4e3dSmrg  # We will build objects and dependencies in a subdirectory because
1972c7c4e3dSmrg  # it helps to detect inapplicable dependency modes.  For instance
1982c7c4e3dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1992c7c4e3dSmrg  # side effect of compilation, but ICC will put the dependencies in
2002c7c4e3dSmrg  # the current directory while Tru64 will put them in the object
2012c7c4e3dSmrg  # directory.
2022c7c4e3dSmrg  mkdir sub
2032c7c4e3dSmrg
2042c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2052c7c4e3dSmrg  if test "$am_compiler_list" = ""; then
2062c7c4e3dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2072c7c4e3dSmrg  fi
2088650bb69Smrg  am__universal=false
2098650bb69Smrg  m4_case([$1], [CC],
2108650bb69Smrg    [case " $depcc " in #(
2118650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2128650bb69Smrg     esac],
2138650bb69Smrg    [CXX],
2148650bb69Smrg    [case " $depcc " in #(
2158650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2168650bb69Smrg     esac])
2178650bb69Smrg
2182c7c4e3dSmrg  for depmode in $am_compiler_list; do
2192c7c4e3dSmrg    # Setup a source with many dependencies, because some compilers
2202c7c4e3dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2212c7c4e3dSmrg    # we should not choose a depcomp mode which is confused by this.
2222c7c4e3dSmrg    #
2232c7c4e3dSmrg    # We need to recreate these files for each test, as the compiler may
2242c7c4e3dSmrg    # overwrite some of them when testing with obscure command lines.
2252c7c4e3dSmrg    # This happens at least with the AIX C compiler.
2262c7c4e3dSmrg    : > sub/conftest.c
2272c7c4e3dSmrg    for i in 1 2 3 4 5 6; do
2282c7c4e3dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2292becc446Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2302becc446Smrg      # Solaris 10 /bin/sh.
2312becc446Smrg      echo '/* dummy */' > sub/conftst$i.h
2322c7c4e3dSmrg    done
2332c7c4e3dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2342c7c4e3dSmrg
2352becc446Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2368650bb69Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2372becc446Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2382becc446Smrg    # versions had trouble with output in subdirs.
2398650bb69Smrg    am__obj=sub/conftest.${OBJEXT-o}
2408650bb69Smrg    am__minus_obj="-o $am__obj"
2412c7c4e3dSmrg    case $depmode in
2428650bb69Smrg    gcc)
2438650bb69Smrg      # This depmode causes a compiler race in universal mode.
2448650bb69Smrg      test "$am__universal" = false || continue
2458650bb69Smrg      ;;
2462c7c4e3dSmrg    nosideeffect)
2472becc446Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2482becc446Smrg      # only be used when explicitly requested.
2492c7c4e3dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2502c7c4e3dSmrg	continue
2512c7c4e3dSmrg      else
2522c7c4e3dSmrg	break
2532c7c4e3dSmrg      fi
2542c7c4e3dSmrg      ;;
2552becc446Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2562becc446Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2578650bb69Smrg      # not run yet.  These depmodes are late enough in the game, and
2588650bb69Smrg      # so weak that their functioning should not be impacted.
2598650bb69Smrg      am__obj=conftest.${OBJEXT-o}
2608650bb69Smrg      am__minus_obj=
2618650bb69Smrg      ;;
2622c7c4e3dSmrg    none) break ;;
2632c7c4e3dSmrg    esac
2642c7c4e3dSmrg    if depmode=$depmode \
2658650bb69Smrg       source=sub/conftest.c object=$am__obj \
2662c7c4e3dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2678650bb69Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2682c7c4e3dSmrg         >/dev/null 2>conftest.err &&
2698650bb69Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2702c7c4e3dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2718650bb69Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2722c7c4e3dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2732c7c4e3dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2748650bb69Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2758650bb69Smrg      # that says an option was ignored or not supported.
2768650bb69Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2778650bb69Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2788650bb69Smrg      # The diagnosis changed in icc 8.0:
2798650bb69Smrg      #   icc: Command line remark: option '-MP' not supported
2808650bb69Smrg      if (grep 'ignoring option' conftest.err ||
2818650bb69Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2822c7c4e3dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2832c7c4e3dSmrg        break
2842c7c4e3dSmrg      fi
2852c7c4e3dSmrg    fi
2862c7c4e3dSmrg  done
2872c7c4e3dSmrg
2882c7c4e3dSmrg  cd ..
2892c7c4e3dSmrg  rm -rf conftest.dir
2902c7c4e3dSmrgelse
2912c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2922c7c4e3dSmrgfi
2932c7c4e3dSmrg])
2942c7c4e3dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2952c7c4e3dSmrgAM_CONDITIONAL([am__fastdep$1], [
2962c7c4e3dSmrg  test "x$enable_dependency_tracking" != xno \
2972c7c4e3dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2982c7c4e3dSmrg])
2992c7c4e3dSmrg
3002c7c4e3dSmrg
3012c7c4e3dSmrg# AM_SET_DEPDIR
3022c7c4e3dSmrg# -------------
3032c7c4e3dSmrg# Choose a directory name for dependency files.
3042becc446Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3052c7c4e3dSmrgAC_DEFUN([AM_SET_DEPDIR],
3062c7c4e3dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3072c7c4e3dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3082c7c4e3dSmrg])
3092c7c4e3dSmrg
3102c7c4e3dSmrg
3112c7c4e3dSmrg# AM_DEP_TRACK
3122c7c4e3dSmrg# ------------
3132c7c4e3dSmrgAC_DEFUN([AM_DEP_TRACK],
3142becc446Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3152becc446SmrgAS_HELP_STRING(
3162becc446Smrg  [--enable-dependency-tracking],
3172becc446Smrg  [do not reject slow dependency extractors])
3182becc446SmrgAS_HELP_STRING(
3192becc446Smrg  [--disable-dependency-tracking],
3202becc446Smrg  [speeds up one-time build])])
3212c7c4e3dSmrgif test "x$enable_dependency_tracking" != xno; then
3222c7c4e3dSmrg  am_depcomp="$ac_aux_dir/depcomp"
3232c7c4e3dSmrg  AMDEPBACKSLASH='\'
3242becc446Smrg  am__nodep='_no'
3252c7c4e3dSmrgfi
3262c7c4e3dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3278650bb69SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3288650bb69Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3292becc446SmrgAC_SUBST([am__nodep])dnl
3302becc446Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3312c7c4e3dSmrg])
3322c7c4e3dSmrg
3338650bb69Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3342c7c4e3dSmrg
3353458e6c2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3368650bb69Smrg#
3378650bb69Smrg# This file is free software; the Free Software Foundation
3388650bb69Smrg# gives unlimited permission to copy and/or distribute it,
3398650bb69Smrg# with or without modifications, as long as this notice is preserved.
3402c7c4e3dSmrg
3412c7c4e3dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3422c7c4e3dSmrg# ------------------------------
3432c7c4e3dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3448650bb69Smrg[{
3452becc446Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3468650bb69Smrg  # are listed without --file.  Let's play safe and only enable the eval
3478650bb69Smrg  # if we detect the quoting.
3483458e6c2Smrg  # TODO: see whether this extra hack can be removed once we start
3493458e6c2Smrg  # requiring Autoconf 2.70 or later.
3503458e6c2Smrg  AS_CASE([$CONFIG_FILES],
3513458e6c2Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523458e6c2Smrg          [*], [set x $CONFIG_FILES])
3538650bb69Smrg  shift
3543458e6c2Smrg  # Used to flag and report bootstrapping failures.
3553458e6c2Smrg  am_rc=0
3563458e6c2Smrg  for am_mf
3578650bb69Smrg  do
3588650bb69Smrg    # Strip MF so we end up with the name of the file.
3593458e6c2Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603458e6c2Smrg    # Check whether this is an Automake generated Makefile which includes
3613458e6c2Smrg    # dependency-tracking related rules and includes.
3623458e6c2Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3638650bb69Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643458e6c2Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653458e6c2Smrg      || continue
3663458e6c2Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673458e6c2Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683458e6c2Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3693458e6c2Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703458e6c2Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3712c7c4e3dSmrg  done
3723458e6c2Smrg  if test $am_rc -ne 0; then
3733458e6c2Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743458e6c2Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3753458e6c2Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3763458e6c2Smrg    necessary).  You can also try re-running configure with the
3773458e6c2Smrg    '--disable-dependency-tracking' option to at least be able to build
3783458e6c2Smrg    the package (albeit without support for automatic dependency tracking).])
3793458e6c2Smrg  fi
3803458e6c2Smrg  AS_UNSET([am_dirpart])
3813458e6c2Smrg  AS_UNSET([am_filepart])
3823458e6c2Smrg  AS_UNSET([am_mf])
3833458e6c2Smrg  AS_UNSET([am_rc])
3843458e6c2Smrg  rm -f conftest-deps.mk
3858650bb69Smrg}
3862c7c4e3dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3872c7c4e3dSmrg
3882c7c4e3dSmrg
3892c7c4e3dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3902c7c4e3dSmrg# -----------------------------
3912c7c4e3dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3922c7c4e3dSmrg#
3933458e6c2Smrg# This code is only required when automatic dependency tracking is enabled.
3943458e6c2Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953458e6c2Smrg# order to bootstrap the dependency handling code.
3962c7c4e3dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3972c7c4e3dSmrg[AC_CONFIG_COMMANDS([depfiles],
3982c7c4e3dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993458e6c2Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4002c7c4e3dSmrg
4018650bb69Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4022c7c4e3dSmrg
4033458e6c2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4048650bb69Smrg#
4058650bb69Smrg# This file is free software; the Free Software Foundation
4068650bb69Smrg# gives unlimited permission to copy and/or distribute it,
4078650bb69Smrg# with or without modifications, as long as this notice is preserved.
4082c7c4e3dSmrg
4098650bb69Smrg# This macro actually does too much.  Some checks are only needed if
4108650bb69Smrg# your package does certain things.  But this isn't really a big deal.
4118650bb69Smrg
4122becc446Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4132becc446Smrgm4_define([AC_PROG_CC],
4142becc446Smrgm4_defn([AC_PROG_CC])
4152becc446Smrg[_AM_PROG_CC_C_O
4162becc446Smrg])
4172becc446Smrg
4188650bb69Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4198650bb69Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4208650bb69Smrg# -----------------------------------------------
4218650bb69Smrg# The call with PACKAGE and VERSION arguments is the old style
4228650bb69Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4238650bb69Smrg# and VERSION should now be passed to AC_INIT and removed from
4248650bb69Smrg# the call to AM_INIT_AUTOMAKE.
4258650bb69Smrg# We support both call styles for the transition.  After
4268650bb69Smrg# the next Automake release, Autoconf can make the AC_INIT
4278650bb69Smrg# arguments mandatory, and then we can depend on a new Autoconf
4288650bb69Smrg# release and drop the old call support.
4298650bb69SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4302becc446Smrg[AC_PREREQ([2.65])dnl
4313458e6c2Smrgm4_ifdef([_$0_ALREADY_INIT],
4323458e6c2Smrg  [m4_fatal([$0 expanded multiple times
4333458e6c2Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343458e6c2Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4358650bb69Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4368650bb69Smrgdnl the ones we care about.
4378650bb69Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4388650bb69SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4398650bb69SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4408650bb69Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4418650bb69Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4428650bb69Smrg  # is not polluted with repeated "-I."
4438650bb69Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4448650bb69Smrg  # test to see if srcdir already configured
4458650bb69Smrg  if test -f $srcdir/config.status; then
4468650bb69Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4478650bb69Smrg  fi
4482c7c4e3dSmrgfi
4498650bb69Smrg
4508650bb69Smrg# test whether we have cygpath
4518650bb69Smrgif test -z "$CYGPATH_W"; then
4528650bb69Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4538650bb69Smrg    CYGPATH_W='cygpath -w'
4548650bb69Smrg  else
4558650bb69Smrg    CYGPATH_W=echo
4568650bb69Smrg  fi
4572c7c4e3dSmrgfi
4588650bb69SmrgAC_SUBST([CYGPATH_W])
4592c7c4e3dSmrg
4608650bb69Smrg# Define the identity of the package.
4618650bb69Smrgdnl Distinguish between old-style and new-style calls.
4628650bb69Smrgm4_ifval([$2],
4632becc446Smrg[AC_DIAGNOSE([obsolete],
4642becc446Smrg             [$0: two- and three-arguments forms are deprecated.])
4652becc446Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4668650bb69Smrg AC_SUBST([PACKAGE], [$1])dnl
4678650bb69Smrg AC_SUBST([VERSION], [$2])],
4688650bb69Smrg[_AM_SET_OPTIONS([$1])dnl
4698650bb69Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4702becc446Smrgm4_if(
4713458e6c2Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4722becc446Smrg  [ok:ok],,
4738650bb69Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4748650bb69Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4758650bb69Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4762c7c4e3dSmrg
4778650bb69Smrg_AM_IF_OPTION([no-define],,
4782becc446Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4792becc446Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4802c7c4e3dSmrg
4818650bb69Smrg# Some tools Automake needs.
4828650bb69SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4838650bb69SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4842becc446SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4852becc446SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4862becc446SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4872becc446SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4882becc446SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4898650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4908650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4912becc446SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4922becc446Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4932becc446Smrg# dies out for good.  For more background, see:
4943458e6c2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953458e6c2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4962becc446SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4972becc446Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4982becc446Smrg# system "awk" is bad on some platforms.
4998650bb69SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5008650bb69SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5018650bb69SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5028650bb69Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5038650bb69Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5048650bb69Smrg			     [_AM_PROG_TAR([v7])])])
5058650bb69Smrg_AM_IF_OPTION([no-dependencies],,
5068650bb69Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5072becc446Smrg		  [_AM_DEPENDENCIES([CC])],
5082becc446Smrg		  [m4_define([AC_PROG_CC],
5092becc446Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5108650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5112becc446Smrg		  [_AM_DEPENDENCIES([CXX])],
5122becc446Smrg		  [m4_define([AC_PROG_CXX],
5132becc446Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5148650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5152becc446Smrg		  [_AM_DEPENDENCIES([OBJC])],
5162becc446Smrg		  [m4_define([AC_PROG_OBJC],
5172becc446Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5182becc446SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5192becc446Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5202becc446Smrg		  [m4_define([AC_PROG_OBJCXX],
5212becc446Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5228650bb69Smrg])
5233458e6c2Smrg# Variables for tags utilities; see am/tags.am
5243458e6c2Smrgif test -z "$CTAGS"; then
5253458e6c2Smrg  CTAGS=ctags
5263458e6c2Smrgfi
5273458e6c2SmrgAC_SUBST([CTAGS])
5283458e6c2Smrgif test -z "$ETAGS"; then
5293458e6c2Smrg  ETAGS=etags
5303458e6c2Smrgfi
5313458e6c2SmrgAC_SUBST([ETAGS])
5323458e6c2Smrgif test -z "$CSCOPE"; then
5333458e6c2Smrg  CSCOPE=cscope
5343458e6c2Smrgfi
5353458e6c2SmrgAC_SUBST([CSCOPE])
5363458e6c2Smrg
5372becc446SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5382becc446Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5392becc446Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5402becc446Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5418650bb69SmrgAC_CONFIG_COMMANDS_PRE(dnl
5428650bb69Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5438650bb69Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5442becc446Smrg
5452becc446Smrg# POSIX will say in a future version that running "rm -f" with no argument
5462becc446Smrg# is OK; and we want to be able to make that assumption in our Makefile
5472becc446Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5482becc446Smrg# actually supported "in the wild" to an acceptable degree.
5492becc446Smrg# See automake bug#10828.
5502becc446Smrg# To make any issue more visible, cause the running configure to be aborted
5512becc446Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5522becc446Smrg# user can still override this though.
5532becc446Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5542becc446Smrg  cat >&2 <<'END'
5552becc446SmrgOops!
5562becc446Smrg
5572becc446SmrgYour 'rm' program seems unable to run without file operands specified
5582becc446Smrgon the command line, even when the '-f' option is present.  This is contrary
5592becc446Smrgto the behaviour of most rm programs out there, and not conforming with
5602becc446Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5612becc446Smrg
5622becc446SmrgPlease tell bug-automake@gnu.org about your system, including the value
5632becc446Smrgof your $PATH and any error possibly output before this message.  This
5642becc446Smrgcan help us improve future automake versions.
5652becc446Smrg
5662becc446SmrgEND
5672becc446Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5682becc446Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5692becc446Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5702becc446Smrg    echo >&2
5712becc446Smrg  else
5722becc446Smrg    cat >&2 <<'END'
5732becc446SmrgAborting the configuration process, to ensure you take notice of the issue.
5742becc446Smrg
5752becc446SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5763458e6c2Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5772becc446Smrg
5782becc446SmrgIf you want to complete the configuration process using your problematic
5792becc446Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5802becc446Smrgto "yes", and re-run configure.
5812becc446Smrg
5822becc446SmrgEND
5832becc446Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5842becc446Smrg  fi
5852becc446Smrgfi
5862becc446Smrgdnl The trailing newline in this macro's definition is deliberate, for
5872becc446Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5882becc446Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5898650bb69Smrg])
5902c7c4e3dSmrg
5912becc446Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5928650bb69Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5938650bb69Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5948650bb69Smrgm4_define([_AC_COMPILER_EXEEXT],
5958650bb69Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5962c7c4e3dSmrg
5978650bb69Smrg# When config.status generates a header, we must update the stamp-h file.
5988650bb69Smrg# This file resides in the same directory as the config header
5998650bb69Smrg# that is generated.  The stamp files are numbered to have different names.
6008650bb69Smrg
6018650bb69Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6028650bb69Smrg# loop where config.status creates the headers, so we can generate
6038650bb69Smrg# our stamp files there.
6048650bb69SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6058650bb69Smrg[# Compute $1's index in $config_headers.
6068650bb69Smrg_am_arg=$1
6078650bb69Smrg_am_stamp_count=1
6088650bb69Smrgfor _am_header in $config_headers :; do
6098650bb69Smrg  case $_am_header in
6108650bb69Smrg    $_am_arg | $_am_arg:* )
6118650bb69Smrg      break ;;
6128650bb69Smrg    * )
6138650bb69Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6148650bb69Smrg  esac
6158650bb69Smrgdone
6168650bb69Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6172c7c4e3dSmrg
6183458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6198650bb69Smrg#
6208650bb69Smrg# This file is free software; the Free Software Foundation
6218650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6228650bb69Smrg# with or without modifications, as long as this notice is preserved.
6232c7c4e3dSmrg
6248650bb69Smrg# AM_PROG_INSTALL_SH
6258650bb69Smrg# ------------------
6268650bb69Smrg# Define $install_sh.
6278650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6288650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6292becc446Smrgif test x"${install_sh+set}" != xset; then
6308650bb69Smrg  case $am_aux_dir in
6318650bb69Smrg  *\ * | *\	*)
6328650bb69Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6338650bb69Smrg  *)
6348650bb69Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6358650bb69Smrg  esac
6362c7c4e3dSmrgfi
6372becc446SmrgAC_SUBST([install_sh])])
6382c7c4e3dSmrg
6393458e6c2Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6408650bb69Smrg#
6418650bb69Smrg# This file is free software; the Free Software Foundation
6428650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6438650bb69Smrg# with or without modifications, as long as this notice is preserved.
6442c7c4e3dSmrg
6458650bb69Smrg# Check whether the underlying file-system supports filenames
6468650bb69Smrg# with a leading dot.  For instance MS-DOS doesn't.
6478650bb69SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6488650bb69Smrg[rm -rf .tst 2>/dev/null
6498650bb69Smrgmkdir .tst 2>/dev/null
6508650bb69Smrgif test -d .tst; then
6518650bb69Smrg  am__leading_dot=.
6528650bb69Smrgelse
6538650bb69Smrg  am__leading_dot=_
6548650bb69Smrgfi
6558650bb69Smrgrmdir .tst 2>/dev/null
6568650bb69SmrgAC_SUBST([am__leading_dot])])
6572c7c4e3dSmrg
6588650bb69Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6592c7c4e3dSmrg
6603458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6618650bb69Smrg#
6628650bb69Smrg# This file is free software; the Free Software Foundation
6638650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6648650bb69Smrg# with or without modifications, as long as this notice is preserved.
6652c7c4e3dSmrg
6668650bb69Smrg# AM_MAKE_INCLUDE()
6678650bb69Smrg# -----------------
6683458e6c2Smrg# Check whether make has an 'include' directive that can support all
6693458e6c2Smrg# the idioms we need for our automatic dependency tracking code.
6708650bb69SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6713458e6c2Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6723458e6c2Smrgcat > confinc.mk << 'END'
6738650bb69Smrgam__doit:
6743458e6c2Smrg	@echo this is the am__doit target >confinc.out
6758650bb69Smrg.PHONY: am__doit
6768650bb69SmrgEND
6778650bb69Smrgam__include="#"
6788650bb69Smrgam__quote=
6793458e6c2Smrg# BSD make does it like this.
6803458e6c2Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6813458e6c2Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6823458e6c2Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6833458e6c2Smrg_am_result=no
6843458e6c2Smrgfor s in GNU BSD; do
6853458e6c2Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6863458e6c2Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6873458e6c2Smrg      ['0:this is the am__doit target'],
6883458e6c2Smrg      [AS_CASE([$s],
6893458e6c2Smrg          [BSD], [am__include='.include' am__quote='"'],
6903458e6c2Smrg          [am__include='include' am__quote=''])])
6913458e6c2Smrg  if test "$am__include" != "#"; then
6923458e6c2Smrg    _am_result="yes ($s style)"
6933458e6c2Smrg    break
6943458e6c2Smrg  fi
6953458e6c2Smrgdone
6963458e6c2Smrgrm -f confinc.* confmf.*
6973458e6c2SmrgAC_MSG_RESULT([${_am_result}])
6983458e6c2SmrgAC_SUBST([am__include])])
6993458e6c2SmrgAC_SUBST([am__quote])])
7002c7c4e3dSmrg
7018650bb69Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7022c7c4e3dSmrg
7033458e6c2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7048650bb69Smrg#
7058650bb69Smrg# This file is free software; the Free Software Foundation
7068650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7078650bb69Smrg# with or without modifications, as long as this notice is preserved.
7082c7c4e3dSmrg
7098650bb69Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7108650bb69Smrg# ------------------------------
7118650bb69SmrgAC_DEFUN([AM_MISSING_PROG],
7128650bb69Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7138650bb69Smrg$1=${$1-"${am_missing_run}$2"}
7148650bb69SmrgAC_SUBST($1)])
7152c7c4e3dSmrg
7168650bb69Smrg# AM_MISSING_HAS_RUN
7178650bb69Smrg# ------------------
7182becc446Smrg# Define MISSING if not defined so far and test if it is modern enough.
7192becc446Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7208650bb69SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7218650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7228650bb69SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7238650bb69Smrgif test x"${MISSING+set}" != xset; then
7243458e6c2Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7252c7c4e3dSmrgfi
7268650bb69Smrg# Use eval to expand $SHELL
7272becc446Smrgif eval "$MISSING --is-lightweight"; then
7282becc446Smrg  am_missing_run="$MISSING "
7298650bb69Smrgelse
7308650bb69Smrg  am_missing_run=
7312becc446Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7328650bb69Smrgfi
7338650bb69Smrg])
7342c7c4e3dSmrg
7358650bb69Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7368650bb69Smrg
7373458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7382c7c4e3dSmrg#
7398650bb69Smrg# This file is free software; the Free Software Foundation
7408650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7418650bb69Smrg# with or without modifications, as long as this notice is preserved.
7422c7c4e3dSmrg
7438650bb69Smrg# _AM_MANGLE_OPTION(NAME)
7448650bb69Smrg# -----------------------
7458650bb69SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7468650bb69Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7472c7c4e3dSmrg
7488650bb69Smrg# _AM_SET_OPTION(NAME)
7492becc446Smrg# --------------------
7508650bb69Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7518650bb69SmrgAC_DEFUN([_AM_SET_OPTION],
7522becc446Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7532c7c4e3dSmrg
7548650bb69Smrg# _AM_SET_OPTIONS(OPTIONS)
7552becc446Smrg# ------------------------
7568650bb69Smrg# OPTIONS is a space-separated list of Automake options.
7578650bb69SmrgAC_DEFUN([_AM_SET_OPTIONS],
7588650bb69Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7592c7c4e3dSmrg
7608650bb69Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7618650bb69Smrg# -------------------------------------------
7628650bb69Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7638650bb69SmrgAC_DEFUN([_AM_IF_OPTION],
7648650bb69Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7658650bb69Smrg
7663458e6c2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7672becc446Smrg#
7682becc446Smrg# This file is free software; the Free Software Foundation
7692becc446Smrg# gives unlimited permission to copy and/or distribute it,
7702becc446Smrg# with or without modifications, as long as this notice is preserved.
7718650bb69Smrg
7722becc446Smrg# _AM_PROG_CC_C_O
7732becc446Smrg# ---------------
7742becc446Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7752becc446Smrg# to automatically call this.
7762becc446SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7772becc446Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7782becc446SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7792becc446SmrgAC_LANG_PUSH([C])dnl
7802becc446SmrgAC_CACHE_CHECK(
7812becc446Smrg  [whether $CC understands -c and -o together],
7822becc446Smrg  [am_cv_prog_cc_c_o],
7832becc446Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7842becc446Smrg  # Make sure it works both with $CC and with simple cc.
7852becc446Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7862becc446Smrg  # compilers refuse to overwrite an existing .o file with -o,
7872becc446Smrg  # though they will create one.
7882becc446Smrg  am_cv_prog_cc_c_o=yes
7892becc446Smrg  for am_i in 1 2; do
7902becc446Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7912becc446Smrg         && test -f conftest2.$ac_objext; then
7922becc446Smrg      : OK
7932becc446Smrg    else
7942becc446Smrg      am_cv_prog_cc_c_o=no
7952becc446Smrg      break
7962becc446Smrg    fi
7972becc446Smrg  done
7982becc446Smrg  rm -f core conftest*
7992becc446Smrg  unset am_i])
8002becc446Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8012becc446Smrg   # Losing compiler, so override with the script.
8022becc446Smrg   # FIXME: It is wrong to rewrite CC.
8032becc446Smrg   # But if we don't then we get into trouble of one sort or another.
8042becc446Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8052becc446Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8062becc446Smrg   CC="$am_aux_dir/compile $CC"
8072becc446Smrgfi
8082becc446SmrgAC_LANG_POP([C])])
8092becc446Smrg
8102becc446Smrg# For backward compatibility.
8112becc446SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8122becc446Smrg
8133458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8142c7c4e3dSmrg#
8158650bb69Smrg# This file is free software; the Free Software Foundation
8168650bb69Smrg# gives unlimited permission to copy and/or distribute it,
8178650bb69Smrg# with or without modifications, as long as this notice is preserved.
8188650bb69Smrg
8192becc446Smrg# AM_RUN_LOG(COMMAND)
8202becc446Smrg# -------------------
8212becc446Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8222becc446Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8232becc446SmrgAC_DEFUN([AM_RUN_LOG],
8242becc446Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8252becc446Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8262becc446Smrg   ac_status=$?
8272becc446Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8282becc446Smrg   (exit $ac_status); }])
8292becc446Smrg
8302becc446Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8312becc446Smrg
8323458e6c2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8332becc446Smrg#
8342becc446Smrg# This file is free software; the Free Software Foundation
8352becc446Smrg# gives unlimited permission to copy and/or distribute it,
8362becc446Smrg# with or without modifications, as long as this notice is preserved.
8378650bb69Smrg
8388650bb69Smrg# AM_SANITY_CHECK
8398650bb69Smrg# ---------------
8408650bb69SmrgAC_DEFUN([AM_SANITY_CHECK],
8418650bb69Smrg[AC_MSG_CHECKING([whether build environment is sane])
8428650bb69Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8438650bb69Smrg# name.  Accept space and tab only in the latter.
8448650bb69Smrgam_lf='
8458650bb69Smrg'
8468650bb69Smrgcase `pwd` in
8478650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8488650bb69Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8498650bb69Smrgesac
8508650bb69Smrgcase $srcdir in
8518650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8522becc446Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8538650bb69Smrgesac
8548650bb69Smrg
8552becc446Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8568650bb69Smrg# arguments.  Must try -L first in case configure is actually a
8578650bb69Smrg# symlink; some systems play weird games with the mod time of symlinks
8588650bb69Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8598650bb69Smrg# directory).
8608650bb69Smrgif (
8612becc446Smrg   am_has_slept=no
8622becc446Smrg   for am_try in 1 2; do
8632becc446Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8642becc446Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8652becc446Smrg     if test "$[*]" = "X"; then
8662becc446Smrg	# -L didn't work.
8672becc446Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8682becc446Smrg     fi
8692becc446Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8702becc446Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8712becc446Smrg
8722becc446Smrg	# If neither matched, then we have a broken ls.  This can happen
8732becc446Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8742becc446Smrg	# broken ls alias from the environment.  This has actually
8752becc446Smrg	# happened.  Such a system could not be considered "sane".
8762becc446Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8772becc446Smrg  alias in your environment])
8782becc446Smrg     fi
8792becc446Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8802becc446Smrg       break
8812becc446Smrg     fi
8822becc446Smrg     # Just in case.
8832becc446Smrg     sleep 1
8842becc446Smrg     am_has_slept=yes
8852becc446Smrg   done
8868650bb69Smrg   test "$[2]" = conftest.file
8878650bb69Smrg   )
8888650bb69Smrgthen
8898650bb69Smrg   # Ok.
8908650bb69Smrg   :
8918650bb69Smrgelse
8928650bb69Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8938650bb69SmrgCheck your system clock])
8948650bb69Smrgfi
8952becc446SmrgAC_MSG_RESULT([yes])
8962becc446Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8972becc446Smrg# generated files are strictly newer.
8982becc446Smrgam_sleep_pid=
8992becc446Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9002becc446Smrg  ( sleep 1 ) &
9012becc446Smrg  am_sleep_pid=$!
9022becc446Smrgfi
9032becc446SmrgAC_CONFIG_COMMANDS_PRE(
9042becc446Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9052becc446Smrg   if test -n "$am_sleep_pid"; then
9062becc446Smrg     # Hide warnings about reused PIDs.
9072becc446Smrg     wait $am_sleep_pid 2>/dev/null
9082becc446Smrg   fi
9092becc446Smrg   AC_MSG_RESULT([done])])
9102becc446Smrgrm -f conftest.file
9112becc446Smrg])
9128650bb69Smrg
9133458e6c2Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9142c7c4e3dSmrg#
9158650bb69Smrg# This file is free software; the Free Software Foundation
9168650bb69Smrg# gives unlimited permission to copy and/or distribute it,
9178650bb69Smrg# with or without modifications, as long as this notice is preserved.
9188650bb69Smrg
9198650bb69Smrg# AM_SILENT_RULES([DEFAULT])
9208650bb69Smrg# --------------------------
9218650bb69Smrg# Enable less verbose build rules; with the default set to DEFAULT
9222becc446Smrg# ("yes" being less verbose, "no" or empty being verbose).
9238650bb69SmrgAC_DEFUN([AM_SILENT_RULES],
9242becc446Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9252becc446SmrgAS_HELP_STRING(
9262becc446Smrg  [--enable-silent-rules],
9272becc446Smrg  [less verbose build output (undo: "make V=1")])
9282becc446SmrgAS_HELP_STRING(
9292becc446Smrg  [--disable-silent-rules],
9302becc446Smrg  [verbose build output (undo: "make V=0")])dnl
9312becc446Smrg])
9322becc446Smrgcase $enable_silent_rules in @%:@ (((
9332becc446Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9342becc446Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9352becc446Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9368650bb69Smrgesac
9372becc446Smrgdnl
9382becc446Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9392becc446Smrgdnl do not support nested variable expansions.
9402becc446Smrgdnl See automake bug#9928 and bug#10237.
9412becc446Smrgam_make=${MAKE-make}
9422becc446SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9432becc446Smrg   [am_cv_make_support_nested_variables],
9442becc446Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9452becc446SmrgBAR0=false
9462becc446SmrgBAR1=true
9472becc446SmrgV=1
9482becc446Smrgam__doit:
9492becc446Smrg	@$(TRUE)
9502becc446Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9512becc446Smrg  am_cv_make_support_nested_variables=yes
9522becc446Smrgelse
9532becc446Smrg  am_cv_make_support_nested_variables=no
9542becc446Smrgfi])
9552becc446Smrgif test $am_cv_make_support_nested_variables = yes; then
9562becc446Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9572becc446Smrg  AM_V='$(V)'
9582becc446Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9592becc446Smrgelse
9602becc446Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9612becc446Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9622becc446Smrgfi
9632becc446SmrgAC_SUBST([AM_V])dnl
9642becc446SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9652becc446SmrgAC_SUBST([AM_DEFAULT_V])dnl
9662becc446SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9678650bb69SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9688650bb69SmrgAM_BACKSLASH='\'
9698650bb69SmrgAC_SUBST([AM_BACKSLASH])dnl
9708650bb69Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9718650bb69Smrg])
9728650bb69Smrg
9733458e6c2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9742c7c4e3dSmrg#
9758650bb69Smrg# This file is free software; the Free Software Foundation
9768650bb69Smrg# gives unlimited permission to copy and/or distribute it,
9778650bb69Smrg# with or without modifications, as long as this notice is preserved.
9782c7c4e3dSmrg
9798650bb69Smrg# AM_PROG_INSTALL_STRIP
9808650bb69Smrg# ---------------------
9812becc446Smrg# One issue with vendor 'install' (even GNU) is that you can't
9828650bb69Smrg# specify the program used to strip binaries.  This is especially
9838650bb69Smrg# annoying in cross-compiling environments, where the build's strip
9848650bb69Smrg# is unlikely to handle the host's binaries.
9858650bb69Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9862becc446Smrg# always use install-sh in "make install-strip", and initialize
9878650bb69Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9888650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9898650bb69Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9902becc446Smrg# Installed binaries are usually stripped using 'strip' when the user
9912becc446Smrg# run "make install-strip".  However 'strip' might not be the right
9928650bb69Smrg# tool to use in cross-compilation environments, therefore Automake
9932becc446Smrg# will honor the 'STRIP' environment variable to overrule this program.
9942becc446Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9958650bb69Smrgif test "$cross_compiling" != no; then
9968650bb69Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9978650bb69Smrgfi
9988650bb69SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9998650bb69SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10002c7c4e3dSmrg
10013458e6c2Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10028650bb69Smrg#
10038650bb69Smrg# This file is free software; the Free Software Foundation
10048650bb69Smrg# gives unlimited permission to copy and/or distribute it,
10058650bb69Smrg# with or without modifications, as long as this notice is preserved.
10062c7c4e3dSmrg
10078650bb69Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10088650bb69Smrg# ---------------------------
10098650bb69Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10108650bb69Smrg# This macro is traced by Automake.
10118650bb69SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10122c7c4e3dSmrg
10138650bb69Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10142becc446Smrg# --------------------------
10158650bb69Smrg# Public sister of _AM_SUBST_NOTMAKE.
10168650bb69SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10172c7c4e3dSmrg
10188650bb69Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10192c7c4e3dSmrg
10203458e6c2Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10218650bb69Smrg#
10228650bb69Smrg# This file is free software; the Free Software Foundation
10238650bb69Smrg# gives unlimited permission to copy and/or distribute it,
10248650bb69Smrg# with or without modifications, as long as this notice is preserved.
10252c7c4e3dSmrg
10268650bb69Smrg# _AM_PROG_TAR(FORMAT)
10278650bb69Smrg# --------------------
10288650bb69Smrg# Check how to create a tarball in format FORMAT.
10292becc446Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10308650bb69Smrg#
10318650bb69Smrg# Substitute a variable $(am__tar) that is a command
10328650bb69Smrg# writing to stdout a FORMAT-tarball containing the directory
10338650bb69Smrg# $tardir.
10348650bb69Smrg#     tardir=directory && $(am__tar) > result.tar
10358650bb69Smrg#
10368650bb69Smrg# Substitute a variable $(am__untar) that extract such
10378650bb69Smrg# a tarball read from stdin.
10388650bb69Smrg#     $(am__untar) < result.tar
10392becc446Smrg#
10408650bb69SmrgAC_DEFUN([_AM_PROG_TAR],
10412becc446Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10422becc446Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10432becc446SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10442becc446Smrg
10452becc446Smrg# We'll loop over all known methods to create a tar archive until one works.
10468650bb69Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
10472c7c4e3dSmrg
10482becc446Smrgm4_if([$1], [v7],
10492becc446Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10502becc446Smrg
10512becc446Smrg  [m4_case([$1],
10522becc446Smrg    [ustar],
10532becc446Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10542becc446Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10552becc446Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10562becc446Smrg      # and bug#13588).
10572becc446Smrg      am_max_uid=2097151 # 2^21 - 1
10582becc446Smrg      am_max_gid=$am_max_uid
10592becc446Smrg      # The $UID and $GID variables are not portable, so we need to resort
10602becc446Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10612becc446Smrg      # below are definitely unexpected, so allow the users to see them
10622becc446Smrg      # (that is, avoid stderr redirection).
10632becc446Smrg      am_uid=`id -u || echo unknown`
10642becc446Smrg      am_gid=`id -g || echo unknown`
10652becc446Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10662becc446Smrg      if test $am_uid -le $am_max_uid; then
10672becc446Smrg         AC_MSG_RESULT([yes])
10682becc446Smrg      else
10692becc446Smrg         AC_MSG_RESULT([no])
10702becc446Smrg         _am_tools=none
10712becc446Smrg      fi
10722becc446Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10732becc446Smrg      if test $am_gid -le $am_max_gid; then
10742becc446Smrg         AC_MSG_RESULT([yes])
10752becc446Smrg      else
10762becc446Smrg        AC_MSG_RESULT([no])
10772becc446Smrg        _am_tools=none
10782becc446Smrg      fi],
10792becc446Smrg
10802becc446Smrg  [pax],
10812becc446Smrg    [],
10822becc446Smrg
10832becc446Smrg  [m4_fatal([Unknown tar format])])
10842becc446Smrg
10852becc446Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10862becc446Smrg
10872becc446Smrg  # Go ahead even if we have the value already cached.  We do so because we
10882becc446Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10892becc446Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10902becc446Smrg
10912becc446Smrg  for _am_tool in $_am_tools; do
10922becc446Smrg    case $_am_tool in
10932becc446Smrg    gnutar)
10942becc446Smrg      for _am_tar in tar gnutar gtar; do
10952becc446Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10962becc446Smrg      done
10972becc446Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10982becc446Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10992becc446Smrg      am__untar="$_am_tar -xf -"
11002becc446Smrg      ;;
11012becc446Smrg    plaintar)
11022becc446Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11032becc446Smrg      # ustar tarball either.
11042becc446Smrg      (tar --version) >/dev/null 2>&1 && continue
11052becc446Smrg      am__tar='tar chf - "$$tardir"'
11062becc446Smrg      am__tar_='tar chf - "$tardir"'
11072becc446Smrg      am__untar='tar xf -'
11082becc446Smrg      ;;
11092becc446Smrg    pax)
11102becc446Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11112becc446Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11122becc446Smrg      am__untar='pax -r'
11132becc446Smrg      ;;
11142becc446Smrg    cpio)
11152becc446Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11162becc446Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11172becc446Smrg      am__untar='cpio -i -H $1 -d'
11182becc446Smrg      ;;
11192becc446Smrg    none)
11202becc446Smrg      am__tar=false
11212becc446Smrg      am__tar_=false
11222becc446Smrg      am__untar=false
11232becc446Smrg      ;;
11242becc446Smrg    esac
11258650bb69Smrg
11262becc446Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11272becc446Smrg    # and am__untar set.
11282becc446Smrg    test -n "${am_cv_prog_tar_$1}" && break
11292becc446Smrg
11302becc446Smrg    # tar/untar a dummy directory, and stop if the command works.
11312becc446Smrg    rm -rf conftest.dir
11322becc446Smrg    mkdir conftest.dir
11332becc446Smrg    echo GrepMe > conftest.dir/file
11342becc446Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11352becc446Smrg    rm -rf conftest.dir
11362becc446Smrg    if test -s conftest.tar; then
11372becc446Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11382becc446Smrg      AM_RUN_LOG([cat conftest.dir/file])
11392becc446Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11402becc446Smrg    fi
11412becc446Smrg  done
11428650bb69Smrg  rm -rf conftest.dir
11432c7c4e3dSmrg
11442becc446Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11452becc446Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11462becc446Smrg
11478650bb69SmrgAC_SUBST([am__tar])
11488650bb69SmrgAC_SUBST([am__untar])
11498650bb69Smrg]) # _AM_PROG_TAR
11508650bb69Smrg
11513458e6c2Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11523458e6c2Smrgdnl serial 11 (pkg-config-0.29)
11533458e6c2Smrgdnl
11543458e6c2Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11553458e6c2Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11563458e6c2Smrgdnl
11573458e6c2Smrgdnl This program is free software; you can redistribute it and/or modify
11583458e6c2Smrgdnl it under the terms of the GNU General Public License as published by
11593458e6c2Smrgdnl the Free Software Foundation; either version 2 of the License, or
11603458e6c2Smrgdnl (at your option) any later version.
11613458e6c2Smrgdnl
11623458e6c2Smrgdnl This program is distributed in the hope that it will be useful, but
11633458e6c2Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11643458e6c2Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11653458e6c2Smrgdnl General Public License for more details.
11663458e6c2Smrgdnl
11673458e6c2Smrgdnl You should have received a copy of the GNU General Public License
11683458e6c2Smrgdnl along with this program; if not, write to the Free Software
11693458e6c2Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11703458e6c2Smrgdnl 02111-1307, USA.
11713458e6c2Smrgdnl
11723458e6c2Smrgdnl As a special exception to the GNU General Public License, if you
11733458e6c2Smrgdnl distribute this file as part of a program that contains a
11743458e6c2Smrgdnl configuration script generated by Autoconf, you may include it under
11753458e6c2Smrgdnl the same distribution terms that you use for the rest of that
11763458e6c2Smrgdnl program.
11773458e6c2Smrg
11783458e6c2Smrgdnl PKG_PREREQ(MIN-VERSION)
11793458e6c2Smrgdnl -----------------------
11803458e6c2Smrgdnl Since: 0.29
11813458e6c2Smrgdnl
11823458e6c2Smrgdnl Verify that the version of the pkg-config macros are at least
11833458e6c2Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11843458e6c2Smrgdnl installed version of pkg-config, this checks the developer's version
11853458e6c2Smrgdnl of pkg.m4 when generating configure.
11863458e6c2Smrgdnl
11873458e6c2Smrgdnl To ensure that this macro is defined, also add:
11883458e6c2Smrgdnl m4_ifndef([PKG_PREREQ],
11893458e6c2Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11903458e6c2Smrgdnl
11913458e6c2Smrgdnl See the "Since" comment for each macro you use to see what version
11923458e6c2Smrgdnl of the macros you require.
11933458e6c2Smrgm4_defun([PKG_PREREQ],
11943458e6c2Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11953458e6c2Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11963458e6c2Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11973458e6c2Smrg])dnl PKG_PREREQ
11983458e6c2Smrg
11993458e6c2Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12003458e6c2Smrgdnl ----------------------------------
12013458e6c2Smrgdnl Since: 0.16
12023458e6c2Smrgdnl
12033458e6c2Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12043458e6c2Smrgdnl first found in the path. Checks that the version of pkg-config found
12053458e6c2Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12063458e6c2Smrgdnl used since that's the first version where most current features of
12073458e6c2Smrgdnl pkg-config existed.
120816d7e2f1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120916d7e2f1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12103458e6c2Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12113458e6c2Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12123458e6c2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12133458e6c2SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12143458e6c2SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12153458e6c2Smrg
121616d7e2f1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121716d7e2f1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121816d7e2f1Smrgfi
121916d7e2f1Smrgif test -n "$PKG_CONFIG"; then
122016d7e2f1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122116d7e2f1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122216d7e2f1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122316d7e2f1Smrg		AC_MSG_RESULT([yes])
122416d7e2f1Smrg	else
122516d7e2f1Smrg		AC_MSG_RESULT([no])
122616d7e2f1Smrg		PKG_CONFIG=""
122716d7e2f1Smrg	fi
122816d7e2f1Smrgfi[]dnl
12293458e6c2Smrg])dnl PKG_PROG_PKG_CONFIG
123016d7e2f1Smrg
12313458e6c2Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12323458e6c2Smrgdnl -------------------------------------------------------------------
12333458e6c2Smrgdnl Since: 0.18
12343458e6c2Smrgdnl
12353458e6c2Smrgdnl Check to see whether a particular set of modules exists. Similar to
12363458e6c2Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12373458e6c2Smrgdnl
12383458e6c2Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12393458e6c2Smrgdnl only at the first occurence in configure.ac, so if the first place
12403458e6c2Smrgdnl it's called might be skipped (such as if it is within an "if", you
12413458e6c2Smrgdnl have to call PKG_CHECK_EXISTS manually
124216d7e2f1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124316d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124416d7e2f1Smrgif test -n "$PKG_CONFIG" && \
124516d7e2f1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12463458e6c2Smrg  m4_default([$2], [:])
124716d7e2f1Smrgm4_ifvaln([$3], [else
124816d7e2f1Smrg  $3])dnl
124916d7e2f1Smrgfi])
125016d7e2f1Smrg
12513458e6c2Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12523458e6c2Smrgdnl ---------------------------------------------
12533458e6c2Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12543458e6c2Smrgdnl pkg_failed based on the result.
125516d7e2f1Smrgm4_define([_PKG_CONFIG],
125616d7e2f1Smrg[if test -n "$$1"; then
125716d7e2f1Smrg    pkg_cv_[]$1="$$1"
125816d7e2f1Smrg elif test -n "$PKG_CONFIG"; then
125916d7e2f1Smrg    PKG_CHECK_EXISTS([$3],
12603458e6c2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12613458e6c2Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126216d7e2f1Smrg		     [pkg_failed=yes])
126316d7e2f1Smrg else
126416d7e2f1Smrg    pkg_failed=untried
126516d7e2f1Smrgfi[]dnl
12663458e6c2Smrg])dnl _PKG_CONFIG
126716d7e2f1Smrg
12683458e6c2Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12693458e6c2Smrgdnl ---------------------------
12703458e6c2Smrgdnl Internal check to see if pkg-config supports short errors.
127116d7e2f1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127216d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127316d7e2f1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127416d7e2f1Smrg        _pkg_short_errors_supported=yes
127516d7e2f1Smrgelse
127616d7e2f1Smrg        _pkg_short_errors_supported=no
127716d7e2f1Smrgfi[]dnl
12783458e6c2Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127916d7e2f1Smrg
128016d7e2f1Smrg
12813458e6c2Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12823458e6c2Smrgdnl   [ACTION-IF-NOT-FOUND])
12833458e6c2Smrgdnl --------------------------------------------------------------
12843458e6c2Smrgdnl Since: 0.4.0
12853458e6c2Smrgdnl
12863458e6c2Smrgdnl Note that if there is a possibility the first call to
12873458e6c2Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12883458e6c2Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128916d7e2f1SmrgAC_DEFUN([PKG_CHECK_MODULES],
129016d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129116d7e2f1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129216d7e2f1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129316d7e2f1Smrg
129416d7e2f1Smrgpkg_failed=no
129516d7e2f1SmrgAC_MSG_CHECKING([for $1])
129616d7e2f1Smrg
129716d7e2f1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129816d7e2f1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129916d7e2f1Smrg
130016d7e2f1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130116d7e2f1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130216d7e2f1SmrgSee the pkg-config man page for more details.])
130316d7e2f1Smrg
130416d7e2f1Smrgif test $pkg_failed = yes; then
13053458e6c2Smrg   	AC_MSG_RESULT([no])
130616d7e2f1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130716d7e2f1Smrg        if test $_pkg_short_errors_supported = yes; then
13083458e6c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130916d7e2f1Smrg        else 
13103458e6c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131116d7e2f1Smrg        fi
131216d7e2f1Smrg	# Put the nasty error message in config.log where it belongs
131316d7e2f1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131416d7e2f1Smrg
13153458e6c2Smrg	m4_default([$4], [AC_MSG_ERROR(
131616d7e2f1Smrg[Package requirements ($2) were not met:
131716d7e2f1Smrg
131816d7e2f1Smrg$$1_PKG_ERRORS
131916d7e2f1Smrg
132016d7e2f1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132116d7e2f1Smrginstalled software in a non-standard prefix.
132216d7e2f1Smrg
13233458e6c2Smrg_PKG_TEXT])[]dnl
13243458e6c2Smrg        ])
132516d7e2f1Smrgelif test $pkg_failed = untried; then
13263458e6c2Smrg     	AC_MSG_RESULT([no])
13273458e6c2Smrg	m4_default([$4], [AC_MSG_FAILURE(
132816d7e2f1Smrg[The pkg-config script could not be found or is too old.  Make sure it
132916d7e2f1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133016d7e2f1Smrgpath to pkg-config.
133116d7e2f1Smrg
133216d7e2f1Smrg_PKG_TEXT
133316d7e2f1Smrg
13343458e6c2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13353458e6c2Smrg        ])
133616d7e2f1Smrgelse
133716d7e2f1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133816d7e2f1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133916d7e2f1Smrg        AC_MSG_RESULT([yes])
13403458e6c2Smrg	$3
134116d7e2f1Smrgfi[]dnl
13423458e6c2Smrg])dnl PKG_CHECK_MODULES
13433458e6c2Smrg
13443458e6c2Smrg
13453458e6c2Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13463458e6c2Smrgdnl   [ACTION-IF-NOT-FOUND])
13473458e6c2Smrgdnl ---------------------------------------------------------------------
13483458e6c2Smrgdnl Since: 0.29
13493458e6c2Smrgdnl
13503458e6c2Smrgdnl Checks for existence of MODULES and gathers its build flags with
13513458e6c2Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13523458e6c2Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13533458e6c2Smrgdnl
13543458e6c2Smrgdnl Note that if there is a possibility the first call to
13553458e6c2Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13563458e6c2Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13573458e6c2Smrgdnl configure.ac.
13583458e6c2SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13593458e6c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13603458e6c2Smrg_save_PKG_CONFIG=$PKG_CONFIG
13613458e6c2SmrgPKG_CONFIG="$PKG_CONFIG --static"
13623458e6c2SmrgPKG_CHECK_MODULES($@)
13633458e6c2SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13643458e6c2Smrg])dnl PKG_CHECK_MODULES_STATIC
13653458e6c2Smrg
13663458e6c2Smrg
13673458e6c2Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13683458e6c2Smrgdnl -------------------------
13693458e6c2Smrgdnl Since: 0.27
13703458e6c2Smrgdnl
13713458e6c2Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13723458e6c2Smrgdnl should install pkg-config .pc files. By default the directory is
13733458e6c2Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13743458e6c2Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13753458e6c2Smrgdnl parameter.
13763458e6c2SmrgAC_DEFUN([PKG_INSTALLDIR],
13773458e6c2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13783458e6c2Smrgm4_pushdef([pkg_description],
13793458e6c2Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13803458e6c2SmrgAC_ARG_WITH([pkgconfigdir],
13813458e6c2Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13823458e6c2Smrg    [with_pkgconfigdir=]pkg_default)
13833458e6c2SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13843458e6c2Smrgm4_popdef([pkg_default])
13853458e6c2Smrgm4_popdef([pkg_description])
13863458e6c2Smrg])dnl PKG_INSTALLDIR
13873458e6c2Smrg
13883458e6c2Smrg
13893458e6c2Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13903458e6c2Smrgdnl --------------------------------
13913458e6c2Smrgdnl Since: 0.27
13923458e6c2Smrgdnl
13933458e6c2Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13943458e6c2Smrgdnl module should install arch-independent pkg-config .pc files. By
13953458e6c2Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13963458e6c2Smrgdnl changed by passing DIRECTORY. The user can override through the
13973458e6c2Smrgdnl --with-noarch-pkgconfigdir parameter.
13983458e6c2SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13993458e6c2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14003458e6c2Smrgm4_pushdef([pkg_description],
14013458e6c2Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14023458e6c2SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14033458e6c2Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14043458e6c2Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14053458e6c2SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14063458e6c2Smrgm4_popdef([pkg_default])
14073458e6c2Smrgm4_popdef([pkg_description])
14083458e6c2Smrg])dnl PKG_NOARCH_INSTALLDIR
14093458e6c2Smrg
14103458e6c2Smrg
14113458e6c2Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14123458e6c2Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14133458e6c2Smrgdnl -------------------------------------------
14143458e6c2Smrgdnl Since: 0.28
14153458e6c2Smrgdnl
14163458e6c2Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14173458e6c2SmrgAC_DEFUN([PKG_CHECK_VAR],
14183458e6c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14193458e6c2SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14203458e6c2Smrg
14213458e6c2Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14223458e6c2SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
14233458e6c2Smrg
14243458e6c2SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14253458e6c2Smrg])dnl PKG_CHECK_VAR
142616d7e2f1Smrg
14278650bb69Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14282c7c4e3dSmrgdnl
14293458e6c2Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14302becc446Smrgdnl
14318650bb69Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143216d7e2f1Smrgdnl copy of this software and associated documentation files (the "Software"),
143316d7e2f1Smrgdnl to deal in the Software without restriction, including without limitation
143416d7e2f1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143516d7e2f1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143616d7e2f1Smrgdnl Software is furnished to do so, subject to the following conditions:
14378650bb69Smrgdnl
143816d7e2f1Smrgdnl The above copyright notice and this permission notice (including the next
143916d7e2f1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144016d7e2f1Smrgdnl Software.
14418650bb69Smrgdnl
144216d7e2f1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144316d7e2f1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144416d7e2f1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144516d7e2f1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144616d7e2f1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144716d7e2f1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144816d7e2f1Smrgdnl DEALINGS IN THE SOFTWARE.
14498650bb69Smrg
14508650bb69Smrg# XORG_MACROS_VERSION(required-version)
14518650bb69Smrg# -------------------------------------
14528650bb69Smrg# Minimum version: 1.1.0
14538650bb69Smrg#
14548650bb69Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14558650bb69Smrg# your configure.ac with the minimum required version, such as:
14568650bb69Smrg# XORG_MACROS_VERSION(1.1)
14578650bb69Smrg#
14588650bb69Smrg# To ensure that this macro is defined, also add:
14598650bb69Smrg# m4_ifndef([XORG_MACROS_VERSION],
14608650bb69Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14618650bb69Smrg#
14628650bb69Smrg#
14632becc446Smrg# See the "minimum version" comment for each macro you use to see what
14648650bb69Smrg# version you require.
14658650bb69Smrgm4_defun([XORG_MACROS_VERSION],[
14663458e6c2Smrgm4_define([vers_have], [1.19.3])
14678650bb69Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14688650bb69Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14698650bb69Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14708650bb69Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14718650bb69Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14728650bb69Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14738650bb69Smrgm4_undefine([vers_have])
14748650bb69Smrgm4_undefine([maj_have])
14758650bb69Smrgm4_undefine([maj_needed])
14768650bb69Smrg]) # XORG_MACROS_VERSION
14772c7c4e3dSmrg
14782c7c4e3dSmrg# XORG_PROG_RAWCPP()
14792c7c4e3dSmrg# ------------------
14808650bb69Smrg# Minimum version: 1.0.0
14818650bb69Smrg#
14822c7c4e3dSmrg# Find cpp program and necessary flags for use in pre-processing text files
14832c7c4e3dSmrg# such as man pages and config files
14842c7c4e3dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14852c7c4e3dSmrgAC_REQUIRE([AC_PROG_CPP])
14863458e6c2SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14872c7c4e3dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14882c7c4e3dSmrg
14892c7c4e3dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14902c7c4e3dSmrg# which is not the best choice for supporting other OS'es, but covers most
14912c7c4e3dSmrg# of the ones we need for now.
14922c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149316d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14942c7c4e3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14952c7c4e3dSmrg	AC_MSG_RESULT([no])
14962c7c4e3dSmrgelse
14972c7c4e3dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14982c7c4e3dSmrg		RAWCPPFLAGS=-undef
14992c7c4e3dSmrg		AC_MSG_RESULT([yes])
15008650bb69Smrg	# under Cygwin unix is still defined even with -undef
15018650bb69Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15028650bb69Smrg		RAWCPPFLAGS="-undef -ansi"
15038650bb69Smrg		AC_MSG_RESULT([yes, with -ansi])
15042c7c4e3dSmrg	else
15052c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15062c7c4e3dSmrg	fi
15072c7c4e3dSmrgfi
15082c7c4e3dSmrgrm -f conftest.$ac_ext
15092c7c4e3dSmrg
15102c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151116d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15122c7c4e3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15132c7c4e3dSmrg	AC_MSG_RESULT([no])
15142c7c4e3dSmrgelse
15152c7c4e3dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15162becc446Smrg		TRADITIONALCPPFLAGS="-traditional"
15172c7c4e3dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15182c7c4e3dSmrg		AC_MSG_RESULT([yes])
15192c7c4e3dSmrg	else
15202c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15212c7c4e3dSmrg	fi
15222c7c4e3dSmrgfi
15232c7c4e3dSmrgrm -f conftest.$ac_ext
15242c7c4e3dSmrgAC_SUBST(RAWCPPFLAGS)
15252becc446SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15262c7c4e3dSmrg]) # XORG_PROG_RAWCPP
15272c7c4e3dSmrg
15282c7c4e3dSmrg# XORG_MANPAGE_SECTIONS()
15292c7c4e3dSmrg# -----------------------
15308650bb69Smrg# Minimum version: 1.0.0
15318650bb69Smrg#
15322c7c4e3dSmrg# Determine which sections man pages go in for the different man page types
15332c7c4e3dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15342c7c4e3dSmrg# Not sure if there's any better way than just hardcoding by OS name.
15352c7c4e3dSmrg# Override default settings by setting environment variables
153616d7e2f1Smrg# Added MAN_SUBSTS in version 1.8
153716d7e2f1Smrg# Added AC_PROG_SED in version 1.8
15382c7c4e3dSmrg
15392c7c4e3dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15402c7c4e3dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154116d7e2f1SmrgAC_REQUIRE([AC_PROG_SED])
15422c7c4e3dSmrg
15433458e6c2Smrgcase $host_os in
15443458e6c2Smrg    solaris*)
15453458e6c2Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15463458e6c2Smrg        # check for a man page file found in later versions that use
15473458e6c2Smrg        # traditional section numbers instead
15483458e6c2Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15493458e6c2Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15503458e6c2Smrg        ;;
15513458e6c2Smrg    *) SYSV_MAN_SECTIONS=false ;;
15523458e6c2Smrgesac
15533458e6c2Smrg
15542c7c4e3dSmrgif test x$APP_MAN_SUFFIX = x    ; then
15558650bb69Smrg    APP_MAN_SUFFIX=1
15562c7c4e3dSmrgfi
15572c7c4e3dSmrgif test x$APP_MAN_DIR = x    ; then
15588650bb69Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15592c7c4e3dSmrgfi
15602c7c4e3dSmrg
15612c7c4e3dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15628650bb69Smrg    LIB_MAN_SUFFIX=3
15632c7c4e3dSmrgfi
15642c7c4e3dSmrgif test x$LIB_MAN_DIR = x    ; then
15658650bb69Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15662c7c4e3dSmrgfi
15672c7c4e3dSmrg
15682c7c4e3dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15693458e6c2Smrg    case $SYSV_MAN_SECTIONS in
15703458e6c2Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15713458e6c2Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15722c7c4e3dSmrg    esac
15732c7c4e3dSmrgfi
15742c7c4e3dSmrgif test x$FILE_MAN_DIR = x    ; then
15758650bb69Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15762c7c4e3dSmrgfi
15772c7c4e3dSmrg
15782c7c4e3dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15793458e6c2Smrg    case $SYSV_MAN_SECTIONS in
15803458e6c2Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15813458e6c2Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15822c7c4e3dSmrg    esac
15832c7c4e3dSmrgfi
15842c7c4e3dSmrgif test x$MISC_MAN_DIR = x    ; then
15858650bb69Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15862c7c4e3dSmrgfi
15872c7c4e3dSmrg
15882c7c4e3dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15893458e6c2Smrg    case $SYSV_MAN_SECTIONS in
15903458e6c2Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15913458e6c2Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15922c7c4e3dSmrg    esac
15932c7c4e3dSmrgfi
15942c7c4e3dSmrgif test x$DRIVER_MAN_DIR = x    ; then
15958650bb69Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15962c7c4e3dSmrgfi
15972c7c4e3dSmrg
15982c7c4e3dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15993458e6c2Smrg    case $SYSV_MAN_SECTIONS in
16003458e6c2Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16013458e6c2Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16022c7c4e3dSmrg    esac
16032c7c4e3dSmrgfi
16042c7c4e3dSmrgif test x$ADMIN_MAN_DIR = x    ; then
16052c7c4e3dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16062c7c4e3dSmrgfi
16072c7c4e3dSmrg
16082c7c4e3dSmrg
16092c7c4e3dSmrgAC_SUBST([APP_MAN_SUFFIX])
16102c7c4e3dSmrgAC_SUBST([LIB_MAN_SUFFIX])
16112c7c4e3dSmrgAC_SUBST([FILE_MAN_SUFFIX])
16122c7c4e3dSmrgAC_SUBST([MISC_MAN_SUFFIX])
16132c7c4e3dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16142c7c4e3dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16152c7c4e3dSmrgAC_SUBST([APP_MAN_DIR])
16162c7c4e3dSmrgAC_SUBST([LIB_MAN_DIR])
16172c7c4e3dSmrgAC_SUBST([FILE_MAN_DIR])
16182c7c4e3dSmrgAC_SUBST([MISC_MAN_DIR])
16192c7c4e3dSmrgAC_SUBST([DRIVER_MAN_DIR])
16202c7c4e3dSmrgAC_SUBST([ADMIN_MAN_DIR])
162116d7e2f1Smrg
162216d7e2f1SmrgXORG_MAN_PAGE="X Version 11"
162316d7e2f1SmrgAC_SUBST([XORG_MAN_PAGE])
162416d7e2f1SmrgMAN_SUBSTS="\
162516d7e2f1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162616d7e2f1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162716d7e2f1Smrg	-e 's|__xservername__|Xorg|g' \
162816d7e2f1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162916d7e2f1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163016d7e2f1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163116d7e2f1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163216d7e2f1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163316d7e2f1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163416d7e2f1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163516d7e2f1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163616d7e2f1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163716d7e2f1SmrgAC_SUBST([MAN_SUBSTS])
163816d7e2f1Smrg
16392c7c4e3dSmrg]) # XORG_MANPAGE_SECTIONS
16402c7c4e3dSmrg
164116d7e2f1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164216d7e2f1Smrg# ------------------------
164316d7e2f1Smrg# Minimum version: 1.7.0
164416d7e2f1Smrg#
164516d7e2f1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164616d7e2f1Smrg# provided by xorg-sgml-doctools, if installed.
164716d7e2f1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164816d7e2f1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164916d7e2f1SmrgXORG_SGML_PATH=
165016d7e2f1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165116d7e2f1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165216d7e2f1Smrg    [m4_ifval([$1],[:],
165316d7e2f1Smrg        [if test x"$cross_compiling" != x"yes" ; then
165416d7e2f1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165516d7e2f1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165616d7e2f1Smrg         fi])
165716d7e2f1Smrg    ])
165816d7e2f1Smrg
165916d7e2f1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166016d7e2f1Smrg# the path and the name of the doc stylesheet
166116d7e2f1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166216d7e2f1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166316d7e2f1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166416d7e2f1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166516d7e2f1Smrgelse
166616d7e2f1Smrg   AC_MSG_RESULT([no])
166716d7e2f1Smrgfi
166816d7e2f1Smrg
166916d7e2f1SmrgAC_SUBST(XORG_SGML_PATH)
167016d7e2f1SmrgAC_SUBST(STYLESHEET_SRCDIR)
167116d7e2f1SmrgAC_SUBST(XSL_STYLESHEET)
167216d7e2f1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167316d7e2f1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167416d7e2f1Smrg
16752c7c4e3dSmrg# XORG_CHECK_LINUXDOC
16762c7c4e3dSmrg# -------------------
16778650bb69Smrg# Minimum version: 1.0.0
16788650bb69Smrg#
16792c7c4e3dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16802c7c4e3dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16812c7c4e3dSmrg# Whether or not the necessary tools and files are found can be checked
16822c7c4e3dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16832c7c4e3dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168416d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168516d7e2f1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16862c7c4e3dSmrg
16872c7c4e3dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16882c7c4e3dSmrg
168916d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
16902c7c4e3dSmrg
169116d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16922c7c4e3dSmrg   BUILDDOC=yes
16932c7c4e3dSmrgelse
16942c7c4e3dSmrg   BUILDDOC=no
16952c7c4e3dSmrgfi
16962c7c4e3dSmrg
16972c7c4e3dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16982c7c4e3dSmrg
16992c7c4e3dSmrgAC_MSG_RESULT([$BUILDDOC])
17002c7c4e3dSmrg
170116d7e2f1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17022c7c4e3dSmrg
170316d7e2f1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17042c7c4e3dSmrg   BUILDPDFDOC=yes
17052c7c4e3dSmrgelse
17062c7c4e3dSmrg   BUILDPDFDOC=no
17072c7c4e3dSmrgfi
17082c7c4e3dSmrg
17092c7c4e3dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17102c7c4e3dSmrg
17112c7c4e3dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17122c7c4e3dSmrg
171316d7e2f1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17148650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17152c7c4e3dSmrgMAKE_PDF="$PS2PDF"
17168650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17172c7c4e3dSmrg
17182c7c4e3dSmrgAC_SUBST(MAKE_TEXT)
17192c7c4e3dSmrgAC_SUBST(MAKE_PS)
17202c7c4e3dSmrgAC_SUBST(MAKE_PDF)
17212c7c4e3dSmrgAC_SUBST(MAKE_HTML)
17222c7c4e3dSmrg]) # XORG_CHECK_LINUXDOC
17232c7c4e3dSmrg
17248650bb69Smrg# XORG_CHECK_DOCBOOK
17258650bb69Smrg# -------------------
17268650bb69Smrg# Minimum version: 1.0.0
17278650bb69Smrg#
17288650bb69Smrg# Checks for the ability to build output formats from SGML DocBook source.
17298650bb69Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17308650bb69Smrg# indicates whether the necessary tools and files are found and, if set,
17318650bb69Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17328650bb69SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173316d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173416d7e2f1Smrg
17358650bb69SmrgBUILDTXTDOC=no
17368650bb69SmrgBUILDPDFDOC=no
17378650bb69SmrgBUILDPSDOC=no
17388650bb69SmrgBUILDHTMLDOC=no
17398650bb69Smrg
17408650bb69SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17418650bb69SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17428650bb69SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17438650bb69SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17448650bb69Smrg
174516d7e2f1SmrgAC_MSG_CHECKING([whether to build text documentation])
174616d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17478650bb69Smrg   test x$BUILD_TXTDOC != xno; then
17488650bb69Smrg	BUILDTXTDOC=yes
17498650bb69Smrgfi
17508650bb69SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17518650bb69SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17528650bb69Smrg
175316d7e2f1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175416d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17558650bb69Smrg   test x$BUILD_PDFDOC != xno; then
17568650bb69Smrg	BUILDPDFDOC=yes
17578650bb69Smrgfi
17588650bb69SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17598650bb69SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17608650bb69Smrg
176116d7e2f1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176216d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17638650bb69Smrg   test x$BUILD_PSDOC != xno; then
17648650bb69Smrg	BUILDPSDOC=yes
17658650bb69Smrgfi
17668650bb69SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17678650bb69SmrgAC_MSG_RESULT([$BUILDPSDOC])
17688650bb69Smrg
176916d7e2f1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177016d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17718650bb69Smrg   test x$BUILD_HTMLDOC != xno; then
17728650bb69Smrg	BUILDHTMLDOC=yes
17738650bb69Smrgfi
17748650bb69SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17758650bb69SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
17768650bb69Smrg
17778650bb69SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17788650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17798650bb69SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17808650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17818650bb69Smrg
17828650bb69SmrgAC_SUBST(MAKE_TEXT)
17838650bb69SmrgAC_SUBST(MAKE_PS)
17848650bb69SmrgAC_SUBST(MAKE_PDF)
17858650bb69SmrgAC_SUBST(MAKE_HTML)
17868650bb69Smrg]) # XORG_CHECK_DOCBOOK
17878650bb69Smrg
178816d7e2f1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178916d7e2f1Smrg# ----------------
179016d7e2f1Smrg# Minimum version: 1.5.0
179116d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17928650bb69Smrg#
179316d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
179416d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
179516d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179616d7e2f1Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179716d7e2f1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179816d7e2f1Smrg# --with-xmlto assumes 'auto'.
179916d7e2f1Smrg#
180016d7e2f1Smrg# Interface to module:
180116d7e2f1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180216d7e2f1Smrg# XMLTO:	returns the path of the xmlto program found
180316d7e2f1Smrg#		returns the path set by the user in the environment
180416d7e2f1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180516d7e2f1Smrg#		'no' user instructs the module not to use xmlto
180616d7e2f1Smrg#
180716d7e2f1Smrg# Added in version 1.10.0
180816d7e2f1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180916d7e2f1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181016d7e2f1Smrg#
181116d7e2f1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181216d7e2f1Smrg#
181316d7e2f1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181416d7e2f1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181516d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
181616d7e2f1SmrgAC_ARG_WITH(xmlto,
181716d7e2f1Smrg	AS_HELP_STRING([--with-xmlto],
181816d7e2f1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181916d7e2f1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182016d7e2f1Smrgm4_undefine([_defopt])
182116d7e2f1Smrg
182216d7e2f1Smrgif test "x$use_xmlto" = x"auto"; then
182316d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182416d7e2f1Smrg   if test "x$XMLTO" = "x"; then
182516d7e2f1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182616d7e2f1Smrg	have_xmlto=no
182716d7e2f1Smrg   else
182816d7e2f1Smrg        have_xmlto=yes
182916d7e2f1Smrg   fi
183016d7e2f1Smrgelif test "x$use_xmlto" = x"yes" ; then
183116d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183216d7e2f1Smrg   if test "x$XMLTO" = "x"; then
183316d7e2f1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183416d7e2f1Smrg   fi
183516d7e2f1Smrg   have_xmlto=yes
183616d7e2f1Smrgelif test "x$use_xmlto" = x"no" ; then
183716d7e2f1Smrg   if test "x$XMLTO" != "x"; then
183816d7e2f1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183916d7e2f1Smrg   fi
184016d7e2f1Smrg   have_xmlto=no
184116d7e2f1Smrgelse
184216d7e2f1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18432c7c4e3dSmrgfi
18442c7c4e3dSmrg
184516d7e2f1Smrg# Test for a minimum version of xmlto, if provided.
184616d7e2f1Smrgm4_ifval([$1],
184716d7e2f1Smrg[if test "$have_xmlto" = yes; then
184816d7e2f1Smrg    # scrape the xmlto version
184916d7e2f1Smrg    AC_MSG_CHECKING([the xmlto version])
185016d7e2f1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185116d7e2f1Smrg    AC_MSG_RESULT([$xmlto_version])
185216d7e2f1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185316d7e2f1Smrg        [if test "x$use_xmlto" = xauto; then
185416d7e2f1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185516d7e2f1Smrg            have_xmlto=no
185616d7e2f1Smrg        else
185716d7e2f1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185816d7e2f1Smrg        fi])
185916d7e2f1Smrgfi])
186016d7e2f1Smrg
186116d7e2f1Smrg# Test for the ability of xmlto to generate a text target
18623458e6c2Smrg#
18633458e6c2Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18643458e6c2Smrg# following test for empty XML docbook files.
18653458e6c2Smrg# For compatibility reasons use the following empty XML docbook file and if
18663458e6c2Smrg# it fails try it again with a non-empty XML file.
186716d7e2f1Smrghave_xmlto_text=no
186816d7e2f1Smrgcat > conftest.xml << "EOF"
186916d7e2f1SmrgEOF
187016d7e2f1SmrgAS_IF([test "$have_xmlto" = yes],
187116d7e2f1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187216d7e2f1Smrg             [have_xmlto_text=yes],
18733458e6c2Smrg             [# Try it again with a non-empty XML file.
18743458e6c2Smrg              cat > conftest.xml << "EOF"
18753458e6c2Smrg<x></x>
18763458e6c2SmrgEOF
18773458e6c2Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18783458e6c2Smrg                    [have_xmlto_text=yes],
18793458e6c2Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188016d7e2f1Smrgrm -f conftest.xml
188116d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188216d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188316d7e2f1Smrg]) # XORG_WITH_XMLTO
188416d7e2f1Smrg
188516d7e2f1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188616d7e2f1Smrg# --------------------------------------------
188716d7e2f1Smrg# Minimum version: 1.12.0
188816d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188916d7e2f1Smrg#
189016d7e2f1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189116d7e2f1Smrg# XML-based language used for the transformation of XML documents.
189216d7e2f1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189316d7e2f1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189416d7e2f1Smrg# The XSLT processor is often used as a standalone tool for transformations.
189516d7e2f1Smrg# It should not be assumed that this tool is used only to work with documnetation.
189616d7e2f1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189716d7e2f1Smrg#
189816d7e2f1Smrg# Interface to module:
189916d7e2f1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190016d7e2f1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190116d7e2f1Smrg#		 returns the path set by the user in the environment
190216d7e2f1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190316d7e2f1Smrg#		  'no' user instructs the module not to use xsltproc
190416d7e2f1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190516d7e2f1Smrg#
190616d7e2f1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190716d7e2f1Smrg#
190816d7e2f1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190916d7e2f1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191016d7e2f1Smrg# Preserves the interface, should it be implemented later
191116d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191216d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
191316d7e2f1SmrgAC_ARG_WITH(xsltproc,
191416d7e2f1Smrg	AS_HELP_STRING([--with-xsltproc],
191516d7e2f1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191616d7e2f1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191716d7e2f1Smrgm4_undefine([_defopt])
191816d7e2f1Smrg
191916d7e2f1Smrgif test "x$use_xsltproc" = x"auto"; then
192016d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192116d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
192216d7e2f1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192316d7e2f1Smrg	have_xsltproc=no
192416d7e2f1Smrg   else
192516d7e2f1Smrg        have_xsltproc=yes
192616d7e2f1Smrg   fi
192716d7e2f1Smrgelif test "x$use_xsltproc" = x"yes" ; then
192816d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192916d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
193016d7e2f1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193116d7e2f1Smrg   fi
193216d7e2f1Smrg   have_xsltproc=yes
193316d7e2f1Smrgelif test "x$use_xsltproc" = x"no" ; then
193416d7e2f1Smrg   if test "x$XSLTPROC" != "x"; then
193516d7e2f1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193616d7e2f1Smrg   fi
193716d7e2f1Smrg   have_xsltproc=no
19382c7c4e3dSmrgelse
193916d7e2f1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19402c7c4e3dSmrgfi
19412c7c4e3dSmrg
194216d7e2f1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194316d7e2f1Smrg]) # XORG_WITH_XSLTPROC
19442c7c4e3dSmrg
194516d7e2f1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194616d7e2f1Smrg# ----------------------------------------
194716d7e2f1Smrg# Minimum version: 1.15.0
19488650bb69Smrg#
194916d7e2f1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195016d7e2f1Smrg# scanning arbitrary text files, extracting information from those text files,
195116d7e2f1Smrg# and printing reports based on that information.
19528650bb69Smrg#
195316d7e2f1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195416d7e2f1Smrg#
195516d7e2f1Smrg# Interface to module:
195616d7e2f1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195716d7e2f1Smrg# PERL:	     returns the path of the perl program found
195816d7e2f1Smrg#	     returns the path set by the user in the environment
195916d7e2f1Smrg# --with-perl: 'yes' user instructs the module to use perl
196016d7e2f1Smrg#	       'no' user instructs the module not to use perl
196116d7e2f1Smrg# have_perl: returns yes if perl found in PATH or no
196216d7e2f1Smrg#
196316d7e2f1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196416d7e2f1Smrg#
196516d7e2f1SmrgAC_DEFUN([XORG_WITH_PERL],[
196616d7e2f1SmrgAC_ARG_VAR([PERL], [Path to perl command])
196716d7e2f1Smrg# Preserves the interface, should it be implemented later
196816d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196916d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
197016d7e2f1SmrgAC_ARG_WITH(perl,
197116d7e2f1Smrg	AS_HELP_STRING([--with-perl],
197216d7e2f1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197316d7e2f1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197416d7e2f1Smrgm4_undefine([_defopt])
197516d7e2f1Smrg
197616d7e2f1Smrgif test "x$use_perl" = x"auto"; then
197716d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
197816d7e2f1Smrg   if test "x$PERL" = "x"; then
197916d7e2f1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198016d7e2f1Smrg	have_perl=no
198116d7e2f1Smrg   else
198216d7e2f1Smrg        have_perl=yes
198316d7e2f1Smrg   fi
198416d7e2f1Smrgelif test "x$use_perl" = x"yes" ; then
198516d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
198616d7e2f1Smrg   if test "x$PERL" = "x"; then
198716d7e2f1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198816d7e2f1Smrg   fi
198916d7e2f1Smrg   have_perl=yes
199016d7e2f1Smrgelif test "x$use_perl" = x"no" ; then
199116d7e2f1Smrg   if test "x$PERL" != "x"; then
199216d7e2f1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199316d7e2f1Smrg   fi
199416d7e2f1Smrg   have_perl=no
19958650bb69Smrgelse
199616d7e2f1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19978650bb69Smrgfi
19988650bb69Smrg
199916d7e2f1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200016d7e2f1Smrg]) # XORG_WITH_PERL
20018650bb69Smrg
200216d7e2f1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200316d7e2f1Smrg# ----------------
200416d7e2f1Smrg# Minimum version: 1.5.0
200516d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20068650bb69Smrg#
200716d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
200816d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
200916d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201016d7e2f1Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201116d7e2f1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201216d7e2f1Smrg# --with-asciidoc assumes 'auto'.
20138650bb69Smrg#
201416d7e2f1Smrg# Interface to module:
201516d7e2f1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201616d7e2f1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201716d7e2f1Smrg#		 returns the path set by the user in the environment
201816d7e2f1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201916d7e2f1Smrg#		  'no' user instructs the module not to use asciidoc
202016d7e2f1Smrg#
202116d7e2f1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202216d7e2f1Smrg#
202316d7e2f1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202416d7e2f1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202516d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
202616d7e2f1SmrgAC_ARG_WITH(asciidoc,
202716d7e2f1Smrg	AS_HELP_STRING([--with-asciidoc],
202816d7e2f1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202916d7e2f1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203016d7e2f1Smrgm4_undefine([_defopt])
203116d7e2f1Smrg
203216d7e2f1Smrgif test "x$use_asciidoc" = x"auto"; then
203316d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203416d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
203516d7e2f1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203616d7e2f1Smrg	have_asciidoc=no
203716d7e2f1Smrg   else
203816d7e2f1Smrg        have_asciidoc=yes
203916d7e2f1Smrg   fi
204016d7e2f1Smrgelif test "x$use_asciidoc" = x"yes" ; then
204116d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204216d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
204316d7e2f1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204416d7e2f1Smrg   fi
204516d7e2f1Smrg   have_asciidoc=yes
204616d7e2f1Smrgelif test "x$use_asciidoc" = x"no" ; then
204716d7e2f1Smrg   if test "x$ASCIIDOC" != "x"; then
204816d7e2f1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204916d7e2f1Smrg   fi
205016d7e2f1Smrg   have_asciidoc=no
205116d7e2f1Smrgelse
205216d7e2f1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205316d7e2f1Smrgfi
205416d7e2f1Smrgm4_ifval([$1],
205516d7e2f1Smrg[if test "$have_asciidoc" = yes; then
205616d7e2f1Smrg    # scrape the asciidoc version
205716d7e2f1Smrg    AC_MSG_CHECKING([the asciidoc version])
205816d7e2f1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205916d7e2f1Smrg    AC_MSG_RESULT([$asciidoc_version])
206016d7e2f1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206116d7e2f1Smrg        [if test "x$use_asciidoc" = xauto; then
206216d7e2f1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206316d7e2f1Smrg            have_asciidoc=no
206416d7e2f1Smrg        else
206516d7e2f1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206616d7e2f1Smrg        fi])
206716d7e2f1Smrgfi])
206816d7e2f1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206916d7e2f1Smrg]) # XORG_WITH_ASCIIDOC
207016d7e2f1Smrg
207116d7e2f1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20722becc446Smrg# -------------------------------------------
207316d7e2f1Smrg# Minimum version: 1.5.0
207416d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20752becc446Smrg# Minimum version for optional DOT checking: 1.18.0
207616d7e2f1Smrg#
207716d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
207816d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
207916d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208016d7e2f1Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208116d7e2f1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208216d7e2f1Smrg# --with-doxygen assumes 'auto'.
208316d7e2f1Smrg#
208416d7e2f1Smrg# Interface to module:
208516d7e2f1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208616d7e2f1Smrg# DOXYGEN:	 returns the path of the doxygen program found
208716d7e2f1Smrg#		 returns the path set by the user in the environment
208816d7e2f1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208916d7e2f1Smrg#		  'no' user instructs the module not to use doxygen
209016d7e2f1Smrg#
209116d7e2f1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209216d7e2f1Smrg#
209316d7e2f1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209416d7e2f1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20952becc446SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209616d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
209716d7e2f1SmrgAC_ARG_WITH(doxygen,
209816d7e2f1Smrg	AS_HELP_STRING([--with-doxygen],
209916d7e2f1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210016d7e2f1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210116d7e2f1Smrgm4_undefine([_defopt])
210216d7e2f1Smrg
210316d7e2f1Smrgif test "x$use_doxygen" = x"auto"; then
210416d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210516d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
210616d7e2f1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210716d7e2f1Smrg	have_doxygen=no
210816d7e2f1Smrg   else
210916d7e2f1Smrg        have_doxygen=yes
211016d7e2f1Smrg   fi
211116d7e2f1Smrgelif test "x$use_doxygen" = x"yes" ; then
211216d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211316d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
211416d7e2f1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211516d7e2f1Smrg   fi
211616d7e2f1Smrg   have_doxygen=yes
211716d7e2f1Smrgelif test "x$use_doxygen" = x"no" ; then
211816d7e2f1Smrg   if test "x$DOXYGEN" != "x"; then
211916d7e2f1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212016d7e2f1Smrg   fi
212116d7e2f1Smrg   have_doxygen=no
212216d7e2f1Smrgelse
212316d7e2f1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212416d7e2f1Smrgfi
212516d7e2f1Smrgm4_ifval([$1],
212616d7e2f1Smrg[if test "$have_doxygen" = yes; then
212716d7e2f1Smrg    # scrape the doxygen version
212816d7e2f1Smrg    AC_MSG_CHECKING([the doxygen version])
212916d7e2f1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213016d7e2f1Smrg    AC_MSG_RESULT([$doxygen_version])
213116d7e2f1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213216d7e2f1Smrg        [if test "x$use_doxygen" = xauto; then
213316d7e2f1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213416d7e2f1Smrg            have_doxygen=no
213516d7e2f1Smrg        else
213616d7e2f1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213716d7e2f1Smrg        fi])
213816d7e2f1Smrgfi])
21392becc446Smrg
21402becc446Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21412becc446Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21422becc446Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21432becc446SmrgHAVE_DOT=no
21442becc446Smrgif test "x$have_doxygen" = "xyes"; then
21452becc446Smrg  AC_PATH_PROG([DOT], [dot])
21462becc446Smrg    if test "x$DOT" != "x"; then
21472becc446Smrg      HAVE_DOT=yes
21482becc446Smrg    fi
21492becc446Smrgfi
21502becc446Smrg
21512becc446SmrgAC_SUBST([HAVE_DOT])
21522becc446SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215316d7e2f1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215416d7e2f1Smrg]) # XORG_WITH_DOXYGEN
215516d7e2f1Smrg
215616d7e2f1Smrg# XORG_WITH_GROFF([DEFAULT])
215716d7e2f1Smrg# ----------------
215816d7e2f1Smrg# Minimum version: 1.6.0
215916d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216016d7e2f1Smrg#
216116d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
216216d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
216316d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216416d7e2f1Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216516d7e2f1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216616d7e2f1Smrg# --with-groff assumes 'auto'.
216716d7e2f1Smrg#
216816d7e2f1Smrg# Interface to module:
216916d7e2f1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217016d7e2f1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217116d7e2f1Smrg# HAVE_GROFF_MS: the -ms macros package
217216d7e2f1Smrg# GROFF:	 returns the path of the groff program found
217316d7e2f1Smrg#		 returns the path set by the user in the environment
217416d7e2f1Smrg# --with-groff:	 'yes' user instructs the module to use groff
217516d7e2f1Smrg#		 'no' user instructs the module not to use groff
217616d7e2f1Smrg#
217716d7e2f1Smrg# Added in version 1.9.0:
217816d7e2f1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217916d7e2f1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218016d7e2f1Smrg#		   psselect from the psutils package.
218116d7e2f1Smrg#		   the ghostcript package. Refer to the grohtml man pages
218216d7e2f1Smrg#
218316d7e2f1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218416d7e2f1Smrg#
218516d7e2f1Smrg# OS and distros often splits groff in a basic and full package, the former
218616d7e2f1Smrg# having the groff program and the later having devices, fonts and macros
218716d7e2f1Smrg# Checking for the groff executable is not enough.
218816d7e2f1Smrg#
218916d7e2f1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219016d7e2f1Smrg# unset HAVE_GROFF or GROFF env variables.
219116d7e2f1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219216d7e2f1Smrg#
219316d7e2f1SmrgAC_DEFUN([XORG_WITH_GROFF],[
219416d7e2f1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219516d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
219616d7e2f1SmrgAC_ARG_WITH(groff,
219716d7e2f1Smrg	AS_HELP_STRING([--with-groff],
219816d7e2f1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219916d7e2f1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220016d7e2f1Smrgm4_undefine([_defopt])
220116d7e2f1Smrg
220216d7e2f1Smrgif test "x$use_groff" = x"auto"; then
220316d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
220416d7e2f1Smrg   if test "x$GROFF" = "x"; then
220516d7e2f1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220616d7e2f1Smrg	have_groff=no
220716d7e2f1Smrg   else
220816d7e2f1Smrg        have_groff=yes
220916d7e2f1Smrg   fi
221016d7e2f1Smrgelif test "x$use_groff" = x"yes" ; then
221116d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
221216d7e2f1Smrg   if test "x$GROFF" = "x"; then
221316d7e2f1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221416d7e2f1Smrg   fi
221516d7e2f1Smrg   have_groff=yes
221616d7e2f1Smrgelif test "x$use_groff" = x"no" ; then
221716d7e2f1Smrg   if test "x$GROFF" != "x"; then
221816d7e2f1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221916d7e2f1Smrg   fi
222016d7e2f1Smrg   have_groff=no
222116d7e2f1Smrgelse
222216d7e2f1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222316d7e2f1Smrgfi
222416d7e2f1Smrg
222516d7e2f1Smrg# We have groff, test for the presence of the macro packages
222616d7e2f1Smrgif test "x$have_groff" = x"yes"; then
222716d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222816d7e2f1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222916d7e2f1Smrg        groff_ms_works=yes
223016d7e2f1Smrg    else
223116d7e2f1Smrg        groff_ms_works=no
223216d7e2f1Smrg    fi
223316d7e2f1Smrg    AC_MSG_RESULT([$groff_ms_works])
223416d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223516d7e2f1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223616d7e2f1Smrg        groff_mm_works=yes
223716d7e2f1Smrg    else
223816d7e2f1Smrg        groff_mm_works=no
223916d7e2f1Smrg    fi
224016d7e2f1Smrg    AC_MSG_RESULT([$groff_mm_works])
224116d7e2f1Smrgfi
224216d7e2f1Smrg
224316d7e2f1Smrg# We have groff, test for HTML dependencies, one command per package
224416d7e2f1Smrgif test "x$have_groff" = x"yes"; then
224516d7e2f1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224616d7e2f1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224716d7e2f1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224816d7e2f1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224916d7e2f1Smrg      have_groff_html=yes
225016d7e2f1Smrg   else
225116d7e2f1Smrg      have_groff_html=no
225216d7e2f1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225316d7e2f1Smrg   fi
225416d7e2f1Smrgfi
225516d7e2f1Smrg
225616d7e2f1Smrg# Set Automake conditionals for Makefiles
225716d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225816d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225916d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226016d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226116d7e2f1Smrg]) # XORG_WITH_GROFF
226216d7e2f1Smrg
226316d7e2f1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226416d7e2f1Smrg# ---------------------------------------
226516d7e2f1Smrg# Minimum version: 1.6.0
226616d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226716d7e2f1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226816d7e2f1Smrg#
226916d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
227016d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
227116d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227216d7e2f1Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227316d7e2f1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227416d7e2f1Smrg# --with-fop assumes 'auto'.
227516d7e2f1Smrg#
227616d7e2f1Smrg# Interface to module:
227716d7e2f1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227816d7e2f1Smrg# FOP:	 	returns the path of the fop program found
227916d7e2f1Smrg#		returns the path set by the user in the environment
228016d7e2f1Smrg# --with-fop: 	'yes' user instructs the module to use fop
228116d7e2f1Smrg#		'no' user instructs the module not to use fop
228216d7e2f1Smrg#
228316d7e2f1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228416d7e2f1Smrg#
228516d7e2f1SmrgAC_DEFUN([XORG_WITH_FOP],[
228616d7e2f1SmrgAC_ARG_VAR([FOP], [Path to fop command])
228716d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
228816d7e2f1SmrgAC_ARG_WITH(fop,
228916d7e2f1Smrg	AS_HELP_STRING([--with-fop],
229016d7e2f1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229116d7e2f1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229216d7e2f1Smrgm4_undefine([_defopt])
229316d7e2f1Smrg
229416d7e2f1Smrgif test "x$use_fop" = x"auto"; then
229516d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
229616d7e2f1Smrg   if test "x$FOP" = "x"; then
229716d7e2f1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229816d7e2f1Smrg	have_fop=no
229916d7e2f1Smrg   else
230016d7e2f1Smrg        have_fop=yes
230116d7e2f1Smrg   fi
230216d7e2f1Smrgelif test "x$use_fop" = x"yes" ; then
230316d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
230416d7e2f1Smrg   if test "x$FOP" = "x"; then
230516d7e2f1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230616d7e2f1Smrg   fi
230716d7e2f1Smrg   have_fop=yes
230816d7e2f1Smrgelif test "x$use_fop" = x"no" ; then
230916d7e2f1Smrg   if test "x$FOP" != "x"; then
231016d7e2f1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231116d7e2f1Smrg   fi
231216d7e2f1Smrg   have_fop=no
231316d7e2f1Smrgelse
231416d7e2f1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231516d7e2f1Smrgfi
231616d7e2f1Smrg
231716d7e2f1Smrg# Test for a minimum version of fop, if provided.
231816d7e2f1Smrgm4_ifval([$1],
231916d7e2f1Smrg[if test "$have_fop" = yes; then
232016d7e2f1Smrg    # scrape the fop version
232116d7e2f1Smrg    AC_MSG_CHECKING([for fop minimum version])
232216d7e2f1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232316d7e2f1Smrg    AC_MSG_RESULT([$fop_version])
232416d7e2f1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232516d7e2f1Smrg        [if test "x$use_fop" = xauto; then
232616d7e2f1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232716d7e2f1Smrg            have_fop=no
232816d7e2f1Smrg        else
232916d7e2f1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233016d7e2f1Smrg        fi])
233116d7e2f1Smrgfi])
233216d7e2f1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233316d7e2f1Smrg]) # XORG_WITH_FOP
233416d7e2f1Smrg
23352becc446Smrg# XORG_WITH_M4([MIN-VERSION])
23362becc446Smrg# ---------------------------
23372becc446Smrg# Minimum version: 1.19.0
23382becc446Smrg#
23392becc446Smrg# This macro attempts to locate an m4 macro processor which supports
23402becc446Smrg# -I option and is only useful for modules relying on M4 in order to
23412becc446Smrg# expand macros in source code files.
23422becc446Smrg#
23432becc446Smrg# Interface to module:
23442becc446Smrg# M4:	 	returns the path of the m4 program found
23452becc446Smrg#		returns the path set by the user in the environment
23462becc446Smrg#
23472becc446SmrgAC_DEFUN([XORG_WITH_M4], [
23482becc446SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23492becc446Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23502becc446Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23512becc446Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23522becc446Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23532becc446Smrg   [$PATH:/usr/gnu/bin])])
23542becc446Smrg
23552becc446SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23562becc446Smrg]) # XORG_WITH_M4
23572becc446Smrg
235816d7e2f1Smrg# XORG_WITH_PS2PDF([DEFAULT])
235916d7e2f1Smrg# ----------------
236016d7e2f1Smrg# Minimum version: 1.6.0
236116d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236216d7e2f1Smrg#
236316d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
236416d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
236516d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236616d7e2f1Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236716d7e2f1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236816d7e2f1Smrg# --with-ps2pdf assumes 'auto'.
236916d7e2f1Smrg#
237016d7e2f1Smrg# Interface to module:
237116d7e2f1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237216d7e2f1Smrg# PS2PDF:	returns the path of the ps2pdf program found
237316d7e2f1Smrg#		returns the path set by the user in the environment
237416d7e2f1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237516d7e2f1Smrg#		 'no' user instructs the module not to use ps2pdf
237616d7e2f1Smrg#
237716d7e2f1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237816d7e2f1Smrg#
237916d7e2f1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238016d7e2f1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238116d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
238216d7e2f1SmrgAC_ARG_WITH(ps2pdf,
238316d7e2f1Smrg	AS_HELP_STRING([--with-ps2pdf],
238416d7e2f1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238516d7e2f1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238616d7e2f1Smrgm4_undefine([_defopt])
238716d7e2f1Smrg
238816d7e2f1Smrgif test "x$use_ps2pdf" = x"auto"; then
238916d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239016d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
239116d7e2f1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239216d7e2f1Smrg	have_ps2pdf=no
239316d7e2f1Smrg   else
239416d7e2f1Smrg        have_ps2pdf=yes
239516d7e2f1Smrg   fi
239616d7e2f1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239716d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239816d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
239916d7e2f1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240016d7e2f1Smrg   fi
240116d7e2f1Smrg   have_ps2pdf=yes
240216d7e2f1Smrgelif test "x$use_ps2pdf" = x"no" ; then
240316d7e2f1Smrg   if test "x$PS2PDF" != "x"; then
240416d7e2f1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240516d7e2f1Smrg   fi
240616d7e2f1Smrg   have_ps2pdf=no
240716d7e2f1Smrgelse
240816d7e2f1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240916d7e2f1Smrgfi
241016d7e2f1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241116d7e2f1Smrg]) # XORG_WITH_PS2PDF
241216d7e2f1Smrg
241316d7e2f1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241416d7e2f1Smrg# ----------------
241516d7e2f1Smrg# Minimum version: 1.6.0
241616d7e2f1Smrg#
241716d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
241816d7e2f1Smrg# not at the appropriate level. This macro enables a builder to skip all
241916d7e2f1Smrg# documentation targets except traditional man pages.
242016d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242116d7e2f1Smrg# maximum flexibilty in controlling documentation building.
242216d7e2f1Smrg# Refer to:
242316d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
242416d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242516d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242616d7e2f1Smrg# XORG_WITH_FOP           --with-fop
242716d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
242816d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242916d7e2f1Smrg#
243016d7e2f1Smrg# Interface to module:
243116d7e2f1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243216d7e2f1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243316d7e2f1Smrg#		 'no' user instructs the module not to generate docs
243416d7e2f1Smrg# parm1:	specify the default value, yes or no.
243516d7e2f1Smrg#
243616d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243716d7e2f1Smrgm4_define([docs_default], m4_default([$1], [yes]))
243816d7e2f1SmrgAC_ARG_ENABLE(docs,
243916d7e2f1Smrg	AS_HELP_STRING([--enable-docs],
244016d7e2f1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244116d7e2f1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244216d7e2f1Smrgm4_undefine([docs_default])
244316d7e2f1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244416d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
244516d7e2f1SmrgAC_MSG_RESULT([$build_docs])
244616d7e2f1Smrg]) # XORG_ENABLE_DOCS
244716d7e2f1Smrg
244816d7e2f1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244916d7e2f1Smrg# ----------------
245016d7e2f1Smrg# Minimum version: 1.6.0
245116d7e2f1Smrg#
245216d7e2f1Smrg# This macro enables a builder to skip all developer documentation.
245316d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245416d7e2f1Smrg# maximum flexibilty in controlling documentation building.
245516d7e2f1Smrg# Refer to:
245616d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
245716d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245816d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245916d7e2f1Smrg# XORG_WITH_FOP           --with-fop
246016d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
246116d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246216d7e2f1Smrg#
246316d7e2f1Smrg# Interface to module:
246416d7e2f1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246516d7e2f1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246616d7e2f1Smrg#			'no' user instructs the module not to generate developer docs
246716d7e2f1Smrg# parm1:		specify the default value, yes or no.
246816d7e2f1Smrg#
246916d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247016d7e2f1Smrgm4_define([devel_default], m4_default([$1], [yes]))
247116d7e2f1SmrgAC_ARG_ENABLE(devel-docs,
247216d7e2f1Smrg	AS_HELP_STRING([--enable-devel-docs],
247316d7e2f1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247416d7e2f1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247516d7e2f1Smrgm4_undefine([devel_default])
247616d7e2f1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247716d7e2f1SmrgAC_MSG_CHECKING([whether to build developer documentation])
247816d7e2f1SmrgAC_MSG_RESULT([$build_devel_docs])
247916d7e2f1Smrg]) # XORG_ENABLE_DEVEL_DOCS
248016d7e2f1Smrg
248116d7e2f1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248216d7e2f1Smrg# ----------------
248316d7e2f1Smrg# Minimum version: 1.6.0
248416d7e2f1Smrg#
248516d7e2f1Smrg# This macro enables a builder to skip all functional specification targets.
248616d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248716d7e2f1Smrg# maximum flexibilty in controlling documentation building.
248816d7e2f1Smrg# Refer to:
248916d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
249016d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249116d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249216d7e2f1Smrg# XORG_WITH_FOP           --with-fop
249316d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
249416d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249516d7e2f1Smrg#
249616d7e2f1Smrg# Interface to module:
249716d7e2f1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249816d7e2f1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249916d7e2f1Smrg#			'no' user instructs the module not to generate specs
250016d7e2f1Smrg# parm1:		specify the default value, yes or no.
250116d7e2f1Smrg#
250216d7e2f1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250316d7e2f1Smrgm4_define([spec_default], m4_default([$1], [yes]))
250416d7e2f1SmrgAC_ARG_ENABLE(specs,
250516d7e2f1Smrg	AS_HELP_STRING([--enable-specs],
250616d7e2f1Smrg	   [Enable building the specs (default: ]spec_default[)]),
250716d7e2f1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250816d7e2f1Smrgm4_undefine([spec_default])
250916d7e2f1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251016d7e2f1SmrgAC_MSG_CHECKING([whether to build functional specifications])
251116d7e2f1SmrgAC_MSG_RESULT([$build_specs])
251216d7e2f1Smrg]) # XORG_ENABLE_SPECS
251316d7e2f1Smrg
251416d7e2f1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251516d7e2f1Smrg# ----------------------------------------------
251616d7e2f1Smrg# Minimum version: 1.13.0
251716d7e2f1Smrg#
251816d7e2f1Smrg# This macro enables a builder to enable/disable unit testing
251916d7e2f1Smrg# It makes no assumption about the test cases implementation
252016d7e2f1Smrg# Test cases may or may not use Automake "Support for test suites"
252116d7e2f1Smrg# They may or may not use the software utility library GLib
252216d7e2f1Smrg#
252316d7e2f1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252416d7e2f1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252516d7e2f1Smrg# The variable enable_unit_tests is used by other macros in this file.
252616d7e2f1Smrg#
252716d7e2f1Smrg# Interface to module:
252816d7e2f1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252916d7e2f1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253016d7e2f1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253116d7e2f1Smrg#			'no' user instructs the module not to build tests
253216d7e2f1Smrg# parm1:		specify the default value, yes or no.
253316d7e2f1Smrg#
253416d7e2f1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253516d7e2f1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253616d7e2f1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253716d7e2f1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253816d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
253916d7e2f1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254016d7e2f1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254116d7e2f1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254216d7e2f1Smrgm4_undefine([_defopt])
254316d7e2f1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254416d7e2f1SmrgAC_MSG_CHECKING([whether to build unit test cases])
254516d7e2f1SmrgAC_MSG_RESULT([$enable_unit_tests])
254616d7e2f1Smrg]) # XORG_ENABLE_UNIT_TESTS
254716d7e2f1Smrg
25482becc446Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25492becc446Smrg# ------------------------------------------------------
25502becc446Smrg# Minimum version: 1.17.0
25512becc446Smrg#
25522becc446Smrg# This macro enables a builder to enable/disable integration testing
25532becc446Smrg# It makes no assumption about the test cases' implementation
25542becc446Smrg# Test cases may or may not use Automake "Support for test suites"
25552becc446Smrg#
25562becc446Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25572becc446Smrg# usually requires less dependencies and may be built and run under less
25582becc446Smrg# stringent environments than integration tests.
25592becc446Smrg#
25602becc446Smrg# Interface to module:
25612becc446Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25622becc446Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25632becc446Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25642becc446Smrg#                             'no' user instructs the module not to build tests
25652becc446Smrg# parm1:                      specify the default value, yes or no.
25662becc446Smrg#
25672becc446SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25682becc446SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25692becc446Smrgm4_define([_defopt], m4_default([$1], [auto]))
25702becc446SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25712becc446Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25722becc446Smrg	[enable_integration_tests=$enableval],
25732becc446Smrg	[enable_integration_tests=]_defopt)
25742becc446Smrgm4_undefine([_defopt])
25752becc446SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25762becc446Smrg	[test "x$enable_integration_tests" != xno])
25772becc446SmrgAC_MSG_CHECKING([whether to build unit test cases])
25782becc446SmrgAC_MSG_RESULT([$enable_integration_tests])
25792becc446Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25802becc446Smrg
258116d7e2f1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258216d7e2f1Smrg# ----------------------------------------
258316d7e2f1Smrg# Minimum version: 1.13.0
258416d7e2f1Smrg#
258516d7e2f1Smrg# GLib is a library which provides advanced data structures and functions.
258616d7e2f1Smrg# This macro enables a module to test for the presence of Glib.
258716d7e2f1Smrg#
258816d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258916d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
259016d7e2f1Smrg#
25912becc446Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25922becc446Smrg# test support usually requires less dependencies and may be built and run under
25932becc446Smrg# less stringent environments than integration tests.
25942becc446Smrg#
259516d7e2f1Smrg# Interface to module:
259616d7e2f1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259716d7e2f1Smrg# with_glib: used in configure.ac to know if GLib has been found
259816d7e2f1Smrg# --with-glib:	'yes' user instructs the module to use glib
259916d7e2f1Smrg#		'no' user instructs the module not to use glib
260016d7e2f1Smrg#
260116d7e2f1SmrgAC_DEFUN([XORG_WITH_GLIB],[
260216d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260316d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
260416d7e2f1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260516d7e2f1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260616d7e2f1Smrg	[with_glib=$withval], [with_glib=]_defopt)
260716d7e2f1Smrgm4_undefine([_defopt])
260816d7e2f1Smrg
260916d7e2f1Smrghave_glib=no
261016d7e2f1Smrg# Do not probe GLib if user explicitly disabled unit testing
261116d7e2f1Smrgif test "x$enable_unit_tests" != x"no"; then
261216d7e2f1Smrg  # Do not probe GLib if user explicitly disabled it
261316d7e2f1Smrg  if test "x$with_glib" != x"no"; then
261416d7e2f1Smrg    m4_ifval(
261516d7e2f1Smrg      [$1],
261616d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261716d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261816d7e2f1Smrg    )
261916d7e2f1Smrg  fi
262016d7e2f1Smrgfi
262116d7e2f1Smrg
262216d7e2f1Smrg# Not having GLib when unit testing has been explicitly requested is an error
262316d7e2f1Smrgif test "x$enable_unit_tests" = x"yes"; then
262416d7e2f1Smrg  if test "x$have_glib" = x"no"; then
262516d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262616d7e2f1Smrg  fi
262716d7e2f1Smrgfi
262816d7e2f1Smrg
262916d7e2f1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263016d7e2f1Smrgif test "x$enable_unit_tests" = x"no"; then
263116d7e2f1Smrg  if test "x$with_glib" = x"yes"; then
263216d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263316d7e2f1Smrg  fi
263416d7e2f1Smrgfi
263516d7e2f1Smrg
263616d7e2f1Smrg# Not having GLib when it has been explicitly requested is an error
263716d7e2f1Smrgif test "x$with_glib" = x"yes"; then
263816d7e2f1Smrg  if test "x$have_glib" = x"no"; then
263916d7e2f1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264016d7e2f1Smrg  fi
264116d7e2f1Smrgfi
264216d7e2f1Smrg
264316d7e2f1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264416d7e2f1Smrg]) # XORG_WITH_GLIB
264516d7e2f1Smrg
264616d7e2f1Smrg# XORG_LD_WRAP([required|optional])
264716d7e2f1Smrg# ---------------------------------
264816d7e2f1Smrg# Minimum version: 1.13.0
264916d7e2f1Smrg#
265016d7e2f1Smrg# Check if linker supports -wrap, passed via compiler flags
265116d7e2f1Smrg#
265216d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265316d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
265416d7e2f1Smrg#
265516d7e2f1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265616d7e2f1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265716d7e2f1Smrg# available, an argument of "optional" allows use when some unit tests require
265816d7e2f1Smrg# ld -wrap and others do not.
265916d7e2f1Smrg#
266016d7e2f1SmrgAC_DEFUN([XORG_LD_WRAP],[
266116d7e2f1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266216d7e2f1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266316d7e2f1Smrg                      void __wrap_exit(int status) { return; }],
266416d7e2f1Smrg                     [exit(0);])])
266516d7e2f1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266616d7e2f1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266716d7e2f1Smrg  if test "x$have_ld_wrap" = x"no"; then
266816d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266916d7e2f1Smrg  fi
267016d7e2f1Smrgfi
267116d7e2f1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267216d7e2f1Smrg#
267316d7e2f1Smrg]) # XORG_LD_WRAP
267416d7e2f1Smrg
267516d7e2f1Smrg# XORG_CHECK_LINKER_FLAGS
267616d7e2f1Smrg# -----------------------
267716d7e2f1Smrg# SYNOPSIS
267816d7e2f1Smrg#
267916d7e2f1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268016d7e2f1Smrg#
268116d7e2f1Smrg# DESCRIPTION
268216d7e2f1Smrg#
268316d7e2f1Smrg#   Check whether the given linker FLAGS work with the current language's
268416d7e2f1Smrg#   linker, or whether they give an error.
268516d7e2f1Smrg#
268616d7e2f1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268716d7e2f1Smrg#   success/failure.
268816d7e2f1Smrg#
268916d7e2f1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269016d7e2f1Smrg#
269116d7e2f1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269216d7e2f1Smrg#
269316d7e2f1Smrg# LICENSE
269416d7e2f1Smrg#
269516d7e2f1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269616d7e2f1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269716d7e2f1Smrg#   Copyright (c) 2009 Matteo Frigo
269816d7e2f1Smrg#
269916d7e2f1Smrg#   This program is free software: you can redistribute it and/or modify it
270016d7e2f1Smrg#   under the terms of the GNU General Public License as published by the
270116d7e2f1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270216d7e2f1Smrg#   option) any later version.
270316d7e2f1Smrg#
270416d7e2f1Smrg#   This program is distributed in the hope that it will be useful, but
270516d7e2f1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270616d7e2f1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270716d7e2f1Smrg#   Public License for more details.
270816d7e2f1Smrg#
270916d7e2f1Smrg#   You should have received a copy of the GNU General Public License along
271016d7e2f1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271116d7e2f1Smrg#
271216d7e2f1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271316d7e2f1Smrg#   gives unlimited permission to copy, distribute and modify the configure
271416d7e2f1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271516d7e2f1Smrg#   need not follow the terms of the GNU General Public License when using
271616d7e2f1Smrg#   or distributing such scripts, even though portions of the text of the
271716d7e2f1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271816d7e2f1Smrg#   all other use of the material that constitutes the Autoconf Macro.
271916d7e2f1Smrg#
272016d7e2f1Smrg#   This special exception to the GPL applies to versions of the Autoconf
272116d7e2f1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272216d7e2f1Smrg#   modified version of the Autoconf Macro, you may extend this special
272316d7e2f1Smrg#   exception to the GPL to apply to your modified version as well.#
272416d7e2f1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272516d7e2f1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272616d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272716d7e2f1SmrgAS_LITERAL_IF([$1],
272816d7e2f1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272916d7e2f1Smrg      ax_save_FLAGS=$LDFLAGS
273016d7e2f1Smrg      LDFLAGS="$1"
273116d7e2f1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273216d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273316d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273416d7e2f1Smrg      LDFLAGS=$ax_save_FLAGS])],
273516d7e2f1Smrg  [ax_save_FLAGS=$LDFLAGS
273616d7e2f1Smrg   LDFLAGS="$1"
273716d7e2f1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273816d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273916d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274016d7e2f1Smrg   LDFLAGS=$ax_save_FLAGS])
274116d7e2f1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274216d7e2f1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274316d7e2f1Smrgif test "x$xorg_check_linker_flags" = xyes; then
274416d7e2f1Smrg	m4_default([$2], :)
274516d7e2f1Smrgelse
274616d7e2f1Smrg	m4_default([$3], :)
274716d7e2f1Smrgfi
274816d7e2f1Smrg]) # XORG_CHECK_LINKER_FLAGS
274916d7e2f1Smrg
275016d7e2f1Smrg# XORG_MEMORY_CHECK_FLAGS
275116d7e2f1Smrg# -----------------------
275216d7e2f1Smrg# Minimum version: 1.16.0
275316d7e2f1Smrg#
275416d7e2f1Smrg# This macro attempts to find appropriate memory checking functionality
275516d7e2f1Smrg# for various platforms which unit testing code may use to catch various
275616d7e2f1Smrg# forms of memory allocation and access errors in testing.
275716d7e2f1Smrg#
275816d7e2f1Smrg# Interface to module:
275916d7e2f1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276016d7e2f1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276116d7e2f1Smrg#
276216d7e2f1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276316d7e2f1Smrg#
276416d7e2f1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276516d7e2f1Smrg
276616d7e2f1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276716d7e2f1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276816d7e2f1Smrg           [Environment variables to enable memory checking in tests])
276916d7e2f1Smrg
277016d7e2f1Smrg# Check for different types of support on different platforms
277116d7e2f1Smrgcase $host_os in
277216d7e2f1Smrg    solaris*)
277316d7e2f1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277416d7e2f1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277516d7e2f1Smrg        ;;
277616d7e2f1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277716d7e2f1Smrg        # both directly and inverted, so should not be 0 or 255.
277816d7e2f1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277916d7e2f1Smrg        ;;
278016d7e2f1Smrg    darwin*)
278116d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278216d7e2f1Smrg        ;;
278316d7e2f1Smrg    *bsd*)
278416d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278516d7e2f1Smrg        ;;
278616d7e2f1Smrgesac
278716d7e2f1Smrg
278816d7e2f1Smrg# User supplied flags override default flags
278916d7e2f1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279016d7e2f1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279116d7e2f1Smrgfi
279216d7e2f1Smrg
279316d7e2f1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279416d7e2f1Smrg]) # XORG_WITH_LINT
279516d7e2f1Smrg
279616d7e2f1Smrg# XORG_CHECK_MALLOC_ZERO
279716d7e2f1Smrg# ----------------------
279816d7e2f1Smrg# Minimum version: 1.0.0
279916d7e2f1Smrg#
280016d7e2f1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280116d7e2f1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280216d7e2f1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280316d7e2f1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280416d7e2f1SmrgAC_ARG_ENABLE(malloc0returnsnull,
280516d7e2f1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280616d7e2f1Smrg		       [malloc(0) returns NULL (default: auto)]),
280716d7e2f1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280816d7e2f1Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280916d7e2f1Smrg
281016d7e2f1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281116d7e2f1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28122becc446SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28132becc446Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281416d7e2f1Smrg#include <stdlib.h>
281516d7e2f1Smrg],[
281616d7e2f1Smrg    char *m0, *r0, *c0, *p;
281716d7e2f1Smrg    m0 = malloc(0);
281816d7e2f1Smrg    p = malloc(10);
281916d7e2f1Smrg    r0 = realloc(p,0);
282016d7e2f1Smrg    c0 = calloc(0,10);
282116d7e2f1Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282216d7e2f1Smrg])],
28232becc446Smrg		[xorg_cv_malloc0_returns_null=yes],
28242becc446Smrg		[xorg_cv_malloc0_returns_null=no])])
28252becc446SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282616d7e2f1Smrgfi
282716d7e2f1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282816d7e2f1Smrg
282916d7e2f1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283016d7e2f1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283116d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283216d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283316d7e2f1Smrgelse
283416d7e2f1Smrg	MALLOC_ZERO_CFLAGS=""
283516d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=""
283616d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS=""
283716d7e2f1Smrgfi
283816d7e2f1Smrg
283916d7e2f1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284016d7e2f1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284116d7e2f1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284216d7e2f1Smrg]) # XORG_CHECK_MALLOC_ZERO
284316d7e2f1Smrg
284416d7e2f1Smrg# XORG_WITH_LINT()
284516d7e2f1Smrg# ----------------
284616d7e2f1Smrg# Minimum version: 1.1.0
284716d7e2f1Smrg#
284816d7e2f1Smrg# This macro enables the use of a tool that flags some suspicious and
284916d7e2f1Smrg# non-portable constructs (likely to be bugs) in C language source code.
285016d7e2f1Smrg# It will attempt to locate the tool and use appropriate options.
285116d7e2f1Smrg# There are various lint type tools on different platforms.
285216d7e2f1Smrg#
285316d7e2f1Smrg# Interface to module:
285416d7e2f1Smrg# LINT:		returns the path to the tool found on the platform
285516d7e2f1Smrg#		or the value set to LINT on the configure cmd line
285616d7e2f1Smrg#		also an Automake conditional
285716d7e2f1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285816d7e2f1Smrg#
285916d7e2f1Smrg# --with-lint:	'yes' user instructs the module to use lint
286016d7e2f1Smrg#		'no' user instructs the module not to use lint (default)
286116d7e2f1Smrg#
286216d7e2f1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286316d7e2f1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286416d7e2f1Smrg#
286516d7e2f1SmrgAC_DEFUN([XORG_WITH_LINT],[
286616d7e2f1Smrg
286716d7e2f1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286816d7e2f1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286916d7e2f1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287016d7e2f1Smrg		[Use a lint-style source code checker (default: disabled)])],
287116d7e2f1Smrg		[use_lint=$withval], [use_lint=no])
287216d7e2f1Smrg
287316d7e2f1Smrg# Obtain platform specific info like program name and options
287416d7e2f1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287516d7e2f1Smrgcase $host_os in
287616d7e2f1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287716d7e2f1Smrg	lint_name=splint
287816d7e2f1Smrg	lint_options="-badflag"
287916d7e2f1Smrg	;;
288016d7e2f1Smrg  *freebsd* | *netbsd*)
288116d7e2f1Smrg	lint_name=lint
288216d7e2f1Smrg	lint_options="-u -b"
288316d7e2f1Smrg	;;
288416d7e2f1Smrg  *solaris*)
288516d7e2f1Smrg	lint_name=lint
288616d7e2f1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288716d7e2f1Smrg	;;
288816d7e2f1Smrgesac
288916d7e2f1Smrg
289016d7e2f1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289116d7e2f1Smrgif test "x$use_lint" = x"yes" ; then
289216d7e2f1Smrg   AC_PATH_PROG([LINT], [$lint_name])
289316d7e2f1Smrg   if test "x$LINT" = "x"; then
289416d7e2f1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289516d7e2f1Smrg   fi
289616d7e2f1Smrgelif test "x$use_lint" = x"no" ; then
289716d7e2f1Smrg   if test "x$LINT" != "x"; then
289816d7e2f1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289916d7e2f1Smrg   fi
290016d7e2f1Smrgelse
290116d7e2f1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290216d7e2f1Smrgfi
290316d7e2f1Smrg
290416d7e2f1Smrg# User supplied flags override default flags
290516d7e2f1Smrgif test "x$LINT_FLAGS" != "x"; then
290616d7e2f1Smrg   lint_options=$LINT_FLAGS
290716d7e2f1Smrgfi
290816d7e2f1Smrg
290916d7e2f1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291016d7e2f1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291116d7e2f1Smrg
291216d7e2f1Smrg]) # XORG_WITH_LINT
291316d7e2f1Smrg
291416d7e2f1Smrg# XORG_LINT_LIBRARY(LIBNAME)
291516d7e2f1Smrg# --------------------------
291616d7e2f1Smrg# Minimum version: 1.1.0
291716d7e2f1Smrg#
291816d7e2f1Smrg# Sets up flags for building lint libraries for checking programs that call
291916d7e2f1Smrg# functions in the library.
292016d7e2f1Smrg#
292116d7e2f1Smrg# Interface to module:
292216d7e2f1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292316d7e2f1Smrg# MAKE_LINT_LIB		- Automake conditional
292416d7e2f1Smrg#
292516d7e2f1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292616d7e2f1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292716d7e2f1Smrg
292816d7e2f1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29298650bb69SmrgAC_REQUIRE([XORG_WITH_LINT])
29308650bb69SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29318650bb69Smrg	[Create lint library (default: disabled)])],
29328650bb69Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293316d7e2f1Smrg
293416d7e2f1Smrgif test "x$make_lint_lib" = x"yes" ; then
293516d7e2f1Smrg   LINTLIB=llib-l$1.ln
293616d7e2f1Smrg   if test "x$LINT" = "x"; then
293716d7e2f1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293816d7e2f1Smrg   fi
293916d7e2f1Smrgelif test "x$make_lint_lib" != x"no" ; then
294016d7e2f1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29418650bb69Smrgfi
294216d7e2f1Smrg
29438650bb69SmrgAC_SUBST(LINTLIB)
29448650bb69SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29458650bb69Smrg
29468650bb69Smrg]) # XORG_LINT_LIBRARY
29478650bb69Smrg
294816d7e2f1Smrg# XORG_COMPILER_BRAND
294916d7e2f1Smrg# -------------------
295016d7e2f1Smrg# Minimum version: 1.14.0
295116d7e2f1Smrg#
295216d7e2f1Smrg# Checks for various brands of compilers and sets flags as appropriate:
295316d7e2f1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29542becc446Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295516d7e2f1Smrg#   clang compiler - sets CLANGCC to "yes"
295616d7e2f1Smrg#   Intel compiler - sets INTELCC to "yes"
295716d7e2f1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295816d7e2f1Smrg#
295916d7e2f1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29602becc446SmrgAC_LANG_CASE(
29612becc446Smrg	[C], [
29622becc446Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29632becc446Smrg	],
29642becc446Smrg	[C++], [
29652becc446Smrg		AC_REQUIRE([AC_PROG_CXX])
29662becc446Smrg	]
29672becc446Smrg)
296816d7e2f1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296916d7e2f1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297016d7e2f1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297116d7e2f1Smrg]) # XORG_COMPILER_BRAND
297216d7e2f1Smrg
297316d7e2f1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297416d7e2f1Smrg# ---------------
297516d7e2f1Smrg# Minimum version: 1.16.0
297616d7e2f1Smrg#
297716d7e2f1Smrg# Test if the compiler works when passed the given flag as a command line argument.
297816d7e2f1Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297916d7e2f1Smrg# next flag in the list until there are no more options.
298016d7e2f1Smrg#
298116d7e2f1Smrg# Note that this does not guarantee that the compiler supports the flag as some
298216d7e2f1Smrg# compilers will simply ignore arguments that they do not understand, but we do
298316d7e2f1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298416d7e2f1Smrg# -Werror=unused-command-line-argument
298516d7e2f1Smrg#
298616d7e2f1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298716d7e2f1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298816d7e2f1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298916d7e2f1Smrg
29902becc446SmrgAC_LANG_COMPILER_REQUIRE
29912becc446Smrg
29922becc446SmrgAC_LANG_CASE(
29932becc446Smrg	[C], [
29942becc446Smrg		AC_REQUIRE([AC_PROG_CC_C99])
29952becc446Smrg		define([PREFIX], [C])
29962becc446Smrg		define([CACHE_PREFIX], [cc])
29972becc446Smrg		define([COMPILER], [$CC])
29982becc446Smrg	],
29992becc446Smrg	[C++], [
30002becc446Smrg		define([PREFIX], [CXX])
30012becc446Smrg		define([CACHE_PREFIX], [cxx])
30022becc446Smrg		define([COMPILER], [$CXX])
30032becc446Smrg	]
30042becc446Smrg)
30052becc446Smrg
30062becc446Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300716d7e2f1Smrg
30082becc446Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30092becc446Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30102becc446Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30112becc446Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301216d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30132becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30142becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30152becc446Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30162becc446Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301716d7e2f1Smrgfi
301816d7e2f1Smrg
30192becc446Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30202becc446Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30212becc446Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302216d7e2f1Smrg	fi
30232becc446Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30242becc446Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30252becc446Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302616d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30272becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30282becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30292becc446Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30302becc446Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303116d7e2f1Smrgfi
303216d7e2f1Smrg
303316d7e2f1Smrgfound="no"
303416d7e2f1Smrgm4_foreach([flag], m4_cdr($@), [
303516d7e2f1Smrg	if test $found = "no" ; then
30362becc446Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30372becc446Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303816d7e2f1Smrg		fi
303916d7e2f1Smrg
30402becc446Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30412becc446Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304216d7e2f1Smrg		fi
304316d7e2f1Smrg
30442becc446Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304516d7e2f1Smrg
304616d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30472becc446Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30482becc446Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30492becc446Smrg		AC_CACHE_VAL($cacheid,
305016d7e2f1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30512becc446Smrg					     [eval $cacheid=yes],
30522becc446Smrg					     [eval $cacheid=no])])
305316d7e2f1Smrg
30542becc446Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305516d7e2f1Smrg
30562becc446Smrg		eval supported=\$$cacheid
305716d7e2f1Smrg		AC_MSG_RESULT([$supported])
305816d7e2f1Smrg		if test "$supported" = "yes" ; then
305916d7e2f1Smrg			$1="$$1 ]flag["
306016d7e2f1Smrg			found="yes"
306116d7e2f1Smrg		fi
306216d7e2f1Smrg	fi
306316d7e2f1Smrg])
306416d7e2f1Smrg]) # XORG_TESTSET_CFLAG
306516d7e2f1Smrg
306616d7e2f1Smrg# XORG_COMPILER_FLAGS
306716d7e2f1Smrg# ---------------
306816d7e2f1Smrg# Minimum version: 1.16.0
306916d7e2f1Smrg#
30702becc446Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30712becc446Smrg# arguments supported by the selected compiler which do NOT alter the generated
30722becc446Smrg# code.  These arguments will cause the compiler to print various warnings
30732becc446Smrg# during compilation AND turn a conservative set of warnings into errors.
307416d7e2f1Smrg#
30752becc446Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30762becc446Smrg# future versions of util-macros as options are added to new compilers.
307716d7e2f1Smrg#
307816d7e2f1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307916d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308016d7e2f1Smrg
308116d7e2f1SmrgAC_ARG_ENABLE(selective-werror,
308216d7e2f1Smrg              AS_HELP_STRING([--disable-selective-werror],
308316d7e2f1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308416d7e2f1Smrg              [SELECTIVE_WERROR=$enableval],
308516d7e2f1Smrg              [SELECTIVE_WERROR=yes])
308616d7e2f1Smrg
30872becc446SmrgAC_LANG_CASE(
30882becc446Smrg        [C], [
30892becc446Smrg                define([PREFIX], [C])
30902becc446Smrg        ],
30912becc446Smrg        [C++], [
30922becc446Smrg                define([PREFIX], [CXX])
30932becc446Smrg        ]
30942becc446Smrg)
309516d7e2f1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309616d7e2f1Smrgif test "x$SUNCC" = "xyes"; then
30972becc446Smrg    [BASE_]PREFIX[FLAGS]="-v"
309816d7e2f1Smrgelse
30992becc446Smrg    [BASE_]PREFIX[FLAGS]=""
310016d7e2f1Smrgfi
310116d7e2f1Smrg
310216d7e2f1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31032becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31042becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31052becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31062becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31072becc446Smrg
31082becc446SmrgAC_LANG_CASE(
31092becc446Smrg	[C], [
31102becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31112becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31122becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31132becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31142becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31152becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31162becc446Smrg	]
31172becc446Smrg)
311816d7e2f1Smrg
311916d7e2f1Smrg# This chunk adds additional warnings that could catch undesired effects.
31202becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31212becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31222becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31232becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31242becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31252becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31262becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
312716d7e2f1Smrg
312816d7e2f1Smrg# These are currently disabled because they are noisy.  They will be enabled
312916d7e2f1Smrg# in the future once the codebase is sufficiently modernized to silence
313016d7e2f1Smrg# them.  For now, I don't want them to drown out the other warnings.
31312becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31322becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31332becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
313416d7e2f1Smrg
313516d7e2f1Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313616d7e2f1Smrg# when there are problems that should be fixed.
313716d7e2f1Smrg
313816d7e2f1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31392becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31402becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31412becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31422becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31432becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31442becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31452becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31462becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31472becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31482becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31492becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31502becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31512becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315216d7e2f1Smrgelse
315316d7e2f1SmrgAC_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])
31542becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31552becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31562becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31572becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31582becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31592becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31602becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31612becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31622becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31632becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31642becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31652becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31662becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31672becc446Smrgfi
31682becc446Smrg
31692becc446SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317016d7e2f1Smrg]) # XORG_COMPILER_FLAGS
317116d7e2f1Smrg
31728650bb69Smrg# XORG_CWARNFLAGS
31738650bb69Smrg# ---------------
31748650bb69Smrg# Minimum version: 1.2.0
317516d7e2f1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31768650bb69Smrg#
31778650bb69Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31788650bb69Smrg#
317916d7e2f1Smrg# This function is deprecated because it defines -fno-strict-aliasing
318016d7e2f1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318116d7e2f1Smrg# is needed, then it should be added explicitly in the module when
318216d7e2f1Smrg# it is updated to use BASE_CFLAGS.
318316d7e2f1Smrg#
31848650bb69SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318516d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318616d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31872becc446SmrgAC_LANG_CASE(
31882becc446Smrg	[C], [
31892becc446Smrg		CWARNFLAGS="$BASE_CFLAGS"
31902becc446Smrg		if  test "x$GCC" = xyes ; then
31912becc446Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31922becc446Smrg		fi
31932becc446Smrg		AC_SUBST(CWARNFLAGS)
31942becc446Smrg	]
31952becc446Smrg)
31968650bb69Smrg]) # XORG_CWARNFLAGS
31978650bb69Smrg
31988650bb69Smrg# XORG_STRICT_OPTION
31998650bb69Smrg# -----------------------
32008650bb69Smrg# Minimum version: 1.3.0
32018650bb69Smrg#
320216d7e2f1Smrg# Add configure option to enable strict compilation flags, such as treating
320316d7e2f1Smrg# warnings as fatal errors.
320416d7e2f1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32052becc446Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320616d7e2f1Smrg#
320716d7e2f1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320816d7e2f1Smrg# when strict compilation is unconditionally desired.
32098650bb69SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32108650bb69SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321116d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32128650bb69Smrg
32138650bb69SmrgAC_ARG_ENABLE(strict-compilation,
32148650bb69Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32158650bb69Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32168650bb69Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321716d7e2f1Smrg
32182becc446SmrgAC_LANG_CASE(
32192becc446Smrg        [C], [
32202becc446Smrg                define([PREFIX], [C])
32212becc446Smrg        ],
32222becc446Smrg        [C++], [
32232becc446Smrg                define([PREFIX], [CXX])
32242becc446Smrg        ]
32252becc446Smrg)
32262becc446Smrg
32272becc446Smrg[STRICT_]PREFIX[FLAGS]=""
32282becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32292becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323016d7e2f1Smrg
323116d7e2f1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323216d7e2f1Smrg# activate it with -Werror, so we add it here explicitly.
32332becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323416d7e2f1Smrg
32358650bb69Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32362becc446Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32372becc446Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32388650bb69Smrgfi
32392becc446SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32402becc446SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32412becc446SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32428650bb69Smrg]) # XORG_STRICT_OPTION
32438650bb69Smrg
32448650bb69Smrg# XORG_DEFAULT_OPTIONS
32458650bb69Smrg# --------------------
32468650bb69Smrg# Minimum version: 1.3.0
32478650bb69Smrg#
32488650bb69Smrg# Defines default options for X.Org modules.
32498650bb69Smrg#
32508650bb69SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325116d7e2f1SmrgAC_REQUIRE([AC_PROG_INSTALL])
325216d7e2f1SmrgXORG_COMPILER_FLAGS
32538650bb69SmrgXORG_CWARNFLAGS
32548650bb69SmrgXORG_STRICT_OPTION
32558650bb69SmrgXORG_RELEASE_VERSION
32568650bb69SmrgXORG_CHANGELOG
325716d7e2f1SmrgXORG_INSTALL
32588650bb69SmrgXORG_MANPAGE_SECTIONS
325916d7e2f1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326016d7e2f1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32618650bb69Smrg]) # XORG_DEFAULT_OPTIONS
326216d7e2f1Smrg
326316d7e2f1Smrg# XORG_INSTALL()
326416d7e2f1Smrg# ----------------
326516d7e2f1Smrg# Minimum version: 1.4.0
326616d7e2f1Smrg#
326716d7e2f1Smrg# Defines the variable INSTALL_CMD as the command to copy
326816d7e2f1Smrg# INSTALL from $prefix/share/util-macros.
326916d7e2f1Smrg#
327016d7e2f1SmrgAC_DEFUN([XORG_INSTALL], [
327116d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327216d7e2f1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327316d7e2f1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327416d7e2f1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32753458e6c2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32763458e6c2Smrgtouch \$(top_srcdir)/INSTALL; \
32773458e6c2Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327816d7e2f1SmrgAC_SUBST([INSTALL_CMD])
327916d7e2f1Smrg]) # XORG_INSTALL
32802c7c4e3dSmrgdnl Copyright 2005 Red Hat, Inc
32812c7c4e3dSmrgdnl
32822c7c4e3dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32832c7c4e3dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32842c7c4e3dSmrgdnl the above copyright notice appear in all copies and that both that
32852c7c4e3dSmrgdnl copyright notice and this permission notice appear in supporting
32862c7c4e3dSmrgdnl documentation.
32872c7c4e3dSmrgdnl
32882c7c4e3dSmrgdnl The above copyright notice and this permission notice shall be included
32892c7c4e3dSmrgdnl in all copies or substantial portions of the Software.
32902c7c4e3dSmrgdnl
32912c7c4e3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32922c7c4e3dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32932c7c4e3dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32942c7c4e3dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32952c7c4e3dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32962c7c4e3dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32972c7c4e3dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
32982c7c4e3dSmrgdnl
32992c7c4e3dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33002c7c4e3dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33012c7c4e3dSmrgdnl other dealings in this Software without prior written authorization
33022c7c4e3dSmrgdnl from the copyright holders.
33032c7c4e3dSmrgdnl
33042c7c4e3dSmrg
33052c7c4e3dSmrg# XORG_RELEASE_VERSION
33062c7c4e3dSmrg# --------------------
330716d7e2f1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33082becc446Smrg
33092c7c4e3dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33108650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33118650bb69Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33128650bb69Smrg		[Major version of this package])
33138650bb69Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33148650bb69Smrg	if test "x$PVM" = "x"; then
33158650bb69Smrg		PVM="0"
33168650bb69Smrg	fi
33178650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33188650bb69Smrg		[$PVM],
33198650bb69Smrg		[Minor version of this package])
33208650bb69Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33218650bb69Smrg	if test "x$PVP" = "x"; then
33228650bb69Smrg		PVP="0"
33238650bb69Smrg	fi
33248650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33258650bb69Smrg		[$PVP],
33268650bb69Smrg		[Patch version of this package])
33272c7c4e3dSmrg])
33282c7c4e3dSmrg
33298650bb69Smrg# XORG_CHANGELOG()
33308650bb69Smrg# ----------------
33318650bb69Smrg# Minimum version: 1.2.0
33328650bb69Smrg#
33338650bb69Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33348650bb69Smrg# ChangeLog from git.
33358650bb69Smrg#
33368650bb69Smrg#
33378650bb69SmrgAC_DEFUN([XORG_CHANGELOG], [
33383458e6c2SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333916d7e2f1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33403458e6c2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33413458e6c2Smrgtouch \$(top_srcdir)/ChangeLog; \
33423458e6c2Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33438650bb69SmrgAC_SUBST([CHANGELOG_CMD])
33448650bb69Smrg]) # XORG_CHANGELOG
33458650bb69Smrg
3346