aclocal.m4 revision 3d13e800
13d13e800Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
201395c31Smrg
33d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
492bb16f8Smrg
592bb16f8Smrg# This file is free software; the Free Software Foundation
692bb16f8Smrg# gives unlimited permission to copy and/or distribute it,
792bb16f8Smrg# with or without modifications, as long as this notice is preserved.
892bb16f8Smrg
992bb16f8Smrg# This program is distributed in the hope that it will be useful,
1092bb16f8Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1192bb16f8Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1292bb16f8Smrg# PARTICULAR PURPOSE.
1392bb16f8Smrg
1401395c31Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158255a313Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168255a313Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
173d13e800Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
183d13e800Smrg[m4_warning([this file was generated for autoconf 2.71.
198255a313SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208255a313SmrgIf you have problems, you may need to regenerate the build system entirely.
2101395c31SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2201395c31Smrg
233d13e800Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2401395c31Smrg#
253d13e800Smrg# This file is free software; the Free Software Foundation
263d13e800Smrg# gives unlimited permission to copy and/or distribute it,
273d13e800Smrg# with or without modifications, as long as this notice is preserved.
2892bb16f8Smrg
293d13e800Smrg# AM_AUTOMAKE_VERSION(VERSION)
303d13e800Smrg# ----------------------------
313d13e800Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
323d13e800Smrg# generated from the m4 files accompanying Automake X.Y.
333d13e800Smrg# (This private macro should not be called outside this file.)
343d13e800SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
353d13e800Smrg[am__api_version='1.16'
363d13e800Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373d13e800Smrgdnl require some minimum version.  Point them to the right macro.
383d13e800Smrgm4_if([$1], [1.16.5], [],
393d13e800Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
403d13e800Smrg])
4192bb16f8Smrg
423d13e800Smrg# _AM_AUTOCONF_VERSION(VERSION)
433d13e800Smrg# -----------------------------
443d13e800Smrg# aclocal traces this macro to find the Autoconf version.
453d13e800Smrg# This is a private macro too.  Using m4_define simplifies
463d13e800Smrg# the logic in aclocal, which can simply ignore this definition.
473d13e800Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4801395c31Smrg
493d13e800Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
503d13e800Smrg# -------------------------------
513d13e800Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523d13e800Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
533d13e800SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543d13e800Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
553d13e800Smrgm4_ifndef([AC_AUTOCONF_VERSION],
563d13e800Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573d13e800Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5801395c31Smrg
593d13e800Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6092bb16f8Smrg
613d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6292bb16f8Smrg#
633d13e800Smrg# This file is free software; the Free Software Foundation
643d13e800Smrg# gives unlimited permission to copy and/or distribute it,
653d13e800Smrg# with or without modifications, as long as this notice is preserved.
6692bb16f8Smrg
673d13e800Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
683d13e800Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
693d13e800Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7092bb16f8Smrg#
713d13e800Smrg# Of course, Automake must honor this variable whenever it calls a
723d13e800Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
733d13e800Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
743d13e800Smrg# depending on how configure is run.  This is pretty annoying, since
753d13e800Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
763d13e800Smrg# source directory, any form will work fine, but in subdirectories a
773d13e800Smrg# relative path needs to be adjusted first.
7892bb16f8Smrg#
793d13e800Smrg# $ac_aux_dir/missing
803d13e800Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
813d13e800Smrg# $top_srcdir/$ac_aux_dir/missing
823d13e800Smrg#    fails if $ac_aux_dir is absolute,
833d13e800Smrg#    fails when called from a subdirectory in a VPATH build with
843d13e800Smrg#          a relative $ac_aux_dir
8592bb16f8Smrg#
863d13e800Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
873d13e800Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
883d13e800Smrg# harmless because $srcdir is '.', but things will broke when you
893d13e800Smrg# start a VPATH build or use an absolute $srcdir.
9001395c31Smrg#
913d13e800Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
923d13e800Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
933d13e800Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
943d13e800Smrg# and then we would define $MISSING as
953d13e800Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
963d13e800Smrg# This will work as long as MISSING is not called from configure, because
973d13e800Smrg# unfortunately $(top_srcdir) has no meaning in configure.
983d13e800Smrg# However there are other variables, like CC, which are often used in
993d13e800Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10001395c31Smrg#
1013d13e800Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1023d13e800Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1033d13e800Smrg# configured tree to be moved without reconfiguration.
10401395c31Smrg
1053d13e800SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1063d13e800Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1073d13e800Smrg# Expand $ac_aux_dir to an absolute path.
1083d13e800Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10992bb16f8Smrg])
11092bb16f8Smrg
1113d13e800Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11292bb16f8Smrg
1133d13e800Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11492bb16f8Smrg#
1153d13e800Smrg# This file is free software; the Free Software Foundation
1163d13e800Smrg# gives unlimited permission to copy and/or distribute it,
1173d13e800Smrg# with or without modifications, as long as this notice is preserved.
11892bb16f8Smrg
1193d13e800Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203d13e800Smrg# -------------------------------------
1213d13e800Smrg# Define a conditional.
1223d13e800SmrgAC_DEFUN([AM_CONDITIONAL],
1233d13e800Smrg[AC_PREREQ([2.52])dnl
1243d13e800Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1253d13e800Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263d13e800SmrgAC_SUBST([$1_TRUE])dnl
1273d13e800SmrgAC_SUBST([$1_FALSE])dnl
1283d13e800Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293d13e800Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303d13e800Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313d13e800Smrgif $2; then
1323d13e800Smrg  $1_TRUE=
1333d13e800Smrg  $1_FALSE='#'
1343d13e800Smrgelse
1353d13e800Smrg  $1_TRUE='#'
1363d13e800Smrg  $1_FALSE=
1373d13e800Smrgfi
1383d13e800SmrgAC_CONFIG_COMMANDS_PRE(
1393d13e800Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403d13e800Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413d13e800SmrgUsually this means the macro was only invoked conditionally.]])
1423d13e800Smrgfi])])
14392bb16f8Smrg
1443d13e800Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1458255a313Smrg#
1463d13e800Smrg# This file is free software; the Free Software Foundation
1473d13e800Smrg# gives unlimited permission to copy and/or distribute it,
1483d13e800Smrg# with or without modifications, as long as this notice is preserved.
1498255a313Smrg
15092bb16f8Smrg
1513d13e800Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1523d13e800Smrg# written in clear, in which case automake, when reading aclocal.m4,
1533d13e800Smrg# will think it sees a *use*, and therefore will trigger all it's
1543d13e800Smrg# C support machinery.  Also note that it means that autoscan, seeing
1553d13e800Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1568255a313Smrg
1578255a313Smrg
1583d13e800Smrg# _AM_DEPENDENCIES(NAME)
1593d13e800Smrg# ----------------------
1603d13e800Smrg# See how the compiler implements dependency checking.
1613d13e800Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1623d13e800Smrg# We try a few techniques and use that to set a single cache variable.
16301395c31Smrg#
1643d13e800Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1653d13e800Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1663d13e800Smrg# dependency, and given that the user is not expected to run this macro,
1673d13e800Smrg# just rely on AC_PROG_CC.
1683d13e800SmrgAC_DEFUN([_AM_DEPENDENCIES],
1693d13e800Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1703d13e800SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1713d13e800SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1723d13e800SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1738255a313Smrg
1743d13e800Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1753d13e800Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1763d13e800Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1773d13e800Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1783d13e800Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1793d13e800Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1803d13e800Smrg                    [depcc="$$1"   am_compiler_list=])
1818255a313Smrg
1823d13e800SmrgAC_CACHE_CHECK([dependency style of $depcc],
1833d13e800Smrg               [am_cv_$1_dependencies_compiler_type],
1843d13e800Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1853d13e800Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1863d13e800Smrg  # making bogus files that we don't know about and never remove.  For
1873d13e800Smrg  # instance it was reported that on HP-UX the gcc test will end up
1883d13e800Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1893d13e800Smrg  # in D".
1903d13e800Smrg  rm -rf conftest.dir
1913d13e800Smrg  mkdir conftest.dir
1923d13e800Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1933d13e800Smrg  # using a relative directory.
1943d13e800Smrg  cp "$am_depcomp" conftest.dir
1953d13e800Smrg  cd conftest.dir
1963d13e800Smrg  # We will build objects and dependencies in a subdirectory because
1973d13e800Smrg  # it helps to detect inapplicable dependency modes.  For instance
1983d13e800Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1993d13e800Smrg  # side effect of compilation, but ICC will put the dependencies in
2003d13e800Smrg  # the current directory while Tru64 will put them in the object
2013d13e800Smrg  # directory.
2023d13e800Smrg  mkdir sub
2038255a313Smrg
2043d13e800Smrg  am_cv_$1_dependencies_compiler_type=none
2053d13e800Smrg  if test "$am_compiler_list" = ""; then
2063d13e800Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2073d13e800Smrg  fi
2083d13e800Smrg  am__universal=false
2093d13e800Smrg  m4_case([$1], [CC],
2103d13e800Smrg    [case " $depcc " in #(
2113d13e800Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2123d13e800Smrg     esac],
2133d13e800Smrg    [CXX],
2143d13e800Smrg    [case " $depcc " in #(
2153d13e800Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2163d13e800Smrg     esac])
2178255a313Smrg
2183d13e800Smrg  for depmode in $am_compiler_list; do
2193d13e800Smrg    # Setup a source with many dependencies, because some compilers
2203d13e800Smrg    # like to wrap large dependency lists on column 80 (with \), and
2213d13e800Smrg    # we should not choose a depcomp mode which is confused by this.
2223d13e800Smrg    #
2233d13e800Smrg    # We need to recreate these files for each test, as the compiler may
2243d13e800Smrg    # overwrite some of them when testing with obscure command lines.
2253d13e800Smrg    # This happens at least with the AIX C compiler.
2263d13e800Smrg    : > sub/conftest.c
2273d13e800Smrg    for i in 1 2 3 4 5 6; do
2283d13e800Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2293d13e800Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2303d13e800Smrg      # Solaris 10 /bin/sh.
2313d13e800Smrg      echo '/* dummy */' > sub/conftst$i.h
2323d13e800Smrg    done
2333d13e800Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2348255a313Smrg
2353d13e800Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2363d13e800Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2373d13e800Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2383d13e800Smrg    # versions had trouble with output in subdirs.
2393d13e800Smrg    am__obj=sub/conftest.${OBJEXT-o}
2403d13e800Smrg    am__minus_obj="-o $am__obj"
2413d13e800Smrg    case $depmode in
2423d13e800Smrg    gcc)
2433d13e800Smrg      # This depmode causes a compiler race in universal mode.
2443d13e800Smrg      test "$am__universal" = false || continue
2453d13e800Smrg      ;;
2463d13e800Smrg    nosideeffect)
2473d13e800Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2483d13e800Smrg      # only be used when explicitly requested.
2493d13e800Smrg      if test "x$enable_dependency_tracking" = xyes; then
2503d13e800Smrg	continue
2513d13e800Smrg      else
2523d13e800Smrg	break
2533d13e800Smrg      fi
2543d13e800Smrg      ;;
2553d13e800Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2563d13e800Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2573d13e800Smrg      # not run yet.  These depmodes are late enough in the game, and
2583d13e800Smrg      # so weak that their functioning should not be impacted.
2593d13e800Smrg      am__obj=conftest.${OBJEXT-o}
2603d13e800Smrg      am__minus_obj=
2613d13e800Smrg      ;;
2623d13e800Smrg    none) break ;;
2633d13e800Smrg    esac
2643d13e800Smrg    if depmode=$depmode \
2653d13e800Smrg       source=sub/conftest.c object=$am__obj \
2663d13e800Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2673d13e800Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2683d13e800Smrg         >/dev/null 2>conftest.err &&
2693d13e800Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2703d13e800Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2713d13e800Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2723d13e800Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2733d13e800Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2743d13e800Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2753d13e800Smrg      # that says an option was ignored or not supported.
2763d13e800Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2773d13e800Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2783d13e800Smrg      # The diagnosis changed in icc 8.0:
2793d13e800Smrg      #   icc: Command line remark: option '-MP' not supported
2803d13e800Smrg      if (grep 'ignoring option' conftest.err ||
2813d13e800Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2823d13e800Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2833d13e800Smrg        break
2843d13e800Smrg      fi
2853d13e800Smrg    fi
2863d13e800Smrg  done
2878255a313Smrg
2883d13e800Smrg  cd ..
2893d13e800Smrg  rm -rf conftest.dir
2903d13e800Smrgelse
2913d13e800Smrg  am_cv_$1_dependencies_compiler_type=none
2923d13e800Smrgfi
2933d13e800Smrg])
2943d13e800SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2953d13e800SmrgAM_CONDITIONAL([am__fastdep$1], [
2963d13e800Smrg  test "x$enable_dependency_tracking" != xno \
2973d13e800Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2988255a313Smrg])
2998255a313Smrg
3008255a313Smrg
3013d13e800Smrg# AM_SET_DEPDIR
3023d13e800Smrg# -------------
3033d13e800Smrg# Choose a directory name for dependency files.
3043d13e800Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3053d13e800SmrgAC_DEFUN([AM_SET_DEPDIR],
3063d13e800Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3073d13e800SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3083d13e800Smrg])
3098255a313Smrg
3108255a313Smrg
3113d13e800Smrg# AM_DEP_TRACK
3123d13e800Smrg# ------------
3133d13e800SmrgAC_DEFUN([AM_DEP_TRACK],
3143d13e800Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3153d13e800SmrgAS_HELP_STRING(
3163d13e800Smrg  [--enable-dependency-tracking],
3173d13e800Smrg  [do not reject slow dependency extractors])
3183d13e800SmrgAS_HELP_STRING(
3193d13e800Smrg  [--disable-dependency-tracking],
3203d13e800Smrg  [speeds up one-time build])])
3213d13e800Smrgif test "x$enable_dependency_tracking" != xno; then
3223d13e800Smrg  am_depcomp="$ac_aux_dir/depcomp"
3233d13e800Smrg  AMDEPBACKSLASH='\'
3243d13e800Smrg  am__nodep='_no'
3253d13e800Smrgfi
3263d13e800SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3273d13e800SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3283d13e800Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3293d13e800SmrgAC_SUBST([am__nodep])dnl
3303d13e800Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33101395c31Smrg])
3328255a313Smrg
3333d13e800Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3343d13e800Smrg
3353d13e800Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3368255a313Smrg#
3373d13e800Smrg# This file is free software; the Free Software Foundation
3383d13e800Smrg# gives unlimited permission to copy and/or distribute it,
3393d13e800Smrg# with or without modifications, as long as this notice is preserved.
3408255a313Smrg
3413d13e800Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3423d13e800Smrg# ------------------------------
3433d13e800SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3443d13e800Smrg[{
3453d13e800Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3463d13e800Smrg  # are listed without --file.  Let's play safe and only enable the eval
3473d13e800Smrg  # if we detect the quoting.
3483d13e800Smrg  # TODO: see whether this extra hack can be removed once we start
3493d13e800Smrg  # requiring Autoconf 2.70 or later.
3503d13e800Smrg  AS_CASE([$CONFIG_FILES],
3513d13e800Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523d13e800Smrg          [*], [set x $CONFIG_FILES])
3533d13e800Smrg  shift
3543d13e800Smrg  # Used to flag and report bootstrapping failures.
3553d13e800Smrg  am_rc=0
3563d13e800Smrg  for am_mf
3573d13e800Smrg  do
3583d13e800Smrg    # Strip MF so we end up with the name of the file.
3593d13e800Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603d13e800Smrg    # Check whether this is an Automake generated Makefile which includes
3613d13e800Smrg    # dependency-tracking related rules and includes.
3623d13e800Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3633d13e800Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643d13e800Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653d13e800Smrg      || continue
3663d13e800Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673d13e800Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683d13e800Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3693d13e800Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703d13e800Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3713d13e800Smrg  done
3723d13e800Smrg  if test $am_rc -ne 0; then
3733d13e800Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743d13e800Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3753d13e800Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3763d13e800Smrg    necessary).  You can also try re-running configure with the
3773d13e800Smrg    '--disable-dependency-tracking' option to at least be able to build
3783d13e800Smrg    the package (albeit without support for automatic dependency tracking).])
3793d13e800Smrg  fi
3803d13e800Smrg  AS_UNSET([am_dirpart])
3813d13e800Smrg  AS_UNSET([am_filepart])
3823d13e800Smrg  AS_UNSET([am_mf])
3833d13e800Smrg  AS_UNSET([am_rc])
3843d13e800Smrg  rm -f conftest-deps.mk
3853d13e800Smrg}
3863d13e800Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38701395c31Smrg
3888255a313Smrg
3893d13e800Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3903d13e800Smrg# -----------------------------
3913d13e800Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3928255a313Smrg#
3933d13e800Smrg# This code is only required when automatic dependency tracking is enabled.
3943d13e800Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953d13e800Smrg# order to bootstrap the dependency handling code.
3963d13e800SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3973d13e800Smrg[AC_CONFIG_COMMANDS([depfiles],
3983d13e800Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993d13e800Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40092bb16f8Smrg
4013d13e800Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40292bb16f8Smrg
4033d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4043d13e800Smrg#
4053d13e800Smrg# This file is free software; the Free Software Foundation
4063d13e800Smrg# gives unlimited permission to copy and/or distribute it,
4073d13e800Smrg# with or without modifications, as long as this notice is preserved.
40801395c31Smrg
4093d13e800Smrg# This macro actually does too much.  Some checks are only needed if
4103d13e800Smrg# your package does certain things.  But this isn't really a big deal.
41101395c31Smrg
4123d13e800Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4133d13e800Smrgm4_define([AC_PROG_CC],
4143d13e800Smrgm4_defn([AC_PROG_CC])
4153d13e800Smrg[_AM_PROG_CC_C_O
4163d13e800Smrg])
41792bb16f8Smrg
4183d13e800Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4193d13e800Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4203d13e800Smrg# -----------------------------------------------
4213d13e800Smrg# The call with PACKAGE and VERSION arguments is the old style
4223d13e800Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4233d13e800Smrg# and VERSION should now be passed to AC_INIT and removed from
4243d13e800Smrg# the call to AM_INIT_AUTOMAKE.
4253d13e800Smrg# We support both call styles for the transition.  After
4263d13e800Smrg# the next Automake release, Autoconf can make the AC_INIT
4273d13e800Smrg# arguments mandatory, and then we can depend on a new Autoconf
4283d13e800Smrg# release and drop the old call support.
4293d13e800SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4303d13e800Smrg[AC_PREREQ([2.65])dnl
4313d13e800Smrgm4_ifdef([_$0_ALREADY_INIT],
4323d13e800Smrg  [m4_fatal([$0 expanded multiple times
4333d13e800Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343d13e800Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4353d13e800Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4363d13e800Smrgdnl the ones we care about.
4373d13e800Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4383d13e800SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4393d13e800SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4403d13e800Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4413d13e800Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4423d13e800Smrg  # is not polluted with repeated "-I."
4433d13e800Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4443d13e800Smrg  # test to see if srcdir already configured
4453d13e800Smrg  if test -f $srcdir/config.status; then
4463d13e800Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4473d13e800Smrg  fi
44892bb16f8Smrgfi
44992bb16f8Smrg
4503d13e800Smrg# test whether we have cygpath
4513d13e800Smrgif test -z "$CYGPATH_W"; then
4523d13e800Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4533d13e800Smrg    CYGPATH_W='cygpath -w'
4543d13e800Smrg  else
4553d13e800Smrg    CYGPATH_W=echo
4563d13e800Smrg  fi
4573d13e800Smrgfi
4583d13e800SmrgAC_SUBST([CYGPATH_W])
45992bb16f8Smrg
4603d13e800Smrg# Define the identity of the package.
4613d13e800Smrgdnl Distinguish between old-style and new-style calls.
4623d13e800Smrgm4_ifval([$2],
4633d13e800Smrg[AC_DIAGNOSE([obsolete],
4643d13e800Smrg             [$0: two- and three-arguments forms are deprecated.])
4653d13e800Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4663d13e800Smrg AC_SUBST([PACKAGE], [$1])dnl
4673d13e800Smrg AC_SUBST([VERSION], [$2])],
4683d13e800Smrg[_AM_SET_OPTIONS([$1])dnl
4693d13e800Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4703d13e800Smrgm4_if(
4713d13e800Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4723d13e800Smrg  [ok:ok],,
4733d13e800Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4743d13e800Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4753d13e800Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47692bb16f8Smrg
4773d13e800Smrg_AM_IF_OPTION([no-define],,
4783d13e800Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4793d13e800Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48092bb16f8Smrg
4813d13e800Smrg# Some tools Automake needs.
4823d13e800SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4833d13e800SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4843d13e800SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4853d13e800SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4863d13e800SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4873d13e800SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4883d13e800SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4893d13e800SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4903d13e800SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4913d13e800SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4923d13e800Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4933d13e800Smrg# dies out for good.  For more background, see:
4943d13e800Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953d13e800Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4963d13e800SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4973d13e800Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4983d13e800Smrg# system "awk" is bad on some platforms.
4993d13e800SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5003d13e800SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5013d13e800SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5023d13e800Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5033d13e800Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5043d13e800Smrg			     [_AM_PROG_TAR([v7])])])
5053d13e800Smrg_AM_IF_OPTION([no-dependencies],,
5063d13e800Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5073d13e800Smrg		  [_AM_DEPENDENCIES([CC])],
5083d13e800Smrg		  [m4_define([AC_PROG_CC],
5093d13e800Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5103d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5113d13e800Smrg		  [_AM_DEPENDENCIES([CXX])],
5123d13e800Smrg		  [m4_define([AC_PROG_CXX],
5133d13e800Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5143d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5153d13e800Smrg		  [_AM_DEPENDENCIES([OBJC])],
5163d13e800Smrg		  [m4_define([AC_PROG_OBJC],
5173d13e800Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5183d13e800SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5193d13e800Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5203d13e800Smrg		  [m4_define([AC_PROG_OBJCXX],
5213d13e800Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5223d13e800Smrg])
5233d13e800Smrg# Variables for tags utilities; see am/tags.am
5243d13e800Smrgif test -z "$CTAGS"; then
5253d13e800Smrg  CTAGS=ctags
5263d13e800Smrgfi
5273d13e800SmrgAC_SUBST([CTAGS])
5283d13e800Smrgif test -z "$ETAGS"; then
5293d13e800Smrg  ETAGS=etags
5303d13e800Smrgfi
5313d13e800SmrgAC_SUBST([ETAGS])
5323d13e800Smrgif test -z "$CSCOPE"; then
5333d13e800Smrg  CSCOPE=cscope
5343d13e800Smrgfi
5353d13e800SmrgAC_SUBST([CSCOPE])
5368255a313Smrg
5373d13e800SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5383d13e800Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5393d13e800Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5403d13e800Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5413d13e800SmrgAC_CONFIG_COMMANDS_PRE(dnl
5423d13e800Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5433d13e800Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54492bb16f8Smrg
5453d13e800Smrg# POSIX will say in a future version that running "rm -f" with no argument
5463d13e800Smrg# is OK; and we want to be able to make that assumption in our Makefile
5473d13e800Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5483d13e800Smrg# actually supported "in the wild" to an acceptable degree.
5493d13e800Smrg# See automake bug#10828.
5503d13e800Smrg# To make any issue more visible, cause the running configure to be aborted
5513d13e800Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5523d13e800Smrg# user can still override this though.
5533d13e800Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5543d13e800Smrg  cat >&2 <<'END'
5553d13e800SmrgOops!
55692bb16f8Smrg
5573d13e800SmrgYour 'rm' program seems unable to run without file operands specified
5583d13e800Smrgon the command line, even when the '-f' option is present.  This is contrary
5593d13e800Smrgto the behaviour of most rm programs out there, and not conforming with
5603d13e800Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56192bb16f8Smrg
5623d13e800SmrgPlease tell bug-automake@gnu.org about your system, including the value
5633d13e800Smrgof your $PATH and any error possibly output before this message.  This
5643d13e800Smrgcan help us improve future automake versions.
56592bb16f8Smrg
5663d13e800SmrgEND
5673d13e800Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5683d13e800Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5693d13e800Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5703d13e800Smrg    echo >&2
5713d13e800Smrg  else
5723d13e800Smrg    cat >&2 <<'END'
5733d13e800SmrgAborting the configuration process, to ensure you take notice of the issue.
57492bb16f8Smrg
5753d13e800SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5763d13e800Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57792bb16f8Smrg
5783d13e800SmrgIf you want to complete the configuration process using your problematic
5793d13e800Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5803d13e800Smrgto "yes", and re-run configure.
58192bb16f8Smrg
5823d13e800SmrgEND
5833d13e800Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5843d13e800Smrg  fi
5853d13e800Smrgfi
5863d13e800Smrgdnl The trailing newline in this macro's definition is deliberate, for
5873d13e800Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5883d13e800Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5893d13e800Smrg])
590de7ed6e8Smrg
5913d13e800Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5923d13e800Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5933d13e800Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5943d13e800Smrgm4_define([_AC_COMPILER_EXEEXT],
5953d13e800Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596de7ed6e8Smrg
5973d13e800Smrg# When config.status generates a header, we must update the stamp-h file.
5983d13e800Smrg# This file resides in the same directory as the config header
5993d13e800Smrg# that is generated.  The stamp files are numbered to have different names.
600de7ed6e8Smrg
6013d13e800Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6023d13e800Smrg# loop where config.status creates the headers, so we can generate
6033d13e800Smrg# our stamp files there.
6043d13e800SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6053d13e800Smrg[# Compute $1's index in $config_headers.
6063d13e800Smrg_am_arg=$1
6073d13e800Smrg_am_stamp_count=1
6083d13e800Smrgfor _am_header in $config_headers :; do
6093d13e800Smrg  case $_am_header in
6103d13e800Smrg    $_am_arg | $_am_arg:* )
6113d13e800Smrg      break ;;
6123d13e800Smrg    * )
6133d13e800Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6143d13e800Smrg  esac
6153d13e800Smrgdone
6163d13e800Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617de7ed6e8Smrg
6183d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6193d13e800Smrg#
6203d13e800Smrg# This file is free software; the Free Software Foundation
6213d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6223d13e800Smrg# with or without modifications, as long as this notice is preserved.
623de7ed6e8Smrg
6243d13e800Smrg# AM_PROG_INSTALL_SH
6253d13e800Smrg# ------------------
6263d13e800Smrg# Define $install_sh.
6273d13e800SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6283d13e800Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6293d13e800Smrgif test x"${install_sh+set}" != xset; then
6303d13e800Smrg  case $am_aux_dir in
6313d13e800Smrg  *\ * | *\	*)
6323d13e800Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6333d13e800Smrg  *)
6343d13e800Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6353d13e800Smrg  esac
6363d13e800Smrgfi
6373d13e800SmrgAC_SUBST([install_sh])])
6388255a313Smrg
6393d13e800Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6403d13e800Smrg#
6413d13e800Smrg# This file is free software; the Free Software Foundation
6423d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6433d13e800Smrg# with or without modifications, as long as this notice is preserved.
64401395c31Smrg
6453d13e800Smrg# Check whether the underlying file-system supports filenames
6463d13e800Smrg# with a leading dot.  For instance MS-DOS doesn't.
6473d13e800SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6483d13e800Smrg[rm -rf .tst 2>/dev/null
6493d13e800Smrgmkdir .tst 2>/dev/null
6503d13e800Smrgif test -d .tst; then
6513d13e800Smrg  am__leading_dot=.
6523d13e800Smrgelse
6533d13e800Smrg  am__leading_dot=_
6543d13e800Smrgfi
6553d13e800Smrgrmdir .tst 2>/dev/null
6563d13e800SmrgAC_SUBST([am__leading_dot])])
65701395c31Smrg
6583d13e800Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65901395c31Smrg
6603d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6613d13e800Smrg#
6623d13e800Smrg# This file is free software; the Free Software Foundation
6633d13e800Smrg# gives unlimited permission to copy and/or distribute it,
6643d13e800Smrg# with or without modifications, as long as this notice is preserved.
66501395c31Smrg
6663d13e800Smrg# AM_MAKE_INCLUDE()
6673d13e800Smrg# -----------------
6683d13e800Smrg# Check whether make has an 'include' directive that can support all
6693d13e800Smrg# the idioms we need for our automatic dependency tracking code.
6703d13e800SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6713d13e800Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6723d13e800Smrgcat > confinc.mk << 'END'
6733d13e800Smrgam__doit:
6743d13e800Smrg	@echo this is the am__doit target >confinc.out
6753d13e800Smrg.PHONY: am__doit
6763d13e800SmrgEND
6773d13e800Smrgam__include="#"
6783d13e800Smrgam__quote=
6793d13e800Smrg# BSD make does it like this.
6803d13e800Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6813d13e800Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6823d13e800Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6833d13e800Smrg_am_result=no
6843d13e800Smrgfor s in GNU BSD; do
6853d13e800Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6863d13e800Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6873d13e800Smrg      ['0:this is the am__doit target'],
6883d13e800Smrg      [AS_CASE([$s],
6893d13e800Smrg          [BSD], [am__include='.include' am__quote='"'],
6903d13e800Smrg          [am__include='include' am__quote=''])])
6913d13e800Smrg  if test "$am__include" != "#"; then
6923d13e800Smrg    _am_result="yes ($s style)"
6933d13e800Smrg    break
6943d13e800Smrg  fi
6953d13e800Smrgdone
6963d13e800Smrgrm -f confinc.* confmf.*
6973d13e800SmrgAC_MSG_RESULT([${_am_result}])
6983d13e800SmrgAC_SUBST([am__include])])
6993d13e800SmrgAC_SUBST([am__quote])])
7008255a313Smrg
7013d13e800Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7028255a313Smrg
7033d13e800Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7043d13e800Smrg#
7053d13e800Smrg# This file is free software; the Free Software Foundation
7063d13e800Smrg# gives unlimited permission to copy and/or distribute it,
7073d13e800Smrg# with or without modifications, as long as this notice is preserved.
70892bb16f8Smrg
7093d13e800Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7103d13e800Smrg# ------------------------------
7113d13e800SmrgAC_DEFUN([AM_MISSING_PROG],
7123d13e800Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7133d13e800Smrg$1=${$1-"${am_missing_run}$2"}
7143d13e800SmrgAC_SUBST($1)])
71592bb16f8Smrg
7163d13e800Smrg# AM_MISSING_HAS_RUN
7173d13e800Smrg# ------------------
7183d13e800Smrg# Define MISSING if not defined so far and test if it is modern enough.
7193d13e800Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7203d13e800SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7213d13e800Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7223d13e800SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7233d13e800Smrgif test x"${MISSING+set}" != xset; then
7243d13e800Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7253d13e800Smrgfi
7263d13e800Smrg# Use eval to expand $SHELL
7273d13e800Smrgif eval "$MISSING --is-lightweight"; then
7283d13e800Smrg  am_missing_run="$MISSING "
7293d13e800Smrgelse
7303d13e800Smrg  am_missing_run=
7313d13e800Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7323d13e800Smrgfi
7333d13e800Smrg])
73492bb16f8Smrg
7353d13e800Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73692bb16f8Smrg
7373d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73801395c31Smrg#
7393d13e800Smrg# This file is free software; the Free Software Foundation
7403d13e800Smrg# gives unlimited permission to copy and/or distribute it,
7413d13e800Smrg# with or without modifications, as long as this notice is preserved.
74292bb16f8Smrg
7433d13e800Smrg# _AM_MANGLE_OPTION(NAME)
7443d13e800Smrg# -----------------------
7453d13e800SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7463d13e800Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7473d13e800Smrg
7483d13e800Smrg# _AM_SET_OPTION(NAME)
7493d13e800Smrg# --------------------
7503d13e800Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7513d13e800SmrgAC_DEFUN([_AM_SET_OPTION],
7523d13e800Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7533d13e800Smrg
7543d13e800Smrg# _AM_SET_OPTIONS(OPTIONS)
7553d13e800Smrg# ------------------------
7563d13e800Smrg# OPTIONS is a space-separated list of Automake options.
7573d13e800SmrgAC_DEFUN([_AM_SET_OPTIONS],
7583d13e800Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7593d13e800Smrg
7603d13e800Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7613d13e800Smrg# -------------------------------------------
7623d13e800Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7633d13e800SmrgAC_DEFUN([_AM_IF_OPTION],
7643d13e800Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7653d13e800Smrg
7663d13e800Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76701395c31Smrg#
7683d13e800Smrg# This file is free software; the Free Software Foundation
7693d13e800Smrg# gives unlimited permission to copy and/or distribute it,
7703d13e800Smrg# with or without modifications, as long as this notice is preserved.
77101395c31Smrg
7723d13e800Smrg# _AM_PROG_CC_C_O
7733d13e800Smrg# ---------------
7743d13e800Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7753d13e800Smrg# to automatically call this.
7763d13e800SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7773d13e800Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7783d13e800SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7793d13e800SmrgAC_LANG_PUSH([C])dnl
7803d13e800SmrgAC_CACHE_CHECK(
7813d13e800Smrg  [whether $CC understands -c and -o together],
7823d13e800Smrg  [am_cv_prog_cc_c_o],
7833d13e800Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7843d13e800Smrg  # Make sure it works both with $CC and with simple cc.
7853d13e800Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7863d13e800Smrg  # compilers refuse to overwrite an existing .o file with -o,
7873d13e800Smrg  # though they will create one.
7883d13e800Smrg  am_cv_prog_cc_c_o=yes
7893d13e800Smrg  for am_i in 1 2; do
7903d13e800Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7913d13e800Smrg         && test -f conftest2.$ac_objext; then
7923d13e800Smrg      : OK
7933d13e800Smrg    else
7943d13e800Smrg      am_cv_prog_cc_c_o=no
7953d13e800Smrg      break
7963d13e800Smrg    fi
7973d13e800Smrg  done
7983d13e800Smrg  rm -f core conftest*
7993d13e800Smrg  unset am_i])
8003d13e800Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8013d13e800Smrg   # Losing compiler, so override with the script.
8023d13e800Smrg   # FIXME: It is wrong to rewrite CC.
8033d13e800Smrg   # But if we don't then we get into trouble of one sort or another.
8043d13e800Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8053d13e800Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8063d13e800Smrg   CC="$am_aux_dir/compile $CC"
8078255a313Smrgfi
8083d13e800SmrgAC_LANG_POP([C])])
80901395c31Smrg
8103d13e800Smrg# For backward compatibility.
8113d13e800SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81292bb16f8Smrg
8133d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81492bb16f8Smrg#
8153d13e800Smrg# This file is free software; the Free Software Foundation
8163d13e800Smrg# gives unlimited permission to copy and/or distribute it,
8173d13e800Smrg# with or without modifications, as long as this notice is preserved.
81892bb16f8Smrg
8193d13e800Smrg# AM_RUN_LOG(COMMAND)
8203d13e800Smrg# -------------------
8213d13e800Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8223d13e800Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8233d13e800SmrgAC_DEFUN([AM_RUN_LOG],
8243d13e800Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8253d13e800Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8263d13e800Smrg   ac_status=$?
8273d13e800Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8283d13e800Smrg   (exit $ac_status); }])
82992bb16f8Smrg
8303d13e800Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83192bb16f8Smrg
8323d13e800Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8333d13e800Smrg#
8343d13e800Smrg# This file is free software; the Free Software Foundation
8353d13e800Smrg# gives unlimited permission to copy and/or distribute it,
8363d13e800Smrg# with or without modifications, as long as this notice is preserved.
83792bb16f8Smrg
8383d13e800Smrg# AM_SANITY_CHECK
8393d13e800Smrg# ---------------
8403d13e800SmrgAC_DEFUN([AM_SANITY_CHECK],
8413d13e800Smrg[AC_MSG_CHECKING([whether build environment is sane])
8423d13e800Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8433d13e800Smrg# name.  Accept space and tab only in the latter.
8443d13e800Smrgam_lf='
8453d13e800Smrg'
8463d13e800Smrgcase `pwd` in
8473d13e800Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8483d13e800Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8493d13e800Smrgesac
8503d13e800Smrgcase $srcdir in
8513d13e800Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8523d13e800Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8533d13e800Smrgesac
85492bb16f8Smrg
8553d13e800Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8563d13e800Smrg# arguments.  Must try -L first in case configure is actually a
8573d13e800Smrg# symlink; some systems play weird games with the mod time of symlinks
8583d13e800Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8593d13e800Smrg# directory).
8603d13e800Smrgif (
8613d13e800Smrg   am_has_slept=no
8623d13e800Smrg   for am_try in 1 2; do
8633d13e800Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8643d13e800Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8653d13e800Smrg     if test "$[*]" = "X"; then
8663d13e800Smrg	# -L didn't work.
8673d13e800Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8683d13e800Smrg     fi
8693d13e800Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8703d13e800Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87192bb16f8Smrg
8723d13e800Smrg	# If neither matched, then we have a broken ls.  This can happen
8733d13e800Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8743d13e800Smrg	# broken ls alias from the environment.  This has actually
8753d13e800Smrg	# happened.  Such a system could not be considered "sane".
8763d13e800Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8773d13e800Smrg  alias in your environment])
8783d13e800Smrg     fi
8793d13e800Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8803d13e800Smrg       break
8813d13e800Smrg     fi
8823d13e800Smrg     # Just in case.
8833d13e800Smrg     sleep 1
8843d13e800Smrg     am_has_slept=yes
8853d13e800Smrg   done
8863d13e800Smrg   test "$[2]" = conftest.file
8873d13e800Smrg   )
8883d13e800Smrgthen
8893d13e800Smrg   # Ok.
8903d13e800Smrg   :
8913d13e800Smrgelse
8923d13e800Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8933d13e800SmrgCheck your system clock])
89401395c31Smrgfi
8953d13e800SmrgAC_MSG_RESULT([yes])
8963d13e800Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8973d13e800Smrg# generated files are strictly newer.
8983d13e800Smrgam_sleep_pid=
8993d13e800Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9003d13e800Smrg  ( sleep 1 ) &
9013d13e800Smrg  am_sleep_pid=$!
90201395c31Smrgfi
9033d13e800SmrgAC_CONFIG_COMMANDS_PRE(
9043d13e800Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9053d13e800Smrg   if test -n "$am_sleep_pid"; then
9063d13e800Smrg     # Hide warnings about reused PIDs.
9073d13e800Smrg     wait $am_sleep_pid 2>/dev/null
9083d13e800Smrg   fi
9093d13e800Smrg   AC_MSG_RESULT([done])])
9103d13e800Smrgrm -f conftest.file
9113d13e800Smrg])
91292bb16f8Smrg
9133d13e800Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9143d13e800Smrg#
9153d13e800Smrg# This file is free software; the Free Software Foundation
9163d13e800Smrg# gives unlimited permission to copy and/or distribute it,
9173d13e800Smrg# with or without modifications, as long as this notice is preserved.
91892bb16f8Smrg
9193d13e800Smrg# AM_SILENT_RULES([DEFAULT])
9203d13e800Smrg# --------------------------
9213d13e800Smrg# Enable less verbose build rules; with the default set to DEFAULT
9223d13e800Smrg# ("yes" being less verbose, "no" or empty being verbose).
9233d13e800SmrgAC_DEFUN([AM_SILENT_RULES],
9243d13e800Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9253d13e800SmrgAS_HELP_STRING(
9263d13e800Smrg  [--enable-silent-rules],
9273d13e800Smrg  [less verbose build output (undo: "make V=1")])
9283d13e800SmrgAS_HELP_STRING(
9293d13e800Smrg  [--disable-silent-rules],
9303d13e800Smrg  [verbose build output (undo: "make V=0")])dnl
9313d13e800Smrg])
9323d13e800Smrgcase $enable_silent_rules in @%:@ (((
9333d13e800Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9343d13e800Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9353d13e800Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9363d13e800Smrgesac
9373d13e800Smrgdnl
9383d13e800Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9393d13e800Smrgdnl do not support nested variable expansions.
9403d13e800Smrgdnl See automake bug#9928 and bug#10237.
9413d13e800Smrgam_make=${MAKE-make}
9423d13e800SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9433d13e800Smrg   [am_cv_make_support_nested_variables],
9443d13e800Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9453d13e800SmrgBAR0=false
9463d13e800SmrgBAR1=true
9473d13e800SmrgV=1
9483d13e800Smrgam__doit:
9493d13e800Smrg	@$(TRUE)
9503d13e800Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9513d13e800Smrg  am_cv_make_support_nested_variables=yes
95292bb16f8Smrgelse
9533d13e800Smrg  am_cv_make_support_nested_variables=no
9543d13e800Smrgfi])
9553d13e800Smrgif test $am_cv_make_support_nested_variables = yes; then
9563d13e800Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9573d13e800Smrg  AM_V='$(V)'
9583d13e800Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9593d13e800Smrgelse
9603d13e800Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9613d13e800Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96292bb16f8Smrgfi
9633d13e800SmrgAC_SUBST([AM_V])dnl
9643d13e800SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9653d13e800SmrgAC_SUBST([AM_DEFAULT_V])dnl
9663d13e800SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9673d13e800SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9683d13e800SmrgAM_BACKSLASH='\'
9693d13e800SmrgAC_SUBST([AM_BACKSLASH])dnl
9703d13e800Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9713d13e800Smrg])
97292bb16f8Smrg
9733d13e800Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97401395c31Smrg#
9753d13e800Smrg# This file is free software; the Free Software Foundation
9763d13e800Smrg# gives unlimited permission to copy and/or distribute it,
9773d13e800Smrg# with or without modifications, as long as this notice is preserved.
97892bb16f8Smrg
9793d13e800Smrg# AM_PROG_INSTALL_STRIP
9803d13e800Smrg# ---------------------
9813d13e800Smrg# One issue with vendor 'install' (even GNU) is that you can't
9823d13e800Smrg# specify the program used to strip binaries.  This is especially
9833d13e800Smrg# annoying in cross-compiling environments, where the build's strip
9843d13e800Smrg# is unlikely to handle the host's binaries.
9853d13e800Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9863d13e800Smrg# always use install-sh in "make install-strip", and initialize
9873d13e800Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9883d13e800SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9893d13e800Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9903d13e800Smrg# Installed binaries are usually stripped using 'strip' when the user
9913d13e800Smrg# run "make install-strip".  However 'strip' might not be the right
9923d13e800Smrg# tool to use in cross-compilation environments, therefore Automake
9933d13e800Smrg# will honor the 'STRIP' environment variable to overrule this program.
9943d13e800Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9953d13e800Smrgif test "$cross_compiling" != no; then
9963d13e800Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99792bb16f8Smrgfi
9983d13e800SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9993d13e800SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100092bb16f8Smrg
10013d13e800Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10023d13e800Smrg#
10033d13e800Smrg# This file is free software; the Free Software Foundation
10043d13e800Smrg# gives unlimited permission to copy and/or distribute it,
10053d13e800Smrg# with or without modifications, as long as this notice is preserved.
10068255a313Smrg
10073d13e800Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10083d13e800Smrg# ---------------------------
10093d13e800Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10103d13e800Smrg# This macro is traced by Automake.
10113d13e800SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10128255a313Smrg
10133d13e800Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10143d13e800Smrg# --------------------------
10153d13e800Smrg# Public sister of _AM_SUBST_NOTMAKE.
10163d13e800SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10178255a313Smrg
10183d13e800Smrg# Check how to create a tarball.                            -*- Autoconf -*-
10198255a313Smrg
10203d13e800Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10213d13e800Smrg#
10223d13e800Smrg# This file is free software; the Free Software Foundation
10233d13e800Smrg# gives unlimited permission to copy and/or distribute it,
10243d13e800Smrg# with or without modifications, as long as this notice is preserved.
102592bb16f8Smrg
10263d13e800Smrg# _AM_PROG_TAR(FORMAT)
10273d13e800Smrg# --------------------
10283d13e800Smrg# Check how to create a tarball in format FORMAT.
10293d13e800Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10303d13e800Smrg#
10313d13e800Smrg# Substitute a variable $(am__tar) that is a command
10323d13e800Smrg# writing to stdout a FORMAT-tarball containing the directory
10333d13e800Smrg# $tardir.
10343d13e800Smrg#     tardir=directory && $(am__tar) > result.tar
10353d13e800Smrg#
10363d13e800Smrg# Substitute a variable $(am__untar) that extract such
10373d13e800Smrg# a tarball read from stdin.
10383d13e800Smrg#     $(am__untar) < result.tar
10393d13e800Smrg#
10403d13e800SmrgAC_DEFUN([_AM_PROG_TAR],
10413d13e800Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10423d13e800Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10433d13e800SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104492bb16f8Smrg
10453d13e800Smrg# We'll loop over all known methods to create a tar archive until one works.
10463d13e800Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104792bb16f8Smrg
10483d13e800Smrgm4_if([$1], [v7],
10493d13e800Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105001395c31Smrg
10513d13e800Smrg  [m4_case([$1],
10523d13e800Smrg    [ustar],
10533d13e800Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10543d13e800Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10553d13e800Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10563d13e800Smrg      # and bug#13588).
10573d13e800Smrg      am_max_uid=2097151 # 2^21 - 1
10583d13e800Smrg      am_max_gid=$am_max_uid
10593d13e800Smrg      # The $UID and $GID variables are not portable, so we need to resort
10603d13e800Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10613d13e800Smrg      # below are definitely unexpected, so allow the users to see them
10623d13e800Smrg      # (that is, avoid stderr redirection).
10633d13e800Smrg      am_uid=`id -u || echo unknown`
10643d13e800Smrg      am_gid=`id -g || echo unknown`
10653d13e800Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10663d13e800Smrg      if test $am_uid -le $am_max_uid; then
10673d13e800Smrg         AC_MSG_RESULT([yes])
10683d13e800Smrg      else
10693d13e800Smrg         AC_MSG_RESULT([no])
10703d13e800Smrg         _am_tools=none
10713d13e800Smrg      fi
10723d13e800Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10733d13e800Smrg      if test $am_gid -le $am_max_gid; then
10743d13e800Smrg         AC_MSG_RESULT([yes])
10753d13e800Smrg      else
10763d13e800Smrg        AC_MSG_RESULT([no])
10773d13e800Smrg        _am_tools=none
10783d13e800Smrg      fi],
107992bb16f8Smrg
10803d13e800Smrg  [pax],
10813d13e800Smrg    [],
108292bb16f8Smrg
10833d13e800Smrg  [m4_fatal([Unknown tar format])])
108492bb16f8Smrg
10853d13e800Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108692bb16f8Smrg
10873d13e800Smrg  # Go ahead even if we have the value already cached.  We do so because we
10883d13e800Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10893d13e800Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10908255a313Smrg
10913d13e800Smrg  for _am_tool in $_am_tools; do
10923d13e800Smrg    case $_am_tool in
10933d13e800Smrg    gnutar)
10943d13e800Smrg      for _am_tar in tar gnutar gtar; do
10953d13e800Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10963d13e800Smrg      done
10973d13e800Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10983d13e800Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10993d13e800Smrg      am__untar="$_am_tar -xf -"
11003d13e800Smrg      ;;
11013d13e800Smrg    plaintar)
11023d13e800Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11033d13e800Smrg      # ustar tarball either.
11043d13e800Smrg      (tar --version) >/dev/null 2>&1 && continue
11053d13e800Smrg      am__tar='tar chf - "$$tardir"'
11063d13e800Smrg      am__tar_='tar chf - "$tardir"'
11073d13e800Smrg      am__untar='tar xf -'
11083d13e800Smrg      ;;
11093d13e800Smrg    pax)
11103d13e800Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11113d13e800Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11123d13e800Smrg      am__untar='pax -r'
11133d13e800Smrg      ;;
11143d13e800Smrg    cpio)
11153d13e800Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11163d13e800Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11173d13e800Smrg      am__untar='cpio -i -H $1 -d'
11183d13e800Smrg      ;;
11193d13e800Smrg    none)
11203d13e800Smrg      am__tar=false
11213d13e800Smrg      am__tar_=false
11223d13e800Smrg      am__untar=false
11233d13e800Smrg      ;;
11243d13e800Smrg    esac
112501395c31Smrg
11263d13e800Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11273d13e800Smrg    # and am__untar set.
11283d13e800Smrg    test -n "${am_cv_prog_tar_$1}" && break
112901395c31Smrg
11303d13e800Smrg    # tar/untar a dummy directory, and stop if the command works.
11313d13e800Smrg    rm -rf conftest.dir
11323d13e800Smrg    mkdir conftest.dir
11333d13e800Smrg    echo GrepMe > conftest.dir/file
11343d13e800Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11353d13e800Smrg    rm -rf conftest.dir
11363d13e800Smrg    if test -s conftest.tar; then
11373d13e800Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11383d13e800Smrg      AM_RUN_LOG([cat conftest.dir/file])
11393d13e800Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11403d13e800Smrg    fi
11413d13e800Smrg  done
11423d13e800Smrg  rm -rf conftest.dir
114301395c31Smrg
11443d13e800Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11453d13e800Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114601395c31Smrg
11473d13e800SmrgAC_SUBST([am__tar])
11483d13e800SmrgAC_SUBST([am__untar])
11493d13e800Smrg]) # _AM_PROG_TAR
11508255a313Smrg
11513d13e800Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11523d13e800Smrgdnl serial 11 (pkg-config-0.29)
11533d13e800Smrgdnl
11543d13e800Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11553d13e800Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11563d13e800Smrgdnl
11573d13e800Smrgdnl This program is free software; you can redistribute it and/or modify
11583d13e800Smrgdnl it under the terms of the GNU General Public License as published by
11593d13e800Smrgdnl the Free Software Foundation; either version 2 of the License, or
11603d13e800Smrgdnl (at your option) any later version.
11613d13e800Smrgdnl
11623d13e800Smrgdnl This program is distributed in the hope that it will be useful, but
11633d13e800Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11643d13e800Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11653d13e800Smrgdnl General Public License for more details.
11663d13e800Smrgdnl
11673d13e800Smrgdnl You should have received a copy of the GNU General Public License
11683d13e800Smrgdnl along with this program; if not, write to the Free Software
11693d13e800Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11703d13e800Smrgdnl 02111-1307, USA.
11713d13e800Smrgdnl
11723d13e800Smrgdnl As a special exception to the GNU General Public License, if you
11733d13e800Smrgdnl distribute this file as part of a program that contains a
11743d13e800Smrgdnl configuration script generated by Autoconf, you may include it under
11753d13e800Smrgdnl the same distribution terms that you use for the rest of that
11763d13e800Smrgdnl program.
11773d13e800Smrg
11783d13e800Smrgdnl PKG_PREREQ(MIN-VERSION)
11793d13e800Smrgdnl -----------------------
11803d13e800Smrgdnl Since: 0.29
11813d13e800Smrgdnl
11823d13e800Smrgdnl Verify that the version of the pkg-config macros are at least
11833d13e800Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11843d13e800Smrgdnl installed version of pkg-config, this checks the developer's version
11853d13e800Smrgdnl of pkg.m4 when generating configure.
11863d13e800Smrgdnl
11873d13e800Smrgdnl To ensure that this macro is defined, also add:
11883d13e800Smrgdnl m4_ifndef([PKG_PREREQ],
11893d13e800Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11903d13e800Smrgdnl
11913d13e800Smrgdnl See the "Since" comment for each macro you use to see what version
11923d13e800Smrgdnl of the macros you require.
11933d13e800Smrgm4_defun([PKG_PREREQ],
11943d13e800Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11953d13e800Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11963d13e800Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11973d13e800Smrg])dnl PKG_PREREQ
11983d13e800Smrg
11993d13e800Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12003d13e800Smrgdnl ----------------------------------
12013d13e800Smrgdnl Since: 0.16
12023d13e800Smrgdnl
12033d13e800Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12043d13e800Smrgdnl first found in the path. Checks that the version of pkg-config found
12053d13e800Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12063d13e800Smrgdnl used since that's the first version where most current features of
12073d13e800Smrgdnl pkg-config existed.
12083d13e800SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12093d13e800Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12103d13e800Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12113d13e800Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12123d13e800SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12133d13e800SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12143d13e800SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12153d13e800Smrg
12163d13e800Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12173d13e800Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
121801395c31Smrgfi
12193d13e800Smrgif test -n "$PKG_CONFIG"; then
12203d13e800Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12213d13e800Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12223d13e800Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12233d13e800Smrg		AC_MSG_RESULT([yes])
12243d13e800Smrg	else
12253d13e800Smrg		AC_MSG_RESULT([no])
12263d13e800Smrg		PKG_CONFIG=""
12273d13e800Smrg	fi
12283d13e800Smrgfi[]dnl
12293d13e800Smrg])dnl PKG_PROG_PKG_CONFIG
12308255a313Smrg
12313d13e800Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12323d13e800Smrgdnl -------------------------------------------------------------------
12333d13e800Smrgdnl Since: 0.18
12343d13e800Smrgdnl
12353d13e800Smrgdnl Check to see whether a particular set of modules exists. Similar to
12363d13e800Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12373d13e800Smrgdnl
12383d13e800Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12393d13e800Smrgdnl only at the first occurence in configure.ac, so if the first place
12403d13e800Smrgdnl it's called might be skipped (such as if it is within an "if", you
12413d13e800Smrgdnl have to call PKG_CHECK_EXISTS manually
12423d13e800SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12433d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12443d13e800Smrgif test -n "$PKG_CONFIG" && \
12453d13e800Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12463d13e800Smrg  m4_default([$2], [:])
12473d13e800Smrgm4_ifvaln([$3], [else
12483d13e800Smrg  $3])dnl
124901395c31Smrgfi])
12508255a313Smrg
12513d13e800Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12523d13e800Smrgdnl ---------------------------------------------
12533d13e800Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12543d13e800Smrgdnl pkg_failed based on the result.
12553d13e800Smrgm4_define([_PKG_CONFIG],
12563d13e800Smrg[if test -n "$$1"; then
12573d13e800Smrg    pkg_cv_[]$1="$$1"
12583d13e800Smrg elif test -n "$PKG_CONFIG"; then
12593d13e800Smrg    PKG_CHECK_EXISTS([$3],
12603d13e800Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12613d13e800Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12623d13e800Smrg		     [pkg_failed=yes])
12633d13e800Smrg else
12643d13e800Smrg    pkg_failed=untried
12653d13e800Smrgfi[]dnl
12663d13e800Smrg])dnl _PKG_CONFIG
12678255a313Smrg
12683d13e800Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12693d13e800Smrgdnl ---------------------------
12703d13e800Smrgdnl Internal check to see if pkg-config supports short errors.
12713d13e800SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12723d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12733d13e800Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12743d13e800Smrg        _pkg_short_errors_supported=yes
127501395c31Smrgelse
12763d13e800Smrg        _pkg_short_errors_supported=no
12773d13e800Smrgfi[]dnl
12783d13e800Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12798255a313Smrg
12808255a313Smrg
12813d13e800Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12823d13e800Smrgdnl   [ACTION-IF-NOT-FOUND])
12833d13e800Smrgdnl --------------------------------------------------------------
12843d13e800Smrgdnl Since: 0.4.0
12853d13e800Smrgdnl
12863d13e800Smrgdnl Note that if there is a possibility the first call to
12873d13e800Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12883d13e800Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12893d13e800SmrgAC_DEFUN([PKG_CHECK_MODULES],
12903d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12913d13e800SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12923d13e800SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12938255a313Smrg
12943d13e800Smrgpkg_failed=no
12953d13e800SmrgAC_MSG_CHECKING([for $1])
12968255a313Smrg
12973d13e800Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12983d13e800Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12998255a313Smrg
13003d13e800Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13013d13e800Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13023d13e800SmrgSee the pkg-config man page for more details.])
13038255a313Smrg
13043d13e800Smrgif test $pkg_failed = yes; then
13053d13e800Smrg   	AC_MSG_RESULT([no])
13063d13e800Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13073d13e800Smrg        if test $_pkg_short_errors_supported = yes; then
13083d13e800Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13093d13e800Smrg        else 
13103d13e800Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13113d13e800Smrg        fi
13123d13e800Smrg	# Put the nasty error message in config.log where it belongs
13133d13e800Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13148255a313Smrg
13153d13e800Smrg	m4_default([$4], [AC_MSG_ERROR(
13163d13e800Smrg[Package requirements ($2) were not met:
1317de7ed6e8Smrg
13183d13e800Smrg$$1_PKG_ERRORS
1319de7ed6e8Smrg
13203d13e800SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13213d13e800Smrginstalled software in a non-standard prefix.
1322de7ed6e8Smrg
13233d13e800Smrg_PKG_TEXT])[]dnl
13243d13e800Smrg        ])
13253d13e800Smrgelif test $pkg_failed = untried; then
13263d13e800Smrg     	AC_MSG_RESULT([no])
13273d13e800Smrg	m4_default([$4], [AC_MSG_FAILURE(
13283d13e800Smrg[The pkg-config script could not be found or is too old.  Make sure it
13293d13e800Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13303d13e800Smrgpath to pkg-config.
1331de7ed6e8Smrg
13323d13e800Smrg_PKG_TEXT
13338255a313Smrg
13343d13e800SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13353d13e800Smrg        ])
13368255a313Smrgelse
13373d13e800Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13383d13e800Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13393d13e800Smrg        AC_MSG_RESULT([yes])
13403d13e800Smrg	$3
13413d13e800Smrgfi[]dnl
13423d13e800Smrg])dnl PKG_CHECK_MODULES
13438255a313Smrg
13448255a313Smrg
13453d13e800Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13463d13e800Smrgdnl   [ACTION-IF-NOT-FOUND])
13473d13e800Smrgdnl ---------------------------------------------------------------------
13483d13e800Smrgdnl Since: 0.29
13493d13e800Smrgdnl
13503d13e800Smrgdnl Checks for existence of MODULES and gathers its build flags with
13513d13e800Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13523d13e800Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13533d13e800Smrgdnl
13543d13e800Smrgdnl Note that if there is a possibility the first call to
13553d13e800Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13563d13e800Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13573d13e800Smrgdnl configure.ac.
13583d13e800SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13593d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13603d13e800Smrg_save_PKG_CONFIG=$PKG_CONFIG
13613d13e800SmrgPKG_CONFIG="$PKG_CONFIG --static"
13623d13e800SmrgPKG_CHECK_MODULES($@)
13633d13e800SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13643d13e800Smrg])dnl PKG_CHECK_MODULES_STATIC
13658255a313Smrg
13668255a313Smrg
13673d13e800Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13683d13e800Smrgdnl -------------------------
13693d13e800Smrgdnl Since: 0.27
13703d13e800Smrgdnl
13713d13e800Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13723d13e800Smrgdnl should install pkg-config .pc files. By default the directory is
13733d13e800Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13743d13e800Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13753d13e800Smrgdnl parameter.
13763d13e800SmrgAC_DEFUN([PKG_INSTALLDIR],
13773d13e800Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13783d13e800Smrgm4_pushdef([pkg_description],
13793d13e800Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13803d13e800SmrgAC_ARG_WITH([pkgconfigdir],
13813d13e800Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13823d13e800Smrg    [with_pkgconfigdir=]pkg_default)
13833d13e800SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13843d13e800Smrgm4_popdef([pkg_default])
13853d13e800Smrgm4_popdef([pkg_description])
13863d13e800Smrg])dnl PKG_INSTALLDIR
13878255a313Smrg
1388de7ed6e8Smrg
13893d13e800Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13903d13e800Smrgdnl --------------------------------
13913d13e800Smrgdnl Since: 0.27
13923d13e800Smrgdnl
13933d13e800Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13943d13e800Smrgdnl module should install arch-independent pkg-config .pc files. By
13953d13e800Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13963d13e800Smrgdnl changed by passing DIRECTORY. The user can override through the
13973d13e800Smrgdnl --with-noarch-pkgconfigdir parameter.
13983d13e800SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13993d13e800Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14003d13e800Smrgm4_pushdef([pkg_description],
14013d13e800Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14023d13e800SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14033d13e800Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14043d13e800Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14053d13e800SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14063d13e800Smrgm4_popdef([pkg_default])
14073d13e800Smrgm4_popdef([pkg_description])
14083d13e800Smrg])dnl PKG_NOARCH_INSTALLDIR
1409de7ed6e8Smrg
14108255a313Smrg
14113d13e800Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14123d13e800Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14133d13e800Smrgdnl -------------------------------------------
14143d13e800Smrgdnl Since: 0.28
14153d13e800Smrgdnl
14163d13e800Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14173d13e800SmrgAC_DEFUN([PKG_CHECK_VAR],
14183d13e800Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14193d13e800SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420de7ed6e8Smrg
14213d13e800Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14223d13e800SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423de7ed6e8Smrg
14243d13e800SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14253d13e800Smrg])dnl PKG_CHECK_VAR
14263d13e800Smrg
14273d13e800Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
14283d13e800Smrgdnl
14293d13e800Smrgdnl This file comes from X.Org's font-util 1.3.2
14303d13e800Smrgdnl
14313d13e800Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
14323d13e800Smrgdnl
14333d13e800Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14343d13e800Smrgdnl copy of this software and associated documentation files (the "Software"),
14353d13e800Smrgdnl to deal in the Software without restriction, including without limitation
14363d13e800Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14373d13e800Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14383d13e800Smrgdnl Software is furnished to do so, subject to the following conditions:
14393d13e800Smrgdnl
14403d13e800Smrgdnl The above copyright notice and this permission notice (including the next
14413d13e800Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14423d13e800Smrgdnl Software.
14433d13e800Smrgdnl
14443d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14453d13e800Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14463d13e800Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14473d13e800Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14483d13e800Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14493d13e800Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14503d13e800Smrgdnl DEALINGS IN THE SOFTWARE.
14513d13e800Smrgdnl
14523d13e800Smrgdnl --------------------------------------------------------------------
14533d13e800Smrgdnl
14543d13e800Smrgdnl Copyright 2005 Red Hat, Inc
14553d13e800Smrgdnl
14563d13e800Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
14573d13e800Smrgdnl documentation for any purpose is hereby granted without fee, provided that
14583d13e800Smrgdnl the above copyright notice appear in all copies and that both that
14593d13e800Smrgdnl copyright notice and this permission notice appear in supporting
14603d13e800Smrgdnl documentation.
14613d13e800Smrgdnl
14623d13e800Smrgdnl The above copyright notice and this permission notice shall be included
14633d13e800Smrgdnl in all copies or substantial portions of the Software.
14643d13e800Smrgdnl
14653d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14663d13e800Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14673d13e800Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
14683d13e800Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
14693d13e800Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
14703d13e800Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
14713d13e800Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
14723d13e800Smrgdnl
14733d13e800Smrgdnl Except as contained in this notice, the name of the copyright holders shall
14743d13e800Smrgdnl not be used in advertising or otherwise to promote the sale, use or
14753d13e800Smrgdnl other dealings in this Software without prior written authorization
14763d13e800Smrgdnl from the copyright holders.
14773d13e800Smrg
14783d13e800Smrg# XORG_FONT_MACROS_VERSION(required-version)
14793d13e800Smrg# ------------------------------------------
14803d13e800Smrg# Minimum version: 1.1.0
148101395c31Smrg#
14823d13e800Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14833d13e800Smrg# your configure.ac with the minimum required version, such as:
14843d13e800Smrg# XORG_FONT_MACROS_VERSION(1.1)
148501395c31Smrg#
14863d13e800Smrg# To ensure that this macro is defined, also add:
14873d13e800Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
14883d13e800Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
148901395c31Smrg#
149001395c31Smrg#
14913d13e800Smrg# See the "minimum version" comment for each macro you use to see what
14923d13e800Smrg# version you require.
14933d13e800Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
14943d13e800Smrgm4_define([vers_have], [1.3.2])
14953d13e800Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14963d13e800Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14973d13e800Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14983d13e800Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
14993d13e800Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
15003d13e800Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
15013d13e800Smrgm4_undefine([vers_have])
15023d13e800Smrgm4_undefine([maj_have])
15033d13e800Smrgm4_undefine([maj_needed])
15043d13e800Smrg]) # XORG_FONT_MACROS_VERSION
15053d13e800Smrg
15063d13e800Smrg# XORG_FONT_CHECK_{maps}()
15073d13e800Smrg# ------------------------
15083d13e800Smrg# Minimum version: 1.0.0
15093d13e800Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
15103d13e800Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
15113d13e800Smrg
15123d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
15133d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
15143d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
15153d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
15163d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
15173d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
15183d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
15193d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
15203d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
15213d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
15223d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
15233d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
15243d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
15253d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
15263d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
15273d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
15283d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
15293d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
15303d13e800Smrg
15313d13e800Smrg# XORG_FONT_CHECK_ENCODING(encoding)
15323d13e800Smrg# ----------------------------------
15333d13e800Smrg# Minimum version: 1.1.0
15343d13e800Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
15353d13e800Smrg# It replaced individual copies of this code in the above macros in 1.1.
15363d13e800Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
15373d13e800Smrg# calls if this is not true in the future.
15383d13e800Smrg
15393d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
15403d13e800Smrg	AC_ARG_ENABLE(m4_tolower($1),
15413d13e800Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
15423d13e800Smrg				[Build $1 fonts (default: yes)]),
15433d13e800Smrg		[AS_TR_SH($1)=$enableval])
15443d13e800Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
15453d13e800Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
15463d13e800Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
15473d13e800Smrg]) # XORG_FONT_CHECK_ENCODING
15483d13e800Smrg
15493d13e800Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
15503d13e800Smrg# -----------------------------------------------------
15513d13e800Smrg# Minimum version: 1.1.0
15523d13e800Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
15533d13e800Smrg# Add a shorthand --enable/disable-all-encodings option.
15543d13e800Smrg
15553d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
15563d13e800Smrg	AC_ARG_ENABLE([all-encodings],
15573d13e800Smrg		AS_HELP_STRING([--disable-all-encodings],
15583d13e800Smrg				[Disable building of all font encodings]),
15593d13e800Smrg		[m4_foreach_w([enc], [$1], [
15603d13e800Smrg			AS_TR_SH(enc)=$enableval
15613d13e800Smrg		])],
15623d13e800Smrg		[m4_foreach_w([enc], [$1], [
15633d13e800Smrg			AS_TR_SH(enc)=yes
15643d13e800Smrg		])])
15653d13e800Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
15663d13e800Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
15673d13e800Smrg
15683d13e800Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
15693d13e800Smrg# ------------------------------------------
15703d13e800Smrg# Minimum version: 1.1.0
157101395c31Smrg#
15723d13e800Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
157301395c31Smrg#
157401395c31Smrg
15753d13e800SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
15763d13e800Smrg	AC_PATH_PROG($1, $2)
15773d13e800Smrg	if test x"$$1" = x; then
15783d13e800Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
15793d13e800Smrg	fi
15803d13e800Smrg])
15813d13e800Smrg
15823d13e800Smrg
15833d13e800Smrg# XORG_FONT_FCCACHE()
15843d13e800Smrg# -------------------
15853d13e800Smrg# Minimum version: 1.1.0
158601395c31Smrg#
15873d13e800Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
15883d13e800Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
15893d13e800Smrg# to run fc-cache if found and not installing to $DESTDIR and not
15903d13e800Smrg# cross-compiling
159101395c31Smrg#
15923d13e800Smrg# fc-cache is optional, not required, and should be skipped when making
15933d13e800Smrg# packages (installing to $DESTDIR) or cross-compiling
159401395c31Smrg#
15953d13e800SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
15963d13e800Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
15973d13e800Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
15983d13e800Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
15993d13e800Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
16003d13e800Smrg	else
16013d13e800Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
16023d13e800Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
16033d13e800Smrg	fi
16043d13e800Smrg	AC_SUBST([RUN_FCCACHE])
16053d13e800Smrg])
1606de7ed6e8Smrg
16073d13e800Smrg# XORG_FONT_MKFONTDIR()
16083d13e800Smrg# -------------------
16093d13e800Smrg# Minimum version: 1.3.0
16108255a313Smrg#
16113d13e800Smrg# Set MKFONTDIR to path to mkfontdir.
161201395c31Smrg#
16133d13e800Smrg# If cross-compiling, and if mkdir is not found, use a shell command
16143d13e800Smrg# which warns mkfontdir needs to be run on the target
161501395c31Smrg#
16163d13e800Smrg# If not cross-compiling, mkfontdir must be found
161701395c31Smrg#
16183d13e800SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
16193d13e800Smrg	if test x"$cross_compiling" != x"no" ; then
16203d13e800Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
16213d13e800Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
16228255a313Smrg
16233d13e800Smrg		if test x"$MKFONTDIR" = x; then
16243d13e800Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
16253d13e800Smrg		fi
16263d13e800Smrg	else
16273d13e800Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
16283d13e800Smrg	fi
16293d13e800Smrg
16303d13e800Smrg	AC_SUBST([MKFONTDIR])
16313d13e800Smrg])
16323d13e800Smrg
16333d13e800Smrg# XORG_FONT_COMMON_UTILS()
16343d13e800Smrg# ------------------------
16353d13e800Smrg# Minimum version: 1.1.0
163601395c31Smrg#
16373d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
16383d13e800Smrg
16393d13e800SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
16403d13e800Smrg	XORG_FONT_FCCACHE
16413d13e800Smrg	XORG_FONT_MKFONTDIR
16423d13e800Smrg])
16433d13e800Smrg
16443d13e800Smrg# XORG_FONT_SCALED_UTILS()
16453d13e800Smrg# ------------------------
16463d13e800Smrg# Minimum version: 1.1.0
164701395c31Smrg#
16483d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
16493d13e800Smrg# (TrueType, OpenType, Type1)
16503d13e800Smrg
16513d13e800SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
16523d13e800Smrg	XORG_FONT_COMMON_UTILS
16533d13e800Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
16543d13e800Smrg])
16553d13e800Smrg
16563d13e800Smrg# XORG_FONT_BDF_UTILS()
16573d13e800Smrg# ---------------------
16583d13e800Smrg# Minimum version: 1.1.0
165901395c31Smrg#
16603d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
16613d13e800Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
16623d13e800Smrg# PCF output files created by bdftopcf
16633d13e800Smrg
16643d13e800SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
16653d13e800Smrg	XORG_FONT_COMMON_UTILS
16663d13e800Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
16673d13e800Smrg	XORG_FONT_CHECK_COMPRESSION
16683d13e800Smrg])
16693d13e800Smrg
16703d13e800Smrg# XORG_FONT_CHECK_COMPRESSION()
16713d13e800Smrg# -----------------------------
16723d13e800Smrg# Minimum version: 1.1.0
167301395c31Smrg#
16743d13e800Smrg# Offer a --with-compression flag to control what compression method is
16753d13e800Smrg# used for pcf font files.   Offers all the methods currently supported
16763d13e800Smrg# by libXfont, including no compression.
16778255a313Smrg
16783d13e800SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
16793d13e800Smrg	AC_MSG_CHECKING([font compression method])
16803d13e800Smrg	AC_ARG_WITH(compression,
16813d13e800Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
16823d13e800Smrg			 [compression method to use on pcf fonts])],
16833d13e800Smrg         [compression="$withval"], [compression="yes"])
16843d13e800Smrg	if test x"$compression" = "xyes" ; then
16853d13e800Smrg		compression="gzip"
16863d13e800Smrg	fi
16873d13e800Smrg	AC_MSG_RESULT([${compression}])
16883d13e800Smrg	case ${compression} in
16893d13e800Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
16903d13e800Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
16913d13e800Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
16923d13e800Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
16933d13e800Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
16943d13e800Smrg	esac
16953d13e800Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
16963d13e800Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
16973d13e800Smrg	fi
16983d13e800Smrg	AC_SUBST([COMPRESS_SUFFIX])
16993d13e800Smrg])
17003d13e800Smrg
17013d13e800Smrg# XORG_FONT_UCS2ANY()
17023d13e800Smrg# -------------------
17033d13e800Smrg# Minimum version: 1.1.0
170401395c31Smrg#
17053d13e800Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
17063d13e800Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
17073d13e800Smrg# Also call pkg-config to find the directory with the encoding files needed
17083d13e800Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
17093d13e800Smrg
17103d13e800SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
17113d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
17123d13e800Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
17133d13e800Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
17143d13e800Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
17153d13e800Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
17163d13e800Smrg	AC_SUBST(MAPFILES_PATH)
17173d13e800Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
17183d13e800Smrg])
17193d13e800Smrg
17203d13e800Smrg
17213d13e800Smrg
17223d13e800Smrg# XORG_FONT_FC_CONFDIR()
17233d13e800Smrg# --------------------
17243d13e800Smrg# Minimum version: 1.2.0
172501395c31Smrg#
17263d13e800Smrg# Sets FC_CONFDIR to the fontconfig config directory
17273d13e800Smrg# (which should be --with-confdir=... when building fontconfig)
17283d13e800Smrg# found from:
17293d13e800Smrg#	--with-fc-confdir=...
17303d13e800Smrg#	pkg-config --variable=confdir fontconfig
17313d13e800Smrg#	${sysconfdir}/fonts
17323d13e800Smrg
17333d13e800SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
17343d13e800Smrg	dnl Ensure $PKG_CONFIG is set first
17353d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
17363d13e800Smrg
17373d13e800Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
17383d13e800Smrg	AC_ARG_WITH(fc-confdir,
17393d13e800Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
17403d13e800Smrg			   [Path to fontconfig's configuration directory]),
17413d13e800Smrg		    [FC_CONFDIR="$withval"])
17423d13e800Smrg	# if --with-fc-confdir was not specified
17433d13e800Smrg	if test "x${FC_CONFDIR}" = "x"; then
17443d13e800Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
17453d13e800Smrg	fi
17463d13e800Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
17473d13e800Smrg	if test "x${FC_CONFDIR}" = "x"; then
17483d13e800Smrg		FC_CONFDIR="${sysconfdir}/fonts"
17493d13e800Smrg	fi
17503d13e800Smrg	AC_SUBST(FC_CONFDIR)
17513d13e800Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
17523d13e800Smrg])
17533d13e800Smrg
17543d13e800Smrg
17553d13e800Smrg
17563d13e800Smrg# XORG_FONTROOTDIR()
17573d13e800Smrg# --------------------
17583d13e800Smrg# Minimum version: 1.1.0
175901395c31Smrg#
17603d13e800Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
17613d13e800Smrg# found from:
17623d13e800Smrg#	--with-fontrootdir
17633d13e800Smrg#	pkg-config --variable=fontrootdir fontutil
17643d13e800Smrg#	${datadir}/fonts/X11
17658255a313Smrg
17663d13e800SmrgAC_DEFUN([XORG_FONTROOTDIR],[
17673d13e800Smrg	dnl Ensure $PKG_CONFIG is set first
17683d13e800Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
17698255a313Smrg
17703d13e800Smrg	AC_MSG_CHECKING([for root directory for font files])
17713d13e800Smrg	AC_ARG_WITH(fontrootdir,
17723d13e800Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
17733d13e800Smrg			   [Path to root directory for font files]),
17743d13e800Smrg		    [FONTROOTDIR="$withval"])
17753d13e800Smrg	# if --with-fontrootdir not specified...
17763d13e800Smrg	if test "x${FONTROOTDIR}" = "x"; then
17773d13e800Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
17783d13e800Smrg	fi
17793d13e800Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
17803d13e800Smrg	if test "x${FONTROOTDIR}" = "x"; then
17813d13e800Smrg		FONTROOTDIR="${datadir}/fonts/X11"
17823d13e800Smrg	fi
17833d13e800Smrg	AC_SUBST(FONTROOTDIR)
17843d13e800Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
17853d13e800Smrg])
17868255a313Smrg
17873d13e800Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
17883d13e800Smrg# ---------------------------------------
17893d13e800Smrg# Minimum version: 1.1.0
17903d13e800Smrg#
17913d13e800Smrg# Offer a --with-<flag> flag to control directory for font installation
17923d13e800Smrg# Default is the specified <subdir> of the font root directory.
17933d13e800Smrg# Sets <variable> to the selected directory
17948255a313Smrg
17953d13e800SmrgAC_DEFUN([XORG_FONTSUBDIR],[
17963d13e800Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
17978255a313Smrg
17983d13e800Smrg	AC_MSG_CHECKING([for directory for $3 files])
17993d13e800Smrg	AC_ARG_WITH($2,
18003d13e800Smrg		    [AS_HELP_STRING([--with-$2=DIR],
18013d13e800Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
18023d13e800Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
18033d13e800Smrg	AC_SUBST($1)
18043d13e800Smrg	AC_MSG_RESULT([${$1}])
18053d13e800Smrg]) # XORG_FONTSUBDIR
18068255a313Smrg
18073d13e800Smrg# XORG_FONTDIR(subdir)
18083d13e800Smrg# --------------------
18093d13e800Smrg# Minimum version: 1.1.0
181001395c31Smrg#
18113d13e800Smrg# Offer a --with-fontdir flag to control directory for font installation
18123d13e800Smrg# Default is the specified subdir of the font root directory.
18133d13e800Smrg# Sets FONTDIR to the selected directory
18143d13e800Smrg
18153d13e800SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
18163d13e800Smrg
18173d13e800Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
18183d13e800Smrgdnl
18193d13e800Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
18203d13e800Smrgdnl
18213d13e800Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
18223d13e800Smrgdnl copy of this software and associated documentation files (the "Software"),
18233d13e800Smrgdnl to deal in the Software without restriction, including without limitation
18243d13e800Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
18253d13e800Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
18263d13e800Smrgdnl Software is furnished to do so, subject to the following conditions:
18273d13e800Smrgdnl
18283d13e800Smrgdnl The above copyright notice and this permission notice (including the next
18293d13e800Smrgdnl paragraph) shall be included in all copies or substantial portions of the
18303d13e800Smrgdnl Software.
18313d13e800Smrgdnl
18323d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18333d13e800Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18343d13e800Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18353d13e800Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18363d13e800Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18373d13e800Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18383d13e800Smrgdnl DEALINGS IN THE SOFTWARE.
18393d13e800Smrg
18403d13e800Smrg# XORG_MACROS_VERSION(required-version)
18413d13e800Smrg# -------------------------------------
18423d13e800Smrg# Minimum version: 1.1.0
184301395c31Smrg#
18443d13e800Smrg# If you're using a macro added in Version 1.1 or newer, include this in
18453d13e800Smrg# your configure.ac with the minimum required version, such as:
18463d13e800Smrg# XORG_MACROS_VERSION(1.1)
184701395c31Smrg#
18483d13e800Smrg# To ensure that this macro is defined, also add:
18493d13e800Smrg# m4_ifndef([XORG_MACROS_VERSION],
18503d13e800Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
185101395c31Smrg#
185201395c31Smrg#
18533d13e800Smrg# See the "minimum version" comment for each macro you use to see what
18543d13e800Smrg# version you require.
18553d13e800Smrgm4_defun([XORG_MACROS_VERSION],[
18563d13e800Smrgm4_define([vers_have], [1.19.3])
18573d13e800Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
18583d13e800Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
18593d13e800Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
18603d13e800Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
18613d13e800Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
18623d13e800Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
18633d13e800Smrgm4_undefine([vers_have])
18643d13e800Smrgm4_undefine([maj_have])
18653d13e800Smrgm4_undefine([maj_needed])
18663d13e800Smrg]) # XORG_MACROS_VERSION
18673d13e800Smrg
18683d13e800Smrg# XORG_PROG_RAWCPP()
18693d13e800Smrg# ------------------
18703d13e800Smrg# Minimum version: 1.0.0
187101395c31Smrg#
18723d13e800Smrg# Find cpp program and necessary flags for use in pre-processing text files
18733d13e800Smrg# such as man pages and config files
18743d13e800SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
18753d13e800SmrgAC_REQUIRE([AC_PROG_CPP])
18763d13e800SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
18773d13e800Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
18783d13e800Smrg
18793d13e800Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
18803d13e800Smrg# which is not the best choice for supporting other OS'es, but covers most
18813d13e800Smrg# of the ones we need for now.
18823d13e800SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
18833d13e800SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
18843d13e800Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18853d13e800Smrg	AC_MSG_RESULT([no])
188601395c31Smrgelse
18873d13e800Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18883d13e800Smrg		RAWCPPFLAGS=-undef
18893d13e800Smrg		AC_MSG_RESULT([yes])
18903d13e800Smrg	# under Cygwin unix is still defined even with -undef
18913d13e800Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18923d13e800Smrg		RAWCPPFLAGS="-undef -ansi"
18933d13e800Smrg		AC_MSG_RESULT([yes, with -ansi])
18943d13e800Smrg	else
18953d13e800Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
18963d13e800Smrg	fi
189701395c31Smrgfi
18983d13e800Smrgrm -f conftest.$ac_ext
18998255a313Smrg
19003d13e800SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
19013d13e800SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
19023d13e800Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
19033d13e800Smrg	AC_MSG_RESULT([no])
19043d13e800Smrgelse
19053d13e800Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
19063d13e800Smrg		TRADITIONALCPPFLAGS="-traditional"
19073d13e800Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
19083d13e800Smrg		AC_MSG_RESULT([yes])
19093d13e800Smrg	else
19103d13e800Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
19113d13e800Smrg	fi
19123d13e800Smrgfi
19133d13e800Smrgrm -f conftest.$ac_ext
19143d13e800SmrgAC_SUBST(RAWCPPFLAGS)
19153d13e800SmrgAC_SUBST(TRADITIONALCPPFLAGS)
19163d13e800Smrg]) # XORG_PROG_RAWCPP
19173d13e800Smrg
19183d13e800Smrg# XORG_MANPAGE_SECTIONS()
191901395c31Smrg# -----------------------
19203d13e800Smrg# Minimum version: 1.0.0
1921de7ed6e8Smrg#
19223d13e800Smrg# Determine which sections man pages go in for the different man page types
19233d13e800Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
19243d13e800Smrg# Not sure if there's any better way than just hardcoding by OS name.
19253d13e800Smrg# Override default settings by setting environment variables
19263d13e800Smrg# Added MAN_SUBSTS in version 1.8
19273d13e800Smrg# Added AC_PROG_SED in version 1.8
192801395c31Smrg
19293d13e800SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
193001395c31SmrgAC_REQUIRE([AC_CANONICAL_HOST])
19313d13e800SmrgAC_REQUIRE([AC_PROG_SED])
193201395c31Smrg
193301395c31Smrgcase $host_os in
193401395c31Smrg    solaris*)
19353d13e800Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
19363d13e800Smrg        # check for a man page file found in later versions that use
19373d13e800Smrg        # traditional section numbers instead
19383d13e800Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
19393d13e800Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
194001395c31Smrg        ;;
19413d13e800Smrg    *) SYSV_MAN_SECTIONS=false ;;
194201395c31Smrgesac
194301395c31Smrg
19443d13e800Smrgif test x$APP_MAN_SUFFIX = x    ; then
19453d13e800Smrg    APP_MAN_SUFFIX=1
19463d13e800Smrgfi
19473d13e800Smrgif test x$APP_MAN_DIR = x    ; then
19483d13e800Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
194901395c31Smrgfi
195001395c31Smrg
19513d13e800Smrgif test x$LIB_MAN_SUFFIX = x    ; then
19523d13e800Smrg    LIB_MAN_SUFFIX=3
19533d13e800Smrgfi
19543d13e800Smrgif test x$LIB_MAN_DIR = x    ; then
19553d13e800Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
19563d13e800Smrgfi
195701395c31Smrg
19583d13e800Smrgif test x$FILE_MAN_SUFFIX = x    ; then
19593d13e800Smrg    case $SYSV_MAN_SECTIONS in
19603d13e800Smrg	true)				FILE_MAN_SUFFIX=4  ;;
19613d13e800Smrg	*)				FILE_MAN_SUFFIX=5  ;;
19623d13e800Smrg    esac
19633d13e800Smrgfi
19643d13e800Smrgif test x$FILE_MAN_DIR = x    ; then
19653d13e800Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
19663d13e800Smrgfi
1967de7ed6e8Smrg
19683d13e800Smrgif test x$MISC_MAN_SUFFIX = x    ; then
19693d13e800Smrg    case $SYSV_MAN_SECTIONS in
19703d13e800Smrg	true)				MISC_MAN_SUFFIX=5  ;;
19713d13e800Smrg	*)				MISC_MAN_SUFFIX=7  ;;
19723d13e800Smrg    esac
19733d13e800Smrgfi
19743d13e800Smrgif test x$MISC_MAN_DIR = x    ; then
19753d13e800Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1976de7ed6e8Smrgfi
1977de7ed6e8Smrg
19783d13e800Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
19793d13e800Smrg    case $SYSV_MAN_SECTIONS in
19803d13e800Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
19813d13e800Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
19823d13e800Smrg    esac
19833d13e800Smrgfi
19843d13e800Smrgif test x$DRIVER_MAN_DIR = x    ; then
19853d13e800Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
198601395c31Smrgfi
1987de7ed6e8Smrg
19883d13e800Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
19893d13e800Smrg    case $SYSV_MAN_SECTIONS in
19903d13e800Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
19913d13e800Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
19923d13e800Smrg    esac
19933d13e800Smrgfi
19943d13e800Smrgif test x$ADMIN_MAN_DIR = x    ; then
19953d13e800Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
19963d13e800Smrgfi
1997de7ed6e8Smrg
19983d13e800Smrg
19993d13e800SmrgAC_SUBST([APP_MAN_SUFFIX])
20003d13e800SmrgAC_SUBST([LIB_MAN_SUFFIX])
20013d13e800SmrgAC_SUBST([FILE_MAN_SUFFIX])
20023d13e800SmrgAC_SUBST([MISC_MAN_SUFFIX])
20033d13e800SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
20043d13e800SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
20053d13e800SmrgAC_SUBST([APP_MAN_DIR])
20063d13e800SmrgAC_SUBST([LIB_MAN_DIR])
20073d13e800SmrgAC_SUBST([FILE_MAN_DIR])
20083d13e800SmrgAC_SUBST([MISC_MAN_DIR])
20093d13e800SmrgAC_SUBST([DRIVER_MAN_DIR])
20103d13e800SmrgAC_SUBST([ADMIN_MAN_DIR])
20113d13e800Smrg
20123d13e800SmrgXORG_MAN_PAGE="X Version 11"
20133d13e800SmrgAC_SUBST([XORG_MAN_PAGE])
20143d13e800SmrgMAN_SUBSTS="\
20153d13e800Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
20163d13e800Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
20173d13e800Smrg	-e 's|__xservername__|Xorg|g' \
20183d13e800Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
20193d13e800Smrg	-e 's|__projectroot__|\$(prefix)|g' \
20203d13e800Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
20213d13e800Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
20223d13e800Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
20233d13e800Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
20243d13e800Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
20253d13e800Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
20263d13e800Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
20273d13e800SmrgAC_SUBST([MAN_SUBSTS])
20283d13e800Smrg
20293d13e800Smrg]) # XORG_MANPAGE_SECTIONS
20303d13e800Smrg
20313d13e800Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
20323d13e800Smrg# ------------------------
20333d13e800Smrg# Minimum version: 1.7.0
2034de7ed6e8Smrg#
20353d13e800Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
20363d13e800Smrg# provided by xorg-sgml-doctools, if installed.
20373d13e800SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
20383d13e800SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
20393d13e800SmrgXORG_SGML_PATH=
20403d13e800SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
20413d13e800Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
20423d13e800Smrg    [m4_ifval([$1],[:],
20433d13e800Smrg        [if test x"$cross_compiling" != x"yes" ; then
20443d13e800Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
20453d13e800Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
20463d13e800Smrg         fi])
20473d13e800Smrg    ])
20483d13e800Smrg
20493d13e800Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
20503d13e800Smrg# the path and the name of the doc stylesheet
20513d13e800Smrgif test "x$XORG_SGML_PATH" != "x" ; then
20523d13e800Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
20533d13e800Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
20543d13e800Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
20553d13e800Smrgelse
20563d13e800Smrg   AC_MSG_RESULT([no])
20573d13e800Smrgfi
20583d13e800Smrg
20593d13e800SmrgAC_SUBST(XORG_SGML_PATH)
20603d13e800SmrgAC_SUBST(STYLESHEET_SRCDIR)
20613d13e800SmrgAC_SUBST(XSL_STYLESHEET)
20623d13e800SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
20633d13e800Smrg]) # XORG_CHECK_SGML_DOCTOOLS
20643d13e800Smrg
20653d13e800Smrg# XORG_CHECK_LINUXDOC
20663d13e800Smrg# -------------------
20673d13e800Smrg# Minimum version: 1.0.0
206801395c31Smrg#
20693d13e800Smrg# Defines the variable MAKE_TEXT if the necessary tools and
20703d13e800Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
20713d13e800Smrg# Whether or not the necessary tools and files are found can be checked
20723d13e800Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
20733d13e800SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
20743d13e800SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
20753d13e800SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
2076de7ed6e8Smrg
20773d13e800SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
207801395c31Smrg
20793d13e800SmrgAC_MSG_CHECKING([whether to build documentation])
208001395c31Smrg
20813d13e800Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
20823d13e800Smrg   BUILDDOC=yes
2083de7ed6e8Smrgelse
20843d13e800Smrg   BUILDDOC=no
2085de7ed6e8Smrgfi
2086de7ed6e8Smrg
20873d13e800SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
208801395c31Smrg
20893d13e800SmrgAC_MSG_RESULT([$BUILDDOC])
209001395c31Smrg
20913d13e800SmrgAC_MSG_CHECKING([whether to build pdf documentation])
209201395c31Smrg
20933d13e800Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
20943d13e800Smrg   BUILDPDFDOC=yes
20953d13e800Smrgelse
20963d13e800Smrg   BUILDPDFDOC=no
20973d13e800Smrgfi
2098de7ed6e8Smrg
20993d13e800SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
210001395c31Smrg
21013d13e800SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2102de7ed6e8Smrg
21033d13e800SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
21043d13e800SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
21053d13e800SmrgMAKE_PDF="$PS2PDF"
21063d13e800SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
210701395c31Smrg
21083d13e800SmrgAC_SUBST(MAKE_TEXT)
21093d13e800SmrgAC_SUBST(MAKE_PS)
21103d13e800SmrgAC_SUBST(MAKE_PDF)
21113d13e800SmrgAC_SUBST(MAKE_HTML)
21123d13e800Smrg]) # XORG_CHECK_LINUXDOC
211301395c31Smrg
21143d13e800Smrg# XORG_CHECK_DOCBOOK
211501395c31Smrg# -------------------
21163d13e800Smrg# Minimum version: 1.0.0
211701395c31Smrg#
21183d13e800Smrg# Checks for the ability to build output formats from SGML DocBook source.
21193d13e800Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
21203d13e800Smrg# indicates whether the necessary tools and files are found and, if set,
21213d13e800Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
21223d13e800SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
21233d13e800SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
212401395c31Smrg
21253d13e800SmrgBUILDTXTDOC=no
21263d13e800SmrgBUILDPDFDOC=no
21273d13e800SmrgBUILDPSDOC=no
21283d13e800SmrgBUILDHTMLDOC=no
212901395c31Smrg
21303d13e800SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
21313d13e800SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
21323d13e800SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
21333d13e800SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
213401395c31Smrg
21353d13e800SmrgAC_MSG_CHECKING([whether to build text documentation])
21363d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
21373d13e800Smrg   test x$BUILD_TXTDOC != xno; then
21383d13e800Smrg	BUILDTXTDOC=yes
213901395c31Smrgfi
21403d13e800SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
21413d13e800SmrgAC_MSG_RESULT([$BUILDTXTDOC])
214201395c31Smrg
21433d13e800SmrgAC_MSG_CHECKING([whether to build PDF documentation])
21443d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
21453d13e800Smrg   test x$BUILD_PDFDOC != xno; then
21463d13e800Smrg	BUILDPDFDOC=yes
214701395c31Smrgfi
21483d13e800SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
21493d13e800SmrgAC_MSG_RESULT([$BUILDPDFDOC])
2150de7ed6e8Smrg
21513d13e800SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
21523d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
21533d13e800Smrg   test x$BUILD_PSDOC != xno; then
21543d13e800Smrg	BUILDPSDOC=yes
21553d13e800Smrgfi
21563d13e800SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
21573d13e800SmrgAC_MSG_RESULT([$BUILDPSDOC])
215801395c31Smrg
21593d13e800SmrgAC_MSG_CHECKING([whether to build HTML documentation])
21603d13e800Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
21613d13e800Smrg   test x$BUILD_HTMLDOC != xno; then
21623d13e800Smrg	BUILDHTMLDOC=yes
21633d13e800Smrgfi
21643d13e800SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
21653d13e800SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
216601395c31Smrg
21673d13e800SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
21683d13e800SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
21693d13e800SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
21703d13e800SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
217101395c31Smrg
21723d13e800SmrgAC_SUBST(MAKE_TEXT)
21733d13e800SmrgAC_SUBST(MAKE_PS)
21743d13e800SmrgAC_SUBST(MAKE_PDF)
21753d13e800SmrgAC_SUBST(MAKE_HTML)
21763d13e800Smrg]) # XORG_CHECK_DOCBOOK
217701395c31Smrg
21783d13e800Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
21793d13e800Smrg# ----------------
21803d13e800Smrg# Minimum version: 1.5.0
21813d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
218201395c31Smrg#
21833d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
21843d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
21853d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21863d13e800Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
21873d13e800Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
21883d13e800Smrg# --with-xmlto assumes 'auto'.
218901395c31Smrg#
21903d13e800Smrg# Interface to module:
21913d13e800Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
21923d13e800Smrg# XMLTO:	returns the path of the xmlto program found
21933d13e800Smrg#		returns the path set by the user in the environment
21943d13e800Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
21953d13e800Smrg#		'no' user instructs the module not to use xmlto
219601395c31Smrg#
21973d13e800Smrg# Added in version 1.10.0
21983d13e800Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
21993d13e800Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
22003d13e800Smrg#
22013d13e800Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
22023d13e800Smrg#
22033d13e800SmrgAC_DEFUN([XORG_WITH_XMLTO],[
22043d13e800SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
22053d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
22063d13e800SmrgAC_ARG_WITH(xmlto,
22073d13e800Smrg	AS_HELP_STRING([--with-xmlto],
22083d13e800Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
22093d13e800Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
22103d13e800Smrgm4_undefine([_defopt])
221101395c31Smrg
22123d13e800Smrgif test "x$use_xmlto" = x"auto"; then
22133d13e800Smrg   AC_PATH_PROG([XMLTO], [xmlto])
22143d13e800Smrg   if test "x$XMLTO" = "x"; then
22153d13e800Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
22163d13e800Smrg	have_xmlto=no
22173d13e800Smrg   else
22183d13e800Smrg        have_xmlto=yes
22193d13e800Smrg   fi
22203d13e800Smrgelif test "x$use_xmlto" = x"yes" ; then
22213d13e800Smrg   AC_PATH_PROG([XMLTO], [xmlto])
22223d13e800Smrg   if test "x$XMLTO" = "x"; then
22233d13e800Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
22243d13e800Smrg   fi
22253d13e800Smrg   have_xmlto=yes
22263d13e800Smrgelif test "x$use_xmlto" = x"no" ; then
22273d13e800Smrg   if test "x$XMLTO" != "x"; then
22283d13e800Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
22293d13e800Smrg   fi
22303d13e800Smrg   have_xmlto=no
2231de7ed6e8Smrgelse
22323d13e800Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2233de7ed6e8Smrgfi
2234de7ed6e8Smrg
22353d13e800Smrg# Test for a minimum version of xmlto, if provided.
22363d13e800Smrgm4_ifval([$1],
22373d13e800Smrg[if test "$have_xmlto" = yes; then
22383d13e800Smrg    # scrape the xmlto version
22393d13e800Smrg    AC_MSG_CHECKING([the xmlto version])
22403d13e800Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
22413d13e800Smrg    AC_MSG_RESULT([$xmlto_version])
22423d13e800Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
22433d13e800Smrg        [if test "x$use_xmlto" = xauto; then
22443d13e800Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
22453d13e800Smrg            have_xmlto=no
22463d13e800Smrg        else
22473d13e800Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
22483d13e800Smrg        fi])
22493d13e800Smrgfi])
225001395c31Smrg
22513d13e800Smrg# Test for the ability of xmlto to generate a text target
22523d13e800Smrg#
22533d13e800Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
22543d13e800Smrg# following test for empty XML docbook files.
22553d13e800Smrg# For compatibility reasons use the following empty XML docbook file and if
22563d13e800Smrg# it fails try it again with a non-empty XML file.
22573d13e800Smrghave_xmlto_text=no
22583d13e800Smrgcat > conftest.xml << "EOF"
22593d13e800SmrgEOF
22603d13e800SmrgAS_IF([test "$have_xmlto" = yes],
22613d13e800Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
22623d13e800Smrg             [have_xmlto_text=yes],
22633d13e800Smrg             [# Try it again with a non-empty XML file.
22643d13e800Smrg              cat > conftest.xml << "EOF"
22653d13e800Smrg<x></x>
22663d13e800SmrgEOF
22673d13e800Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
22683d13e800Smrg                    [have_xmlto_text=yes],
22693d13e800Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
22703d13e800Smrgrm -f conftest.xml
22713d13e800SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
22723d13e800SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
22733d13e800Smrg]) # XORG_WITH_XMLTO
227401395c31Smrg
22753d13e800Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
22763d13e800Smrg# --------------------------------------------
22773d13e800Smrg# Minimum version: 1.12.0
22783d13e800Smrg# Minimum version for optional DEFAULT argument: 1.12.0
22793d13e800Smrg#
22803d13e800Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
22813d13e800Smrg# XML-based language used for the transformation of XML documents.
22823d13e800Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
22833d13e800Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
22843d13e800Smrg# The XSLT processor is often used as a standalone tool for transformations.
22853d13e800Smrg# It should not be assumed that this tool is used only to work with documnetation.
22863d13e800Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
22873d13e800Smrg#
22883d13e800Smrg# Interface to module:
22893d13e800Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
22903d13e800Smrg# XSLTPROC:	 returns the path of the xsltproc program found
22913d13e800Smrg#		 returns the path set by the user in the environment
22923d13e800Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
22933d13e800Smrg#		  'no' user instructs the module not to use xsltproc
22943d13e800Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
22953d13e800Smrg#
22963d13e800Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
22973d13e800Smrg#
22983d13e800SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
22993d13e800SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
23003d13e800Smrg# Preserves the interface, should it be implemented later
23013d13e800Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
23023d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
23033d13e800SmrgAC_ARG_WITH(xsltproc,
23043d13e800Smrg	AS_HELP_STRING([--with-xsltproc],
23053d13e800Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
23063d13e800Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
23073d13e800Smrgm4_undefine([_defopt])
23083d13e800Smrg
23093d13e800Smrgif test "x$use_xsltproc" = x"auto"; then
23103d13e800Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
23113d13e800Smrg   if test "x$XSLTPROC" = "x"; then
23123d13e800Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
23133d13e800Smrg	have_xsltproc=no
23143d13e800Smrg   else
23153d13e800Smrg        have_xsltproc=yes
23163d13e800Smrg   fi
23173d13e800Smrgelif test "x$use_xsltproc" = x"yes" ; then
23183d13e800Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
23193d13e800Smrg   if test "x$XSLTPROC" = "x"; then
23203d13e800Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
23213d13e800Smrg   fi
23223d13e800Smrg   have_xsltproc=yes
23233d13e800Smrgelif test "x$use_xsltproc" = x"no" ; then
23243d13e800Smrg   if test "x$XSLTPROC" != "x"; then
23253d13e800Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
23263d13e800Smrg   fi
23273d13e800Smrg   have_xsltproc=no
232801395c31Smrgelse
23293d13e800Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2330de7ed6e8Smrgfi
2331de7ed6e8Smrg
23323d13e800SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
23333d13e800Smrg]) # XORG_WITH_XSLTPROC
2334de7ed6e8Smrg
23353d13e800Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
23363d13e800Smrg# ----------------------------------------
23373d13e800Smrg# Minimum version: 1.15.0
2338de7ed6e8Smrg#
23393d13e800Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
23403d13e800Smrg# scanning arbitrary text files, extracting information from those text files,
23413d13e800Smrg# and printing reports based on that information.
2342de7ed6e8Smrg#
23433d13e800Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2344de7ed6e8Smrg#
23453d13e800Smrg# Interface to module:
23463d13e800Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
23473d13e800Smrg# PERL:	     returns the path of the perl program found
23483d13e800Smrg#	     returns the path set by the user in the environment
23493d13e800Smrg# --with-perl: 'yes' user instructs the module to use perl
23503d13e800Smrg#	       'no' user instructs the module not to use perl
23513d13e800Smrg# have_perl: returns yes if perl found in PATH or no
2352de7ed6e8Smrg#
23533d13e800Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
235401395c31Smrg#
23553d13e800SmrgAC_DEFUN([XORG_WITH_PERL],[
23563d13e800SmrgAC_ARG_VAR([PERL], [Path to perl command])
23573d13e800Smrg# Preserves the interface, should it be implemented later
23583d13e800Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
23593d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
23603d13e800SmrgAC_ARG_WITH(perl,
23613d13e800Smrg	AS_HELP_STRING([--with-perl],
23623d13e800Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
23633d13e800Smrg	   [use_perl=$withval], [use_perl=]_defopt)
23643d13e800Smrgm4_undefine([_defopt])
236501395c31Smrg
23663d13e800Smrgif test "x$use_perl" = x"auto"; then
23673d13e800Smrg   AC_PATH_PROG([PERL], [perl])
23683d13e800Smrg   if test "x$PERL" = "x"; then
23693d13e800Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
23703d13e800Smrg	have_perl=no
23713d13e800Smrg   else
23723d13e800Smrg        have_perl=yes
23733d13e800Smrg   fi
23743d13e800Smrgelif test "x$use_perl" = x"yes" ; then
23753d13e800Smrg   AC_PATH_PROG([PERL], [perl])
23763d13e800Smrg   if test "x$PERL" = "x"; then
23773d13e800Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
23783d13e800Smrg   fi
23793d13e800Smrg   have_perl=yes
23803d13e800Smrgelif test "x$use_perl" = x"no" ; then
23813d13e800Smrg   if test "x$PERL" != "x"; then
23823d13e800Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
23833d13e800Smrg   fi
23843d13e800Smrg   have_perl=no
23853d13e800Smrgelse
23863d13e800Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2387de7ed6e8Smrgfi
2388de7ed6e8Smrg
23893d13e800SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
23903d13e800Smrg]) # XORG_WITH_PERL
239101395c31Smrg
23923d13e800Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
239301395c31Smrg# ----------------
23943d13e800Smrg# Minimum version: 1.5.0
23953d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2396de7ed6e8Smrg#
23973d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
23983d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
23993d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24003d13e800Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
24013d13e800Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
24023d13e800Smrg# --with-asciidoc assumes 'auto'.
2403de7ed6e8Smrg#
24043d13e800Smrg# Interface to module:
24053d13e800Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
24063d13e800Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
24073d13e800Smrg#		 returns the path set by the user in the environment
24083d13e800Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
24093d13e800Smrg#		  'no' user instructs the module not to use asciidoc
2410de7ed6e8Smrg#
24113d13e800Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2412de7ed6e8Smrg#
24133d13e800SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
24143d13e800SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
24153d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
24163d13e800SmrgAC_ARG_WITH(asciidoc,
24173d13e800Smrg	AS_HELP_STRING([--with-asciidoc],
24183d13e800Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
24193d13e800Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
24203d13e800Smrgm4_undefine([_defopt])
242101395c31Smrg
24223d13e800Smrgif test "x$use_asciidoc" = x"auto"; then
24233d13e800Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
24243d13e800Smrg   if test "x$ASCIIDOC" = "x"; then
24253d13e800Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
24263d13e800Smrg	have_asciidoc=no
24273d13e800Smrg   else
24283d13e800Smrg        have_asciidoc=yes
24293d13e800Smrg   fi
24303d13e800Smrgelif test "x$use_asciidoc" = x"yes" ; then
24313d13e800Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
24323d13e800Smrg   if test "x$ASCIIDOC" = "x"; then
24333d13e800Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
24343d13e800Smrg   fi
24353d13e800Smrg   have_asciidoc=yes
24363d13e800Smrgelif test "x$use_asciidoc" = x"no" ; then
24373d13e800Smrg   if test "x$ASCIIDOC" != "x"; then
24383d13e800Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
24393d13e800Smrg   fi
24403d13e800Smrg   have_asciidoc=no
24413d13e800Smrgelse
24423d13e800Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
24433d13e800Smrgfi
24443d13e800Smrgm4_ifval([$1],
24453d13e800Smrg[if test "$have_asciidoc" = yes; then
24463d13e800Smrg    # scrape the asciidoc version
24473d13e800Smrg    AC_MSG_CHECKING([the asciidoc version])
24483d13e800Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
24493d13e800Smrg    AC_MSG_RESULT([$asciidoc_version])
24503d13e800Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
24513d13e800Smrg        [if test "x$use_asciidoc" = xauto; then
24523d13e800Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
24533d13e800Smrg            have_asciidoc=no
24543d13e800Smrg        else
24553d13e800Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
24563d13e800Smrg        fi])
24573d13e800Smrgfi])
24583d13e800SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
24593d13e800Smrg]) # XORG_WITH_ASCIIDOC
246001395c31Smrg
24613d13e800Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
24623d13e800Smrg# -------------------------------------------
24633d13e800Smrg# Minimum version: 1.5.0
24643d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24653d13e800Smrg# Minimum version for optional DOT checking: 1.18.0
246601395c31Smrg#
24673d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
24683d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
24693d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24703d13e800Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
24713d13e800Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
24723d13e800Smrg# --with-doxygen assumes 'auto'.
247301395c31Smrg#
24743d13e800Smrg# Interface to module:
24753d13e800Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
24763d13e800Smrg# DOXYGEN:	 returns the path of the doxygen program found
24773d13e800Smrg#		 returns the path set by the user in the environment
24783d13e800Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
24793d13e800Smrg#		  'no' user instructs the module not to use doxygen
248001395c31Smrg#
24813d13e800Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2482de7ed6e8Smrg#
24833d13e800SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
24843d13e800SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
24853d13e800SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
24863d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
24873d13e800SmrgAC_ARG_WITH(doxygen,
24883d13e800Smrg	AS_HELP_STRING([--with-doxygen],
24893d13e800Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
24903d13e800Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
24913d13e800Smrgm4_undefine([_defopt])
249201395c31Smrg
24933d13e800Smrgif test "x$use_doxygen" = x"auto"; then
24943d13e800Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
24953d13e800Smrg   if test "x$DOXYGEN" = "x"; then
24963d13e800Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
24973d13e800Smrg	have_doxygen=no
24983d13e800Smrg   else
24993d13e800Smrg        have_doxygen=yes
25003d13e800Smrg   fi
25013d13e800Smrgelif test "x$use_doxygen" = x"yes" ; then
25023d13e800Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
25033d13e800Smrg   if test "x$DOXYGEN" = "x"; then
25043d13e800Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
25053d13e800Smrg   fi
25063d13e800Smrg   have_doxygen=yes
25073d13e800Smrgelif test "x$use_doxygen" = x"no" ; then
25083d13e800Smrg   if test "x$DOXYGEN" != "x"; then
25093d13e800Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
25103d13e800Smrg   fi
25113d13e800Smrg   have_doxygen=no
251201395c31Smrgelse
25133d13e800Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
251401395c31Smrgfi
25153d13e800Smrgm4_ifval([$1],
25163d13e800Smrg[if test "$have_doxygen" = yes; then
25173d13e800Smrg    # scrape the doxygen version
25183d13e800Smrg    AC_MSG_CHECKING([the doxygen version])
25193d13e800Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
25203d13e800Smrg    AC_MSG_RESULT([$doxygen_version])
25213d13e800Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
25223d13e800Smrg        [if test "x$use_doxygen" = xauto; then
25233d13e800Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
25243d13e800Smrg            have_doxygen=no
25253d13e800Smrg        else
25263d13e800Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
25273d13e800Smrg        fi])
25283d13e800Smrgfi])
252901395c31Smrg
25303d13e800Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
25313d13e800Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
25323d13e800Smrgdnl 	HAVE_DOT = @HAVE_DOT@
25333d13e800SmrgHAVE_DOT=no
25343d13e800Smrgif test "x$have_doxygen" = "xyes"; then
25353d13e800Smrg  AC_PATH_PROG([DOT], [dot])
25363d13e800Smrg    if test "x$DOT" != "x"; then
25373d13e800Smrg      HAVE_DOT=yes
25383d13e800Smrg    fi
25393d13e800Smrgfi
254001395c31Smrg
25413d13e800SmrgAC_SUBST([HAVE_DOT])
25423d13e800SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
25433d13e800SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
25443d13e800Smrg]) # XORG_WITH_DOXYGEN
254501395c31Smrg
25463d13e800Smrg# XORG_WITH_GROFF([DEFAULT])
25473d13e800Smrg# ----------------
25483d13e800Smrg# Minimum version: 1.6.0
25493d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2550de7ed6e8Smrg#
25513d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
25523d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
25533d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25543d13e800Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
25553d13e800Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
25563d13e800Smrg# --with-groff assumes 'auto'.
25573d13e800Smrg#
25583d13e800Smrg# Interface to module:
25593d13e800Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
25603d13e800Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
25613d13e800Smrg# HAVE_GROFF_MS: the -ms macros package
25623d13e800Smrg# GROFF:	 returns the path of the groff program found
25633d13e800Smrg#		 returns the path set by the user in the environment
25643d13e800Smrg# --with-groff:	 'yes' user instructs the module to use groff
25653d13e800Smrg#		 'no' user instructs the module not to use groff
25663d13e800Smrg#
25673d13e800Smrg# Added in version 1.9.0:
25683d13e800Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
25693d13e800Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
25703d13e800Smrg#		   psselect from the psutils package.
25713d13e800Smrg#		   the ghostcript package. Refer to the grohtml man pages
25723d13e800Smrg#
25733d13e800Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
25743d13e800Smrg#
25753d13e800Smrg# OS and distros often splits groff in a basic and full package, the former
25763d13e800Smrg# having the groff program and the later having devices, fonts and macros
25773d13e800Smrg# Checking for the groff executable is not enough.
25783d13e800Smrg#
25793d13e800Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
25803d13e800Smrg# unset HAVE_GROFF or GROFF env variables.
25813d13e800Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
25823d13e800Smrg#
25833d13e800SmrgAC_DEFUN([XORG_WITH_GROFF],[
25843d13e800SmrgAC_ARG_VAR([GROFF], [Path to groff command])
25853d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
25863d13e800SmrgAC_ARG_WITH(groff,
25873d13e800Smrg	AS_HELP_STRING([--with-groff],
25883d13e800Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
25893d13e800Smrg	   [use_groff=$withval], [use_groff=]_defopt)
25903d13e800Smrgm4_undefine([_defopt])
25918255a313Smrg
25923d13e800Smrgif test "x$use_groff" = x"auto"; then
25933d13e800Smrg   AC_PATH_PROG([GROFF], [groff])
25943d13e800Smrg   if test "x$GROFF" = "x"; then
25953d13e800Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
25963d13e800Smrg	have_groff=no
25973d13e800Smrg   else
25983d13e800Smrg        have_groff=yes
25993d13e800Smrg   fi
26003d13e800Smrgelif test "x$use_groff" = x"yes" ; then
26013d13e800Smrg   AC_PATH_PROG([GROFF], [groff])
26023d13e800Smrg   if test "x$GROFF" = "x"; then
26033d13e800Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
26043d13e800Smrg   fi
26053d13e800Smrg   have_groff=yes
26063d13e800Smrgelif test "x$use_groff" = x"no" ; then
26073d13e800Smrg   if test "x$GROFF" != "x"; then
26083d13e800Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
26093d13e800Smrg   fi
26103d13e800Smrg   have_groff=no
261101395c31Smrgelse
26123d13e800Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
26138255a313Smrgfi
26148255a313Smrg
26153d13e800Smrg# We have groff, test for the presence of the macro packages
26163d13e800Smrgif test "x$have_groff" = x"yes"; then
26173d13e800Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
26183d13e800Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
26193d13e800Smrg        groff_ms_works=yes
26203d13e800Smrg    else
26213d13e800Smrg        groff_ms_works=no
26223d13e800Smrg    fi
26233d13e800Smrg    AC_MSG_RESULT([$groff_ms_works])
26243d13e800Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
26253d13e800Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
26263d13e800Smrg        groff_mm_works=yes
26273d13e800Smrg    else
26283d13e800Smrg        groff_mm_works=no
26293d13e800Smrg    fi
26303d13e800Smrg    AC_MSG_RESULT([$groff_mm_works])
26313d13e800Smrgfi
263201395c31Smrg
26333d13e800Smrg# We have groff, test for HTML dependencies, one command per package
26343d13e800Smrgif test "x$have_groff" = x"yes"; then
26353d13e800Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
26363d13e800Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
26373d13e800Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
26383d13e800Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
26393d13e800Smrg      have_groff_html=yes
26403d13e800Smrg   else
26413d13e800Smrg      have_groff_html=no
26423d13e800Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
26433d13e800Smrg   fi
26443d13e800Smrgfi
264501395c31Smrg
26463d13e800Smrg# Set Automake conditionals for Makefiles
26473d13e800SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
26483d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
26493d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
26503d13e800SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
26513d13e800Smrg]) # XORG_WITH_GROFF
265201395c31Smrg
26533d13e800Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
26543d13e800Smrg# ---------------------------------------
26553d13e800Smrg# Minimum version: 1.6.0
26563d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
26573d13e800Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
26583d13e800Smrg#
26593d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
26603d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
26613d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
26623d13e800Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
26633d13e800Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
26643d13e800Smrg# --with-fop assumes 'auto'.
26653d13e800Smrg#
26663d13e800Smrg# Interface to module:
26673d13e800Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
26683d13e800Smrg# FOP:	 	returns the path of the fop program found
26693d13e800Smrg#		returns the path set by the user in the environment
26703d13e800Smrg# --with-fop: 	'yes' user instructs the module to use fop
26713d13e800Smrg#		'no' user instructs the module not to use fop
26723d13e800Smrg#
26733d13e800Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
26743d13e800Smrg#
26753d13e800SmrgAC_DEFUN([XORG_WITH_FOP],[
26763d13e800SmrgAC_ARG_VAR([FOP], [Path to fop command])
26773d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
26783d13e800SmrgAC_ARG_WITH(fop,
26793d13e800Smrg	AS_HELP_STRING([--with-fop],
26803d13e800Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
26813d13e800Smrg	   [use_fop=$withval], [use_fop=]_defopt)
26823d13e800Smrgm4_undefine([_defopt])
26833d13e800Smrg
26843d13e800Smrgif test "x$use_fop" = x"auto"; then
26853d13e800Smrg   AC_PATH_PROG([FOP], [fop])
26863d13e800Smrg   if test "x$FOP" = "x"; then
26873d13e800Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
26883d13e800Smrg	have_fop=no
26893d13e800Smrg   else
26903d13e800Smrg        have_fop=yes
26913d13e800Smrg   fi
26923d13e800Smrgelif test "x$use_fop" = x"yes" ; then
26933d13e800Smrg   AC_PATH_PROG([FOP], [fop])
26943d13e800Smrg   if test "x$FOP" = "x"; then
26953d13e800Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
26963d13e800Smrg   fi
26973d13e800Smrg   have_fop=yes
26983d13e800Smrgelif test "x$use_fop" = x"no" ; then
26993d13e800Smrg   if test "x$FOP" != "x"; then
27003d13e800Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
27013d13e800Smrg   fi
27023d13e800Smrg   have_fop=no
27033d13e800Smrgelse
27043d13e800Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
27058255a313Smrgfi
27068255a313Smrg
27073d13e800Smrg# Test for a minimum version of fop, if provided.
27083d13e800Smrgm4_ifval([$1],
27093d13e800Smrg[if test "$have_fop" = yes; then
27103d13e800Smrg    # scrape the fop version
27113d13e800Smrg    AC_MSG_CHECKING([for fop minimum version])
27123d13e800Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
27133d13e800Smrg    AC_MSG_RESULT([$fop_version])
27143d13e800Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
27153d13e800Smrg        [if test "x$use_fop" = xauto; then
27163d13e800Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
27173d13e800Smrg            have_fop=no
27183d13e800Smrg        else
27193d13e800Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
27203d13e800Smrg        fi])
27213d13e800Smrgfi])
27223d13e800SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
27233d13e800Smrg]) # XORG_WITH_FOP
27248255a313Smrg
27253d13e800Smrg# XORG_WITH_M4([MIN-VERSION])
27263d13e800Smrg# ---------------------------
27273d13e800Smrg# Minimum version: 1.19.0
2728de7ed6e8Smrg#
27293d13e800Smrg# This macro attempts to locate an m4 macro processor which supports
27303d13e800Smrg# -I option and is only useful for modules relying on M4 in order to
27313d13e800Smrg# expand macros in source code files.
27323d13e800Smrg#
27333d13e800Smrg# Interface to module:
27343d13e800Smrg# M4:	 	returns the path of the m4 program found
27353d13e800Smrg#		returns the path set by the user in the environment
27363d13e800Smrg#
27373d13e800SmrgAC_DEFUN([XORG_WITH_M4], [
27383d13e800SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
27393d13e800Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
27403d13e800Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
27413d13e800Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
27423d13e800Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
27433d13e800Smrg   [$PATH:/usr/gnu/bin])])
274401395c31Smrg
27453d13e800SmrgAC_SUBST([M4], [$ac_cv_path_M4])
27463d13e800Smrg]) # XORG_WITH_M4
27473d13e800Smrg
27483d13e800Smrg# XORG_WITH_PS2PDF([DEFAULT])
27493d13e800Smrg# ----------------
27503d13e800Smrg# Minimum version: 1.6.0
27513d13e800Smrg# Minimum version for optional DEFAULT argument: 1.11.0
27523d13e800Smrg#
27533d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
27543d13e800Smrg# not at the appropriate level. This macro enables a module to test for the
27553d13e800Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
27563d13e800Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
27573d13e800Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
27583d13e800Smrg# --with-ps2pdf assumes 'auto'.
27593d13e800Smrg#
27603d13e800Smrg# Interface to module:
27613d13e800Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
27623d13e800Smrg# PS2PDF:	returns the path of the ps2pdf program found
27633d13e800Smrg#		returns the path set by the user in the environment
27643d13e800Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
27653d13e800Smrg#		 'no' user instructs the module not to use ps2pdf
27663d13e800Smrg#
27673d13e800Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
27683d13e800Smrg#
27693d13e800SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
27703d13e800SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
27713d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
27723d13e800SmrgAC_ARG_WITH(ps2pdf,
27733d13e800Smrg	AS_HELP_STRING([--with-ps2pdf],
27743d13e800Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
27753d13e800Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
27763d13e800Smrgm4_undefine([_defopt])
277701395c31Smrg
27783d13e800Smrgif test "x$use_ps2pdf" = x"auto"; then
27793d13e800Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
27803d13e800Smrg   if test "x$PS2PDF" = "x"; then
27813d13e800Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
27823d13e800Smrg	have_ps2pdf=no
27833d13e800Smrg   else
27843d13e800Smrg        have_ps2pdf=yes
27853d13e800Smrg   fi
27863d13e800Smrgelif test "x$use_ps2pdf" = x"yes" ; then
27873d13e800Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
27883d13e800Smrg   if test "x$PS2PDF" = "x"; then
27893d13e800Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
27903d13e800Smrg   fi
27913d13e800Smrg   have_ps2pdf=yes
27923d13e800Smrgelif test "x$use_ps2pdf" = x"no" ; then
27933d13e800Smrg   if test "x$PS2PDF" != "x"; then
27943d13e800Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
27953d13e800Smrg   fi
27963d13e800Smrg   have_ps2pdf=no
27973d13e800Smrgelse
27983d13e800Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
27993d13e800Smrgfi
28003d13e800SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
28013d13e800Smrg]) # XORG_WITH_PS2PDF
280201395c31Smrg
28033d13e800Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
28043d13e800Smrg# ----------------
28053d13e800Smrg# Minimum version: 1.6.0
2806de7ed6e8Smrg#
28073d13e800Smrg# Documentation tools are not always available on all platforms and sometimes
28083d13e800Smrg# not at the appropriate level. This macro enables a builder to skip all
28093d13e800Smrg# documentation targets except traditional man pages.
28103d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
28113d13e800Smrg# maximum flexibilty in controlling documentation building.
28123d13e800Smrg# Refer to:
28133d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
28143d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
28153d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
28163d13e800Smrg# XORG_WITH_FOP           --with-fop
28173d13e800Smrg# XORG_WITH_GROFF         --with-groff
28183d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
28193d13e800Smrg#
28203d13e800Smrg# Interface to module:
28213d13e800Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
28223d13e800Smrg# --enable-docs: 'yes' user instructs the module to generate docs
28233d13e800Smrg#		 'no' user instructs the module not to generate docs
28243d13e800Smrg# parm1:	specify the default value, yes or no.
28253d13e800Smrg#
28263d13e800SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
28273d13e800Smrgm4_define([docs_default], m4_default([$1], [yes]))
28283d13e800SmrgAC_ARG_ENABLE(docs,
28293d13e800Smrg	AS_HELP_STRING([--enable-docs],
28303d13e800Smrg	   [Enable building the documentation (default: ]docs_default[)]),
28313d13e800Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
28323d13e800Smrgm4_undefine([docs_default])
28333d13e800SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
28343d13e800SmrgAC_MSG_CHECKING([whether to build documentation])
28353d13e800SmrgAC_MSG_RESULT([$build_docs])
28363d13e800Smrg]) # XORG_ENABLE_DOCS
283701395c31Smrg
28383d13e800Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
28393d13e800Smrg# ----------------
28403d13e800Smrg# Minimum version: 1.6.0
28413d13e800Smrg#
28423d13e800Smrg# This macro enables a builder to skip all developer documentation.
28433d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
28443d13e800Smrg# maximum flexibilty in controlling documentation building.
28453d13e800Smrg# Refer to:
28463d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
28473d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
28483d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
28493d13e800Smrg# XORG_WITH_FOP           --with-fop
28503d13e800Smrg# XORG_WITH_GROFF         --with-groff
28513d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
28523d13e800Smrg#
28533d13e800Smrg# Interface to module:
28543d13e800Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
28553d13e800Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
28563d13e800Smrg#			'no' user instructs the module not to generate developer docs
28573d13e800Smrg# parm1:		specify the default value, yes or no.
28583d13e800Smrg#
28593d13e800SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
28603d13e800Smrgm4_define([devel_default], m4_default([$1], [yes]))
28613d13e800SmrgAC_ARG_ENABLE(devel-docs,
28623d13e800Smrg	AS_HELP_STRING([--enable-devel-docs],
28633d13e800Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
28643d13e800Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
28653d13e800Smrgm4_undefine([devel_default])
28663d13e800SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
28673d13e800SmrgAC_MSG_CHECKING([whether to build developer documentation])
28683d13e800SmrgAC_MSG_RESULT([$build_devel_docs])
28693d13e800Smrg]) # XORG_ENABLE_DEVEL_DOCS
287001395c31Smrg
28713d13e800Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
28723d13e800Smrg# ----------------
28733d13e800Smrg# Minimum version: 1.6.0
28748255a313Smrg#
28753d13e800Smrg# This macro enables a builder to skip all functional specification targets.
28763d13e800Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
28773d13e800Smrg# maximum flexibilty in controlling documentation building.
28783d13e800Smrg# Refer to:
28793d13e800Smrg# XORG_WITH_XMLTO         --with-xmlto
28803d13e800Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
28813d13e800Smrg# XORG_WITH_DOXYGEN       --with-doxygen
28823d13e800Smrg# XORG_WITH_FOP           --with-fop
28833d13e800Smrg# XORG_WITH_GROFF         --with-groff
28843d13e800Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
28853d13e800Smrg#
28863d13e800Smrg# Interface to module:
28873d13e800Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
28883d13e800Smrg# --enable-specs:	'yes' user instructs the module to generate specs
28893d13e800Smrg#			'no' user instructs the module not to generate specs
28903d13e800Smrg# parm1:		specify the default value, yes or no.
28913d13e800Smrg#
28923d13e800SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
28933d13e800Smrgm4_define([spec_default], m4_default([$1], [yes]))
28943d13e800SmrgAC_ARG_ENABLE(specs,
28953d13e800Smrg	AS_HELP_STRING([--enable-specs],
28963d13e800Smrg	   [Enable building the specs (default: ]spec_default[)]),
28973d13e800Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
28983d13e800Smrgm4_undefine([spec_default])
28993d13e800SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
29003d13e800SmrgAC_MSG_CHECKING([whether to build functional specifications])
29013d13e800SmrgAC_MSG_RESULT([$build_specs])
29023d13e800Smrg]) # XORG_ENABLE_SPECS
29038255a313Smrg
29043d13e800Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
29053d13e800Smrg# ----------------------------------------------
29063d13e800Smrg# Minimum version: 1.13.0
29073d13e800Smrg#
29083d13e800Smrg# This macro enables a builder to enable/disable unit testing
29093d13e800Smrg# It makes no assumption about the test cases implementation
29103d13e800Smrg# Test cases may or may not use Automake "Support for test suites"
29113d13e800Smrg# They may or may not use the software utility library GLib
29123d13e800Smrg#
29133d13e800Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
29143d13e800Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
29153d13e800Smrg# The variable enable_unit_tests is used by other macros in this file.
29163d13e800Smrg#
29173d13e800Smrg# Interface to module:
29183d13e800Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
29193d13e800Smrg# enable_unit_tests:    used in configure.ac for additional configuration
29203d13e800Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
29213d13e800Smrg#			'no' user instructs the module not to build tests
29223d13e800Smrg# parm1:		specify the default value, yes or no.
29233d13e800Smrg#
29243d13e800SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
29253d13e800SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
29263d13e800SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
29273d13e800SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
29283d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
29293d13e800SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
29303d13e800Smrg	[Enable building unit test cases (default: ]_defopt[)]),
29313d13e800Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
29323d13e800Smrgm4_undefine([_defopt])
29333d13e800SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
29343d13e800SmrgAC_MSG_CHECKING([whether to build unit test cases])
29353d13e800SmrgAC_MSG_RESULT([$enable_unit_tests])
29363d13e800Smrg]) # XORG_ENABLE_UNIT_TESTS
2937de7ed6e8Smrg
29383d13e800Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
29393d13e800Smrg# ------------------------------------------------------
29403d13e800Smrg# Minimum version: 1.17.0
29413d13e800Smrg#
29423d13e800Smrg# This macro enables a builder to enable/disable integration testing
29433d13e800Smrg# It makes no assumption about the test cases' implementation
29443d13e800Smrg# Test cases may or may not use Automake "Support for test suites"
29453d13e800Smrg#
29463d13e800Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
29473d13e800Smrg# usually requires less dependencies and may be built and run under less
29483d13e800Smrg# stringent environments than integration tests.
29493d13e800Smrg#
29503d13e800Smrg# Interface to module:
29513d13e800Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
29523d13e800Smrg# enable_integration_tests:   used in configure.ac for additional configuration
29533d13e800Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
29543d13e800Smrg#                             'no' user instructs the module not to build tests
29553d13e800Smrg# parm1:                      specify the default value, yes or no.
29563d13e800Smrg#
29573d13e800SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
29583d13e800SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
29593d13e800Smrgm4_define([_defopt], m4_default([$1], [auto]))
29603d13e800SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
29613d13e800Smrg	[Enable building integration test cases (default: ]_defopt[)]),
29623d13e800Smrg	[enable_integration_tests=$enableval],
29633d13e800Smrg	[enable_integration_tests=]_defopt)
29643d13e800Smrgm4_undefine([_defopt])
29653d13e800SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
29663d13e800Smrg	[test "x$enable_integration_tests" != xno])
29673d13e800SmrgAC_MSG_CHECKING([whether to build unit test cases])
29683d13e800SmrgAC_MSG_RESULT([$enable_integration_tests])
29693d13e800Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2970de7ed6e8Smrg
29713d13e800Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
29723d13e800Smrg# ----------------------------------------
29733d13e800Smrg# Minimum version: 1.13.0
29743d13e800Smrg#
29753d13e800Smrg# GLib is a library which provides advanced data structures and functions.
29763d13e800Smrg# This macro enables a module to test for the presence of Glib.
29773d13e800Smrg#
29783d13e800Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
29793d13e800Smrg# Otherwise the value of $enable_unit_tests is blank.
29803d13e800Smrg#
29813d13e800Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
29823d13e800Smrg# test support usually requires less dependencies and may be built and run under
29833d13e800Smrg# less stringent environments than integration tests.
29843d13e800Smrg#
29853d13e800Smrg# Interface to module:
29863d13e800Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
29873d13e800Smrg# with_glib: used in configure.ac to know if GLib has been found
29883d13e800Smrg# --with-glib:	'yes' user instructs the module to use glib
29893d13e800Smrg#		'no' user instructs the module not to use glib
29903d13e800Smrg#
29913d13e800SmrgAC_DEFUN([XORG_WITH_GLIB],[
29923d13e800SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29933d13e800Smrgm4_define([_defopt], m4_default([$2], [auto]))
29943d13e800SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
29953d13e800Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
29963d13e800Smrg	[with_glib=$withval], [with_glib=]_defopt)
29973d13e800Smrgm4_undefine([_defopt])
29983d13e800Smrg
29993d13e800Smrghave_glib=no
30003d13e800Smrg# Do not probe GLib if user explicitly disabled unit testing
30013d13e800Smrgif test "x$enable_unit_tests" != x"no"; then
30023d13e800Smrg  # Do not probe GLib if user explicitly disabled it
30033d13e800Smrg  if test "x$with_glib" != x"no"; then
30043d13e800Smrg    m4_ifval(
30053d13e800Smrg      [$1],
30063d13e800Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
30073d13e800Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
30083d13e800Smrg    )
300901395c31Smrg  fi
30108255a313Smrgfi
3011de7ed6e8Smrg
30123d13e800Smrg# Not having GLib when unit testing has been explicitly requested is an error
30133d13e800Smrgif test "x$enable_unit_tests" = x"yes"; then
30143d13e800Smrg  if test "x$have_glib" = x"no"; then
30153d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
301601395c31Smrg  fi
30178255a313Smrgfi
301801395c31Smrg
30193d13e800Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
30203d13e800Smrgif test "x$enable_unit_tests" = x"no"; then
30213d13e800Smrg  if test "x$with_glib" = x"yes"; then
30223d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
30233d13e800Smrg  fi
30243d13e800Smrgfi
302501395c31Smrg
30263d13e800Smrg# Not having GLib when it has been explicitly requested is an error
30273d13e800Smrgif test "x$with_glib" = x"yes"; then
30283d13e800Smrg  if test "x$have_glib" = x"no"; then
30293d13e800Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
30303d13e800Smrg  fi
30313d13e800Smrgfi
30328255a313Smrg
30333d13e800SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
30343d13e800Smrg]) # XORG_WITH_GLIB
303501395c31Smrg
30363d13e800Smrg# XORG_LD_WRAP([required|optional])
30373d13e800Smrg# ---------------------------------
30383d13e800Smrg# Minimum version: 1.13.0
30393d13e800Smrg#
30403d13e800Smrg# Check if linker supports -wrap, passed via compiler flags
30413d13e800Smrg#
30423d13e800Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
30433d13e800Smrg# Otherwise the value of $enable_unit_tests is blank.
30443d13e800Smrg#
30453d13e800Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
30463d13e800Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
30473d13e800Smrg# available, an argument of "optional" allows use when some unit tests require
30483d13e800Smrg# ld -wrap and others do not.
30493d13e800Smrg#
30503d13e800SmrgAC_DEFUN([XORG_LD_WRAP],[
30513d13e800SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
30523d13e800Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
30533d13e800Smrg                      void __wrap_exit(int status) { return; }],
30543d13e800Smrg                     [exit(0);])])
30553d13e800Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
30563d13e800Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
30573d13e800Smrg  if test "x$have_ld_wrap" = x"no"; then
30583d13e800Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
30593d13e800Smrg  fi
30603d13e800Smrgfi
30613d13e800SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
30623d13e800Smrg#
30633d13e800Smrg]) # XORG_LD_WRAP
306401395c31Smrg
30653d13e800Smrg# XORG_CHECK_LINKER_FLAGS
30663d13e800Smrg# -----------------------
30673d13e800Smrg# SYNOPSIS
30683d13e800Smrg#
30693d13e800Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
30703d13e800Smrg#
30713d13e800Smrg# DESCRIPTION
30723d13e800Smrg#
30733d13e800Smrg#   Check whether the given linker FLAGS work with the current language's
30743d13e800Smrg#   linker, or whether they give an error.
30753d13e800Smrg#
30763d13e800Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
30773d13e800Smrg#   success/failure.
30783d13e800Smrg#
30793d13e800Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
30803d13e800Smrg#
30813d13e800Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
30823d13e800Smrg#
30833d13e800Smrg# LICENSE
30843d13e800Smrg#
30853d13e800Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
30863d13e800Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
30873d13e800Smrg#   Copyright (c) 2009 Matteo Frigo
30883d13e800Smrg#
30893d13e800Smrg#   This program is free software: you can redistribute it and/or modify it
30903d13e800Smrg#   under the terms of the GNU General Public License as published by the
30913d13e800Smrg#   Free Software Foundation, either version 3 of the License, or (at your
30923d13e800Smrg#   option) any later version.
30933d13e800Smrg#
30943d13e800Smrg#   This program is distributed in the hope that it will be useful, but
30953d13e800Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
30963d13e800Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
30973d13e800Smrg#   Public License for more details.
30983d13e800Smrg#
30993d13e800Smrg#   You should have received a copy of the GNU General Public License along
31003d13e800Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
31013d13e800Smrg#
31023d13e800Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
31033d13e800Smrg#   gives unlimited permission to copy, distribute and modify the configure
31043d13e800Smrg#   scripts that are the output of Autoconf when processing the Macro. You
31053d13e800Smrg#   need not follow the terms of the GNU General Public License when using
31063d13e800Smrg#   or distributing such scripts, even though portions of the text of the
31073d13e800Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
31083d13e800Smrg#   all other use of the material that constitutes the Autoconf Macro.
31093d13e800Smrg#
31103d13e800Smrg#   This special exception to the GPL applies to versions of the Autoconf
31113d13e800Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
31123d13e800Smrg#   modified version of the Autoconf Macro, you may extend this special
31133d13e800Smrg#   exception to the GPL to apply to your modified version as well.#
31143d13e800SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
31153d13e800Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
31163d13e800Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
31173d13e800SmrgAS_LITERAL_IF([$1],
31183d13e800Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
31193d13e800Smrg      ax_save_FLAGS=$LDFLAGS
31203d13e800Smrg      LDFLAGS="$1"
31213d13e800Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
31223d13e800Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
31233d13e800Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
31243d13e800Smrg      LDFLAGS=$ax_save_FLAGS])],
31253d13e800Smrg  [ax_save_FLAGS=$LDFLAGS
31263d13e800Smrg   LDFLAGS="$1"
31273d13e800Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
31283d13e800Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
31293d13e800Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
31303d13e800Smrg   LDFLAGS=$ax_save_FLAGS])
31313d13e800Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
31323d13e800SmrgAC_MSG_RESULT($xorg_check_linker_flags)
31333d13e800Smrgif test "x$xorg_check_linker_flags" = xyes; then
31343d13e800Smrg	m4_default([$2], :)
31353d13e800Smrgelse
31363d13e800Smrg	m4_default([$3], :)
31373d13e800Smrgfi
31383d13e800Smrg]) # XORG_CHECK_LINKER_FLAGS
31398255a313Smrg
31403d13e800Smrg# XORG_MEMORY_CHECK_FLAGS
31413d13e800Smrg# -----------------------
31423d13e800Smrg# Minimum version: 1.16.0
31433d13e800Smrg#
31443d13e800Smrg# This macro attempts to find appropriate memory checking functionality
31453d13e800Smrg# for various platforms which unit testing code may use to catch various
31463d13e800Smrg# forms of memory allocation and access errors in testing.
31473d13e800Smrg#
31483d13e800Smrg# Interface to module:
31493d13e800Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
31503d13e800Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
31513d13e800Smrg#
31523d13e800Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
31533d13e800Smrg#
31543d13e800SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
31558255a313Smrg
31563d13e800SmrgAC_REQUIRE([AC_CANONICAL_HOST])
31573d13e800SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
31583d13e800Smrg           [Environment variables to enable memory checking in tests])
31598255a313Smrg
31603d13e800Smrg# Check for different types of support on different platforms
31613d13e800Smrgcase $host_os in
31623d13e800Smrg    solaris*)
31633d13e800Smrg        AC_CHECK_LIB([umem], [umem_alloc],
31643d13e800Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
31653d13e800Smrg        ;;
31663d13e800Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
31673d13e800Smrg        # both directly and inverted, so should not be 0 or 255.
31683d13e800Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
31693d13e800Smrg        ;;
31703d13e800Smrg    darwin*)
31713d13e800Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
31723d13e800Smrg        ;;
31733d13e800Smrg    *bsd*)
31743d13e800Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
31753d13e800Smrg        ;;
31763d13e800Smrgesac
3177de7ed6e8Smrg
31783d13e800Smrg# User supplied flags override default flags
31793d13e800Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
31803d13e800Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
31818255a313Smrgfi
31828255a313Smrg
31833d13e800SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
31843d13e800Smrg]) # XORG_WITH_LINT
318501395c31Smrg
31863d13e800Smrg# XORG_CHECK_MALLOC_ZERO
31873d13e800Smrg# ----------------------
31883d13e800Smrg# Minimum version: 1.0.0
31898255a313Smrg#
31903d13e800Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
31913d13e800Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
31923d13e800Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
31933d13e800SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
31943d13e800SmrgAC_ARG_ENABLE(malloc0returnsnull,
31953d13e800Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
31963d13e800Smrg		       [malloc(0) returns NULL (default: auto)]),
31973d13e800Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
31983d13e800Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
319901395c31Smrg
32003d13e800SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
32013d13e800Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
32023d13e800SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
32033d13e800Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
32043d13e800Smrg#include <stdlib.h>
32053d13e800Smrg],[
32063d13e800Smrg    char *m0, *r0, *c0, *p;
32073d13e800Smrg    m0 = malloc(0);
32083d13e800Smrg    p = malloc(10);
32093d13e800Smrg    r0 = realloc(p,0);
32103d13e800Smrg    c0 = calloc(0,10);
32113d13e800Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
32123d13e800Smrg])],
32133d13e800Smrg		[xorg_cv_malloc0_returns_null=yes],
32143d13e800Smrg		[xorg_cv_malloc0_returns_null=no])])
32153d13e800SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
32168255a313Smrgfi
32173d13e800SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
32188255a313Smrg
32193d13e800Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
32203d13e800Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
32213d13e800Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
32223d13e800Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
322301395c31Smrgelse
32243d13e800Smrg	MALLOC_ZERO_CFLAGS=""
32253d13e800Smrg	XMALLOC_ZERO_CFLAGS=""
32263d13e800Smrg	XTMALLOC_ZERO_CFLAGS=""
32278255a313Smrgfi
32288255a313Smrg
32293d13e800SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
32303d13e800SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
32313d13e800SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
32323d13e800Smrg]) # XORG_CHECK_MALLOC_ZERO
3233de7ed6e8Smrg
32343d13e800Smrg# XORG_WITH_LINT()
32353d13e800Smrg# ----------------
32363d13e800Smrg# Minimum version: 1.1.0
3237de7ed6e8Smrg#
32383d13e800Smrg# This macro enables the use of a tool that flags some suspicious and
32393d13e800Smrg# non-portable constructs (likely to be bugs) in C language source code.
32403d13e800Smrg# It will attempt to locate the tool and use appropriate options.
32413d13e800Smrg# There are various lint type tools on different platforms.
32428255a313Smrg#
32433d13e800Smrg# Interface to module:
32443d13e800Smrg# LINT:		returns the path to the tool found on the platform
32453d13e800Smrg#		or the value set to LINT on the configure cmd line
32463d13e800Smrg#		also an Automake conditional
32473d13e800Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
32483d13e800Smrg#
32493d13e800Smrg# --with-lint:	'yes' user instructs the module to use lint
32503d13e800Smrg#		'no' user instructs the module not to use lint (default)
32513d13e800Smrg#
32523d13e800Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
32533d13e800Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
32543d13e800Smrg#
32553d13e800SmrgAC_DEFUN([XORG_WITH_LINT],[
325601395c31Smrg
32573d13e800SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
32583d13e800SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
32593d13e800SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
32603d13e800Smrg		[Use a lint-style source code checker (default: disabled)])],
32613d13e800Smrg		[use_lint=$withval], [use_lint=no])
326201395c31Smrg
32633d13e800Smrg# Obtain platform specific info like program name and options
32643d13e800Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
32653d13e800Smrgcase $host_os in
32663d13e800Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
32673d13e800Smrg	lint_name=splint
32683d13e800Smrg	lint_options="-badflag"
32693d13e800Smrg	;;
32703d13e800Smrg  *freebsd* | *netbsd*)
32713d13e800Smrg	lint_name=lint
32723d13e800Smrg	lint_options="-u -b"
32733d13e800Smrg	;;
32743d13e800Smrg  *solaris*)
32753d13e800Smrg	lint_name=lint
32763d13e800Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
32773d13e800Smrg	;;
32783d13e800Smrgesac
32793d13e800Smrg
32803d13e800Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
32813d13e800Smrgif test "x$use_lint" = x"yes" ; then
32823d13e800Smrg   AC_PATH_PROG([LINT], [$lint_name])
32833d13e800Smrg   if test "x$LINT" = "x"; then
32843d13e800Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
32853d13e800Smrg   fi
32863d13e800Smrgelif test "x$use_lint" = x"no" ; then
32873d13e800Smrg   if test "x$LINT" != "x"; then
32883d13e800Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
32893d13e800Smrg   fi
329001395c31Smrgelse
32913d13e800Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
329201395c31Smrgfi
329301395c31Smrg
32943d13e800Smrg# User supplied flags override default flags
32953d13e800Smrgif test "x$LINT_FLAGS" != "x"; then
32963d13e800Smrg   lint_options=$LINT_FLAGS
32973d13e800Smrgfi
329801395c31Smrg
32993d13e800SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
33003d13e800SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
330101395c31Smrg
33023d13e800Smrg]) # XORG_WITH_LINT
330301395c31Smrg
33043d13e800Smrg# XORG_LINT_LIBRARY(LIBNAME)
33053d13e800Smrg# --------------------------
33063d13e800Smrg# Minimum version: 1.1.0
33078255a313Smrg#
33083d13e800Smrg# Sets up flags for building lint libraries for checking programs that call
33093d13e800Smrg# functions in the library.
33103d13e800Smrg#
33113d13e800Smrg# Interface to module:
33123d13e800Smrg# LINTLIB		- Automake variable with the name of lint library file to make
33133d13e800Smrg# MAKE_LINT_LIB		- Automake conditional
33143d13e800Smrg#
33153d13e800Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
33163d13e800Smrg#			  - 'no' user instructs the module not to create a lint library (default)
33178255a313Smrg
33183d13e800SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
33193d13e800SmrgAC_REQUIRE([XORG_WITH_LINT])
33203d13e800SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
33213d13e800Smrg	[Create lint library (default: disabled)])],
33223d13e800Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
33233d13e800Smrg
33243d13e800Smrgif test "x$make_lint_lib" = x"yes" ; then
33253d13e800Smrg   LINTLIB=llib-l$1.ln
33263d13e800Smrg   if test "x$LINT" = "x"; then
33273d13e800Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
33283d13e800Smrg   fi
33293d13e800Smrgelif test "x$make_lint_lib" != x"no" ; then
33303d13e800Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
33318255a313Smrgfi
33328255a313Smrg
33333d13e800SmrgAC_SUBST(LINTLIB)
33343d13e800SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
333501395c31Smrg
33363d13e800Smrg]) # XORG_LINT_LIBRARY
33378255a313Smrg
33383d13e800Smrg# XORG_COMPILER_BRAND
333901395c31Smrg# -------------------
33403d13e800Smrg# Minimum version: 1.14.0
334101395c31Smrg#
33423d13e800Smrg# Checks for various brands of compilers and sets flags as appropriate:
33433d13e800Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
33443d13e800Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
33453d13e800Smrg#   clang compiler - sets CLANGCC to "yes"
33463d13e800Smrg#   Intel compiler - sets INTELCC to "yes"
33473d13e800Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
33483d13e800Smrg#
33493d13e800SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
33503d13e800SmrgAC_LANG_CASE(
33513d13e800Smrg	[C], [
33523d13e800Smrg		AC_REQUIRE([AC_PROG_CC_C99])
33533d13e800Smrg	],
33543d13e800Smrg	[C++], [
33553d13e800Smrg		AC_REQUIRE([AC_PROG_CXX])
33563d13e800Smrg	]
33573d13e800Smrg)
33583d13e800SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
33593d13e800SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
33603d13e800SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
33613d13e800Smrg]) # XORG_COMPILER_BRAND
33628255a313Smrg
33633d13e800Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
336401395c31Smrg# ---------------
33653d13e800Smrg# Minimum version: 1.16.0
33663d13e800Smrg#
33673d13e800Smrg# Test if the compiler works when passed the given flag as a command line argument.
33683d13e800Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
33693d13e800Smrg# next flag in the list until there are no more options.
33703d13e800Smrg#
33713d13e800Smrg# Note that this does not guarantee that the compiler supports the flag as some
33723d13e800Smrg# compilers will simply ignore arguments that they do not understand, but we do
33733d13e800Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
33743d13e800Smrg# -Werror=unused-command-line-argument
33753d13e800Smrg#
33763d13e800SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
33773d13e800Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
33783d13e800Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
33798255a313Smrg
33803d13e800SmrgAC_LANG_COMPILER_REQUIRE
338101395c31Smrg
33823d13e800SmrgAC_LANG_CASE(
33833d13e800Smrg	[C], [
33843d13e800Smrg		AC_REQUIRE([AC_PROG_CC_C99])
33853d13e800Smrg		define([PREFIX], [C])
33863d13e800Smrg		define([CACHE_PREFIX], [cc])
33873d13e800Smrg		define([COMPILER], [$CC])
33883d13e800Smrg	],
33893d13e800Smrg	[C++], [
33903d13e800Smrg		define([PREFIX], [CXX])
33913d13e800Smrg		define([CACHE_PREFIX], [cxx])
33923d13e800Smrg		define([COMPILER], [$CXX])
33933d13e800Smrg	]
33943d13e800Smrg)
33953d13e800Smrg
33963d13e800Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
33973d13e800Smrg
33983d13e800Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
33993d13e800Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
34003d13e800Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
34013d13e800Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
34023d13e800Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
34033d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
34043d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
34053d13e800Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
34063d13e800Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
340701395c31Smrgfi
34083d13e800Smrg
34093d13e800Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
34103d13e800Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
34113d13e800Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
34123d13e800Smrg	fi
34133d13e800Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
34143d13e800Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
34153d13e800Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
34163d13e800Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
34173d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
34183d13e800Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
34193d13e800Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
34203d13e800Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
342101395c31Smrgfi
34223d13e800Smrg
34233d13e800Smrgfound="no"
34243d13e800Smrgm4_foreach([flag], m4_cdr($@), [
34253d13e800Smrg	if test $found = "no" ; then
34263d13e800Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
34273d13e800Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
34283d13e800Smrg		fi
34293d13e800Smrg
34303d13e800Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
34313d13e800Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
34323d13e800Smrg		fi
34333d13e800Smrg
34343d13e800Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
34353d13e800Smrg
34363d13e800Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
34373d13e800Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
34383d13e800Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
34393d13e800Smrg		AC_CACHE_VAL($cacheid,
34403d13e800Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
34413d13e800Smrg					     [eval $cacheid=yes],
34423d13e800Smrg					     [eval $cacheid=no])])
34433d13e800Smrg
34443d13e800Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
34453d13e800Smrg
34463d13e800Smrg		eval supported=\$$cacheid
34473d13e800Smrg		AC_MSG_RESULT([$supported])
34483d13e800Smrg		if test "$supported" = "yes" ; then
34493d13e800Smrg			$1="$$1 ]flag["
34503d13e800Smrg			found="yes"
34513d13e800Smrg		fi
34523d13e800Smrg	fi
345301395c31Smrg])
34543d13e800Smrg]) # XORG_TESTSET_CFLAG
345501395c31Smrg
34563d13e800Smrg# XORG_COMPILER_FLAGS
34573d13e800Smrg# ---------------
34583d13e800Smrg# Minimum version: 1.16.0
34598255a313Smrg#
34603d13e800Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
34613d13e800Smrg# arguments supported by the selected compiler which do NOT alter the generated
34623d13e800Smrg# code.  These arguments will cause the compiler to print various warnings
34633d13e800Smrg# during compilation AND turn a conservative set of warnings into errors.
34643d13e800Smrg#
34653d13e800Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
34663d13e800Smrg# future versions of util-macros as options are added to new compilers.
34673d13e800Smrg#
34683d13e800SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
34693d13e800SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
347001395c31Smrg
34713d13e800SmrgAC_ARG_ENABLE(selective-werror,
34723d13e800Smrg              AS_HELP_STRING([--disable-selective-werror],
34733d13e800Smrg                             [Turn off selective compiler errors. (default: enabled)]),
34743d13e800Smrg              [SELECTIVE_WERROR=$enableval],
34753d13e800Smrg              [SELECTIVE_WERROR=yes])
34763d13e800Smrg
34773d13e800SmrgAC_LANG_CASE(
34783d13e800Smrg        [C], [
34793d13e800Smrg                define([PREFIX], [C])
34803d13e800Smrg        ],
34813d13e800Smrg        [C++], [
34823d13e800Smrg                define([PREFIX], [CXX])
34833d13e800Smrg        ]
34843d13e800Smrg)
34853d13e800Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
34863d13e800Smrgif test "x$SUNCC" = "xyes"; then
34873d13e800Smrg    [BASE_]PREFIX[FLAGS]="-v"
348801395c31Smrgelse
34893d13e800Smrg    [BASE_]PREFIX[FLAGS]=""
349001395c31Smrgfi
349101395c31Smrg
34923d13e800Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
34933d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
34943d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
34953d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
34963d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
349701395c31Smrg
34983d13e800SmrgAC_LANG_CASE(
34993d13e800Smrg	[C], [
35003d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
35013d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
35023d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
35033d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
35043d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
35053d13e800Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
35063d13e800Smrg	]
35073d13e800Smrg)
350801395c31Smrg
35093d13e800Smrg# This chunk adds additional warnings that could catch undesired effects.
35103d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
35113d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
35123d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
35133d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
35143d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
35153d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
35163d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
35178255a313Smrg
35183d13e800Smrg# These are currently disabled because they are noisy.  They will be enabled
35193d13e800Smrg# in the future once the codebase is sufficiently modernized to silence
35203d13e800Smrg# them.  For now, I don't want them to drown out the other warnings.
35213d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
35223d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
35233d13e800Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
35248255a313Smrg
35253d13e800Smrg# Turn some warnings into errors, so we don't accidently get successful builds
35263d13e800Smrg# when there are problems that should be fixed.
35278255a313Smrg
35283d13e800Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
35293d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
35303d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
35313d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
35323d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
35333d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
35343d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
35353d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
35363d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
35373d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
35383d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
35393d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
35403d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
35413d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
35423d13e800Smrgelse
35433d13e800SmrgAC_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])
35443d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
35453d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
35463d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
35473d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
35483d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
35493d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
35503d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
35513d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
35523d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
35533d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
35543d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
35553d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
35563d13e800SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
35573d13e800Smrgfi
35588255a313Smrg
35593d13e800SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
35603d13e800Smrg]) # XORG_COMPILER_FLAGS
35618255a313Smrg
35623d13e800Smrg# XORG_CWARNFLAGS
35633d13e800Smrg# ---------------
35643d13e800Smrg# Minimum version: 1.2.0
35653d13e800Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
356601395c31Smrg#
35673d13e800Smrg# Defines CWARNFLAGS to enable C compiler warnings.
356801395c31Smrg#
35693d13e800Smrg# This function is deprecated because it defines -fno-strict-aliasing
35703d13e800Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
35713d13e800Smrg# is needed, then it should be added explicitly in the module when
35723d13e800Smrg# it is updated to use BASE_CFLAGS.
357301395c31Smrg#
35743d13e800SmrgAC_DEFUN([XORG_CWARNFLAGS], [
35753d13e800SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
35763d13e800SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
35773d13e800SmrgAC_LANG_CASE(
35783d13e800Smrg	[C], [
35793d13e800Smrg		CWARNFLAGS="$BASE_CFLAGS"
35803d13e800Smrg		if  test "x$GCC" = xyes ; then
35813d13e800Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
35823d13e800Smrg		fi
35833d13e800Smrg		AC_SUBST(CWARNFLAGS)
35843d13e800Smrg	]
35853d13e800Smrg)
35863d13e800Smrg]) # XORG_CWARNFLAGS
35878255a313Smrg
35883d13e800Smrg# XORG_STRICT_OPTION
35893d13e800Smrg# -----------------------
35903d13e800Smrg# Minimum version: 1.3.0
35913d13e800Smrg#
35923d13e800Smrg# Add configure option to enable strict compilation flags, such as treating
35933d13e800Smrg# warnings as fatal errors.
35943d13e800Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
35953d13e800Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
35963d13e800Smrg#
35973d13e800Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
35983d13e800Smrg# when strict compilation is unconditionally desired.
35993d13e800SmrgAC_DEFUN([XORG_STRICT_OPTION], [
36003d13e800SmrgAC_REQUIRE([XORG_CWARNFLAGS])
36013d13e800SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
360201395c31Smrg
36033d13e800SmrgAC_ARG_ENABLE(strict-compilation,
36043d13e800Smrg			  AS_HELP_STRING([--enable-strict-compilation],
36053d13e800Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
36063d13e800Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
360701395c31Smrg
36083d13e800SmrgAC_LANG_CASE(
36093d13e800Smrg        [C], [
36103d13e800Smrg                define([PREFIX], [C])
36113d13e800Smrg        ],
36123d13e800Smrg        [C++], [
36133d13e800Smrg                define([PREFIX], [CXX])
36143d13e800Smrg        ]
36153d13e800Smrg)
361601395c31Smrg
36173d13e800Smrg[STRICT_]PREFIX[FLAGS]=""
36183d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
36193d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
362001395c31Smrg
36213d13e800Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
36223d13e800Smrg# activate it with -Werror, so we add it here explicitly.
36233d13e800SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
362401395c31Smrg
36253d13e800Smrgif test "x$STRICT_COMPILE" = "xyes"; then
36263d13e800Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
36273d13e800Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
36283d13e800Smrgfi
36293d13e800SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
36303d13e800SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
36313d13e800SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
36323d13e800Smrg]) # XORG_STRICT_OPTION
363301395c31Smrg
36343d13e800Smrg# XORG_DEFAULT_OPTIONS
36353d13e800Smrg# --------------------
36363d13e800Smrg# Minimum version: 1.3.0
36373d13e800Smrg#
36383d13e800Smrg# Defines default options for X.Org modules.
36393d13e800Smrg#
36403d13e800SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
36413d13e800SmrgAC_REQUIRE([AC_PROG_INSTALL])
36423d13e800SmrgXORG_COMPILER_FLAGS
36433d13e800SmrgXORG_CWARNFLAGS
36443d13e800SmrgXORG_STRICT_OPTION
36453d13e800SmrgXORG_RELEASE_VERSION
36463d13e800SmrgXORG_CHANGELOG
36473d13e800SmrgXORG_INSTALL
36483d13e800SmrgXORG_MANPAGE_SECTIONS
36493d13e800Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
36503d13e800Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
36513d13e800Smrg]) # XORG_DEFAULT_OPTIONS
36528255a313Smrg
36533d13e800Smrg# XORG_INSTALL()
36543d13e800Smrg# ----------------
36553d13e800Smrg# Minimum version: 1.4.0
36563d13e800Smrg#
36573d13e800Smrg# Defines the variable INSTALL_CMD as the command to copy
36583d13e800Smrg# INSTALL from $prefix/share/util-macros.
36593d13e800Smrg#
36603d13e800SmrgAC_DEFUN([XORG_INSTALL], [
36613d13e800SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
36623d13e800Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
36633d13e800SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
36643d13e800Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
36653d13e800Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
36663d13e800Smrgtouch \$(top_srcdir)/INSTALL; \
36673d13e800Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
36683d13e800SmrgAC_SUBST([INSTALL_CMD])
36693d13e800Smrg]) # XORG_INSTALL
36703d13e800Smrgdnl Copyright 2005 Red Hat, Inc
36713d13e800Smrgdnl
36723d13e800Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
36733d13e800Smrgdnl documentation for any purpose is hereby granted without fee, provided that
36743d13e800Smrgdnl the above copyright notice appear in all copies and that both that
36753d13e800Smrgdnl copyright notice and this permission notice appear in supporting
36763d13e800Smrgdnl documentation.
36773d13e800Smrgdnl
36783d13e800Smrgdnl The above copyright notice and this permission notice shall be included
36793d13e800Smrgdnl in all copies or substantial portions of the Software.
36803d13e800Smrgdnl
36813d13e800Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36823d13e800Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36833d13e800Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36843d13e800Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
36853d13e800Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
36863d13e800Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
36873d13e800Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
36883d13e800Smrgdnl
36893d13e800Smrgdnl Except as contained in this notice, the name of the copyright holders shall
36903d13e800Smrgdnl not be used in advertising or otherwise to promote the sale, use or
36913d13e800Smrgdnl other dealings in this Software without prior written authorization
36923d13e800Smrgdnl from the copyright holders.
36933d13e800Smrgdnl
369401395c31Smrg
36953d13e800Smrg# XORG_RELEASE_VERSION
36963d13e800Smrg# --------------------
36973d13e800Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
36988255a313Smrg
36993d13e800SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
37003d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
37013d13e800Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
37023d13e800Smrg		[Major version of this package])
37033d13e800Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
37043d13e800Smrg	if test "x$PVM" = "x"; then
37053d13e800Smrg		PVM="0"
37063d13e800Smrg	fi
37073d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
37083d13e800Smrg		[$PVM],
37093d13e800Smrg		[Minor version of this package])
37103d13e800Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
37113d13e800Smrg	if test "x$PVP" = "x"; then
37123d13e800Smrg		PVP="0"
37133d13e800Smrg	fi
37143d13e800Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
37153d13e800Smrg		[$PVP],
37163d13e800Smrg		[Patch version of this package])
37173d13e800Smrg])
37188255a313Smrg
37193d13e800Smrg# XORG_CHANGELOG()
37203d13e800Smrg# ----------------
37213d13e800Smrg# Minimum version: 1.2.0
37223d13e800Smrg#
37233d13e800Smrg# Defines the variable CHANGELOG_CMD as the command to generate
37243d13e800Smrg# ChangeLog from git.
37253d13e800Smrg#
37263d13e800Smrg#
37273d13e800SmrgAC_DEFUN([XORG_CHANGELOG], [
37283d13e800SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
37293d13e800Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
37303d13e800Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
37313d13e800Smrgtouch \$(top_srcdir)/ChangeLog; \
37323d13e800Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
37333d13e800SmrgAC_SUBST([CHANGELOG_CMD])
37343d13e800Smrg]) # XORG_CHANGELOG
37358255a313Smrg
3736