146374b8dSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
20c7e83b2Smrg
346374b8dSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
49aa228fdSmrg
59aa228fdSmrg# This file is free software; the Free Software Foundation
69aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
79aa228fdSmrg# with or without modifications, as long as this notice is preserved.
89aa228fdSmrg
99aa228fdSmrg# This program is distributed in the hope that it will be useful,
109aa228fdSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
119aa228fdSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
129aa228fdSmrg# PARTICULAR PURPOSE.
139aa228fdSmrg
140c7e83b2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
168f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1746374b8dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1846374b8dSmrg[m4_warning([this file was generated for autoconf 2.72.
198f65982aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208f65982aSmrgIf you have problems, you may need to regenerate the build system entirely.
210c7e83b2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
229aa228fdSmrg
2346374b8dSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
249aa228fdSmrg#
259aa228fdSmrg# This file is free software; the Free Software Foundation
269aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
279aa228fdSmrg# with or without modifications, as long as this notice is preserved.
289aa228fdSmrg
299aa228fdSmrg# AM_AUTOMAKE_VERSION(VERSION)
309aa228fdSmrg# ----------------------------
319aa228fdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
329aa228fdSmrg# generated from the m4 files accompanying Automake X.Y.
339aa228fdSmrg# (This private macro should not be called outside this file.)
349aa228fdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3546374b8dSmrg[am__api_version='1.17'
369aa228fdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379aa228fdSmrgdnl require some minimum version.  Point them to the right macro.
3846374b8dSmrgm4_if([$1], [1.17], [],
399aa228fdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409aa228fdSmrg])
419aa228fdSmrg
429aa228fdSmrg# _AM_AUTOCONF_VERSION(VERSION)
439aa228fdSmrg# -----------------------------
449aa228fdSmrg# aclocal traces this macro to find the Autoconf version.
459aa228fdSmrg# This is a private macro too.  Using m4_define simplifies
469aa228fdSmrg# the logic in aclocal, which can simply ignore this definition.
479aa228fdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
489aa228fdSmrg
499aa228fdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
509aa228fdSmrg# -------------------------------
519aa228fdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528f65982aSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
539aa228fdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5446374b8dSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
558f65982aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
568f65982aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578f65982aSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
589aa228fdSmrg
599aa228fdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
609aa228fdSmrg
6146374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
629aa228fdSmrg#
639aa228fdSmrg# This file is free software; the Free Software Foundation
649aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
659aa228fdSmrg# with or without modifications, as long as this notice is preserved.
669aa228fdSmrg
679aa228fdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680c7e83b2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690c7e83b2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
709aa228fdSmrg#
719aa228fdSmrg# Of course, Automake must honor this variable whenever it calls a
729aa228fdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
739aa228fdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
749aa228fdSmrg# depending on how configure is run.  This is pretty annoying, since
759aa228fdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
769aa228fdSmrg# source directory, any form will work fine, but in subdirectories a
779aa228fdSmrg# relative path needs to be adjusted first.
789aa228fdSmrg#
799aa228fdSmrg# $ac_aux_dir/missing
809aa228fdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
819aa228fdSmrg# $top_srcdir/$ac_aux_dir/missing
829aa228fdSmrg#    fails if $ac_aux_dir is absolute,
839aa228fdSmrg#    fails when called from a subdirectory in a VPATH build with
849aa228fdSmrg#          a relative $ac_aux_dir
859aa228fdSmrg#
869aa228fdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
879aa228fdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
880c7e83b2Smrg# harmless because $srcdir is '.', but things will broke when you
899aa228fdSmrg# start a VPATH build or use an absolute $srcdir.
909aa228fdSmrg#
919aa228fdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
929aa228fdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
939aa228fdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
949aa228fdSmrg# and then we would define $MISSING as
959aa228fdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
969aa228fdSmrg# This will work as long as MISSING is not called from configure, because
979aa228fdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
989aa228fdSmrg# However there are other variables, like CC, which are often used in
999aa228fdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1009aa228fdSmrg#
1019aa228fdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1029aa228fdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1039aa228fdSmrg# configured tree to be moved without reconfiguration.
1049aa228fdSmrg
1059aa228fdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060c7e83b2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070c7e83b2Smrg# Expand $ac_aux_dir to an absolute path.
1080c7e83b2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1099aa228fdSmrg])
1109aa228fdSmrg
1119aa228fdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1129aa228fdSmrg
11346374b8dSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
1149aa228fdSmrg#
1159aa228fdSmrg# This file is free software; the Free Software Foundation
1169aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1179aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1189aa228fdSmrg
1199aa228fdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1209aa228fdSmrg# -------------------------------------
1219aa228fdSmrg# Define a conditional.
1229aa228fdSmrgAC_DEFUN([AM_CONDITIONAL],
1230c7e83b2Smrg[AC_PREREQ([2.52])dnl
1240c7e83b2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250c7e83b2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1269aa228fdSmrgAC_SUBST([$1_TRUE])dnl
1279aa228fdSmrgAC_SUBST([$1_FALSE])dnl
1289aa228fdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1299aa228fdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1308f65982aSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1319aa228fdSmrgif $2; then
1329aa228fdSmrg  $1_TRUE=
1339aa228fdSmrg  $1_FALSE='#'
1349aa228fdSmrgelse
1359aa228fdSmrg  $1_TRUE='#'
1369aa228fdSmrg  $1_FALSE=
1379aa228fdSmrgfi
1389aa228fdSmrgAC_CONFIG_COMMANDS_PRE(
1399aa228fdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1409aa228fdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1419aa228fdSmrgUsually this means the macro was only invoked conditionally.]])
1429aa228fdSmrgfi])])
1439aa228fdSmrg
14446374b8dSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
1459aa228fdSmrg#
1469aa228fdSmrg# This file is free software; the Free Software Foundation
1479aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
1489aa228fdSmrg# with or without modifications, as long as this notice is preserved.
1499aa228fdSmrg
1509aa228fdSmrg
1510c7e83b2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1529aa228fdSmrg# written in clear, in which case automake, when reading aclocal.m4,
1539aa228fdSmrg# will think it sees a *use*, and therefore will trigger all it's
1549aa228fdSmrg# C support machinery.  Also note that it means that autoscan, seeing
1559aa228fdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1569aa228fdSmrg
1579aa228fdSmrg
1589aa228fdSmrg# _AM_DEPENDENCIES(NAME)
1599aa228fdSmrg# ----------------------
1609aa228fdSmrg# See how the compiler implements dependency checking.
1610c7e83b2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1629aa228fdSmrg# We try a few techniques and use that to set a single cache variable.
1639aa228fdSmrg#
1649aa228fdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1659aa228fdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1669aa228fdSmrg# dependency, and given that the user is not expected to run this macro,
1679aa228fdSmrg# just rely on AC_PROG_CC.
1689aa228fdSmrgAC_DEFUN([_AM_DEPENDENCIES],
1699aa228fdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1709aa228fdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1719aa228fdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1729aa228fdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1739aa228fdSmrg
1740c7e83b2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1750c7e83b2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1760c7e83b2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1770c7e83b2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1780c7e83b2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1790c7e83b2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1800c7e83b2Smrg                    [depcc="$$1"   am_compiler_list=])
1819aa228fdSmrg
1829aa228fdSmrgAC_CACHE_CHECK([dependency style of $depcc],
1839aa228fdSmrg               [am_cv_$1_dependencies_compiler_type],
1849aa228fdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1859aa228fdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1869aa228fdSmrg  # making bogus files that we don't know about and never remove.  For
1879aa228fdSmrg  # instance it was reported that on HP-UX the gcc test will end up
1880c7e83b2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1890c7e83b2Smrg  # in D".
19080b026c6Smrg  rm -rf conftest.dir
1919aa228fdSmrg  mkdir conftest.dir
1929aa228fdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1939aa228fdSmrg  # using a relative directory.
1949aa228fdSmrg  cp "$am_depcomp" conftest.dir
1959aa228fdSmrg  cd conftest.dir
1969aa228fdSmrg  # We will build objects and dependencies in a subdirectory because
1979aa228fdSmrg  # it helps to detect inapplicable dependency modes.  For instance
1989aa228fdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1999aa228fdSmrg  # side effect of compilation, but ICC will put the dependencies in
2009aa228fdSmrg  # the current directory while Tru64 will put them in the object
2019aa228fdSmrg  # directory.
2029aa228fdSmrg  mkdir sub
2039aa228fdSmrg
2049aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
2059aa228fdSmrg  if test "$am_compiler_list" = ""; then
2069aa228fdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2079aa228fdSmrg  fi
2088f65982aSmrg  am__universal=false
2098f65982aSmrg  m4_case([$1], [CC],
2108f65982aSmrg    [case " $depcc " in #(
2118f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2128f65982aSmrg     esac],
2138f65982aSmrg    [CXX],
2148f65982aSmrg    [case " $depcc " in #(
2158f65982aSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2168f65982aSmrg     esac])
2178f65982aSmrg
2189aa228fdSmrg  for depmode in $am_compiler_list; do
2199aa228fdSmrg    # Setup a source with many dependencies, because some compilers
2209aa228fdSmrg    # like to wrap large dependency lists on column 80 (with \), and
2219aa228fdSmrg    # we should not choose a depcomp mode which is confused by this.
2229aa228fdSmrg    #
2239aa228fdSmrg    # We need to recreate these files for each test, as the compiler may
2249aa228fdSmrg    # overwrite some of them when testing with obscure command lines.
2259aa228fdSmrg    # This happens at least with the AIX C compiler.
2269aa228fdSmrg    : > sub/conftest.c
2279aa228fdSmrg    for i in 1 2 3 4 5 6; do
2289aa228fdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2290c7e83b2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2300c7e83b2Smrg      # Solaris 10 /bin/sh.
2310c7e83b2Smrg      echo '/* dummy */' > sub/conftst$i.h
2329aa228fdSmrg    done
2339aa228fdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2349aa228fdSmrg
2350c7e83b2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2368f65982aSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2370c7e83b2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2380c7e83b2Smrg    # versions had trouble with output in subdirs.
2398f65982aSmrg    am__obj=sub/conftest.${OBJEXT-o}
2408f65982aSmrg    am__minus_obj="-o $am__obj"
2419aa228fdSmrg    case $depmode in
2428f65982aSmrg    gcc)
2438f65982aSmrg      # This depmode causes a compiler race in universal mode.
2448f65982aSmrg      test "$am__universal" = false || continue
2458f65982aSmrg      ;;
2469aa228fdSmrg    nosideeffect)
2470c7e83b2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2480c7e83b2Smrg      # only be used when explicitly requested.
2499aa228fdSmrg      if test "x$enable_dependency_tracking" = xyes; then
2509aa228fdSmrg	continue
2519aa228fdSmrg      else
2529aa228fdSmrg	break
2539aa228fdSmrg      fi
2549aa228fdSmrg      ;;
25580b026c6Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2560c7e83b2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2578f65982aSmrg      # not run yet.  These depmodes are late enough in the game, and
2588f65982aSmrg      # so weak that their functioning should not be impacted.
2598f65982aSmrg      am__obj=conftest.${OBJEXT-o}
2608f65982aSmrg      am__minus_obj=
2618f65982aSmrg      ;;
2629aa228fdSmrg    none) break ;;
2639aa228fdSmrg    esac
2649aa228fdSmrg    if depmode=$depmode \
2658f65982aSmrg       source=sub/conftest.c object=$am__obj \
2669aa228fdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2678f65982aSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2689aa228fdSmrg         >/dev/null 2>conftest.err &&
2699aa228fdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2709aa228fdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2718f65982aSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2729aa228fdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2739aa228fdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2749aa228fdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2759aa228fdSmrg      # that says an option was ignored or not supported.
27646374b8dSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
2779aa228fdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2789aa228fdSmrg      # The diagnosis changed in icc 8.0:
2799aa228fdSmrg      #   icc: Command line remark: option '-MP' not supported
2809aa228fdSmrg      if (grep 'ignoring option' conftest.err ||
2819aa228fdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2829aa228fdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2839aa228fdSmrg        break
2849aa228fdSmrg      fi
2859aa228fdSmrg    fi
2869aa228fdSmrg  done
2879aa228fdSmrg
2889aa228fdSmrg  cd ..
2899aa228fdSmrg  rm -rf conftest.dir
2909aa228fdSmrgelse
2919aa228fdSmrg  am_cv_$1_dependencies_compiler_type=none
2929aa228fdSmrgfi
2939aa228fdSmrg])
2949aa228fdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2959aa228fdSmrgAM_CONDITIONAL([am__fastdep$1], [
2969aa228fdSmrg  test "x$enable_dependency_tracking" != xno \
2979aa228fdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2989aa228fdSmrg])
2999aa228fdSmrg
3009aa228fdSmrg
3019aa228fdSmrg# AM_SET_DEPDIR
3029aa228fdSmrg# -------------
3039aa228fdSmrg# Choose a directory name for dependency files.
3040c7e83b2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3059aa228fdSmrgAC_DEFUN([AM_SET_DEPDIR],
3069aa228fdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3079aa228fdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3089aa228fdSmrg])
3099aa228fdSmrg
3109aa228fdSmrg
3119aa228fdSmrg# AM_DEP_TRACK
3129aa228fdSmrg# ------------
3139aa228fdSmrgAC_DEFUN([AM_DEP_TRACK],
3140c7e83b2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3150c7e83b2SmrgAS_HELP_STRING(
3160c7e83b2Smrg  [--enable-dependency-tracking],
3170c7e83b2Smrg  [do not reject slow dependency extractors])
3180c7e83b2SmrgAS_HELP_STRING(
3190c7e83b2Smrg  [--disable-dependency-tracking],
3200c7e83b2Smrg  [speeds up one-time build])])
3219aa228fdSmrgif test "x$enable_dependency_tracking" != xno; then
3229aa228fdSmrg  am_depcomp="$ac_aux_dir/depcomp"
3239aa228fdSmrg  AMDEPBACKSLASH='\'
32480b026c6Smrg  am__nodep='_no'
3259aa228fdSmrgfi
3269aa228fdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3279aa228fdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3289aa228fdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32980b026c6SmrgAC_SUBST([am__nodep])dnl
33080b026c6Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3319aa228fdSmrg])
3329aa228fdSmrg
3339aa228fdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3349aa228fdSmrg
33546374b8dSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
3369aa228fdSmrg#
3379aa228fdSmrg# This file is free software; the Free Software Foundation
3389aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
3399aa228fdSmrg# with or without modifications, as long as this notice is preserved.
3409aa228fdSmrg
3419aa228fdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3429aa228fdSmrg# ------------------------------
3439aa228fdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3448f65982aSmrg[{
3450c7e83b2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3468f65982aSmrg  # are listed without --file.  Let's play safe and only enable the eval
3478f65982aSmrg  # if we detect the quoting.
348e39ce84cSmrg  # TODO: see whether this extra hack can be removed once we start
349e39ce84cSmrg  # requiring Autoconf 2.70 or later.
350e39ce84cSmrg  AS_CASE([$CONFIG_FILES],
351e39ce84cSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352e39ce84cSmrg          [*], [set x $CONFIG_FILES])
3538f65982aSmrg  shift
354e39ce84cSmrg  # Used to flag and report bootstrapping failures.
355e39ce84cSmrg  am_rc=0
356e39ce84cSmrg  for am_mf
3578f65982aSmrg  do
3588f65982aSmrg    # Strip MF so we end up with the name of the file.
359e39ce84cSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360e39ce84cSmrg    # Check whether this is an Automake generated Makefile which includes
361e39ce84cSmrg    # dependency-tracking related rules and includes.
362e39ce84cSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3638f65982aSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364e39ce84cSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365e39ce84cSmrg      || continue
366e39ce84cSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367e39ce84cSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368e39ce84cSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369e39ce84cSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370e39ce84cSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3719aa228fdSmrg  done
372e39ce84cSmrg  if test $am_rc -ne 0; then
373e39ce84cSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374e39ce84cSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375e39ce84cSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376e39ce84cSmrg    necessary).  You can also try re-running configure with the
377e39ce84cSmrg    '--disable-dependency-tracking' option to at least be able to build
378e39ce84cSmrg    the package (albeit without support for automatic dependency tracking).])
379e39ce84cSmrg  fi
380e39ce84cSmrg  AS_UNSET([am_dirpart])
381e39ce84cSmrg  AS_UNSET([am_filepart])
382e39ce84cSmrg  AS_UNSET([am_mf])
383e39ce84cSmrg  AS_UNSET([am_rc])
384e39ce84cSmrg  rm -f conftest-deps.mk
3858f65982aSmrg}
3869aa228fdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3879aa228fdSmrg
3889aa228fdSmrg
3899aa228fdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3909aa228fdSmrg# -----------------------------
3919aa228fdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3929aa228fdSmrg#
393e39ce84cSmrg# This code is only required when automatic dependency tracking is enabled.
394e39ce84cSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395e39ce84cSmrg# order to bootstrap the dependency handling code.
3969aa228fdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3979aa228fdSmrg[AC_CONFIG_COMMANDS([depfiles],
3989aa228fdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399e39ce84cSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4009aa228fdSmrg
4019aa228fdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4029aa228fdSmrg
40346374b8dSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4049aa228fdSmrg#
4059aa228fdSmrg# This file is free software; the Free Software Foundation
4069aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
4079aa228fdSmrg# with or without modifications, as long as this notice is preserved.
4089aa228fdSmrg
4099aa228fdSmrg# This macro actually does too much.  Some checks are only needed if
4109aa228fdSmrg# your package does certain things.  But this isn't really a big deal.
4119aa228fdSmrg
4120c7e83b2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4130c7e83b2Smrgm4_define([AC_PROG_CC],
4140c7e83b2Smrgm4_defn([AC_PROG_CC])
4150c7e83b2Smrg[_AM_PROG_CC_C_O
4160c7e83b2Smrg])
4170c7e83b2Smrg
4189aa228fdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4199aa228fdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
4209aa228fdSmrg# -----------------------------------------------
4219aa228fdSmrg# The call with PACKAGE and VERSION arguments is the old style
4229aa228fdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4239aa228fdSmrg# and VERSION should now be passed to AC_INIT and removed from
4249aa228fdSmrg# the call to AM_INIT_AUTOMAKE.
4259aa228fdSmrg# We support both call styles for the transition.  After
4269aa228fdSmrg# the next Automake release, Autoconf can make the AC_INIT
4279aa228fdSmrg# arguments mandatory, and then we can depend on a new Autoconf
4289aa228fdSmrg# release and drop the old call support.
4299aa228fdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4300c7e83b2Smrg[AC_PREREQ([2.65])dnl
431e39ce84cSmrgm4_ifdef([_$0_ALREADY_INIT],
432e39ce84cSmrg  [m4_fatal([$0 expanded multiple times
433e39ce84cSmrg]m4_defn([_$0_ALREADY_INIT]))],
434e39ce84cSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4359aa228fdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4369aa228fdSmrgdnl the ones we care about.
4379aa228fdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4389aa228fdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4399aa228fdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4409aa228fdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4419aa228fdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4429aa228fdSmrg  # is not polluted with repeated "-I."
4439aa228fdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4449aa228fdSmrg  # test to see if srcdir already configured
4459aa228fdSmrg  if test -f $srcdir/config.status; then
4469aa228fdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4479aa228fdSmrg  fi
4489aa228fdSmrgfi
4499aa228fdSmrg
4509aa228fdSmrg# test whether we have cygpath
4519aa228fdSmrgif test -z "$CYGPATH_W"; then
4529aa228fdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4539aa228fdSmrg    CYGPATH_W='cygpath -w'
4549aa228fdSmrg  else
4559aa228fdSmrg    CYGPATH_W=echo
4569aa228fdSmrg  fi
4579aa228fdSmrgfi
4589aa228fdSmrgAC_SUBST([CYGPATH_W])
4599aa228fdSmrg
4609aa228fdSmrg# Define the identity of the package.
4619aa228fdSmrgdnl Distinguish between old-style and new-style calls.
4629aa228fdSmrgm4_ifval([$2],
4630c7e83b2Smrg[AC_DIAGNOSE([obsolete],
4640c7e83b2Smrg             [$0: two- and three-arguments forms are deprecated.])
4650c7e83b2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4669aa228fdSmrg AC_SUBST([PACKAGE], [$1])dnl
4679aa228fdSmrg AC_SUBST([VERSION], [$2])],
4689aa228fdSmrg[_AM_SET_OPTIONS([$1])dnl
4699aa228fdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4700c7e83b2Smrgm4_if(
471e39ce84cSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4720c7e83b2Smrg  [ok:ok],,
4739aa228fdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4749aa228fdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4759aa228fdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4769aa228fdSmrg
4779aa228fdSmrg_AM_IF_OPTION([no-define],,
4780c7e83b2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4790c7e83b2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4809aa228fdSmrg
4819aa228fdSmrg# Some tools Automake needs.
4829aa228fdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4839aa228fdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4840c7e83b2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4850c7e83b2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4860c7e83b2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4870c7e83b2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4880c7e83b2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4898f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4908f65982aSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4910c7e83b2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4920c7e83b2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4930c7e83b2Smrg# dies out for good.  For more background, see:
494e39ce84cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495e39ce84cSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4960c7e83b2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4970c7e83b2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4980c7e83b2Smrg# system "awk" is bad on some platforms.
4999aa228fdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
5009aa228fdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5019aa228fdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5029aa228fdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5038f65982aSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5048f65982aSmrg			     [_AM_PROG_TAR([v7])])])
5059aa228fdSmrg_AM_IF_OPTION([no-dependencies],,
5069aa228fdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5070c7e83b2Smrg		  [_AM_DEPENDENCIES([CC])],
5080c7e83b2Smrg		  [m4_define([AC_PROG_CC],
5090c7e83b2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5109aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5110c7e83b2Smrg		  [_AM_DEPENDENCIES([CXX])],
5120c7e83b2Smrg		  [m4_define([AC_PROG_CXX],
5130c7e83b2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5149aa228fdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5150c7e83b2Smrg		  [_AM_DEPENDENCIES([OBJC])],
5160c7e83b2Smrg		  [m4_define([AC_PROG_OBJC],
5170c7e83b2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5180c7e83b2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5190c7e83b2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5200c7e83b2Smrg		  [m4_define([AC_PROG_OBJCXX],
5210c7e83b2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5229aa228fdSmrg])
523e39ce84cSmrg# Variables for tags utilities; see am/tags.am
524e39ce84cSmrgif test -z "$CTAGS"; then
525e39ce84cSmrg  CTAGS=ctags
526e39ce84cSmrgfi
527e39ce84cSmrgAC_SUBST([CTAGS])
528e39ce84cSmrgif test -z "$ETAGS"; then
529e39ce84cSmrg  ETAGS=etags
530e39ce84cSmrgfi
531e39ce84cSmrgAC_SUBST([ETAGS])
532e39ce84cSmrgif test -z "$CSCOPE"; then
533e39ce84cSmrg  CSCOPE=cscope
534e39ce84cSmrgfi
535e39ce84cSmrgAC_SUBST([CSCOPE])
536e39ce84cSmrg
53746374b8dSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5380c7e83b2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5390c7e83b2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5400c7e83b2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5418f65982aSmrgAC_CONFIG_COMMANDS_PRE(dnl
5428f65982aSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5438f65982aSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5440c7e83b2Smrg
54546374b8dSmrgAC_REQUIRE([_AM_PROG_RM_F])
54646374b8dSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5470c7e83b2Smrg
5480c7e83b2Smrgdnl The trailing newline in this macro's definition is deliberate, for
5490c7e83b2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5500c7e83b2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5519aa228fdSmrg])
5529aa228fdSmrg
5530c7e83b2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5548f65982aSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5558f65982aSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5568f65982aSmrgm4_define([_AC_COMPILER_EXEEXT],
5578f65982aSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5588f65982aSmrg
5599aa228fdSmrg# When config.status generates a header, we must update the stamp-h file.
5609aa228fdSmrg# This file resides in the same directory as the config header
5619aa228fdSmrg# that is generated.  The stamp files are numbered to have different names.
5629aa228fdSmrg
5639aa228fdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5649aa228fdSmrg# loop where config.status creates the headers, so we can generate
5659aa228fdSmrg# our stamp files there.
5669aa228fdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5679aa228fdSmrg[# Compute $1's index in $config_headers.
5688f65982aSmrg_am_arg=$1
5699aa228fdSmrg_am_stamp_count=1
5709aa228fdSmrgfor _am_header in $config_headers :; do
5719aa228fdSmrg  case $_am_header in
5728f65982aSmrg    $_am_arg | $_am_arg:* )
5739aa228fdSmrg      break ;;
5749aa228fdSmrg    * )
5759aa228fdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5769aa228fdSmrg  esac
5779aa228fdSmrgdone
5788f65982aSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5799aa228fdSmrg
58046374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5819aa228fdSmrg#
5829aa228fdSmrg# This file is free software; the Free Software Foundation
5839aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
5849aa228fdSmrg# with or without modifications, as long as this notice is preserved.
5859aa228fdSmrg
5869aa228fdSmrg# AM_PROG_INSTALL_SH
5879aa228fdSmrg# ------------------
5889aa228fdSmrg# Define $install_sh.
5899aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5909aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5910c7e83b2Smrgif test x"${install_sh+set}" != xset; then
5928f65982aSmrg  case $am_aux_dir in
5938f65982aSmrg  *\ * | *\	*)
5948f65982aSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5958f65982aSmrg  *)
5968f65982aSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5978f65982aSmrg  esac
5988f65982aSmrgfi
5990c7e83b2SmrgAC_SUBST([install_sh])])
6009aa228fdSmrg
60146374b8dSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
6029aa228fdSmrg#
6039aa228fdSmrg# This file is free software; the Free Software Foundation
6049aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6059aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6069aa228fdSmrg
6079aa228fdSmrg# Check whether the underlying file-system supports filenames
6089aa228fdSmrg# with a leading dot.  For instance MS-DOS doesn't.
6099aa228fdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
6109aa228fdSmrg[rm -rf .tst 2>/dev/null
6119aa228fdSmrgmkdir .tst 2>/dev/null
6129aa228fdSmrgif test -d .tst; then
6139aa228fdSmrg  am__leading_dot=.
6149aa228fdSmrgelse
6159aa228fdSmrg  am__leading_dot=_
6169aa228fdSmrgfi
6179aa228fdSmrgrmdir .tst 2>/dev/null
6189aa228fdSmrgAC_SUBST([am__leading_dot])])
6199aa228fdSmrg
6209aa228fdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6219aa228fdSmrg
62246374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6239aa228fdSmrg#
6249aa228fdSmrg# This file is free software; the Free Software Foundation
6259aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6269aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6279aa228fdSmrg
6289aa228fdSmrg# AM_MAKE_INCLUDE()
6299aa228fdSmrg# -----------------
630e39ce84cSmrg# Check whether make has an 'include' directive that can support all
631e39ce84cSmrg# the idioms we need for our automatic dependency tracking code.
6329aa228fdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
633e39ce84cSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
634e39ce84cSmrgcat > confinc.mk << 'END'
6359aa228fdSmrgam__doit:
636e39ce84cSmrg	@echo this is the am__doit target >confinc.out
6379aa228fdSmrg.PHONY: am__doit
6389aa228fdSmrgEND
6399aa228fdSmrgam__include="#"
6409aa228fdSmrgam__quote=
641e39ce84cSmrg# BSD make does it like this.
642e39ce84cSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
643e39ce84cSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
644e39ce84cSmrgecho 'include confinc.mk # ignored' > confmf.GNU
645e39ce84cSmrg_am_result=no
646e39ce84cSmrgfor s in GNU BSD; do
647e39ce84cSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
648e39ce84cSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
649e39ce84cSmrg      ['0:this is the am__doit target'],
650e39ce84cSmrg      [AS_CASE([$s],
651e39ce84cSmrg          [BSD], [am__include='.include' am__quote='"'],
652e39ce84cSmrg          [am__include='include' am__quote=''])])
653e39ce84cSmrg  if test "$am__include" != "#"; then
654e39ce84cSmrg    _am_result="yes ($s style)"
655e39ce84cSmrg    break
656e39ce84cSmrg  fi
657e39ce84cSmrgdone
658e39ce84cSmrgrm -f confinc.* confmf.*
659e39ce84cSmrgAC_MSG_RESULT([${_am_result}])
660e39ce84cSmrgAC_SUBST([am__include])])
661e39ce84cSmrgAC_SUBST([am__quote])])
6629aa228fdSmrg
6639aa228fdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6649aa228fdSmrg
66546374b8dSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6669aa228fdSmrg#
6679aa228fdSmrg# This file is free software; the Free Software Foundation
6689aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
6699aa228fdSmrg# with or without modifications, as long as this notice is preserved.
6709aa228fdSmrg
6719aa228fdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
6729aa228fdSmrg# ------------------------------
6739aa228fdSmrgAC_DEFUN([AM_MISSING_PROG],
6749aa228fdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6759aa228fdSmrg$1=${$1-"${am_missing_run}$2"}
6769aa228fdSmrgAC_SUBST($1)])
6779aa228fdSmrg
6789aa228fdSmrg# AM_MISSING_HAS_RUN
6799aa228fdSmrg# ------------------
6800c7e83b2Smrg# Define MISSING if not defined so far and test if it is modern enough.
6810c7e83b2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
6829aa228fdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6839aa228fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6849aa228fdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
6858f65982aSmrgif test x"${MISSING+set}" != xset; then
686e39ce84cSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6878f65982aSmrgfi
6889aa228fdSmrg# Use eval to expand $SHELL
6890c7e83b2Smrgif eval "$MISSING --is-lightweight"; then
6900c7e83b2Smrg  am_missing_run="$MISSING "
6919aa228fdSmrgelse
6929aa228fdSmrg  am_missing_run=
6930c7e83b2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
6949aa228fdSmrgfi
6959aa228fdSmrg])
6969aa228fdSmrg
6979aa228fdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
6989aa228fdSmrg
69946374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7009aa228fdSmrg#
7019aa228fdSmrg# This file is free software; the Free Software Foundation
7029aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7039aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7049aa228fdSmrg
7059aa228fdSmrg# _AM_MANGLE_OPTION(NAME)
7069aa228fdSmrg# -----------------------
7079aa228fdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
7089aa228fdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7099aa228fdSmrg
7109aa228fdSmrg# _AM_SET_OPTION(NAME)
71180b026c6Smrg# --------------------
7129aa228fdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
7139aa228fdSmrgAC_DEFUN([_AM_SET_OPTION],
7140c7e83b2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7159aa228fdSmrg
7169aa228fdSmrg# _AM_SET_OPTIONS(OPTIONS)
71780b026c6Smrg# ------------------------
7189aa228fdSmrg# OPTIONS is a space-separated list of Automake options.
7199aa228fdSmrgAC_DEFUN([_AM_SET_OPTIONS],
7208f65982aSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7219aa228fdSmrg
7229aa228fdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7239aa228fdSmrg# -------------------------------------------
7249aa228fdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7259aa228fdSmrgAC_DEFUN([_AM_IF_OPTION],
7269aa228fdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7279aa228fdSmrg
72846374b8dSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7290c7e83b2Smrg#
7300c7e83b2Smrg# This file is free software; the Free Software Foundation
7310c7e83b2Smrg# gives unlimited permission to copy and/or distribute it,
7320c7e83b2Smrg# with or without modifications, as long as this notice is preserved.
7339aa228fdSmrg
7340c7e83b2Smrg# _AM_PROG_CC_C_O
7350c7e83b2Smrg# ---------------
7360c7e83b2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7370c7e83b2Smrg# to automatically call this.
7380c7e83b2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7390c7e83b2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7400c7e83b2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7410c7e83b2SmrgAC_LANG_PUSH([C])dnl
7420c7e83b2SmrgAC_CACHE_CHECK(
7430c7e83b2Smrg  [whether $CC understands -c and -o together],
7440c7e83b2Smrg  [am_cv_prog_cc_c_o],
7450c7e83b2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7460c7e83b2Smrg  # Make sure it works both with $CC and with simple cc.
7470c7e83b2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7480c7e83b2Smrg  # compilers refuse to overwrite an existing .o file with -o,
7490c7e83b2Smrg  # though they will create one.
7500c7e83b2Smrg  am_cv_prog_cc_c_o=yes
7510c7e83b2Smrg  for am_i in 1 2; do
7520c7e83b2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7530c7e83b2Smrg         && test -f conftest2.$ac_objext; then
7540c7e83b2Smrg      : OK
7550c7e83b2Smrg    else
7560c7e83b2Smrg      am_cv_prog_cc_c_o=no
7570c7e83b2Smrg      break
7580c7e83b2Smrg    fi
7590c7e83b2Smrg  done
7600c7e83b2Smrg  rm -f core conftest*
7610c7e83b2Smrg  unset am_i])
7620c7e83b2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7630c7e83b2Smrg   # Losing compiler, so override with the script.
7640c7e83b2Smrg   # FIXME: It is wrong to rewrite CC.
7650c7e83b2Smrg   # But if we don't then we get into trouble of one sort or another.
7660c7e83b2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7670c7e83b2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7680c7e83b2Smrg   CC="$am_aux_dir/compile $CC"
7690c7e83b2Smrgfi
7700c7e83b2SmrgAC_LANG_POP([C])])
7710c7e83b2Smrg
7720c7e83b2Smrg# For backward compatibility.
7730c7e83b2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7740c7e83b2Smrg
77546374b8dSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
77646374b8dSmrg#
77746374b8dSmrg# This file is free software; the Free Software Foundation
77846374b8dSmrg# gives unlimited permission to copy and/or distribute it,
77946374b8dSmrg# with or without modifications, as long as this notice is preserved.
78046374b8dSmrg
78146374b8dSmrg# _AM_PROG_RM_F
78246374b8dSmrg# ---------------
78346374b8dSmrg# Check whether 'rm -f' without any arguments works.
78446374b8dSmrg# https://bugs.gnu.org/10828
78546374b8dSmrgAC_DEFUN([_AM_PROG_RM_F],
78646374b8dSmrg[am__rm_f_notfound=
78746374b8dSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
78846374b8dSmrgAC_SUBST(am__rm_f_notfound)
78946374b8dSmrg])
79046374b8dSmrg
79146374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7929aa228fdSmrg#
7939aa228fdSmrg# This file is free software; the Free Software Foundation
7949aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
7959aa228fdSmrg# with or without modifications, as long as this notice is preserved.
7969aa228fdSmrg
7970c7e83b2Smrg# AM_RUN_LOG(COMMAND)
7980c7e83b2Smrg# -------------------
7990c7e83b2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8000c7e83b2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8010c7e83b2SmrgAC_DEFUN([AM_RUN_LOG],
8020c7e83b2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8030c7e83b2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8040c7e83b2Smrg   ac_status=$?
8050c7e83b2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8060c7e83b2Smrg   (exit $ac_status); }])
8070c7e83b2Smrg
8080c7e83b2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8090c7e83b2Smrg
81046374b8dSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8110c7e83b2Smrg#
8120c7e83b2Smrg# This file is free software; the Free Software Foundation
8130c7e83b2Smrg# gives unlimited permission to copy and/or distribute it,
8140c7e83b2Smrg# with or without modifications, as long as this notice is preserved.
8159aa228fdSmrg
81646374b8dSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
81746374b8dSmrg# ----------------------------
81846374b8dSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
81946374b8dSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
82046374b8dSmrg               am_cv_sleep_fractional_seconds, [dnl
82146374b8dSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
82246374b8dSmrg                                 [am_cv_sleep_fractional_seconds=no])
82346374b8dSmrg])])
82446374b8dSmrg
82546374b8dSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
82646374b8dSmrg# -----------------------------------
82746374b8dSmrg# Determine the filesystem's resolution for file modification
82846374b8dSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
82946374b8dSmrg# of only two seconds, even with the most recent "exFAT" extensions.
83046374b8dSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
83146374b8dSmrg# nanosecond, matching clock_gettime.  However, it is probably not
83246374b8dSmrg# possible to delay execution of a shell script for less than one
83346374b8dSmrg# millisecond, due to process creation overhead and scheduling
83446374b8dSmrg# granularity, so we don't check for anything finer than that. (See below.)
83546374b8dSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
83646374b8dSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
83746374b8dSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
83846374b8dSmrg               am_cv_filesystem_timestamp_resolution, [dnl
83946374b8dSmrg# Default to the worst case.
84046374b8dSmrgam_cv_filesystem_timestamp_resolution=2
84146374b8dSmrg
84246374b8dSmrg# Only try to go finer than 1 sec if sleep can do it.
84346374b8dSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
84446374b8dSmrg# - 1 sec is not much of a win compared to 2 sec, and
84546374b8dSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
84646374b8dSmrg# 
84746374b8dSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
84846374b8dSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
84946374b8dSmrg# exchange for not incurring the 2s delay for running the test for all
85046374b8dSmrg# packages.
85146374b8dSmrg#
85246374b8dSmrgam_try_resolutions=
85346374b8dSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
85446374b8dSmrg  # Even a millisecond often causes a bunch of false positives,
85546374b8dSmrg  # so just try a hundredth of a second. The time saved between .001 and
85646374b8dSmrg  # .01 is not terribly consequential.
85746374b8dSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
85846374b8dSmrgfi
85946374b8dSmrg
86046374b8dSmrg# In order to catch current-generation FAT out, we must *modify* files
86146374b8dSmrg# that already exist; the *creation* timestamp is finer.  Use names
86246374b8dSmrg# that make ls -t sort them differently when they have equal
86346374b8dSmrg# timestamps than when they have distinct timestamps, keeping
86446374b8dSmrg# in mind that ls -t prints the *newest* file first.
86546374b8dSmrgrm -f conftest.ts?
86646374b8dSmrg: > conftest.ts1
86746374b8dSmrg: > conftest.ts2
86846374b8dSmrg: > conftest.ts3
86946374b8dSmrg
87046374b8dSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
87146374b8dSmrg# clobber the current shell's arguments. (Outer-level square brackets
87246374b8dSmrg# are removed by m4; they're present so that m4 does not expand
87346374b8dSmrg# <dollar><star>; be careful, easy to get confused.)
87446374b8dSmrgif (
87546374b8dSmrg     set X `[ls -t conftest.ts[12]]` &&
87646374b8dSmrg     {
87746374b8dSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
87846374b8dSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
87946374b8dSmrg     }
88046374b8dSmrg); then :; else
88146374b8dSmrg  # If neither matched, then we have a broken ls.  This can happen
88246374b8dSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
88346374b8dSmrg  # broken ls alias from the environment.  This has actually
88446374b8dSmrg  # happened.  Such a system could not be considered "sane".
88546374b8dSmrg  _AS_ECHO_UNQUOTED(
88646374b8dSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
88746374b8dSmrg    [AS_MESSAGE_LOG_FD])
88846374b8dSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
88946374b8dSmrgMake sure there is not a broken ls alias in your environment.])
89046374b8dSmrgfi
89146374b8dSmrg
89246374b8dSmrgfor am_try_res in $am_try_resolutions; do
89346374b8dSmrg  # Any one fine-grained sleep might happen to cross the boundary
89446374b8dSmrg  # between two values of a coarser actual resolution, but if we do
89546374b8dSmrg  # two fine-grained sleeps in a row, at least one of them will fall
89646374b8dSmrg  # entirely within a coarse interval.
89746374b8dSmrg  echo alpha > conftest.ts1
89846374b8dSmrg  sleep $am_try_res
89946374b8dSmrg  echo beta > conftest.ts2
90046374b8dSmrg  sleep $am_try_res
90146374b8dSmrg  echo gamma > conftest.ts3
90246374b8dSmrg
90346374b8dSmrg  # We assume that 'ls -t' will make use of high-resolution
90446374b8dSmrg  # timestamps if the operating system supports them at all.
90546374b8dSmrg  if (set X `ls -t conftest.ts?` &&
90646374b8dSmrg      test "$[]2" = conftest.ts3 &&
90746374b8dSmrg      test "$[]3" = conftest.ts2 &&
90846374b8dSmrg      test "$[]4" = conftest.ts1); then
90946374b8dSmrg    #
91046374b8dSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
91146374b8dSmrg    # because we don't need to test make.
91246374b8dSmrg    make_ok=true
91346374b8dSmrg    if test $am_try_res != 1; then
91446374b8dSmrg      # But if we've succeeded so far with a subsecond resolution, we
91546374b8dSmrg      # have one more thing to check: make. It can happen that
91646374b8dSmrg      # everything else supports the subsecond mtimes, but make doesn't;
91746374b8dSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
91846374b8dSmrg      # released under GPLv2). https://bugs.gnu.org/68808
91946374b8dSmrg      # 
92046374b8dSmrg      # We test $MAKE if it is defined in the environment, else "make".
92146374b8dSmrg      # It might get overridden later, but our hope is that in practice
92246374b8dSmrg      # it does not matter: it is the system "make" which is (by far)
92346374b8dSmrg      # the most likely to be broken, whereas if the user overrides it,
92446374b8dSmrg      # probably they did so with a better, or at least not worse, make.
92546374b8dSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
92646374b8dSmrg      #
92746374b8dSmrg      # Create a Makefile (real tab character here):
92846374b8dSmrg      rm -f conftest.mk
92946374b8dSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
93046374b8dSmrg      echo '	touch conftest.ts2' >>conftest.mk
93146374b8dSmrg      #
93246374b8dSmrg      # Now, running
93346374b8dSmrg      #   touch conftest.ts1; touch conftest.ts2; make
93446374b8dSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
93546374b8dSmrg      # but most often, it will fail if make's support is insufficient. So
93646374b8dSmrg      # test for several consecutive successes.
93746374b8dSmrg      #
93846374b8dSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
93946374b8dSmrg      # files, not create new ones, per above.)
94046374b8dSmrg      n=0
94146374b8dSmrg      make=${MAKE-make}
94246374b8dSmrg      until test $n -eq 3; do
94346374b8dSmrg        echo one > conftest.ts1
94446374b8dSmrg        sleep $am_try_res
94546374b8dSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
94646374b8dSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
94746374b8dSmrg          make_ok=false
94846374b8dSmrg          break # out of $n loop
94946374b8dSmrg        fi
95046374b8dSmrg        n=`expr $n + 1`
95146374b8dSmrg      done
95246374b8dSmrg    fi
95346374b8dSmrg    #
95446374b8dSmrg    if $make_ok; then
95546374b8dSmrg      # Everything we know to check worked out, so call this resolution good.
95646374b8dSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
95746374b8dSmrg      break # out of $am_try_res loop
95846374b8dSmrg    fi
95946374b8dSmrg    # Otherwise, we'll go on to check the next resolution.
96046374b8dSmrg  fi
96146374b8dSmrgdone
96246374b8dSmrgrm -f conftest.ts?
96346374b8dSmrg# (end _am_filesystem_timestamp_resolution)
96446374b8dSmrg])])
96546374b8dSmrg
9669aa228fdSmrg# AM_SANITY_CHECK
9679aa228fdSmrg# ---------------
9689aa228fdSmrgAC_DEFUN([AM_SANITY_CHECK],
96946374b8dSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
97046374b8dSmrg# This check should not be cached, as it may vary across builds of
97146374b8dSmrg# different projects.
97246374b8dSmrgAC_MSG_CHECKING([whether build environment is sane])
9738f65982aSmrg# Reject unsafe characters in $srcdir or the absolute working directory
9748f65982aSmrg# name.  Accept space and tab only in the latter.
9758f65982aSmrgam_lf='
9768f65982aSmrg'
9778f65982aSmrgcase `pwd` in
9788f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9798f65982aSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9808f65982aSmrgesac
9818f65982aSmrgcase $srcdir in
9828f65982aSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9830c7e83b2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9848f65982aSmrgesac
9858f65982aSmrg
9860c7e83b2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
9879aa228fdSmrg# arguments.  Must try -L first in case configure is actually a
9889aa228fdSmrg# symlink; some systems play weird games with the mod time of symlinks
9899aa228fdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
9909aa228fdSmrg# directory).
99146374b8dSmrgam_build_env_is_sane=no
99246374b8dSmrgam_has_slept=no
99346374b8dSmrgrm -f conftest.file
99446374b8dSmrgfor am_try in 1 2; do
99546374b8dSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
99646374b8dSmrg  if (
99746374b8dSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
99846374b8dSmrg    if test "$[]*" = "X"; then
99946374b8dSmrg      # -L didn't work.
100046374b8dSmrg      set X `ls -t "$srcdir/configure" conftest.file`
100146374b8dSmrg    fi
100246374b8dSmrg    test "$[]2" = conftest.file
100346374b8dSmrg  ); then
100446374b8dSmrg    am_build_env_is_sane=yes
100546374b8dSmrg    break
100646374b8dSmrg  fi
100746374b8dSmrg  # Just in case.
100846374b8dSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
100946374b8dSmrg  am_has_slept=yes
101046374b8dSmrgdone
101146374b8dSmrg
101246374b8dSmrgAC_MSG_RESULT([$am_build_env_is_sane])
101346374b8dSmrgif test "$am_build_env_is_sane" = no; then
101446374b8dSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
10159aa228fdSmrgCheck your system clock])
10169aa228fdSmrgfi
101746374b8dSmrg
10180c7e83b2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10190c7e83b2Smrg# generated files are strictly newer.
10200c7e83b2Smrgam_sleep_pid=
102146374b8dSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
102246374b8dSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10230c7e83b2Smrg  am_sleep_pid=$!
102446374b8dSmrg])
10250c7e83b2SmrgAC_CONFIG_COMMANDS_PRE(
10260c7e83b2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10270c7e83b2Smrg   if test -n "$am_sleep_pid"; then
10280c7e83b2Smrg     # Hide warnings about reused PIDs.
10290c7e83b2Smrg     wait $am_sleep_pid 2>/dev/null
10300c7e83b2Smrg   fi
10310c7e83b2Smrg   AC_MSG_RESULT([done])])
10320c7e83b2Smrgrm -f conftest.file
10330c7e83b2Smrg])
10349aa228fdSmrg
103546374b8dSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10368f65982aSmrg#
10378f65982aSmrg# This file is free software; the Free Software Foundation
10388f65982aSmrg# gives unlimited permission to copy and/or distribute it,
10398f65982aSmrg# with or without modifications, as long as this notice is preserved.
10408f65982aSmrg
104146374b8dSmrg# _AM_SILENT_RULES
104246374b8dSmrg# ----------------
104346374b8dSmrg# Enable less verbose build rules support.
104446374b8dSmrgAC_DEFUN([_AM_SILENT_RULES],
104546374b8dSmrg[AM_DEFAULT_VERBOSITY=1
104646374b8dSmrgAC_ARG_ENABLE([silent-rules], [dnl
10470c7e83b2SmrgAS_HELP_STRING(
10480c7e83b2Smrg  [--enable-silent-rules],
10490c7e83b2Smrg  [less verbose build output (undo: "make V=1")])
10500c7e83b2SmrgAS_HELP_STRING(
10510c7e83b2Smrg  [--disable-silent-rules],
10520c7e83b2Smrg  [verbose build output (undo: "make V=0")])dnl
10530c7e83b2Smrg])
10540c7e83b2Smrgdnl
10550c7e83b2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10560c7e83b2Smrgdnl do not support nested variable expansions.
10570c7e83b2Smrgdnl See automake bug#9928 and bug#10237.
10580c7e83b2Smrgam_make=${MAKE-make}
10590c7e83b2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10600c7e83b2Smrg   [am_cv_make_support_nested_variables],
10610c7e83b2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10620c7e83b2SmrgBAR0=false
10630c7e83b2SmrgBAR1=true
10640c7e83b2SmrgV=1
10650c7e83b2Smrgam__doit:
10660c7e83b2Smrg	@$(TRUE)
10670c7e83b2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10680c7e83b2Smrg  am_cv_make_support_nested_variables=yes
10690c7e83b2Smrgelse
10700c7e83b2Smrg  am_cv_make_support_nested_variables=no
10710c7e83b2Smrgfi])
10720c7e83b2SmrgAC_SUBST([AM_V])dnl
10730c7e83b2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10740c7e83b2SmrgAC_SUBST([AM_DEFAULT_V])dnl
10750c7e83b2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10768f65982aSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10778f65982aSmrgAM_BACKSLASH='\'
10788f65982aSmrgAC_SUBST([AM_BACKSLASH])dnl
10798f65982aSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
108046374b8dSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
108146374b8dSmrgdnl to AM_SILENT_RULES to change the default value.
108246374b8dSmrgAC_CONFIG_COMMANDS_PRE([dnl
108346374b8dSmrgcase $enable_silent_rules in @%:@ (((
108446374b8dSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
108546374b8dSmrg   no) AM_DEFAULT_VERBOSITY=1;;
108646374b8dSmrgesac
108746374b8dSmrgif test $am_cv_make_support_nested_variables = yes; then
108846374b8dSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
108946374b8dSmrg  AM_V='$(V)'
109046374b8dSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
109146374b8dSmrgelse
109246374b8dSmrg  AM_V=$AM_DEFAULT_VERBOSITY
109346374b8dSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
109446374b8dSmrgfi
109546374b8dSmrg])dnl
10968f65982aSmrg])
10978f65982aSmrg
109846374b8dSmrg# AM_SILENT_RULES([DEFAULT])
109946374b8dSmrg# --------------------------
110046374b8dSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
110146374b8dSmrg# empty being verbose).
110246374b8dSmrgAC_DEFUN([AM_SILENT_RULES],
110346374b8dSmrg[AC_REQUIRE([_AM_SILENT_RULES])
110446374b8dSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
110546374b8dSmrg
110646374b8dSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11079aa228fdSmrg#
11089aa228fdSmrg# This file is free software; the Free Software Foundation
11099aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
11109aa228fdSmrg# with or without modifications, as long as this notice is preserved.
11119aa228fdSmrg
11129aa228fdSmrg# AM_PROG_INSTALL_STRIP
11139aa228fdSmrg# ---------------------
11140c7e83b2Smrg# One issue with vendor 'install' (even GNU) is that you can't
11159aa228fdSmrg# specify the program used to strip binaries.  This is especially
11169aa228fdSmrg# annoying in cross-compiling environments, where the build's strip
11179aa228fdSmrg# is unlikely to handle the host's binaries.
11189aa228fdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11190c7e83b2Smrg# always use install-sh in "make install-strip", and initialize
11209aa228fdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
11219aa228fdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
11229aa228fdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11230c7e83b2Smrg# Installed binaries are usually stripped using 'strip' when the user
11240c7e83b2Smrg# run "make install-strip".  However 'strip' might not be the right
11259aa228fdSmrg# tool to use in cross-compilation environments, therefore Automake
11260c7e83b2Smrg# will honor the 'STRIP' environment variable to overrule this program.
11270c7e83b2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
11289aa228fdSmrgif test "$cross_compiling" != no; then
11299aa228fdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
11309aa228fdSmrgfi
11319aa228fdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
11329aa228fdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11339aa228fdSmrg
113446374b8dSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
11359aa228fdSmrg#
11369aa228fdSmrg# This file is free software; the Free Software Foundation
11379aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
11389aa228fdSmrg# with or without modifications, as long as this notice is preserved.
11399aa228fdSmrg
11409aa228fdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
11419aa228fdSmrg# ---------------------------
11428f65982aSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
11439aa228fdSmrg# This macro is traced by Automake.
11449aa228fdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11459aa228fdSmrg
11468f65982aSmrg# AM_SUBST_NOTMAKE(VARIABLE)
114780b026c6Smrg# --------------------------
11488f65982aSmrg# Public sister of _AM_SUBST_NOTMAKE.
11498f65982aSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11508f65982aSmrg
11519aa228fdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
11529aa228fdSmrg
115346374b8dSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11549aa228fdSmrg#
11559aa228fdSmrg# This file is free software; the Free Software Foundation
11569aa228fdSmrg# gives unlimited permission to copy and/or distribute it,
11579aa228fdSmrg# with or without modifications, as long as this notice is preserved.
11589aa228fdSmrg
11599aa228fdSmrg# _AM_PROG_TAR(FORMAT)
11609aa228fdSmrg# --------------------
11619aa228fdSmrg# Check how to create a tarball in format FORMAT.
11620c7e83b2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11639aa228fdSmrg#
11649aa228fdSmrg# Substitute a variable $(am__tar) that is a command
11659aa228fdSmrg# writing to stdout a FORMAT-tarball containing the directory
11669aa228fdSmrg# $tardir.
11679aa228fdSmrg#     tardir=directory && $(am__tar) > result.tar
11689aa228fdSmrg#
11699aa228fdSmrg# Substitute a variable $(am__untar) that extract such
11709aa228fdSmrg# a tarball read from stdin.
11719aa228fdSmrg#     $(am__untar) < result.tar
11720c7e83b2Smrg#
11739aa228fdSmrgAC_DEFUN([_AM_PROG_TAR],
11740c7e83b2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11750c7e83b2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
11760c7e83b2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11770c7e83b2Smrg
11780c7e83b2Smrg# We'll loop over all known methods to create a tar archive until one works.
11799aa228fdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11809aa228fdSmrg
11810c7e83b2Smrgm4_if([$1], [v7],
11820c7e83b2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11830c7e83b2Smrg
11840c7e83b2Smrg  [m4_case([$1],
11850c7e83b2Smrg    [ustar],
11860c7e83b2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11870c7e83b2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11880c7e83b2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11890c7e83b2Smrg      # and bug#13588).
11900c7e83b2Smrg      am_max_uid=2097151 # 2^21 - 1
11910c7e83b2Smrg      am_max_gid=$am_max_uid
11920c7e83b2Smrg      # The $UID and $GID variables are not portable, so we need to resort
11930c7e83b2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11940c7e83b2Smrg      # below are definitely unexpected, so allow the users to see them
11950c7e83b2Smrg      # (that is, avoid stderr redirection).
11960c7e83b2Smrg      am_uid=`id -u || echo unknown`
11970c7e83b2Smrg      am_gid=`id -g || echo unknown`
11980c7e83b2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
119946374b8dSmrg      if test x$am_uid = xunknown; then
120046374b8dSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
120146374b8dSmrg      elif test $am_uid -le $am_max_uid; then
120246374b8dSmrg        AC_MSG_RESULT([yes])
12030c7e83b2Smrg      else
120446374b8dSmrg        AC_MSG_RESULT([no])
120546374b8dSmrg        _am_tools=none
12060c7e83b2Smrg      fi
12070c7e83b2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
120846374b8dSmrg      if test x$gm_gid = xunknown; then
120946374b8dSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
121046374b8dSmrg      elif test $am_gid -le $am_max_gid; then
121146374b8dSmrg        AC_MSG_RESULT([yes])
12120c7e83b2Smrg      else
12130c7e83b2Smrg        AC_MSG_RESULT([no])
12140c7e83b2Smrg        _am_tools=none
12150c7e83b2Smrg      fi],
12160c7e83b2Smrg
12170c7e83b2Smrg  [pax],
12180c7e83b2Smrg    [],
12190c7e83b2Smrg
12200c7e83b2Smrg  [m4_fatal([Unknown tar format])])
12210c7e83b2Smrg
12220c7e83b2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
12230c7e83b2Smrg
12240c7e83b2Smrg  # Go ahead even if we have the value already cached.  We do so because we
12250c7e83b2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12260c7e83b2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12270c7e83b2Smrg
12280c7e83b2Smrg  for _am_tool in $_am_tools; do
12290c7e83b2Smrg    case $_am_tool in
12300c7e83b2Smrg    gnutar)
12310c7e83b2Smrg      for _am_tar in tar gnutar gtar; do
12320c7e83b2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
12330c7e83b2Smrg      done
12340c7e83b2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12350c7e83b2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12360c7e83b2Smrg      am__untar="$_am_tar -xf -"
12370c7e83b2Smrg      ;;
12380c7e83b2Smrg    plaintar)
12390c7e83b2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12400c7e83b2Smrg      # ustar tarball either.
12410c7e83b2Smrg      (tar --version) >/dev/null 2>&1 && continue
12420c7e83b2Smrg      am__tar='tar chf - "$$tardir"'
12430c7e83b2Smrg      am__tar_='tar chf - "$tardir"'
12440c7e83b2Smrg      am__untar='tar xf -'
12450c7e83b2Smrg      ;;
12460c7e83b2Smrg    pax)
12470c7e83b2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
12480c7e83b2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
12490c7e83b2Smrg      am__untar='pax -r'
12500c7e83b2Smrg      ;;
12510c7e83b2Smrg    cpio)
12520c7e83b2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12530c7e83b2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12540c7e83b2Smrg      am__untar='cpio -i -H $1 -d'
12550c7e83b2Smrg      ;;
12560c7e83b2Smrg    none)
12570c7e83b2Smrg      am__tar=false
12580c7e83b2Smrg      am__tar_=false
12590c7e83b2Smrg      am__untar=false
12600c7e83b2Smrg      ;;
12610c7e83b2Smrg    esac
12629aa228fdSmrg
12630c7e83b2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
12640c7e83b2Smrg    # and am__untar set.
12650c7e83b2Smrg    test -n "${am_cv_prog_tar_$1}" && break
12660c7e83b2Smrg
12670c7e83b2Smrg    # tar/untar a dummy directory, and stop if the command works.
12680c7e83b2Smrg    rm -rf conftest.dir
12690c7e83b2Smrg    mkdir conftest.dir
12700c7e83b2Smrg    echo GrepMe > conftest.dir/file
12710c7e83b2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12720c7e83b2Smrg    rm -rf conftest.dir
12730c7e83b2Smrg    if test -s conftest.tar; then
12740c7e83b2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
12750c7e83b2Smrg      AM_RUN_LOG([cat conftest.dir/file])
12760c7e83b2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12770c7e83b2Smrg    fi
12780c7e83b2Smrg  done
12799aa228fdSmrg  rm -rf conftest.dir
12809aa228fdSmrg
12810c7e83b2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12820c7e83b2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
12830c7e83b2Smrg
12849aa228fdSmrgAC_SUBST([am__tar])
12859aa228fdSmrgAC_SUBST([am__untar])
12869aa228fdSmrg]) # _AM_PROG_TAR
12879aa228fdSmrg
128846374b8dSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
128946374b8dSmrg#
129046374b8dSmrg# This file is free software; the Free Software Foundation
129146374b8dSmrg# gives unlimited permission to copy and/or distribute it,
129246374b8dSmrg# with or without modifications, as long as this notice is preserved.
129346374b8dSmrg
129446374b8dSmrg# _AM_PROG_XARGS_N
129546374b8dSmrg# ----------------
129646374b8dSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
129746374b8dSmrg# is not optimized at all as we never expect to use it.
129846374b8dSmrgAC_DEFUN([_AM_PROG_XARGS_N],
129946374b8dSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
130046374b8dSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
130146374b8dSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
130246374b8dSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
130346374b8dSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
130446374b8dSmrg])dnl
130546374b8dSmrgAC_SUBST(am__xargs_n)
130646374b8dSmrg])
130746374b8dSmrg
1308e39ce84cSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1309e39ce84cSmrgdnl serial 11 (pkg-config-0.29)
1310e39ce84cSmrgdnl
1311e39ce84cSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1312e39ce84cSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1313e39ce84cSmrgdnl
1314e39ce84cSmrgdnl This program is free software; you can redistribute it and/or modify
1315e39ce84cSmrgdnl it under the terms of the GNU General Public License as published by
1316e39ce84cSmrgdnl the Free Software Foundation; either version 2 of the License, or
1317e39ce84cSmrgdnl (at your option) any later version.
1318e39ce84cSmrgdnl
1319e39ce84cSmrgdnl This program is distributed in the hope that it will be useful, but
1320e39ce84cSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1321e39ce84cSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1322e39ce84cSmrgdnl General Public License for more details.
1323e39ce84cSmrgdnl
1324e39ce84cSmrgdnl You should have received a copy of the GNU General Public License
1325e39ce84cSmrgdnl along with this program; if not, write to the Free Software
1326e39ce84cSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1327e39ce84cSmrgdnl 02111-1307, USA.
1328e39ce84cSmrgdnl
1329e39ce84cSmrgdnl As a special exception to the GNU General Public License, if you
1330e39ce84cSmrgdnl distribute this file as part of a program that contains a
1331e39ce84cSmrgdnl configuration script generated by Autoconf, you may include it under
1332e39ce84cSmrgdnl the same distribution terms that you use for the rest of that
1333e39ce84cSmrgdnl program.
1334e39ce84cSmrg
1335e39ce84cSmrgdnl PKG_PREREQ(MIN-VERSION)
1336e39ce84cSmrgdnl -----------------------
1337e39ce84cSmrgdnl Since: 0.29
1338e39ce84cSmrgdnl
1339e39ce84cSmrgdnl Verify that the version of the pkg-config macros are at least
1340e39ce84cSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1341e39ce84cSmrgdnl installed version of pkg-config, this checks the developer's version
1342e39ce84cSmrgdnl of pkg.m4 when generating configure.
1343e39ce84cSmrgdnl
1344e39ce84cSmrgdnl To ensure that this macro is defined, also add:
1345e39ce84cSmrgdnl m4_ifndef([PKG_PREREQ],
1346e39ce84cSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1347e39ce84cSmrgdnl
1348e39ce84cSmrgdnl See the "Since" comment for each macro you use to see what version
1349e39ce84cSmrgdnl of the macros you require.
1350e39ce84cSmrgm4_defun([PKG_PREREQ],
1351e39ce84cSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1352e39ce84cSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1353e39ce84cSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1354e39ce84cSmrg])dnl PKG_PREREQ
1355e39ce84cSmrg
1356e39ce84cSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1357e39ce84cSmrgdnl ----------------------------------
1358e39ce84cSmrgdnl Since: 0.16
1359e39ce84cSmrgdnl
1360e39ce84cSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1361e39ce84cSmrgdnl first found in the path. Checks that the version of pkg-config found
1362e39ce84cSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1363e39ce84cSmrgdnl used since that's the first version where most current features of
1364e39ce84cSmrgdnl pkg-config existed.
136580b026c6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
136680b026c6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1367e39ce84cSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1368e39ce84cSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1369e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1370e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1371e39ce84cSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372e39ce84cSmrg
137380b026c6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
137480b026c6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
137580b026c6Smrgfi
137680b026c6Smrgif test -n "$PKG_CONFIG"; then
137780b026c6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
137880b026c6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
137980b026c6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
138080b026c6Smrg		AC_MSG_RESULT([yes])
138180b026c6Smrg	else
138280b026c6Smrg		AC_MSG_RESULT([no])
138380b026c6Smrg		PKG_CONFIG=""
138480b026c6Smrg	fi
138580b026c6Smrgfi[]dnl
1386e39ce84cSmrg])dnl PKG_PROG_PKG_CONFIG
138780b026c6Smrg
1388e39ce84cSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1389e39ce84cSmrgdnl -------------------------------------------------------------------
1390e39ce84cSmrgdnl Since: 0.18
1391e39ce84cSmrgdnl
1392e39ce84cSmrgdnl Check to see whether a particular set of modules exists. Similar to
1393e39ce84cSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1394e39ce84cSmrgdnl
1395e39ce84cSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1396e39ce84cSmrgdnl only at the first occurence in configure.ac, so if the first place
1397e39ce84cSmrgdnl it's called might be skipped (such as if it is within an "if", you
1398e39ce84cSmrgdnl have to call PKG_CHECK_EXISTS manually
139980b026c6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
140080b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
140180b026c6Smrgif test -n "$PKG_CONFIG" && \
140280b026c6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1403e39ce84cSmrg  m4_default([$2], [:])
140480b026c6Smrgm4_ifvaln([$3], [else
140580b026c6Smrg  $3])dnl
140680b026c6Smrgfi])
140780b026c6Smrg
1408e39ce84cSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1409e39ce84cSmrgdnl ---------------------------------------------
1410e39ce84cSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1411e39ce84cSmrgdnl pkg_failed based on the result.
141280b026c6Smrgm4_define([_PKG_CONFIG],
141380b026c6Smrg[if test -n "$$1"; then
141480b026c6Smrg    pkg_cv_[]$1="$$1"
141580b026c6Smrg elif test -n "$PKG_CONFIG"; then
141680b026c6Smrg    PKG_CHECK_EXISTS([$3],
1417e39ce84cSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1418e39ce84cSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
141980b026c6Smrg		     [pkg_failed=yes])
142080b026c6Smrg else
142180b026c6Smrg    pkg_failed=untried
142280b026c6Smrgfi[]dnl
1423e39ce84cSmrg])dnl _PKG_CONFIG
142480b026c6Smrg
1425e39ce84cSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1426e39ce84cSmrgdnl ---------------------------
1427e39ce84cSmrgdnl Internal check to see if pkg-config supports short errors.
142880b026c6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
142980b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
143080b026c6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143180b026c6Smrg        _pkg_short_errors_supported=yes
143280b026c6Smrgelse
143380b026c6Smrg        _pkg_short_errors_supported=no
143480b026c6Smrgfi[]dnl
1435e39ce84cSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
143680b026c6Smrg
143780b026c6Smrg
1438e39ce84cSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1439e39ce84cSmrgdnl   [ACTION-IF-NOT-FOUND])
1440e39ce84cSmrgdnl --------------------------------------------------------------
1441e39ce84cSmrgdnl Since: 0.4.0
1442e39ce84cSmrgdnl
1443e39ce84cSmrgdnl Note that if there is a possibility the first call to
1444e39ce84cSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1445e39ce84cSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
144680b026c6SmrgAC_DEFUN([PKG_CHECK_MODULES],
144780b026c6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144880b026c6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
144980b026c6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
145080b026c6Smrg
145180b026c6Smrgpkg_failed=no
145280b026c6SmrgAC_MSG_CHECKING([for $1])
145380b026c6Smrg
145480b026c6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
145580b026c6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
145680b026c6Smrg
145780b026c6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145880b026c6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
145980b026c6SmrgSee the pkg-config man page for more details.])
146080b026c6Smrg
146180b026c6Smrgif test $pkg_failed = yes; then
1462e39ce84cSmrg   	AC_MSG_RESULT([no])
146380b026c6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146480b026c6Smrg        if test $_pkg_short_errors_supported = yes; then
1465e39ce84cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
146680b026c6Smrg        else 
1467e39ce84cSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
146880b026c6Smrg        fi
146980b026c6Smrg	# Put the nasty error message in config.log where it belongs
147080b026c6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147180b026c6Smrg
1472e39ce84cSmrg	m4_default([$4], [AC_MSG_ERROR(
147380b026c6Smrg[Package requirements ($2) were not met:
147480b026c6Smrg
147580b026c6Smrg$$1_PKG_ERRORS
147680b026c6Smrg
147780b026c6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
147880b026c6Smrginstalled software in a non-standard prefix.
147980b026c6Smrg
1480e39ce84cSmrg_PKG_TEXT])[]dnl
1481e39ce84cSmrg        ])
148280b026c6Smrgelif test $pkg_failed = untried; then
1483e39ce84cSmrg     	AC_MSG_RESULT([no])
1484e39ce84cSmrg	m4_default([$4], [AC_MSG_FAILURE(
148580b026c6Smrg[The pkg-config script could not be found or is too old.  Make sure it
148680b026c6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
148780b026c6Smrgpath to pkg-config.
148880b026c6Smrg
148980b026c6Smrg_PKG_TEXT
149080b026c6Smrg
1491e39ce84cSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1492e39ce84cSmrg        ])
149380b026c6Smrgelse
149480b026c6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
149580b026c6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
149680b026c6Smrg        AC_MSG_RESULT([yes])
1497e39ce84cSmrg	$3
149880b026c6Smrgfi[]dnl
1499e39ce84cSmrg])dnl PKG_CHECK_MODULES
1500e39ce84cSmrg
1501e39ce84cSmrg
1502e39ce84cSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1503e39ce84cSmrgdnl   [ACTION-IF-NOT-FOUND])
1504e39ce84cSmrgdnl ---------------------------------------------------------------------
1505e39ce84cSmrgdnl Since: 0.29
1506e39ce84cSmrgdnl
1507e39ce84cSmrgdnl Checks for existence of MODULES and gathers its build flags with
1508e39ce84cSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1509e39ce84cSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1510e39ce84cSmrgdnl
1511e39ce84cSmrgdnl Note that if there is a possibility the first call to
1512e39ce84cSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1513e39ce84cSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1514e39ce84cSmrgdnl configure.ac.
1515e39ce84cSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1516e39ce84cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1517e39ce84cSmrg_save_PKG_CONFIG=$PKG_CONFIG
1518e39ce84cSmrgPKG_CONFIG="$PKG_CONFIG --static"
1519e39ce84cSmrgPKG_CHECK_MODULES($@)
1520e39ce84cSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1521e39ce84cSmrg])dnl PKG_CHECK_MODULES_STATIC
1522e39ce84cSmrg
1523e39ce84cSmrg
1524e39ce84cSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1525e39ce84cSmrgdnl -------------------------
1526e39ce84cSmrgdnl Since: 0.27
1527e39ce84cSmrgdnl
1528e39ce84cSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1529e39ce84cSmrgdnl should install pkg-config .pc files. By default the directory is
1530e39ce84cSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1531e39ce84cSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1532e39ce84cSmrgdnl parameter.
1533e39ce84cSmrgAC_DEFUN([PKG_INSTALLDIR],
1534e39ce84cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535e39ce84cSmrgm4_pushdef([pkg_description],
1536e39ce84cSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537e39ce84cSmrgAC_ARG_WITH([pkgconfigdir],
1538e39ce84cSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539e39ce84cSmrg    [with_pkgconfigdir=]pkg_default)
1540e39ce84cSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541e39ce84cSmrgm4_popdef([pkg_default])
1542e39ce84cSmrgm4_popdef([pkg_description])
1543e39ce84cSmrg])dnl PKG_INSTALLDIR
1544e39ce84cSmrg
1545e39ce84cSmrg
1546e39ce84cSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1547e39ce84cSmrgdnl --------------------------------
1548e39ce84cSmrgdnl Since: 0.27
1549e39ce84cSmrgdnl
1550e39ce84cSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1551e39ce84cSmrgdnl module should install arch-independent pkg-config .pc files. By
1552e39ce84cSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1553e39ce84cSmrgdnl changed by passing DIRECTORY. The user can override through the
1554e39ce84cSmrgdnl --with-noarch-pkgconfigdir parameter.
1555e39ce84cSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1556e39ce84cSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1557e39ce84cSmrgm4_pushdef([pkg_description],
1558e39ce84cSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1559e39ce84cSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1560e39ce84cSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1561e39ce84cSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1562e39ce84cSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1563e39ce84cSmrgm4_popdef([pkg_default])
1564e39ce84cSmrgm4_popdef([pkg_description])
1565e39ce84cSmrg])dnl PKG_NOARCH_INSTALLDIR
1566e39ce84cSmrg
1567e39ce84cSmrg
1568e39ce84cSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1569e39ce84cSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1570e39ce84cSmrgdnl -------------------------------------------
1571e39ce84cSmrgdnl Since: 0.28
1572e39ce84cSmrgdnl
1573e39ce84cSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1574e39ce84cSmrgAC_DEFUN([PKG_CHECK_VAR],
1575e39ce84cSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1576e39ce84cSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577e39ce84cSmrg
1578e39ce84cSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1579e39ce84cSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580e39ce84cSmrg
1581e39ce84cSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1582e39ce84cSmrg])dnl PKG_CHECK_VAR
158380b026c6Smrg
158483d7c197Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15859aa228fdSmrgdnl
158646374b8dSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15870c7e83b2Smrgdnl
15889aa228fdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15898f65982aSmrgdnl copy of this software and associated documentation files (the "Software"),
15908f65982aSmrgdnl to deal in the Software without restriction, including without limitation
15918f65982aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15928f65982aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
15938f65982aSmrgdnl Software is furnished to do so, subject to the following conditions:
15949aa228fdSmrgdnl
15958f65982aSmrgdnl The above copyright notice and this permission notice (including the next
15968f65982aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
15978f65982aSmrgdnl Software.
15989aa228fdSmrgdnl
15998f65982aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16008f65982aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16018f65982aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16028f65982aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16038f65982aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16048f65982aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16058f65982aSmrgdnl DEALINGS IN THE SOFTWARE.
16069aa228fdSmrg
16079aa228fdSmrg# XORG_MACROS_VERSION(required-version)
16089aa228fdSmrg# -------------------------------------
16099aa228fdSmrg# Minimum version: 1.1.0
16109aa228fdSmrg#
16119aa228fdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
16129aa228fdSmrg# your configure.ac with the minimum required version, such as:
16139aa228fdSmrg# XORG_MACROS_VERSION(1.1)
16149aa228fdSmrg#
161583d7c197Smrg# To ensure that this macro is defined, also add:
161683d7c197Smrg# m4_ifndef([XORG_MACROS_VERSION],
161783d7c197Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16189aa228fdSmrg#
16199aa228fdSmrg#
16200c7e83b2Smrg# See the "minimum version" comment for each macro you use to see what
16219aa228fdSmrg# version you require.
162283d7c197Smrgm4_defun([XORG_MACROS_VERSION],[
162346374b8dSmrgm4_define([vers_have], [1.20.1])
162483d7c197Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
162583d7c197Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
162683d7c197Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
162783d7c197Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
162883d7c197Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
162983d7c197Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
163083d7c197Smrgm4_undefine([vers_have])
163183d7c197Smrgm4_undefine([maj_have])
163283d7c197Smrgm4_undefine([maj_needed])
16339aa228fdSmrg]) # XORG_MACROS_VERSION
16349aa228fdSmrg
16359aa228fdSmrg# XORG_PROG_RAWCPP()
16369aa228fdSmrg# ------------------
16379aa228fdSmrg# Minimum version: 1.0.0
16389aa228fdSmrg#
16399aa228fdSmrg# Find cpp program and necessary flags for use in pre-processing text files
16409aa228fdSmrg# such as man pages and config files
16419aa228fdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16429aa228fdSmrgAC_REQUIRE([AC_PROG_CPP])
1643e39ce84cSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16449aa228fdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16459aa228fdSmrg
16469aa228fdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16479aa228fdSmrg# which is not the best choice for supporting other OS'es, but covers most
16489aa228fdSmrg# of the ones we need for now.
16499aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
165080b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16519aa228fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16529aa228fdSmrg	AC_MSG_RESULT([no])
16539aa228fdSmrgelse
16549aa228fdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16559aa228fdSmrg		RAWCPPFLAGS=-undef
16569aa228fdSmrg		AC_MSG_RESULT([yes])
165783d7c197Smrg	# under Cygwin unix is still defined even with -undef
165883d7c197Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
165983d7c197Smrg		RAWCPPFLAGS="-undef -ansi"
166083d7c197Smrg		AC_MSG_RESULT([yes, with -ansi])
16619aa228fdSmrg	else
16629aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16639aa228fdSmrg	fi
16649aa228fdSmrgfi
16659aa228fdSmrgrm -f conftest.$ac_ext
16669aa228fdSmrg
16679aa228fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
166880b026c6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
166946374b8dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16709aa228fdSmrg	AC_MSG_RESULT([no])
16719aa228fdSmrgelse
167246374b8dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16730c7e83b2Smrg		TRADITIONALCPPFLAGS="-traditional"
16749aa228fdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16759aa228fdSmrg		AC_MSG_RESULT([yes])
16769aa228fdSmrg	else
16779aa228fdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16789aa228fdSmrg	fi
16799aa228fdSmrgfi
16809aa228fdSmrgrm -f conftest.$ac_ext
16819aa228fdSmrgAC_SUBST(RAWCPPFLAGS)
16820c7e83b2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
16839aa228fdSmrg]) # XORG_PROG_RAWCPP
16849aa228fdSmrg
16859aa228fdSmrg# XORG_MANPAGE_SECTIONS()
16869aa228fdSmrg# -----------------------
16879aa228fdSmrg# Minimum version: 1.0.0
16889aa228fdSmrg#
16899aa228fdSmrg# Determine which sections man pages go in for the different man page types
16909aa228fdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16919aa228fdSmrg# Not sure if there's any better way than just hardcoding by OS name.
16929aa228fdSmrg# Override default settings by setting environment variables
16938f65982aSmrg# Added MAN_SUBSTS in version 1.8
16948f65982aSmrg# Added AC_PROG_SED in version 1.8
16959aa228fdSmrg
16969aa228fdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16979aa228fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
16988f65982aSmrgAC_REQUIRE([AC_PROG_SED])
16999aa228fdSmrg
1700e39ce84cSmrgcase $host_os in
1701e39ce84cSmrg    solaris*)
1702e39ce84cSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1703e39ce84cSmrg        # check for a man page file found in later versions that use
1704e39ce84cSmrg        # traditional section numbers instead
1705e39ce84cSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1706e39ce84cSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1707e39ce84cSmrg        ;;
1708e39ce84cSmrg    *) SYSV_MAN_SECTIONS=false ;;
1709e39ce84cSmrgesac
1710e39ce84cSmrg
17119aa228fdSmrgif test x$APP_MAN_SUFFIX = x    ; then
17129aa228fdSmrg    APP_MAN_SUFFIX=1
17139aa228fdSmrgfi
17149aa228fdSmrgif test x$APP_MAN_DIR = x    ; then
17159aa228fdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17169aa228fdSmrgfi
17179aa228fdSmrg
17189aa228fdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
17199aa228fdSmrg    LIB_MAN_SUFFIX=3
17209aa228fdSmrgfi
17219aa228fdSmrgif test x$LIB_MAN_DIR = x    ; then
17229aa228fdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17239aa228fdSmrgfi
17249aa228fdSmrg
17259aa228fdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1726e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1727e39ce84cSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1728e39ce84cSmrg	*)				FILE_MAN_SUFFIX=5  ;;
17299aa228fdSmrg    esac
17309aa228fdSmrgfi
17319aa228fdSmrgif test x$FILE_MAN_DIR = x    ; then
17329aa228fdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
17339aa228fdSmrgfi
17349aa228fdSmrg
17359aa228fdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1736e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1737e39ce84cSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1738e39ce84cSmrg	*)				MISC_MAN_SUFFIX=7  ;;
17399aa228fdSmrg    esac
17409aa228fdSmrgfi
17419aa228fdSmrgif test x$MISC_MAN_DIR = x    ; then
17429aa228fdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
17439aa228fdSmrgfi
17449aa228fdSmrg
17459aa228fdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1746e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1747e39ce84cSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1748e39ce84cSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
17499aa228fdSmrg    esac
17509aa228fdSmrgfi
17519aa228fdSmrgif test x$DRIVER_MAN_DIR = x    ; then
17529aa228fdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
17539aa228fdSmrgfi
17549aa228fdSmrg
17559aa228fdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1756e39ce84cSmrg    case $SYSV_MAN_SECTIONS in
1757e39ce84cSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1758e39ce84cSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
17599aa228fdSmrg    esac
17609aa228fdSmrgfi
17619aa228fdSmrgif test x$ADMIN_MAN_DIR = x    ; then
17629aa228fdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17639aa228fdSmrgfi
17649aa228fdSmrg
17659aa228fdSmrg
17669aa228fdSmrgAC_SUBST([APP_MAN_SUFFIX])
17679aa228fdSmrgAC_SUBST([LIB_MAN_SUFFIX])
17689aa228fdSmrgAC_SUBST([FILE_MAN_SUFFIX])
17699aa228fdSmrgAC_SUBST([MISC_MAN_SUFFIX])
17709aa228fdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
17719aa228fdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
17729aa228fdSmrgAC_SUBST([APP_MAN_DIR])
17739aa228fdSmrgAC_SUBST([LIB_MAN_DIR])
17749aa228fdSmrgAC_SUBST([FILE_MAN_DIR])
17759aa228fdSmrgAC_SUBST([MISC_MAN_DIR])
17769aa228fdSmrgAC_SUBST([DRIVER_MAN_DIR])
17779aa228fdSmrgAC_SUBST([ADMIN_MAN_DIR])
17788f65982aSmrg
17798f65982aSmrgXORG_MAN_PAGE="X Version 11"
17808f65982aSmrgAC_SUBST([XORG_MAN_PAGE])
17818f65982aSmrgMAN_SUBSTS="\
17828f65982aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17838f65982aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17848f65982aSmrg	-e 's|__xservername__|Xorg|g' \
17858f65982aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
17868f65982aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
17878f65982aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
17888f65982aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
17898f65982aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
17908f65982aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
17918f65982aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
17928f65982aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
17938f65982aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
17948f65982aSmrgAC_SUBST([MAN_SUBSTS])
17958f65982aSmrg
17969aa228fdSmrg]) # XORG_MANPAGE_SECTIONS
17979aa228fdSmrg
17988f65982aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
17998f65982aSmrg# ------------------------
18008f65982aSmrg# Minimum version: 1.7.0
18018f65982aSmrg#
18028f65982aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
18038f65982aSmrg# provided by xorg-sgml-doctools, if installed.
18048f65982aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
18058f65982aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
18068f65982aSmrgXORG_SGML_PATH=
18078f65982aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
18088f65982aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
18098f65982aSmrg    [m4_ifval([$1],[:],
18108f65982aSmrg        [if test x"$cross_compiling" != x"yes" ; then
18118f65982aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
18128f65982aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
18138f65982aSmrg         fi])
18148f65982aSmrg    ])
18158f65982aSmrg
18168f65982aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
18178f65982aSmrg# the path and the name of the doc stylesheet
18188f65982aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
18198f65982aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
18208f65982aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
18218f65982aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18228f65982aSmrgelse
18238f65982aSmrg   AC_MSG_RESULT([no])
18248f65982aSmrgfi
18258f65982aSmrg
18268f65982aSmrgAC_SUBST(XORG_SGML_PATH)
18278f65982aSmrgAC_SUBST(STYLESHEET_SRCDIR)
18288f65982aSmrgAC_SUBST(XSL_STYLESHEET)
18298f65982aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
18308f65982aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
18318f65982aSmrg
18329aa228fdSmrg# XORG_CHECK_LINUXDOC
18339aa228fdSmrg# -------------------
18349aa228fdSmrg# Minimum version: 1.0.0
18359aa228fdSmrg#
18369aa228fdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
18379aa228fdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
18389aa228fdSmrg# Whether or not the necessary tools and files are found can be checked
18399aa228fdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
18409aa228fdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
18418f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18428f65982aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18439aa228fdSmrg
18449aa228fdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18459aa228fdSmrg
18468f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
18479aa228fdSmrg
18488f65982aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
18499aa228fdSmrg   BUILDDOC=yes
18509aa228fdSmrgelse
18519aa228fdSmrg   BUILDDOC=no
18529aa228fdSmrgfi
18539aa228fdSmrg
18549aa228fdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18559aa228fdSmrg
18569aa228fdSmrgAC_MSG_RESULT([$BUILDDOC])
18579aa228fdSmrg
18588f65982aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
18599aa228fdSmrg
18608f65982aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
18619aa228fdSmrg   BUILDPDFDOC=yes
18629aa228fdSmrgelse
18639aa228fdSmrg   BUILDPDFDOC=no
18649aa228fdSmrgfi
18659aa228fdSmrg
18669aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18679aa228fdSmrg
18689aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
18699aa228fdSmrg
18708f65982aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
18719aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
18729aa228fdSmrgMAKE_PDF="$PS2PDF"
18739aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
18749aa228fdSmrg
18759aa228fdSmrgAC_SUBST(MAKE_TEXT)
18769aa228fdSmrgAC_SUBST(MAKE_PS)
18779aa228fdSmrgAC_SUBST(MAKE_PDF)
18789aa228fdSmrgAC_SUBST(MAKE_HTML)
18799aa228fdSmrg]) # XORG_CHECK_LINUXDOC
18809aa228fdSmrg
18819aa228fdSmrg# XORG_CHECK_DOCBOOK
18829aa228fdSmrg# -------------------
18839aa228fdSmrg# Minimum version: 1.0.0
18849aa228fdSmrg#
18859aa228fdSmrg# Checks for the ability to build output formats from SGML DocBook source.
18869aa228fdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
18879aa228fdSmrg# indicates whether the necessary tools and files are found and, if set,
18889aa228fdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
18899aa228fdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
18908f65982aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18918f65982aSmrg
18929aa228fdSmrgBUILDTXTDOC=no
18939aa228fdSmrgBUILDPDFDOC=no
18949aa228fdSmrgBUILDPSDOC=no
18959aa228fdSmrgBUILDHTMLDOC=no
18969aa228fdSmrg
18979aa228fdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
18989aa228fdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
18999aa228fdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
19009aa228fdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19019aa228fdSmrg
19028f65982aSmrgAC_MSG_CHECKING([whether to build text documentation])
19038f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
19049aa228fdSmrg   test x$BUILD_TXTDOC != xno; then
19059aa228fdSmrg	BUILDTXTDOC=yes
19069aa228fdSmrgfi
19079aa228fdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
19089aa228fdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
19099aa228fdSmrg
19108f65982aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
19118f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
19129aa228fdSmrg   test x$BUILD_PDFDOC != xno; then
19139aa228fdSmrg	BUILDPDFDOC=yes
19149aa228fdSmrgfi
19159aa228fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
19169aa228fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
19179aa228fdSmrg
19188f65982aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
19198f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
19209aa228fdSmrg   test x$BUILD_PSDOC != xno; then
19219aa228fdSmrg	BUILDPSDOC=yes
19229aa228fdSmrgfi
19239aa228fdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
19249aa228fdSmrgAC_MSG_RESULT([$BUILDPSDOC])
19259aa228fdSmrg
19268f65982aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
19278f65982aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
19289aa228fdSmrg   test x$BUILD_HTMLDOC != xno; then
19299aa228fdSmrg	BUILDHTMLDOC=yes
19309aa228fdSmrgfi
19319aa228fdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
19329aa228fdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19339aa228fdSmrg
19349aa228fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
19359aa228fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
19369aa228fdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
19379aa228fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19389aa228fdSmrg
19399aa228fdSmrgAC_SUBST(MAKE_TEXT)
19409aa228fdSmrgAC_SUBST(MAKE_PS)
19419aa228fdSmrgAC_SUBST(MAKE_PDF)
19429aa228fdSmrgAC_SUBST(MAKE_HTML)
19439aa228fdSmrg]) # XORG_CHECK_DOCBOOK
19449aa228fdSmrg
19458f65982aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19468f65982aSmrg# ----------------
19478f65982aSmrg# Minimum version: 1.5.0
19488f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
19498f65982aSmrg#
19508f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
19518f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
19528f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
195346374b8dSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19548f65982aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19558f65982aSmrg# --with-xmlto assumes 'auto'.
19568f65982aSmrg#
19578f65982aSmrg# Interface to module:
19588f65982aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
19598f65982aSmrg# XMLTO:	returns the path of the xmlto program found
19608f65982aSmrg#		returns the path set by the user in the environment
19618f65982aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
19628f65982aSmrg#		'no' user instructs the module not to use xmlto
19638f65982aSmrg#
19648f65982aSmrg# Added in version 1.10.0
19658f65982aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
19668f65982aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
19678f65982aSmrg#
19688f65982aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
19698f65982aSmrg#
19708f65982aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
19718f65982aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19728f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
19738f65982aSmrgAC_ARG_WITH(xmlto,
19748f65982aSmrg	AS_HELP_STRING([--with-xmlto],
19758f65982aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19768f65982aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19778f65982aSmrgm4_undefine([_defopt])
19788f65982aSmrg
19798f65982aSmrgif test "x$use_xmlto" = x"auto"; then
19808f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
19818f65982aSmrg   if test "x$XMLTO" = "x"; then
19828f65982aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
19838f65982aSmrg	have_xmlto=no
19848f65982aSmrg   else
19858f65982aSmrg        have_xmlto=yes
19868f65982aSmrg   fi
19878f65982aSmrgelif test "x$use_xmlto" = x"yes" ; then
19888f65982aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
19898f65982aSmrg   if test "x$XMLTO" = "x"; then
19908f65982aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
19918f65982aSmrg   fi
19928f65982aSmrg   have_xmlto=yes
19938f65982aSmrgelif test "x$use_xmlto" = x"no" ; then
19948f65982aSmrg   if test "x$XMLTO" != "x"; then
19958f65982aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
19968f65982aSmrg   fi
19978f65982aSmrg   have_xmlto=no
19988f65982aSmrgelse
19998f65982aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20008f65982aSmrgfi
20018f65982aSmrg
20028f65982aSmrg# Test for a minimum version of xmlto, if provided.
20038f65982aSmrgm4_ifval([$1],
20048f65982aSmrg[if test "$have_xmlto" = yes; then
20058f65982aSmrg    # scrape the xmlto version
20068f65982aSmrg    AC_MSG_CHECKING([the xmlto version])
20078f65982aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
20088f65982aSmrg    AC_MSG_RESULT([$xmlto_version])
20098f65982aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
20108f65982aSmrg        [if test "x$use_xmlto" = xauto; then
20118f65982aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
20128f65982aSmrg            have_xmlto=no
20138f65982aSmrg        else
20148f65982aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
20158f65982aSmrg        fi])
20168f65982aSmrgfi])
20178f65982aSmrg
20188f65982aSmrg# Test for the ability of xmlto to generate a text target
2019e39ce84cSmrg#
2020e39ce84cSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2021e39ce84cSmrg# following test for empty XML docbook files.
2022e39ce84cSmrg# For compatibility reasons use the following empty XML docbook file and if
2023e39ce84cSmrg# it fails try it again with a non-empty XML file.
20248f65982aSmrghave_xmlto_text=no
20258f65982aSmrgcat > conftest.xml << "EOF"
20268f65982aSmrgEOF
20278f65982aSmrgAS_IF([test "$have_xmlto" = yes],
20288f65982aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20298f65982aSmrg             [have_xmlto_text=yes],
2030e39ce84cSmrg             [# Try it again with a non-empty XML file.
2031e39ce84cSmrg              cat > conftest.xml << "EOF"
2032e39ce84cSmrg<x></x>
2033e39ce84cSmrgEOF
2034e39ce84cSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2035e39ce84cSmrg                    [have_xmlto_text=yes],
2036e39ce84cSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
20378f65982aSmrgrm -f conftest.xml
20388f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
20398f65982aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
20408f65982aSmrg]) # XORG_WITH_XMLTO
20418f65982aSmrg
204280b026c6Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
204380b026c6Smrg# --------------------------------------------
204480b026c6Smrg# Minimum version: 1.12.0
204580b026c6Smrg# Minimum version for optional DEFAULT argument: 1.12.0
204680b026c6Smrg#
204780b026c6Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
204880b026c6Smrg# XML-based language used for the transformation of XML documents.
204980b026c6Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
205080b026c6Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
205180b026c6Smrg# The XSLT processor is often used as a standalone tool for transformations.
205280b026c6Smrg# It should not be assumed that this tool is used only to work with documnetation.
205380b026c6Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
205480b026c6Smrg#
205580b026c6Smrg# Interface to module:
205680b026c6Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
205780b026c6Smrg# XSLTPROC:	 returns the path of the xsltproc program found
205880b026c6Smrg#		 returns the path set by the user in the environment
205980b026c6Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
206080b026c6Smrg#		  'no' user instructs the module not to use xsltproc
206180b026c6Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
206280b026c6Smrg#
206380b026c6Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
206480b026c6Smrg#
206580b026c6SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
206680b026c6SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
206780b026c6Smrg# Preserves the interface, should it be implemented later
206880b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
206980b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
207080b026c6SmrgAC_ARG_WITH(xsltproc,
207180b026c6Smrg	AS_HELP_STRING([--with-xsltproc],
207280b026c6Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
207380b026c6Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
207480b026c6Smrgm4_undefine([_defopt])
207580b026c6Smrg
207680b026c6Smrgif test "x$use_xsltproc" = x"auto"; then
207780b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
207880b026c6Smrg   if test "x$XSLTPROC" = "x"; then
207980b026c6Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
208080b026c6Smrg	have_xsltproc=no
208180b026c6Smrg   else
208280b026c6Smrg        have_xsltproc=yes
208380b026c6Smrg   fi
208480b026c6Smrgelif test "x$use_xsltproc" = x"yes" ; then
208580b026c6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
208680b026c6Smrg   if test "x$XSLTPROC" = "x"; then
208780b026c6Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
208880b026c6Smrg   fi
208980b026c6Smrg   have_xsltproc=yes
209080b026c6Smrgelif test "x$use_xsltproc" = x"no" ; then
209180b026c6Smrg   if test "x$XSLTPROC" != "x"; then
209280b026c6Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
209380b026c6Smrg   fi
209480b026c6Smrg   have_xsltproc=no
209580b026c6Smrgelse
209680b026c6Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
209780b026c6Smrgfi
209880b026c6Smrg
209980b026c6SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
210080b026c6Smrg]) # XORG_WITH_XSLTPROC
210180b026c6Smrg
210280b026c6Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
210380b026c6Smrg# ----------------------------------------
210480b026c6Smrg# Minimum version: 1.15.0
210580b026c6Smrg#
210680b026c6Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
210780b026c6Smrg# scanning arbitrary text files, extracting information from those text files,
210880b026c6Smrg# and printing reports based on that information.
210980b026c6Smrg#
211080b026c6Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
211180b026c6Smrg#
211280b026c6Smrg# Interface to module:
211380b026c6Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
211480b026c6Smrg# PERL:	     returns the path of the perl program found
211580b026c6Smrg#	     returns the path set by the user in the environment
211680b026c6Smrg# --with-perl: 'yes' user instructs the module to use perl
211780b026c6Smrg#	       'no' user instructs the module not to use perl
211880b026c6Smrg# have_perl: returns yes if perl found in PATH or no
211980b026c6Smrg#
212080b026c6Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
212180b026c6Smrg#
212280b026c6SmrgAC_DEFUN([XORG_WITH_PERL],[
212380b026c6SmrgAC_ARG_VAR([PERL], [Path to perl command])
212480b026c6Smrg# Preserves the interface, should it be implemented later
212580b026c6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
212680b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
212780b026c6SmrgAC_ARG_WITH(perl,
212880b026c6Smrg	AS_HELP_STRING([--with-perl],
212980b026c6Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
213080b026c6Smrg	   [use_perl=$withval], [use_perl=]_defopt)
213180b026c6Smrgm4_undefine([_defopt])
213280b026c6Smrg
213380b026c6Smrgif test "x$use_perl" = x"auto"; then
213480b026c6Smrg   AC_PATH_PROG([PERL], [perl])
213580b026c6Smrg   if test "x$PERL" = "x"; then
213680b026c6Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
213780b026c6Smrg	have_perl=no
213880b026c6Smrg   else
213980b026c6Smrg        have_perl=yes
214080b026c6Smrg   fi
214180b026c6Smrgelif test "x$use_perl" = x"yes" ; then
214280b026c6Smrg   AC_PATH_PROG([PERL], [perl])
214380b026c6Smrg   if test "x$PERL" = "x"; then
214480b026c6Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
214580b026c6Smrg   fi
214680b026c6Smrg   have_perl=yes
214780b026c6Smrgelif test "x$use_perl" = x"no" ; then
214880b026c6Smrg   if test "x$PERL" != "x"; then
214980b026c6Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
215080b026c6Smrg   fi
215180b026c6Smrg   have_perl=no
215280b026c6Smrgelse
215380b026c6Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
215480b026c6Smrgfi
215580b026c6Smrg
215680b026c6SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
215780b026c6Smrg]) # XORG_WITH_PERL
215880b026c6Smrg
21598f65982aSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
21608f65982aSmrg# ----------------
21618f65982aSmrg# Minimum version: 1.5.0
21628f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
21638f65982aSmrg#
21648f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
21658f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
21668f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
216746374b8dSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21688f65982aSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21698f65982aSmrg# --with-asciidoc assumes 'auto'.
21708f65982aSmrg#
21718f65982aSmrg# Interface to module:
21728f65982aSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
21738f65982aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
21748f65982aSmrg#		 returns the path set by the user in the environment
21758f65982aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
21768f65982aSmrg#		  'no' user instructs the module not to use asciidoc
21778f65982aSmrg#
21788f65982aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
21798f65982aSmrg#
21808f65982aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
21818f65982aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21828f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
21838f65982aSmrgAC_ARG_WITH(asciidoc,
21848f65982aSmrg	AS_HELP_STRING([--with-asciidoc],
21858f65982aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21868f65982aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21878f65982aSmrgm4_undefine([_defopt])
21888f65982aSmrg
21898f65982aSmrgif test "x$use_asciidoc" = x"auto"; then
21908f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21918f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
21928f65982aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
21938f65982aSmrg	have_asciidoc=no
21948f65982aSmrg   else
21958f65982aSmrg        have_asciidoc=yes
21968f65982aSmrg   fi
21978f65982aSmrgelif test "x$use_asciidoc" = x"yes" ; then
21988f65982aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21998f65982aSmrg   if test "x$ASCIIDOC" = "x"; then
22008f65982aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
22018f65982aSmrg   fi
22028f65982aSmrg   have_asciidoc=yes
22038f65982aSmrgelif test "x$use_asciidoc" = x"no" ; then
22048f65982aSmrg   if test "x$ASCIIDOC" != "x"; then
22058f65982aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
22068f65982aSmrg   fi
22078f65982aSmrg   have_asciidoc=no
22088f65982aSmrgelse
22098f65982aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22108f65982aSmrgfi
22118f65982aSmrgm4_ifval([$1],
22128f65982aSmrg[if test "$have_asciidoc" = yes; then
22138f65982aSmrg    # scrape the asciidoc version
22148f65982aSmrg    AC_MSG_CHECKING([the asciidoc version])
22158f65982aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
22168f65982aSmrg    AC_MSG_RESULT([$asciidoc_version])
22178f65982aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
22188f65982aSmrg        [if test "x$use_asciidoc" = xauto; then
22198f65982aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
22208f65982aSmrg            have_asciidoc=no
22218f65982aSmrg        else
22228f65982aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
22238f65982aSmrg        fi])
22248f65982aSmrgfi])
22258f65982aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
22268f65982aSmrg]) # XORG_WITH_ASCIIDOC
22278f65982aSmrg
22288f65982aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22290c7e83b2Smrg# -------------------------------------------
22308f65982aSmrg# Minimum version: 1.5.0
22318f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
22320c7e83b2Smrg# Minimum version for optional DOT checking: 1.18.0
22338f65982aSmrg#
22348f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
22358f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
22368f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
223746374b8dSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22388f65982aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22398f65982aSmrg# --with-doxygen assumes 'auto'.
22408f65982aSmrg#
22418f65982aSmrg# Interface to module:
22428f65982aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
22438f65982aSmrg# DOXYGEN:	 returns the path of the doxygen program found
22448f65982aSmrg#		 returns the path set by the user in the environment
22458f65982aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
22468f65982aSmrg#		  'no' user instructs the module not to use doxygen
22478f65982aSmrg#
22488f65982aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
22498f65982aSmrg#
22508f65982aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
22518f65982aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22520c7e83b2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22538f65982aSmrgm4_define([_defopt], m4_default([$2], [auto]))
22548f65982aSmrgAC_ARG_WITH(doxygen,
22558f65982aSmrg	AS_HELP_STRING([--with-doxygen],
22568f65982aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22578f65982aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22588f65982aSmrgm4_undefine([_defopt])
22598f65982aSmrg
22608f65982aSmrgif test "x$use_doxygen" = x"auto"; then
22618f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22628f65982aSmrg   if test "x$DOXYGEN" = "x"; then
22638f65982aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
22648f65982aSmrg	have_doxygen=no
22658f65982aSmrg   else
22668f65982aSmrg        have_doxygen=yes
22678f65982aSmrg   fi
22688f65982aSmrgelif test "x$use_doxygen" = x"yes" ; then
22698f65982aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22708f65982aSmrg   if test "x$DOXYGEN" = "x"; then
22718f65982aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
22728f65982aSmrg   fi
22738f65982aSmrg   have_doxygen=yes
22748f65982aSmrgelif test "x$use_doxygen" = x"no" ; then
22758f65982aSmrg   if test "x$DOXYGEN" != "x"; then
22768f65982aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
22778f65982aSmrg   fi
22788f65982aSmrg   have_doxygen=no
22798f65982aSmrgelse
22808f65982aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
22818f65982aSmrgfi
22828f65982aSmrgm4_ifval([$1],
22838f65982aSmrg[if test "$have_doxygen" = yes; then
22848f65982aSmrg    # scrape the doxygen version
22858f65982aSmrg    AC_MSG_CHECKING([the doxygen version])
22868f65982aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
22878f65982aSmrg    AC_MSG_RESULT([$doxygen_version])
22888f65982aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
22898f65982aSmrg        [if test "x$use_doxygen" = xauto; then
22908f65982aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
22918f65982aSmrg            have_doxygen=no
22928f65982aSmrg        else
22938f65982aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
22948f65982aSmrg        fi])
22958f65982aSmrgfi])
22960c7e83b2Smrg
22970c7e83b2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22980c7e83b2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22990c7e83b2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
23000c7e83b2SmrgHAVE_DOT=no
23010c7e83b2Smrgif test "x$have_doxygen" = "xyes"; then
23020c7e83b2Smrg  AC_PATH_PROG([DOT], [dot])
23030c7e83b2Smrg    if test "x$DOT" != "x"; then
23040c7e83b2Smrg      HAVE_DOT=yes
23050c7e83b2Smrg    fi
23060c7e83b2Smrgfi
23070c7e83b2Smrg
23080c7e83b2SmrgAC_SUBST([HAVE_DOT])
23090c7e83b2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
23108f65982aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
23118f65982aSmrg]) # XORG_WITH_DOXYGEN
23128f65982aSmrg
23138f65982aSmrg# XORG_WITH_GROFF([DEFAULT])
23148f65982aSmrg# ----------------
23158f65982aSmrg# Minimum version: 1.6.0
23168f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
23178f65982aSmrg#
23188f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
23198f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
23208f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
232146374b8dSmrg# the --with-groff option, it allows maximum flexibility in making decisions
23228f65982aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
23238f65982aSmrg# --with-groff assumes 'auto'.
23248f65982aSmrg#
23258f65982aSmrg# Interface to module:
23268f65982aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
23278f65982aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
23288f65982aSmrg# HAVE_GROFF_MS: the -ms macros package
23298f65982aSmrg# GROFF:	 returns the path of the groff program found
23308f65982aSmrg#		 returns the path set by the user in the environment
23318f65982aSmrg# --with-groff:	 'yes' user instructs the module to use groff
23328f65982aSmrg#		 'no' user instructs the module not to use groff
23338f65982aSmrg#
23348f65982aSmrg# Added in version 1.9.0:
23358f65982aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
23368f65982aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
23378f65982aSmrg#		   psselect from the psutils package.
23388f65982aSmrg#		   the ghostcript package. Refer to the grohtml man pages
23398f65982aSmrg#
23408f65982aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
23418f65982aSmrg#
23428f65982aSmrg# OS and distros often splits groff in a basic and full package, the former
23438f65982aSmrg# having the groff program and the later having devices, fonts and macros
23448f65982aSmrg# Checking for the groff executable is not enough.
23458f65982aSmrg#
23468f65982aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
23478f65982aSmrg# unset HAVE_GROFF or GROFF env variables.
23488f65982aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23498f65982aSmrg#
23508f65982aSmrgAC_DEFUN([XORG_WITH_GROFF],[
23518f65982aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
23528f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
23538f65982aSmrgAC_ARG_WITH(groff,
23548f65982aSmrg	AS_HELP_STRING([--with-groff],
23558f65982aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23568f65982aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
23578f65982aSmrgm4_undefine([_defopt])
23588f65982aSmrg
23598f65982aSmrgif test "x$use_groff" = x"auto"; then
23608f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
23618f65982aSmrg   if test "x$GROFF" = "x"; then
23628f65982aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
23638f65982aSmrg	have_groff=no
23648f65982aSmrg   else
23658f65982aSmrg        have_groff=yes
23668f65982aSmrg   fi
23678f65982aSmrgelif test "x$use_groff" = x"yes" ; then
23688f65982aSmrg   AC_PATH_PROG([GROFF], [groff])
23698f65982aSmrg   if test "x$GROFF" = "x"; then
23708f65982aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
23718f65982aSmrg   fi
23728f65982aSmrg   have_groff=yes
23738f65982aSmrgelif test "x$use_groff" = x"no" ; then
23748f65982aSmrg   if test "x$GROFF" != "x"; then
23758f65982aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
23768f65982aSmrg   fi
23778f65982aSmrg   have_groff=no
23788f65982aSmrgelse
23798f65982aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23808f65982aSmrgfi
23818f65982aSmrg
23828f65982aSmrg# We have groff, test for the presence of the macro packages
23838f65982aSmrgif test "x$have_groff" = x"yes"; then
23848f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
23858f65982aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
23868f65982aSmrg        groff_ms_works=yes
23878f65982aSmrg    else
23888f65982aSmrg        groff_ms_works=no
23898f65982aSmrg    fi
23908f65982aSmrg    AC_MSG_RESULT([$groff_ms_works])
23918f65982aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
23928f65982aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
23938f65982aSmrg        groff_mm_works=yes
23948f65982aSmrg    else
23958f65982aSmrg        groff_mm_works=no
23968f65982aSmrg    fi
23978f65982aSmrg    AC_MSG_RESULT([$groff_mm_works])
23988f65982aSmrgfi
23998f65982aSmrg
24008f65982aSmrg# We have groff, test for HTML dependencies, one command per package
24018f65982aSmrgif test "x$have_groff" = x"yes"; then
24028f65982aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
24038f65982aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
24048f65982aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
24058f65982aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
24068f65982aSmrg      have_groff_html=yes
24078f65982aSmrg   else
24088f65982aSmrg      have_groff_html=no
24098f65982aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
24108f65982aSmrg   fi
24118f65982aSmrgfi
24128f65982aSmrg
24138f65982aSmrg# Set Automake conditionals for Makefiles
24148f65982aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
24158f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
24168f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
24178f65982aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
24188f65982aSmrg]) # XORG_WITH_GROFF
24198f65982aSmrg
242080b026c6Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
242180b026c6Smrg# ---------------------------------------
24228f65982aSmrg# Minimum version: 1.6.0
24238f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
242480b026c6Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
24258f65982aSmrg#
24268f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
24278f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
24288f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
242946374b8dSmrg# the --with-fop option, it allows maximum flexibility in making decisions
24308f65982aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
24318f65982aSmrg# --with-fop assumes 'auto'.
24328f65982aSmrg#
24338f65982aSmrg# Interface to module:
24348f65982aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
24358f65982aSmrg# FOP:	 	returns the path of the fop program found
24368f65982aSmrg#		returns the path set by the user in the environment
24378f65982aSmrg# --with-fop: 	'yes' user instructs the module to use fop
24388f65982aSmrg#		'no' user instructs the module not to use fop
24398f65982aSmrg#
24408f65982aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
24418f65982aSmrg#
24428f65982aSmrgAC_DEFUN([XORG_WITH_FOP],[
24438f65982aSmrgAC_ARG_VAR([FOP], [Path to fop command])
244480b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
24458f65982aSmrgAC_ARG_WITH(fop,
24468f65982aSmrg	AS_HELP_STRING([--with-fop],
24478f65982aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24488f65982aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
24498f65982aSmrgm4_undefine([_defopt])
24508f65982aSmrg
24518f65982aSmrgif test "x$use_fop" = x"auto"; then
24528f65982aSmrg   AC_PATH_PROG([FOP], [fop])
24538f65982aSmrg   if test "x$FOP" = "x"; then
24548f65982aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
24558f65982aSmrg	have_fop=no
24568f65982aSmrg   else
24578f65982aSmrg        have_fop=yes
24588f65982aSmrg   fi
24598f65982aSmrgelif test "x$use_fop" = x"yes" ; then
24608f65982aSmrg   AC_PATH_PROG([FOP], [fop])
24618f65982aSmrg   if test "x$FOP" = "x"; then
24628f65982aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
24638f65982aSmrg   fi
24648f65982aSmrg   have_fop=yes
24658f65982aSmrgelif test "x$use_fop" = x"no" ; then
24668f65982aSmrg   if test "x$FOP" != "x"; then
24678f65982aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
24688f65982aSmrg   fi
24698f65982aSmrg   have_fop=no
24708f65982aSmrgelse
24718f65982aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24728f65982aSmrgfi
247380b026c6Smrg
247480b026c6Smrg# Test for a minimum version of fop, if provided.
247580b026c6Smrgm4_ifval([$1],
247680b026c6Smrg[if test "$have_fop" = yes; then
247780b026c6Smrg    # scrape the fop version
247880b026c6Smrg    AC_MSG_CHECKING([for fop minimum version])
247980b026c6Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
248080b026c6Smrg    AC_MSG_RESULT([$fop_version])
248180b026c6Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
248280b026c6Smrg        [if test "x$use_fop" = xauto; then
248380b026c6Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
248480b026c6Smrg            have_fop=no
248580b026c6Smrg        else
248680b026c6Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
248780b026c6Smrg        fi])
248880b026c6Smrgfi])
24898f65982aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
24908f65982aSmrg]) # XORG_WITH_FOP
24918f65982aSmrg
24920c7e83b2Smrg# XORG_WITH_M4([MIN-VERSION])
24930c7e83b2Smrg# ---------------------------
24940c7e83b2Smrg# Minimum version: 1.19.0
24950c7e83b2Smrg#
24960c7e83b2Smrg# This macro attempts to locate an m4 macro processor which supports
24970c7e83b2Smrg# -I option and is only useful for modules relying on M4 in order to
24980c7e83b2Smrg# expand macros in source code files.
24990c7e83b2Smrg#
25000c7e83b2Smrg# Interface to module:
25010c7e83b2Smrg# M4:	 	returns the path of the m4 program found
25020c7e83b2Smrg#		returns the path set by the user in the environment
25030c7e83b2Smrg#
25040c7e83b2SmrgAC_DEFUN([XORG_WITH_M4], [
25050c7e83b2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25060c7e83b2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25070c7e83b2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25080c7e83b2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25090c7e83b2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25100c7e83b2Smrg   [$PATH:/usr/gnu/bin])])
25110c7e83b2Smrg
25120c7e83b2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
25130c7e83b2Smrg]) # XORG_WITH_M4
25140c7e83b2Smrg
25158f65982aSmrg# XORG_WITH_PS2PDF([DEFAULT])
25168f65982aSmrg# ----------------
25178f65982aSmrg# Minimum version: 1.6.0
25188f65982aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
25198f65982aSmrg#
25208f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
25218f65982aSmrg# not at the appropriate level. This macro enables a module to test for the
25228f65982aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
252346374b8dSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25248f65982aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25258f65982aSmrg# --with-ps2pdf assumes 'auto'.
25268f65982aSmrg#
25278f65982aSmrg# Interface to module:
25288f65982aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
25298f65982aSmrg# PS2PDF:	returns the path of the ps2pdf program found
25308f65982aSmrg#		returns the path set by the user in the environment
25318f65982aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
25328f65982aSmrg#		 'no' user instructs the module not to use ps2pdf
25338f65982aSmrg#
25348f65982aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
25358f65982aSmrg#
25368f65982aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
25378f65982aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25388f65982aSmrgm4_define([_defopt], m4_default([$1], [auto]))
25398f65982aSmrgAC_ARG_WITH(ps2pdf,
25408f65982aSmrg	AS_HELP_STRING([--with-ps2pdf],
25418f65982aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25428f65982aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25438f65982aSmrgm4_undefine([_defopt])
25448f65982aSmrg
25458f65982aSmrgif test "x$use_ps2pdf" = x"auto"; then
25468f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25478f65982aSmrg   if test "x$PS2PDF" = "x"; then
25488f65982aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
25498f65982aSmrg	have_ps2pdf=no
25508f65982aSmrg   else
25518f65982aSmrg        have_ps2pdf=yes
25528f65982aSmrg   fi
25538f65982aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
25548f65982aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25558f65982aSmrg   if test "x$PS2PDF" = "x"; then
25568f65982aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
25578f65982aSmrg   fi
25588f65982aSmrg   have_ps2pdf=yes
25598f65982aSmrgelif test "x$use_ps2pdf" = x"no" ; then
25608f65982aSmrg   if test "x$PS2PDF" != "x"; then
25618f65982aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
25628f65982aSmrg   fi
25638f65982aSmrg   have_ps2pdf=no
25648f65982aSmrgelse
25658f65982aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
25668f65982aSmrgfi
25678f65982aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
25688f65982aSmrg]) # XORG_WITH_PS2PDF
25698f65982aSmrg
25708f65982aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
25718f65982aSmrg# ----------------
25728f65982aSmrg# Minimum version: 1.6.0
25738f65982aSmrg#
25748f65982aSmrg# Documentation tools are not always available on all platforms and sometimes
25758f65982aSmrg# not at the appropriate level. This macro enables a builder to skip all
25768f65982aSmrg# documentation targets except traditional man pages.
25778f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
257846374b8dSmrg# maximum flexibility in controlling documentation building.
25798f65982aSmrg# Refer to:
25808f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
25818f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25828f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
25838f65982aSmrg# XORG_WITH_FOP           --with-fop
25848f65982aSmrg# XORG_WITH_GROFF         --with-groff
25858f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
25868f65982aSmrg#
25878f65982aSmrg# Interface to module:
25888f65982aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
25898f65982aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
25908f65982aSmrg#		 'no' user instructs the module not to generate docs
25918f65982aSmrg# parm1:	specify the default value, yes or no.
25928f65982aSmrg#
25938f65982aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
259480b026c6Smrgm4_define([docs_default], m4_default([$1], [yes]))
25958f65982aSmrgAC_ARG_ENABLE(docs,
25968f65982aSmrg	AS_HELP_STRING([--enable-docs],
259780b026c6Smrg	   [Enable building the documentation (default: ]docs_default[)]),
259880b026c6Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
259980b026c6Smrgm4_undefine([docs_default])
26008f65982aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
26018f65982aSmrgAC_MSG_CHECKING([whether to build documentation])
26028f65982aSmrgAC_MSG_RESULT([$build_docs])
26038f65982aSmrg]) # XORG_ENABLE_DOCS
26048f65982aSmrg
26058f65982aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
26068f65982aSmrg# ----------------
26078f65982aSmrg# Minimum version: 1.6.0
26088f65982aSmrg#
26098f65982aSmrg# This macro enables a builder to skip all developer documentation.
26108f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
261146374b8dSmrg# maximum flexibility in controlling documentation building.
26128f65982aSmrg# Refer to:
26138f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
26148f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26158f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
26168f65982aSmrg# XORG_WITH_FOP           --with-fop
26178f65982aSmrg# XORG_WITH_GROFF         --with-groff
26188f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
26198f65982aSmrg#
26208f65982aSmrg# Interface to module:
26218f65982aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
26228f65982aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
26238f65982aSmrg#			'no' user instructs the module not to generate developer docs
26248f65982aSmrg# parm1:		specify the default value, yes or no.
26258f65982aSmrg#
26268f65982aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26278f65982aSmrgm4_define([devel_default], m4_default([$1], [yes]))
26288f65982aSmrgAC_ARG_ENABLE(devel-docs,
26298f65982aSmrg	AS_HELP_STRING([--enable-devel-docs],
26308f65982aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26318f65982aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26328f65982aSmrgm4_undefine([devel_default])
26338f65982aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
26348f65982aSmrgAC_MSG_CHECKING([whether to build developer documentation])
26358f65982aSmrgAC_MSG_RESULT([$build_devel_docs])
26368f65982aSmrg]) # XORG_ENABLE_DEVEL_DOCS
26378f65982aSmrg
26388f65982aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
26398f65982aSmrg# ----------------
26408f65982aSmrg# Minimum version: 1.6.0
26418f65982aSmrg#
26428f65982aSmrg# This macro enables a builder to skip all functional specification targets.
26438f65982aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
264446374b8dSmrg# maximum flexibility in controlling documentation building.
26458f65982aSmrg# Refer to:
26468f65982aSmrg# XORG_WITH_XMLTO         --with-xmlto
26478f65982aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26488f65982aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
26498f65982aSmrg# XORG_WITH_FOP           --with-fop
26508f65982aSmrg# XORG_WITH_GROFF         --with-groff
26518f65982aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
26528f65982aSmrg#
26538f65982aSmrg# Interface to module:
26548f65982aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
26558f65982aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
26568f65982aSmrg#			'no' user instructs the module not to generate specs
26578f65982aSmrg# parm1:		specify the default value, yes or no.
26588f65982aSmrg#
26598f65982aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26608f65982aSmrgm4_define([spec_default], m4_default([$1], [yes]))
26618f65982aSmrgAC_ARG_ENABLE(specs,
26628f65982aSmrg	AS_HELP_STRING([--enable-specs],
26638f65982aSmrg	   [Enable building the specs (default: ]spec_default[)]),
26648f65982aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
26658f65982aSmrgm4_undefine([spec_default])
26668f65982aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
26678f65982aSmrgAC_MSG_CHECKING([whether to build functional specifications])
26688f65982aSmrgAC_MSG_RESULT([$build_specs])
26698f65982aSmrg]) # XORG_ENABLE_SPECS
26708f65982aSmrg
267180b026c6Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
267280b026c6Smrg# ----------------------------------------------
267380b026c6Smrg# Minimum version: 1.13.0
267480b026c6Smrg#
267580b026c6Smrg# This macro enables a builder to enable/disable unit testing
267680b026c6Smrg# It makes no assumption about the test cases implementation
267780b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
267880b026c6Smrg# They may or may not use the software utility library GLib
267980b026c6Smrg#
268080b026c6Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
268180b026c6Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
268280b026c6Smrg# The variable enable_unit_tests is used by other macros in this file.
268380b026c6Smrg#
268480b026c6Smrg# Interface to module:
268580b026c6Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
268680b026c6Smrg# enable_unit_tests:    used in configure.ac for additional configuration
268780b026c6Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
268880b026c6Smrg#			'no' user instructs the module not to build tests
268980b026c6Smrg# parm1:		specify the default value, yes or no.
269080b026c6Smrg#
269180b026c6SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
269280b026c6SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
269380b026c6SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
269480b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
269580b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
269680b026c6SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
269780b026c6Smrg	[Enable building unit test cases (default: ]_defopt[)]),
269880b026c6Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
269980b026c6Smrgm4_undefine([_defopt])
270080b026c6SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
270180b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
270280b026c6SmrgAC_MSG_RESULT([$enable_unit_tests])
270380b026c6Smrg]) # XORG_ENABLE_UNIT_TESTS
270480b026c6Smrg
270580b026c6Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
270680b026c6Smrg# ------------------------------------------------------
270780b026c6Smrg# Minimum version: 1.17.0
270880b026c6Smrg#
270980b026c6Smrg# This macro enables a builder to enable/disable integration testing
271080b026c6Smrg# It makes no assumption about the test cases' implementation
271180b026c6Smrg# Test cases may or may not use Automake "Support for test suites"
271280b026c6Smrg#
271380b026c6Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
271480b026c6Smrg# usually requires less dependencies and may be built and run under less
271580b026c6Smrg# stringent environments than integration tests.
271680b026c6Smrg#
271780b026c6Smrg# Interface to module:
271880b026c6Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
271980b026c6Smrg# enable_integration_tests:   used in configure.ac for additional configuration
272080b026c6Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
272180b026c6Smrg#                             'no' user instructs the module not to build tests
272280b026c6Smrg# parm1:                      specify the default value, yes or no.
272380b026c6Smrg#
272480b026c6SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
272580b026c6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
272680b026c6Smrgm4_define([_defopt], m4_default([$1], [auto]))
272780b026c6SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
272880b026c6Smrg	[Enable building integration test cases (default: ]_defopt[)]),
272980b026c6Smrg	[enable_integration_tests=$enableval],
273080b026c6Smrg	[enable_integration_tests=]_defopt)
273180b026c6Smrgm4_undefine([_defopt])
273280b026c6SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
273380b026c6Smrg	[test "x$enable_integration_tests" != xno])
273480b026c6SmrgAC_MSG_CHECKING([whether to build unit test cases])
273580b026c6SmrgAC_MSG_RESULT([$enable_integration_tests])
273680b026c6Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
273780b026c6Smrg
273880b026c6Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
273980b026c6Smrg# ----------------------------------------
274080b026c6Smrg# Minimum version: 1.13.0
274180b026c6Smrg#
274280b026c6Smrg# GLib is a library which provides advanced data structures and functions.
274380b026c6Smrg# This macro enables a module to test for the presence of Glib.
274480b026c6Smrg#
274580b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
274680b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
274780b026c6Smrg#
274880b026c6Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
274980b026c6Smrg# test support usually requires less dependencies and may be built and run under
275080b026c6Smrg# less stringent environments than integration tests.
275180b026c6Smrg#
275280b026c6Smrg# Interface to module:
275380b026c6Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
275480b026c6Smrg# with_glib: used in configure.ac to know if GLib has been found
275580b026c6Smrg# --with-glib:	'yes' user instructs the module to use glib
275680b026c6Smrg#		'no' user instructs the module not to use glib
275780b026c6Smrg#
275880b026c6SmrgAC_DEFUN([XORG_WITH_GLIB],[
275980b026c6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
276080b026c6Smrgm4_define([_defopt], m4_default([$2], [auto]))
276180b026c6SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
276280b026c6Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
276380b026c6Smrg	[with_glib=$withval], [with_glib=]_defopt)
276480b026c6Smrgm4_undefine([_defopt])
276580b026c6Smrg
276680b026c6Smrghave_glib=no
276780b026c6Smrg# Do not probe GLib if user explicitly disabled unit testing
276880b026c6Smrgif test "x$enable_unit_tests" != x"no"; then
276980b026c6Smrg  # Do not probe GLib if user explicitly disabled it
277080b026c6Smrg  if test "x$with_glib" != x"no"; then
277180b026c6Smrg    m4_ifval(
277280b026c6Smrg      [$1],
277380b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
277480b026c6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
277580b026c6Smrg    )
277680b026c6Smrg  fi
277780b026c6Smrgfi
277880b026c6Smrg
277980b026c6Smrg# Not having GLib when unit testing has been explicitly requested is an error
278080b026c6Smrgif test "x$enable_unit_tests" = x"yes"; then
278180b026c6Smrg  if test "x$have_glib" = x"no"; then
278280b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
278380b026c6Smrg  fi
278480b026c6Smrgfi
278580b026c6Smrg
278680b026c6Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
278780b026c6Smrgif test "x$enable_unit_tests" = x"no"; then
278880b026c6Smrg  if test "x$with_glib" = x"yes"; then
278980b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
279080b026c6Smrg  fi
279180b026c6Smrgfi
279280b026c6Smrg
279380b026c6Smrg# Not having GLib when it has been explicitly requested is an error
279480b026c6Smrgif test "x$with_glib" = x"yes"; then
279580b026c6Smrg  if test "x$have_glib" = x"no"; then
279680b026c6Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
279780b026c6Smrg  fi
279880b026c6Smrgfi
279980b026c6Smrg
280080b026c6SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
280180b026c6Smrg]) # XORG_WITH_GLIB
280280b026c6Smrg
280380b026c6Smrg# XORG_LD_WRAP([required|optional])
280480b026c6Smrg# ---------------------------------
280580b026c6Smrg# Minimum version: 1.13.0
280680b026c6Smrg#
280780b026c6Smrg# Check if linker supports -wrap, passed via compiler flags
280880b026c6Smrg#
280980b026c6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
281080b026c6Smrg# Otherwise the value of $enable_unit_tests is blank.
281180b026c6Smrg#
281280b026c6Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
281380b026c6Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
281480b026c6Smrg# available, an argument of "optional" allows use when some unit tests require
281580b026c6Smrg# ld -wrap and others do not.
281680b026c6Smrg#
281780b026c6SmrgAC_DEFUN([XORG_LD_WRAP],[
281880b026c6SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
281980b026c6Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
282080b026c6Smrg                      void __wrap_exit(int status) { return; }],
282180b026c6Smrg                     [exit(0);])])
282280b026c6Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
282380b026c6Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
282480b026c6Smrg  if test "x$have_ld_wrap" = x"no"; then
282580b026c6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
282680b026c6Smrg  fi
282780b026c6Smrgfi
282880b026c6SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
282980b026c6Smrg#
283080b026c6Smrg]) # XORG_LD_WRAP
283180b026c6Smrg
283280b026c6Smrg# XORG_CHECK_LINKER_FLAGS
283380b026c6Smrg# -----------------------
283480b026c6Smrg# SYNOPSIS
283580b026c6Smrg#
283680b026c6Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
283780b026c6Smrg#
283880b026c6Smrg# DESCRIPTION
283980b026c6Smrg#
284080b026c6Smrg#   Check whether the given linker FLAGS work with the current language's
284180b026c6Smrg#   linker, or whether they give an error.
284280b026c6Smrg#
284380b026c6Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
284480b026c6Smrg#   success/failure.
284580b026c6Smrg#
284680b026c6Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
284780b026c6Smrg#
284880b026c6Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
284980b026c6Smrg#
285080b026c6Smrg# LICENSE
285180b026c6Smrg#
285280b026c6Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
285380b026c6Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
285480b026c6Smrg#   Copyright (c) 2009 Matteo Frigo
285580b026c6Smrg#
285680b026c6Smrg#   This program is free software: you can redistribute it and/or modify it
285780b026c6Smrg#   under the terms of the GNU General Public License as published by the
285880b026c6Smrg#   Free Software Foundation, either version 3 of the License, or (at your
285980b026c6Smrg#   option) any later version.
286080b026c6Smrg#
286180b026c6Smrg#   This program is distributed in the hope that it will be useful, but
286280b026c6Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
286380b026c6Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
286480b026c6Smrg#   Public License for more details.
286580b026c6Smrg#
286680b026c6Smrg#   You should have received a copy of the GNU General Public License along
286780b026c6Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
286880b026c6Smrg#
286980b026c6Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
287080b026c6Smrg#   gives unlimited permission to copy, distribute and modify the configure
287180b026c6Smrg#   scripts that are the output of Autoconf when processing the Macro. You
287280b026c6Smrg#   need not follow the terms of the GNU General Public License when using
287380b026c6Smrg#   or distributing such scripts, even though portions of the text of the
287480b026c6Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
287580b026c6Smrg#   all other use of the material that constitutes the Autoconf Macro.
287680b026c6Smrg#
287780b026c6Smrg#   This special exception to the GPL applies to versions of the Autoconf
287880b026c6Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
287980b026c6Smrg#   modified version of the Autoconf Macro, you may extend this special
288080b026c6Smrg#   exception to the GPL to apply to your modified version as well.#
288180b026c6SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
288280b026c6Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
288380b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
288480b026c6SmrgAS_LITERAL_IF([$1],
288580b026c6Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
288680b026c6Smrg      ax_save_FLAGS=$LDFLAGS
288780b026c6Smrg      LDFLAGS="$1"
288880b026c6Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
288980b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289080b026c6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289180b026c6Smrg      LDFLAGS=$ax_save_FLAGS])],
289280b026c6Smrg  [ax_save_FLAGS=$LDFLAGS
289380b026c6Smrg   LDFLAGS="$1"
289480b026c6Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
289580b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289680b026c6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289780b026c6Smrg   LDFLAGS=$ax_save_FLAGS])
289880b026c6Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
289980b026c6SmrgAC_MSG_RESULT($xorg_check_linker_flags)
290080b026c6Smrgif test "x$xorg_check_linker_flags" = xyes; then
290180b026c6Smrg	m4_default([$2], :)
290280b026c6Smrgelse
290380b026c6Smrg	m4_default([$3], :)
290480b026c6Smrgfi
290580b026c6Smrg]) # XORG_CHECK_LINKER_FLAGS
290680b026c6Smrg
290780b026c6Smrg# XORG_MEMORY_CHECK_FLAGS
290880b026c6Smrg# -----------------------
290980b026c6Smrg# Minimum version: 1.16.0
291080b026c6Smrg#
291180b026c6Smrg# This macro attempts to find appropriate memory checking functionality
291280b026c6Smrg# for various platforms which unit testing code may use to catch various
291380b026c6Smrg# forms of memory allocation and access errors in testing.
291480b026c6Smrg#
291580b026c6Smrg# Interface to module:
291680b026c6Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
291780b026c6Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
291880b026c6Smrg#
291980b026c6Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
292080b026c6Smrg#
292180b026c6SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
292280b026c6Smrg
292380b026c6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
292480b026c6SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
292580b026c6Smrg           [Environment variables to enable memory checking in tests])
292680b026c6Smrg
292780b026c6Smrg# Check for different types of support on different platforms
292880b026c6Smrgcase $host_os in
292980b026c6Smrg    solaris*)
293080b026c6Smrg        AC_CHECK_LIB([umem], [umem_alloc],
293180b026c6Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
293280b026c6Smrg        ;;
293380b026c6Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
293480b026c6Smrg        # both directly and inverted, so should not be 0 or 255.
293580b026c6Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
293680b026c6Smrg        ;;
293780b026c6Smrg    darwin*)
293880b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
293980b026c6Smrg        ;;
294080b026c6Smrg    *bsd*)
294180b026c6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
294280b026c6Smrg        ;;
294380b026c6Smrgesac
294480b026c6Smrg
294580b026c6Smrg# User supplied flags override default flags
294680b026c6Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
294780b026c6Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
294880b026c6Smrgfi
294980b026c6Smrg
295080b026c6SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
295180b026c6Smrg]) # XORG_WITH_LINT
295280b026c6Smrg
29539aa228fdSmrg# XORG_CHECK_MALLOC_ZERO
29549aa228fdSmrg# ----------------------
29559aa228fdSmrg# Minimum version: 1.0.0
29569aa228fdSmrg#
29579aa228fdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
29589aa228fdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
29599aa228fdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
296046374b8dSmrg#
296146374b8dSmrg# No longer actually tests since there is no guarantee applications will
296246374b8dSmrg# run with the same malloc implementation we tested against, and the cost
296346374b8dSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
296446374b8dSmrg# Still allows builders to override when they have complete control over
296546374b8dSmrg# which malloc implementation will be used.
29669aa228fdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
29679aa228fdSmrgAC_ARG_ENABLE(malloc0returnsnull,
29688f65982aSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
296946374b8dSmrg		       [malloc(0) returns NULL (default: yes)]),
29709aa228fdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
297146374b8dSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29729aa228fdSmrg
29739aa228fdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
29749aa228fdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
29759aa228fdSmrg
29769aa228fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
29779aa228fdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
29789aa228fdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
29799aa228fdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29809aa228fdSmrgelse
29819aa228fdSmrg	MALLOC_ZERO_CFLAGS=""
29829aa228fdSmrg	XMALLOC_ZERO_CFLAGS=""
29839aa228fdSmrg	XTMALLOC_ZERO_CFLAGS=""
29849aa228fdSmrgfi
29859aa228fdSmrg
29869aa228fdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
29879aa228fdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
29889aa228fdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
29899aa228fdSmrg]) # XORG_CHECK_MALLOC_ZERO
29909aa228fdSmrg
29919aa228fdSmrg# XORG_WITH_LINT()
29929aa228fdSmrg# ----------------
29939aa228fdSmrg# Minimum version: 1.1.0
29949aa228fdSmrg#
29958f65982aSmrg# This macro enables the use of a tool that flags some suspicious and
29968f65982aSmrg# non-portable constructs (likely to be bugs) in C language source code.
29978f65982aSmrg# It will attempt to locate the tool and use appropriate options.
29988f65982aSmrg# There are various lint type tools on different platforms.
29998f65982aSmrg#
30008f65982aSmrg# Interface to module:
30018f65982aSmrg# LINT:		returns the path to the tool found on the platform
30028f65982aSmrg#		or the value set to LINT on the configure cmd line
30038f65982aSmrg#		also an Automake conditional
30048f65982aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
30058f65982aSmrg#
30068f65982aSmrg# --with-lint:	'yes' user instructs the module to use lint
30078f65982aSmrg#		'no' user instructs the module not to use lint (default)
30088f65982aSmrg#
30098f65982aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
30108f65982aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
30119aa228fdSmrg#
30129aa228fdSmrgAC_DEFUN([XORG_WITH_LINT],[
30139aa228fdSmrg
30148f65982aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
30158f65982aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
30168f65982aSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
30179aa228fdSmrg		[Use a lint-style source code checker (default: disabled)])],
30189aa228fdSmrg		[use_lint=$withval], [use_lint=no])
30198f65982aSmrg
30208f65982aSmrg# Obtain platform specific info like program name and options
30218f65982aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
30228f65982aSmrgcase $host_os in
30238f65982aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
30248f65982aSmrg	lint_name=splint
30258f65982aSmrg	lint_options="-badflag"
30268f65982aSmrg	;;
30278f65982aSmrg  *freebsd* | *netbsd*)
30288f65982aSmrg	lint_name=lint
30298f65982aSmrg	lint_options="-u -b"
30308f65982aSmrg	;;
30318f65982aSmrg  *solaris*)
30328f65982aSmrg	lint_name=lint
30338f65982aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
30348f65982aSmrg	;;
30358f65982aSmrgesac
30368f65982aSmrg
30378f65982aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
30388f65982aSmrgif test "x$use_lint" = x"yes" ; then
30398f65982aSmrg   AC_PATH_PROG([LINT], [$lint_name])
30408f65982aSmrg   if test "x$LINT" = "x"; then
30418f65982aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
30428f65982aSmrg   fi
30438f65982aSmrgelif test "x$use_lint" = x"no" ; then
30448f65982aSmrg   if test "x$LINT" != "x"; then
30458f65982aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
30468f65982aSmrg   fi
30479aa228fdSmrgelse
30488f65982aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30499aa228fdSmrgfi
30508f65982aSmrg
30518f65982aSmrg# User supplied flags override default flags
30528f65982aSmrgif test "x$LINT_FLAGS" != "x"; then
30538f65982aSmrg   lint_options=$LINT_FLAGS
30549aa228fdSmrgfi
30559aa228fdSmrg
30568f65982aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
30578f65982aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
30589aa228fdSmrg
30599aa228fdSmrg]) # XORG_WITH_LINT
30609aa228fdSmrg
30619aa228fdSmrg# XORG_LINT_LIBRARY(LIBNAME)
30629aa228fdSmrg# --------------------------
30639aa228fdSmrg# Minimum version: 1.1.0
30649aa228fdSmrg#
30659aa228fdSmrg# Sets up flags for building lint libraries for checking programs that call
30669aa228fdSmrg# functions in the library.
30679aa228fdSmrg#
30688f65982aSmrg# Interface to module:
30698f65982aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
30708f65982aSmrg# MAKE_LINT_LIB		- Automake conditional
30718f65982aSmrg#
30728f65982aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
30738f65982aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
30749aa228fdSmrg
30759aa228fdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
30769aa228fdSmrgAC_REQUIRE([XORG_WITH_LINT])
30778f65982aSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
30789aa228fdSmrg	[Create lint library (default: disabled)])],
30799aa228fdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
30808f65982aSmrg
30818f65982aSmrgif test "x$make_lint_lib" = x"yes" ; then
30828f65982aSmrg   LINTLIB=llib-l$1.ln
30838f65982aSmrg   if test "x$LINT" = "x"; then
30848f65982aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
30858f65982aSmrg   fi
30868f65982aSmrgelif test "x$make_lint_lib" != x"no" ; then
30878f65982aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30889aa228fdSmrgfi
30898f65982aSmrg
30909aa228fdSmrgAC_SUBST(LINTLIB)
30919aa228fdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
30929aa228fdSmrg
30939aa228fdSmrg]) # XORG_LINT_LIBRARY
30949aa228fdSmrg
309580b026c6Smrg# XORG_COMPILER_BRAND
309680b026c6Smrg# -------------------
309780b026c6Smrg# Minimum version: 1.14.0
309880b026c6Smrg#
309980b026c6Smrg# Checks for various brands of compilers and sets flags as appropriate:
310080b026c6Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
310180b026c6Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
310280b026c6Smrg#   clang compiler - sets CLANGCC to "yes"
310380b026c6Smrg#   Intel compiler - sets INTELCC to "yes"
310480b026c6Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
310580b026c6Smrg#
310680b026c6SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
310780b026c6SmrgAC_LANG_CASE(
310880b026c6Smrg	[C], [
310946374b8dSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
311046374b8dSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
311146374b8dSmrg		m4_version_prereq([2.70],
311246374b8dSmrg			[AC_REQUIRE([AC_PROG_CC])],
311346374b8dSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
311480b026c6Smrg	],
311580b026c6Smrg	[C++], [
311680b026c6Smrg		AC_REQUIRE([AC_PROG_CXX])
311780b026c6Smrg	]
311880b026c6Smrg)
311980b026c6SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
312080b026c6SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
312180b026c6SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
312280b026c6Smrg]) # XORG_COMPILER_BRAND
312380b026c6Smrg
312480b026c6Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
312580b026c6Smrg# ---------------
312680b026c6Smrg# Minimum version: 1.16.0
312780b026c6Smrg#
312880b026c6Smrg# Test if the compiler works when passed the given flag as a command line argument.
312946374b8dSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
313080b026c6Smrg# next flag in the list until there are no more options.
313180b026c6Smrg#
313280b026c6Smrg# Note that this does not guarantee that the compiler supports the flag as some
313380b026c6Smrg# compilers will simply ignore arguments that they do not understand, but we do
313480b026c6Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
313580b026c6Smrg# -Werror=unused-command-line-argument
313680b026c6Smrg#
313780b026c6SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
313880b026c6Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
313980b026c6Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
314080b026c6Smrg
314180b026c6SmrgAC_LANG_COMPILER_REQUIRE
314280b026c6Smrg
314380b026c6SmrgAC_LANG_CASE(
314480b026c6Smrg	[C], [
314546374b8dSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
314646374b8dSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
314746374b8dSmrg		m4_version_prereq([2.70],
314846374b8dSmrg			[AC_REQUIRE([AC_PROG_CC])],
314946374b8dSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
315080b026c6Smrg		define([PREFIX], [C])
315180b026c6Smrg		define([CACHE_PREFIX], [cc])
315280b026c6Smrg		define([COMPILER], [$CC])
315380b026c6Smrg	],
315480b026c6Smrg	[C++], [
315580b026c6Smrg		define([PREFIX], [CXX])
315680b026c6Smrg		define([CACHE_PREFIX], [cxx])
315780b026c6Smrg		define([COMPILER], [$CXX])
315880b026c6Smrg	]
315980b026c6Smrg)
316080b026c6Smrg
316180b026c6Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
316280b026c6Smrg
316380b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
316480b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
316580b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
316680b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
316780b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
316880b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
316980b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
317080b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
317180b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
317280b026c6Smrgfi
317380b026c6Smrg
317480b026c6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
317580b026c6Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
317680b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
317780b026c6Smrg	fi
317880b026c6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
317980b026c6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
318080b026c6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
318180b026c6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
318280b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
318380b026c6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
318480b026c6Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
318580b026c6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318680b026c6Smrgfi
318780b026c6Smrg
318880b026c6Smrgfound="no"
318980b026c6Smrgm4_foreach([flag], m4_cdr($@), [
319080b026c6Smrg	if test $found = "no" ; then
31910c7e83b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
319280b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
319380b026c6Smrg		fi
319480b026c6Smrg
31950c7e83b2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
319680b026c6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
319780b026c6Smrg		fi
319880b026c6Smrg
319980b026c6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
320080b026c6Smrg
320180b026c6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
320280b026c6Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
320380b026c6Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
320480b026c6Smrg		AC_CACHE_VAL($cacheid,
320580b026c6Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
320680b026c6Smrg					     [eval $cacheid=yes],
320780b026c6Smrg					     [eval $cacheid=no])])
320880b026c6Smrg
320980b026c6Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
321080b026c6Smrg
321180b026c6Smrg		eval supported=\$$cacheid
321280b026c6Smrg		AC_MSG_RESULT([$supported])
321380b026c6Smrg		if test "$supported" = "yes" ; then
321480b026c6Smrg			$1="$$1 ]flag["
321580b026c6Smrg			found="yes"
321680b026c6Smrg		fi
321780b026c6Smrg	fi
321880b026c6Smrg])
321980b026c6Smrg]) # XORG_TESTSET_CFLAG
322080b026c6Smrg
322180b026c6Smrg# XORG_COMPILER_FLAGS
322280b026c6Smrg# ---------------
322380b026c6Smrg# Minimum version: 1.16.0
322480b026c6Smrg#
322580b026c6Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
322680b026c6Smrg# arguments supported by the selected compiler which do NOT alter the generated
322780b026c6Smrg# code.  These arguments will cause the compiler to print various warnings
322880b026c6Smrg# during compilation AND turn a conservative set of warnings into errors.
322980b026c6Smrg#
323080b026c6Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
323180b026c6Smrg# future versions of util-macros as options are added to new compilers.
323280b026c6Smrg#
323380b026c6SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
323480b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
323580b026c6Smrg
323680b026c6SmrgAC_ARG_ENABLE(selective-werror,
323780b026c6Smrg              AS_HELP_STRING([--disable-selective-werror],
323880b026c6Smrg                             [Turn off selective compiler errors. (default: enabled)]),
323980b026c6Smrg              [SELECTIVE_WERROR=$enableval],
324080b026c6Smrg              [SELECTIVE_WERROR=yes])
324180b026c6Smrg
324280b026c6SmrgAC_LANG_CASE(
324380b026c6Smrg        [C], [
324480b026c6Smrg                define([PREFIX], [C])
324580b026c6Smrg        ],
324680b026c6Smrg        [C++], [
324780b026c6Smrg                define([PREFIX], [CXX])
324880b026c6Smrg        ]
324980b026c6Smrg)
325080b026c6Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
325180b026c6Smrgif test "x$SUNCC" = "xyes"; then
325280b026c6Smrg    [BASE_]PREFIX[FLAGS]="-v"
325380b026c6Smrgelse
325480b026c6Smrg    [BASE_]PREFIX[FLAGS]=""
325580b026c6Smrgfi
325680b026c6Smrg
325780b026c6Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
325880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
325980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
326080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
326180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
326280b026c6Smrg
326380b026c6SmrgAC_LANG_CASE(
326480b026c6Smrg	[C], [
326580b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
326680b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
326780b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
326880b026c6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32690c7e83b2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
327080b026c6Smrg	]
327180b026c6Smrg)
327280b026c6Smrg
327380b026c6Smrg# This chunk adds additional warnings that could catch undesired effects.
327480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
327580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
327680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
327780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
327880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
327980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32800c7e83b2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
328180b026c6Smrg
328280b026c6Smrg# These are currently disabled because they are noisy.  They will be enabled
328380b026c6Smrg# in the future once the codebase is sufficiently modernized to silence
328480b026c6Smrg# them.  For now, I don't want them to drown out the other warnings.
328580b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
328680b026c6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32870c7e83b2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
328880b026c6Smrg
328946374b8dSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
329080b026c6Smrg# when there are problems that should be fixed.
329180b026c6Smrg
329280b026c6Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
329380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
329480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
329580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
329680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
329780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
329880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
329980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
330080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
330180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
330280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
330380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
330480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
330580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
330680b026c6Smrgelse
330780b026c6SmrgAC_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])
330880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
330980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
331080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
331180b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
331280b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
331380b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
331480b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
331580b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
331680b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
331780b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
331880b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
331980b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
332080b026c6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
332180b026c6Smrgfi
332280b026c6Smrg
332380b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
332480b026c6Smrg]) # XORG_COMPILER_FLAGS
332580b026c6Smrg
332683d7c197Smrg# XORG_CWARNFLAGS
332783d7c197Smrg# ---------------
332883d7c197Smrg# Minimum version: 1.2.0
332980b026c6Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
333083d7c197Smrg#
333183d7c197Smrg# Defines CWARNFLAGS to enable C compiler warnings.
333283d7c197Smrg#
333380b026c6Smrg# This function is deprecated because it defines -fno-strict-aliasing
333480b026c6Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
333580b026c6Smrg# is needed, then it should be added explicitly in the module when
333680b026c6Smrg# it is updated to use BASE_CFLAGS.
333780b026c6Smrg#
333883d7c197SmrgAC_DEFUN([XORG_CWARNFLAGS], [
333980b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
334080b026c6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
334180b026c6SmrgAC_LANG_CASE(
334280b026c6Smrg	[C], [
334380b026c6Smrg		CWARNFLAGS="$BASE_CFLAGS"
334480b026c6Smrg		if  test "x$GCC" = xyes ; then
334580b026c6Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
334680b026c6Smrg		fi
334780b026c6Smrg		AC_SUBST(CWARNFLAGS)
334880b026c6Smrg	]
334980b026c6Smrg)
335083d7c197Smrg]) # XORG_CWARNFLAGS
33518f65982aSmrg
33528f65982aSmrg# XORG_STRICT_OPTION
33538f65982aSmrg# -----------------------
33548f65982aSmrg# Minimum version: 1.3.0
33558f65982aSmrg#
335680b026c6Smrg# Add configure option to enable strict compilation flags, such as treating
335780b026c6Smrg# warnings as fatal errors.
335880b026c6Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
335980b026c6Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
336080b026c6Smrg#
336180b026c6Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
336280b026c6Smrg# when strict compilation is unconditionally desired.
33638f65982aSmrgAC_DEFUN([XORG_STRICT_OPTION], [
33648f65982aSmrgAC_REQUIRE([XORG_CWARNFLAGS])
336580b026c6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33668f65982aSmrg
33678f65982aSmrgAC_ARG_ENABLE(strict-compilation,
33688f65982aSmrg			  AS_HELP_STRING([--enable-strict-compilation],
33698f65982aSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33708f65982aSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
337180b026c6Smrg
337280b026c6SmrgAC_LANG_CASE(
337380b026c6Smrg        [C], [
337480b026c6Smrg                define([PREFIX], [C])
337580b026c6Smrg        ],
337680b026c6Smrg        [C++], [
337780b026c6Smrg                define([PREFIX], [CXX])
337880b026c6Smrg        ]
337980b026c6Smrg)
338080b026c6Smrg
338180b026c6Smrg[STRICT_]PREFIX[FLAGS]=""
338280b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
338380b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
338480b026c6Smrg
338580b026c6Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
338680b026c6Smrg# activate it with -Werror, so we add it here explicitly.
338780b026c6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
338880b026c6Smrg
33898f65982aSmrgif test "x$STRICT_COMPILE" = "xyes"; then
339080b026c6Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
339180b026c6Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33928f65982aSmrgfi
339380b026c6SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
339480b026c6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
339580b026c6SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33968f65982aSmrg]) # XORG_STRICT_OPTION
33978f65982aSmrg
339846374b8dSmrg# XORG_DEFAULT_NOCODE_OPTIONS
339946374b8dSmrg# ---------------------------
340046374b8dSmrg# Minimum version: 1.20.0
340146374b8dSmrg#
340246374b8dSmrg# Defines default options for X.Org modules which don't compile code,
340346374b8dSmrg# such as fonts, bitmaps, cursors, and docs.
340446374b8dSmrg#
340546374b8dSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
340646374b8dSmrgAC_REQUIRE([AC_PROG_INSTALL])
340746374b8dSmrgXORG_RELEASE_VERSION
340846374b8dSmrgXORG_CHANGELOG
340946374b8dSmrgXORG_INSTALL
341046374b8dSmrgXORG_MANPAGE_SECTIONS
341146374b8dSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
341246374b8dSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
341346374b8dSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
341446374b8dSmrg
34158f65982aSmrg# XORG_DEFAULT_OPTIONS
34168f65982aSmrg# --------------------
34178f65982aSmrg# Minimum version: 1.3.0
34188f65982aSmrg#
341946374b8dSmrg# Defines default options for X.Org modules which compile code.
34208f65982aSmrg#
34218f65982aSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
34228f65982aSmrgAC_REQUIRE([AC_PROG_INSTALL])
342380b026c6SmrgXORG_COMPILER_FLAGS
34248f65982aSmrgXORG_CWARNFLAGS
34258f65982aSmrgXORG_STRICT_OPTION
342646374b8dSmrgXORG_DEFAULT_NOCODE_OPTIONS
34278f65982aSmrg]) # XORG_DEFAULT_OPTIONS
34288f65982aSmrg
34298f65982aSmrg# XORG_INSTALL()
34308f65982aSmrg# ----------------
34318f65982aSmrg# Minimum version: 1.4.0
34328f65982aSmrg#
34338f65982aSmrg# Defines the variable INSTALL_CMD as the command to copy
34348f65982aSmrg# INSTALL from $prefix/share/util-macros.
34358f65982aSmrg#
34368f65982aSmrgAC_DEFUN([XORG_INSTALL], [
34378f65982aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
34388f65982aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
34398f65982aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
34408f65982aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3441e39ce84cSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3442e39ce84cSmrgtouch \$(top_srcdir)/INSTALL; \
3443e39ce84cSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
34448f65982aSmrgAC_SUBST([INSTALL_CMD])
34458f65982aSmrg]) # XORG_INSTALL
34469aa228fdSmrgdnl Copyright 2005 Red Hat, Inc
34479aa228fdSmrgdnl
34489aa228fdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
34499aa228fdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
34509aa228fdSmrgdnl the above copyright notice appear in all copies and that both that
34519aa228fdSmrgdnl copyright notice and this permission notice appear in supporting
34529aa228fdSmrgdnl documentation.
34539aa228fdSmrgdnl
34549aa228fdSmrgdnl The above copyright notice and this permission notice shall be included
34559aa228fdSmrgdnl in all copies or substantial portions of the Software.
34569aa228fdSmrgdnl
34579aa228fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34589aa228fdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34599aa228fdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34609aa228fdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
34619aa228fdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34629aa228fdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34639aa228fdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
34649aa228fdSmrgdnl
34659aa228fdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
34669aa228fdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
34679aa228fdSmrgdnl other dealings in this Software without prior written authorization
34689aa228fdSmrgdnl from the copyright holders.
34699aa228fdSmrgdnl
34709aa228fdSmrg
34719aa228fdSmrg# XORG_RELEASE_VERSION
34729aa228fdSmrg# --------------------
34738f65982aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
34740c7e83b2Smrg
34759aa228fdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
34769aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
34779aa228fdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
34789aa228fdSmrg		[Major version of this package])
347983d7c197Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
34809aa228fdSmrg	if test "x$PVM" = "x"; then
34819aa228fdSmrg		PVM="0"
34829aa228fdSmrg	fi
34839aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
34849aa228fdSmrg		[$PVM],
34859aa228fdSmrg		[Minor version of this package])
348683d7c197Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
34879aa228fdSmrg	if test "x$PVP" = "x"; then
34889aa228fdSmrg		PVP="0"
34899aa228fdSmrg	fi
34909aa228fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
34919aa228fdSmrg		[$PVP],
34929aa228fdSmrg		[Patch version of this package])
34939aa228fdSmrg])
34949aa228fdSmrg
349583d7c197Smrg# XORG_CHANGELOG()
349683d7c197Smrg# ----------------
349783d7c197Smrg# Minimum version: 1.2.0
349883d7c197Smrg#
349983d7c197Smrg# Defines the variable CHANGELOG_CMD as the command to generate
350083d7c197Smrg# ChangeLog from git.
350183d7c197Smrg#
350283d7c197Smrg#
350383d7c197SmrgAC_DEFUN([XORG_CHANGELOG], [
3504e39ce84cSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
35058f65982aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3506e39ce84cSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3507e39ce84cSmrgtouch \$(top_srcdir)/ChangeLog; \
3508e39ce84cSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
350983d7c197SmrgAC_SUBST([CHANGELOG_CMD])
351083d7c197Smrg]) # XORG_CHANGELOG
351183d7c197Smrg
3512