10f595aedSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2b8f63ae3Smrg
30f595aedSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4c95b42baSmrg
5c95b42baSmrg# This file is free software; the Free Software Foundation
6c95b42baSmrg# gives unlimited permission to copy and/or distribute it,
7c95b42baSmrg# with or without modifications, as long as this notice is preserved.
8c95b42baSmrg
9c95b42baSmrg# This program is distributed in the hope that it will be useful,
10c95b42baSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11c95b42baSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12c95b42baSmrg# PARTICULAR PURPOSE.
13c95b42baSmrg
14b8f63ae3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f40e0d56Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f40e0d56Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
170f595aedSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
180f595aedSmrg[m4_warning([this file was generated for autoconf 2.71.
19f40e0d56SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f40e0d56SmrgIf you have problems, you may need to regenerate the build system entirely.
21b8f63ae3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22c95b42baSmrg
230f595aedSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
240f595aedSmrg#
250f595aedSmrg# This file is free software; the Free Software Foundation
260f595aedSmrg# gives unlimited permission to copy and/or distribute it,
270f595aedSmrg# with or without modifications, as long as this notice is preserved.
28b8f63ae3Smrg
290f595aedSmrg# AM_AUTOMAKE_VERSION(VERSION)
300f595aedSmrg# ----------------------------
310f595aedSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
320f595aedSmrg# generated from the m4 files accompanying Automake X.Y.
330f595aedSmrg# (This private macro should not be called outside this file.)
340f595aedSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
350f595aedSmrg[am__api_version='1.16'
360f595aedSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
370f595aedSmrgdnl require some minimum version.  Point them to the right macro.
380f595aedSmrgm4_if([$1], [1.16.5], [],
390f595aedSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
400f595aedSmrg])
41b8f63ae3Smrg
420f595aedSmrg# _AM_AUTOCONF_VERSION(VERSION)
430f595aedSmrg# -----------------------------
440f595aedSmrg# aclocal traces this macro to find the Autoconf version.
450f595aedSmrg# This is a private macro too.  Using m4_define simplifies
460f595aedSmrg# the logic in aclocal, which can simply ignore this definition.
470f595aedSmrgm4_define([_AM_AUTOCONF_VERSION], [])
48c95b42baSmrg
490f595aedSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
500f595aedSmrg# -------------------------------
510f595aedSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
520f595aedSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
530f595aedSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
540f595aedSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
550f595aedSmrgm4_ifndef([AC_AUTOCONF_VERSION],
560f595aedSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
570f595aedSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5862aeb71dSmrg
590f595aedSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60f40e0d56Smrg
610f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
620f595aedSmrg#
630f595aedSmrg# This file is free software; the Free Software Foundation
640f595aedSmrg# gives unlimited permission to copy and/or distribute it,
650f595aedSmrg# with or without modifications, as long as this notice is preserved.
66c95b42baSmrg
670f595aedSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680f595aedSmrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690f595aedSmrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
700f595aedSmrg#
710f595aedSmrg# Of course, Automake must honor this variable whenever it calls a
720f595aedSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
730f595aedSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
740f595aedSmrg# depending on how configure is run.  This is pretty annoying, since
750f595aedSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
760f595aedSmrg# source directory, any form will work fine, but in subdirectories a
770f595aedSmrg# relative path needs to be adjusted first.
780f595aedSmrg#
790f595aedSmrg# $ac_aux_dir/missing
800f595aedSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
810f595aedSmrg# $top_srcdir/$ac_aux_dir/missing
820f595aedSmrg#    fails if $ac_aux_dir is absolute,
830f595aedSmrg#    fails when called from a subdirectory in a VPATH build with
840f595aedSmrg#          a relative $ac_aux_dir
850f595aedSmrg#
860f595aedSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
870f595aedSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
880f595aedSmrg# harmless because $srcdir is '.', but things will broke when you
890f595aedSmrg# start a VPATH build or use an absolute $srcdir.
900f595aedSmrg#
910f595aedSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
920f595aedSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
930f595aedSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
940f595aedSmrg# and then we would define $MISSING as
950f595aedSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
960f595aedSmrg# This will work as long as MISSING is not called from configure, because
970f595aedSmrg# unfortunately $(top_srcdir) has no meaning in configure.
980f595aedSmrg# However there are other variables, like CC, which are often used in
990f595aedSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1000f595aedSmrg#
1010f595aedSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1020f595aedSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1030f595aedSmrg# configured tree to be moved without reconfiguration.
104c95b42baSmrg
1050f595aedSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060f595aedSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070f595aedSmrg# Expand $ac_aux_dir to an absolute path.
1080f595aedSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1090f595aedSmrg])
110c95b42baSmrg
1110f595aedSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112c95b42baSmrg
1130f595aedSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1140f595aedSmrg#
1150f595aedSmrg# This file is free software; the Free Software Foundation
1160f595aedSmrg# gives unlimited permission to copy and/or distribute it,
1170f595aedSmrg# with or without modifications, as long as this notice is preserved.
11862aeb71dSmrg
1190f595aedSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1200f595aedSmrg# -------------------------------------
1210f595aedSmrg# Define a conditional.
1220f595aedSmrgAC_DEFUN([AM_CONDITIONAL],
1230f595aedSmrg[AC_PREREQ([2.52])dnl
1240f595aedSmrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250f595aedSmrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1260f595aedSmrgAC_SUBST([$1_TRUE])dnl
1270f595aedSmrgAC_SUBST([$1_FALSE])dnl
1280f595aedSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1290f595aedSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1300f595aedSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1310f595aedSmrgif $2; then
1320f595aedSmrg  $1_TRUE=
1330f595aedSmrg  $1_FALSE='#'
1340f595aedSmrgelse
1350f595aedSmrg  $1_TRUE='#'
1360f595aedSmrg  $1_FALSE=
1370f595aedSmrgfi
1380f595aedSmrgAC_CONFIG_COMMANDS_PRE(
1390f595aedSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1400f595aedSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1410f595aedSmrgUsually this means the macro was only invoked conditionally.]])
1420f595aedSmrgfi])])
143c95b42baSmrg
1440f595aedSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1450f595aedSmrg#
1460f595aedSmrg# This file is free software; the Free Software Foundation
1470f595aedSmrg# gives unlimited permission to copy and/or distribute it,
1480f595aedSmrg# with or without modifications, as long as this notice is preserved.
149c95b42baSmrg
150c95b42baSmrg
1510f595aedSmrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1520f595aedSmrg# written in clear, in which case automake, when reading aclocal.m4,
1530f595aedSmrg# will think it sees a *use*, and therefore will trigger all it's
1540f595aedSmrg# C support machinery.  Also note that it means that autoscan, seeing
1550f595aedSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156c95b42baSmrg
157c95b42baSmrg
1580f595aedSmrg# _AM_DEPENDENCIES(NAME)
1590f595aedSmrg# ----------------------
1600f595aedSmrg# See how the compiler implements dependency checking.
1610f595aedSmrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1620f595aedSmrg# We try a few techniques and use that to set a single cache variable.
1630f595aedSmrg#
1640f595aedSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1650f595aedSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1660f595aedSmrg# dependency, and given that the user is not expected to run this macro,
1670f595aedSmrg# just rely on AC_PROG_CC.
1680f595aedSmrgAC_DEFUN([_AM_DEPENDENCIES],
1690f595aedSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1700f595aedSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1710f595aedSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1720f595aedSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173c95b42baSmrg
1740f595aedSmrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1750f595aedSmrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1760f595aedSmrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1770f595aedSmrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1780f595aedSmrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1790f595aedSmrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1800f595aedSmrg                    [depcc="$$1"   am_compiler_list=])
181c95b42baSmrg
1820f595aedSmrgAC_CACHE_CHECK([dependency style of $depcc],
1830f595aedSmrg               [am_cv_$1_dependencies_compiler_type],
1840f595aedSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1850f595aedSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1860f595aedSmrg  # making bogus files that we don't know about and never remove.  For
1870f595aedSmrg  # instance it was reported that on HP-UX the gcc test will end up
1880f595aedSmrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1890f595aedSmrg  # in D".
1900f595aedSmrg  rm -rf conftest.dir
1910f595aedSmrg  mkdir conftest.dir
1920f595aedSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1930f595aedSmrg  # using a relative directory.
1940f595aedSmrg  cp "$am_depcomp" conftest.dir
1950f595aedSmrg  cd conftest.dir
1960f595aedSmrg  # We will build objects and dependencies in a subdirectory because
1970f595aedSmrg  # it helps to detect inapplicable dependency modes.  For instance
1980f595aedSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1990f595aedSmrg  # side effect of compilation, but ICC will put the dependencies in
2000f595aedSmrg  # the current directory while Tru64 will put them in the object
2010f595aedSmrg  # directory.
2020f595aedSmrg  mkdir sub
203c95b42baSmrg
2040f595aedSmrg  am_cv_$1_dependencies_compiler_type=none
2050f595aedSmrg  if test "$am_compiler_list" = ""; then
2060f595aedSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2070f595aedSmrg  fi
2080f595aedSmrg  am__universal=false
2090f595aedSmrg  m4_case([$1], [CC],
2100f595aedSmrg    [case " $depcc " in #(
2110f595aedSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2120f595aedSmrg     esac],
2130f595aedSmrg    [CXX],
2140f595aedSmrg    [case " $depcc " in #(
2150f595aedSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2160f595aedSmrg     esac])
217c95b42baSmrg
2180f595aedSmrg  for depmode in $am_compiler_list; do
2190f595aedSmrg    # Setup a source with many dependencies, because some compilers
2200f595aedSmrg    # like to wrap large dependency lists on column 80 (with \), and
2210f595aedSmrg    # we should not choose a depcomp mode which is confused by this.
2220f595aedSmrg    #
2230f595aedSmrg    # We need to recreate these files for each test, as the compiler may
2240f595aedSmrg    # overwrite some of them when testing with obscure command lines.
2250f595aedSmrg    # This happens at least with the AIX C compiler.
2260f595aedSmrg    : > sub/conftest.c
2270f595aedSmrg    for i in 1 2 3 4 5 6; do
2280f595aedSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2290f595aedSmrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2300f595aedSmrg      # Solaris 10 /bin/sh.
2310f595aedSmrg      echo '/* dummy */' > sub/conftst$i.h
2320f595aedSmrg    done
2330f595aedSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234c95b42baSmrg
2350f595aedSmrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2360f595aedSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2370f595aedSmrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2380f595aedSmrg    # versions had trouble with output in subdirs.
2390f595aedSmrg    am__obj=sub/conftest.${OBJEXT-o}
2400f595aedSmrg    am__minus_obj="-o $am__obj"
2410f595aedSmrg    case $depmode in
2420f595aedSmrg    gcc)
2430f595aedSmrg      # This depmode causes a compiler race in universal mode.
2440f595aedSmrg      test "$am__universal" = false || continue
2450f595aedSmrg      ;;
2460f595aedSmrg    nosideeffect)
2470f595aedSmrg      # After this tag, mechanisms are not by side-effect, so they'll
2480f595aedSmrg      # only be used when explicitly requested.
2490f595aedSmrg      if test "x$enable_dependency_tracking" = xyes; then
2500f595aedSmrg	continue
2510f595aedSmrg      else
2520f595aedSmrg	break
2530f595aedSmrg      fi
2540f595aedSmrg      ;;
2550f595aedSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2560f595aedSmrg      # This compiler won't grok '-c -o', but also, the minuso test has
2570f595aedSmrg      # not run yet.  These depmodes are late enough in the game, and
2580f595aedSmrg      # so weak that their functioning should not be impacted.
2590f595aedSmrg      am__obj=conftest.${OBJEXT-o}
2600f595aedSmrg      am__minus_obj=
2610f595aedSmrg      ;;
2620f595aedSmrg    none) break ;;
2630f595aedSmrg    esac
2640f595aedSmrg    if depmode=$depmode \
2650f595aedSmrg       source=sub/conftest.c object=$am__obj \
2660f595aedSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2670f595aedSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2680f595aedSmrg         >/dev/null 2>conftest.err &&
2690f595aedSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2700f595aedSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2710f595aedSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2720f595aedSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2730f595aedSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2740f595aedSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2750f595aedSmrg      # that says an option was ignored or not supported.
2760f595aedSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2770f595aedSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2780f595aedSmrg      # The diagnosis changed in icc 8.0:
2790f595aedSmrg      #   icc: Command line remark: option '-MP' not supported
2800f595aedSmrg      if (grep 'ignoring option' conftest.err ||
2810f595aedSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2820f595aedSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2830f595aedSmrg        break
2840f595aedSmrg      fi
2850f595aedSmrg    fi
2860f595aedSmrg  done
287c95b42baSmrg
2880f595aedSmrg  cd ..
2890f595aedSmrg  rm -rf conftest.dir
2900f595aedSmrgelse
2910f595aedSmrg  am_cv_$1_dependencies_compiler_type=none
2920f595aedSmrgfi
2930f595aedSmrg])
2940f595aedSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2950f595aedSmrgAM_CONDITIONAL([am__fastdep$1], [
2960f595aedSmrg  test "x$enable_dependency_tracking" != xno \
2970f595aedSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2980f595aedSmrg])
299c95b42baSmrg
300b8f63ae3Smrg
3010f595aedSmrg# AM_SET_DEPDIR
3020f595aedSmrg# -------------
3030f595aedSmrg# Choose a directory name for dependency files.
3040f595aedSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3050f595aedSmrgAC_DEFUN([AM_SET_DEPDIR],
3060f595aedSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3070f595aedSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3080f595aedSmrg])
309b8f63ae3Smrg
310b8f63ae3Smrg
3110f595aedSmrg# AM_DEP_TRACK
3120f595aedSmrg# ------------
3130f595aedSmrgAC_DEFUN([AM_DEP_TRACK],
3140f595aedSmrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3150f595aedSmrgAS_HELP_STRING(
3160f595aedSmrg  [--enable-dependency-tracking],
3170f595aedSmrg  [do not reject slow dependency extractors])
3180f595aedSmrgAS_HELP_STRING(
3190f595aedSmrg  [--disable-dependency-tracking],
3200f595aedSmrg  [speeds up one-time build])])
3210f595aedSmrgif test "x$enable_dependency_tracking" != xno; then
3220f595aedSmrg  am_depcomp="$ac_aux_dir/depcomp"
3230f595aedSmrg  AMDEPBACKSLASH='\'
3240f595aedSmrg  am__nodep='_no'
3250f595aedSmrgfi
3260f595aedSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3270f595aedSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3280f595aedSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3290f595aedSmrgAC_SUBST([am__nodep])dnl
3300f595aedSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3310f595aedSmrg])
332b8f63ae3Smrg
3330f595aedSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334b8f63ae3Smrg
3350f595aedSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336b8f63ae3Smrg#
3370f595aedSmrg# This file is free software; the Free Software Foundation
3380f595aedSmrg# gives unlimited permission to copy and/or distribute it,
3390f595aedSmrg# with or without modifications, as long as this notice is preserved.
340b8f63ae3Smrg
3410f595aedSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3420f595aedSmrg# ------------------------------
3430f595aedSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3440f595aedSmrg[{
3450f595aedSmrg  # Older Autoconf quotes --file arguments for eval, but not when files
3460f595aedSmrg  # are listed without --file.  Let's play safe and only enable the eval
3470f595aedSmrg  # if we detect the quoting.
3480f595aedSmrg  # TODO: see whether this extra hack can be removed once we start
3490f595aedSmrg  # requiring Autoconf 2.70 or later.
3500f595aedSmrg  AS_CASE([$CONFIG_FILES],
3510f595aedSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
3520f595aedSmrg          [*], [set x $CONFIG_FILES])
3530f595aedSmrg  shift
3540f595aedSmrg  # Used to flag and report bootstrapping failures.
3550f595aedSmrg  am_rc=0
3560f595aedSmrg  for am_mf
3570f595aedSmrg  do
3580f595aedSmrg    # Strip MF so we end up with the name of the file.
3590f595aedSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3600f595aedSmrg    # Check whether this is an Automake generated Makefile which includes
3610f595aedSmrg    # dependency-tracking related rules and includes.
3620f595aedSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3630f595aedSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
3640f595aedSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3650f595aedSmrg      || continue
3660f595aedSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3670f595aedSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3680f595aedSmrg    AM_RUN_LOG([cd "$am_dirpart" \
3690f595aedSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3700f595aedSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3710f595aedSmrg  done
3720f595aedSmrg  if test $am_rc -ne 0; then
3730f595aedSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3740f595aedSmrg    for automatic dependency tracking.  If GNU make was not used, consider
3750f595aedSmrg    re-running the configure script with MAKE="gmake" (or whatever is
3760f595aedSmrg    necessary).  You can also try re-running configure with the
3770f595aedSmrg    '--disable-dependency-tracking' option to at least be able to build
3780f595aedSmrg    the package (albeit without support for automatic dependency tracking).])
3790f595aedSmrg  fi
3800f595aedSmrg  AS_UNSET([am_dirpart])
3810f595aedSmrg  AS_UNSET([am_filepart])
3820f595aedSmrg  AS_UNSET([am_mf])
3830f595aedSmrg  AS_UNSET([am_rc])
3840f595aedSmrg  rm -f conftest-deps.mk
3850f595aedSmrg}
3860f595aedSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387c95b42baSmrg
388c95b42baSmrg
3890f595aedSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3900f595aedSmrg# -----------------------------
3910f595aedSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
392b8f63ae3Smrg#
3930f595aedSmrg# This code is only required when automatic dependency tracking is enabled.
3940f595aedSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3950f595aedSmrg# order to bootstrap the dependency handling code.
3960f595aedSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3970f595aedSmrg[AC_CONFIG_COMMANDS([depfiles],
3980f595aedSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3990f595aedSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400c95b42baSmrg
4010f595aedSmrg# Do all the work for Automake.                             -*- Autoconf -*-
402c95b42baSmrg
4030f595aedSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4040f595aedSmrg#
4050f595aedSmrg# This file is free software; the Free Software Foundation
4060f595aedSmrg# gives unlimited permission to copy and/or distribute it,
4070f595aedSmrg# with or without modifications, as long as this notice is preserved.
408c95b42baSmrg
4090f595aedSmrg# This macro actually does too much.  Some checks are only needed if
4100f595aedSmrg# your package does certain things.  But this isn't really a big deal.
411c95b42baSmrg
4120f595aedSmrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4130f595aedSmrgm4_define([AC_PROG_CC],
4140f595aedSmrgm4_defn([AC_PROG_CC])
4150f595aedSmrg[_AM_PROG_CC_C_O
4160f595aedSmrg])
417c95b42baSmrg
4180f595aedSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4190f595aedSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4200f595aedSmrg# -----------------------------------------------
4210f595aedSmrg# The call with PACKAGE and VERSION arguments is the old style
4220f595aedSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4230f595aedSmrg# and VERSION should now be passed to AC_INIT and removed from
4240f595aedSmrg# the call to AM_INIT_AUTOMAKE.
4250f595aedSmrg# We support both call styles for the transition.  After
4260f595aedSmrg# the next Automake release, Autoconf can make the AC_INIT
4270f595aedSmrg# arguments mandatory, and then we can depend on a new Autoconf
4280f595aedSmrg# release and drop the old call support.
4290f595aedSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4300f595aedSmrg[AC_PREREQ([2.65])dnl
4310f595aedSmrgm4_ifdef([_$0_ALREADY_INIT],
4320f595aedSmrg  [m4_fatal([$0 expanded multiple times
4330f595aedSmrg]m4_defn([_$0_ALREADY_INIT]))],
4340f595aedSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4350f595aedSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4360f595aedSmrgdnl the ones we care about.
4370f595aedSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4380f595aedSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4390f595aedSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4400f595aedSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4410f595aedSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4420f595aedSmrg  # is not polluted with repeated "-I."
4430f595aedSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4440f595aedSmrg  # test to see if srcdir already configured
4450f595aedSmrg  if test -f $srcdir/config.status; then
4460f595aedSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4470f595aedSmrg  fi
448b8f63ae3Smrgfi
449c95b42baSmrg
4500f595aedSmrg# test whether we have cygpath
4510f595aedSmrgif test -z "$CYGPATH_W"; then
4520f595aedSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4530f595aedSmrg    CYGPATH_W='cygpath -w'
4540f595aedSmrg  else
4550f595aedSmrg    CYGPATH_W=echo
4560f595aedSmrg  fi
457c95b42baSmrgfi
4580f595aedSmrgAC_SUBST([CYGPATH_W])
459c95b42baSmrg
4600f595aedSmrg# Define the identity of the package.
4610f595aedSmrgdnl Distinguish between old-style and new-style calls.
4620f595aedSmrgm4_ifval([$2],
4630f595aedSmrg[AC_DIAGNOSE([obsolete],
4640f595aedSmrg             [$0: two- and three-arguments forms are deprecated.])
4650f595aedSmrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4660f595aedSmrg AC_SUBST([PACKAGE], [$1])dnl
4670f595aedSmrg AC_SUBST([VERSION], [$2])],
4680f595aedSmrg[_AM_SET_OPTIONS([$1])dnl
4690f595aedSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4700f595aedSmrgm4_if(
4710f595aedSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4720f595aedSmrg  [ok:ok],,
4730f595aedSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4740f595aedSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4750f595aedSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476c95b42baSmrg
4770f595aedSmrg_AM_IF_OPTION([no-define],,
4780f595aedSmrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4790f595aedSmrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480c95b42baSmrg
4810f595aedSmrg# Some tools Automake needs.
4820f595aedSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4830f595aedSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4840f595aedSmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4850f595aedSmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4860f595aedSmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4870f595aedSmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4880f595aedSmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4890f595aedSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4900f595aedSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4910f595aedSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4920f595aedSmrg# For better backward compatibility.  To be removed once Automake 1.9.x
4930f595aedSmrg# dies out for good.  For more background, see:
4940f595aedSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4950f595aedSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4960f595aedSmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4970f595aedSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
4980f595aedSmrg# system "awk" is bad on some platforms.
4990f595aedSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5000f595aedSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5010f595aedSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5020f595aedSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5030f595aedSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5040f595aedSmrg			     [_AM_PROG_TAR([v7])])])
5050f595aedSmrg_AM_IF_OPTION([no-dependencies],,
5060f595aedSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5070f595aedSmrg		  [_AM_DEPENDENCIES([CC])],
5080f595aedSmrg		  [m4_define([AC_PROG_CC],
5090f595aedSmrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5100f595aedSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5110f595aedSmrg		  [_AM_DEPENDENCIES([CXX])],
5120f595aedSmrg		  [m4_define([AC_PROG_CXX],
5130f595aedSmrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5140f595aedSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5150f595aedSmrg		  [_AM_DEPENDENCIES([OBJC])],
5160f595aedSmrg		  [m4_define([AC_PROG_OBJC],
5170f595aedSmrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5180f595aedSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5190f595aedSmrg		  [_AM_DEPENDENCIES([OBJCXX])],
5200f595aedSmrg		  [m4_define([AC_PROG_OBJCXX],
5210f595aedSmrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5220f595aedSmrg])
5230f595aedSmrg# Variables for tags utilities; see am/tags.am
5240f595aedSmrgif test -z "$CTAGS"; then
5250f595aedSmrg  CTAGS=ctags
5260f595aedSmrgfi
5270f595aedSmrgAC_SUBST([CTAGS])
5280f595aedSmrgif test -z "$ETAGS"; then
5290f595aedSmrg  ETAGS=etags
5300f595aedSmrgfi
5310f595aedSmrgAC_SUBST([ETAGS])
5320f595aedSmrgif test -z "$CSCOPE"; then
5330f595aedSmrg  CSCOPE=cscope
5340f595aedSmrgfi
5350f595aedSmrgAC_SUBST([CSCOPE])
536c95b42baSmrg
5370f595aedSmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5380f595aedSmrgdnl The testsuite driver may need to know about EXEEXT, so add the
5390f595aedSmrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5400f595aedSmrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5410f595aedSmrgAC_CONFIG_COMMANDS_PRE(dnl
5420f595aedSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5430f595aedSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544f40e0d56Smrg
5450f595aedSmrg# POSIX will say in a future version that running "rm -f" with no argument
5460f595aedSmrg# is OK; and we want to be able to make that assumption in our Makefile
5470f595aedSmrg# recipes.  So use an aggressive probe to check that the usage we want is
5480f595aedSmrg# actually supported "in the wild" to an acceptable degree.
5490f595aedSmrg# See automake bug#10828.
5500f595aedSmrg# To make any issue more visible, cause the running configure to be aborted
5510f595aedSmrg# by default if the 'rm' program in use doesn't match our expectations; the
5520f595aedSmrg# user can still override this though.
5530f595aedSmrgif rm -f && rm -fr && rm -rf; then : OK; else
5540f595aedSmrg  cat >&2 <<'END'
5550f595aedSmrgOops!
556c95b42baSmrg
5570f595aedSmrgYour 'rm' program seems unable to run without file operands specified
5580f595aedSmrgon the command line, even when the '-f' option is present.  This is contrary
5590f595aedSmrgto the behaviour of most rm programs out there, and not conforming with
5600f595aedSmrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561c95b42baSmrg
5620f595aedSmrgPlease tell bug-automake@gnu.org about your system, including the value
5630f595aedSmrgof your $PATH and any error possibly output before this message.  This
5640f595aedSmrgcan help us improve future automake versions.
565c95b42baSmrg
5660f595aedSmrgEND
5670f595aedSmrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5680f595aedSmrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5690f595aedSmrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5700f595aedSmrg    echo >&2
5710f595aedSmrg  else
5720f595aedSmrg    cat >&2 <<'END'
5730f595aedSmrgAborting the configuration process, to ensure you take notice of the issue.
574c95b42baSmrg
5750f595aedSmrgYou can download and install GNU coreutils to get an 'rm' implementation
5760f595aedSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57762aeb71dSmrg
5780f595aedSmrgIf you want to complete the configuration process using your problematic
5790f595aedSmrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5800f595aedSmrgto "yes", and re-run configure.
581b8f63ae3Smrg
5820f595aedSmrgEND
5830f595aedSmrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5840f595aedSmrg  fi
585f40e0d56Smrgfi
5860f595aedSmrgdnl The trailing newline in this macro's definition is deliberate, for
5870f595aedSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5880f595aedSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5890f595aedSmrg])
590c95b42baSmrg
5910f595aedSmrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5920f595aedSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5930f595aedSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5940f595aedSmrgm4_define([_AC_COMPILER_EXEEXT],
5950f595aedSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596c95b42baSmrg
5970f595aedSmrg# When config.status generates a header, we must update the stamp-h file.
5980f595aedSmrg# This file resides in the same directory as the config header
5990f595aedSmrg# that is generated.  The stamp files are numbered to have different names.
600c95b42baSmrg
6010f595aedSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6020f595aedSmrg# loop where config.status creates the headers, so we can generate
6030f595aedSmrg# our stamp files there.
6040f595aedSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6050f595aedSmrg[# Compute $1's index in $config_headers.
6060f595aedSmrg_am_arg=$1
6070f595aedSmrg_am_stamp_count=1
6080f595aedSmrgfor _am_header in $config_headers :; do
6090f595aedSmrg  case $_am_header in
6100f595aedSmrg    $_am_arg | $_am_arg:* )
6110f595aedSmrg      break ;;
6120f595aedSmrg    * )
6130f595aedSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6140f595aedSmrg  esac
6150f595aedSmrgdone
6160f595aedSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617b8f63ae3Smrg
6180f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6190f595aedSmrg#
6200f595aedSmrg# This file is free software; the Free Software Foundation
6210f595aedSmrg# gives unlimited permission to copy and/or distribute it,
6220f595aedSmrg# with or without modifications, as long as this notice is preserved.
6230f595aedSmrg
6240f595aedSmrg# AM_PROG_INSTALL_SH
6250f595aedSmrg# ------------------
6260f595aedSmrg# Define $install_sh.
6270f595aedSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6280f595aedSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6290f595aedSmrgif test x"${install_sh+set}" != xset; then
6300f595aedSmrg  case $am_aux_dir in
6310f595aedSmrg  *\ * | *\	*)
6320f595aedSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6330f595aedSmrg  *)
6340f595aedSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6350f595aedSmrg  esac
6360f595aedSmrgfi
6370f595aedSmrgAC_SUBST([install_sh])])
6380f595aedSmrg
6390f595aedSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6400f595aedSmrg#
6410f595aedSmrg# This file is free software; the Free Software Foundation
6420f595aedSmrg# gives unlimited permission to copy and/or distribute it,
6430f595aedSmrg# with or without modifications, as long as this notice is preserved.
6440f595aedSmrg
6450f595aedSmrg# Check whether the underlying file-system supports filenames
6460f595aedSmrg# with a leading dot.  For instance MS-DOS doesn't.
6470f595aedSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6480f595aedSmrg[rm -rf .tst 2>/dev/null
6490f595aedSmrgmkdir .tst 2>/dev/null
6500f595aedSmrgif test -d .tst; then
6510f595aedSmrg  am__leading_dot=.
652c95b42baSmrgelse
6530f595aedSmrg  am__leading_dot=_
654c95b42baSmrgfi
6550f595aedSmrgrmdir .tst 2>/dev/null
6560f595aedSmrgAC_SUBST([am__leading_dot])])
657c95b42baSmrg
6580f595aedSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659c95b42baSmrg
6600f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6610f595aedSmrg#
6620f595aedSmrg# This file is free software; the Free Software Foundation
6630f595aedSmrg# gives unlimited permission to copy and/or distribute it,
6640f595aedSmrg# with or without modifications, as long as this notice is preserved.
665c95b42baSmrg
6660f595aedSmrg# AM_MAKE_INCLUDE()
6670f595aedSmrg# -----------------
6680f595aedSmrg# Check whether make has an 'include' directive that can support all
6690f595aedSmrg# the idioms we need for our automatic dependency tracking code.
6700f595aedSmrgAC_DEFUN([AM_MAKE_INCLUDE],
6710f595aedSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6720f595aedSmrgcat > confinc.mk << 'END'
6730f595aedSmrgam__doit:
6740f595aedSmrg	@echo this is the am__doit target >confinc.out
6750f595aedSmrg.PHONY: am__doit
6760f595aedSmrgEND
6770f595aedSmrgam__include="#"
6780f595aedSmrgam__quote=
6790f595aedSmrg# BSD make does it like this.
6800f595aedSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6810f595aedSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6820f595aedSmrgecho 'include confinc.mk # ignored' > confmf.GNU
6830f595aedSmrg_am_result=no
6840f595aedSmrgfor s in GNU BSD; do
6850f595aedSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6860f595aedSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6870f595aedSmrg      ['0:this is the am__doit target'],
6880f595aedSmrg      [AS_CASE([$s],
6890f595aedSmrg          [BSD], [am__include='.include' am__quote='"'],
6900f595aedSmrg          [am__include='include' am__quote=''])])
6910f595aedSmrg  if test "$am__include" != "#"; then
6920f595aedSmrg    _am_result="yes ($s style)"
6930f595aedSmrg    break
6940f595aedSmrg  fi
6950f595aedSmrgdone
6960f595aedSmrgrm -f confinc.* confmf.*
6970f595aedSmrgAC_MSG_RESULT([${_am_result}])
6980f595aedSmrgAC_SUBST([am__include])])
6990f595aedSmrgAC_SUBST([am__quote])])
700c95b42baSmrg
7010f595aedSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702c95b42baSmrg
7030f595aedSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704c95b42baSmrg#
7050f595aedSmrg# This file is free software; the Free Software Foundation
7060f595aedSmrg# gives unlimited permission to copy and/or distribute it,
7070f595aedSmrg# with or without modifications, as long as this notice is preserved.
708c95b42baSmrg
7090f595aedSmrg# AM_MISSING_PROG(NAME, PROGRAM)
7100f595aedSmrg# ------------------------------
7110f595aedSmrgAC_DEFUN([AM_MISSING_PROG],
7120f595aedSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7130f595aedSmrg$1=${$1-"${am_missing_run}$2"}
7140f595aedSmrgAC_SUBST($1)])
715c95b42baSmrg
7160f595aedSmrg# AM_MISSING_HAS_RUN
7170f595aedSmrg# ------------------
7180f595aedSmrg# Define MISSING if not defined so far and test if it is modern enough.
7190f595aedSmrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7200f595aedSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7210f595aedSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7220f595aedSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7230f595aedSmrgif test x"${MISSING+set}" != xset; then
7240f595aedSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725f40e0d56Smrgfi
7260f595aedSmrg# Use eval to expand $SHELL
7270f595aedSmrgif eval "$MISSING --is-lightweight"; then
7280f595aedSmrg  am_missing_run="$MISSING "
7290f595aedSmrgelse
7300f595aedSmrg  am_missing_run=
7310f595aedSmrg  AC_MSG_WARN(['missing' script is too old or missing])
732c95b42baSmrgfi
7330f595aedSmrg])
734c95b42baSmrg
7350f595aedSmrg# Helper functions for option handling.                     -*- Autoconf -*-
736c95b42baSmrg
7370f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7380f595aedSmrg#
7390f595aedSmrg# This file is free software; the Free Software Foundation
7400f595aedSmrg# gives unlimited permission to copy and/or distribute it,
7410f595aedSmrg# with or without modifications, as long as this notice is preserved.
74262aeb71dSmrg
7430f595aedSmrg# _AM_MANGLE_OPTION(NAME)
7440f595aedSmrg# -----------------------
7450f595aedSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7460f595aedSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747c95b42baSmrg
7480f595aedSmrg# _AM_SET_OPTION(NAME)
7490f595aedSmrg# --------------------
7500f595aedSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7510f595aedSmrgAC_DEFUN([_AM_SET_OPTION],
7520f595aedSmrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753c95b42baSmrg
7540f595aedSmrg# _AM_SET_OPTIONS(OPTIONS)
7550f595aedSmrg# ------------------------
7560f595aedSmrg# OPTIONS is a space-separated list of Automake options.
7570f595aedSmrgAC_DEFUN([_AM_SET_OPTIONS],
7580f595aedSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7590f595aedSmrg
7600f595aedSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7610f595aedSmrg# -------------------------------------------
7620f595aedSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7630f595aedSmrgAC_DEFUN([_AM_IF_OPTION],
7640f595aedSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7650f595aedSmrg
7660f595aedSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767b8f63ae3Smrg#
7680f595aedSmrg# This file is free software; the Free Software Foundation
7690f595aedSmrg# gives unlimited permission to copy and/or distribute it,
7700f595aedSmrg# with or without modifications, as long as this notice is preserved.
771f40e0d56Smrg
7720f595aedSmrg# _AM_PROG_CC_C_O
7730f595aedSmrg# ---------------
7740f595aedSmrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7750f595aedSmrg# to automatically call this.
7760f595aedSmrgAC_DEFUN([_AM_PROG_CC_C_O],
7770f595aedSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7780f595aedSmrgAC_REQUIRE_AUX_FILE([compile])dnl
7790f595aedSmrgAC_LANG_PUSH([C])dnl
7800f595aedSmrgAC_CACHE_CHECK(
7810f595aedSmrg  [whether $CC understands -c and -o together],
7820f595aedSmrg  [am_cv_prog_cc_c_o],
7830f595aedSmrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7840f595aedSmrg  # Make sure it works both with $CC and with simple cc.
7850f595aedSmrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7860f595aedSmrg  # compilers refuse to overwrite an existing .o file with -o,
7870f595aedSmrg  # though they will create one.
7880f595aedSmrg  am_cv_prog_cc_c_o=yes
7890f595aedSmrg  for am_i in 1 2; do
7900f595aedSmrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7910f595aedSmrg         && test -f conftest2.$ac_objext; then
7920f595aedSmrg      : OK
7930f595aedSmrg    else
7940f595aedSmrg      am_cv_prog_cc_c_o=no
7950f595aedSmrg      break
7960f595aedSmrg    fi
7970f595aedSmrg  done
7980f595aedSmrg  rm -f core conftest*
7990f595aedSmrg  unset am_i])
8000f595aedSmrgif test "$am_cv_prog_cc_c_o" != yes; then
8010f595aedSmrg   # Losing compiler, so override with the script.
8020f595aedSmrg   # FIXME: It is wrong to rewrite CC.
8030f595aedSmrg   # But if we don't then we get into trouble of one sort or another.
8040f595aedSmrg   # A longer-term fix would be to have automake use am__CC in this case,
8050f595aedSmrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8060f595aedSmrg   CC="$am_aux_dir/compile $CC"
807c95b42baSmrgfi
8080f595aedSmrgAC_LANG_POP([C])])
809f40e0d56Smrg
8100f595aedSmrg# For backward compatibility.
8110f595aedSmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812f40e0d56Smrg
8130f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814c95b42baSmrg#
8150f595aedSmrg# This file is free software; the Free Software Foundation
8160f595aedSmrg# gives unlimited permission to copy and/or distribute it,
8170f595aedSmrg# with or without modifications, as long as this notice is preserved.
818c95b42baSmrg
8190f595aedSmrg# AM_RUN_LOG(COMMAND)
8200f595aedSmrg# -------------------
8210f595aedSmrg# Run COMMAND, save the exit status in ac_status, and log it.
8220f595aedSmrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8230f595aedSmrgAC_DEFUN([AM_RUN_LOG],
8240f595aedSmrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8250f595aedSmrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8260f595aedSmrg   ac_status=$?
8270f595aedSmrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8280f595aedSmrg   (exit $ac_status); }])
8290f595aedSmrg
8300f595aedSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8310f595aedSmrg
8320f595aedSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833c95b42baSmrg#
8340f595aedSmrg# This file is free software; the Free Software Foundation
8350f595aedSmrg# gives unlimited permission to copy and/or distribute it,
8360f595aedSmrg# with or without modifications, as long as this notice is preserved.
837c95b42baSmrg
8380f595aedSmrg# AM_SANITY_CHECK
8390f595aedSmrg# ---------------
8400f595aedSmrgAC_DEFUN([AM_SANITY_CHECK],
8410f595aedSmrg[AC_MSG_CHECKING([whether build environment is sane])
8420f595aedSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8430f595aedSmrg# name.  Accept space and tab only in the latter.
8440f595aedSmrgam_lf='
8450f595aedSmrg'
8460f595aedSmrgcase `pwd` in
8470f595aedSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8480f595aedSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8490f595aedSmrgesac
8500f595aedSmrgcase $srcdir in
8510f595aedSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8520f595aedSmrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8530f595aedSmrgesac
8540f595aedSmrg
8550f595aedSmrg# Do 'set' in a subshell so we don't clobber the current shell's
8560f595aedSmrg# arguments.  Must try -L first in case configure is actually a
8570f595aedSmrg# symlink; some systems play weird games with the mod time of symlinks
8580f595aedSmrg# (eg FreeBSD returns the mod time of the symlink's containing
8590f595aedSmrg# directory).
8600f595aedSmrgif (
8610f595aedSmrg   am_has_slept=no
8620f595aedSmrg   for am_try in 1 2; do
8630f595aedSmrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8640f595aedSmrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8650f595aedSmrg     if test "$[*]" = "X"; then
8660f595aedSmrg	# -L didn't work.
8670f595aedSmrg	set X `ls -t "$srcdir/configure" conftest.file`
8680f595aedSmrg     fi
8690f595aedSmrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8700f595aedSmrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8710f595aedSmrg
8720f595aedSmrg	# If neither matched, then we have a broken ls.  This can happen
8730f595aedSmrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8740f595aedSmrg	# broken ls alias from the environment.  This has actually
8750f595aedSmrg	# happened.  Such a system could not be considered "sane".
8760f595aedSmrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8770f595aedSmrg  alias in your environment])
8780f595aedSmrg     fi
8790f595aedSmrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8800f595aedSmrg       break
8810f595aedSmrg     fi
8820f595aedSmrg     # Just in case.
8830f595aedSmrg     sleep 1
8840f595aedSmrg     am_has_slept=yes
8850f595aedSmrg   done
8860f595aedSmrg   test "$[2]" = conftest.file
8870f595aedSmrg   )
8880f595aedSmrgthen
8890f595aedSmrg   # Ok.
8900f595aedSmrg   :
891b8f63ae3Smrgelse
8920f595aedSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
8930f595aedSmrgCheck your system clock])
894b8f63ae3Smrgfi
8950f595aedSmrgAC_MSG_RESULT([yes])
8960f595aedSmrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8970f595aedSmrg# generated files are strictly newer.
8980f595aedSmrgam_sleep_pid=
8990f595aedSmrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9000f595aedSmrg  ( sleep 1 ) &
9010f595aedSmrg  am_sleep_pid=$!
9020f595aedSmrgfi
9030f595aedSmrgAC_CONFIG_COMMANDS_PRE(
9040f595aedSmrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9050f595aedSmrg   if test -n "$am_sleep_pid"; then
9060f595aedSmrg     # Hide warnings about reused PIDs.
9070f595aedSmrg     wait $am_sleep_pid 2>/dev/null
9080f595aedSmrg   fi
9090f595aedSmrg   AC_MSG_RESULT([done])])
9100f595aedSmrgrm -f conftest.file
9110f595aedSmrg])
912c95b42baSmrg
9130f595aedSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
91462aeb71dSmrg#
9150f595aedSmrg# This file is free software; the Free Software Foundation
9160f595aedSmrg# gives unlimited permission to copy and/or distribute it,
9170f595aedSmrg# with or without modifications, as long as this notice is preserved.
91862aeb71dSmrg
9190f595aedSmrg# AM_SILENT_RULES([DEFAULT])
9200f595aedSmrg# --------------------------
9210f595aedSmrg# Enable less verbose build rules; with the default set to DEFAULT
9220f595aedSmrg# ("yes" being less verbose, "no" or empty being verbose).
9230f595aedSmrgAC_DEFUN([AM_SILENT_RULES],
9240f595aedSmrg[AC_ARG_ENABLE([silent-rules], [dnl
9250f595aedSmrgAS_HELP_STRING(
9260f595aedSmrg  [--enable-silent-rules],
9270f595aedSmrg  [less verbose build output (undo: "make V=1")])
9280f595aedSmrgAS_HELP_STRING(
9290f595aedSmrg  [--disable-silent-rules],
9300f595aedSmrg  [verbose build output (undo: "make V=0")])dnl
9310f595aedSmrg])
9320f595aedSmrgcase $enable_silent_rules in @%:@ (((
9330f595aedSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
9340f595aedSmrg   no) AM_DEFAULT_VERBOSITY=1;;
9350f595aedSmrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9360f595aedSmrgesac
9370f595aedSmrgdnl
9380f595aedSmrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9390f595aedSmrgdnl do not support nested variable expansions.
9400f595aedSmrgdnl See automake bug#9928 and bug#10237.
9410f595aedSmrgam_make=${MAKE-make}
9420f595aedSmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9430f595aedSmrg   [am_cv_make_support_nested_variables],
9440f595aedSmrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9450f595aedSmrgBAR0=false
9460f595aedSmrgBAR1=true
9470f595aedSmrgV=1
9480f595aedSmrgam__doit:
9490f595aedSmrg	@$(TRUE)
9500f595aedSmrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9510f595aedSmrg  am_cv_make_support_nested_variables=yes
95262aeb71dSmrgelse
9530f595aedSmrg  am_cv_make_support_nested_variables=no
9540f595aedSmrgfi])
9550f595aedSmrgif test $am_cv_make_support_nested_variables = yes; then
9560f595aedSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9570f595aedSmrg  AM_V='$(V)'
9580f595aedSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9590f595aedSmrgelse
9600f595aedSmrg  AM_V=$AM_DEFAULT_VERBOSITY
9610f595aedSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962b8f63ae3Smrgfi
9630f595aedSmrgAC_SUBST([AM_V])dnl
9640f595aedSmrgAM_SUBST_NOTMAKE([AM_V])dnl
9650f595aedSmrgAC_SUBST([AM_DEFAULT_V])dnl
9660f595aedSmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9670f595aedSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9680f595aedSmrgAM_BACKSLASH='\'
9690f595aedSmrgAC_SUBST([AM_BACKSLASH])dnl
9700f595aedSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9710f595aedSmrg])
97262aeb71dSmrg
9730f595aedSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97462aeb71dSmrg#
9750f595aedSmrg# This file is free software; the Free Software Foundation
9760f595aedSmrg# gives unlimited permission to copy and/or distribute it,
9770f595aedSmrg# with or without modifications, as long as this notice is preserved.
97862aeb71dSmrg
9790f595aedSmrg# AM_PROG_INSTALL_STRIP
9800f595aedSmrg# ---------------------
9810f595aedSmrg# One issue with vendor 'install' (even GNU) is that you can't
9820f595aedSmrg# specify the program used to strip binaries.  This is especially
9830f595aedSmrg# annoying in cross-compiling environments, where the build's strip
9840f595aedSmrg# is unlikely to handle the host's binaries.
9850f595aedSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9860f595aedSmrg# always use install-sh in "make install-strip", and initialize
9870f595aedSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
9880f595aedSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9890f595aedSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9900f595aedSmrg# Installed binaries are usually stripped using 'strip' when the user
9910f595aedSmrg# run "make install-strip".  However 'strip' might not be the right
9920f595aedSmrg# tool to use in cross-compilation environments, therefore Automake
9930f595aedSmrg# will honor the 'STRIP' environment variable to overrule this program.
9940f595aedSmrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9950f595aedSmrgif test "$cross_compiling" != no; then
9960f595aedSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
997b8f63ae3Smrgfi
9980f595aedSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9990f595aedSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000c95b42baSmrg
10010f595aedSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002c95b42baSmrg#
10030f595aedSmrg# This file is free software; the Free Software Foundation
10040f595aedSmrg# gives unlimited permission to copy and/or distribute it,
10050f595aedSmrg# with or without modifications, as long as this notice is preserved.
1006c95b42baSmrg
10070f595aedSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10080f595aedSmrg# ---------------------------
10090f595aedSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10100f595aedSmrg# This macro is traced by Automake.
10110f595aedSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012c95b42baSmrg
10130f595aedSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10140f595aedSmrg# --------------------------
10150f595aedSmrg# Public sister of _AM_SUBST_NOTMAKE.
10160f595aedSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017c95b42baSmrg
10180f595aedSmrg# Check how to create a tarball.                            -*- Autoconf -*-
1019c95b42baSmrg
10200f595aedSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021b8f63ae3Smrg#
10220f595aedSmrg# This file is free software; the Free Software Foundation
10230f595aedSmrg# gives unlimited permission to copy and/or distribute it,
10240f595aedSmrg# with or without modifications, as long as this notice is preserved.
10250f595aedSmrg
10260f595aedSmrg# _AM_PROG_TAR(FORMAT)
10270f595aedSmrg# --------------------
10280f595aedSmrg# Check how to create a tarball in format FORMAT.
10290f595aedSmrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030b8f63ae3Smrg#
10310f595aedSmrg# Substitute a variable $(am__tar) that is a command
10320f595aedSmrg# writing to stdout a FORMAT-tarball containing the directory
10330f595aedSmrg# $tardir.
10340f595aedSmrg#     tardir=directory && $(am__tar) > result.tar
1035b8f63ae3Smrg#
10360f595aedSmrg# Substitute a variable $(am__untar) that extract such
10370f595aedSmrg# a tarball read from stdin.
10380f595aedSmrg#     $(am__untar) < result.tar
1039b8f63ae3Smrg#
10400f595aedSmrgAC_DEFUN([_AM_PROG_TAR],
10410f595aedSmrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10420f595aedSmrg# in the wild :-(  We should find a proper way to deprecate it ...
10430f595aedSmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044c95b42baSmrg
10450f595aedSmrg# We'll loop over all known methods to create a tar archive until one works.
10460f595aedSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047c95b42baSmrg
10480f595aedSmrgm4_if([$1], [v7],
10490f595aedSmrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050c95b42baSmrg
10510f595aedSmrg  [m4_case([$1],
10520f595aedSmrg    [ustar],
10530f595aedSmrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10540f595aedSmrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10550f595aedSmrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10560f595aedSmrg      # and bug#13588).
10570f595aedSmrg      am_max_uid=2097151 # 2^21 - 1
10580f595aedSmrg      am_max_gid=$am_max_uid
10590f595aedSmrg      # The $UID and $GID variables are not portable, so we need to resort
10600f595aedSmrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10610f595aedSmrg      # below are definitely unexpected, so allow the users to see them
10620f595aedSmrg      # (that is, avoid stderr redirection).
10630f595aedSmrg      am_uid=`id -u || echo unknown`
10640f595aedSmrg      am_gid=`id -g || echo unknown`
10650f595aedSmrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10660f595aedSmrg      if test $am_uid -le $am_max_uid; then
10670f595aedSmrg         AC_MSG_RESULT([yes])
10680f595aedSmrg      else
10690f595aedSmrg         AC_MSG_RESULT([no])
10700f595aedSmrg         _am_tools=none
10710f595aedSmrg      fi
10720f595aedSmrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10730f595aedSmrg      if test $am_gid -le $am_max_gid; then
10740f595aedSmrg         AC_MSG_RESULT([yes])
10750f595aedSmrg      else
10760f595aedSmrg        AC_MSG_RESULT([no])
10770f595aedSmrg        _am_tools=none
10780f595aedSmrg      fi],
1079d80571a9Smrg
10800f595aedSmrg  [pax],
10810f595aedSmrg    [],
1082d80571a9Smrg
10830f595aedSmrg  [m4_fatal([Unknown tar format])])
108462aeb71dSmrg
10850f595aedSmrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108662aeb71dSmrg
10870f595aedSmrg  # Go ahead even if we have the value already cached.  We do so because we
10880f595aedSmrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10890f595aedSmrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109062aeb71dSmrg
10910f595aedSmrg  for _am_tool in $_am_tools; do
10920f595aedSmrg    case $_am_tool in
10930f595aedSmrg    gnutar)
10940f595aedSmrg      for _am_tar in tar gnutar gtar; do
10950f595aedSmrg        AM_RUN_LOG([$_am_tar --version]) && break
10960f595aedSmrg      done
10970f595aedSmrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10980f595aedSmrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10990f595aedSmrg      am__untar="$_am_tar -xf -"
11000f595aedSmrg      ;;
11010f595aedSmrg    plaintar)
11020f595aedSmrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11030f595aedSmrg      # ustar tarball either.
11040f595aedSmrg      (tar --version) >/dev/null 2>&1 && continue
11050f595aedSmrg      am__tar='tar chf - "$$tardir"'
11060f595aedSmrg      am__tar_='tar chf - "$tardir"'
11070f595aedSmrg      am__untar='tar xf -'
11080f595aedSmrg      ;;
11090f595aedSmrg    pax)
11100f595aedSmrg      am__tar='pax -L -x $1 -w "$$tardir"'
11110f595aedSmrg      am__tar_='pax -L -x $1 -w "$tardir"'
11120f595aedSmrg      am__untar='pax -r'
11130f595aedSmrg      ;;
11140f595aedSmrg    cpio)
11150f595aedSmrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11160f595aedSmrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11170f595aedSmrg      am__untar='cpio -i -H $1 -d'
11180f595aedSmrg      ;;
11190f595aedSmrg    none)
11200f595aedSmrg      am__tar=false
11210f595aedSmrg      am__tar_=false
11220f595aedSmrg      am__untar=false
11230f595aedSmrg      ;;
11240f595aedSmrg    esac
112562aeb71dSmrg
11260f595aedSmrg    # If the value was cached, stop now.  We just wanted to have am__tar
11270f595aedSmrg    # and am__untar set.
11280f595aedSmrg    test -n "${am_cv_prog_tar_$1}" && break
1129b8f63ae3Smrg
11300f595aedSmrg    # tar/untar a dummy directory, and stop if the command works.
11310f595aedSmrg    rm -rf conftest.dir
11320f595aedSmrg    mkdir conftest.dir
11330f595aedSmrg    echo GrepMe > conftest.dir/file
11340f595aedSmrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11350f595aedSmrg    rm -rf conftest.dir
11360f595aedSmrg    if test -s conftest.tar; then
11370f595aedSmrg      AM_RUN_LOG([$am__untar <conftest.tar])
11380f595aedSmrg      AM_RUN_LOG([cat conftest.dir/file])
11390f595aedSmrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11400f595aedSmrg    fi
11410f595aedSmrg  done
11420f595aedSmrg  rm -rf conftest.dir
1143d80571a9Smrg
11440f595aedSmrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11450f595aedSmrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146d80571a9Smrg
11470f595aedSmrgAC_SUBST([am__tar])
11480f595aedSmrgAC_SUBST([am__untar])
11490f595aedSmrg]) # _AM_PROG_TAR
1150b8f63ae3Smrg
11510f595aedSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11520f595aedSmrgdnl serial 11 (pkg-config-0.29)
11530f595aedSmrgdnl
11540f595aedSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11550f595aedSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11560f595aedSmrgdnl
11570f595aedSmrgdnl This program is free software; you can redistribute it and/or modify
11580f595aedSmrgdnl it under the terms of the GNU General Public License as published by
11590f595aedSmrgdnl the Free Software Foundation; either version 2 of the License, or
11600f595aedSmrgdnl (at your option) any later version.
11610f595aedSmrgdnl
11620f595aedSmrgdnl This program is distributed in the hope that it will be useful, but
11630f595aedSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11640f595aedSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11650f595aedSmrgdnl General Public License for more details.
11660f595aedSmrgdnl
11670f595aedSmrgdnl You should have received a copy of the GNU General Public License
11680f595aedSmrgdnl along with this program; if not, write to the Free Software
11690f595aedSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11700f595aedSmrgdnl 02111-1307, USA.
11710f595aedSmrgdnl
11720f595aedSmrgdnl As a special exception to the GNU General Public License, if you
11730f595aedSmrgdnl distribute this file as part of a program that contains a
11740f595aedSmrgdnl configuration script generated by Autoconf, you may include it under
11750f595aedSmrgdnl the same distribution terms that you use for the rest of that
11760f595aedSmrgdnl program.
1177b8f63ae3Smrg
11780f595aedSmrgdnl PKG_PREREQ(MIN-VERSION)
11790f595aedSmrgdnl -----------------------
11800f595aedSmrgdnl Since: 0.29
11810f595aedSmrgdnl
11820f595aedSmrgdnl Verify that the version of the pkg-config macros are at least
11830f595aedSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11840f595aedSmrgdnl installed version of pkg-config, this checks the developer's version
11850f595aedSmrgdnl of pkg.m4 when generating configure.
11860f595aedSmrgdnl
11870f595aedSmrgdnl To ensure that this macro is defined, also add:
11880f595aedSmrgdnl m4_ifndef([PKG_PREREQ],
11890f595aedSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11900f595aedSmrgdnl
11910f595aedSmrgdnl See the "Since" comment for each macro you use to see what version
11920f595aedSmrgdnl of the macros you require.
11930f595aedSmrgm4_defun([PKG_PREREQ],
11940f595aedSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
11950f595aedSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11960f595aedSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11970f595aedSmrg])dnl PKG_PREREQ
1198b8f63ae3Smrg
11990f595aedSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12000f595aedSmrgdnl ----------------------------------
12010f595aedSmrgdnl Since: 0.16
12020f595aedSmrgdnl
12030f595aedSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12040f595aedSmrgdnl first found in the path. Checks that the version of pkg-config found
12050f595aedSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12060f595aedSmrgdnl used since that's the first version where most current features of
12070f595aedSmrgdnl pkg-config existed.
12080f595aedSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12090f595aedSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12100f595aedSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12110f595aedSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12120f595aedSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12130f595aedSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12140f595aedSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215b8f63ae3Smrg
12160f595aedSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12170f595aedSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218d80571a9Smrgfi
12190f595aedSmrgif test -n "$PKG_CONFIG"; then
12200f595aedSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
12210f595aedSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12220f595aedSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12230f595aedSmrg		AC_MSG_RESULT([yes])
12240f595aedSmrg	else
12250f595aedSmrg		AC_MSG_RESULT([no])
12260f595aedSmrg		PKG_CONFIG=""
12270f595aedSmrg	fi
12280f595aedSmrgfi[]dnl
12290f595aedSmrg])dnl PKG_PROG_PKG_CONFIG
1230d80571a9Smrg
12310f595aedSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12320f595aedSmrgdnl -------------------------------------------------------------------
12330f595aedSmrgdnl Since: 0.18
12340f595aedSmrgdnl
12350f595aedSmrgdnl Check to see whether a particular set of modules exists. Similar to
12360f595aedSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12370f595aedSmrgdnl
12380f595aedSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12390f595aedSmrgdnl only at the first occurence in configure.ac, so if the first place
12400f595aedSmrgdnl it's called might be skipped (such as if it is within an "if", you
12410f595aedSmrgdnl have to call PKG_CHECK_EXISTS manually
12420f595aedSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12430f595aedSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12440f595aedSmrgif test -n "$PKG_CONFIG" && \
12450f595aedSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12460f595aedSmrg  m4_default([$2], [:])
12470f595aedSmrgm4_ifvaln([$3], [else
12480f595aedSmrg  $3])dnl
12490f595aedSmrgfi])
12500f595aedSmrg
12510f595aedSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12520f595aedSmrgdnl ---------------------------------------------
12530f595aedSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12540f595aedSmrgdnl pkg_failed based on the result.
12550f595aedSmrgm4_define([_PKG_CONFIG],
12560f595aedSmrg[if test -n "$$1"; then
12570f595aedSmrg    pkg_cv_[]$1="$$1"
12580f595aedSmrg elif test -n "$PKG_CONFIG"; then
12590f595aedSmrg    PKG_CHECK_EXISTS([$3],
12600f595aedSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12610f595aedSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
12620f595aedSmrg		     [pkg_failed=yes])
12630f595aedSmrg else
12640f595aedSmrg    pkg_failed=untried
12650f595aedSmrgfi[]dnl
12660f595aedSmrg])dnl _PKG_CONFIG
12670f595aedSmrg
12680f595aedSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12690f595aedSmrgdnl ---------------------------
12700f595aedSmrgdnl Internal check to see if pkg-config supports short errors.
12710f595aedSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12720f595aedSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12730f595aedSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12740f595aedSmrg        _pkg_short_errors_supported=yes
1275b8f63ae3Smrgelse
12760f595aedSmrg        _pkg_short_errors_supported=no
12770f595aedSmrgfi[]dnl
12780f595aedSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279d80571a9Smrg
1280d80571a9Smrg
12810f595aedSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12820f595aedSmrgdnl   [ACTION-IF-NOT-FOUND])
12830f595aedSmrgdnl --------------------------------------------------------------
12840f595aedSmrgdnl Since: 0.4.0
12850f595aedSmrgdnl
12860f595aedSmrgdnl Note that if there is a possibility the first call to
12870f595aedSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12880f595aedSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12890f595aedSmrgAC_DEFUN([PKG_CHECK_MODULES],
12900f595aedSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12910f595aedSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12920f595aedSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293b8f63ae3Smrg
12940f595aedSmrgpkg_failed=no
12950f595aedSmrgAC_MSG_CHECKING([for $1])
1296b8f63ae3Smrg
12970f595aedSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12980f595aedSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299b8f63ae3Smrg
13000f595aedSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13010f595aedSmrgand $1[]_LIBS to avoid the need to call pkg-config.
13020f595aedSmrgSee the pkg-config man page for more details.])
1303b8f63ae3Smrg
13040f595aedSmrgif test $pkg_failed = yes; then
13050f595aedSmrg   	AC_MSG_RESULT([no])
13060f595aedSmrg        _PKG_SHORT_ERRORS_SUPPORTED
13070f595aedSmrg        if test $_pkg_short_errors_supported = yes; then
13080f595aedSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13090f595aedSmrg        else 
13100f595aedSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13110f595aedSmrg        fi
13120f595aedSmrg	# Put the nasty error message in config.log where it belongs
13130f595aedSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314b8f63ae3Smrg
13150f595aedSmrg	m4_default([$4], [AC_MSG_ERROR(
13160f595aedSmrg[Package requirements ($2) were not met:
1317b8f63ae3Smrg
13180f595aedSmrg$$1_PKG_ERRORS
13190f595aedSmrg
13200f595aedSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13210f595aedSmrginstalled software in a non-standard prefix.
13220f595aedSmrg
13230f595aedSmrg_PKG_TEXT])[]dnl
13240f595aedSmrg        ])
13250f595aedSmrgelif test $pkg_failed = untried; then
13260f595aedSmrg     	AC_MSG_RESULT([no])
13270f595aedSmrg	m4_default([$4], [AC_MSG_FAILURE(
13280f595aedSmrg[The pkg-config script could not be found or is too old.  Make sure it
13290f595aedSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
13300f595aedSmrgpath to pkg-config.
13310f595aedSmrg
13320f595aedSmrg_PKG_TEXT
13330f595aedSmrg
13340f595aedSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13350f595aedSmrg        ])
1336d80571a9Smrgelse
13370f595aedSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13380f595aedSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13390f595aedSmrg        AC_MSG_RESULT([yes])
13400f595aedSmrg	$3
13410f595aedSmrgfi[]dnl
13420f595aedSmrg])dnl PKG_CHECK_MODULES
134362aeb71dSmrg
1344d80571a9Smrg
13450f595aedSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13460f595aedSmrgdnl   [ACTION-IF-NOT-FOUND])
13470f595aedSmrgdnl ---------------------------------------------------------------------
13480f595aedSmrgdnl Since: 0.29
13490f595aedSmrgdnl
13500f595aedSmrgdnl Checks for existence of MODULES and gathers its build flags with
13510f595aedSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13520f595aedSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13530f595aedSmrgdnl
13540f595aedSmrgdnl Note that if there is a possibility the first call to
13550f595aedSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13560f595aedSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13570f595aedSmrgdnl configure.ac.
13580f595aedSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13590f595aedSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13600f595aedSmrg_save_PKG_CONFIG=$PKG_CONFIG
13610f595aedSmrgPKG_CONFIG="$PKG_CONFIG --static"
13620f595aedSmrgPKG_CHECK_MODULES($@)
13630f595aedSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13640f595aedSmrg])dnl PKG_CHECK_MODULES_STATIC
1365d80571a9Smrg
1366b8f63ae3Smrg
13670f595aedSmrgdnl PKG_INSTALLDIR([DIRECTORY])
13680f595aedSmrgdnl -------------------------
13690f595aedSmrgdnl Since: 0.27
13700f595aedSmrgdnl
13710f595aedSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
13720f595aedSmrgdnl should install pkg-config .pc files. By default the directory is
13730f595aedSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
13740f595aedSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13750f595aedSmrgdnl parameter.
13760f595aedSmrgAC_DEFUN([PKG_INSTALLDIR],
13770f595aedSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13780f595aedSmrgm4_pushdef([pkg_description],
13790f595aedSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13800f595aedSmrgAC_ARG_WITH([pkgconfigdir],
13810f595aedSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13820f595aedSmrg    [with_pkgconfigdir=]pkg_default)
13830f595aedSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13840f595aedSmrgm4_popdef([pkg_default])
13850f595aedSmrgm4_popdef([pkg_description])
13860f595aedSmrg])dnl PKG_INSTALLDIR
13870f595aedSmrg
13880f595aedSmrg
13890f595aedSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13900f595aedSmrgdnl --------------------------------
13910f595aedSmrgdnl Since: 0.27
13920f595aedSmrgdnl
13930f595aedSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13940f595aedSmrgdnl module should install arch-independent pkg-config .pc files. By
13950f595aedSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
13960f595aedSmrgdnl changed by passing DIRECTORY. The user can override through the
13970f595aedSmrgdnl --with-noarch-pkgconfigdir parameter.
13980f595aedSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13990f595aedSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14000f595aedSmrgm4_pushdef([pkg_description],
14010f595aedSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14020f595aedSmrgAC_ARG_WITH([noarch-pkgconfigdir],
14030f595aedSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14040f595aedSmrg    [with_noarch_pkgconfigdir=]pkg_default)
14050f595aedSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14060f595aedSmrgm4_popdef([pkg_default])
14070f595aedSmrgm4_popdef([pkg_description])
14080f595aedSmrg])dnl PKG_NOARCH_INSTALLDIR
14090f595aedSmrg
1410b8f63ae3Smrg
14110f595aedSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14120f595aedSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14130f595aedSmrgdnl -------------------------------------------
14140f595aedSmrgdnl Since: 0.28
14150f595aedSmrgdnl
14160f595aedSmrgdnl Retrieves the value of the pkg-config variable for the given module.
14170f595aedSmrgAC_DEFUN([PKG_CHECK_VAR],
14180f595aedSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14190f595aedSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420d80571a9Smrg
14210f595aedSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14220f595aedSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423b8f63ae3Smrg
14240f595aedSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14250f595aedSmrg])dnl PKG_CHECK_VAR
1426b8f63ae3Smrg
14270f595aedSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14280f595aedSmrgdnl
14290f595aedSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
14300f595aedSmrgdnl
14310f595aedSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14320f595aedSmrgdnl copy of this software and associated documentation files (the "Software"),
14330f595aedSmrgdnl to deal in the Software without restriction, including without limitation
14340f595aedSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14350f595aedSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
14360f595aedSmrgdnl Software is furnished to do so, subject to the following conditions:
14370f595aedSmrgdnl
14380f595aedSmrgdnl The above copyright notice and this permission notice (including the next
14390f595aedSmrgdnl paragraph) shall be included in all copies or substantial portions of the
14400f595aedSmrgdnl Software.
14410f595aedSmrgdnl
14420f595aedSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14430f595aedSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14440f595aedSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14450f595aedSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14460f595aedSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14470f595aedSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14480f595aedSmrgdnl DEALINGS IN THE SOFTWARE.
1449b8f63ae3Smrg
14500f595aedSmrg# XORG_MACROS_VERSION(required-version)
14510f595aedSmrg# -------------------------------------
1452b8f63ae3Smrg# Minimum version: 1.1.0
1453d80571a9Smrg#
14540f595aedSmrg# If you're using a macro added in Version 1.1 or newer, include this in
14550f595aedSmrg# your configure.ac with the minimum required version, such as:
14560f595aedSmrg# XORG_MACROS_VERSION(1.1)
1457d80571a9Smrg#
14580f595aedSmrg# To ensure that this macro is defined, also add:
14590f595aedSmrg# m4_ifndef([XORG_MACROS_VERSION],
14600f595aedSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461d80571a9Smrg#
14620f595aedSmrg#
14630f595aedSmrg# See the "minimum version" comment for each macro you use to see what
14640f595aedSmrg# version you require.
14650f595aedSmrgm4_defun([XORG_MACROS_VERSION],[
14660f595aedSmrgm4_define([vers_have], [1.19.3])
14670f595aedSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14680f595aedSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14690f595aedSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14700f595aedSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14710f595aedSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14720f595aedSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14730f595aedSmrgm4_undefine([vers_have])
14740f595aedSmrgm4_undefine([maj_have])
14750f595aedSmrgm4_undefine([maj_needed])
14760f595aedSmrg]) # XORG_MACROS_VERSION
1477d80571a9Smrg
14780f595aedSmrg# XORG_PROG_RAWCPP()
14790f595aedSmrg# ------------------
14800f595aedSmrg# Minimum version: 1.0.0
14810f595aedSmrg#
14820f595aedSmrg# Find cpp program and necessary flags for use in pre-processing text files
14830f595aedSmrg# such as man pages and config files
14840f595aedSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14850f595aedSmrgAC_REQUIRE([AC_PROG_CPP])
14860f595aedSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14870f595aedSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488b8f63ae3Smrg
14890f595aedSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14900f595aedSmrg# which is not the best choice for supporting other OS'es, but covers most
14910f595aedSmrg# of the ones we need for now.
14920f595aedSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14930f595aedSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14940f595aedSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14950f595aedSmrg	AC_MSG_RESULT([no])
14960f595aedSmrgelse
14970f595aedSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14980f595aedSmrg		RAWCPPFLAGS=-undef
14990f595aedSmrg		AC_MSG_RESULT([yes])
15000f595aedSmrg	# under Cygwin unix is still defined even with -undef
15010f595aedSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15020f595aedSmrg		RAWCPPFLAGS="-undef -ansi"
15030f595aedSmrg		AC_MSG_RESULT([yes, with -ansi])
15040f595aedSmrg	else
15050f595aedSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15060f595aedSmrg	fi
1507b8f63ae3Smrgfi
15080f595aedSmrgrm -f conftest.$ac_ext
1509b8f63ae3Smrg
15100f595aedSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15110f595aedSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15120f595aedSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15130f595aedSmrg	AC_MSG_RESULT([no])
15140f595aedSmrgelse
15150f595aedSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15160f595aedSmrg		TRADITIONALCPPFLAGS="-traditional"
15170f595aedSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15180f595aedSmrg		AC_MSG_RESULT([yes])
15190f595aedSmrg	else
15200f595aedSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15210f595aedSmrg	fi
15220f595aedSmrgfi
15230f595aedSmrgrm -f conftest.$ac_ext
15240f595aedSmrgAC_SUBST(RAWCPPFLAGS)
15250f595aedSmrgAC_SUBST(TRADITIONALCPPFLAGS)
15260f595aedSmrg]) # XORG_PROG_RAWCPP
1527b8f63ae3Smrg
15280f595aedSmrg# XORG_MANPAGE_SECTIONS()
15290f595aedSmrg# -----------------------
15300f595aedSmrg# Minimum version: 1.0.0
1531d80571a9Smrg#
15320f595aedSmrg# Determine which sections man pages go in for the different man page types
15330f595aedSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15340f595aedSmrg# Not sure if there's any better way than just hardcoding by OS name.
15350f595aedSmrg# Override default settings by setting environment variables
15360f595aedSmrg# Added MAN_SUBSTS in version 1.8
15370f595aedSmrg# Added AC_PROG_SED in version 1.8
1538d80571a9Smrg
15390f595aedSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15400f595aedSmrgAC_REQUIRE([AC_CANONICAL_HOST])
15410f595aedSmrgAC_REQUIRE([AC_PROG_SED])
1542d80571a9Smrg
15430f595aedSmrgcase $host_os in
15440f595aedSmrg    solaris*)
15450f595aedSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15460f595aedSmrg        # check for a man page file found in later versions that use
15470f595aedSmrg        # traditional section numbers instead
15480f595aedSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15490f595aedSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15500f595aedSmrg        ;;
15510f595aedSmrg    *) SYSV_MAN_SECTIONS=false ;;
15520f595aedSmrgesac
1553b8f63ae3Smrg
15540f595aedSmrgif test x$APP_MAN_SUFFIX = x    ; then
15550f595aedSmrg    APP_MAN_SUFFIX=1
15560f595aedSmrgfi
15570f595aedSmrgif test x$APP_MAN_DIR = x    ; then
15580f595aedSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15590f595aedSmrgfi
1560b8f63ae3Smrg
15610f595aedSmrgif test x$LIB_MAN_SUFFIX = x    ; then
15620f595aedSmrg    LIB_MAN_SUFFIX=3
15630f595aedSmrgfi
15640f595aedSmrgif test x$LIB_MAN_DIR = x    ; then
15650f595aedSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15660f595aedSmrgfi
1567b8f63ae3Smrg
15680f595aedSmrgif test x$FILE_MAN_SUFFIX = x    ; then
15690f595aedSmrg    case $SYSV_MAN_SECTIONS in
15700f595aedSmrg	true)				FILE_MAN_SUFFIX=4  ;;
15710f595aedSmrg	*)				FILE_MAN_SUFFIX=5  ;;
15720f595aedSmrg    esac
15730f595aedSmrgfi
15740f595aedSmrgif test x$FILE_MAN_DIR = x    ; then
15750f595aedSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576b8f63ae3Smrgfi
1577b8f63ae3Smrg
15780f595aedSmrgif test x$MISC_MAN_SUFFIX = x    ; then
15790f595aedSmrg    case $SYSV_MAN_SECTIONS in
15800f595aedSmrg	true)				MISC_MAN_SUFFIX=5  ;;
15810f595aedSmrg	*)				MISC_MAN_SUFFIX=7  ;;
15820f595aedSmrg    esac
15830f595aedSmrgfi
15840f595aedSmrgif test x$MISC_MAN_DIR = x    ; then
15850f595aedSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586b8f63ae3Smrgfi
1587b8f63ae3Smrg
15880f595aedSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15890f595aedSmrg    case $SYSV_MAN_SECTIONS in
15900f595aedSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15910f595aedSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15920f595aedSmrg    esac
15930f595aedSmrgfi
15940f595aedSmrgif test x$DRIVER_MAN_DIR = x    ; then
15950f595aedSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15960f595aedSmrgfi
1597b8f63ae3Smrg
15980f595aedSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15990f595aedSmrg    case $SYSV_MAN_SECTIONS in
16000f595aedSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16010f595aedSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16020f595aedSmrg    esac
16030f595aedSmrgfi
16040f595aedSmrgif test x$ADMIN_MAN_DIR = x    ; then
16050f595aedSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16060f595aedSmrgfi
1607b8f63ae3Smrg
1608b8f63ae3Smrg
16090f595aedSmrgAC_SUBST([APP_MAN_SUFFIX])
16100f595aedSmrgAC_SUBST([LIB_MAN_SUFFIX])
16110f595aedSmrgAC_SUBST([FILE_MAN_SUFFIX])
16120f595aedSmrgAC_SUBST([MISC_MAN_SUFFIX])
16130f595aedSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16140f595aedSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16150f595aedSmrgAC_SUBST([APP_MAN_DIR])
16160f595aedSmrgAC_SUBST([LIB_MAN_DIR])
16170f595aedSmrgAC_SUBST([FILE_MAN_DIR])
16180f595aedSmrgAC_SUBST([MISC_MAN_DIR])
16190f595aedSmrgAC_SUBST([DRIVER_MAN_DIR])
16200f595aedSmrgAC_SUBST([ADMIN_MAN_DIR])
1621b8f63ae3Smrg
16220f595aedSmrgXORG_MAN_PAGE="X Version 11"
16230f595aedSmrgAC_SUBST([XORG_MAN_PAGE])
16240f595aedSmrgMAN_SUBSTS="\
16250f595aedSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16260f595aedSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16270f595aedSmrg	-e 's|__xservername__|Xorg|g' \
16280f595aedSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
16290f595aedSmrg	-e 's|__projectroot__|\$(prefix)|g' \
16300f595aedSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16310f595aedSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16320f595aedSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16330f595aedSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16340f595aedSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16350f595aedSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16360f595aedSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16370f595aedSmrgAC_SUBST([MAN_SUBSTS])
1638b8f63ae3Smrg
16390f595aedSmrg]) # XORG_MANPAGE_SECTIONS
1640b8f63ae3Smrg
16410f595aedSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16420f595aedSmrg# ------------------------
16430f595aedSmrg# Minimum version: 1.7.0
164462aeb71dSmrg#
16450f595aedSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16460f595aedSmrg# provided by xorg-sgml-doctools, if installed.
16470f595aedSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16480f595aedSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16490f595aedSmrgXORG_SGML_PATH=
16500f595aedSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16510f595aedSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16520f595aedSmrg    [m4_ifval([$1],[:],
16530f595aedSmrg        [if test x"$cross_compiling" != x"yes" ; then
16540f595aedSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16550f595aedSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16560f595aedSmrg         fi])
16570f595aedSmrg    ])
16580f595aedSmrg
16590f595aedSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16600f595aedSmrg# the path and the name of the doc stylesheet
16610f595aedSmrgif test "x$XORG_SGML_PATH" != "x" ; then
16620f595aedSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16630f595aedSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16640f595aedSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16650f595aedSmrgelse
16660f595aedSmrg   AC_MSG_RESULT([no])
16670f595aedSmrgfi
16680f595aedSmrg
16690f595aedSmrgAC_SUBST(XORG_SGML_PATH)
16700f595aedSmrgAC_SUBST(STYLESHEET_SRCDIR)
16710f595aedSmrgAC_SUBST(XSL_STYLESHEET)
16720f595aedSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16730f595aedSmrg]) # XORG_CHECK_SGML_DOCTOOLS
16740f595aedSmrg
16750f595aedSmrg# XORG_CHECK_LINUXDOC
16760f595aedSmrg# -------------------
16770f595aedSmrg# Minimum version: 1.0.0
167862aeb71dSmrg#
16790f595aedSmrg# Defines the variable MAKE_TEXT if the necessary tools and
16800f595aedSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16810f595aedSmrg# Whether or not the necessary tools and files are found can be checked
16820f595aedSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16830f595aedSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16840f595aedSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16850f595aedSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686b8f63ae3Smrg
16870f595aedSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688b8f63ae3Smrg
16890f595aedSmrgAC_MSG_CHECKING([whether to build documentation])
16900f595aedSmrg
16910f595aedSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16920f595aedSmrg   BUILDDOC=yes
1693b8f63ae3Smrgelse
16940f595aedSmrg   BUILDDOC=no
1695b8f63ae3Smrgfi
1696b8f63ae3Smrg
16970f595aedSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698b8f63ae3Smrg
16990f595aedSmrgAC_MSG_RESULT([$BUILDDOC])
1700b8f63ae3Smrg
17010f595aedSmrgAC_MSG_CHECKING([whether to build pdf documentation])
17020f595aedSmrg
17030f595aedSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17040f595aedSmrg   BUILDPDFDOC=yes
17050f595aedSmrgelse
17060f595aedSmrg   BUILDPDFDOC=no
17070f595aedSmrgfi
17080f595aedSmrg
17090f595aedSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17100f595aedSmrg
17110f595aedSmrgAC_MSG_RESULT([$BUILDPDFDOC])
17120f595aedSmrg
17130f595aedSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17140f595aedSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17150f595aedSmrgMAKE_PDF="$PS2PDF"
17160f595aedSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17170f595aedSmrg
17180f595aedSmrgAC_SUBST(MAKE_TEXT)
17190f595aedSmrgAC_SUBST(MAKE_PS)
17200f595aedSmrgAC_SUBST(MAKE_PDF)
17210f595aedSmrgAC_SUBST(MAKE_HTML)
17220f595aedSmrg]) # XORG_CHECK_LINUXDOC
17230f595aedSmrg
17240f595aedSmrg# XORG_CHECK_DOCBOOK
17250f595aedSmrg# -------------------
17260f595aedSmrg# Minimum version: 1.0.0
17270f595aedSmrg#
17280f595aedSmrg# Checks for the ability to build output formats from SGML DocBook source.
17290f595aedSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17300f595aedSmrg# indicates whether the necessary tools and files are found and, if set,
17310f595aedSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17320f595aedSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17330f595aedSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17340f595aedSmrg
17350f595aedSmrgBUILDTXTDOC=no
17360f595aedSmrgBUILDPDFDOC=no
17370f595aedSmrgBUILDPSDOC=no
17380f595aedSmrgBUILDHTMLDOC=no
17390f595aedSmrg
17400f595aedSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17410f595aedSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17420f595aedSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17430f595aedSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744b8f63ae3Smrg
17450f595aedSmrgAC_MSG_CHECKING([whether to build text documentation])
17460f595aedSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17470f595aedSmrg   test x$BUILD_TXTDOC != xno; then
17480f595aedSmrg	BUILDTXTDOC=yes
17490f595aedSmrgfi
17500f595aedSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17510f595aedSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752b8f63ae3Smrg
17530f595aedSmrgAC_MSG_CHECKING([whether to build PDF documentation])
17540f595aedSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17550f595aedSmrg   test x$BUILD_PDFDOC != xno; then
17560f595aedSmrg	BUILDPDFDOC=yes
17570f595aedSmrgfi
17580f595aedSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17590f595aedSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760b8f63ae3Smrg
17610f595aedSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17620f595aedSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17630f595aedSmrg   test x$BUILD_PSDOC != xno; then
17640f595aedSmrg	BUILDPSDOC=yes
1765b8f63ae3Smrgfi
17660f595aedSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17670f595aedSmrgAC_MSG_RESULT([$BUILDPSDOC])
176862aeb71dSmrg
17690f595aedSmrgAC_MSG_CHECKING([whether to build HTML documentation])
17700f595aedSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17710f595aedSmrg   test x$BUILD_HTMLDOC != xno; then
17720f595aedSmrg	BUILDHTMLDOC=yes
17730f595aedSmrgfi
17740f595aedSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17750f595aedSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177662aeb71dSmrg
17770f595aedSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17780f595aedSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17790f595aedSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17800f595aedSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17810f595aedSmrg
17820f595aedSmrgAC_SUBST(MAKE_TEXT)
17830f595aedSmrgAC_SUBST(MAKE_PS)
17840f595aedSmrgAC_SUBST(MAKE_PDF)
17850f595aedSmrgAC_SUBST(MAKE_HTML)
17860f595aedSmrg]) # XORG_CHECK_DOCBOOK
17870f595aedSmrg
17880f595aedSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17890f595aedSmrg# ----------------
17900f595aedSmrg# Minimum version: 1.5.0
17910f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179262aeb71dSmrg#
17930f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
17940f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
17950f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
17960f595aedSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
17970f595aedSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17980f595aedSmrg# --with-xmlto assumes 'auto'.
179962aeb71dSmrg#
18000f595aedSmrg# Interface to module:
18010f595aedSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18020f595aedSmrg# XMLTO:	returns the path of the xmlto program found
18030f595aedSmrg#		returns the path set by the user in the environment
18040f595aedSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18050f595aedSmrg#		'no' user instructs the module not to use xmlto
180662aeb71dSmrg#
18070f595aedSmrg# Added in version 1.10.0
18080f595aedSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18090f595aedSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181062aeb71dSmrg#
18110f595aedSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181262aeb71dSmrg#
18130f595aedSmrgAC_DEFUN([XORG_WITH_XMLTO],[
18140f595aedSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18150f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
18160f595aedSmrgAC_ARG_WITH(xmlto,
18170f595aedSmrg	AS_HELP_STRING([--with-xmlto],
18180f595aedSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18190f595aedSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18200f595aedSmrgm4_undefine([_defopt])
182162aeb71dSmrg
18220f595aedSmrgif test "x$use_xmlto" = x"auto"; then
18230f595aedSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18240f595aedSmrg   if test "x$XMLTO" = "x"; then
18250f595aedSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18260f595aedSmrg	have_xmlto=no
18270f595aedSmrg   else
18280f595aedSmrg        have_xmlto=yes
18290f595aedSmrg   fi
18300f595aedSmrgelif test "x$use_xmlto" = x"yes" ; then
18310f595aedSmrg   AC_PATH_PROG([XMLTO], [xmlto])
18320f595aedSmrg   if test "x$XMLTO" = "x"; then
18330f595aedSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18340f595aedSmrg   fi
18350f595aedSmrg   have_xmlto=yes
18360f595aedSmrgelif test "x$use_xmlto" = x"no" ; then
18370f595aedSmrg   if test "x$XMLTO" != "x"; then
18380f595aedSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18390f595aedSmrg   fi
18400f595aedSmrg   have_xmlto=no
18410f595aedSmrgelse
18420f595aedSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18430f595aedSmrgfi
184462aeb71dSmrg
18450f595aedSmrg# Test for a minimum version of xmlto, if provided.
18460f595aedSmrgm4_ifval([$1],
18470f595aedSmrg[if test "$have_xmlto" = yes; then
18480f595aedSmrg    # scrape the xmlto version
18490f595aedSmrg    AC_MSG_CHECKING([the xmlto version])
18500f595aedSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18510f595aedSmrg    AC_MSG_RESULT([$xmlto_version])
18520f595aedSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18530f595aedSmrg        [if test "x$use_xmlto" = xauto; then
18540f595aedSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18550f595aedSmrg            have_xmlto=no
18560f595aedSmrg        else
18570f595aedSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18580f595aedSmrg        fi])
18590f595aedSmrgfi])
186062aeb71dSmrg
18610f595aedSmrg# Test for the ability of xmlto to generate a text target
18620f595aedSmrg#
18630f595aedSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18640f595aedSmrg# following test for empty XML docbook files.
18650f595aedSmrg# For compatibility reasons use the following empty XML docbook file and if
18660f595aedSmrg# it fails try it again with a non-empty XML file.
18670f595aedSmrghave_xmlto_text=no
18680f595aedSmrgcat > conftest.xml << "EOF"
18690f595aedSmrgEOF
18700f595aedSmrgAS_IF([test "$have_xmlto" = yes],
18710f595aedSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18720f595aedSmrg             [have_xmlto_text=yes],
18730f595aedSmrg             [# Try it again with a non-empty XML file.
18740f595aedSmrg              cat > conftest.xml << "EOF"
18750f595aedSmrg<x></x>
18760f595aedSmrgEOF
18770f595aedSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18780f595aedSmrg                    [have_xmlto_text=yes],
18790f595aedSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18800f595aedSmrgrm -f conftest.xml
18810f595aedSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18820f595aedSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18830f595aedSmrg]) # XORG_WITH_XMLTO
188462aeb71dSmrg
18850f595aedSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18860f595aedSmrg# --------------------------------------------
18870f595aedSmrg# Minimum version: 1.12.0
18880f595aedSmrg# Minimum version for optional DEFAULT argument: 1.12.0
18890f595aedSmrg#
18900f595aedSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18910f595aedSmrg# XML-based language used for the transformation of XML documents.
18920f595aedSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18930f595aedSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18940f595aedSmrg# The XSLT processor is often used as a standalone tool for transformations.
18950f595aedSmrg# It should not be assumed that this tool is used only to work with documnetation.
18960f595aedSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18970f595aedSmrg#
18980f595aedSmrg# Interface to module:
18990f595aedSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19000f595aedSmrg# XSLTPROC:	 returns the path of the xsltproc program found
19010f595aedSmrg#		 returns the path set by the user in the environment
19020f595aedSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19030f595aedSmrg#		  'no' user instructs the module not to use xsltproc
19040f595aedSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19050f595aedSmrg#
19060f595aedSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19070f595aedSmrg#
19080f595aedSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19090f595aedSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19100f595aedSmrg# Preserves the interface, should it be implemented later
19110f595aedSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19120f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
19130f595aedSmrgAC_ARG_WITH(xsltproc,
19140f595aedSmrg	AS_HELP_STRING([--with-xsltproc],
19150f595aedSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19160f595aedSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19170f595aedSmrgm4_undefine([_defopt])
191862aeb71dSmrg
19190f595aedSmrgif test "x$use_xsltproc" = x"auto"; then
19200f595aedSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19210f595aedSmrg   if test "x$XSLTPROC" = "x"; then
19220f595aedSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19230f595aedSmrg	have_xsltproc=no
19240f595aedSmrg   else
19250f595aedSmrg        have_xsltproc=yes
19260f595aedSmrg   fi
19270f595aedSmrgelif test "x$use_xsltproc" = x"yes" ; then
19280f595aedSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19290f595aedSmrg   if test "x$XSLTPROC" = "x"; then
19300f595aedSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19310f595aedSmrg   fi
19320f595aedSmrg   have_xsltproc=yes
19330f595aedSmrgelif test "x$use_xsltproc" = x"no" ; then
19340f595aedSmrg   if test "x$XSLTPROC" != "x"; then
19350f595aedSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19360f595aedSmrg   fi
19370f595aedSmrg   have_xsltproc=no
19380f595aedSmrgelse
19390f595aedSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940b8f63ae3Smrgfi
194162aeb71dSmrg
19420f595aedSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19430f595aedSmrg]) # XORG_WITH_XSLTPROC
19440f595aedSmrg
19450f595aedSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19460f595aedSmrg# ----------------------------------------
19470f595aedSmrg# Minimum version: 1.15.0
194862aeb71dSmrg#
19490f595aedSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
19500f595aedSmrg# scanning arbitrary text files, extracting information from those text files,
19510f595aedSmrg# and printing reports based on that information.
195262aeb71dSmrg#
19530f595aedSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195462aeb71dSmrg#
19550f595aedSmrg# Interface to module:
19560f595aedSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
19570f595aedSmrg# PERL:	     returns the path of the perl program found
19580f595aedSmrg#	     returns the path set by the user in the environment
19590f595aedSmrg# --with-perl: 'yes' user instructs the module to use perl
19600f595aedSmrg#	       'no' user instructs the module not to use perl
19610f595aedSmrg# have_perl: returns yes if perl found in PATH or no
196262aeb71dSmrg#
19630f595aedSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19640f595aedSmrg#
19650f595aedSmrgAC_DEFUN([XORG_WITH_PERL],[
19660f595aedSmrgAC_ARG_VAR([PERL], [Path to perl command])
19670f595aedSmrg# Preserves the interface, should it be implemented later
19680f595aedSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19690f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
19700f595aedSmrgAC_ARG_WITH(perl,
19710f595aedSmrg	AS_HELP_STRING([--with-perl],
19720f595aedSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19730f595aedSmrg	   [use_perl=$withval], [use_perl=]_defopt)
19740f595aedSmrgm4_undefine([_defopt])
1975b8f63ae3Smrg
19760f595aedSmrgif test "x$use_perl" = x"auto"; then
19770f595aedSmrg   AC_PATH_PROG([PERL], [perl])
19780f595aedSmrg   if test "x$PERL" = "x"; then
19790f595aedSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19800f595aedSmrg	have_perl=no
19810f595aedSmrg   else
19820f595aedSmrg        have_perl=yes
19830f595aedSmrg   fi
19840f595aedSmrgelif test "x$use_perl" = x"yes" ; then
19850f595aedSmrg   AC_PATH_PROG([PERL], [perl])
19860f595aedSmrg   if test "x$PERL" = "x"; then
19870f595aedSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19880f595aedSmrg   fi
19890f595aedSmrg   have_perl=yes
19900f595aedSmrgelif test "x$use_perl" = x"no" ; then
19910f595aedSmrg   if test "x$PERL" != "x"; then
19920f595aedSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19930f595aedSmrg   fi
19940f595aedSmrg   have_perl=no
19950f595aedSmrgelse
19960f595aedSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19970f595aedSmrgfi
1998b8f63ae3Smrg
19990f595aedSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20000f595aedSmrg]) # XORG_WITH_PERL
200162aeb71dSmrg
20020f595aedSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003b8f63ae3Smrg# ----------------
20040f595aedSmrg# Minimum version: 1.5.0
20050f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
200662aeb71dSmrg#
20070f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
20080f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
20090f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20100f595aedSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
20110f595aedSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20120f595aedSmrg# --with-asciidoc assumes 'auto'.
201362aeb71dSmrg#
20140f595aedSmrg# Interface to module:
20150f595aedSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20160f595aedSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
20170f595aedSmrg#		 returns the path set by the user in the environment
20180f595aedSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20190f595aedSmrg#		  'no' user instructs the module not to use asciidoc
202062aeb71dSmrg#
20210f595aedSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202262aeb71dSmrg#
20230f595aedSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20240f595aedSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20250f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
20260f595aedSmrgAC_ARG_WITH(asciidoc,
20270f595aedSmrg	AS_HELP_STRING([--with-asciidoc],
20280f595aedSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20290f595aedSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20300f595aedSmrgm4_undefine([_defopt])
2031b8f63ae3Smrg
20320f595aedSmrgif test "x$use_asciidoc" = x"auto"; then
20330f595aedSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20340f595aedSmrg   if test "x$ASCIIDOC" = "x"; then
20350f595aedSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20360f595aedSmrg	have_asciidoc=no
20370f595aedSmrg   else
20380f595aedSmrg        have_asciidoc=yes
20390f595aedSmrg   fi
20400f595aedSmrgelif test "x$use_asciidoc" = x"yes" ; then
20410f595aedSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20420f595aedSmrg   if test "x$ASCIIDOC" = "x"; then
20430f595aedSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20440f595aedSmrg   fi
20450f595aedSmrg   have_asciidoc=yes
20460f595aedSmrgelif test "x$use_asciidoc" = x"no" ; then
20470f595aedSmrg   if test "x$ASCIIDOC" != "x"; then
20480f595aedSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20490f595aedSmrg   fi
20500f595aedSmrg   have_asciidoc=no
20510f595aedSmrgelse
20520f595aedSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20530f595aedSmrgfi
20540f595aedSmrgm4_ifval([$1],
20550f595aedSmrg[if test "$have_asciidoc" = yes; then
20560f595aedSmrg    # scrape the asciidoc version
20570f595aedSmrg    AC_MSG_CHECKING([the asciidoc version])
20580f595aedSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20590f595aedSmrg    AC_MSG_RESULT([$asciidoc_version])
20600f595aedSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20610f595aedSmrg        [if test "x$use_asciidoc" = xauto; then
20620f595aedSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20630f595aedSmrg            have_asciidoc=no
20640f595aedSmrg        else
20650f595aedSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20660f595aedSmrg        fi])
20670f595aedSmrgfi])
20680f595aedSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20690f595aedSmrg]) # XORG_WITH_ASCIIDOC
2070b8f63ae3Smrg
20710f595aedSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20720f595aedSmrg# -------------------------------------------
20730f595aedSmrg# Minimum version: 1.5.0
20740f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
20750f595aedSmrg# Minimum version for optional DOT checking: 1.18.0
207662aeb71dSmrg#
20770f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
20780f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
20790f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
20800f595aedSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
20810f595aedSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20820f595aedSmrg# --with-doxygen assumes 'auto'.
208362aeb71dSmrg#
20840f595aedSmrg# Interface to module:
20850f595aedSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20860f595aedSmrg# DOXYGEN:	 returns the path of the doxygen program found
20870f595aedSmrg#		 returns the path set by the user in the environment
20880f595aedSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20890f595aedSmrg#		  'no' user instructs the module not to use doxygen
209062aeb71dSmrg#
20910f595aedSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209262aeb71dSmrg#
20930f595aedSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20940f595aedSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20950f595aedSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20960f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
20970f595aedSmrgAC_ARG_WITH(doxygen,
20980f595aedSmrg	AS_HELP_STRING([--with-doxygen],
20990f595aedSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21000f595aedSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21010f595aedSmrgm4_undefine([_defopt])
2102b8f63ae3Smrg
21030f595aedSmrgif test "x$use_doxygen" = x"auto"; then
21040f595aedSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21050f595aedSmrg   if test "x$DOXYGEN" = "x"; then
21060f595aedSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21070f595aedSmrg	have_doxygen=no
21080f595aedSmrg   else
21090f595aedSmrg        have_doxygen=yes
21100f595aedSmrg   fi
21110f595aedSmrgelif test "x$use_doxygen" = x"yes" ; then
21120f595aedSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21130f595aedSmrg   if test "x$DOXYGEN" = "x"; then
21140f595aedSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21150f595aedSmrg   fi
21160f595aedSmrg   have_doxygen=yes
21170f595aedSmrgelif test "x$use_doxygen" = x"no" ; then
21180f595aedSmrg   if test "x$DOXYGEN" != "x"; then
21190f595aedSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21200f595aedSmrg   fi
21210f595aedSmrg   have_doxygen=no
212262aeb71dSmrgelse
21230f595aedSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212462aeb71dSmrgfi
21250f595aedSmrgm4_ifval([$1],
21260f595aedSmrg[if test "$have_doxygen" = yes; then
21270f595aedSmrg    # scrape the doxygen version
21280f595aedSmrg    AC_MSG_CHECKING([the doxygen version])
21290f595aedSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21300f595aedSmrg    AC_MSG_RESULT([$doxygen_version])
21310f595aedSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21320f595aedSmrg        [if test "x$use_doxygen" = xauto; then
21330f595aedSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21340f595aedSmrg            have_doxygen=no
21350f595aedSmrg        else
21360f595aedSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21370f595aedSmrg        fi])
21380f595aedSmrgfi])
2139b8f63ae3Smrg
21400f595aedSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21410f595aedSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21420f595aedSmrgdnl 	HAVE_DOT = @HAVE_DOT@
21430f595aedSmrgHAVE_DOT=no
21440f595aedSmrgif test "x$have_doxygen" = "xyes"; then
21450f595aedSmrg  AC_PATH_PROG([DOT], [dot])
21460f595aedSmrg    if test "x$DOT" != "x"; then
21470f595aedSmrg      HAVE_DOT=yes
21480f595aedSmrg    fi
21490f595aedSmrgfi
2150b8f63ae3Smrg
21510f595aedSmrgAC_SUBST([HAVE_DOT])
21520f595aedSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21530f595aedSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21540f595aedSmrg]) # XORG_WITH_DOXYGEN
2155b8f63ae3Smrg
21560f595aedSmrg# XORG_WITH_GROFF([DEFAULT])
21570f595aedSmrg# ----------------
21580f595aedSmrg# Minimum version: 1.6.0
21590f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
216062aeb71dSmrg#
21610f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
21620f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
21630f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
21640f595aedSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
21650f595aedSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
21660f595aedSmrg# --with-groff assumes 'auto'.
21670f595aedSmrg#
21680f595aedSmrg# Interface to module:
21690f595aedSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21700f595aedSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21710f595aedSmrg# HAVE_GROFF_MS: the -ms macros package
21720f595aedSmrg# GROFF:	 returns the path of the groff program found
21730f595aedSmrg#		 returns the path set by the user in the environment
21740f595aedSmrg# --with-groff:	 'yes' user instructs the module to use groff
21750f595aedSmrg#		 'no' user instructs the module not to use groff
21760f595aedSmrg#
21770f595aedSmrg# Added in version 1.9.0:
21780f595aedSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21790f595aedSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21800f595aedSmrg#		   psselect from the psutils package.
21810f595aedSmrg#		   the ghostcript package. Refer to the grohtml man pages
21820f595aedSmrg#
21830f595aedSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21840f595aedSmrg#
21850f595aedSmrg# OS and distros often splits groff in a basic and full package, the former
21860f595aedSmrg# having the groff program and the later having devices, fonts and macros
21870f595aedSmrg# Checking for the groff executable is not enough.
21880f595aedSmrg#
21890f595aedSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
21900f595aedSmrg# unset HAVE_GROFF or GROFF env variables.
21910f595aedSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21920f595aedSmrg#
21930f595aedSmrgAC_DEFUN([XORG_WITH_GROFF],[
21940f595aedSmrgAC_ARG_VAR([GROFF], [Path to groff command])
21950f595aedSmrgm4_define([_defopt], m4_default([$1], [auto]))
21960f595aedSmrgAC_ARG_WITH(groff,
21970f595aedSmrg	AS_HELP_STRING([--with-groff],
21980f595aedSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21990f595aedSmrg	   [use_groff=$withval], [use_groff=]_defopt)
22000f595aedSmrgm4_undefine([_defopt])
220162aeb71dSmrg
22020f595aedSmrgif test "x$use_groff" = x"auto"; then
22030f595aedSmrg   AC_PATH_PROG([GROFF], [groff])
22040f595aedSmrg   if test "x$GROFF" = "x"; then
22050f595aedSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22060f595aedSmrg	have_groff=no
22070f595aedSmrg   else
22080f595aedSmrg        have_groff=yes
22090f595aedSmrg   fi
22100f595aedSmrgelif test "x$use_groff" = x"yes" ; then
22110f595aedSmrg   AC_PATH_PROG([GROFF], [groff])
22120f595aedSmrg   if test "x$GROFF" = "x"; then
22130f595aedSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22140f595aedSmrg   fi
22150f595aedSmrg   have_groff=yes
22160f595aedSmrgelif test "x$use_groff" = x"no" ; then
22170f595aedSmrg   if test "x$GROFF" != "x"; then
22180f595aedSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22190f595aedSmrg   fi
22200f595aedSmrg   have_groff=no
22210f595aedSmrgelse
22220f595aedSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22230f595aedSmrgfi
222462aeb71dSmrg
22250f595aedSmrg# We have groff, test for the presence of the macro packages
22260f595aedSmrgif test "x$have_groff" = x"yes"; then
22270f595aedSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22280f595aedSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22290f595aedSmrg        groff_ms_works=yes
22300f595aedSmrg    else
22310f595aedSmrg        groff_ms_works=no
2232b8f63ae3Smrg    fi
22330f595aedSmrg    AC_MSG_RESULT([$groff_ms_works])
22340f595aedSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22350f595aedSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22360f595aedSmrg        groff_mm_works=yes
22370f595aedSmrg    else
22380f595aedSmrg        groff_mm_works=no
22390f595aedSmrg    fi
22400f595aedSmrg    AC_MSG_RESULT([$groff_mm_works])
22410f595aedSmrgfi
224262aeb71dSmrg
22430f595aedSmrg# We have groff, test for HTML dependencies, one command per package
22440f595aedSmrgif test "x$have_groff" = x"yes"; then
22450f595aedSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22460f595aedSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22470f595aedSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22480f595aedSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22490f595aedSmrg      have_groff_html=yes
22500f595aedSmrg   else
22510f595aedSmrg      have_groff_html=no
22520f595aedSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22530f595aedSmrg   fi
22540f595aedSmrgfi
22550f595aedSmrg
22560f595aedSmrg# Set Automake conditionals for Makefiles
22570f595aedSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22580f595aedSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22590f595aedSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22600f595aedSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22610f595aedSmrg]) # XORG_WITH_GROFF
22620f595aedSmrg
22630f595aedSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22640f595aedSmrg# ---------------------------------------
22650f595aedSmrg# Minimum version: 1.6.0
22660f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22670f595aedSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22680f595aedSmrg#
22690f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
22700f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
22710f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
22720f595aedSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
22730f595aedSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
22740f595aedSmrg# --with-fop assumes 'auto'.
22750f595aedSmrg#
22760f595aedSmrg# Interface to module:
22770f595aedSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22780f595aedSmrg# FOP:	 	returns the path of the fop program found
22790f595aedSmrg#		returns the path set by the user in the environment
22800f595aedSmrg# --with-fop: 	'yes' user instructs the module to use fop
22810f595aedSmrg#		'no' user instructs the module not to use fop
22820f595aedSmrg#
22830f595aedSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22840f595aedSmrg#
22850f595aedSmrgAC_DEFUN([XORG_WITH_FOP],[
22860f595aedSmrgAC_ARG_VAR([FOP], [Path to fop command])
22870f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
22880f595aedSmrgAC_ARG_WITH(fop,
22890f595aedSmrg	AS_HELP_STRING([--with-fop],
22900f595aedSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22910f595aedSmrg	   [use_fop=$withval], [use_fop=]_defopt)
22920f595aedSmrgm4_undefine([_defopt])
22930f595aedSmrg
22940f595aedSmrgif test "x$use_fop" = x"auto"; then
22950f595aedSmrg   AC_PATH_PROG([FOP], [fop])
22960f595aedSmrg   if test "x$FOP" = "x"; then
22970f595aedSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22980f595aedSmrg	have_fop=no
22990f595aedSmrg   else
23000f595aedSmrg        have_fop=yes
23010f595aedSmrg   fi
23020f595aedSmrgelif test "x$use_fop" = x"yes" ; then
23030f595aedSmrg   AC_PATH_PROG([FOP], [fop])
23040f595aedSmrg   if test "x$FOP" = "x"; then
23050f595aedSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23060f595aedSmrg   fi
23070f595aedSmrg   have_fop=yes
23080f595aedSmrgelif test "x$use_fop" = x"no" ; then
23090f595aedSmrg   if test "x$FOP" != "x"; then
23100f595aedSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23110f595aedSmrg   fi
23120f595aedSmrg   have_fop=no
2313b8f63ae3Smrgelse
23140f595aedSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231562aeb71dSmrgfi
231662aeb71dSmrg
23170f595aedSmrg# Test for a minimum version of fop, if provided.
23180f595aedSmrgm4_ifval([$1],
23190f595aedSmrg[if test "$have_fop" = yes; then
23200f595aedSmrg    # scrape the fop version
23210f595aedSmrg    AC_MSG_CHECKING([for fop minimum version])
23220f595aedSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23230f595aedSmrg    AC_MSG_RESULT([$fop_version])
23240f595aedSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
23250f595aedSmrg        [if test "x$use_fop" = xauto; then
23260f595aedSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23270f595aedSmrg            have_fop=no
23280f595aedSmrg        else
23290f595aedSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23300f595aedSmrg        fi])
23310f595aedSmrgfi])
23320f595aedSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23330f595aedSmrg]) # XORG_WITH_FOP
23340f595aedSmrg
23350f595aedSmrg# XORG_WITH_M4([MIN-VERSION])
23360f595aedSmrg# ---------------------------
23370f595aedSmrg# Minimum version: 1.19.0
23380f595aedSmrg#
23390f595aedSmrg# This macro attempts to locate an m4 macro processor which supports
23400f595aedSmrg# -I option and is only useful for modules relying on M4 in order to
23410f595aedSmrg# expand macros in source code files.
23420f595aedSmrg#
23430f595aedSmrg# Interface to module:
23440f595aedSmrg# M4:	 	returns the path of the m4 program found
23450f595aedSmrg#		returns the path set by the user in the environment
23460f595aedSmrg#
23470f595aedSmrgAC_DEFUN([XORG_WITH_M4], [
23480f595aedSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23490f595aedSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23500f595aedSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23510f595aedSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23520f595aedSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23530f595aedSmrg   [$PATH:/usr/gnu/bin])])
235462aeb71dSmrg
23550f595aedSmrgAC_SUBST([M4], [$ac_cv_path_M4])
23560f595aedSmrg]) # XORG_WITH_M4
2357c95b42baSmrg
23580f595aedSmrg# XORG_WITH_PS2PDF([DEFAULT])
23590f595aedSmrg# ----------------
23600f595aedSmrg# Minimum version: 1.6.0
23610f595aedSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23620f595aedSmrg#
23630f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
23640f595aedSmrg# not at the appropriate level. This macro enables a module to test for the
23650f595aedSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
23660f595aedSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
23670f595aedSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23680f595aedSmrg# --with-ps2pdf assumes 'auto'.
23690f595aedSmrg#
23700f595aedSmrg# Interface to module:
23710f595aedSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23720f595aedSmrg# PS2PDF:	returns the path of the ps2pdf program found
23730f595aedSmrg#		returns the path set by the user in the environment
23740f595aedSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23750f595aedSmrg#		 'no' user instructs the module not to use ps2pdf
23760f595aedSmrg#
23770f595aedSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23780f595aedSmrg#
23790f595aedSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23800f595aedSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23810f595aedSmrgm4_define([_defopt], m4_default([$1], [auto]))
23820f595aedSmrgAC_ARG_WITH(ps2pdf,
23830f595aedSmrg	AS_HELP_STRING([--with-ps2pdf],
23840f595aedSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23850f595aedSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23860f595aedSmrgm4_undefine([_defopt])
2387c95b42baSmrg
23880f595aedSmrgif test "x$use_ps2pdf" = x"auto"; then
23890f595aedSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23900f595aedSmrg   if test "x$PS2PDF" = "x"; then
23910f595aedSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23920f595aedSmrg	have_ps2pdf=no
23930f595aedSmrg   else
23940f595aedSmrg        have_ps2pdf=yes
23950f595aedSmrg   fi
23960f595aedSmrgelif test "x$use_ps2pdf" = x"yes" ; then
23970f595aedSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23980f595aedSmrg   if test "x$PS2PDF" = "x"; then
23990f595aedSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24000f595aedSmrg   fi
24010f595aedSmrg   have_ps2pdf=yes
24020f595aedSmrgelif test "x$use_ps2pdf" = x"no" ; then
24030f595aedSmrg   if test "x$PS2PDF" != "x"; then
24040f595aedSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24050f595aedSmrg   fi
24060f595aedSmrg   have_ps2pdf=no
24070f595aedSmrgelse
24080f595aedSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409c95b42baSmrgfi
24100f595aedSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24110f595aedSmrg]) # XORG_WITH_PS2PDF
2412c95b42baSmrg
24130f595aedSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
24140f595aedSmrg# ----------------
24150f595aedSmrg# Minimum version: 1.6.0
2416c95b42baSmrg#
24170f595aedSmrg# Documentation tools are not always available on all platforms and sometimes
24180f595aedSmrg# not at the appropriate level. This macro enables a builder to skip all
24190f595aedSmrg# documentation targets except traditional man pages.
24200f595aedSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24210f595aedSmrg# maximum flexibilty in controlling documentation building.
24220f595aedSmrg# Refer to:
24230f595aedSmrg# XORG_WITH_XMLTO         --with-xmlto
24240f595aedSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24250f595aedSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24260f595aedSmrg# XORG_WITH_FOP           --with-fop
24270f595aedSmrg# XORG_WITH_GROFF         --with-groff
24280f595aedSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24290f595aedSmrg#
24300f595aedSmrg# Interface to module:
24310f595aedSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24320f595aedSmrg# --enable-docs: 'yes' user instructs the module to generate docs
24330f595aedSmrg#		 'no' user instructs the module not to generate docs
24340f595aedSmrg# parm1:	specify the default value, yes or no.
24350f595aedSmrg#
24360f595aedSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24370f595aedSmrgm4_define([docs_default], m4_default([$1], [yes]))
24380f595aedSmrgAC_ARG_ENABLE(docs,
24390f595aedSmrg	AS_HELP_STRING([--enable-docs],
24400f595aedSmrg	   [Enable building the documentation (default: ]docs_default[)]),
24410f595aedSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
24420f595aedSmrgm4_undefine([docs_default])
24430f595aedSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24440f595aedSmrgAC_MSG_CHECKING([whether to build documentation])
24450f595aedSmrgAC_MSG_RESULT([$build_docs])
24460f595aedSmrg]) # XORG_ENABLE_DOCS
2447d80571a9Smrg
24480f595aedSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24490f595aedSmrg# ----------------
24500f595aedSmrg# Minimum version: 1.6.0
24510f595aedSmrg#
24520f595aedSmrg# This macro enables a builder to skip all developer documentation.
24530f595aedSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24540f595aedSmrg# maximum flexibilty in controlling documentation building.
24550f595aedSmrg# Refer to:
24560f595aedSmrg# XORG_WITH_XMLTO         --with-xmlto
24570f595aedSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24580f595aedSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24590f595aedSmrg# XORG_WITH_FOP           --with-fop
24600f595aedSmrg# XORG_WITH_GROFF         --with-groff
24610f595aedSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24620f595aedSmrg#
24630f595aedSmrg# Interface to module:
24640f595aedSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24650f595aedSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24660f595aedSmrg#			'no' user instructs the module not to generate developer docs
24670f595aedSmrg# parm1:		specify the default value, yes or no.
24680f595aedSmrg#
24690f595aedSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24700f595aedSmrgm4_define([devel_default], m4_default([$1], [yes]))
24710f595aedSmrgAC_ARG_ENABLE(devel-docs,
24720f595aedSmrg	AS_HELP_STRING([--enable-devel-docs],
24730f595aedSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24740f595aedSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24750f595aedSmrgm4_undefine([devel_default])
24760f595aedSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24770f595aedSmrgAC_MSG_CHECKING([whether to build developer documentation])
24780f595aedSmrgAC_MSG_RESULT([$build_devel_docs])
24790f595aedSmrg]) # XORG_ENABLE_DEVEL_DOCS
2480d80571a9Smrg
24810f595aedSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
24820f595aedSmrg# ----------------
24830f595aedSmrg# Minimum version: 1.6.0
24840f595aedSmrg#
24850f595aedSmrg# This macro enables a builder to skip all functional specification targets.
24860f595aedSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24870f595aedSmrg# maximum flexibilty in controlling documentation building.
24880f595aedSmrg# Refer to:
24890f595aedSmrg# XORG_WITH_XMLTO         --with-xmlto
24900f595aedSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24910f595aedSmrg# XORG_WITH_DOXYGEN       --with-doxygen
24920f595aedSmrg# XORG_WITH_FOP           --with-fop
24930f595aedSmrg# XORG_WITH_GROFF         --with-groff
24940f595aedSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
24950f595aedSmrg#
24960f595aedSmrg# Interface to module:
24970f595aedSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24980f595aedSmrg# --enable-specs:	'yes' user instructs the module to generate specs
24990f595aedSmrg#			'no' user instructs the module not to generate specs
25000f595aedSmrg# parm1:		specify the default value, yes or no.
25010f595aedSmrg#
25020f595aedSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25030f595aedSmrgm4_define([spec_default], m4_default([$1], [yes]))
25040f595aedSmrgAC_ARG_ENABLE(specs,
25050f595aedSmrg	AS_HELP_STRING([--enable-specs],
25060f595aedSmrg	   [Enable building the specs (default: ]spec_default[)]),
25070f595aedSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
25080f595aedSmrgm4_undefine([spec_default])
25090f595aedSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25100f595aedSmrgAC_MSG_CHECKING([whether to build functional specifications])
25110f595aedSmrgAC_MSG_RESULT([$build_specs])
25120f595aedSmrg]) # XORG_ENABLE_SPECS
2513c95b42baSmrg
25140f595aedSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25150f595aedSmrg# ----------------------------------------------
25160f595aedSmrg# Minimum version: 1.13.0
2517b8f63ae3Smrg#
25180f595aedSmrg# This macro enables a builder to enable/disable unit testing
25190f595aedSmrg# It makes no assumption about the test cases implementation
25200f595aedSmrg# Test cases may or may not use Automake "Support for test suites"
25210f595aedSmrg# They may or may not use the software utility library GLib
25220f595aedSmrg#
25230f595aedSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25240f595aedSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25250f595aedSmrg# The variable enable_unit_tests is used by other macros in this file.
25260f595aedSmrg#
25270f595aedSmrg# Interface to module:
25280f595aedSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25290f595aedSmrg# enable_unit_tests:    used in configure.ac for additional configuration
25300f595aedSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25310f595aedSmrg#			'no' user instructs the module not to build tests
25320f595aedSmrg# parm1:		specify the default value, yes or no.
25330f595aedSmrg#
25340f595aedSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25350f595aedSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25360f595aedSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25370f595aedSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25380f595aedSmrgm4_define([_defopt], m4_default([$1], [auto]))
25390f595aedSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25400f595aedSmrg	[Enable building unit test cases (default: ]_defopt[)]),
25410f595aedSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25420f595aedSmrgm4_undefine([_defopt])
25430f595aedSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25440f595aedSmrgAC_MSG_CHECKING([whether to build unit test cases])
25450f595aedSmrgAC_MSG_RESULT([$enable_unit_tests])
25460f595aedSmrg]) # XORG_ENABLE_UNIT_TESTS
2547c95b42baSmrg
25480f595aedSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25490f595aedSmrg# ------------------------------------------------------
25500f595aedSmrg# Minimum version: 1.17.0
25510f595aedSmrg#
25520f595aedSmrg# This macro enables a builder to enable/disable integration testing
25530f595aedSmrg# It makes no assumption about the test cases' implementation
25540f595aedSmrg# Test cases may or may not use Automake "Support for test suites"
25550f595aedSmrg#
25560f595aedSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25570f595aedSmrg# usually requires less dependencies and may be built and run under less
25580f595aedSmrg# stringent environments than integration tests.
25590f595aedSmrg#
25600f595aedSmrg# Interface to module:
25610f595aedSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25620f595aedSmrg# enable_integration_tests:   used in configure.ac for additional configuration
25630f595aedSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25640f595aedSmrg#                             'no' user instructs the module not to build tests
25650f595aedSmrg# parm1:                      specify the default value, yes or no.
25660f595aedSmrg#
25670f595aedSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25680f595aedSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25690f595aedSmrgm4_define([_defopt], m4_default([$1], [auto]))
25700f595aedSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25710f595aedSmrg	[Enable building integration test cases (default: ]_defopt[)]),
25720f595aedSmrg	[enable_integration_tests=$enableval],
25730f595aedSmrg	[enable_integration_tests=]_defopt)
25740f595aedSmrgm4_undefine([_defopt])
25750f595aedSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25760f595aedSmrg	[test "x$enable_integration_tests" != xno])
25770f595aedSmrgAC_MSG_CHECKING([whether to build unit test cases])
25780f595aedSmrgAC_MSG_RESULT([$enable_integration_tests])
25790f595aedSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580c95b42baSmrg
25810f595aedSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25820f595aedSmrg# ----------------------------------------
25830f595aedSmrg# Minimum version: 1.13.0
25840f595aedSmrg#
25850f595aedSmrg# GLib is a library which provides advanced data structures and functions.
25860f595aedSmrg# This macro enables a module to test for the presence of Glib.
25870f595aedSmrg#
25880f595aedSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25890f595aedSmrg# Otherwise the value of $enable_unit_tests is blank.
25900f595aedSmrg#
25910f595aedSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25920f595aedSmrg# test support usually requires less dependencies and may be built and run under
25930f595aedSmrg# less stringent environments than integration tests.
2594c95b42baSmrg#
25950f595aedSmrg# Interface to module:
25960f595aedSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
25970f595aedSmrg# with_glib: used in configure.ac to know if GLib has been found
25980f595aedSmrg# --with-glib:	'yes' user instructs the module to use glib
25990f595aedSmrg#		'no' user instructs the module not to use glib
26000f595aedSmrg#
26010f595aedSmrgAC_DEFUN([XORG_WITH_GLIB],[
26020f595aedSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26030f595aedSmrgm4_define([_defopt], m4_default([$2], [auto]))
26040f595aedSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26050f595aedSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26060f595aedSmrg	[with_glib=$withval], [with_glib=]_defopt)
26070f595aedSmrgm4_undefine([_defopt])
2608b8f63ae3Smrg
26090f595aedSmrghave_glib=no
26100f595aedSmrg# Do not probe GLib if user explicitly disabled unit testing
26110f595aedSmrgif test "x$enable_unit_tests" != x"no"; then
26120f595aedSmrg  # Do not probe GLib if user explicitly disabled it
26130f595aedSmrg  if test "x$with_glib" != x"no"; then
26140f595aedSmrg    m4_ifval(
26150f595aedSmrg      [$1],
26160f595aedSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26170f595aedSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26180f595aedSmrg    )
2619b8f63ae3Smrg  fi
2620c95b42baSmrgfi
2621d80571a9Smrg
26220f595aedSmrg# Not having GLib when unit testing has been explicitly requested is an error
26230f595aedSmrgif test "x$enable_unit_tests" = x"yes"; then
26240f595aedSmrg  if test "x$have_glib" = x"no"; then
26250f595aedSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626b8f63ae3Smrg  fi
2627b8f63ae3Smrgfi
2628c95b42baSmrg
26290f595aedSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
26300f595aedSmrgif test "x$enable_unit_tests" = x"no"; then
26310f595aedSmrg  if test "x$with_glib" = x"yes"; then
26320f595aedSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26330f595aedSmrg  fi
26340f595aedSmrgfi
263562aeb71dSmrg
26360f595aedSmrg# Not having GLib when it has been explicitly requested is an error
26370f595aedSmrgif test "x$with_glib" = x"yes"; then
26380f595aedSmrg  if test "x$have_glib" = x"no"; then
26390f595aedSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26400f595aedSmrg  fi
26410f595aedSmrgfi
264262aeb71dSmrg
26430f595aedSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26440f595aedSmrg]) # XORG_WITH_GLIB
2645b8f63ae3Smrg
26460f595aedSmrg# XORG_LD_WRAP([required|optional])
26470f595aedSmrg# ---------------------------------
26480f595aedSmrg# Minimum version: 1.13.0
26490f595aedSmrg#
26500f595aedSmrg# Check if linker supports -wrap, passed via compiler flags
26510f595aedSmrg#
26520f595aedSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26530f595aedSmrg# Otherwise the value of $enable_unit_tests is blank.
26540f595aedSmrg#
26550f595aedSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26560f595aedSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26570f595aedSmrg# available, an argument of "optional" allows use when some unit tests require
26580f595aedSmrg# ld -wrap and others do not.
26590f595aedSmrg#
26600f595aedSmrgAC_DEFUN([XORG_LD_WRAP],[
26610f595aedSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26620f595aedSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26630f595aedSmrg                      void __wrap_exit(int status) { return; }],
26640f595aedSmrg                     [exit(0);])])
26650f595aedSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
26660f595aedSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26670f595aedSmrg  if test "x$have_ld_wrap" = x"no"; then
26680f595aedSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26690f595aedSmrg  fi
26700f595aedSmrgfi
26710f595aedSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26720f595aedSmrg#
26730f595aedSmrg]) # XORG_LD_WRAP
2674b8f63ae3Smrg
26750f595aedSmrg# XORG_CHECK_LINKER_FLAGS
26760f595aedSmrg# -----------------------
26770f595aedSmrg# SYNOPSIS
26780f595aedSmrg#
26790f595aedSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26800f595aedSmrg#
26810f595aedSmrg# DESCRIPTION
26820f595aedSmrg#
26830f595aedSmrg#   Check whether the given linker FLAGS work with the current language's
26840f595aedSmrg#   linker, or whether they give an error.
26850f595aedSmrg#
26860f595aedSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26870f595aedSmrg#   success/failure.
26880f595aedSmrg#
26890f595aedSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
26900f595aedSmrg#
26910f595aedSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26920f595aedSmrg#
26930f595aedSmrg# LICENSE
26940f595aedSmrg#
26950f595aedSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26960f595aedSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26970f595aedSmrg#   Copyright (c) 2009 Matteo Frigo
26980f595aedSmrg#
26990f595aedSmrg#   This program is free software: you can redistribute it and/or modify it
27000f595aedSmrg#   under the terms of the GNU General Public License as published by the
27010f595aedSmrg#   Free Software Foundation, either version 3 of the License, or (at your
27020f595aedSmrg#   option) any later version.
27030f595aedSmrg#
27040f595aedSmrg#   This program is distributed in the hope that it will be useful, but
27050f595aedSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27060f595aedSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27070f595aedSmrg#   Public License for more details.
27080f595aedSmrg#
27090f595aedSmrg#   You should have received a copy of the GNU General Public License along
27100f595aedSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27110f595aedSmrg#
27120f595aedSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
27130f595aedSmrg#   gives unlimited permission to copy, distribute and modify the configure
27140f595aedSmrg#   scripts that are the output of Autoconf when processing the Macro. You
27150f595aedSmrg#   need not follow the terms of the GNU General Public License when using
27160f595aedSmrg#   or distributing such scripts, even though portions of the text of the
27170f595aedSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27180f595aedSmrg#   all other use of the material that constitutes the Autoconf Macro.
27190f595aedSmrg#
27200f595aedSmrg#   This special exception to the GPL applies to versions of the Autoconf
27210f595aedSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
27220f595aedSmrg#   modified version of the Autoconf Macro, you may extend this special
27230f595aedSmrg#   exception to the GPL to apply to your modified version as well.#
27240f595aedSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27250f595aedSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
27260f595aedSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27270f595aedSmrgAS_LITERAL_IF([$1],
27280f595aedSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27290f595aedSmrg      ax_save_FLAGS=$LDFLAGS
27300f595aedSmrg      LDFLAGS="$1"
27310f595aedSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27320f595aedSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27330f595aedSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27340f595aedSmrg      LDFLAGS=$ax_save_FLAGS])],
27350f595aedSmrg  [ax_save_FLAGS=$LDFLAGS
27360f595aedSmrg   LDFLAGS="$1"
27370f595aedSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27380f595aedSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27390f595aedSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27400f595aedSmrg   LDFLAGS=$ax_save_FLAGS])
27410f595aedSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27420f595aedSmrgAC_MSG_RESULT($xorg_check_linker_flags)
27430f595aedSmrgif test "x$xorg_check_linker_flags" = xyes; then
27440f595aedSmrg	m4_default([$2], :)
27450f595aedSmrgelse
27460f595aedSmrg	m4_default([$3], :)
27470f595aedSmrgfi
27480f595aedSmrg]) # XORG_CHECK_LINKER_FLAGS
274962aeb71dSmrg
27500f595aedSmrg# XORG_MEMORY_CHECK_FLAGS
27510f595aedSmrg# -----------------------
27520f595aedSmrg# Minimum version: 1.16.0
27530f595aedSmrg#
27540f595aedSmrg# This macro attempts to find appropriate memory checking functionality
27550f595aedSmrg# for various platforms which unit testing code may use to catch various
27560f595aedSmrg# forms of memory allocation and access errors in testing.
27570f595aedSmrg#
27580f595aedSmrg# Interface to module:
27590f595aedSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27600f595aedSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27610f595aedSmrg#
27620f595aedSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27630f595aedSmrg#
27640f595aedSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276562aeb71dSmrg
27660f595aedSmrgAC_REQUIRE([AC_CANONICAL_HOST])
27670f595aedSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27680f595aedSmrg           [Environment variables to enable memory checking in tests])
276962aeb71dSmrg
27700f595aedSmrg# Check for different types of support on different platforms
27710f595aedSmrgcase $host_os in
27720f595aedSmrg    solaris*)
27730f595aedSmrg        AC_CHECK_LIB([umem], [umem_alloc],
27740f595aedSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27750f595aedSmrg        ;;
27760f595aedSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27770f595aedSmrg        # both directly and inverted, so should not be 0 or 255.
27780f595aedSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
27790f595aedSmrg        ;;
27800f595aedSmrg    darwin*)
27810f595aedSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27820f595aedSmrg        ;;
27830f595aedSmrg    *bsd*)
27840f595aedSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27850f595aedSmrg        ;;
27860f595aedSmrgesac
278762aeb71dSmrg
27880f595aedSmrg# User supplied flags override default flags
27890f595aedSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27900f595aedSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279162aeb71dSmrgfi
279262aeb71dSmrg
27930f595aedSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27940f595aedSmrg]) # XORG_WITH_LINT
279562aeb71dSmrg
27960f595aedSmrg# XORG_CHECK_MALLOC_ZERO
27970f595aedSmrg# ----------------------
27980f595aedSmrg# Minimum version: 1.0.0
279962aeb71dSmrg#
28000f595aedSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28010f595aedSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28020f595aedSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28030f595aedSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28040f595aedSmrgAC_ARG_ENABLE(malloc0returnsnull,
28050f595aedSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28060f595aedSmrg		       [malloc(0) returns NULL (default: auto)]),
28070f595aedSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28080f595aedSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280962aeb71dSmrg
28100f595aedSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28110f595aedSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28120f595aedSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28130f595aedSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28140f595aedSmrg#include <stdlib.h>
28150f595aedSmrg],[
28160f595aedSmrg    char *m0, *r0, *c0, *p;
28170f595aedSmrg    m0 = malloc(0);
28180f595aedSmrg    p = malloc(10);
28190f595aedSmrg    r0 = realloc(p,0);
28200f595aedSmrg    c0 = calloc(0,10);
28210f595aedSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28220f595aedSmrg])],
28230f595aedSmrg		[xorg_cv_malloc0_returns_null=yes],
28240f595aedSmrg		[xorg_cv_malloc0_returns_null=no])])
28250f595aedSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826b8f63ae3Smrgfi
28270f595aedSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828b8f63ae3Smrg
28290f595aedSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28300f595aedSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28310f595aedSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28320f595aedSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283362aeb71dSmrgelse
28340f595aedSmrg	MALLOC_ZERO_CFLAGS=""
28350f595aedSmrg	XMALLOC_ZERO_CFLAGS=""
28360f595aedSmrg	XTMALLOC_ZERO_CFLAGS=""
283762aeb71dSmrgfi
283862aeb71dSmrg
28390f595aedSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28400f595aedSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28410f595aedSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28420f595aedSmrg]) # XORG_CHECK_MALLOC_ZERO
284362aeb71dSmrg
28440f595aedSmrg# XORG_WITH_LINT()
28450f595aedSmrg# ----------------
28460f595aedSmrg# Minimum version: 1.1.0
2847b8f63ae3Smrg#
28480f595aedSmrg# This macro enables the use of a tool that flags some suspicious and
28490f595aedSmrg# non-portable constructs (likely to be bugs) in C language source code.
28500f595aedSmrg# It will attempt to locate the tool and use appropriate options.
28510f595aedSmrg# There are various lint type tools on different platforms.
2852b8f63ae3Smrg#
28530f595aedSmrg# Interface to module:
28540f595aedSmrg# LINT:		returns the path to the tool found on the platform
28550f595aedSmrg#		or the value set to LINT on the configure cmd line
28560f595aedSmrg#		also an Automake conditional
28570f595aedSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
28580f595aedSmrg#
28590f595aedSmrg# --with-lint:	'yes' user instructs the module to use lint
28600f595aedSmrg#		'no' user instructs the module not to use lint (default)
28610f595aedSmrg#
28620f595aedSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28630f595aedSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28640f595aedSmrg#
28650f595aedSmrgAC_DEFUN([XORG_WITH_LINT],[
286662aeb71dSmrg
28670f595aedSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28680f595aedSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28690f595aedSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28700f595aedSmrg		[Use a lint-style source code checker (default: disabled)])],
28710f595aedSmrg		[use_lint=$withval], [use_lint=no])
2872b8f63ae3Smrg
28730f595aedSmrg# Obtain platform specific info like program name and options
28740f595aedSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28750f595aedSmrgcase $host_os in
28760f595aedSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28770f595aedSmrg	lint_name=splint
28780f595aedSmrg	lint_options="-badflag"
28790f595aedSmrg	;;
28800f595aedSmrg  *freebsd* | *netbsd*)
28810f595aedSmrg	lint_name=lint
28820f595aedSmrg	lint_options="-u -b"
28830f595aedSmrg	;;
28840f595aedSmrg  *solaris*)
28850f595aedSmrg	lint_name=lint
28860f595aedSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28870f595aedSmrg	;;
28880f595aedSmrgesac
28890f595aedSmrg
28900f595aedSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28910f595aedSmrgif test "x$use_lint" = x"yes" ; then
28920f595aedSmrg   AC_PATH_PROG([LINT], [$lint_name])
28930f595aedSmrg   if test "x$LINT" = "x"; then
28940f595aedSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28950f595aedSmrg   fi
28960f595aedSmrgelif test "x$use_lint" = x"no" ; then
28970f595aedSmrg   if test "x$LINT" != "x"; then
28980f595aedSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28990f595aedSmrg   fi
290062aeb71dSmrgelse
29010f595aedSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290262aeb71dSmrgfi
2903b8f63ae3Smrg
29040f595aedSmrg# User supplied flags override default flags
29050f595aedSmrgif test "x$LINT_FLAGS" != "x"; then
29060f595aedSmrg   lint_options=$LINT_FLAGS
29070f595aedSmrgfi
2908b8f63ae3Smrg
29090f595aedSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29100f595aedSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911b8f63ae3Smrg
29120f595aedSmrg]) # XORG_WITH_LINT
2913b8f63ae3Smrg
29140f595aedSmrg# XORG_LINT_LIBRARY(LIBNAME)
29150f595aedSmrg# --------------------------
29160f595aedSmrg# Minimum version: 1.1.0
2917f40e0d56Smrg#
29180f595aedSmrg# Sets up flags for building lint libraries for checking programs that call
29190f595aedSmrg# functions in the library.
29200f595aedSmrg#
29210f595aedSmrg# Interface to module:
29220f595aedSmrg# LINTLIB		- Automake variable with the name of lint library file to make
29230f595aedSmrg# MAKE_LINT_LIB		- Automake conditional
29240f595aedSmrg#
29250f595aedSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29260f595aedSmrg#			  - 'no' user instructs the module not to create a lint library (default)
2927b8f63ae3Smrg
29280f595aedSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29290f595aedSmrgAC_REQUIRE([XORG_WITH_LINT])
29300f595aedSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29310f595aedSmrg	[Create lint library (default: disabled)])],
29320f595aedSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29330f595aedSmrg
29340f595aedSmrgif test "x$make_lint_lib" = x"yes" ; then
29350f595aedSmrg   LINTLIB=llib-l$1.ln
29360f595aedSmrg   if test "x$LINT" = "x"; then
29370f595aedSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29380f595aedSmrg   fi
29390f595aedSmrgelif test "x$make_lint_lib" != x"no" ; then
29400f595aedSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941b8f63ae3Smrgfi
2942b8f63ae3Smrg
29430f595aedSmrgAC_SUBST(LINTLIB)
29440f595aedSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945b8f63ae3Smrg
29460f595aedSmrg]) # XORG_LINT_LIBRARY
2947f40e0d56Smrg
29480f595aedSmrg# XORG_COMPILER_BRAND
2949b8f63ae3Smrg# -------------------
29500f595aedSmrg# Minimum version: 1.14.0
2951b8f63ae3Smrg#
29520f595aedSmrg# Checks for various brands of compilers and sets flags as appropriate:
29530f595aedSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29540f595aedSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29550f595aedSmrg#   clang compiler - sets CLANGCC to "yes"
29560f595aedSmrg#   Intel compiler - sets INTELCC to "yes"
29570f595aedSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29580f595aedSmrg#
29590f595aedSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29600f595aedSmrgAC_LANG_CASE(
29610f595aedSmrg	[C], [
29620f595aedSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29630f595aedSmrg	],
29640f595aedSmrg	[C++], [
29650f595aedSmrg		AC_REQUIRE([AC_PROG_CXX])
29660f595aedSmrg	]
29670f595aedSmrg)
29680f595aedSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29690f595aedSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29700f595aedSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29710f595aedSmrg]) # XORG_COMPILER_BRAND
297262aeb71dSmrg
29730f595aedSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2974b8f63ae3Smrg# ---------------
29750f595aedSmrg# Minimum version: 1.16.0
29760f595aedSmrg#
29770f595aedSmrg# Test if the compiler works when passed the given flag as a command line argument.
29780f595aedSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
29790f595aedSmrg# next flag in the list until there are no more options.
29800f595aedSmrg#
29810f595aedSmrg# Note that this does not guarantee that the compiler supports the flag as some
29820f595aedSmrg# compilers will simply ignore arguments that they do not understand, but we do
29830f595aedSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29840f595aedSmrg# -Werror=unused-command-line-argument
29850f595aedSmrg#
29860f595aedSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29870f595aedSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29880f595aedSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298962aeb71dSmrg
29900f595aedSmrgAC_LANG_COMPILER_REQUIRE
2991b8f63ae3Smrg
29920f595aedSmrgAC_LANG_CASE(
29930f595aedSmrg	[C], [
29940f595aedSmrg		AC_REQUIRE([AC_PROG_CC_C99])
29950f595aedSmrg		define([PREFIX], [C])
29960f595aedSmrg		define([CACHE_PREFIX], [cc])
29970f595aedSmrg		define([COMPILER], [$CC])
29980f595aedSmrg	],
29990f595aedSmrg	[C++], [
30000f595aedSmrg		define([PREFIX], [CXX])
30010f595aedSmrg		define([CACHE_PREFIX], [cxx])
30020f595aedSmrg		define([COMPILER], [$CXX])
30030f595aedSmrg	]
30040f595aedSmrg)
30050f595aedSmrg
30060f595aedSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30070f595aedSmrg
30080f595aedSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30090f595aedSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30100f595aedSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30110f595aedSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30120f595aedSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30130f595aedSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30140f595aedSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30150f595aedSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30160f595aedSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3017b8f63ae3Smrgfi
30180f595aedSmrg
30190f595aedSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30200f595aedSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30210f595aedSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30220f595aedSmrg	fi
30230f595aedSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30240f595aedSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30250f595aedSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30260f595aedSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30270f595aedSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30280f595aedSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30290f595aedSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30300f595aedSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30310f595aedSmrgfi
30320f595aedSmrg
30330f595aedSmrgfound="no"
30340f595aedSmrgm4_foreach([flag], m4_cdr($@), [
30350f595aedSmrg	if test $found = "no" ; then
30360f595aedSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30370f595aedSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30380f595aedSmrg		fi
30390f595aedSmrg
30400f595aedSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30410f595aedSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30420f595aedSmrg		fi
30430f595aedSmrg
30440f595aedSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30450f595aedSmrg
30460f595aedSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30470f595aedSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30480f595aedSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30490f595aedSmrg		AC_CACHE_VAL($cacheid,
30500f595aedSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30510f595aedSmrg					     [eval $cacheid=yes],
30520f595aedSmrg					     [eval $cacheid=no])])
30530f595aedSmrg
30540f595aedSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30550f595aedSmrg
30560f595aedSmrg		eval supported=\$$cacheid
30570f595aedSmrg		AC_MSG_RESULT([$supported])
30580f595aedSmrg		if test "$supported" = "yes" ; then
30590f595aedSmrg			$1="$$1 ]flag["
30600f595aedSmrg			found="yes"
30610f595aedSmrg		fi
30620f595aedSmrg	fi
3063b8f63ae3Smrg])
30640f595aedSmrg]) # XORG_TESTSET_CFLAG
3065f40e0d56Smrg
30660f595aedSmrg# XORG_COMPILER_FLAGS
30670f595aedSmrg# ---------------
30680f595aedSmrg# Minimum version: 1.16.0
3069f40e0d56Smrg#
30700f595aedSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30710f595aedSmrg# arguments supported by the selected compiler which do NOT alter the generated
30720f595aedSmrg# code.  These arguments will cause the compiler to print various warnings
30730f595aedSmrg# during compilation AND turn a conservative set of warnings into errors.
30740f595aedSmrg#
30750f595aedSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30760f595aedSmrg# future versions of util-macros as options are added to new compilers.
30770f595aedSmrg#
30780f595aedSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30790f595aedSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3080b8f63ae3Smrg
30810f595aedSmrgAC_ARG_ENABLE(selective-werror,
30820f595aedSmrg              AS_HELP_STRING([--disable-selective-werror],
30830f595aedSmrg                             [Turn off selective compiler errors. (default: enabled)]),
30840f595aedSmrg              [SELECTIVE_WERROR=$enableval],
30850f595aedSmrg              [SELECTIVE_WERROR=yes])
30860f595aedSmrg
30870f595aedSmrgAC_LANG_CASE(
30880f595aedSmrg        [C], [
30890f595aedSmrg                define([PREFIX], [C])
30900f595aedSmrg        ],
30910f595aedSmrg        [C++], [
30920f595aedSmrg                define([PREFIX], [CXX])
30930f595aedSmrg        ]
30940f595aedSmrg)
30950f595aedSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
30960f595aedSmrgif test "x$SUNCC" = "xyes"; then
30970f595aedSmrg    [BASE_]PREFIX[FLAGS]="-v"
3098b8f63ae3Smrgelse
30990f595aedSmrg    [BASE_]PREFIX[FLAGS]=""
3100b8f63ae3Smrgfi
3101b8f63ae3Smrg
31020f595aedSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31030f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31040f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31050f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31060f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3107d80571a9Smrg
31080f595aedSmrgAC_LANG_CASE(
31090f595aedSmrg	[C], [
31100f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31110f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31120f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31130f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31140f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31150f595aedSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31160f595aedSmrg	]
31170f595aedSmrg)
3118b8f63ae3Smrg
31190f595aedSmrg# This chunk adds additional warnings that could catch undesired effects.
31200f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31210f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31220f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31230f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31240f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31250f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31260f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3127b8f63ae3Smrg
31280f595aedSmrg# These are currently disabled because they are noisy.  They will be enabled
31290f595aedSmrg# in the future once the codebase is sufficiently modernized to silence
31300f595aedSmrg# them.  For now, I don't want them to drown out the other warnings.
31310f595aedSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31320f595aedSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31330f595aedSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3134b8f63ae3Smrg
31350f595aedSmrg# Turn some warnings into errors, so we don't accidently get successful builds
31360f595aedSmrg# when there are problems that should be fixed.
3137b8f63ae3Smrg
31380f595aedSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31390f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31400f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31410f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31420f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31430f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31440f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31450f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31460f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31470f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31480f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31490f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31500f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31510f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31520f595aedSmrgelse
31530f595aedSmrgAC_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])
31540f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31550f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31560f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31570f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31580f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31590f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31600f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31610f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31620f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31630f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31640f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31650f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31660f595aedSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31670f595aedSmrgfi
3168b8f63ae3Smrg
31690f595aedSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31700f595aedSmrg]) # XORG_COMPILER_FLAGS
3171c95b42baSmrg
31720f595aedSmrg# XORG_CWARNFLAGS
31730f595aedSmrg# ---------------
31740f595aedSmrg# Minimum version: 1.2.0
31750f595aedSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3176f40e0d56Smrg#
31770f595aedSmrg# Defines CWARNFLAGS to enable C compiler warnings.
3178f40e0d56Smrg#
31790f595aedSmrg# This function is deprecated because it defines -fno-strict-aliasing
31800f595aedSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31810f595aedSmrg# is needed, then it should be added explicitly in the module when
31820f595aedSmrg# it is updated to use BASE_CFLAGS.
3183f40e0d56Smrg#
31840f595aedSmrgAC_DEFUN([XORG_CWARNFLAGS], [
31850f595aedSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31860f595aedSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31870f595aedSmrgAC_LANG_CASE(
31880f595aedSmrg	[C], [
31890f595aedSmrg		CWARNFLAGS="$BASE_CFLAGS"
31900f595aedSmrg		if  test "x$GCC" = xyes ; then
31910f595aedSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
31920f595aedSmrg		fi
31930f595aedSmrg		AC_SUBST(CWARNFLAGS)
31940f595aedSmrg	]
31950f595aedSmrg)
31960f595aedSmrg]) # XORG_CWARNFLAGS
3197b8f63ae3Smrg
31980f595aedSmrg# XORG_STRICT_OPTION
31990f595aedSmrg# -----------------------
32000f595aedSmrg# Minimum version: 1.3.0
32010f595aedSmrg#
32020f595aedSmrg# Add configure option to enable strict compilation flags, such as treating
32030f595aedSmrg# warnings as fatal errors.
32040f595aedSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32050f595aedSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32060f595aedSmrg#
32070f595aedSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32080f595aedSmrg# when strict compilation is unconditionally desired.
32090f595aedSmrgAC_DEFUN([XORG_STRICT_OPTION], [
32100f595aedSmrgAC_REQUIRE([XORG_CWARNFLAGS])
32110f595aedSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3212b8f63ae3Smrg
32130f595aedSmrgAC_ARG_ENABLE(strict-compilation,
32140f595aedSmrg			  AS_HELP_STRING([--enable-strict-compilation],
32150f595aedSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32160f595aedSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3217b8f63ae3Smrg
32180f595aedSmrgAC_LANG_CASE(
32190f595aedSmrg        [C], [
32200f595aedSmrg                define([PREFIX], [C])
32210f595aedSmrg        ],
32220f595aedSmrg        [C++], [
32230f595aedSmrg                define([PREFIX], [CXX])
32240f595aedSmrg        ]
32250f595aedSmrg)
3226b8f63ae3Smrg
32270f595aedSmrg[STRICT_]PREFIX[FLAGS]=""
32280f595aedSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32290f595aedSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3230b8f63ae3Smrg
32310f595aedSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32320f595aedSmrg# activate it with -Werror, so we add it here explicitly.
32330f595aedSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3234b8f63ae3Smrg
32350f595aedSmrgif test "x$STRICT_COMPILE" = "xyes"; then
32360f595aedSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32370f595aedSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32380f595aedSmrgfi
32390f595aedSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32400f595aedSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32410f595aedSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32420f595aedSmrg]) # XORG_STRICT_OPTION
3243b8f63ae3Smrg
32440f595aedSmrg# XORG_DEFAULT_OPTIONS
32450f595aedSmrg# --------------------
32460f595aedSmrg# Minimum version: 1.3.0
32470f595aedSmrg#
32480f595aedSmrg# Defines default options for X.Org modules.
32490f595aedSmrg#
32500f595aedSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32510f595aedSmrgAC_REQUIRE([AC_PROG_INSTALL])
32520f595aedSmrgXORG_COMPILER_FLAGS
32530f595aedSmrgXORG_CWARNFLAGS
32540f595aedSmrgXORG_STRICT_OPTION
32550f595aedSmrgXORG_RELEASE_VERSION
32560f595aedSmrgXORG_CHANGELOG
32570f595aedSmrgXORG_INSTALL
32580f595aedSmrgXORG_MANPAGE_SECTIONS
32590f595aedSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32600f595aedSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32610f595aedSmrg]) # XORG_DEFAULT_OPTIONS
3262b8f63ae3Smrg
32630f595aedSmrg# XORG_INSTALL()
32640f595aedSmrg# ----------------
32650f595aedSmrg# Minimum version: 1.4.0
32660f595aedSmrg#
32670f595aedSmrg# Defines the variable INSTALL_CMD as the command to copy
32680f595aedSmrg# INSTALL from $prefix/share/util-macros.
32690f595aedSmrg#
32700f595aedSmrgAC_DEFUN([XORG_INSTALL], [
32710f595aedSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32720f595aedSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32730f595aedSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32740f595aedSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32750f595aedSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32760f595aedSmrgtouch \$(top_srcdir)/INSTALL; \
32770f595aedSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32780f595aedSmrgAC_SUBST([INSTALL_CMD])
32790f595aedSmrg]) # XORG_INSTALL
32800f595aedSmrgdnl Copyright 2005 Red Hat, Inc
32810f595aedSmrgdnl
32820f595aedSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
32830f595aedSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32840f595aedSmrgdnl the above copyright notice appear in all copies and that both that
32850f595aedSmrgdnl copyright notice and this permission notice appear in supporting
32860f595aedSmrgdnl documentation.
32870f595aedSmrgdnl
32880f595aedSmrgdnl The above copyright notice and this permission notice shall be included
32890f595aedSmrgdnl in all copies or substantial portions of the Software.
32900f595aedSmrgdnl
32910f595aedSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32920f595aedSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32930f595aedSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32940f595aedSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
32950f595aedSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32960f595aedSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32970f595aedSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
32980f595aedSmrgdnl
32990f595aedSmrgdnl Except as contained in this notice, the name of the copyright holders shall
33000f595aedSmrgdnl not be used in advertising or otherwise to promote the sale, use or
33010f595aedSmrgdnl other dealings in this Software without prior written authorization
33020f595aedSmrgdnl from the copyright holders.
33030f595aedSmrgdnl
3304b8f63ae3Smrg
33050f595aedSmrg# XORG_RELEASE_VERSION
33060f595aedSmrg# --------------------
33070f595aedSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3308b8f63ae3Smrg
33090f595aedSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33100f595aedSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33110f595aedSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33120f595aedSmrg		[Major version of this package])
33130f595aedSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33140f595aedSmrg	if test "x$PVM" = "x"; then
33150f595aedSmrg		PVM="0"
33160f595aedSmrg	fi
33170f595aedSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33180f595aedSmrg		[$PVM],
33190f595aedSmrg		[Minor version of this package])
33200f595aedSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33210f595aedSmrg	if test "x$PVP" = "x"; then
33220f595aedSmrg		PVP="0"
33230f595aedSmrg	fi
33240f595aedSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33250f595aedSmrg		[$PVP],
33260f595aedSmrg		[Patch version of this package])
33270f595aedSmrg])
3328b8f63ae3Smrg
33290f595aedSmrg# XORG_CHANGELOG()
33300f595aedSmrg# ----------------
33310f595aedSmrg# Minimum version: 1.2.0
33320f595aedSmrg#
33330f595aedSmrg# Defines the variable CHANGELOG_CMD as the command to generate
33340f595aedSmrg# ChangeLog from git.
33350f595aedSmrg#
33360f595aedSmrg#
33370f595aedSmrgAC_DEFUN([XORG_CHANGELOG], [
33380f595aedSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33390f595aedSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33400f595aedSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33410f595aedSmrgtouch \$(top_srcdir)/ChangeLog; \
33420f595aedSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33430f595aedSmrgAC_SUBST([CHANGELOG_CMD])
33440f595aedSmrg]) # XORG_CHANGELOG
3345f40e0d56Smrg
3346