1c1e8faa6Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
22becc446Smrg
3c1e8faa6Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
42c7c4e3dSmrg
52c7c4e3dSmrg# This file is free software; the Free Software Foundation
62c7c4e3dSmrg# gives unlimited permission to copy and/or distribute it,
72c7c4e3dSmrg# with or without modifications, as long as this notice is preserved.
82c7c4e3dSmrg
92c7c4e3dSmrg# This program is distributed in the hope that it will be useful,
102c7c4e3dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
112c7c4e3dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
122c7c4e3dSmrg# PARTICULAR PURPOSE.
132c7c4e3dSmrg
142becc446Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c1e8faa6Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18c1e8faa6Smrg[m4_warning([this file was generated for autoconf 2.72.
198650bb69SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208650bb69SmrgIf you have problems, you may need to regenerate the build system entirely.
212becc446SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
222c7c4e3dSmrg
23c1e8faa6Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
248650bb69Smrg#
258650bb69Smrg# This file is free software; the Free Software Foundation
268650bb69Smrg# gives unlimited permission to copy and/or distribute it,
278650bb69Smrg# with or without modifications, as long as this notice is preserved.
282c7c4e3dSmrg
292c7c4e3dSmrg# AM_AUTOMAKE_VERSION(VERSION)
302c7c4e3dSmrg# ----------------------------
312c7c4e3dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
322c7c4e3dSmrg# generated from the m4 files accompanying Automake X.Y.
338650bb69Smrg# (This private macro should not be called outside this file.)
348650bb69SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35c1e8faa6Smrg[am__api_version='1.17'
368650bb69Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
378650bb69Smrgdnl require some minimum version.  Point them to the right macro.
38c1e8faa6Smrgm4_if([$1], [1.17], [],
398650bb69Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
408650bb69Smrg])
418650bb69Smrg
428650bb69Smrg# _AM_AUTOCONF_VERSION(VERSION)
438650bb69Smrg# -----------------------------
448650bb69Smrg# aclocal traces this macro to find the Autoconf version.
458650bb69Smrg# This is a private macro too.  Using m4_define simplifies
468650bb69Smrg# the logic in aclocal, which can simply ignore this definition.
478650bb69Smrgm4_define([_AM_AUTOCONF_VERSION], [])
482c7c4e3dSmrg
492c7c4e3dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
502c7c4e3dSmrg# -------------------------------
518650bb69Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528650bb69Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
532c7c4e3dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54c1e8faa6Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
558650bb69Smrgm4_ifndef([AC_AUTOCONF_VERSION],
568650bb69Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578650bb69Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
582c7c4e3dSmrg
598650bb69Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
602c7c4e3dSmrg
61c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
622c7c4e3dSmrg#
638650bb69Smrg# This file is free software; the Free Software Foundation
648650bb69Smrg# gives unlimited permission to copy and/or distribute it,
658650bb69Smrg# with or without modifications, as long as this notice is preserved.
662c7c4e3dSmrg
672c7c4e3dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
682becc446Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
692becc446Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
702c7c4e3dSmrg#
712c7c4e3dSmrg# Of course, Automake must honor this variable whenever it calls a
722c7c4e3dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
732c7c4e3dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
742c7c4e3dSmrg# depending on how configure is run.  This is pretty annoying, since
752c7c4e3dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
762c7c4e3dSmrg# source directory, any form will work fine, but in subdirectories a
772c7c4e3dSmrg# relative path needs to be adjusted first.
782c7c4e3dSmrg#
792c7c4e3dSmrg# $ac_aux_dir/missing
802c7c4e3dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
812c7c4e3dSmrg# $top_srcdir/$ac_aux_dir/missing
822c7c4e3dSmrg#    fails if $ac_aux_dir is absolute,
832c7c4e3dSmrg#    fails when called from a subdirectory in a VPATH build with
842c7c4e3dSmrg#          a relative $ac_aux_dir
852c7c4e3dSmrg#
862c7c4e3dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
872c7c4e3dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
882becc446Smrg# harmless because $srcdir is '.', but things will broke when you
892c7c4e3dSmrg# start a VPATH build or use an absolute $srcdir.
902c7c4e3dSmrg#
912c7c4e3dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
922c7c4e3dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
932c7c4e3dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
942c7c4e3dSmrg# and then we would define $MISSING as
952c7c4e3dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
962c7c4e3dSmrg# This will work as long as MISSING is not called from configure, because
972c7c4e3dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
982c7c4e3dSmrg# However there are other variables, like CC, which are often used in
992c7c4e3dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1002c7c4e3dSmrg#
1012c7c4e3dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
1022c7c4e3dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
1032c7c4e3dSmrg# configured tree to be moved without reconfiguration.
1042c7c4e3dSmrg
1058650bb69SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1062becc446Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1072becc446Smrg# Expand $ac_aux_dir to an absolute path.
1082becc446Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1092c7c4e3dSmrg])
1102c7c4e3dSmrg
1118650bb69Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1122c7c4e3dSmrg
113c1e8faa6Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
1148650bb69Smrg#
1158650bb69Smrg# This file is free software; the Free Software Foundation
1168650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1178650bb69Smrg# with or without modifications, as long as this notice is preserved.
1182c7c4e3dSmrg
1198650bb69Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1208650bb69Smrg# -------------------------------------
1218650bb69Smrg# Define a conditional.
1228650bb69SmrgAC_DEFUN([AM_CONDITIONAL],
1232becc446Smrg[AC_PREREQ([2.52])dnl
1242becc446Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1252becc446Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1268650bb69SmrgAC_SUBST([$1_TRUE])dnl
1278650bb69SmrgAC_SUBST([$1_FALSE])dnl
1288650bb69Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1298650bb69Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1308650bb69Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1318650bb69Smrgif $2; then
1328650bb69Smrg  $1_TRUE=
1338650bb69Smrg  $1_FALSE='#'
1342c7c4e3dSmrgelse
1358650bb69Smrg  $1_TRUE='#'
1368650bb69Smrg  $1_FALSE=
1372c7c4e3dSmrgfi
1388650bb69SmrgAC_CONFIG_COMMANDS_PRE(
1398650bb69Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1408650bb69Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1418650bb69SmrgUsually this means the macro was only invoked conditionally.]])
1428650bb69Smrgfi])])
1432c7c4e3dSmrg
144c1e8faa6Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
1458650bb69Smrg#
1468650bb69Smrg# This file is free software; the Free Software Foundation
1478650bb69Smrg# gives unlimited permission to copy and/or distribute it,
1488650bb69Smrg# with or without modifications, as long as this notice is preserved.
1492c7c4e3dSmrg
1502c7c4e3dSmrg
1512becc446Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1522c7c4e3dSmrg# written in clear, in which case automake, when reading aclocal.m4,
1532c7c4e3dSmrg# will think it sees a *use*, and therefore will trigger all it's
1542c7c4e3dSmrg# C support machinery.  Also note that it means that autoscan, seeing
1552c7c4e3dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1562c7c4e3dSmrg
1572c7c4e3dSmrg
1582c7c4e3dSmrg# _AM_DEPENDENCIES(NAME)
1592c7c4e3dSmrg# ----------------------
1602c7c4e3dSmrg# See how the compiler implements dependency checking.
1612becc446Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1622c7c4e3dSmrg# We try a few techniques and use that to set a single cache variable.
1632c7c4e3dSmrg#
1642c7c4e3dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1652c7c4e3dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1662c7c4e3dSmrg# dependency, and given that the user is not expected to run this macro,
1672c7c4e3dSmrg# just rely on AC_PROG_CC.
1682c7c4e3dSmrgAC_DEFUN([_AM_DEPENDENCIES],
1692c7c4e3dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1702c7c4e3dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1712c7c4e3dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1722c7c4e3dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1732c7c4e3dSmrg
1742becc446Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1752becc446Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1762becc446Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1772becc446Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1782becc446Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1792becc446Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1802becc446Smrg                    [depcc="$$1"   am_compiler_list=])
1812c7c4e3dSmrg
1822c7c4e3dSmrgAC_CACHE_CHECK([dependency style of $depcc],
1832c7c4e3dSmrg               [am_cv_$1_dependencies_compiler_type],
1842c7c4e3dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1852c7c4e3dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1862c7c4e3dSmrg  # making bogus files that we don't know about and never remove.  For
1872c7c4e3dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1882becc446Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1892becc446Smrg  # in D".
1902becc446Smrg  rm -rf conftest.dir
1912c7c4e3dSmrg  mkdir conftest.dir
1922c7c4e3dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1932c7c4e3dSmrg  # using a relative directory.
1942c7c4e3dSmrg  cp "$am_depcomp" conftest.dir
1952c7c4e3dSmrg  cd conftest.dir
1962c7c4e3dSmrg  # We will build objects and dependencies in a subdirectory because
1972c7c4e3dSmrg  # it helps to detect inapplicable dependency modes.  For instance
1982c7c4e3dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1992c7c4e3dSmrg  # side effect of compilation, but ICC will put the dependencies in
2002c7c4e3dSmrg  # the current directory while Tru64 will put them in the object
2012c7c4e3dSmrg  # directory.
2022c7c4e3dSmrg  mkdir sub
2032c7c4e3dSmrg
2042c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2052c7c4e3dSmrg  if test "$am_compiler_list" = ""; then
2062c7c4e3dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2072c7c4e3dSmrg  fi
2088650bb69Smrg  am__universal=false
2098650bb69Smrg  m4_case([$1], [CC],
2108650bb69Smrg    [case " $depcc " in #(
2118650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2128650bb69Smrg     esac],
2138650bb69Smrg    [CXX],
2148650bb69Smrg    [case " $depcc " in #(
2158650bb69Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2168650bb69Smrg     esac])
2178650bb69Smrg
2182c7c4e3dSmrg  for depmode in $am_compiler_list; do
2192c7c4e3dSmrg    # Setup a source with many dependencies, because some compilers
2202c7c4e3dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2212c7c4e3dSmrg    # we should not choose a depcomp mode which is confused by this.
2222c7c4e3dSmrg    #
2232c7c4e3dSmrg    # We need to recreate these files for each test, as the compiler may
2242c7c4e3dSmrg    # overwrite some of them when testing with obscure command lines.
2252c7c4e3dSmrg    # This happens at least with the AIX C compiler.
2262c7c4e3dSmrg    : > sub/conftest.c
2272c7c4e3dSmrg    for i in 1 2 3 4 5 6; do
2282c7c4e3dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2292becc446Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2302becc446Smrg      # Solaris 10 /bin/sh.
2312becc446Smrg      echo '/* dummy */' > sub/conftst$i.h
2322c7c4e3dSmrg    done
2332c7c4e3dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2342c7c4e3dSmrg
2352becc446Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2368650bb69Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2372becc446Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2382becc446Smrg    # versions had trouble with output in subdirs.
2398650bb69Smrg    am__obj=sub/conftest.${OBJEXT-o}
2408650bb69Smrg    am__minus_obj="-o $am__obj"
2412c7c4e3dSmrg    case $depmode in
2428650bb69Smrg    gcc)
2438650bb69Smrg      # This depmode causes a compiler race in universal mode.
2448650bb69Smrg      test "$am__universal" = false || continue
2458650bb69Smrg      ;;
2462c7c4e3dSmrg    nosideeffect)
2472becc446Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2482becc446Smrg      # only be used when explicitly requested.
2492c7c4e3dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2502c7c4e3dSmrg	continue
2512c7c4e3dSmrg      else
2522c7c4e3dSmrg	break
2532c7c4e3dSmrg      fi
2542c7c4e3dSmrg      ;;
2552becc446Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2562becc446Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2578650bb69Smrg      # not run yet.  These depmodes are late enough in the game, and
2588650bb69Smrg      # so weak that their functioning should not be impacted.
2598650bb69Smrg      am__obj=conftest.${OBJEXT-o}
2608650bb69Smrg      am__minus_obj=
2618650bb69Smrg      ;;
2622c7c4e3dSmrg    none) break ;;
2632c7c4e3dSmrg    esac
2642c7c4e3dSmrg    if depmode=$depmode \
2658650bb69Smrg       source=sub/conftest.c object=$am__obj \
2662c7c4e3dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2678650bb69Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2682c7c4e3dSmrg         >/dev/null 2>conftest.err &&
2698650bb69Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2702c7c4e3dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2718650bb69Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2722c7c4e3dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2732c7c4e3dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2748650bb69Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2758650bb69Smrg      # that says an option was ignored or not supported.
276c1e8faa6Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
2778650bb69Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2788650bb69Smrg      # The diagnosis changed in icc 8.0:
2798650bb69Smrg      #   icc: Command line remark: option '-MP' not supported
2808650bb69Smrg      if (grep 'ignoring option' conftest.err ||
2818650bb69Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2822c7c4e3dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2832c7c4e3dSmrg        break
2842c7c4e3dSmrg      fi
2852c7c4e3dSmrg    fi
2862c7c4e3dSmrg  done
2872c7c4e3dSmrg
2882c7c4e3dSmrg  cd ..
2892c7c4e3dSmrg  rm -rf conftest.dir
2902c7c4e3dSmrgelse
2912c7c4e3dSmrg  am_cv_$1_dependencies_compiler_type=none
2922c7c4e3dSmrgfi
2932c7c4e3dSmrg])
2942c7c4e3dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2952c7c4e3dSmrgAM_CONDITIONAL([am__fastdep$1], [
2962c7c4e3dSmrg  test "x$enable_dependency_tracking" != xno \
2972c7c4e3dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2982c7c4e3dSmrg])
2992c7c4e3dSmrg
3002c7c4e3dSmrg
3012c7c4e3dSmrg# AM_SET_DEPDIR
3022c7c4e3dSmrg# -------------
3032c7c4e3dSmrg# Choose a directory name for dependency files.
3042becc446Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3052c7c4e3dSmrgAC_DEFUN([AM_SET_DEPDIR],
3062c7c4e3dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3072c7c4e3dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3082c7c4e3dSmrg])
3092c7c4e3dSmrg
3102c7c4e3dSmrg
3112c7c4e3dSmrg# AM_DEP_TRACK
3122c7c4e3dSmrg# ------------
3132c7c4e3dSmrgAC_DEFUN([AM_DEP_TRACK],
3142becc446Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3152becc446SmrgAS_HELP_STRING(
3162becc446Smrg  [--enable-dependency-tracking],
3172becc446Smrg  [do not reject slow dependency extractors])
3182becc446SmrgAS_HELP_STRING(
3192becc446Smrg  [--disable-dependency-tracking],
3202becc446Smrg  [speeds up one-time build])])
3212c7c4e3dSmrgif test "x$enable_dependency_tracking" != xno; then
3222c7c4e3dSmrg  am_depcomp="$ac_aux_dir/depcomp"
3232c7c4e3dSmrg  AMDEPBACKSLASH='\'
3242becc446Smrg  am__nodep='_no'
3252c7c4e3dSmrgfi
3262c7c4e3dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3278650bb69SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3288650bb69Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3292becc446SmrgAC_SUBST([am__nodep])dnl
3302becc446Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3312c7c4e3dSmrg])
3322c7c4e3dSmrg
3338650bb69Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3342c7c4e3dSmrg
335c1e8faa6Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
3368650bb69Smrg#
3378650bb69Smrg# This file is free software; the Free Software Foundation
3388650bb69Smrg# gives unlimited permission to copy and/or distribute it,
3398650bb69Smrg# with or without modifications, as long as this notice is preserved.
3402c7c4e3dSmrg
3412c7c4e3dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3422c7c4e3dSmrg# ------------------------------
3432c7c4e3dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3448650bb69Smrg[{
3452becc446Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3468650bb69Smrg  # are listed without --file.  Let's play safe and only enable the eval
3478650bb69Smrg  # if we detect the quoting.
3483458e6c2Smrg  # TODO: see whether this extra hack can be removed once we start
3493458e6c2Smrg  # requiring Autoconf 2.70 or later.
3503458e6c2Smrg  AS_CASE([$CONFIG_FILES],
3513458e6c2Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523458e6c2Smrg          [*], [set x $CONFIG_FILES])
3538650bb69Smrg  shift
3543458e6c2Smrg  # Used to flag and report bootstrapping failures.
3553458e6c2Smrg  am_rc=0
3563458e6c2Smrg  for am_mf
3578650bb69Smrg  do
3588650bb69Smrg    # Strip MF so we end up with the name of the file.
3593458e6c2Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603458e6c2Smrg    # Check whether this is an Automake generated Makefile which includes
3613458e6c2Smrg    # dependency-tracking related rules and includes.
3623458e6c2Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3638650bb69Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643458e6c2Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653458e6c2Smrg      || continue
3663458e6c2Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673458e6c2Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683458e6c2Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3693458e6c2Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703458e6c2Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3712c7c4e3dSmrg  done
3723458e6c2Smrg  if test $am_rc -ne 0; then
3733458e6c2Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743458e6c2Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3753458e6c2Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3763458e6c2Smrg    necessary).  You can also try re-running configure with the
3773458e6c2Smrg    '--disable-dependency-tracking' option to at least be able to build
3783458e6c2Smrg    the package (albeit without support for automatic dependency tracking).])
3793458e6c2Smrg  fi
3803458e6c2Smrg  AS_UNSET([am_dirpart])
3813458e6c2Smrg  AS_UNSET([am_filepart])
3823458e6c2Smrg  AS_UNSET([am_mf])
3833458e6c2Smrg  AS_UNSET([am_rc])
3843458e6c2Smrg  rm -f conftest-deps.mk
3858650bb69Smrg}
3862c7c4e3dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3872c7c4e3dSmrg
3882c7c4e3dSmrg
3892c7c4e3dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3902c7c4e3dSmrg# -----------------------------
3912c7c4e3dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3922c7c4e3dSmrg#
3933458e6c2Smrg# This code is only required when automatic dependency tracking is enabled.
3943458e6c2Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953458e6c2Smrg# order to bootstrap the dependency handling code.
3962c7c4e3dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3972c7c4e3dSmrg[AC_CONFIG_COMMANDS([depfiles],
3982c7c4e3dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993458e6c2Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4002c7c4e3dSmrg
4018650bb69Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4022c7c4e3dSmrg
403c1e8faa6Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4048650bb69Smrg#
4058650bb69Smrg# This file is free software; the Free Software Foundation
4068650bb69Smrg# gives unlimited permission to copy and/or distribute it,
4078650bb69Smrg# with or without modifications, as long as this notice is preserved.
4082c7c4e3dSmrg
4098650bb69Smrg# This macro actually does too much.  Some checks are only needed if
4108650bb69Smrg# your package does certain things.  But this isn't really a big deal.
4118650bb69Smrg
4122becc446Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4132becc446Smrgm4_define([AC_PROG_CC],
4142becc446Smrgm4_defn([AC_PROG_CC])
4152becc446Smrg[_AM_PROG_CC_C_O
4162becc446Smrg])
4172becc446Smrg
4188650bb69Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4198650bb69Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4208650bb69Smrg# -----------------------------------------------
4218650bb69Smrg# The call with PACKAGE and VERSION arguments is the old style
4228650bb69Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4238650bb69Smrg# and VERSION should now be passed to AC_INIT and removed from
4248650bb69Smrg# the call to AM_INIT_AUTOMAKE.
4258650bb69Smrg# We support both call styles for the transition.  After
4268650bb69Smrg# the next Automake release, Autoconf can make the AC_INIT
4278650bb69Smrg# arguments mandatory, and then we can depend on a new Autoconf
4288650bb69Smrg# release and drop the old call support.
4298650bb69SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4302becc446Smrg[AC_PREREQ([2.65])dnl
4313458e6c2Smrgm4_ifdef([_$0_ALREADY_INIT],
4323458e6c2Smrg  [m4_fatal([$0 expanded multiple times
4333458e6c2Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343458e6c2Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4358650bb69Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4368650bb69Smrgdnl the ones we care about.
4378650bb69Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4388650bb69SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4398650bb69SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4408650bb69Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4418650bb69Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4428650bb69Smrg  # is not polluted with repeated "-I."
4438650bb69Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4448650bb69Smrg  # test to see if srcdir already configured
4458650bb69Smrg  if test -f $srcdir/config.status; then
4468650bb69Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4478650bb69Smrg  fi
4482c7c4e3dSmrgfi
4498650bb69Smrg
4508650bb69Smrg# test whether we have cygpath
4518650bb69Smrgif test -z "$CYGPATH_W"; then
4528650bb69Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4538650bb69Smrg    CYGPATH_W='cygpath -w'
4548650bb69Smrg  else
4558650bb69Smrg    CYGPATH_W=echo
4568650bb69Smrg  fi
4572c7c4e3dSmrgfi
4588650bb69SmrgAC_SUBST([CYGPATH_W])
4592c7c4e3dSmrg
4608650bb69Smrg# Define the identity of the package.
4618650bb69Smrgdnl Distinguish between old-style and new-style calls.
4628650bb69Smrgm4_ifval([$2],
4632becc446Smrg[AC_DIAGNOSE([obsolete],
4642becc446Smrg             [$0: two- and three-arguments forms are deprecated.])
4652becc446Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4668650bb69Smrg AC_SUBST([PACKAGE], [$1])dnl
4678650bb69Smrg AC_SUBST([VERSION], [$2])],
4688650bb69Smrg[_AM_SET_OPTIONS([$1])dnl
4698650bb69Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4702becc446Smrgm4_if(
4713458e6c2Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4722becc446Smrg  [ok:ok],,
4738650bb69Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4748650bb69Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4758650bb69Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4762c7c4e3dSmrg
4778650bb69Smrg_AM_IF_OPTION([no-define],,
4782becc446Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4792becc446Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4802c7c4e3dSmrg
4818650bb69Smrg# Some tools Automake needs.
4828650bb69SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4838650bb69SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4842becc446SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4852becc446SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4862becc446SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4872becc446SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4882becc446SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4898650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4908650bb69SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4912becc446SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4922becc446Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4932becc446Smrg# dies out for good.  For more background, see:
4943458e6c2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953458e6c2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4962becc446SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4972becc446Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4982becc446Smrg# system "awk" is bad on some platforms.
4998650bb69SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5008650bb69SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5018650bb69SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5028650bb69Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5038650bb69Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5048650bb69Smrg			     [_AM_PROG_TAR([v7])])])
5058650bb69Smrg_AM_IF_OPTION([no-dependencies],,
5068650bb69Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5072becc446Smrg		  [_AM_DEPENDENCIES([CC])],
5082becc446Smrg		  [m4_define([AC_PROG_CC],
5092becc446Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5108650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5112becc446Smrg		  [_AM_DEPENDENCIES([CXX])],
5122becc446Smrg		  [m4_define([AC_PROG_CXX],
5132becc446Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5148650bb69SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5152becc446Smrg		  [_AM_DEPENDENCIES([OBJC])],
5162becc446Smrg		  [m4_define([AC_PROG_OBJC],
5172becc446Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5182becc446SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5192becc446Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5202becc446Smrg		  [m4_define([AC_PROG_OBJCXX],
5212becc446Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5228650bb69Smrg])
5233458e6c2Smrg# Variables for tags utilities; see am/tags.am
5243458e6c2Smrgif test -z "$CTAGS"; then
5253458e6c2Smrg  CTAGS=ctags
5263458e6c2Smrgfi
5273458e6c2SmrgAC_SUBST([CTAGS])
5283458e6c2Smrgif test -z "$ETAGS"; then
5293458e6c2Smrg  ETAGS=etags
5303458e6c2Smrgfi
5313458e6c2SmrgAC_SUBST([ETAGS])
5323458e6c2Smrgif test -z "$CSCOPE"; then
5333458e6c2Smrg  CSCOPE=cscope
5343458e6c2Smrgfi
5353458e6c2SmrgAC_SUBST([CSCOPE])
5363458e6c2Smrg
537c1e8faa6SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5382becc446Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5392becc446Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5402becc446Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5418650bb69SmrgAC_CONFIG_COMMANDS_PRE(dnl
5428650bb69Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5438650bb69Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5442becc446Smrg
545c1e8faa6SmrgAC_REQUIRE([_AM_PROG_RM_F])
546c1e8faa6SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
5472becc446Smrg
5482becc446Smrgdnl The trailing newline in this macro's definition is deliberate, for
5492becc446Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5502becc446Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5518650bb69Smrg])
5522c7c4e3dSmrg
5532becc446Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5548650bb69Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5558650bb69Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5568650bb69Smrgm4_define([_AC_COMPILER_EXEEXT],
5578650bb69Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5582c7c4e3dSmrg
5598650bb69Smrg# When config.status generates a header, we must update the stamp-h file.
5608650bb69Smrg# This file resides in the same directory as the config header
5618650bb69Smrg# that is generated.  The stamp files are numbered to have different names.
5628650bb69Smrg
5638650bb69Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5648650bb69Smrg# loop where config.status creates the headers, so we can generate
5658650bb69Smrg# our stamp files there.
5668650bb69SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5678650bb69Smrg[# Compute $1's index in $config_headers.
5688650bb69Smrg_am_arg=$1
5698650bb69Smrg_am_stamp_count=1
5708650bb69Smrgfor _am_header in $config_headers :; do
5718650bb69Smrg  case $_am_header in
5728650bb69Smrg    $_am_arg | $_am_arg:* )
5738650bb69Smrg      break ;;
5748650bb69Smrg    * )
5758650bb69Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5768650bb69Smrg  esac
5778650bb69Smrgdone
5788650bb69Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5792c7c4e3dSmrg
580c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5818650bb69Smrg#
5828650bb69Smrg# This file is free software; the Free Software Foundation
5838650bb69Smrg# gives unlimited permission to copy and/or distribute it,
5848650bb69Smrg# with or without modifications, as long as this notice is preserved.
5852c7c4e3dSmrg
5868650bb69Smrg# AM_PROG_INSTALL_SH
5878650bb69Smrg# ------------------
5888650bb69Smrg# Define $install_sh.
5898650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5908650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5912becc446Smrgif test x"${install_sh+set}" != xset; then
5928650bb69Smrg  case $am_aux_dir in
5938650bb69Smrg  *\ * | *\	*)
5948650bb69Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5958650bb69Smrg  *)
5968650bb69Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5978650bb69Smrg  esac
5982c7c4e3dSmrgfi
5992becc446SmrgAC_SUBST([install_sh])])
6002c7c4e3dSmrg
601c1e8faa6Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
6028650bb69Smrg#
6038650bb69Smrg# This file is free software; the Free Software Foundation
6048650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6058650bb69Smrg# with or without modifications, as long as this notice is preserved.
6062c7c4e3dSmrg
6078650bb69Smrg# Check whether the underlying file-system supports filenames
6088650bb69Smrg# with a leading dot.  For instance MS-DOS doesn't.
6098650bb69SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6108650bb69Smrg[rm -rf .tst 2>/dev/null
6118650bb69Smrgmkdir .tst 2>/dev/null
6128650bb69Smrgif test -d .tst; then
6138650bb69Smrg  am__leading_dot=.
6148650bb69Smrgelse
6158650bb69Smrg  am__leading_dot=_
6168650bb69Smrgfi
6178650bb69Smrgrmdir .tst 2>/dev/null
6188650bb69SmrgAC_SUBST([am__leading_dot])])
6192c7c4e3dSmrg
6208650bb69Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6212c7c4e3dSmrg
622c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6238650bb69Smrg#
6248650bb69Smrg# This file is free software; the Free Software Foundation
6258650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6268650bb69Smrg# with or without modifications, as long as this notice is preserved.
6272c7c4e3dSmrg
6288650bb69Smrg# AM_MAKE_INCLUDE()
6298650bb69Smrg# -----------------
6303458e6c2Smrg# Check whether make has an 'include' directive that can support all
6313458e6c2Smrg# the idioms we need for our automatic dependency tracking code.
6328650bb69SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6333458e6c2Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6343458e6c2Smrgcat > confinc.mk << 'END'
6358650bb69Smrgam__doit:
6363458e6c2Smrg	@echo this is the am__doit target >confinc.out
6378650bb69Smrg.PHONY: am__doit
6388650bb69SmrgEND
6398650bb69Smrgam__include="#"
6408650bb69Smrgam__quote=
6413458e6c2Smrg# BSD make does it like this.
6423458e6c2Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6433458e6c2Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6443458e6c2Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6453458e6c2Smrg_am_result=no
6463458e6c2Smrgfor s in GNU BSD; do
6473458e6c2Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6483458e6c2Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6493458e6c2Smrg      ['0:this is the am__doit target'],
6503458e6c2Smrg      [AS_CASE([$s],
6513458e6c2Smrg          [BSD], [am__include='.include' am__quote='"'],
6523458e6c2Smrg          [am__include='include' am__quote=''])])
6533458e6c2Smrg  if test "$am__include" != "#"; then
6543458e6c2Smrg    _am_result="yes ($s style)"
6553458e6c2Smrg    break
6563458e6c2Smrg  fi
6573458e6c2Smrgdone
6583458e6c2Smrgrm -f confinc.* confmf.*
6593458e6c2SmrgAC_MSG_RESULT([${_am_result}])
6603458e6c2SmrgAC_SUBST([am__include])])
6613458e6c2SmrgAC_SUBST([am__quote])])
6622c7c4e3dSmrg
6638650bb69Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
6642c7c4e3dSmrg
665c1e8faa6Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6668650bb69Smrg#
6678650bb69Smrg# This file is free software; the Free Software Foundation
6688650bb69Smrg# gives unlimited permission to copy and/or distribute it,
6698650bb69Smrg# with or without modifications, as long as this notice is preserved.
6702c7c4e3dSmrg
6718650bb69Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6728650bb69Smrg# ------------------------------
6738650bb69SmrgAC_DEFUN([AM_MISSING_PROG],
6748650bb69Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6758650bb69Smrg$1=${$1-"${am_missing_run}$2"}
6768650bb69SmrgAC_SUBST($1)])
6772c7c4e3dSmrg
6788650bb69Smrg# AM_MISSING_HAS_RUN
6798650bb69Smrg# ------------------
6802becc446Smrg# Define MISSING if not defined so far and test if it is modern enough.
6812becc446Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
6828650bb69SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6838650bb69Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6848650bb69SmrgAC_REQUIRE_AUX_FILE([missing])dnl
6858650bb69Smrgif test x"${MISSING+set}" != xset; then
6863458e6c2Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6872c7c4e3dSmrgfi
6888650bb69Smrg# Use eval to expand $SHELL
6892becc446Smrgif eval "$MISSING --is-lightweight"; then
6902becc446Smrg  am_missing_run="$MISSING "
6918650bb69Smrgelse
6928650bb69Smrg  am_missing_run=
6932becc446Smrg  AC_MSG_WARN(['missing' script is too old or missing])
6948650bb69Smrgfi
6958650bb69Smrg])
6962c7c4e3dSmrg
6978650bb69Smrg# Helper functions for option handling.                     -*- Autoconf -*-
6988650bb69Smrg
699c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7002c7c4e3dSmrg#
7018650bb69Smrg# This file is free software; the Free Software Foundation
7028650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7038650bb69Smrg# with or without modifications, as long as this notice is preserved.
7042c7c4e3dSmrg
7058650bb69Smrg# _AM_MANGLE_OPTION(NAME)
7068650bb69Smrg# -----------------------
7078650bb69SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7088650bb69Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7092c7c4e3dSmrg
7108650bb69Smrg# _AM_SET_OPTION(NAME)
7112becc446Smrg# --------------------
7128650bb69Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7138650bb69SmrgAC_DEFUN([_AM_SET_OPTION],
7142becc446Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7152c7c4e3dSmrg
7168650bb69Smrg# _AM_SET_OPTIONS(OPTIONS)
7172becc446Smrg# ------------------------
7188650bb69Smrg# OPTIONS is a space-separated list of Automake options.
7198650bb69SmrgAC_DEFUN([_AM_SET_OPTIONS],
7208650bb69Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7212c7c4e3dSmrg
7228650bb69Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7238650bb69Smrg# -------------------------------------------
7248650bb69Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7258650bb69SmrgAC_DEFUN([_AM_IF_OPTION],
7268650bb69Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7278650bb69Smrg
728c1e8faa6Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7292becc446Smrg#
7302becc446Smrg# This file is free software; the Free Software Foundation
7312becc446Smrg# gives unlimited permission to copy and/or distribute it,
7322becc446Smrg# with or without modifications, as long as this notice is preserved.
7338650bb69Smrg
7342becc446Smrg# _AM_PROG_CC_C_O
7352becc446Smrg# ---------------
7362becc446Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7372becc446Smrg# to automatically call this.
7382becc446SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7392becc446Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7402becc446SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7412becc446SmrgAC_LANG_PUSH([C])dnl
7422becc446SmrgAC_CACHE_CHECK(
7432becc446Smrg  [whether $CC understands -c and -o together],
7442becc446Smrg  [am_cv_prog_cc_c_o],
7452becc446Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7462becc446Smrg  # Make sure it works both with $CC and with simple cc.
7472becc446Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7482becc446Smrg  # compilers refuse to overwrite an existing .o file with -o,
7492becc446Smrg  # though they will create one.
7502becc446Smrg  am_cv_prog_cc_c_o=yes
7512becc446Smrg  for am_i in 1 2; do
7522becc446Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7532becc446Smrg         && test -f conftest2.$ac_objext; then
7542becc446Smrg      : OK
7552becc446Smrg    else
7562becc446Smrg      am_cv_prog_cc_c_o=no
7572becc446Smrg      break
7582becc446Smrg    fi
7592becc446Smrg  done
7602becc446Smrg  rm -f core conftest*
7612becc446Smrg  unset am_i])
7622becc446Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7632becc446Smrg   # Losing compiler, so override with the script.
7642becc446Smrg   # FIXME: It is wrong to rewrite CC.
7652becc446Smrg   # But if we don't then we get into trouble of one sort or another.
7662becc446Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7672becc446Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7682becc446Smrg   CC="$am_aux_dir/compile $CC"
7692becc446Smrgfi
7702becc446SmrgAC_LANG_POP([C])])
7712becc446Smrg
7722becc446Smrg# For backward compatibility.
7732becc446SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7742becc446Smrg
775c1e8faa6Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776c1e8faa6Smrg#
777c1e8faa6Smrg# This file is free software; the Free Software Foundation
778c1e8faa6Smrg# gives unlimited permission to copy and/or distribute it,
779c1e8faa6Smrg# with or without modifications, as long as this notice is preserved.
780c1e8faa6Smrg
781c1e8faa6Smrg# _AM_PROG_RM_F
782c1e8faa6Smrg# ---------------
783c1e8faa6Smrg# Check whether 'rm -f' without any arguments works.
784c1e8faa6Smrg# https://bugs.gnu.org/10828
785c1e8faa6SmrgAC_DEFUN([_AM_PROG_RM_F],
786c1e8faa6Smrg[am__rm_f_notfound=
787c1e8faa6SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788c1e8faa6SmrgAC_SUBST(am__rm_f_notfound)
789c1e8faa6Smrg])
790c1e8faa6Smrg
791c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7922c7c4e3dSmrg#
7938650bb69Smrg# This file is free software; the Free Software Foundation
7948650bb69Smrg# gives unlimited permission to copy and/or distribute it,
7958650bb69Smrg# with or without modifications, as long as this notice is preserved.
7968650bb69Smrg
7972becc446Smrg# AM_RUN_LOG(COMMAND)
7982becc446Smrg# -------------------
7992becc446Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8002becc446Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8012becc446SmrgAC_DEFUN([AM_RUN_LOG],
8022becc446Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8032becc446Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8042becc446Smrg   ac_status=$?
8052becc446Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8062becc446Smrg   (exit $ac_status); }])
8072becc446Smrg
8082becc446Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8092becc446Smrg
810c1e8faa6Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8112becc446Smrg#
8122becc446Smrg# This file is free software; the Free Software Foundation
8132becc446Smrg# gives unlimited permission to copy and/or distribute it,
8142becc446Smrg# with or without modifications, as long as this notice is preserved.
8158650bb69Smrg
816c1e8faa6Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
817c1e8faa6Smrg# ----------------------------
818c1e8faa6SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819c1e8faa6SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820c1e8faa6Smrg               am_cv_sleep_fractional_seconds, [dnl
821c1e8faa6SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822c1e8faa6Smrg                                 [am_cv_sleep_fractional_seconds=no])
823c1e8faa6Smrg])])
824c1e8faa6Smrg
825c1e8faa6Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826c1e8faa6Smrg# -----------------------------------
827c1e8faa6Smrg# Determine the filesystem's resolution for file modification
828c1e8faa6Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
829c1e8faa6Smrg# of only two seconds, even with the most recent "exFAT" extensions.
830c1e8faa6Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831c1e8faa6Smrg# nanosecond, matching clock_gettime.  However, it is probably not
832c1e8faa6Smrg# possible to delay execution of a shell script for less than one
833c1e8faa6Smrg# millisecond, due to process creation overhead and scheduling
834c1e8faa6Smrg# granularity, so we don't check for anything finer than that. (See below.)
835c1e8faa6SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836c1e8faa6SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837c1e8faa6SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838c1e8faa6Smrg               am_cv_filesystem_timestamp_resolution, [dnl
839c1e8faa6Smrg# Default to the worst case.
840c1e8faa6Smrgam_cv_filesystem_timestamp_resolution=2
841c1e8faa6Smrg
842c1e8faa6Smrg# Only try to go finer than 1 sec if sleep can do it.
843c1e8faa6Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844c1e8faa6Smrg# - 1 sec is not much of a win compared to 2 sec, and
845c1e8faa6Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
846c1e8faa6Smrg# 
847c1e8faa6Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
848c1e8faa6Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849c1e8faa6Smrg# exchange for not incurring the 2s delay for running the test for all
850c1e8faa6Smrg# packages.
851c1e8faa6Smrg#
852c1e8faa6Smrgam_try_resolutions=
853c1e8faa6Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854c1e8faa6Smrg  # Even a millisecond often causes a bunch of false positives,
855c1e8faa6Smrg  # so just try a hundredth of a second. The time saved between .001 and
856c1e8faa6Smrg  # .01 is not terribly consequential.
857c1e8faa6Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858c1e8faa6Smrgfi
859c1e8faa6Smrg
860c1e8faa6Smrg# In order to catch current-generation FAT out, we must *modify* files
861c1e8faa6Smrg# that already exist; the *creation* timestamp is finer.  Use names
862c1e8faa6Smrg# that make ls -t sort them differently when they have equal
863c1e8faa6Smrg# timestamps than when they have distinct timestamps, keeping
864c1e8faa6Smrg# in mind that ls -t prints the *newest* file first.
865c1e8faa6Smrgrm -f conftest.ts?
866c1e8faa6Smrg: > conftest.ts1
867c1e8faa6Smrg: > conftest.ts2
868c1e8faa6Smrg: > conftest.ts3
869c1e8faa6Smrg
870c1e8faa6Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871c1e8faa6Smrg# clobber the current shell's arguments. (Outer-level square brackets
872c1e8faa6Smrg# are removed by m4; they're present so that m4 does not expand
873c1e8faa6Smrg# <dollar><star>; be careful, easy to get confused.)
874c1e8faa6Smrgif (
875c1e8faa6Smrg     set X `[ls -t conftest.ts[12]]` &&
876c1e8faa6Smrg     {
877c1e8faa6Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878c1e8faa6Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879c1e8faa6Smrg     }
880c1e8faa6Smrg); then :; else
881c1e8faa6Smrg  # If neither matched, then we have a broken ls.  This can happen
882c1e8faa6Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883c1e8faa6Smrg  # broken ls alias from the environment.  This has actually
884c1e8faa6Smrg  # happened.  Such a system could not be considered "sane".
885c1e8faa6Smrg  _AS_ECHO_UNQUOTED(
886c1e8faa6Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887c1e8faa6Smrg    [AS_MESSAGE_LOG_FD])
888c1e8faa6Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889c1e8faa6SmrgMake sure there is not a broken ls alias in your environment.])
890c1e8faa6Smrgfi
891c1e8faa6Smrg
892c1e8faa6Smrgfor am_try_res in $am_try_resolutions; do
893c1e8faa6Smrg  # Any one fine-grained sleep might happen to cross the boundary
894c1e8faa6Smrg  # between two values of a coarser actual resolution, but if we do
895c1e8faa6Smrg  # two fine-grained sleeps in a row, at least one of them will fall
896c1e8faa6Smrg  # entirely within a coarse interval.
897c1e8faa6Smrg  echo alpha > conftest.ts1
898c1e8faa6Smrg  sleep $am_try_res
899c1e8faa6Smrg  echo beta > conftest.ts2
900c1e8faa6Smrg  sleep $am_try_res
901c1e8faa6Smrg  echo gamma > conftest.ts3
902c1e8faa6Smrg
903c1e8faa6Smrg  # We assume that 'ls -t' will make use of high-resolution
904c1e8faa6Smrg  # timestamps if the operating system supports them at all.
905c1e8faa6Smrg  if (set X `ls -t conftest.ts?` &&
906c1e8faa6Smrg      test "$[]2" = conftest.ts3 &&
907c1e8faa6Smrg      test "$[]3" = conftest.ts2 &&
908c1e8faa6Smrg      test "$[]4" = conftest.ts1); then
909c1e8faa6Smrg    #
910c1e8faa6Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911c1e8faa6Smrg    # because we don't need to test make.
912c1e8faa6Smrg    make_ok=true
913c1e8faa6Smrg    if test $am_try_res != 1; then
914c1e8faa6Smrg      # But if we've succeeded so far with a subsecond resolution, we
915c1e8faa6Smrg      # have one more thing to check: make. It can happen that
916c1e8faa6Smrg      # everything else supports the subsecond mtimes, but make doesn't;
917c1e8faa6Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918c1e8faa6Smrg      # released under GPLv2). https://bugs.gnu.org/68808
919c1e8faa6Smrg      # 
920c1e8faa6Smrg      # We test $MAKE if it is defined in the environment, else "make".
921c1e8faa6Smrg      # It might get overridden later, but our hope is that in practice
922c1e8faa6Smrg      # it does not matter: it is the system "make" which is (by far)
923c1e8faa6Smrg      # the most likely to be broken, whereas if the user overrides it,
924c1e8faa6Smrg      # probably they did so with a better, or at least not worse, make.
925c1e8faa6Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926c1e8faa6Smrg      #
927c1e8faa6Smrg      # Create a Makefile (real tab character here):
928c1e8faa6Smrg      rm -f conftest.mk
929c1e8faa6Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930c1e8faa6Smrg      echo '	touch conftest.ts2' >>conftest.mk
931c1e8faa6Smrg      #
932c1e8faa6Smrg      # Now, running
933c1e8faa6Smrg      #   touch conftest.ts1; touch conftest.ts2; make
934c1e8faa6Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935c1e8faa6Smrg      # but most often, it will fail if make's support is insufficient. So
936c1e8faa6Smrg      # test for several consecutive successes.
937c1e8faa6Smrg      #
938c1e8faa6Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
939c1e8faa6Smrg      # files, not create new ones, per above.)
940c1e8faa6Smrg      n=0
941c1e8faa6Smrg      make=${MAKE-make}
942c1e8faa6Smrg      until test $n -eq 3; do
943c1e8faa6Smrg        echo one > conftest.ts1
944c1e8faa6Smrg        sleep $am_try_res
945c1e8faa6Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946c1e8faa6Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947c1e8faa6Smrg          make_ok=false
948c1e8faa6Smrg          break # out of $n loop
949c1e8faa6Smrg        fi
950c1e8faa6Smrg        n=`expr $n + 1`
951c1e8faa6Smrg      done
952c1e8faa6Smrg    fi
953c1e8faa6Smrg    #
954c1e8faa6Smrg    if $make_ok; then
955c1e8faa6Smrg      # Everything we know to check worked out, so call this resolution good.
956c1e8faa6Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957c1e8faa6Smrg      break # out of $am_try_res loop
958c1e8faa6Smrg    fi
959c1e8faa6Smrg    # Otherwise, we'll go on to check the next resolution.
960c1e8faa6Smrg  fi
961c1e8faa6Smrgdone
962c1e8faa6Smrgrm -f conftest.ts?
963c1e8faa6Smrg# (end _am_filesystem_timestamp_resolution)
964c1e8faa6Smrg])])
965c1e8faa6Smrg
9668650bb69Smrg# AM_SANITY_CHECK
9678650bb69Smrg# ---------------
9688650bb69SmrgAC_DEFUN([AM_SANITY_CHECK],
969c1e8faa6Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970c1e8faa6Smrg# This check should not be cached, as it may vary across builds of
971c1e8faa6Smrg# different projects.
972c1e8faa6SmrgAC_MSG_CHECKING([whether build environment is sane])
9738650bb69Smrg# Reject unsafe characters in $srcdir or the absolute working directory
9748650bb69Smrg# name.  Accept space and tab only in the latter.
9758650bb69Smrgam_lf='
9768650bb69Smrg'
9778650bb69Smrgcase `pwd` in
9788650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9798650bb69Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9808650bb69Smrgesac
9818650bb69Smrgcase $srcdir in
9828650bb69Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9832becc446Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9848650bb69Smrgesac
9858650bb69Smrg
9862becc446Smrg# Do 'set' in a subshell so we don't clobber the current shell's
9878650bb69Smrg# arguments.  Must try -L first in case configure is actually a
9888650bb69Smrg# symlink; some systems play weird games with the mod time of symlinks
9898650bb69Smrg# (eg FreeBSD returns the mod time of the symlink's containing
9908650bb69Smrg# directory).
991c1e8faa6Smrgam_build_env_is_sane=no
992c1e8faa6Smrgam_has_slept=no
993c1e8faa6Smrgrm -f conftest.file
994c1e8faa6Smrgfor am_try in 1 2; do
995c1e8faa6Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996c1e8faa6Smrg  if (
997c1e8faa6Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998c1e8faa6Smrg    if test "$[]*" = "X"; then
999c1e8faa6Smrg      # -L didn't work.
1000c1e8faa6Smrg      set X `ls -t "$srcdir/configure" conftest.file`
1001c1e8faa6Smrg    fi
1002c1e8faa6Smrg    test "$[]2" = conftest.file
1003c1e8faa6Smrg  ); then
1004c1e8faa6Smrg    am_build_env_is_sane=yes
1005c1e8faa6Smrg    break
1006c1e8faa6Smrg  fi
1007c1e8faa6Smrg  # Just in case.
1008c1e8faa6Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009c1e8faa6Smrg  am_has_slept=yes
1010c1e8faa6Smrgdone
1011c1e8faa6Smrg
1012c1e8faa6SmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013c1e8faa6Smrgif test "$am_build_env_is_sane" = no; then
1014c1e8faa6Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
10158650bb69SmrgCheck your system clock])
10168650bb69Smrgfi
1017c1e8faa6Smrg
10182becc446Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10192becc446Smrg# generated files are strictly newer.
10202becc446Smrgam_sleep_pid=
1021c1e8faa6SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022c1e8faa6Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10232becc446Smrg  am_sleep_pid=$!
1024c1e8faa6Smrg])
10252becc446SmrgAC_CONFIG_COMMANDS_PRE(
10262becc446Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10272becc446Smrg   if test -n "$am_sleep_pid"; then
10282becc446Smrg     # Hide warnings about reused PIDs.
10292becc446Smrg     wait $am_sleep_pid 2>/dev/null
10302becc446Smrg   fi
10312becc446Smrg   AC_MSG_RESULT([done])])
10322becc446Smrgrm -f conftest.file
10332becc446Smrg])
10348650bb69Smrg
1035c1e8faa6Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10362c7c4e3dSmrg#
10378650bb69Smrg# This file is free software; the Free Software Foundation
10388650bb69Smrg# gives unlimited permission to copy and/or distribute it,
10398650bb69Smrg# with or without modifications, as long as this notice is preserved.
10408650bb69Smrg
1041c1e8faa6Smrg# _AM_SILENT_RULES
1042c1e8faa6Smrg# ----------------
1043c1e8faa6Smrg# Enable less verbose build rules support.
1044c1e8faa6SmrgAC_DEFUN([_AM_SILENT_RULES],
1045c1e8faa6Smrg[AM_DEFAULT_VERBOSITY=1
1046c1e8faa6SmrgAC_ARG_ENABLE([silent-rules], [dnl
10472becc446SmrgAS_HELP_STRING(
10482becc446Smrg  [--enable-silent-rules],
10492becc446Smrg  [less verbose build output (undo: "make V=1")])
10502becc446SmrgAS_HELP_STRING(
10512becc446Smrg  [--disable-silent-rules],
10522becc446Smrg  [verbose build output (undo: "make V=0")])dnl
10532becc446Smrg])
10542becc446Smrgdnl
10552becc446Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10562becc446Smrgdnl do not support nested variable expansions.
10572becc446Smrgdnl See automake bug#9928 and bug#10237.
10582becc446Smrgam_make=${MAKE-make}
10592becc446SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10602becc446Smrg   [am_cv_make_support_nested_variables],
10612becc446Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10622becc446SmrgBAR0=false
10632becc446SmrgBAR1=true
10642becc446SmrgV=1
10652becc446Smrgam__doit:
10662becc446Smrg	@$(TRUE)
10672becc446Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10682becc446Smrg  am_cv_make_support_nested_variables=yes
10692becc446Smrgelse
10702becc446Smrg  am_cv_make_support_nested_variables=no
10712becc446Smrgfi])
10722becc446SmrgAC_SUBST([AM_V])dnl
10732becc446SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10742becc446SmrgAC_SUBST([AM_DEFAULT_V])dnl
10752becc446SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10768650bb69SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10778650bb69SmrgAM_BACKSLASH='\'
10788650bb69SmrgAC_SUBST([AM_BACKSLASH])dnl
10798650bb69Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080c1e8faa6Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081c1e8faa6Smrgdnl to AM_SILENT_RULES to change the default value.
1082c1e8faa6SmrgAC_CONFIG_COMMANDS_PRE([dnl
1083c1e8faa6Smrgcase $enable_silent_rules in @%:@ (((
1084c1e8faa6Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085c1e8faa6Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086c1e8faa6Smrgesac
1087c1e8faa6Smrgif test $am_cv_make_support_nested_variables = yes; then
1088c1e8faa6Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089c1e8faa6Smrg  AM_V='$(V)'
1090c1e8faa6Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091c1e8faa6Smrgelse
1092c1e8faa6Smrg  AM_V=$AM_DEFAULT_VERBOSITY
1093c1e8faa6Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094c1e8faa6Smrgfi
1095c1e8faa6Smrg])dnl
10968650bb69Smrg])
10978650bb69Smrg
1098c1e8faa6Smrg# AM_SILENT_RULES([DEFAULT])
1099c1e8faa6Smrg# --------------------------
1100c1e8faa6Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101c1e8faa6Smrg# empty being verbose).
1102c1e8faa6SmrgAC_DEFUN([AM_SILENT_RULES],
1103c1e8faa6Smrg[AC_REQUIRE([_AM_SILENT_RULES])
1104c1e8faa6SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105c1e8faa6Smrg
1106c1e8faa6Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11072c7c4e3dSmrg#
11088650bb69Smrg# This file is free software; the Free Software Foundation
11098650bb69Smrg# gives unlimited permission to copy and/or distribute it,
11108650bb69Smrg# with or without modifications, as long as this notice is preserved.
11112c7c4e3dSmrg
11128650bb69Smrg# AM_PROG_INSTALL_STRIP
11138650bb69Smrg# ---------------------
11142becc446Smrg# One issue with vendor 'install' (even GNU) is that you can't
11158650bb69Smrg# specify the program used to strip binaries.  This is especially
11168650bb69Smrg# annoying in cross-compiling environments, where the build's strip
11178650bb69Smrg# is unlikely to handle the host's binaries.
11188650bb69Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11192becc446Smrg# always use install-sh in "make install-strip", and initialize
11208650bb69Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
11218650bb69SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
11228650bb69Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11232becc446Smrg# Installed binaries are usually stripped using 'strip' when the user
11242becc446Smrg# run "make install-strip".  However 'strip' might not be the right
11258650bb69Smrg# tool to use in cross-compilation environments, therefore Automake
11262becc446Smrg# will honor the 'STRIP' environment variable to overrule this program.
11272becc446Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
11288650bb69Smrgif test "$cross_compiling" != no; then
11298650bb69Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
11308650bb69Smrgfi
11318650bb69SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
11328650bb69SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11332c7c4e3dSmrg
1134c1e8faa6Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
11358650bb69Smrg#
11368650bb69Smrg# This file is free software; the Free Software Foundation
11378650bb69Smrg# gives unlimited permission to copy and/or distribute it,
11388650bb69Smrg# with or without modifications, as long as this notice is preserved.
11392c7c4e3dSmrg
11408650bb69Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
11418650bb69Smrg# ---------------------------
11428650bb69Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
11438650bb69Smrg# This macro is traced by Automake.
11448650bb69SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11452c7c4e3dSmrg
11468650bb69Smrg# AM_SUBST_NOTMAKE(VARIABLE)
11472becc446Smrg# --------------------------
11488650bb69Smrg# Public sister of _AM_SUBST_NOTMAKE.
11498650bb69SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11502c7c4e3dSmrg
11518650bb69Smrg# Check how to create a tarball.                            -*- Autoconf -*-
11522c7c4e3dSmrg
1153c1e8faa6Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11548650bb69Smrg#
11558650bb69Smrg# This file is free software; the Free Software Foundation
11568650bb69Smrg# gives unlimited permission to copy and/or distribute it,
11578650bb69Smrg# with or without modifications, as long as this notice is preserved.
11582c7c4e3dSmrg
11598650bb69Smrg# _AM_PROG_TAR(FORMAT)
11608650bb69Smrg# --------------------
11618650bb69Smrg# Check how to create a tarball in format FORMAT.
11622becc446Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11638650bb69Smrg#
11648650bb69Smrg# Substitute a variable $(am__tar) that is a command
11658650bb69Smrg# writing to stdout a FORMAT-tarball containing the directory
11668650bb69Smrg# $tardir.
11678650bb69Smrg#     tardir=directory && $(am__tar) > result.tar
11688650bb69Smrg#
11698650bb69Smrg# Substitute a variable $(am__untar) that extract such
11708650bb69Smrg# a tarball read from stdin.
11718650bb69Smrg#     $(am__untar) < result.tar
11722becc446Smrg#
11738650bb69SmrgAC_DEFUN([_AM_PROG_TAR],
11742becc446Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11752becc446Smrg# in the wild :-(  We should find a proper way to deprecate it ...
11762becc446SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11772becc446Smrg
11782becc446Smrg# We'll loop over all known methods to create a tar archive until one works.
11798650bb69Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
11802c7c4e3dSmrg
11812becc446Smrgm4_if([$1], [v7],
11822becc446Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
11832becc446Smrg
11842becc446Smrg  [m4_case([$1],
11852becc446Smrg    [ustar],
11862becc446Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11872becc446Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11882becc446Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11892becc446Smrg      # and bug#13588).
11902becc446Smrg      am_max_uid=2097151 # 2^21 - 1
11912becc446Smrg      am_max_gid=$am_max_uid
11922becc446Smrg      # The $UID and $GID variables are not portable, so we need to resort
11932becc446Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11942becc446Smrg      # below are definitely unexpected, so allow the users to see them
11952becc446Smrg      # (that is, avoid stderr redirection).
11962becc446Smrg      am_uid=`id -u || echo unknown`
11972becc446Smrg      am_gid=`id -g || echo unknown`
11982becc446Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199c1e8faa6Smrg      if test x$am_uid = xunknown; then
1200c1e8faa6Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201c1e8faa6Smrg      elif test $am_uid -le $am_max_uid; then
1202c1e8faa6Smrg        AC_MSG_RESULT([yes])
12032becc446Smrg      else
1204c1e8faa6Smrg        AC_MSG_RESULT([no])
1205c1e8faa6Smrg        _am_tools=none
12062becc446Smrg      fi
12072becc446Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208c1e8faa6Smrg      if test x$gm_gid = xunknown; then
1209c1e8faa6Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210c1e8faa6Smrg      elif test $am_gid -le $am_max_gid; then
1211c1e8faa6Smrg        AC_MSG_RESULT([yes])
12122becc446Smrg      else
12132becc446Smrg        AC_MSG_RESULT([no])
12142becc446Smrg        _am_tools=none
12152becc446Smrg      fi],
12162becc446Smrg
12172becc446Smrg  [pax],
12182becc446Smrg    [],
12192becc446Smrg
12202becc446Smrg  [m4_fatal([Unknown tar format])])
12212becc446Smrg
12222becc446Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
12232becc446Smrg
12242becc446Smrg  # Go ahead even if we have the value already cached.  We do so because we
12252becc446Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12262becc446Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12272becc446Smrg
12282becc446Smrg  for _am_tool in $_am_tools; do
12292becc446Smrg    case $_am_tool in
12302becc446Smrg    gnutar)
12312becc446Smrg      for _am_tar in tar gnutar gtar; do
12322becc446Smrg        AM_RUN_LOG([$_am_tar --version]) && break
12332becc446Smrg      done
12342becc446Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12352becc446Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12362becc446Smrg      am__untar="$_am_tar -xf -"
12372becc446Smrg      ;;
12382becc446Smrg    plaintar)
12392becc446Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12402becc446Smrg      # ustar tarball either.
12412becc446Smrg      (tar --version) >/dev/null 2>&1 && continue
12422becc446Smrg      am__tar='tar chf - "$$tardir"'
12432becc446Smrg      am__tar_='tar chf - "$tardir"'
12442becc446Smrg      am__untar='tar xf -'
12452becc446Smrg      ;;
12462becc446Smrg    pax)
12472becc446Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
12482becc446Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
12492becc446Smrg      am__untar='pax -r'
12502becc446Smrg      ;;
12512becc446Smrg    cpio)
12522becc446Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12532becc446Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12542becc446Smrg      am__untar='cpio -i -H $1 -d'
12552becc446Smrg      ;;
12562becc446Smrg    none)
12572becc446Smrg      am__tar=false
12582becc446Smrg      am__tar_=false
12592becc446Smrg      am__untar=false
12602becc446Smrg      ;;
12612becc446Smrg    esac
12628650bb69Smrg
12632becc446Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
12642becc446Smrg    # and am__untar set.
12652becc446Smrg    test -n "${am_cv_prog_tar_$1}" && break
12662becc446Smrg
12672becc446Smrg    # tar/untar a dummy directory, and stop if the command works.
12682becc446Smrg    rm -rf conftest.dir
12692becc446Smrg    mkdir conftest.dir
12702becc446Smrg    echo GrepMe > conftest.dir/file
12712becc446Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12722becc446Smrg    rm -rf conftest.dir
12732becc446Smrg    if test -s conftest.tar; then
12742becc446Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
12752becc446Smrg      AM_RUN_LOG([cat conftest.dir/file])
12762becc446Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12772becc446Smrg    fi
12782becc446Smrg  done
12798650bb69Smrg  rm -rf conftest.dir
12802c7c4e3dSmrg
12812becc446Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12822becc446Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
12832becc446Smrg
12848650bb69SmrgAC_SUBST([am__tar])
12858650bb69SmrgAC_SUBST([am__untar])
12868650bb69Smrg]) # _AM_PROG_TAR
12878650bb69Smrg
1288c1e8faa6Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289c1e8faa6Smrg#
1290c1e8faa6Smrg# This file is free software; the Free Software Foundation
1291c1e8faa6Smrg# gives unlimited permission to copy and/or distribute it,
1292c1e8faa6Smrg# with or without modifications, as long as this notice is preserved.
1293c1e8faa6Smrg
1294c1e8faa6Smrg# _AM_PROG_XARGS_N
1295c1e8faa6Smrg# ----------------
1296c1e8faa6Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297c1e8faa6Smrg# is not optimized at all as we never expect to use it.
1298c1e8faa6SmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299c1e8faa6Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300c1e8faa6SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301c1e8faa6Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302c1e8faa6SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303c1e8faa6Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304c1e8faa6Smrg])dnl
1305c1e8faa6SmrgAC_SUBST(am__xargs_n)
1306c1e8faa6Smrg])
1307c1e8faa6Smrg
13083458e6c2Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
13093458e6c2Smrgdnl serial 11 (pkg-config-0.29)
13103458e6c2Smrgdnl
13113458e6c2Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
13123458e6c2Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
13133458e6c2Smrgdnl
13143458e6c2Smrgdnl This program is free software; you can redistribute it and/or modify
13153458e6c2Smrgdnl it under the terms of the GNU General Public License as published by
13163458e6c2Smrgdnl the Free Software Foundation; either version 2 of the License, or
13173458e6c2Smrgdnl (at your option) any later version.
13183458e6c2Smrgdnl
13193458e6c2Smrgdnl This program is distributed in the hope that it will be useful, but
13203458e6c2Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
13213458e6c2Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13223458e6c2Smrgdnl General Public License for more details.
13233458e6c2Smrgdnl
13243458e6c2Smrgdnl You should have received a copy of the GNU General Public License
13253458e6c2Smrgdnl along with this program; if not, write to the Free Software
13263458e6c2Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
13273458e6c2Smrgdnl 02111-1307, USA.
13283458e6c2Smrgdnl
13293458e6c2Smrgdnl As a special exception to the GNU General Public License, if you
13303458e6c2Smrgdnl distribute this file as part of a program that contains a
13313458e6c2Smrgdnl configuration script generated by Autoconf, you may include it under
13323458e6c2Smrgdnl the same distribution terms that you use for the rest of that
13333458e6c2Smrgdnl program.
13343458e6c2Smrg
13353458e6c2Smrgdnl PKG_PREREQ(MIN-VERSION)
13363458e6c2Smrgdnl -----------------------
13373458e6c2Smrgdnl Since: 0.29
13383458e6c2Smrgdnl
13393458e6c2Smrgdnl Verify that the version of the pkg-config macros are at least
13403458e6c2Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
13413458e6c2Smrgdnl installed version of pkg-config, this checks the developer's version
13423458e6c2Smrgdnl of pkg.m4 when generating configure.
13433458e6c2Smrgdnl
13443458e6c2Smrgdnl To ensure that this macro is defined, also add:
13453458e6c2Smrgdnl m4_ifndef([PKG_PREREQ],
13463458e6c2Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
13473458e6c2Smrgdnl
13483458e6c2Smrgdnl See the "Since" comment for each macro you use to see what version
13493458e6c2Smrgdnl of the macros you require.
13503458e6c2Smrgm4_defun([PKG_PREREQ],
13513458e6c2Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
13523458e6c2Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
13533458e6c2Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
13543458e6c2Smrg])dnl PKG_PREREQ
13553458e6c2Smrg
13563458e6c2Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
13573458e6c2Smrgdnl ----------------------------------
13583458e6c2Smrgdnl Since: 0.16
13593458e6c2Smrgdnl
13603458e6c2Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
13613458e6c2Smrgdnl first found in the path. Checks that the version of pkg-config found
13623458e6c2Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
13633458e6c2Smrgdnl used since that's the first version where most current features of
13643458e6c2Smrgdnl pkg-config existed.
136516d7e2f1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
136616d7e2f1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
13673458e6c2Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
13683458e6c2Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
13693458e6c2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
13703458e6c2SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
13713458e6c2SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
13723458e6c2Smrg
137316d7e2f1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
137416d7e2f1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
137516d7e2f1Smrgfi
137616d7e2f1Smrgif test -n "$PKG_CONFIG"; then
137716d7e2f1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
137816d7e2f1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
137916d7e2f1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
138016d7e2f1Smrg		AC_MSG_RESULT([yes])
138116d7e2f1Smrg	else
138216d7e2f1Smrg		AC_MSG_RESULT([no])
138316d7e2f1Smrg		PKG_CONFIG=""
138416d7e2f1Smrg	fi
138516d7e2f1Smrgfi[]dnl
13863458e6c2Smrg])dnl PKG_PROG_PKG_CONFIG
138716d7e2f1Smrg
13883458e6c2Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
13893458e6c2Smrgdnl -------------------------------------------------------------------
13903458e6c2Smrgdnl Since: 0.18
13913458e6c2Smrgdnl
13923458e6c2Smrgdnl Check to see whether a particular set of modules exists. Similar to
13933458e6c2Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
13943458e6c2Smrgdnl
13953458e6c2Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13963458e6c2Smrgdnl only at the first occurence in configure.ac, so if the first place
13973458e6c2Smrgdnl it's called might be skipped (such as if it is within an "if", you
13983458e6c2Smrgdnl have to call PKG_CHECK_EXISTS manually
139916d7e2f1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
140016d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
140116d7e2f1Smrgif test -n "$PKG_CONFIG" && \
140216d7e2f1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
14033458e6c2Smrg  m4_default([$2], [:])
140416d7e2f1Smrgm4_ifvaln([$3], [else
140516d7e2f1Smrg  $3])dnl
140616d7e2f1Smrgfi])
140716d7e2f1Smrg
14083458e6c2Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
14093458e6c2Smrgdnl ---------------------------------------------
14103458e6c2Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
14113458e6c2Smrgdnl pkg_failed based on the result.
141216d7e2f1Smrgm4_define([_PKG_CONFIG],
141316d7e2f1Smrg[if test -n "$$1"; then
141416d7e2f1Smrg    pkg_cv_[]$1="$$1"
141516d7e2f1Smrg elif test -n "$PKG_CONFIG"; then
141616d7e2f1Smrg    PKG_CHECK_EXISTS([$3],
14173458e6c2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
14183458e6c2Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
141916d7e2f1Smrg		     [pkg_failed=yes])
142016d7e2f1Smrg else
142116d7e2f1Smrg    pkg_failed=untried
142216d7e2f1Smrgfi[]dnl
14233458e6c2Smrg])dnl _PKG_CONFIG
142416d7e2f1Smrg
14253458e6c2Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14263458e6c2Smrgdnl ---------------------------
14273458e6c2Smrgdnl Internal check to see if pkg-config supports short errors.
142816d7e2f1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
142916d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
143016d7e2f1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143116d7e2f1Smrg        _pkg_short_errors_supported=yes
143216d7e2f1Smrgelse
143316d7e2f1Smrg        _pkg_short_errors_supported=no
143416d7e2f1Smrgfi[]dnl
14353458e6c2Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
143616d7e2f1Smrg
143716d7e2f1Smrg
14383458e6c2Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
14393458e6c2Smrgdnl   [ACTION-IF-NOT-FOUND])
14403458e6c2Smrgdnl --------------------------------------------------------------
14413458e6c2Smrgdnl Since: 0.4.0
14423458e6c2Smrgdnl
14433458e6c2Smrgdnl Note that if there is a possibility the first call to
14443458e6c2Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
14453458e6c2Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
144616d7e2f1SmrgAC_DEFUN([PKG_CHECK_MODULES],
144716d7e2f1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144816d7e2f1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
144916d7e2f1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
145016d7e2f1Smrg
145116d7e2f1Smrgpkg_failed=no
145216d7e2f1SmrgAC_MSG_CHECKING([for $1])
145316d7e2f1Smrg
145416d7e2f1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
145516d7e2f1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
145616d7e2f1Smrg
145716d7e2f1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145816d7e2f1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
145916d7e2f1SmrgSee the pkg-config man page for more details.])
146016d7e2f1Smrg
146116d7e2f1Smrgif test $pkg_failed = yes; then
14623458e6c2Smrg   	AC_MSG_RESULT([no])
146316d7e2f1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146416d7e2f1Smrg        if test $_pkg_short_errors_supported = yes; then
14653458e6c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
146616d7e2f1Smrg        else 
14673458e6c2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
146816d7e2f1Smrg        fi
146916d7e2f1Smrg	# Put the nasty error message in config.log where it belongs
147016d7e2f1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147116d7e2f1Smrg
14723458e6c2Smrg	m4_default([$4], [AC_MSG_ERROR(
147316d7e2f1Smrg[Package requirements ($2) were not met:
147416d7e2f1Smrg
147516d7e2f1Smrg$$1_PKG_ERRORS
147616d7e2f1Smrg
147716d7e2f1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
147816d7e2f1Smrginstalled software in a non-standard prefix.
147916d7e2f1Smrg
14803458e6c2Smrg_PKG_TEXT])[]dnl
14813458e6c2Smrg        ])
148216d7e2f1Smrgelif test $pkg_failed = untried; then
14833458e6c2Smrg     	AC_MSG_RESULT([no])
14843458e6c2Smrg	m4_default([$4], [AC_MSG_FAILURE(
148516d7e2f1Smrg[The pkg-config script could not be found or is too old.  Make sure it
148616d7e2f1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
148716d7e2f1Smrgpath to pkg-config.
148816d7e2f1Smrg
148916d7e2f1Smrg_PKG_TEXT
149016d7e2f1Smrg
14913458e6c2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
14923458e6c2Smrg        ])
149316d7e2f1Smrgelse
149416d7e2f1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
149516d7e2f1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
149616d7e2f1Smrg        AC_MSG_RESULT([yes])
14973458e6c2Smrg	$3
149816d7e2f1Smrgfi[]dnl
14993458e6c2Smrg])dnl PKG_CHECK_MODULES
15003458e6c2Smrg
15013458e6c2Smrg
15023458e6c2Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15033458e6c2Smrgdnl   [ACTION-IF-NOT-FOUND])
15043458e6c2Smrgdnl ---------------------------------------------------------------------
15053458e6c2Smrgdnl Since: 0.29
15063458e6c2Smrgdnl
15073458e6c2Smrgdnl Checks for existence of MODULES and gathers its build flags with
15083458e6c2Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
15093458e6c2Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
15103458e6c2Smrgdnl
15113458e6c2Smrgdnl Note that if there is a possibility the first call to
15123458e6c2Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
15133458e6c2Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
15143458e6c2Smrgdnl configure.ac.
15153458e6c2SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
15163458e6c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15173458e6c2Smrg_save_PKG_CONFIG=$PKG_CONFIG
15183458e6c2SmrgPKG_CONFIG="$PKG_CONFIG --static"
15193458e6c2SmrgPKG_CHECK_MODULES($@)
15203458e6c2SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
15213458e6c2Smrg])dnl PKG_CHECK_MODULES_STATIC
15223458e6c2Smrg
15233458e6c2Smrg
15243458e6c2Smrgdnl PKG_INSTALLDIR([DIRECTORY])
15253458e6c2Smrgdnl -------------------------
15263458e6c2Smrgdnl Since: 0.27
15273458e6c2Smrgdnl
15283458e6c2Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
15293458e6c2Smrgdnl should install pkg-config .pc files. By default the directory is
15303458e6c2Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
15313458e6c2Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
15323458e6c2Smrgdnl parameter.
15333458e6c2SmrgAC_DEFUN([PKG_INSTALLDIR],
15343458e6c2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
15353458e6c2Smrgm4_pushdef([pkg_description],
15363458e6c2Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
15373458e6c2SmrgAC_ARG_WITH([pkgconfigdir],
15383458e6c2Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
15393458e6c2Smrg    [with_pkgconfigdir=]pkg_default)
15403458e6c2SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
15413458e6c2Smrgm4_popdef([pkg_default])
15423458e6c2Smrgm4_popdef([pkg_description])
15433458e6c2Smrg])dnl PKG_INSTALLDIR
15443458e6c2Smrg
15453458e6c2Smrg
15463458e6c2Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
15473458e6c2Smrgdnl --------------------------------
15483458e6c2Smrgdnl Since: 0.27
15493458e6c2Smrgdnl
15503458e6c2Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
15513458e6c2Smrgdnl module should install arch-independent pkg-config .pc files. By
15523458e6c2Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
15533458e6c2Smrgdnl changed by passing DIRECTORY. The user can override through the
15543458e6c2Smrgdnl --with-noarch-pkgconfigdir parameter.
15553458e6c2SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
15563458e6c2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
15573458e6c2Smrgm4_pushdef([pkg_description],
15583458e6c2Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
15593458e6c2SmrgAC_ARG_WITH([noarch-pkgconfigdir],
15603458e6c2Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
15613458e6c2Smrg    [with_noarch_pkgconfigdir=]pkg_default)
15623458e6c2SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
15633458e6c2Smrgm4_popdef([pkg_default])
15643458e6c2Smrgm4_popdef([pkg_description])
15653458e6c2Smrg])dnl PKG_NOARCH_INSTALLDIR
15663458e6c2Smrg
15673458e6c2Smrg
15683458e6c2Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
15693458e6c2Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
15703458e6c2Smrgdnl -------------------------------------------
15713458e6c2Smrgdnl Since: 0.28
15723458e6c2Smrgdnl
15733458e6c2Smrgdnl Retrieves the value of the pkg-config variable for the given module.
15743458e6c2SmrgAC_DEFUN([PKG_CHECK_VAR],
15753458e6c2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15763458e6c2SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
15773458e6c2Smrg
15783458e6c2Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
15793458e6c2SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
15803458e6c2Smrg
15813458e6c2SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
15823458e6c2Smrg])dnl PKG_CHECK_VAR
158316d7e2f1Smrg
15848650bb69Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15852c7c4e3dSmrgdnl
1586c1e8faa6Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15872becc446Smrgdnl
15888650bb69Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
158916d7e2f1Smrgdnl copy of this software and associated documentation files (the "Software"),
159016d7e2f1Smrgdnl to deal in the Software without restriction, including without limitation
159116d7e2f1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
159216d7e2f1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
159316d7e2f1Smrgdnl Software is furnished to do so, subject to the following conditions:
15948650bb69Smrgdnl
159516d7e2f1Smrgdnl The above copyright notice and this permission notice (including the next
159616d7e2f1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
159716d7e2f1Smrgdnl Software.
15988650bb69Smrgdnl
159916d7e2f1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160016d7e2f1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160116d7e2f1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
160216d7e2f1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
160316d7e2f1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
160416d7e2f1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
160516d7e2f1Smrgdnl DEALINGS IN THE SOFTWARE.
16068650bb69Smrg
16078650bb69Smrg# XORG_MACROS_VERSION(required-version)
16088650bb69Smrg# -------------------------------------
16098650bb69Smrg# Minimum version: 1.1.0
16108650bb69Smrg#
16118650bb69Smrg# If you're using a macro added in Version 1.1 or newer, include this in
16128650bb69Smrg# your configure.ac with the minimum required version, such as:
16138650bb69Smrg# XORG_MACROS_VERSION(1.1)
16148650bb69Smrg#
16158650bb69Smrg# To ensure that this macro is defined, also add:
16168650bb69Smrg# m4_ifndef([XORG_MACROS_VERSION],
16178650bb69Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16188650bb69Smrg#
16198650bb69Smrg#
16202becc446Smrg# See the "minimum version" comment for each macro you use to see what
16218650bb69Smrg# version you require.
16228650bb69Smrgm4_defun([XORG_MACROS_VERSION],[
1623c1e8faa6Smrgm4_define([vers_have], [1.20.1])
16248650bb69Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16258650bb69Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16268650bb69Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16278650bb69Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16288650bb69Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16298650bb69Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16308650bb69Smrgm4_undefine([vers_have])
16318650bb69Smrgm4_undefine([maj_have])
16328650bb69Smrgm4_undefine([maj_needed])
16338650bb69Smrg]) # XORG_MACROS_VERSION
16342c7c4e3dSmrg
16352c7c4e3dSmrg# XORG_PROG_RAWCPP()
16362c7c4e3dSmrg# ------------------
16378650bb69Smrg# Minimum version: 1.0.0
16388650bb69Smrg#
16392c7c4e3dSmrg# Find cpp program and necessary flags for use in pre-processing text files
16402c7c4e3dSmrg# such as man pages and config files
16412c7c4e3dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16422c7c4e3dSmrgAC_REQUIRE([AC_PROG_CPP])
16433458e6c2SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16442c7c4e3dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
16452c7c4e3dSmrg
16462c7c4e3dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16472c7c4e3dSmrg# which is not the best choice for supporting other OS'es, but covers most
16482c7c4e3dSmrg# of the ones we need for now.
16492c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
165016d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16512c7c4e3dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16522c7c4e3dSmrg	AC_MSG_RESULT([no])
16532c7c4e3dSmrgelse
16542c7c4e3dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16552c7c4e3dSmrg		RAWCPPFLAGS=-undef
16562c7c4e3dSmrg		AC_MSG_RESULT([yes])
16578650bb69Smrg	# under Cygwin unix is still defined even with -undef
16588650bb69Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16598650bb69Smrg		RAWCPPFLAGS="-undef -ansi"
16608650bb69Smrg		AC_MSG_RESULT([yes, with -ansi])
16612c7c4e3dSmrg	else
16622c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16632c7c4e3dSmrg	fi
16642c7c4e3dSmrgfi
16652c7c4e3dSmrgrm -f conftest.$ac_ext
16662c7c4e3dSmrg
16672c7c4e3dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
166816d7e2f1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1669c1e8faa6Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16702c7c4e3dSmrg	AC_MSG_RESULT([no])
16712c7c4e3dSmrgelse
1672c1e8faa6Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16732becc446Smrg		TRADITIONALCPPFLAGS="-traditional"
16742c7c4e3dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16752c7c4e3dSmrg		AC_MSG_RESULT([yes])
16762c7c4e3dSmrg	else
16772c7c4e3dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16782c7c4e3dSmrg	fi
16792c7c4e3dSmrgfi
16802c7c4e3dSmrgrm -f conftest.$ac_ext
16812c7c4e3dSmrgAC_SUBST(RAWCPPFLAGS)
16822becc446SmrgAC_SUBST(TRADITIONALCPPFLAGS)
16832c7c4e3dSmrg]) # XORG_PROG_RAWCPP
16842c7c4e3dSmrg
16852c7c4e3dSmrg# XORG_MANPAGE_SECTIONS()
16862c7c4e3dSmrg# -----------------------
16878650bb69Smrg# Minimum version: 1.0.0
16888650bb69Smrg#
16892c7c4e3dSmrg# Determine which sections man pages go in for the different man page types
16902c7c4e3dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16912c7c4e3dSmrg# Not sure if there's any better way than just hardcoding by OS name.
16922c7c4e3dSmrg# Override default settings by setting environment variables
169316d7e2f1Smrg# Added MAN_SUBSTS in version 1.8
169416d7e2f1Smrg# Added AC_PROG_SED in version 1.8
16952c7c4e3dSmrg
16962c7c4e3dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16972c7c4e3dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
169816d7e2f1SmrgAC_REQUIRE([AC_PROG_SED])
16992c7c4e3dSmrg
17003458e6c2Smrgcase $host_os in
17013458e6c2Smrg    solaris*)
17023458e6c2Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
17033458e6c2Smrg        # check for a man page file found in later versions that use
17043458e6c2Smrg        # traditional section numbers instead
17053458e6c2Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
17063458e6c2Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
17073458e6c2Smrg        ;;
17083458e6c2Smrg    *) SYSV_MAN_SECTIONS=false ;;
17093458e6c2Smrgesac
17103458e6c2Smrg
17112c7c4e3dSmrgif test x$APP_MAN_SUFFIX = x    ; then
17128650bb69Smrg    APP_MAN_SUFFIX=1
17132c7c4e3dSmrgfi
17142c7c4e3dSmrgif test x$APP_MAN_DIR = x    ; then
17158650bb69Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17162c7c4e3dSmrgfi
17172c7c4e3dSmrg
17182c7c4e3dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
17198650bb69Smrg    LIB_MAN_SUFFIX=3
17202c7c4e3dSmrgfi
17212c7c4e3dSmrgif test x$LIB_MAN_DIR = x    ; then
17228650bb69Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17232c7c4e3dSmrgfi
17242c7c4e3dSmrg
17252c7c4e3dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
17263458e6c2Smrg    case $SYSV_MAN_SECTIONS in
17273458e6c2Smrg	true)				FILE_MAN_SUFFIX=4  ;;
17283458e6c2Smrg	*)				FILE_MAN_SUFFIX=5  ;;
17292c7c4e3dSmrg    esac
17302c7c4e3dSmrgfi
17312c7c4e3dSmrgif test x$FILE_MAN_DIR = x    ; then
17328650bb69Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
17332c7c4e3dSmrgfi
17342c7c4e3dSmrg
17352c7c4e3dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
17363458e6c2Smrg    case $SYSV_MAN_SECTIONS in
17373458e6c2Smrg	true)				MISC_MAN_SUFFIX=5  ;;
17383458e6c2Smrg	*)				MISC_MAN_SUFFIX=7  ;;
17392c7c4e3dSmrg    esac
17402c7c4e3dSmrgfi
17412c7c4e3dSmrgif test x$MISC_MAN_DIR = x    ; then
17428650bb69Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
17432c7c4e3dSmrgfi
17442c7c4e3dSmrg
17452c7c4e3dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
17463458e6c2Smrg    case $SYSV_MAN_SECTIONS in
17473458e6c2Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
17483458e6c2Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
17492c7c4e3dSmrg    esac
17502c7c4e3dSmrgfi
17512c7c4e3dSmrgif test x$DRIVER_MAN_DIR = x    ; then
17528650bb69Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
17532c7c4e3dSmrgfi
17542c7c4e3dSmrg
17552c7c4e3dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
17563458e6c2Smrg    case $SYSV_MAN_SECTIONS in
17573458e6c2Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
17583458e6c2Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
17592c7c4e3dSmrg    esac
17602c7c4e3dSmrgfi
17612c7c4e3dSmrgif test x$ADMIN_MAN_DIR = x    ; then
17622c7c4e3dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17632c7c4e3dSmrgfi
17642c7c4e3dSmrg
17652c7c4e3dSmrg
17662c7c4e3dSmrgAC_SUBST([APP_MAN_SUFFIX])
17672c7c4e3dSmrgAC_SUBST([LIB_MAN_SUFFIX])
17682c7c4e3dSmrgAC_SUBST([FILE_MAN_SUFFIX])
17692c7c4e3dSmrgAC_SUBST([MISC_MAN_SUFFIX])
17702c7c4e3dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
17712c7c4e3dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
17722c7c4e3dSmrgAC_SUBST([APP_MAN_DIR])
17732c7c4e3dSmrgAC_SUBST([LIB_MAN_DIR])
17742c7c4e3dSmrgAC_SUBST([FILE_MAN_DIR])
17752c7c4e3dSmrgAC_SUBST([MISC_MAN_DIR])
17762c7c4e3dSmrgAC_SUBST([DRIVER_MAN_DIR])
17772c7c4e3dSmrgAC_SUBST([ADMIN_MAN_DIR])
177816d7e2f1Smrg
177916d7e2f1SmrgXORG_MAN_PAGE="X Version 11"
178016d7e2f1SmrgAC_SUBST([XORG_MAN_PAGE])
178116d7e2f1SmrgMAN_SUBSTS="\
178216d7e2f1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
178316d7e2f1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
178416d7e2f1Smrg	-e 's|__xservername__|Xorg|g' \
178516d7e2f1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
178616d7e2f1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
178716d7e2f1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
178816d7e2f1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
178916d7e2f1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
179016d7e2f1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
179116d7e2f1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
179216d7e2f1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
179316d7e2f1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
179416d7e2f1SmrgAC_SUBST([MAN_SUBSTS])
179516d7e2f1Smrg
17962c7c4e3dSmrg]) # XORG_MANPAGE_SECTIONS
17972c7c4e3dSmrg
179816d7e2f1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
179916d7e2f1Smrg# ------------------------
180016d7e2f1Smrg# Minimum version: 1.7.0
180116d7e2f1Smrg#
180216d7e2f1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
180316d7e2f1Smrg# provided by xorg-sgml-doctools, if installed.
180416d7e2f1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
180516d7e2f1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
180616d7e2f1SmrgXORG_SGML_PATH=
180716d7e2f1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
180816d7e2f1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
180916d7e2f1Smrg    [m4_ifval([$1],[:],
181016d7e2f1Smrg        [if test x"$cross_compiling" != x"yes" ; then
181116d7e2f1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
181216d7e2f1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
181316d7e2f1Smrg         fi])
181416d7e2f1Smrg    ])
181516d7e2f1Smrg
181616d7e2f1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
181716d7e2f1Smrg# the path and the name of the doc stylesheet
181816d7e2f1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
181916d7e2f1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
182016d7e2f1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
182116d7e2f1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
182216d7e2f1Smrgelse
182316d7e2f1Smrg   AC_MSG_RESULT([no])
182416d7e2f1Smrgfi
182516d7e2f1Smrg
182616d7e2f1SmrgAC_SUBST(XORG_SGML_PATH)
182716d7e2f1SmrgAC_SUBST(STYLESHEET_SRCDIR)
182816d7e2f1SmrgAC_SUBST(XSL_STYLESHEET)
182916d7e2f1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
183016d7e2f1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
183116d7e2f1Smrg
18322c7c4e3dSmrg# XORG_CHECK_LINUXDOC
18332c7c4e3dSmrg# -------------------
18348650bb69Smrg# Minimum version: 1.0.0
18358650bb69Smrg#
18362c7c4e3dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
18372c7c4e3dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
18382c7c4e3dSmrg# Whether or not the necessary tools and files are found can be checked
18392c7c4e3dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
18402c7c4e3dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
184116d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
184216d7e2f1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
18432c7c4e3dSmrg
18442c7c4e3dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
18452c7c4e3dSmrg
184616d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
18472c7c4e3dSmrg
184816d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
18492c7c4e3dSmrg   BUILDDOC=yes
18502c7c4e3dSmrgelse
18512c7c4e3dSmrg   BUILDDOC=no
18522c7c4e3dSmrgfi
18532c7c4e3dSmrg
18542c7c4e3dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
18552c7c4e3dSmrg
18562c7c4e3dSmrgAC_MSG_RESULT([$BUILDDOC])
18572c7c4e3dSmrg
185816d7e2f1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
18592c7c4e3dSmrg
186016d7e2f1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
18612c7c4e3dSmrg   BUILDPDFDOC=yes
18622c7c4e3dSmrgelse
18632c7c4e3dSmrg   BUILDPDFDOC=no
18642c7c4e3dSmrgfi
18652c7c4e3dSmrg
18662c7c4e3dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18672c7c4e3dSmrg
18682c7c4e3dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
18692c7c4e3dSmrg
187016d7e2f1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
18718650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
18722c7c4e3dSmrgMAKE_PDF="$PS2PDF"
18738650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
18742c7c4e3dSmrg
18752c7c4e3dSmrgAC_SUBST(MAKE_TEXT)
18762c7c4e3dSmrgAC_SUBST(MAKE_PS)
18772c7c4e3dSmrgAC_SUBST(MAKE_PDF)
18782c7c4e3dSmrgAC_SUBST(MAKE_HTML)
18792c7c4e3dSmrg]) # XORG_CHECK_LINUXDOC
18802c7c4e3dSmrg
18818650bb69Smrg# XORG_CHECK_DOCBOOK
18828650bb69Smrg# -------------------
18838650bb69Smrg# Minimum version: 1.0.0
18848650bb69Smrg#
18858650bb69Smrg# Checks for the ability to build output formats from SGML DocBook source.
18868650bb69Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
18878650bb69Smrg# indicates whether the necessary tools and files are found and, if set,
18888650bb69Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
18898650bb69SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
189016d7e2f1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
189116d7e2f1Smrg
18928650bb69SmrgBUILDTXTDOC=no
18938650bb69SmrgBUILDPDFDOC=no
18948650bb69SmrgBUILDPSDOC=no
18958650bb69SmrgBUILDHTMLDOC=no
18968650bb69Smrg
18978650bb69SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
18988650bb69SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
18998650bb69SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
19008650bb69SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19018650bb69Smrg
190216d7e2f1SmrgAC_MSG_CHECKING([whether to build text documentation])
190316d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
19048650bb69Smrg   test x$BUILD_TXTDOC != xno; then
19058650bb69Smrg	BUILDTXTDOC=yes
19068650bb69Smrgfi
19078650bb69SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
19088650bb69SmrgAC_MSG_RESULT([$BUILDTXTDOC])
19098650bb69Smrg
191016d7e2f1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
191116d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
19128650bb69Smrg   test x$BUILD_PDFDOC != xno; then
19138650bb69Smrg	BUILDPDFDOC=yes
19148650bb69Smrgfi
19158650bb69SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
19168650bb69SmrgAC_MSG_RESULT([$BUILDPDFDOC])
19178650bb69Smrg
191816d7e2f1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
191916d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
19208650bb69Smrg   test x$BUILD_PSDOC != xno; then
19218650bb69Smrg	BUILDPSDOC=yes
19228650bb69Smrgfi
19238650bb69SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
19248650bb69SmrgAC_MSG_RESULT([$BUILDPSDOC])
19258650bb69Smrg
192616d7e2f1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
192716d7e2f1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
19288650bb69Smrg   test x$BUILD_HTMLDOC != xno; then
19298650bb69Smrg	BUILDHTMLDOC=yes
19308650bb69Smrgfi
19318650bb69SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
19328650bb69SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
19338650bb69Smrg
19348650bb69SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
19358650bb69SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
19368650bb69SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
19378650bb69SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19388650bb69Smrg
19398650bb69SmrgAC_SUBST(MAKE_TEXT)
19408650bb69SmrgAC_SUBST(MAKE_PS)
19418650bb69SmrgAC_SUBST(MAKE_PDF)
19428650bb69SmrgAC_SUBST(MAKE_HTML)
19438650bb69Smrg]) # XORG_CHECK_DOCBOOK
19448650bb69Smrg
194516d7e2f1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
194616d7e2f1Smrg# ----------------
194716d7e2f1Smrg# Minimum version: 1.5.0
194816d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19498650bb69Smrg#
195016d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
195116d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
195216d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1953c1e8faa6Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
195416d7e2f1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
195516d7e2f1Smrg# --with-xmlto assumes 'auto'.
195616d7e2f1Smrg#
195716d7e2f1Smrg# Interface to module:
195816d7e2f1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
195916d7e2f1Smrg# XMLTO:	returns the path of the xmlto program found
196016d7e2f1Smrg#		returns the path set by the user in the environment
196116d7e2f1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
196216d7e2f1Smrg#		'no' user instructs the module not to use xmlto
196316d7e2f1Smrg#
196416d7e2f1Smrg# Added in version 1.10.0
196516d7e2f1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
196616d7e2f1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
196716d7e2f1Smrg#
196816d7e2f1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
196916d7e2f1Smrg#
197016d7e2f1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
197116d7e2f1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
197216d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
197316d7e2f1SmrgAC_ARG_WITH(xmlto,
197416d7e2f1Smrg	AS_HELP_STRING([--with-xmlto],
197516d7e2f1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
197616d7e2f1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
197716d7e2f1Smrgm4_undefine([_defopt])
197816d7e2f1Smrg
197916d7e2f1Smrgif test "x$use_xmlto" = x"auto"; then
198016d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
198116d7e2f1Smrg   if test "x$XMLTO" = "x"; then
198216d7e2f1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
198316d7e2f1Smrg	have_xmlto=no
198416d7e2f1Smrg   else
198516d7e2f1Smrg        have_xmlto=yes
198616d7e2f1Smrg   fi
198716d7e2f1Smrgelif test "x$use_xmlto" = x"yes" ; then
198816d7e2f1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
198916d7e2f1Smrg   if test "x$XMLTO" = "x"; then
199016d7e2f1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
199116d7e2f1Smrg   fi
199216d7e2f1Smrg   have_xmlto=yes
199316d7e2f1Smrgelif test "x$use_xmlto" = x"no" ; then
199416d7e2f1Smrg   if test "x$XMLTO" != "x"; then
199516d7e2f1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
199616d7e2f1Smrg   fi
199716d7e2f1Smrg   have_xmlto=no
199816d7e2f1Smrgelse
199916d7e2f1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20002c7c4e3dSmrgfi
20012c7c4e3dSmrg
200216d7e2f1Smrg# Test for a minimum version of xmlto, if provided.
200316d7e2f1Smrgm4_ifval([$1],
200416d7e2f1Smrg[if test "$have_xmlto" = yes; then
200516d7e2f1Smrg    # scrape the xmlto version
200616d7e2f1Smrg    AC_MSG_CHECKING([the xmlto version])
200716d7e2f1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
200816d7e2f1Smrg    AC_MSG_RESULT([$xmlto_version])
200916d7e2f1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
201016d7e2f1Smrg        [if test "x$use_xmlto" = xauto; then
201116d7e2f1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
201216d7e2f1Smrg            have_xmlto=no
201316d7e2f1Smrg        else
201416d7e2f1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
201516d7e2f1Smrg        fi])
201616d7e2f1Smrgfi])
201716d7e2f1Smrg
201816d7e2f1Smrg# Test for the ability of xmlto to generate a text target
20193458e6c2Smrg#
20203458e6c2Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
20213458e6c2Smrg# following test for empty XML docbook files.
20223458e6c2Smrg# For compatibility reasons use the following empty XML docbook file and if
20233458e6c2Smrg# it fails try it again with a non-empty XML file.
202416d7e2f1Smrghave_xmlto_text=no
202516d7e2f1Smrgcat > conftest.xml << "EOF"
202616d7e2f1SmrgEOF
202716d7e2f1SmrgAS_IF([test "$have_xmlto" = yes],
202816d7e2f1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
202916d7e2f1Smrg             [have_xmlto_text=yes],
20303458e6c2Smrg             [# Try it again with a non-empty XML file.
20313458e6c2Smrg              cat > conftest.xml << "EOF"
20323458e6c2Smrg<x></x>
20333458e6c2SmrgEOF
20343458e6c2Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20353458e6c2Smrg                    [have_xmlto_text=yes],
20363458e6c2Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
203716d7e2f1Smrgrm -f conftest.xml
203816d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
203916d7e2f1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
204016d7e2f1Smrg]) # XORG_WITH_XMLTO
204116d7e2f1Smrg
204216d7e2f1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
204316d7e2f1Smrg# --------------------------------------------
204416d7e2f1Smrg# Minimum version: 1.12.0
204516d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
204616d7e2f1Smrg#
204716d7e2f1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
204816d7e2f1Smrg# XML-based language used for the transformation of XML documents.
204916d7e2f1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
205016d7e2f1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
205116d7e2f1Smrg# The XSLT processor is often used as a standalone tool for transformations.
205216d7e2f1Smrg# It should not be assumed that this tool is used only to work with documnetation.
205316d7e2f1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
205416d7e2f1Smrg#
205516d7e2f1Smrg# Interface to module:
205616d7e2f1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
205716d7e2f1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
205816d7e2f1Smrg#		 returns the path set by the user in the environment
205916d7e2f1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
206016d7e2f1Smrg#		  'no' user instructs the module not to use xsltproc
206116d7e2f1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
206216d7e2f1Smrg#
206316d7e2f1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
206416d7e2f1Smrg#
206516d7e2f1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
206616d7e2f1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
206716d7e2f1Smrg# Preserves the interface, should it be implemented later
206816d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
206916d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
207016d7e2f1SmrgAC_ARG_WITH(xsltproc,
207116d7e2f1Smrg	AS_HELP_STRING([--with-xsltproc],
207216d7e2f1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
207316d7e2f1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
207416d7e2f1Smrgm4_undefine([_defopt])
207516d7e2f1Smrg
207616d7e2f1Smrgif test "x$use_xsltproc" = x"auto"; then
207716d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
207816d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
207916d7e2f1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
208016d7e2f1Smrg	have_xsltproc=no
208116d7e2f1Smrg   else
208216d7e2f1Smrg        have_xsltproc=yes
208316d7e2f1Smrg   fi
208416d7e2f1Smrgelif test "x$use_xsltproc" = x"yes" ; then
208516d7e2f1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
208616d7e2f1Smrg   if test "x$XSLTPROC" = "x"; then
208716d7e2f1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
208816d7e2f1Smrg   fi
208916d7e2f1Smrg   have_xsltproc=yes
209016d7e2f1Smrgelif test "x$use_xsltproc" = x"no" ; then
209116d7e2f1Smrg   if test "x$XSLTPROC" != "x"; then
209216d7e2f1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
209316d7e2f1Smrg   fi
209416d7e2f1Smrg   have_xsltproc=no
20952c7c4e3dSmrgelse
209616d7e2f1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
20972c7c4e3dSmrgfi
20982c7c4e3dSmrg
209916d7e2f1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
210016d7e2f1Smrg]) # XORG_WITH_XSLTPROC
21012c7c4e3dSmrg
210216d7e2f1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
210316d7e2f1Smrg# ----------------------------------------
210416d7e2f1Smrg# Minimum version: 1.15.0
21058650bb69Smrg#
210616d7e2f1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
210716d7e2f1Smrg# scanning arbitrary text files, extracting information from those text files,
210816d7e2f1Smrg# and printing reports based on that information.
21098650bb69Smrg#
211016d7e2f1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
211116d7e2f1Smrg#
211216d7e2f1Smrg# Interface to module:
211316d7e2f1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
211416d7e2f1Smrg# PERL:	     returns the path of the perl program found
211516d7e2f1Smrg#	     returns the path set by the user in the environment
211616d7e2f1Smrg# --with-perl: 'yes' user instructs the module to use perl
211716d7e2f1Smrg#	       'no' user instructs the module not to use perl
211816d7e2f1Smrg# have_perl: returns yes if perl found in PATH or no
211916d7e2f1Smrg#
212016d7e2f1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
212116d7e2f1Smrg#
212216d7e2f1SmrgAC_DEFUN([XORG_WITH_PERL],[
212316d7e2f1SmrgAC_ARG_VAR([PERL], [Path to perl command])
212416d7e2f1Smrg# Preserves the interface, should it be implemented later
212516d7e2f1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
212616d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
212716d7e2f1SmrgAC_ARG_WITH(perl,
212816d7e2f1Smrg	AS_HELP_STRING([--with-perl],
212916d7e2f1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
213016d7e2f1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
213116d7e2f1Smrgm4_undefine([_defopt])
213216d7e2f1Smrg
213316d7e2f1Smrgif test "x$use_perl" = x"auto"; then
213416d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
213516d7e2f1Smrg   if test "x$PERL" = "x"; then
213616d7e2f1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
213716d7e2f1Smrg	have_perl=no
213816d7e2f1Smrg   else
213916d7e2f1Smrg        have_perl=yes
214016d7e2f1Smrg   fi
214116d7e2f1Smrgelif test "x$use_perl" = x"yes" ; then
214216d7e2f1Smrg   AC_PATH_PROG([PERL], [perl])
214316d7e2f1Smrg   if test "x$PERL" = "x"; then
214416d7e2f1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
214516d7e2f1Smrg   fi
214616d7e2f1Smrg   have_perl=yes
214716d7e2f1Smrgelif test "x$use_perl" = x"no" ; then
214816d7e2f1Smrg   if test "x$PERL" != "x"; then
214916d7e2f1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
215016d7e2f1Smrg   fi
215116d7e2f1Smrg   have_perl=no
21528650bb69Smrgelse
215316d7e2f1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21548650bb69Smrgfi
21558650bb69Smrg
215616d7e2f1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
215716d7e2f1Smrg]) # XORG_WITH_PERL
21588650bb69Smrg
215916d7e2f1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
216016d7e2f1Smrg# ----------------
216116d7e2f1Smrg# Minimum version: 1.5.0
216216d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21638650bb69Smrg#
216416d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
216516d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
216616d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2167c1e8faa6Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
216816d7e2f1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
216916d7e2f1Smrg# --with-asciidoc assumes 'auto'.
21708650bb69Smrg#
217116d7e2f1Smrg# Interface to module:
217216d7e2f1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
217316d7e2f1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
217416d7e2f1Smrg#		 returns the path set by the user in the environment
217516d7e2f1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
217616d7e2f1Smrg#		  'no' user instructs the module not to use asciidoc
217716d7e2f1Smrg#
217816d7e2f1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
217916d7e2f1Smrg#
218016d7e2f1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
218116d7e2f1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
218216d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
218316d7e2f1SmrgAC_ARG_WITH(asciidoc,
218416d7e2f1Smrg	AS_HELP_STRING([--with-asciidoc],
218516d7e2f1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
218616d7e2f1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
218716d7e2f1Smrgm4_undefine([_defopt])
218816d7e2f1Smrg
218916d7e2f1Smrgif test "x$use_asciidoc" = x"auto"; then
219016d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
219116d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
219216d7e2f1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
219316d7e2f1Smrg	have_asciidoc=no
219416d7e2f1Smrg   else
219516d7e2f1Smrg        have_asciidoc=yes
219616d7e2f1Smrg   fi
219716d7e2f1Smrgelif test "x$use_asciidoc" = x"yes" ; then
219816d7e2f1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
219916d7e2f1Smrg   if test "x$ASCIIDOC" = "x"; then
220016d7e2f1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
220116d7e2f1Smrg   fi
220216d7e2f1Smrg   have_asciidoc=yes
220316d7e2f1Smrgelif test "x$use_asciidoc" = x"no" ; then
220416d7e2f1Smrg   if test "x$ASCIIDOC" != "x"; then
220516d7e2f1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
220616d7e2f1Smrg   fi
220716d7e2f1Smrg   have_asciidoc=no
220816d7e2f1Smrgelse
220916d7e2f1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
221016d7e2f1Smrgfi
221116d7e2f1Smrgm4_ifval([$1],
221216d7e2f1Smrg[if test "$have_asciidoc" = yes; then
221316d7e2f1Smrg    # scrape the asciidoc version
221416d7e2f1Smrg    AC_MSG_CHECKING([the asciidoc version])
221516d7e2f1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
221616d7e2f1Smrg    AC_MSG_RESULT([$asciidoc_version])
221716d7e2f1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
221816d7e2f1Smrg        [if test "x$use_asciidoc" = xauto; then
221916d7e2f1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
222016d7e2f1Smrg            have_asciidoc=no
222116d7e2f1Smrg        else
222216d7e2f1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
222316d7e2f1Smrg        fi])
222416d7e2f1Smrgfi])
222516d7e2f1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
222616d7e2f1Smrg]) # XORG_WITH_ASCIIDOC
222716d7e2f1Smrg
222816d7e2f1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22292becc446Smrg# -------------------------------------------
223016d7e2f1Smrg# Minimum version: 1.5.0
223116d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22322becc446Smrg# Minimum version for optional DOT checking: 1.18.0
223316d7e2f1Smrg#
223416d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
223516d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
223616d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2237c1e8faa6Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
223816d7e2f1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
223916d7e2f1Smrg# --with-doxygen assumes 'auto'.
224016d7e2f1Smrg#
224116d7e2f1Smrg# Interface to module:
224216d7e2f1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
224316d7e2f1Smrg# DOXYGEN:	 returns the path of the doxygen program found
224416d7e2f1Smrg#		 returns the path set by the user in the environment
224516d7e2f1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
224616d7e2f1Smrg#		  'no' user instructs the module not to use doxygen
224716d7e2f1Smrg#
224816d7e2f1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
224916d7e2f1Smrg#
225016d7e2f1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
225116d7e2f1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22522becc446SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
225316d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
225416d7e2f1SmrgAC_ARG_WITH(doxygen,
225516d7e2f1Smrg	AS_HELP_STRING([--with-doxygen],
225616d7e2f1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
225716d7e2f1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
225816d7e2f1Smrgm4_undefine([_defopt])
225916d7e2f1Smrg
226016d7e2f1Smrgif test "x$use_doxygen" = x"auto"; then
226116d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
226216d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
226316d7e2f1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
226416d7e2f1Smrg	have_doxygen=no
226516d7e2f1Smrg   else
226616d7e2f1Smrg        have_doxygen=yes
226716d7e2f1Smrg   fi
226816d7e2f1Smrgelif test "x$use_doxygen" = x"yes" ; then
226916d7e2f1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
227016d7e2f1Smrg   if test "x$DOXYGEN" = "x"; then
227116d7e2f1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
227216d7e2f1Smrg   fi
227316d7e2f1Smrg   have_doxygen=yes
227416d7e2f1Smrgelif test "x$use_doxygen" = x"no" ; then
227516d7e2f1Smrg   if test "x$DOXYGEN" != "x"; then
227616d7e2f1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
227716d7e2f1Smrg   fi
227816d7e2f1Smrg   have_doxygen=no
227916d7e2f1Smrgelse
228016d7e2f1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
228116d7e2f1Smrgfi
228216d7e2f1Smrgm4_ifval([$1],
228316d7e2f1Smrg[if test "$have_doxygen" = yes; then
228416d7e2f1Smrg    # scrape the doxygen version
228516d7e2f1Smrg    AC_MSG_CHECKING([the doxygen version])
228616d7e2f1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
228716d7e2f1Smrg    AC_MSG_RESULT([$doxygen_version])
228816d7e2f1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
228916d7e2f1Smrg        [if test "x$use_doxygen" = xauto; then
229016d7e2f1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
229116d7e2f1Smrg            have_doxygen=no
229216d7e2f1Smrg        else
229316d7e2f1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
229416d7e2f1Smrg        fi])
229516d7e2f1Smrgfi])
22962becc446Smrg
22972becc446Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22982becc446Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22992becc446Smrgdnl 	HAVE_DOT = @HAVE_DOT@
23002becc446SmrgHAVE_DOT=no
23012becc446Smrgif test "x$have_doxygen" = "xyes"; then
23022becc446Smrg  AC_PATH_PROG([DOT], [dot])
23032becc446Smrg    if test "x$DOT" != "x"; then
23042becc446Smrg      HAVE_DOT=yes
23052becc446Smrg    fi
23062becc446Smrgfi
23072becc446Smrg
23082becc446SmrgAC_SUBST([HAVE_DOT])
23092becc446SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
231016d7e2f1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
231116d7e2f1Smrg]) # XORG_WITH_DOXYGEN
231216d7e2f1Smrg
231316d7e2f1Smrg# XORG_WITH_GROFF([DEFAULT])
231416d7e2f1Smrg# ----------------
231516d7e2f1Smrg# Minimum version: 1.6.0
231616d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
231716d7e2f1Smrg#
231816d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
231916d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
232016d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2321c1e8faa6Smrg# the --with-groff option, it allows maximum flexibility in making decisions
232216d7e2f1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
232316d7e2f1Smrg# --with-groff assumes 'auto'.
232416d7e2f1Smrg#
232516d7e2f1Smrg# Interface to module:
232616d7e2f1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
232716d7e2f1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
232816d7e2f1Smrg# HAVE_GROFF_MS: the -ms macros package
232916d7e2f1Smrg# GROFF:	 returns the path of the groff program found
233016d7e2f1Smrg#		 returns the path set by the user in the environment
233116d7e2f1Smrg# --with-groff:	 'yes' user instructs the module to use groff
233216d7e2f1Smrg#		 'no' user instructs the module not to use groff
233316d7e2f1Smrg#
233416d7e2f1Smrg# Added in version 1.9.0:
233516d7e2f1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
233616d7e2f1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
233716d7e2f1Smrg#		   psselect from the psutils package.
233816d7e2f1Smrg#		   the ghostcript package. Refer to the grohtml man pages
233916d7e2f1Smrg#
234016d7e2f1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
234116d7e2f1Smrg#
234216d7e2f1Smrg# OS and distros often splits groff in a basic and full package, the former
234316d7e2f1Smrg# having the groff program and the later having devices, fonts and macros
234416d7e2f1Smrg# Checking for the groff executable is not enough.
234516d7e2f1Smrg#
234616d7e2f1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
234716d7e2f1Smrg# unset HAVE_GROFF or GROFF env variables.
234816d7e2f1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
234916d7e2f1Smrg#
235016d7e2f1SmrgAC_DEFUN([XORG_WITH_GROFF],[
235116d7e2f1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
235216d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
235316d7e2f1SmrgAC_ARG_WITH(groff,
235416d7e2f1Smrg	AS_HELP_STRING([--with-groff],
235516d7e2f1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
235616d7e2f1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
235716d7e2f1Smrgm4_undefine([_defopt])
235816d7e2f1Smrg
235916d7e2f1Smrgif test "x$use_groff" = x"auto"; then
236016d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
236116d7e2f1Smrg   if test "x$GROFF" = "x"; then
236216d7e2f1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
236316d7e2f1Smrg	have_groff=no
236416d7e2f1Smrg   else
236516d7e2f1Smrg        have_groff=yes
236616d7e2f1Smrg   fi
236716d7e2f1Smrgelif test "x$use_groff" = x"yes" ; then
236816d7e2f1Smrg   AC_PATH_PROG([GROFF], [groff])
236916d7e2f1Smrg   if test "x$GROFF" = "x"; then
237016d7e2f1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
237116d7e2f1Smrg   fi
237216d7e2f1Smrg   have_groff=yes
237316d7e2f1Smrgelif test "x$use_groff" = x"no" ; then
237416d7e2f1Smrg   if test "x$GROFF" != "x"; then
237516d7e2f1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
237616d7e2f1Smrg   fi
237716d7e2f1Smrg   have_groff=no
237816d7e2f1Smrgelse
237916d7e2f1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
238016d7e2f1Smrgfi
238116d7e2f1Smrg
238216d7e2f1Smrg# We have groff, test for the presence of the macro packages
238316d7e2f1Smrgif test "x$have_groff" = x"yes"; then
238416d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
238516d7e2f1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
238616d7e2f1Smrg        groff_ms_works=yes
238716d7e2f1Smrg    else
238816d7e2f1Smrg        groff_ms_works=no
238916d7e2f1Smrg    fi
239016d7e2f1Smrg    AC_MSG_RESULT([$groff_ms_works])
239116d7e2f1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
239216d7e2f1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
239316d7e2f1Smrg        groff_mm_works=yes
239416d7e2f1Smrg    else
239516d7e2f1Smrg        groff_mm_works=no
239616d7e2f1Smrg    fi
239716d7e2f1Smrg    AC_MSG_RESULT([$groff_mm_works])
239816d7e2f1Smrgfi
239916d7e2f1Smrg
240016d7e2f1Smrg# We have groff, test for HTML dependencies, one command per package
240116d7e2f1Smrgif test "x$have_groff" = x"yes"; then
240216d7e2f1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
240316d7e2f1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
240416d7e2f1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
240516d7e2f1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
240616d7e2f1Smrg      have_groff_html=yes
240716d7e2f1Smrg   else
240816d7e2f1Smrg      have_groff_html=no
240916d7e2f1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
241016d7e2f1Smrg   fi
241116d7e2f1Smrgfi
241216d7e2f1Smrg
241316d7e2f1Smrg# Set Automake conditionals for Makefiles
241416d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
241516d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
241616d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
241716d7e2f1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
241816d7e2f1Smrg]) # XORG_WITH_GROFF
241916d7e2f1Smrg
242016d7e2f1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
242116d7e2f1Smrg# ---------------------------------------
242216d7e2f1Smrg# Minimum version: 1.6.0
242316d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
242416d7e2f1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
242516d7e2f1Smrg#
242616d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
242716d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
242816d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2429c1e8faa6Smrg# the --with-fop option, it allows maximum flexibility in making decisions
243016d7e2f1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
243116d7e2f1Smrg# --with-fop assumes 'auto'.
243216d7e2f1Smrg#
243316d7e2f1Smrg# Interface to module:
243416d7e2f1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
243516d7e2f1Smrg# FOP:	 	returns the path of the fop program found
243616d7e2f1Smrg#		returns the path set by the user in the environment
243716d7e2f1Smrg# --with-fop: 	'yes' user instructs the module to use fop
243816d7e2f1Smrg#		'no' user instructs the module not to use fop
243916d7e2f1Smrg#
244016d7e2f1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
244116d7e2f1Smrg#
244216d7e2f1SmrgAC_DEFUN([XORG_WITH_FOP],[
244316d7e2f1SmrgAC_ARG_VAR([FOP], [Path to fop command])
244416d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
244516d7e2f1SmrgAC_ARG_WITH(fop,
244616d7e2f1Smrg	AS_HELP_STRING([--with-fop],
244716d7e2f1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
244816d7e2f1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
244916d7e2f1Smrgm4_undefine([_defopt])
245016d7e2f1Smrg
245116d7e2f1Smrgif test "x$use_fop" = x"auto"; then
245216d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
245316d7e2f1Smrg   if test "x$FOP" = "x"; then
245416d7e2f1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
245516d7e2f1Smrg	have_fop=no
245616d7e2f1Smrg   else
245716d7e2f1Smrg        have_fop=yes
245816d7e2f1Smrg   fi
245916d7e2f1Smrgelif test "x$use_fop" = x"yes" ; then
246016d7e2f1Smrg   AC_PATH_PROG([FOP], [fop])
246116d7e2f1Smrg   if test "x$FOP" = "x"; then
246216d7e2f1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
246316d7e2f1Smrg   fi
246416d7e2f1Smrg   have_fop=yes
246516d7e2f1Smrgelif test "x$use_fop" = x"no" ; then
246616d7e2f1Smrg   if test "x$FOP" != "x"; then
246716d7e2f1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
246816d7e2f1Smrg   fi
246916d7e2f1Smrg   have_fop=no
247016d7e2f1Smrgelse
247116d7e2f1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
247216d7e2f1Smrgfi
247316d7e2f1Smrg
247416d7e2f1Smrg# Test for a minimum version of fop, if provided.
247516d7e2f1Smrgm4_ifval([$1],
247616d7e2f1Smrg[if test "$have_fop" = yes; then
247716d7e2f1Smrg    # scrape the fop version
247816d7e2f1Smrg    AC_MSG_CHECKING([for fop minimum version])
247916d7e2f1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
248016d7e2f1Smrg    AC_MSG_RESULT([$fop_version])
248116d7e2f1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
248216d7e2f1Smrg        [if test "x$use_fop" = xauto; then
248316d7e2f1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
248416d7e2f1Smrg            have_fop=no
248516d7e2f1Smrg        else
248616d7e2f1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
248716d7e2f1Smrg        fi])
248816d7e2f1Smrgfi])
248916d7e2f1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
249016d7e2f1Smrg]) # XORG_WITH_FOP
249116d7e2f1Smrg
24922becc446Smrg# XORG_WITH_M4([MIN-VERSION])
24932becc446Smrg# ---------------------------
24942becc446Smrg# Minimum version: 1.19.0
24952becc446Smrg#
24962becc446Smrg# This macro attempts to locate an m4 macro processor which supports
24972becc446Smrg# -I option and is only useful for modules relying on M4 in order to
24982becc446Smrg# expand macros in source code files.
24992becc446Smrg#
25002becc446Smrg# Interface to module:
25012becc446Smrg# M4:	 	returns the path of the m4 program found
25022becc446Smrg#		returns the path set by the user in the environment
25032becc446Smrg#
25042becc446SmrgAC_DEFUN([XORG_WITH_M4], [
25052becc446SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25062becc446Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25072becc446Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25082becc446Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25092becc446Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25102becc446Smrg   [$PATH:/usr/gnu/bin])])
25112becc446Smrg
25122becc446SmrgAC_SUBST([M4], [$ac_cv_path_M4])
25132becc446Smrg]) # XORG_WITH_M4
25142becc446Smrg
251516d7e2f1Smrg# XORG_WITH_PS2PDF([DEFAULT])
251616d7e2f1Smrg# ----------------
251716d7e2f1Smrg# Minimum version: 1.6.0
251816d7e2f1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
251916d7e2f1Smrg#
252016d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
252116d7e2f1Smrg# not at the appropriate level. This macro enables a module to test for the
252216d7e2f1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2523c1e8faa6Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
252416d7e2f1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
252516d7e2f1Smrg# --with-ps2pdf assumes 'auto'.
252616d7e2f1Smrg#
252716d7e2f1Smrg# Interface to module:
252816d7e2f1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
252916d7e2f1Smrg# PS2PDF:	returns the path of the ps2pdf program found
253016d7e2f1Smrg#		returns the path set by the user in the environment
253116d7e2f1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
253216d7e2f1Smrg#		 'no' user instructs the module not to use ps2pdf
253316d7e2f1Smrg#
253416d7e2f1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
253516d7e2f1Smrg#
253616d7e2f1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
253716d7e2f1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
253816d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
253916d7e2f1SmrgAC_ARG_WITH(ps2pdf,
254016d7e2f1Smrg	AS_HELP_STRING([--with-ps2pdf],
254116d7e2f1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
254216d7e2f1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
254316d7e2f1Smrgm4_undefine([_defopt])
254416d7e2f1Smrg
254516d7e2f1Smrgif test "x$use_ps2pdf" = x"auto"; then
254616d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
254716d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
254816d7e2f1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
254916d7e2f1Smrg	have_ps2pdf=no
255016d7e2f1Smrg   else
255116d7e2f1Smrg        have_ps2pdf=yes
255216d7e2f1Smrg   fi
255316d7e2f1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
255416d7e2f1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
255516d7e2f1Smrg   if test "x$PS2PDF" = "x"; then
255616d7e2f1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
255716d7e2f1Smrg   fi
255816d7e2f1Smrg   have_ps2pdf=yes
255916d7e2f1Smrgelif test "x$use_ps2pdf" = x"no" ; then
256016d7e2f1Smrg   if test "x$PS2PDF" != "x"; then
256116d7e2f1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
256216d7e2f1Smrg   fi
256316d7e2f1Smrg   have_ps2pdf=no
256416d7e2f1Smrgelse
256516d7e2f1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
256616d7e2f1Smrgfi
256716d7e2f1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
256816d7e2f1Smrg]) # XORG_WITH_PS2PDF
256916d7e2f1Smrg
257016d7e2f1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
257116d7e2f1Smrg# ----------------
257216d7e2f1Smrg# Minimum version: 1.6.0
257316d7e2f1Smrg#
257416d7e2f1Smrg# Documentation tools are not always available on all platforms and sometimes
257516d7e2f1Smrg# not at the appropriate level. This macro enables a builder to skip all
257616d7e2f1Smrg# documentation targets except traditional man pages.
257716d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2578c1e8faa6Smrg# maximum flexibility in controlling documentation building.
257916d7e2f1Smrg# Refer to:
258016d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
258116d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
258216d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
258316d7e2f1Smrg# XORG_WITH_FOP           --with-fop
258416d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
258516d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
258616d7e2f1Smrg#
258716d7e2f1Smrg# Interface to module:
258816d7e2f1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
258916d7e2f1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
259016d7e2f1Smrg#		 'no' user instructs the module not to generate docs
259116d7e2f1Smrg# parm1:	specify the default value, yes or no.
259216d7e2f1Smrg#
259316d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
259416d7e2f1Smrgm4_define([docs_default], m4_default([$1], [yes]))
259516d7e2f1SmrgAC_ARG_ENABLE(docs,
259616d7e2f1Smrg	AS_HELP_STRING([--enable-docs],
259716d7e2f1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
259816d7e2f1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
259916d7e2f1Smrgm4_undefine([docs_default])
260016d7e2f1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
260116d7e2f1SmrgAC_MSG_CHECKING([whether to build documentation])
260216d7e2f1SmrgAC_MSG_RESULT([$build_docs])
260316d7e2f1Smrg]) # XORG_ENABLE_DOCS
260416d7e2f1Smrg
260516d7e2f1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
260616d7e2f1Smrg# ----------------
260716d7e2f1Smrg# Minimum version: 1.6.0
260816d7e2f1Smrg#
260916d7e2f1Smrg# This macro enables a builder to skip all developer documentation.
261016d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2611c1e8faa6Smrg# maximum flexibility in controlling documentation building.
261216d7e2f1Smrg# Refer to:
261316d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
261416d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
261516d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
261616d7e2f1Smrg# XORG_WITH_FOP           --with-fop
261716d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
261816d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
261916d7e2f1Smrg#
262016d7e2f1Smrg# Interface to module:
262116d7e2f1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
262216d7e2f1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
262316d7e2f1Smrg#			'no' user instructs the module not to generate developer docs
262416d7e2f1Smrg# parm1:		specify the default value, yes or no.
262516d7e2f1Smrg#
262616d7e2f1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
262716d7e2f1Smrgm4_define([devel_default], m4_default([$1], [yes]))
262816d7e2f1SmrgAC_ARG_ENABLE(devel-docs,
262916d7e2f1Smrg	AS_HELP_STRING([--enable-devel-docs],
263016d7e2f1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
263116d7e2f1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
263216d7e2f1Smrgm4_undefine([devel_default])
263316d7e2f1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
263416d7e2f1SmrgAC_MSG_CHECKING([whether to build developer documentation])
263516d7e2f1SmrgAC_MSG_RESULT([$build_devel_docs])
263616d7e2f1Smrg]) # XORG_ENABLE_DEVEL_DOCS
263716d7e2f1Smrg
263816d7e2f1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
263916d7e2f1Smrg# ----------------
264016d7e2f1Smrg# Minimum version: 1.6.0
264116d7e2f1Smrg#
264216d7e2f1Smrg# This macro enables a builder to skip all functional specification targets.
264316d7e2f1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2644c1e8faa6Smrg# maximum flexibility in controlling documentation building.
264516d7e2f1Smrg# Refer to:
264616d7e2f1Smrg# XORG_WITH_XMLTO         --with-xmlto
264716d7e2f1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
264816d7e2f1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
264916d7e2f1Smrg# XORG_WITH_FOP           --with-fop
265016d7e2f1Smrg# XORG_WITH_GROFF         --with-groff
265116d7e2f1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
265216d7e2f1Smrg#
265316d7e2f1Smrg# Interface to module:
265416d7e2f1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
265516d7e2f1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
265616d7e2f1Smrg#			'no' user instructs the module not to generate specs
265716d7e2f1Smrg# parm1:		specify the default value, yes or no.
265816d7e2f1Smrg#
265916d7e2f1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
266016d7e2f1Smrgm4_define([spec_default], m4_default([$1], [yes]))
266116d7e2f1SmrgAC_ARG_ENABLE(specs,
266216d7e2f1Smrg	AS_HELP_STRING([--enable-specs],
266316d7e2f1Smrg	   [Enable building the specs (default: ]spec_default[)]),
266416d7e2f1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
266516d7e2f1Smrgm4_undefine([spec_default])
266616d7e2f1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
266716d7e2f1SmrgAC_MSG_CHECKING([whether to build functional specifications])
266816d7e2f1SmrgAC_MSG_RESULT([$build_specs])
266916d7e2f1Smrg]) # XORG_ENABLE_SPECS
267016d7e2f1Smrg
267116d7e2f1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
267216d7e2f1Smrg# ----------------------------------------------
267316d7e2f1Smrg# Minimum version: 1.13.0
267416d7e2f1Smrg#
267516d7e2f1Smrg# This macro enables a builder to enable/disable unit testing
267616d7e2f1Smrg# It makes no assumption about the test cases implementation
267716d7e2f1Smrg# Test cases may or may not use Automake "Support for test suites"
267816d7e2f1Smrg# They may or may not use the software utility library GLib
267916d7e2f1Smrg#
268016d7e2f1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
268116d7e2f1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
268216d7e2f1Smrg# The variable enable_unit_tests is used by other macros in this file.
268316d7e2f1Smrg#
268416d7e2f1Smrg# Interface to module:
268516d7e2f1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
268616d7e2f1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
268716d7e2f1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
268816d7e2f1Smrg#			'no' user instructs the module not to build tests
268916d7e2f1Smrg# parm1:		specify the default value, yes or no.
269016d7e2f1Smrg#
269116d7e2f1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
269216d7e2f1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
269316d7e2f1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
269416d7e2f1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
269516d7e2f1Smrgm4_define([_defopt], m4_default([$1], [auto]))
269616d7e2f1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
269716d7e2f1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
269816d7e2f1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
269916d7e2f1Smrgm4_undefine([_defopt])
270016d7e2f1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
270116d7e2f1SmrgAC_MSG_CHECKING([whether to build unit test cases])
270216d7e2f1SmrgAC_MSG_RESULT([$enable_unit_tests])
270316d7e2f1Smrg]) # XORG_ENABLE_UNIT_TESTS
270416d7e2f1Smrg
27052becc446Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27062becc446Smrg# ------------------------------------------------------
27072becc446Smrg# Minimum version: 1.17.0
27082becc446Smrg#
27092becc446Smrg# This macro enables a builder to enable/disable integration testing
27102becc446Smrg# It makes no assumption about the test cases' implementation
27112becc446Smrg# Test cases may or may not use Automake "Support for test suites"
27122becc446Smrg#
27132becc446Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27142becc446Smrg# usually requires less dependencies and may be built and run under less
27152becc446Smrg# stringent environments than integration tests.
27162becc446Smrg#
27172becc446Smrg# Interface to module:
27182becc446Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
27192becc446Smrg# enable_integration_tests:   used in configure.ac for additional configuration
27202becc446Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
27212becc446Smrg#                             'no' user instructs the module not to build tests
27222becc446Smrg# parm1:                      specify the default value, yes or no.
27232becc446Smrg#
27242becc446SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
27252becc446SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27262becc446Smrgm4_define([_defopt], m4_default([$1], [auto]))
27272becc446SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
27282becc446Smrg	[Enable building integration test cases (default: ]_defopt[)]),
27292becc446Smrg	[enable_integration_tests=$enableval],
27302becc446Smrg	[enable_integration_tests=]_defopt)
27312becc446Smrgm4_undefine([_defopt])
27322becc446SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
27332becc446Smrg	[test "x$enable_integration_tests" != xno])
27342becc446SmrgAC_MSG_CHECKING([whether to build unit test cases])
27352becc446SmrgAC_MSG_RESULT([$enable_integration_tests])
27362becc446Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
27372becc446Smrg
273816d7e2f1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
273916d7e2f1Smrg# ----------------------------------------
274016d7e2f1Smrg# Minimum version: 1.13.0
274116d7e2f1Smrg#
274216d7e2f1Smrg# GLib is a library which provides advanced data structures and functions.
274316d7e2f1Smrg# This macro enables a module to test for the presence of Glib.
274416d7e2f1Smrg#
274516d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
274616d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
274716d7e2f1Smrg#
27482becc446Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
27492becc446Smrg# test support usually requires less dependencies and may be built and run under
27502becc446Smrg# less stringent environments than integration tests.
27512becc446Smrg#
275216d7e2f1Smrg# Interface to module:
275316d7e2f1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
275416d7e2f1Smrg# with_glib: used in configure.ac to know if GLib has been found
275516d7e2f1Smrg# --with-glib:	'yes' user instructs the module to use glib
275616d7e2f1Smrg#		'no' user instructs the module not to use glib
275716d7e2f1Smrg#
275816d7e2f1SmrgAC_DEFUN([XORG_WITH_GLIB],[
275916d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
276016d7e2f1Smrgm4_define([_defopt], m4_default([$2], [auto]))
276116d7e2f1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
276216d7e2f1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
276316d7e2f1Smrg	[with_glib=$withval], [with_glib=]_defopt)
276416d7e2f1Smrgm4_undefine([_defopt])
276516d7e2f1Smrg
276616d7e2f1Smrghave_glib=no
276716d7e2f1Smrg# Do not probe GLib if user explicitly disabled unit testing
276816d7e2f1Smrgif test "x$enable_unit_tests" != x"no"; then
276916d7e2f1Smrg  # Do not probe GLib if user explicitly disabled it
277016d7e2f1Smrg  if test "x$with_glib" != x"no"; then
277116d7e2f1Smrg    m4_ifval(
277216d7e2f1Smrg      [$1],
277316d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
277416d7e2f1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
277516d7e2f1Smrg    )
277616d7e2f1Smrg  fi
277716d7e2f1Smrgfi
277816d7e2f1Smrg
277916d7e2f1Smrg# Not having GLib when unit testing has been explicitly requested is an error
278016d7e2f1Smrgif test "x$enable_unit_tests" = x"yes"; then
278116d7e2f1Smrg  if test "x$have_glib" = x"no"; then
278216d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
278316d7e2f1Smrg  fi
278416d7e2f1Smrgfi
278516d7e2f1Smrg
278616d7e2f1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
278716d7e2f1Smrgif test "x$enable_unit_tests" = x"no"; then
278816d7e2f1Smrg  if test "x$with_glib" = x"yes"; then
278916d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
279016d7e2f1Smrg  fi
279116d7e2f1Smrgfi
279216d7e2f1Smrg
279316d7e2f1Smrg# Not having GLib when it has been explicitly requested is an error
279416d7e2f1Smrgif test "x$with_glib" = x"yes"; then
279516d7e2f1Smrg  if test "x$have_glib" = x"no"; then
279616d7e2f1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
279716d7e2f1Smrg  fi
279816d7e2f1Smrgfi
279916d7e2f1Smrg
280016d7e2f1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
280116d7e2f1Smrg]) # XORG_WITH_GLIB
280216d7e2f1Smrg
280316d7e2f1Smrg# XORG_LD_WRAP([required|optional])
280416d7e2f1Smrg# ---------------------------------
280516d7e2f1Smrg# Minimum version: 1.13.0
280616d7e2f1Smrg#
280716d7e2f1Smrg# Check if linker supports -wrap, passed via compiler flags
280816d7e2f1Smrg#
280916d7e2f1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
281016d7e2f1Smrg# Otherwise the value of $enable_unit_tests is blank.
281116d7e2f1Smrg#
281216d7e2f1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
281316d7e2f1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
281416d7e2f1Smrg# available, an argument of "optional" allows use when some unit tests require
281516d7e2f1Smrg# ld -wrap and others do not.
281616d7e2f1Smrg#
281716d7e2f1SmrgAC_DEFUN([XORG_LD_WRAP],[
281816d7e2f1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
281916d7e2f1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
282016d7e2f1Smrg                      void __wrap_exit(int status) { return; }],
282116d7e2f1Smrg                     [exit(0);])])
282216d7e2f1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
282316d7e2f1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
282416d7e2f1Smrg  if test "x$have_ld_wrap" = x"no"; then
282516d7e2f1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
282616d7e2f1Smrg  fi
282716d7e2f1Smrgfi
282816d7e2f1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
282916d7e2f1Smrg#
283016d7e2f1Smrg]) # XORG_LD_WRAP
283116d7e2f1Smrg
283216d7e2f1Smrg# XORG_CHECK_LINKER_FLAGS
283316d7e2f1Smrg# -----------------------
283416d7e2f1Smrg# SYNOPSIS
283516d7e2f1Smrg#
283616d7e2f1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
283716d7e2f1Smrg#
283816d7e2f1Smrg# DESCRIPTION
283916d7e2f1Smrg#
284016d7e2f1Smrg#   Check whether the given linker FLAGS work with the current language's
284116d7e2f1Smrg#   linker, or whether they give an error.
284216d7e2f1Smrg#
284316d7e2f1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
284416d7e2f1Smrg#   success/failure.
284516d7e2f1Smrg#
284616d7e2f1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
284716d7e2f1Smrg#
284816d7e2f1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
284916d7e2f1Smrg#
285016d7e2f1Smrg# LICENSE
285116d7e2f1Smrg#
285216d7e2f1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
285316d7e2f1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
285416d7e2f1Smrg#   Copyright (c) 2009 Matteo Frigo
285516d7e2f1Smrg#
285616d7e2f1Smrg#   This program is free software: you can redistribute it and/or modify it
285716d7e2f1Smrg#   under the terms of the GNU General Public License as published by the
285816d7e2f1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
285916d7e2f1Smrg#   option) any later version.
286016d7e2f1Smrg#
286116d7e2f1Smrg#   This program is distributed in the hope that it will be useful, but
286216d7e2f1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
286316d7e2f1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
286416d7e2f1Smrg#   Public License for more details.
286516d7e2f1Smrg#
286616d7e2f1Smrg#   You should have received a copy of the GNU General Public License along
286716d7e2f1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
286816d7e2f1Smrg#
286916d7e2f1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
287016d7e2f1Smrg#   gives unlimited permission to copy, distribute and modify the configure
287116d7e2f1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
287216d7e2f1Smrg#   need not follow the terms of the GNU General Public License when using
287316d7e2f1Smrg#   or distributing such scripts, even though portions of the text of the
287416d7e2f1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
287516d7e2f1Smrg#   all other use of the material that constitutes the Autoconf Macro.
287616d7e2f1Smrg#
287716d7e2f1Smrg#   This special exception to the GPL applies to versions of the Autoconf
287816d7e2f1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
287916d7e2f1Smrg#   modified version of the Autoconf Macro, you may extend this special
288016d7e2f1Smrg#   exception to the GPL to apply to your modified version as well.#
288116d7e2f1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
288216d7e2f1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
288316d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
288416d7e2f1SmrgAS_LITERAL_IF([$1],
288516d7e2f1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
288616d7e2f1Smrg      ax_save_FLAGS=$LDFLAGS
288716d7e2f1Smrg      LDFLAGS="$1"
288816d7e2f1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
288916d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289016d7e2f1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289116d7e2f1Smrg      LDFLAGS=$ax_save_FLAGS])],
289216d7e2f1Smrg  [ax_save_FLAGS=$LDFLAGS
289316d7e2f1Smrg   LDFLAGS="$1"
289416d7e2f1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
289516d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
289616d7e2f1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
289716d7e2f1Smrg   LDFLAGS=$ax_save_FLAGS])
289816d7e2f1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
289916d7e2f1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
290016d7e2f1Smrgif test "x$xorg_check_linker_flags" = xyes; then
290116d7e2f1Smrg	m4_default([$2], :)
290216d7e2f1Smrgelse
290316d7e2f1Smrg	m4_default([$3], :)
290416d7e2f1Smrgfi
290516d7e2f1Smrg]) # XORG_CHECK_LINKER_FLAGS
290616d7e2f1Smrg
290716d7e2f1Smrg# XORG_MEMORY_CHECK_FLAGS
290816d7e2f1Smrg# -----------------------
290916d7e2f1Smrg# Minimum version: 1.16.0
291016d7e2f1Smrg#
291116d7e2f1Smrg# This macro attempts to find appropriate memory checking functionality
291216d7e2f1Smrg# for various platforms which unit testing code may use to catch various
291316d7e2f1Smrg# forms of memory allocation and access errors in testing.
291416d7e2f1Smrg#
291516d7e2f1Smrg# Interface to module:
291616d7e2f1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
291716d7e2f1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
291816d7e2f1Smrg#
291916d7e2f1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
292016d7e2f1Smrg#
292116d7e2f1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
292216d7e2f1Smrg
292316d7e2f1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
292416d7e2f1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
292516d7e2f1Smrg           [Environment variables to enable memory checking in tests])
292616d7e2f1Smrg
292716d7e2f1Smrg# Check for different types of support on different platforms
292816d7e2f1Smrgcase $host_os in
292916d7e2f1Smrg    solaris*)
293016d7e2f1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
293116d7e2f1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
293216d7e2f1Smrg        ;;
293316d7e2f1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
293416d7e2f1Smrg        # both directly and inverted, so should not be 0 or 255.
293516d7e2f1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
293616d7e2f1Smrg        ;;
293716d7e2f1Smrg    darwin*)
293816d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
293916d7e2f1Smrg        ;;
294016d7e2f1Smrg    *bsd*)
294116d7e2f1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
294216d7e2f1Smrg        ;;
294316d7e2f1Smrgesac
294416d7e2f1Smrg
294516d7e2f1Smrg# User supplied flags override default flags
294616d7e2f1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
294716d7e2f1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
294816d7e2f1Smrgfi
294916d7e2f1Smrg
295016d7e2f1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
295116d7e2f1Smrg]) # XORG_WITH_LINT
295216d7e2f1Smrg
295316d7e2f1Smrg# XORG_CHECK_MALLOC_ZERO
295416d7e2f1Smrg# ----------------------
295516d7e2f1Smrg# Minimum version: 1.0.0
295616d7e2f1Smrg#
295716d7e2f1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
295816d7e2f1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
295916d7e2f1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2960c1e8faa6Smrg#
2961c1e8faa6Smrg# No longer actually tests since there is no guarantee applications will
2962c1e8faa6Smrg# run with the same malloc implementation we tested against, and the cost
2963c1e8faa6Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
2964c1e8faa6Smrg# Still allows builders to override when they have complete control over
2965c1e8faa6Smrg# which malloc implementation will be used.
296616d7e2f1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
296716d7e2f1SmrgAC_ARG_ENABLE(malloc0returnsnull,
296816d7e2f1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2969c1e8faa6Smrg		       [malloc(0) returns NULL (default: yes)]),
297016d7e2f1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2971c1e8faa6Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
297216d7e2f1Smrg
297316d7e2f1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
297416d7e2f1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
297516d7e2f1Smrg
297616d7e2f1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
297716d7e2f1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
297816d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
297916d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
298016d7e2f1Smrgelse
298116d7e2f1Smrg	MALLOC_ZERO_CFLAGS=""
298216d7e2f1Smrg	XMALLOC_ZERO_CFLAGS=""
298316d7e2f1Smrg	XTMALLOC_ZERO_CFLAGS=""
298416d7e2f1Smrgfi
298516d7e2f1Smrg
298616d7e2f1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
298716d7e2f1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
298816d7e2f1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
298916d7e2f1Smrg]) # XORG_CHECK_MALLOC_ZERO
299016d7e2f1Smrg
299116d7e2f1Smrg# XORG_WITH_LINT()
299216d7e2f1Smrg# ----------------
299316d7e2f1Smrg# Minimum version: 1.1.0
299416d7e2f1Smrg#
299516d7e2f1Smrg# This macro enables the use of a tool that flags some suspicious and
299616d7e2f1Smrg# non-portable constructs (likely to be bugs) in C language source code.
299716d7e2f1Smrg# It will attempt to locate the tool and use appropriate options.
299816d7e2f1Smrg# There are various lint type tools on different platforms.
299916d7e2f1Smrg#
300016d7e2f1Smrg# Interface to module:
300116d7e2f1Smrg# LINT:		returns the path to the tool found on the platform
300216d7e2f1Smrg#		or the value set to LINT on the configure cmd line
300316d7e2f1Smrg#		also an Automake conditional
300416d7e2f1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
300516d7e2f1Smrg#
300616d7e2f1Smrg# --with-lint:	'yes' user instructs the module to use lint
300716d7e2f1Smrg#		'no' user instructs the module not to use lint (default)
300816d7e2f1Smrg#
300916d7e2f1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
301016d7e2f1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
301116d7e2f1Smrg#
301216d7e2f1SmrgAC_DEFUN([XORG_WITH_LINT],[
301316d7e2f1Smrg
301416d7e2f1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
301516d7e2f1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
301616d7e2f1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
301716d7e2f1Smrg		[Use a lint-style source code checker (default: disabled)])],
301816d7e2f1Smrg		[use_lint=$withval], [use_lint=no])
301916d7e2f1Smrg
302016d7e2f1Smrg# Obtain platform specific info like program name and options
302116d7e2f1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
302216d7e2f1Smrgcase $host_os in
302316d7e2f1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
302416d7e2f1Smrg	lint_name=splint
302516d7e2f1Smrg	lint_options="-badflag"
302616d7e2f1Smrg	;;
302716d7e2f1Smrg  *freebsd* | *netbsd*)
302816d7e2f1Smrg	lint_name=lint
302916d7e2f1Smrg	lint_options="-u -b"
303016d7e2f1Smrg	;;
303116d7e2f1Smrg  *solaris*)
303216d7e2f1Smrg	lint_name=lint
303316d7e2f1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
303416d7e2f1Smrg	;;
303516d7e2f1Smrgesac
303616d7e2f1Smrg
303716d7e2f1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
303816d7e2f1Smrgif test "x$use_lint" = x"yes" ; then
303916d7e2f1Smrg   AC_PATH_PROG([LINT], [$lint_name])
304016d7e2f1Smrg   if test "x$LINT" = "x"; then
304116d7e2f1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
304216d7e2f1Smrg   fi
304316d7e2f1Smrgelif test "x$use_lint" = x"no" ; then
304416d7e2f1Smrg   if test "x$LINT" != "x"; then
304516d7e2f1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
304616d7e2f1Smrg   fi
304716d7e2f1Smrgelse
304816d7e2f1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
304916d7e2f1Smrgfi
305016d7e2f1Smrg
305116d7e2f1Smrg# User supplied flags override default flags
305216d7e2f1Smrgif test "x$LINT_FLAGS" != "x"; then
305316d7e2f1Smrg   lint_options=$LINT_FLAGS
305416d7e2f1Smrgfi
305516d7e2f1Smrg
305616d7e2f1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
305716d7e2f1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
305816d7e2f1Smrg
305916d7e2f1Smrg]) # XORG_WITH_LINT
306016d7e2f1Smrg
306116d7e2f1Smrg# XORG_LINT_LIBRARY(LIBNAME)
306216d7e2f1Smrg# --------------------------
306316d7e2f1Smrg# Minimum version: 1.1.0
306416d7e2f1Smrg#
306516d7e2f1Smrg# Sets up flags for building lint libraries for checking programs that call
306616d7e2f1Smrg# functions in the library.
306716d7e2f1Smrg#
306816d7e2f1Smrg# Interface to module:
306916d7e2f1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
307016d7e2f1Smrg# MAKE_LINT_LIB		- Automake conditional
307116d7e2f1Smrg#
307216d7e2f1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
307316d7e2f1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
307416d7e2f1Smrg
307516d7e2f1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
30768650bb69SmrgAC_REQUIRE([XORG_WITH_LINT])
30778650bb69SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
30788650bb69Smrg	[Create lint library (default: disabled)])],
30798650bb69Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
308016d7e2f1Smrg
308116d7e2f1Smrgif test "x$make_lint_lib" = x"yes" ; then
308216d7e2f1Smrg   LINTLIB=llib-l$1.ln
308316d7e2f1Smrg   if test "x$LINT" = "x"; then
308416d7e2f1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
308516d7e2f1Smrg   fi
308616d7e2f1Smrgelif test "x$make_lint_lib" != x"no" ; then
308716d7e2f1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30888650bb69Smrgfi
308916d7e2f1Smrg
30908650bb69SmrgAC_SUBST(LINTLIB)
30918650bb69SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
30928650bb69Smrg
30938650bb69Smrg]) # XORG_LINT_LIBRARY
30948650bb69Smrg
309516d7e2f1Smrg# XORG_COMPILER_BRAND
309616d7e2f1Smrg# -------------------
309716d7e2f1Smrg# Minimum version: 1.14.0
309816d7e2f1Smrg#
309916d7e2f1Smrg# Checks for various brands of compilers and sets flags as appropriate:
310016d7e2f1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31012becc446Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
310216d7e2f1Smrg#   clang compiler - sets CLANGCC to "yes"
310316d7e2f1Smrg#   Intel compiler - sets INTELCC to "yes"
310416d7e2f1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
310516d7e2f1Smrg#
310616d7e2f1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
31072becc446SmrgAC_LANG_CASE(
31082becc446Smrg	[C], [
3109c1e8faa6Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3110c1e8faa6Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3111c1e8faa6Smrg		m4_version_prereq([2.70],
3112c1e8faa6Smrg			[AC_REQUIRE([AC_PROG_CC])],
3113c1e8faa6Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31142becc446Smrg	],
31152becc446Smrg	[C++], [
31162becc446Smrg		AC_REQUIRE([AC_PROG_CXX])
31172becc446Smrg	]
31182becc446Smrg)
311916d7e2f1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
312016d7e2f1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
312116d7e2f1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
312216d7e2f1Smrg]) # XORG_COMPILER_BRAND
312316d7e2f1Smrg
312416d7e2f1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
312516d7e2f1Smrg# ---------------
312616d7e2f1Smrg# Minimum version: 1.16.0
312716d7e2f1Smrg#
312816d7e2f1Smrg# Test if the compiler works when passed the given flag as a command line argument.
3129c1e8faa6Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
313016d7e2f1Smrg# next flag in the list until there are no more options.
313116d7e2f1Smrg#
313216d7e2f1Smrg# Note that this does not guarantee that the compiler supports the flag as some
313316d7e2f1Smrg# compilers will simply ignore arguments that they do not understand, but we do
313416d7e2f1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
313516d7e2f1Smrg# -Werror=unused-command-line-argument
313616d7e2f1Smrg#
313716d7e2f1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
313816d7e2f1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
313916d7e2f1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
314016d7e2f1Smrg
31412becc446SmrgAC_LANG_COMPILER_REQUIRE
31422becc446Smrg
31432becc446SmrgAC_LANG_CASE(
31442becc446Smrg	[C], [
3145c1e8faa6Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3146c1e8faa6Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3147c1e8faa6Smrg		m4_version_prereq([2.70],
3148c1e8faa6Smrg			[AC_REQUIRE([AC_PROG_CC])],
3149c1e8faa6Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31502becc446Smrg		define([PREFIX], [C])
31512becc446Smrg		define([CACHE_PREFIX], [cc])
31522becc446Smrg		define([COMPILER], [$CC])
31532becc446Smrg	],
31542becc446Smrg	[C++], [
31552becc446Smrg		define([PREFIX], [CXX])
31562becc446Smrg		define([CACHE_PREFIX], [cxx])
31572becc446Smrg		define([COMPILER], [$CXX])
31582becc446Smrg	]
31592becc446Smrg)
31602becc446Smrg
31612becc446Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
316216d7e2f1Smrg
31632becc446Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
31642becc446Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31652becc446Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
31662becc446Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
316716d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31682becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
31692becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
31702becc446Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
31712becc446Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
317216d7e2f1Smrgfi
317316d7e2f1Smrg
31742becc446Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
31752becc446Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
31762becc446Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
317716d7e2f1Smrg	fi
31782becc446Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31792becc446Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
31802becc446Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
318116d7e2f1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31822becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
31832becc446Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
31842becc446Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
31852becc446Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
318616d7e2f1Smrgfi
318716d7e2f1Smrg
318816d7e2f1Smrgfound="no"
318916d7e2f1Smrgm4_foreach([flag], m4_cdr($@), [
319016d7e2f1Smrg	if test $found = "no" ; then
31912becc446Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
31922becc446Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
319316d7e2f1Smrg		fi
319416d7e2f1Smrg
31952becc446Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
31962becc446Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
319716d7e2f1Smrg		fi
319816d7e2f1Smrg
31992becc446Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
320016d7e2f1Smrg
320116d7e2f1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32022becc446Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32032becc446Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32042becc446Smrg		AC_CACHE_VAL($cacheid,
320516d7e2f1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32062becc446Smrg					     [eval $cacheid=yes],
32072becc446Smrg					     [eval $cacheid=no])])
320816d7e2f1Smrg
32092becc446Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
321016d7e2f1Smrg
32112becc446Smrg		eval supported=\$$cacheid
321216d7e2f1Smrg		AC_MSG_RESULT([$supported])
321316d7e2f1Smrg		if test "$supported" = "yes" ; then
321416d7e2f1Smrg			$1="$$1 ]flag["
321516d7e2f1Smrg			found="yes"
321616d7e2f1Smrg		fi
321716d7e2f1Smrg	fi
321816d7e2f1Smrg])
321916d7e2f1Smrg]) # XORG_TESTSET_CFLAG
322016d7e2f1Smrg
322116d7e2f1Smrg# XORG_COMPILER_FLAGS
322216d7e2f1Smrg# ---------------
322316d7e2f1Smrg# Minimum version: 1.16.0
322416d7e2f1Smrg#
32252becc446Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
32262becc446Smrg# arguments supported by the selected compiler which do NOT alter the generated
32272becc446Smrg# code.  These arguments will cause the compiler to print various warnings
32282becc446Smrg# during compilation AND turn a conservative set of warnings into errors.
322916d7e2f1Smrg#
32302becc446Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
32312becc446Smrg# future versions of util-macros as options are added to new compilers.
323216d7e2f1Smrg#
323316d7e2f1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
323416d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
323516d7e2f1Smrg
323616d7e2f1SmrgAC_ARG_ENABLE(selective-werror,
323716d7e2f1Smrg              AS_HELP_STRING([--disable-selective-werror],
323816d7e2f1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
323916d7e2f1Smrg              [SELECTIVE_WERROR=$enableval],
324016d7e2f1Smrg              [SELECTIVE_WERROR=yes])
324116d7e2f1Smrg
32422becc446SmrgAC_LANG_CASE(
32432becc446Smrg        [C], [
32442becc446Smrg                define([PREFIX], [C])
32452becc446Smrg        ],
32462becc446Smrg        [C++], [
32472becc446Smrg                define([PREFIX], [CXX])
32482becc446Smrg        ]
32492becc446Smrg)
325016d7e2f1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
325116d7e2f1Smrgif test "x$SUNCC" = "xyes"; then
32522becc446Smrg    [BASE_]PREFIX[FLAGS]="-v"
325316d7e2f1Smrgelse
32542becc446Smrg    [BASE_]PREFIX[FLAGS]=""
325516d7e2f1Smrgfi
325616d7e2f1Smrg
325716d7e2f1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
32582becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
32592becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
32602becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
32612becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
32622becc446Smrg
32632becc446SmrgAC_LANG_CASE(
32642becc446Smrg	[C], [
32652becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
32662becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
32672becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
32682becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32692becc446Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
32702becc446Smrg	]
32712becc446Smrg)
327216d7e2f1Smrg
327316d7e2f1Smrg# This chunk adds additional warnings that could catch undesired effects.
32742becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
32752becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
32762becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
32772becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
32782becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
32792becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32802becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
328116d7e2f1Smrg
328216d7e2f1Smrg# These are currently disabled because they are noisy.  They will be enabled
328316d7e2f1Smrg# in the future once the codebase is sufficiently modernized to silence
328416d7e2f1Smrg# them.  For now, I don't want them to drown out the other warnings.
32852becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
32862becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32872becc446Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
328816d7e2f1Smrg
3289c1e8faa6Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
329016d7e2f1Smrg# when there are problems that should be fixed.
329116d7e2f1Smrg
329216d7e2f1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
32932becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
32942becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
32952becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
32962becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
32972becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
32982becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
32992becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33002becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33012becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33022becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33032becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33042becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33052becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
330616d7e2f1Smrgelse
330716d7e2f1SmrgAC_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])
33082becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33092becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33102becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33112becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33122becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33132becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
33142becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
33152becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
33162becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
33172becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
33182becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
33192becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
33202becc446SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33212becc446Smrgfi
33222becc446Smrg
33232becc446SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
332416d7e2f1Smrg]) # XORG_COMPILER_FLAGS
332516d7e2f1Smrg
33268650bb69Smrg# XORG_CWARNFLAGS
33278650bb69Smrg# ---------------
33288650bb69Smrg# Minimum version: 1.2.0
332916d7e2f1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33308650bb69Smrg#
33318650bb69Smrg# Defines CWARNFLAGS to enable C compiler warnings.
33328650bb69Smrg#
333316d7e2f1Smrg# This function is deprecated because it defines -fno-strict-aliasing
333416d7e2f1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
333516d7e2f1Smrg# is needed, then it should be added explicitly in the module when
333616d7e2f1Smrg# it is updated to use BASE_CFLAGS.
333716d7e2f1Smrg#
33388650bb69SmrgAC_DEFUN([XORG_CWARNFLAGS], [
333916d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
334016d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33412becc446SmrgAC_LANG_CASE(
33422becc446Smrg	[C], [
33432becc446Smrg		CWARNFLAGS="$BASE_CFLAGS"
33442becc446Smrg		if  test "x$GCC" = xyes ; then
33452becc446Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
33462becc446Smrg		fi
33472becc446Smrg		AC_SUBST(CWARNFLAGS)
33482becc446Smrg	]
33492becc446Smrg)
33508650bb69Smrg]) # XORG_CWARNFLAGS
33518650bb69Smrg
33528650bb69Smrg# XORG_STRICT_OPTION
33538650bb69Smrg# -----------------------
33548650bb69Smrg# Minimum version: 1.3.0
33558650bb69Smrg#
335616d7e2f1Smrg# Add configure option to enable strict compilation flags, such as treating
335716d7e2f1Smrg# warnings as fatal errors.
335816d7e2f1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
33592becc446Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
336016d7e2f1Smrg#
336116d7e2f1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
336216d7e2f1Smrg# when strict compilation is unconditionally desired.
33638650bb69SmrgAC_DEFUN([XORG_STRICT_OPTION], [
33648650bb69SmrgAC_REQUIRE([XORG_CWARNFLAGS])
336516d7e2f1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33668650bb69Smrg
33678650bb69SmrgAC_ARG_ENABLE(strict-compilation,
33688650bb69Smrg			  AS_HELP_STRING([--enable-strict-compilation],
33698650bb69Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33708650bb69Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
337116d7e2f1Smrg
33722becc446SmrgAC_LANG_CASE(
33732becc446Smrg        [C], [
33742becc446Smrg                define([PREFIX], [C])
33752becc446Smrg        ],
33762becc446Smrg        [C++], [
33772becc446Smrg                define([PREFIX], [CXX])
33782becc446Smrg        ]
33792becc446Smrg)
33802becc446Smrg
33812becc446Smrg[STRICT_]PREFIX[FLAGS]=""
33822becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
33832becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
338416d7e2f1Smrg
338516d7e2f1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
338616d7e2f1Smrg# activate it with -Werror, so we add it here explicitly.
33872becc446SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
338816d7e2f1Smrg
33898650bb69Smrgif test "x$STRICT_COMPILE" = "xyes"; then
33902becc446Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
33912becc446Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33928650bb69Smrgfi
33932becc446SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
33942becc446SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33952becc446SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33968650bb69Smrg]) # XORG_STRICT_OPTION
33978650bb69Smrg
3398c1e8faa6Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3399c1e8faa6Smrg# ---------------------------
3400c1e8faa6Smrg# Minimum version: 1.20.0
3401c1e8faa6Smrg#
3402c1e8faa6Smrg# Defines default options for X.Org modules which don't compile code,
3403c1e8faa6Smrg# such as fonts, bitmaps, cursors, and docs.
3404c1e8faa6Smrg#
3405c1e8faa6SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3406c1e8faa6SmrgAC_REQUIRE([AC_PROG_INSTALL])
3407c1e8faa6SmrgXORG_RELEASE_VERSION
3408c1e8faa6SmrgXORG_CHANGELOG
3409c1e8faa6SmrgXORG_INSTALL
3410c1e8faa6SmrgXORG_MANPAGE_SECTIONS
3411c1e8faa6Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3412c1e8faa6Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3413c1e8faa6Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3414c1e8faa6Smrg
34158650bb69Smrg# XORG_DEFAULT_OPTIONS
34168650bb69Smrg# --------------------
34178650bb69Smrg# Minimum version: 1.3.0
34188650bb69Smrg#
3419c1e8faa6Smrg# Defines default options for X.Org modules which compile code.
34208650bb69Smrg#
34218650bb69SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
342216d7e2f1SmrgAC_REQUIRE([AC_PROG_INSTALL])
342316d7e2f1SmrgXORG_COMPILER_FLAGS
34248650bb69SmrgXORG_CWARNFLAGS
34258650bb69SmrgXORG_STRICT_OPTION
3426c1e8faa6SmrgXORG_DEFAULT_NOCODE_OPTIONS
34278650bb69Smrg]) # XORG_DEFAULT_OPTIONS
342816d7e2f1Smrg
342916d7e2f1Smrg# XORG_INSTALL()
343016d7e2f1Smrg# ----------------
343116d7e2f1Smrg# Minimum version: 1.4.0
343216d7e2f1Smrg#
343316d7e2f1Smrg# Defines the variable INSTALL_CMD as the command to copy
343416d7e2f1Smrg# INSTALL from $prefix/share/util-macros.
343516d7e2f1Smrg#
343616d7e2f1SmrgAC_DEFUN([XORG_INSTALL], [
343716d7e2f1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
343816d7e2f1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
343916d7e2f1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
344016d7e2f1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
34413458e6c2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
34423458e6c2Smrgtouch \$(top_srcdir)/INSTALL; \
34433458e6c2Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
344416d7e2f1SmrgAC_SUBST([INSTALL_CMD])
344516d7e2f1Smrg]) # XORG_INSTALL
34462c7c4e3dSmrgdnl Copyright 2005 Red Hat, Inc
34472c7c4e3dSmrgdnl
34482c7c4e3dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
34492c7c4e3dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
34502c7c4e3dSmrgdnl the above copyright notice appear in all copies and that both that
34512c7c4e3dSmrgdnl copyright notice and this permission notice appear in supporting
34522c7c4e3dSmrgdnl documentation.
34532c7c4e3dSmrgdnl
34542c7c4e3dSmrgdnl The above copyright notice and this permission notice shall be included
34552c7c4e3dSmrgdnl in all copies or substantial portions of the Software.
34562c7c4e3dSmrgdnl
34572c7c4e3dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34582c7c4e3dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34592c7c4e3dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34602c7c4e3dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
34612c7c4e3dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34622c7c4e3dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34632c7c4e3dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
34642c7c4e3dSmrgdnl
34652c7c4e3dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
34662c7c4e3dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
34672c7c4e3dSmrgdnl other dealings in this Software without prior written authorization
34682c7c4e3dSmrgdnl from the copyright holders.
34692c7c4e3dSmrgdnl
34702c7c4e3dSmrg
34712c7c4e3dSmrg# XORG_RELEASE_VERSION
34722c7c4e3dSmrg# --------------------
347316d7e2f1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
34742becc446Smrg
34752c7c4e3dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
34768650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
34778650bb69Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
34788650bb69Smrg		[Major version of this package])
34798650bb69Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
34808650bb69Smrg	if test "x$PVM" = "x"; then
34818650bb69Smrg		PVM="0"
34828650bb69Smrg	fi
34838650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
34848650bb69Smrg		[$PVM],
34858650bb69Smrg		[Minor version of this package])
34868650bb69Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
34878650bb69Smrg	if test "x$PVP" = "x"; then
34888650bb69Smrg		PVP="0"
34898650bb69Smrg	fi
34908650bb69Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
34918650bb69Smrg		[$PVP],
34928650bb69Smrg		[Patch version of this package])
34932c7c4e3dSmrg])
34942c7c4e3dSmrg
34958650bb69Smrg# XORG_CHANGELOG()
34968650bb69Smrg# ----------------
34978650bb69Smrg# Minimum version: 1.2.0
34988650bb69Smrg#
34998650bb69Smrg# Defines the variable CHANGELOG_CMD as the command to generate
35008650bb69Smrg# ChangeLog from git.
35018650bb69Smrg#
35028650bb69Smrg#
35038650bb69SmrgAC_DEFUN([XORG_CHANGELOG], [
35043458e6c2SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
350516d7e2f1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
35063458e6c2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
35073458e6c2Smrgtouch \$(top_srcdir)/ChangeLog; \
35083458e6c2Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
35098650bb69SmrgAC_SUBST([CHANGELOG_CMD])
35108650bb69Smrg]) # XORG_CHANGELOG
35118650bb69Smrg
3512