18b5ec993Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
2f33d31a3Smrg
38b5ec993Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4f33d31a3Smrg
5f33d31a3Smrg# This file is free software; the Free Software Foundation
6f33d31a3Smrg# gives unlimited permission to copy and/or distribute it,
7f33d31a3Smrg# with or without modifications, as long as this notice is preserved.
8f33d31a3Smrg
9f33d31a3Smrg# This program is distributed in the hope that it will be useful,
10f33d31a3Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11f33d31a3Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12f33d31a3Smrg# PARTICULAR PURPOSE.
13f33d31a3Smrg
14f33d31a3Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15f33d31a3Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16f33d31a3Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178b5ec993Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
188b5ec993Smrg[m4_warning([this file was generated for autoconf 2.72.
19f33d31a3SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20f33d31a3SmrgIf you have problems, you may need to regenerate the build system entirely.
21f33d31a3SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f33d31a3Smrg
238b5ec993Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
249f1d9476Smrg#
259f1d9476Smrg# This file is free software; the Free Software Foundation
269f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
279f1d9476Smrg# with or without modifications, as long as this notice is preserved.
28f33d31a3Smrg
299f1d9476Smrg# AM_AUTOMAKE_VERSION(VERSION)
309f1d9476Smrg# ----------------------------
319f1d9476Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
329f1d9476Smrg# generated from the m4 files accompanying Automake X.Y.
339f1d9476Smrg# (This private macro should not be called outside this file.)
349f1d9476SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358b5ec993Smrg[am__api_version='1.17'
369f1d9476Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379f1d9476Smrgdnl require some minimum version.  Point them to the right macro.
388b5ec993Smrgm4_if([$1], [1.17], [],
399f1d9476Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409f1d9476Smrg])
41f33d31a3Smrg
429f1d9476Smrg# _AM_AUTOCONF_VERSION(VERSION)
439f1d9476Smrg# -----------------------------
449f1d9476Smrg# aclocal traces this macro to find the Autoconf version.
459f1d9476Smrg# This is a private macro too.  Using m4_define simplifies
469f1d9476Smrg# the logic in aclocal, which can simply ignore this definition.
479f1d9476Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48f33d31a3Smrg
499f1d9476Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
509f1d9476Smrg# -------------------------------
519f1d9476Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
529f1d9476Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
539f1d9476SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548b5ec993Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
559f1d9476Smrgm4_ifndef([AC_AUTOCONF_VERSION],
569f1d9476Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
579f1d9476Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58f33d31a3Smrg
599f1d9476Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60f33d31a3Smrg
618b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
629f1d9476Smrg#
639f1d9476Smrg# This file is free software; the Free Software Foundation
649f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
659f1d9476Smrg# with or without modifications, as long as this notice is preserved.
66f33d31a3Smrg
679f1d9476Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
689f1d9476Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
699f1d9476Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
709f1d9476Smrg#
719f1d9476Smrg# Of course, Automake must honor this variable whenever it calls a
729f1d9476Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
739f1d9476Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
749f1d9476Smrg# depending on how configure is run.  This is pretty annoying, since
759f1d9476Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
769f1d9476Smrg# source directory, any form will work fine, but in subdirectories a
779f1d9476Smrg# relative path needs to be adjusted first.
789f1d9476Smrg#
799f1d9476Smrg# $ac_aux_dir/missing
809f1d9476Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
819f1d9476Smrg# $top_srcdir/$ac_aux_dir/missing
829f1d9476Smrg#    fails if $ac_aux_dir is absolute,
839f1d9476Smrg#    fails when called from a subdirectory in a VPATH build with
849f1d9476Smrg#          a relative $ac_aux_dir
859f1d9476Smrg#
869f1d9476Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
879f1d9476Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
889f1d9476Smrg# harmless because $srcdir is '.', but things will broke when you
899f1d9476Smrg# start a VPATH build or use an absolute $srcdir.
909f1d9476Smrg#
919f1d9476Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
929f1d9476Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
939f1d9476Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
949f1d9476Smrg# and then we would define $MISSING as
959f1d9476Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
969f1d9476Smrg# This will work as long as MISSING is not called from configure, because
979f1d9476Smrg# unfortunately $(top_srcdir) has no meaning in configure.
989f1d9476Smrg# However there are other variables, like CC, which are often used in
999f1d9476Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1009f1d9476Smrg#
1019f1d9476Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1029f1d9476Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1039f1d9476Smrg# configured tree to be moved without reconfiguration.
104f33d31a3Smrg
1059f1d9476SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1069f1d9476Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1079f1d9476Smrg# Expand $ac_aux_dir to an absolute path.
1089f1d9476Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1099f1d9476Smrg])
110f33d31a3Smrg
1119f1d9476Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112f33d31a3Smrg
1138b5ec993Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
1149f1d9476Smrg#
1159f1d9476Smrg# This file is free software; the Free Software Foundation
1169f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
1179f1d9476Smrg# with or without modifications, as long as this notice is preserved.
118f33d31a3Smrg
1199f1d9476Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1209f1d9476Smrg# -------------------------------------
1219f1d9476Smrg# Define a conditional.
1229f1d9476SmrgAC_DEFUN([AM_CONDITIONAL],
1239f1d9476Smrg[AC_PREREQ([2.52])dnl
1249f1d9476Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1259f1d9476Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1269f1d9476SmrgAC_SUBST([$1_TRUE])dnl
1279f1d9476SmrgAC_SUBST([$1_FALSE])dnl
1289f1d9476Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1299f1d9476Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1309f1d9476Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1319f1d9476Smrgif $2; then
1329f1d9476Smrg  $1_TRUE=
1339f1d9476Smrg  $1_FALSE='#'
1349f1d9476Smrgelse
1359f1d9476Smrg  $1_TRUE='#'
1369f1d9476Smrg  $1_FALSE=
1379f1d9476Smrgfi
1389f1d9476SmrgAC_CONFIG_COMMANDS_PRE(
1399f1d9476Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1409f1d9476Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1419f1d9476SmrgUsually this means the macro was only invoked conditionally.]])
1429f1d9476Smrgfi])])
143f33d31a3Smrg
1448b5ec993Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
1459f1d9476Smrg#
1469f1d9476Smrg# This file is free software; the Free Software Foundation
1479f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
1489f1d9476Smrg# with or without modifications, as long as this notice is preserved.
149f33d31a3Smrg
150f33d31a3Smrg
1519f1d9476Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1529f1d9476Smrg# written in clear, in which case automake, when reading aclocal.m4,
1539f1d9476Smrg# will think it sees a *use*, and therefore will trigger all it's
1549f1d9476Smrg# C support machinery.  Also note that it means that autoscan, seeing
1559f1d9476Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156f33d31a3Smrg
157f33d31a3Smrg
1589f1d9476Smrg# _AM_DEPENDENCIES(NAME)
1599f1d9476Smrg# ----------------------
1609f1d9476Smrg# See how the compiler implements dependency checking.
1619f1d9476Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1629f1d9476Smrg# We try a few techniques and use that to set a single cache variable.
1639f1d9476Smrg#
1649f1d9476Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1659f1d9476Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1669f1d9476Smrg# dependency, and given that the user is not expected to run this macro,
1679f1d9476Smrg# just rely on AC_PROG_CC.
1689f1d9476SmrgAC_DEFUN([_AM_DEPENDENCIES],
1699f1d9476Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1709f1d9476SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1719f1d9476SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1729f1d9476SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173f33d31a3Smrg
1749f1d9476Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1759f1d9476Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1769f1d9476Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1779f1d9476Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1789f1d9476Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1799f1d9476Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1809f1d9476Smrg                    [depcc="$$1"   am_compiler_list=])
181f33d31a3Smrg
1829f1d9476SmrgAC_CACHE_CHECK([dependency style of $depcc],
1839f1d9476Smrg               [am_cv_$1_dependencies_compiler_type],
1849f1d9476Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1859f1d9476Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1869f1d9476Smrg  # making bogus files that we don't know about and never remove.  For
1879f1d9476Smrg  # instance it was reported that on HP-UX the gcc test will end up
1889f1d9476Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1899f1d9476Smrg  # in D".
1909f1d9476Smrg  rm -rf conftest.dir
1919f1d9476Smrg  mkdir conftest.dir
1929f1d9476Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1939f1d9476Smrg  # using a relative directory.
1949f1d9476Smrg  cp "$am_depcomp" conftest.dir
1959f1d9476Smrg  cd conftest.dir
1969f1d9476Smrg  # We will build objects and dependencies in a subdirectory because
1979f1d9476Smrg  # it helps to detect inapplicable dependency modes.  For instance
1989f1d9476Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1999f1d9476Smrg  # side effect of compilation, but ICC will put the dependencies in
2009f1d9476Smrg  # the current directory while Tru64 will put them in the object
2019f1d9476Smrg  # directory.
2029f1d9476Smrg  mkdir sub
203f33d31a3Smrg
2049f1d9476Smrg  am_cv_$1_dependencies_compiler_type=none
2059f1d9476Smrg  if test "$am_compiler_list" = ""; then
2069f1d9476Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2079f1d9476Smrg  fi
2089f1d9476Smrg  am__universal=false
2099f1d9476Smrg  m4_case([$1], [CC],
2109f1d9476Smrg    [case " $depcc " in #(
2119f1d9476Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2129f1d9476Smrg     esac],
2139f1d9476Smrg    [CXX],
2149f1d9476Smrg    [case " $depcc " in #(
2159f1d9476Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2169f1d9476Smrg     esac])
217f33d31a3Smrg
2189f1d9476Smrg  for depmode in $am_compiler_list; do
2199f1d9476Smrg    # Setup a source with many dependencies, because some compilers
2209f1d9476Smrg    # like to wrap large dependency lists on column 80 (with \), and
2219f1d9476Smrg    # we should not choose a depcomp mode which is confused by this.
2229f1d9476Smrg    #
2239f1d9476Smrg    # We need to recreate these files for each test, as the compiler may
2249f1d9476Smrg    # overwrite some of them when testing with obscure command lines.
2259f1d9476Smrg    # This happens at least with the AIX C compiler.
2269f1d9476Smrg    : > sub/conftest.c
2279f1d9476Smrg    for i in 1 2 3 4 5 6; do
2289f1d9476Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2299f1d9476Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2309f1d9476Smrg      # Solaris 10 /bin/sh.
2319f1d9476Smrg      echo '/* dummy */' > sub/conftst$i.h
2329f1d9476Smrg    done
2339f1d9476Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234f33d31a3Smrg
2359f1d9476Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2369f1d9476Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2379f1d9476Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2389f1d9476Smrg    # versions had trouble with output in subdirs.
2399f1d9476Smrg    am__obj=sub/conftest.${OBJEXT-o}
2409f1d9476Smrg    am__minus_obj="-o $am__obj"
2419f1d9476Smrg    case $depmode in
2429f1d9476Smrg    gcc)
2439f1d9476Smrg      # This depmode causes a compiler race in universal mode.
2449f1d9476Smrg      test "$am__universal" = false || continue
2459f1d9476Smrg      ;;
2469f1d9476Smrg    nosideeffect)
2479f1d9476Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2489f1d9476Smrg      # only be used when explicitly requested.
2499f1d9476Smrg      if test "x$enable_dependency_tracking" = xyes; then
2509f1d9476Smrg	continue
2519f1d9476Smrg      else
2529f1d9476Smrg	break
2539f1d9476Smrg      fi
2549f1d9476Smrg      ;;
2559f1d9476Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2569f1d9476Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2579f1d9476Smrg      # not run yet.  These depmodes are late enough in the game, and
2589f1d9476Smrg      # so weak that their functioning should not be impacted.
2599f1d9476Smrg      am__obj=conftest.${OBJEXT-o}
2609f1d9476Smrg      am__minus_obj=
2619f1d9476Smrg      ;;
2629f1d9476Smrg    none) break ;;
2639f1d9476Smrg    esac
2649f1d9476Smrg    if depmode=$depmode \
2659f1d9476Smrg       source=sub/conftest.c object=$am__obj \
2669f1d9476Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2679f1d9476Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2689f1d9476Smrg         >/dev/null 2>conftest.err &&
2699f1d9476Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2709f1d9476Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2719f1d9476Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2729f1d9476Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2739f1d9476Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2749f1d9476Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2759f1d9476Smrg      # that says an option was ignored or not supported.
2768b5ec993Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
2779f1d9476Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2789f1d9476Smrg      # The diagnosis changed in icc 8.0:
2799f1d9476Smrg      #   icc: Command line remark: option '-MP' not supported
2809f1d9476Smrg      if (grep 'ignoring option' conftest.err ||
2819f1d9476Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2829f1d9476Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2839f1d9476Smrg        break
2849f1d9476Smrg      fi
2859f1d9476Smrg    fi
2869f1d9476Smrg  done
287f33d31a3Smrg
2889f1d9476Smrg  cd ..
2899f1d9476Smrg  rm -rf conftest.dir
2909f1d9476Smrgelse
2919f1d9476Smrg  am_cv_$1_dependencies_compiler_type=none
2929f1d9476Smrgfi
2939f1d9476Smrg])
2949f1d9476SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2959f1d9476SmrgAM_CONDITIONAL([am__fastdep$1], [
2969f1d9476Smrg  test "x$enable_dependency_tracking" != xno \
2979f1d9476Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2989f1d9476Smrg])
299f33d31a3Smrg
300f33d31a3Smrg
3019f1d9476Smrg# AM_SET_DEPDIR
3029f1d9476Smrg# -------------
3039f1d9476Smrg# Choose a directory name for dependency files.
3049f1d9476Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3059f1d9476SmrgAC_DEFUN([AM_SET_DEPDIR],
3069f1d9476Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3079f1d9476SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3089f1d9476Smrg])
309f33d31a3Smrg
310f33d31a3Smrg
3119f1d9476Smrg# AM_DEP_TRACK
3129f1d9476Smrg# ------------
3139f1d9476SmrgAC_DEFUN([AM_DEP_TRACK],
3149f1d9476Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3159f1d9476SmrgAS_HELP_STRING(
3169f1d9476Smrg  [--enable-dependency-tracking],
3179f1d9476Smrg  [do not reject slow dependency extractors])
3189f1d9476SmrgAS_HELP_STRING(
3199f1d9476Smrg  [--disable-dependency-tracking],
3209f1d9476Smrg  [speeds up one-time build])])
3219f1d9476Smrgif test "x$enable_dependency_tracking" != xno; then
3229f1d9476Smrg  am_depcomp="$ac_aux_dir/depcomp"
3239f1d9476Smrg  AMDEPBACKSLASH='\'
3249f1d9476Smrg  am__nodep='_no'
3259f1d9476Smrgfi
3269f1d9476SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3279f1d9476SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3289f1d9476Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3299f1d9476SmrgAC_SUBST([am__nodep])dnl
3309f1d9476Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3319f1d9476Smrg])
332f33d31a3Smrg
3339f1d9476Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334f33d31a3Smrg
3358b5ec993Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336f33d31a3Smrg#
3379f1d9476Smrg# This file is free software; the Free Software Foundation
3389f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
3399f1d9476Smrg# with or without modifications, as long as this notice is preserved.
340f33d31a3Smrg
3419f1d9476Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3429f1d9476Smrg# ------------------------------
3439f1d9476SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3449f1d9476Smrg[{
3459f1d9476Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3469f1d9476Smrg  # are listed without --file.  Let's play safe and only enable the eval
3479f1d9476Smrg  # if we detect the quoting.
3489f1d9476Smrg  # TODO: see whether this extra hack can be removed once we start
3499f1d9476Smrg  # requiring Autoconf 2.70 or later.
3509f1d9476Smrg  AS_CASE([$CONFIG_FILES],
3519f1d9476Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3529f1d9476Smrg          [*], [set x $CONFIG_FILES])
3539f1d9476Smrg  shift
3549f1d9476Smrg  # Used to flag and report bootstrapping failures.
3559f1d9476Smrg  am_rc=0
3569f1d9476Smrg  for am_mf
3579f1d9476Smrg  do
3589f1d9476Smrg    # Strip MF so we end up with the name of the file.
3599f1d9476Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3609f1d9476Smrg    # Check whether this is an Automake generated Makefile which includes
3619f1d9476Smrg    # dependency-tracking related rules and includes.
3629f1d9476Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3639f1d9476Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3649f1d9476Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3659f1d9476Smrg      || continue
3669f1d9476Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3679f1d9476Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3689f1d9476Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3699f1d9476Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3709f1d9476Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3719f1d9476Smrg  done
3729f1d9476Smrg  if test $am_rc -ne 0; then
3739f1d9476Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3749f1d9476Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3759f1d9476Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3769f1d9476Smrg    necessary).  You can also try re-running configure with the
3779f1d9476Smrg    '--disable-dependency-tracking' option to at least be able to build
3789f1d9476Smrg    the package (albeit without support for automatic dependency tracking).])
3799f1d9476Smrg  fi
3809f1d9476Smrg  AS_UNSET([am_dirpart])
3819f1d9476Smrg  AS_UNSET([am_filepart])
3829f1d9476Smrg  AS_UNSET([am_mf])
3839f1d9476Smrg  AS_UNSET([am_rc])
3849f1d9476Smrg  rm -f conftest-deps.mk
3859f1d9476Smrg}
3869f1d9476Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387f33d31a3Smrg
388f33d31a3Smrg
3899f1d9476Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3909f1d9476Smrg# -----------------------------
3919f1d9476Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392f33d31a3Smrg#
3939f1d9476Smrg# This code is only required when automatic dependency tracking is enabled.
3949f1d9476Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3959f1d9476Smrg# order to bootstrap the dependency handling code.
3969f1d9476SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3979f1d9476Smrg[AC_CONFIG_COMMANDS([depfiles],
3989f1d9476Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3999f1d9476Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400f33d31a3Smrg
4019f1d9476Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402f33d31a3Smrg
4038b5ec993Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4049f1d9476Smrg#
4059f1d9476Smrg# This file is free software; the Free Software Foundation
4069f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
4079f1d9476Smrg# with or without modifications, as long as this notice is preserved.
408f33d31a3Smrg
4099f1d9476Smrg# This macro actually does too much.  Some checks are only needed if
4109f1d9476Smrg# your package does certain things.  But this isn't really a big deal.
411f33d31a3Smrg
4129f1d9476Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4139f1d9476Smrgm4_define([AC_PROG_CC],
4149f1d9476Smrgm4_defn([AC_PROG_CC])
4159f1d9476Smrg[_AM_PROG_CC_C_O
4169f1d9476Smrg])
417f33d31a3Smrg
4189f1d9476Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4199f1d9476Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4209f1d9476Smrg# -----------------------------------------------
4219f1d9476Smrg# The call with PACKAGE and VERSION arguments is the old style
4229f1d9476Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4239f1d9476Smrg# and VERSION should now be passed to AC_INIT and removed from
4249f1d9476Smrg# the call to AM_INIT_AUTOMAKE.
4259f1d9476Smrg# We support both call styles for the transition.  After
4269f1d9476Smrg# the next Automake release, Autoconf can make the AC_INIT
4279f1d9476Smrg# arguments mandatory, and then we can depend on a new Autoconf
4289f1d9476Smrg# release and drop the old call support.
4299f1d9476SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4309f1d9476Smrg[AC_PREREQ([2.65])dnl
4319f1d9476Smrgm4_ifdef([_$0_ALREADY_INIT],
4329f1d9476Smrg  [m4_fatal([$0 expanded multiple times
4339f1d9476Smrg]m4_defn([_$0_ALREADY_INIT]))],
4349f1d9476Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4359f1d9476Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4369f1d9476Smrgdnl the ones we care about.
4379f1d9476Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4389f1d9476SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4399f1d9476SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4409f1d9476Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4419f1d9476Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4429f1d9476Smrg  # is not polluted with repeated "-I."
4439f1d9476Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4449f1d9476Smrg  # test to see if srcdir already configured
4459f1d9476Smrg  if test -f $srcdir/config.status; then
4469f1d9476Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4479f1d9476Smrg  fi
448f33d31a3Smrgfi
449f33d31a3Smrg
4509f1d9476Smrg# test whether we have cygpath
4519f1d9476Smrgif test -z "$CYGPATH_W"; then
4529f1d9476Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4539f1d9476Smrg    CYGPATH_W='cygpath -w'
4549f1d9476Smrg  else
4559f1d9476Smrg    CYGPATH_W=echo
4569f1d9476Smrg  fi
457f33d31a3Smrgfi
4589f1d9476SmrgAC_SUBST([CYGPATH_W])
459f33d31a3Smrg
4609f1d9476Smrg# Define the identity of the package.
4619f1d9476Smrgdnl Distinguish between old-style and new-style calls.
4629f1d9476Smrgm4_ifval([$2],
4639f1d9476Smrg[AC_DIAGNOSE([obsolete],
4649f1d9476Smrg             [$0: two- and three-arguments forms are deprecated.])
4659f1d9476Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4669f1d9476Smrg AC_SUBST([PACKAGE], [$1])dnl
4679f1d9476Smrg AC_SUBST([VERSION], [$2])],
4689f1d9476Smrg[_AM_SET_OPTIONS([$1])dnl
4699f1d9476Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4709f1d9476Smrgm4_if(
4719f1d9476Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4729f1d9476Smrg  [ok:ok],,
4739f1d9476Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4749f1d9476Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4759f1d9476Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476f33d31a3Smrg
4779f1d9476Smrg_AM_IF_OPTION([no-define],,
4789f1d9476Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4799f1d9476Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480f33d31a3Smrg
4819f1d9476Smrg# Some tools Automake needs.
4829f1d9476SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4839f1d9476SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4849f1d9476SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4859f1d9476SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4869f1d9476SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4879f1d9476SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4889f1d9476SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4899f1d9476SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4909f1d9476SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4919f1d9476SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4929f1d9476Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4939f1d9476Smrg# dies out for good.  For more background, see:
4949f1d9476Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4959f1d9476Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4969f1d9476SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4979f1d9476Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4989f1d9476Smrg# system "awk" is bad on some platforms.
4999f1d9476SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5009f1d9476SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5019f1d9476SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5029f1d9476Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5039f1d9476Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5049f1d9476Smrg			     [_AM_PROG_TAR([v7])])])
5059f1d9476Smrg_AM_IF_OPTION([no-dependencies],,
5069f1d9476Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5079f1d9476Smrg		  [_AM_DEPENDENCIES([CC])],
5089f1d9476Smrg		  [m4_define([AC_PROG_CC],
5099f1d9476Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5109f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5119f1d9476Smrg		  [_AM_DEPENDENCIES([CXX])],
5129f1d9476Smrg		  [m4_define([AC_PROG_CXX],
5139f1d9476Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5149f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5159f1d9476Smrg		  [_AM_DEPENDENCIES([OBJC])],
5169f1d9476Smrg		  [m4_define([AC_PROG_OBJC],
5179f1d9476Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5189f1d9476SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5199f1d9476Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5209f1d9476Smrg		  [m4_define([AC_PROG_OBJCXX],
5219f1d9476Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5229f1d9476Smrg])
5239f1d9476Smrg# Variables for tags utilities; see am/tags.am
5249f1d9476Smrgif test -z "$CTAGS"; then
5259f1d9476Smrg  CTAGS=ctags
5269f1d9476Smrgfi
5279f1d9476SmrgAC_SUBST([CTAGS])
5289f1d9476Smrgif test -z "$ETAGS"; then
5299f1d9476Smrg  ETAGS=etags
5309f1d9476Smrgfi
5319f1d9476SmrgAC_SUBST([ETAGS])
5329f1d9476Smrgif test -z "$CSCOPE"; then
5339f1d9476Smrg  CSCOPE=cscope
5349f1d9476Smrgfi
5359f1d9476SmrgAC_SUBST([CSCOPE])
536f33d31a3Smrg
5378b5ec993SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5389f1d9476Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5399f1d9476Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5409f1d9476Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5419f1d9476SmrgAC_CONFIG_COMMANDS_PRE(dnl
5429f1d9476Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5439f1d9476Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544f33d31a3Smrg
5458b5ec993SmrgAC_REQUIRE([_AM_PROG_RM_F])
5468b5ec993SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
547f33d31a3Smrg
5489f1d9476Smrgdnl The trailing newline in this macro's definition is deliberate, for
5499f1d9476Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5509f1d9476Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5519f1d9476Smrg])
552f33d31a3Smrg
5539f1d9476Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5549f1d9476Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5559f1d9476Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5569f1d9476Smrgm4_define([_AC_COMPILER_EXEEXT],
5579f1d9476Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558f33d31a3Smrg
5599f1d9476Smrg# When config.status generates a header, we must update the stamp-h file.
5609f1d9476Smrg# This file resides in the same directory as the config header
5619f1d9476Smrg# that is generated.  The stamp files are numbered to have different names.
562f33d31a3Smrg
5639f1d9476Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5649f1d9476Smrg# loop where config.status creates the headers, so we can generate
5659f1d9476Smrg# our stamp files there.
5669f1d9476SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5679f1d9476Smrg[# Compute $1's index in $config_headers.
5689f1d9476Smrg_am_arg=$1
5699f1d9476Smrg_am_stamp_count=1
5709f1d9476Smrgfor _am_header in $config_headers :; do
5719f1d9476Smrg  case $_am_header in
5729f1d9476Smrg    $_am_arg | $_am_arg:* )
5739f1d9476Smrg      break ;;
5749f1d9476Smrg    * )
5759f1d9476Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5769f1d9476Smrg  esac
5779f1d9476Smrgdone
5789f1d9476Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579f33d31a3Smrg
5808b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5819f1d9476Smrg#
5829f1d9476Smrg# This file is free software; the Free Software Foundation
5839f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
5849f1d9476Smrg# with or without modifications, as long as this notice is preserved.
5859f1d9476Smrg
5869f1d9476Smrg# AM_PROG_INSTALL_SH
5879f1d9476Smrg# ------------------
5889f1d9476Smrg# Define $install_sh.
5899f1d9476SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5909f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5919f1d9476Smrgif test x"${install_sh+set}" != xset; then
5929f1d9476Smrg  case $am_aux_dir in
5939f1d9476Smrg  *\ * | *\	*)
5949f1d9476Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5959f1d9476Smrg  *)
5969f1d9476Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5979f1d9476Smrg  esac
5989f1d9476Smrgfi
5999f1d9476SmrgAC_SUBST([install_sh])])
6009f1d9476Smrg
6018b5ec993Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
6029f1d9476Smrg#
6039f1d9476Smrg# This file is free software; the Free Software Foundation
6049f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6059f1d9476Smrg# with or without modifications, as long as this notice is preserved.
6069f1d9476Smrg
6079f1d9476Smrg# Check whether the underlying file-system supports filenames
6089f1d9476Smrg# with a leading dot.  For instance MS-DOS doesn't.
6099f1d9476SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6109f1d9476Smrg[rm -rf .tst 2>/dev/null
6119f1d9476Smrgmkdir .tst 2>/dev/null
6129f1d9476Smrgif test -d .tst; then
6139f1d9476Smrg  am__leading_dot=.
614f33d31a3Smrgelse
6159f1d9476Smrg  am__leading_dot=_
616f33d31a3Smrgfi
6179f1d9476Smrgrmdir .tst 2>/dev/null
6189f1d9476SmrgAC_SUBST([am__leading_dot])])
619f33d31a3Smrg
6209f1d9476Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621f33d31a3Smrg
6228b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6239f1d9476Smrg#
6249f1d9476Smrg# This file is free software; the Free Software Foundation
6259f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6269f1d9476Smrg# with or without modifications, as long as this notice is preserved.
627f33d31a3Smrg
6289f1d9476Smrg# AM_MAKE_INCLUDE()
6299f1d9476Smrg# -----------------
6309f1d9476Smrg# Check whether make has an 'include' directive that can support all
6319f1d9476Smrg# the idioms we need for our automatic dependency tracking code.
6329f1d9476SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6339f1d9476Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6349f1d9476Smrgcat > confinc.mk << 'END'
6359f1d9476Smrgam__doit:
6369f1d9476Smrg	@echo this is the am__doit target >confinc.out
6379f1d9476Smrg.PHONY: am__doit
6389f1d9476SmrgEND
6399f1d9476Smrgam__include="#"
6409f1d9476Smrgam__quote=
6419f1d9476Smrg# BSD make does it like this.
6429f1d9476Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6439f1d9476Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6449f1d9476Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6459f1d9476Smrg_am_result=no
6469f1d9476Smrgfor s in GNU BSD; do
6479f1d9476Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6489f1d9476Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6499f1d9476Smrg      ['0:this is the am__doit target'],
6509f1d9476Smrg      [AS_CASE([$s],
6519f1d9476Smrg          [BSD], [am__include='.include' am__quote='"'],
6529f1d9476Smrg          [am__include='include' am__quote=''])])
6539f1d9476Smrg  if test "$am__include" != "#"; then
6549f1d9476Smrg    _am_result="yes ($s style)"
6559f1d9476Smrg    break
6569f1d9476Smrg  fi
6579f1d9476Smrgdone
6589f1d9476Smrgrm -f confinc.* confmf.*
6599f1d9476SmrgAC_MSG_RESULT([${_am_result}])
6609f1d9476SmrgAC_SUBST([am__include])])
6619f1d9476SmrgAC_SUBST([am__quote])])
662f33d31a3Smrg
6639f1d9476Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664f33d31a3Smrg
6658b5ec993Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
666f33d31a3Smrg#
6679f1d9476Smrg# This file is free software; the Free Software Foundation
6689f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
6699f1d9476Smrg# with or without modifications, as long as this notice is preserved.
670f33d31a3Smrg
6719f1d9476Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6729f1d9476Smrg# ------------------------------
6739f1d9476SmrgAC_DEFUN([AM_MISSING_PROG],
6749f1d9476Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6759f1d9476Smrg$1=${$1-"${am_missing_run}$2"}
6769f1d9476SmrgAC_SUBST($1)])
677f33d31a3Smrg
6789f1d9476Smrg# AM_MISSING_HAS_RUN
6799f1d9476Smrg# ------------------
6809f1d9476Smrg# Define MISSING if not defined so far and test if it is modern enough.
6819f1d9476Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
6829f1d9476SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6839f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6849f1d9476SmrgAC_REQUIRE_AUX_FILE([missing])dnl
6859f1d9476Smrgif test x"${MISSING+set}" != xset; then
6869f1d9476Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687f33d31a3Smrgfi
6889f1d9476Smrg# Use eval to expand $SHELL
6899f1d9476Smrgif eval "$MISSING --is-lightweight"; then
6909f1d9476Smrg  am_missing_run="$MISSING "
6919f1d9476Smrgelse
6929f1d9476Smrg  am_missing_run=
6939f1d9476Smrg  AC_MSG_WARN(['missing' script is too old or missing])
694f33d31a3Smrgfi
6959f1d9476Smrg])
696f33d31a3Smrg
6979f1d9476Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698f33d31a3Smrg
6998b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7009f1d9476Smrg#
7019f1d9476Smrg# This file is free software; the Free Software Foundation
7029f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7039f1d9476Smrg# with or without modifications, as long as this notice is preserved.
704f33d31a3Smrg
7059f1d9476Smrg# _AM_MANGLE_OPTION(NAME)
7069f1d9476Smrg# -----------------------
7079f1d9476SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7089f1d9476Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709f33d31a3Smrg
7109f1d9476Smrg# _AM_SET_OPTION(NAME)
7119f1d9476Smrg# --------------------
7129f1d9476Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7139f1d9476SmrgAC_DEFUN([_AM_SET_OPTION],
7149f1d9476Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715f33d31a3Smrg
7169f1d9476Smrg# _AM_SET_OPTIONS(OPTIONS)
7179f1d9476Smrg# ------------------------
7189f1d9476Smrg# OPTIONS is a space-separated list of Automake options.
7199f1d9476SmrgAC_DEFUN([_AM_SET_OPTIONS],
7209f1d9476Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7219f1d9476Smrg
7229f1d9476Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7239f1d9476Smrg# -------------------------------------------
7249f1d9476Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7259f1d9476SmrgAC_DEFUN([_AM_IF_OPTION],
7269f1d9476Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7279f1d9476Smrg
7288b5ec993Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
729f33d31a3Smrg#
7309f1d9476Smrg# This file is free software; the Free Software Foundation
7319f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7329f1d9476Smrg# with or without modifications, as long as this notice is preserved.
733f33d31a3Smrg
7349f1d9476Smrg# _AM_PROG_CC_C_O
7359f1d9476Smrg# ---------------
7369f1d9476Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7379f1d9476Smrg# to automatically call this.
7389f1d9476SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7399f1d9476Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7409f1d9476SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7419f1d9476SmrgAC_LANG_PUSH([C])dnl
7429f1d9476SmrgAC_CACHE_CHECK(
7439f1d9476Smrg  [whether $CC understands -c and -o together],
7449f1d9476Smrg  [am_cv_prog_cc_c_o],
7459f1d9476Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7469f1d9476Smrg  # Make sure it works both with $CC and with simple cc.
7479f1d9476Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7489f1d9476Smrg  # compilers refuse to overwrite an existing .o file with -o,
7499f1d9476Smrg  # though they will create one.
7509f1d9476Smrg  am_cv_prog_cc_c_o=yes
7519f1d9476Smrg  for am_i in 1 2; do
7529f1d9476Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7539f1d9476Smrg         && test -f conftest2.$ac_objext; then
7549f1d9476Smrg      : OK
7559f1d9476Smrg    else
7569f1d9476Smrg      am_cv_prog_cc_c_o=no
7579f1d9476Smrg      break
7589f1d9476Smrg    fi
7599f1d9476Smrg  done
7609f1d9476Smrg  rm -f core conftest*
7619f1d9476Smrg  unset am_i])
7629f1d9476Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7639f1d9476Smrg   # Losing compiler, so override with the script.
7649f1d9476Smrg   # FIXME: It is wrong to rewrite CC.
7659f1d9476Smrg   # But if we don't then we get into trouble of one sort or another.
7669f1d9476Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7679f1d9476Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7689f1d9476Smrg   CC="$am_aux_dir/compile $CC"
769f33d31a3Smrgfi
7709f1d9476SmrgAC_LANG_POP([C])])
771f33d31a3Smrg
7729f1d9476Smrg# For backward compatibility.
7739f1d9476SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774f33d31a3Smrg
7758b5ec993Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7768b5ec993Smrg#
7778b5ec993Smrg# This file is free software; the Free Software Foundation
7788b5ec993Smrg# gives unlimited permission to copy and/or distribute it,
7798b5ec993Smrg# with or without modifications, as long as this notice is preserved.
7808b5ec993Smrg
7818b5ec993Smrg# _AM_PROG_RM_F
7828b5ec993Smrg# ---------------
7838b5ec993Smrg# Check whether 'rm -f' without any arguments works.
7848b5ec993Smrg# https://bugs.gnu.org/10828
7858b5ec993SmrgAC_DEFUN([_AM_PROG_RM_F],
7868b5ec993Smrg[am__rm_f_notfound=
7878b5ec993SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7888b5ec993SmrgAC_SUBST(am__rm_f_notfound)
7898b5ec993Smrg])
7908b5ec993Smrg
7918b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792f33d31a3Smrg#
7939f1d9476Smrg# This file is free software; the Free Software Foundation
7949f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
7959f1d9476Smrg# with or without modifications, as long as this notice is preserved.
796f33d31a3Smrg
7979f1d9476Smrg# AM_RUN_LOG(COMMAND)
7989f1d9476Smrg# -------------------
7999f1d9476Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8009f1d9476Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8019f1d9476SmrgAC_DEFUN([AM_RUN_LOG],
8029f1d9476Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8039f1d9476Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8049f1d9476Smrg   ac_status=$?
8059f1d9476Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8069f1d9476Smrg   (exit $ac_status); }])
8079f1d9476Smrg
8089f1d9476Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8099f1d9476Smrg
8108b5ec993Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
811f33d31a3Smrg#
8129f1d9476Smrg# This file is free software; the Free Software Foundation
8139f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
8149f1d9476Smrg# with or without modifications, as long as this notice is preserved.
815f33d31a3Smrg
8168b5ec993Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
8178b5ec993Smrg# ----------------------------
8188b5ec993SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8198b5ec993SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8208b5ec993Smrg               am_cv_sleep_fractional_seconds, [dnl
8218b5ec993SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8228b5ec993Smrg                                 [am_cv_sleep_fractional_seconds=no])
8238b5ec993Smrg])])
8248b5ec993Smrg
8258b5ec993Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8268b5ec993Smrg# -----------------------------------
8278b5ec993Smrg# Determine the filesystem's resolution for file modification
8288b5ec993Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
8298b5ec993Smrg# of only two seconds, even with the most recent "exFAT" extensions.
8308b5ec993Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8318b5ec993Smrg# nanosecond, matching clock_gettime.  However, it is probably not
8328b5ec993Smrg# possible to delay execution of a shell script for less than one
8338b5ec993Smrg# millisecond, due to process creation overhead and scheduling
8348b5ec993Smrg# granularity, so we don't check for anything finer than that. (See below.)
8358b5ec993SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8368b5ec993SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8378b5ec993SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8388b5ec993Smrg               am_cv_filesystem_timestamp_resolution, [dnl
8398b5ec993Smrg# Default to the worst case.
8408b5ec993Smrgam_cv_filesystem_timestamp_resolution=2
8418b5ec993Smrg
8428b5ec993Smrg# Only try to go finer than 1 sec if sleep can do it.
8438b5ec993Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8448b5ec993Smrg# - 1 sec is not much of a win compared to 2 sec, and
8458b5ec993Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
8468b5ec993Smrg# 
8478b5ec993Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
8488b5ec993Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8498b5ec993Smrg# exchange for not incurring the 2s delay for running the test for all
8508b5ec993Smrg# packages.
8518b5ec993Smrg#
8528b5ec993Smrgam_try_resolutions=
8538b5ec993Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8548b5ec993Smrg  # Even a millisecond often causes a bunch of false positives,
8558b5ec993Smrg  # so just try a hundredth of a second. The time saved between .001 and
8568b5ec993Smrg  # .01 is not terribly consequential.
8578b5ec993Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8588b5ec993Smrgfi
8598b5ec993Smrg
8608b5ec993Smrg# In order to catch current-generation FAT out, we must *modify* files
8618b5ec993Smrg# that already exist; the *creation* timestamp is finer.  Use names
8628b5ec993Smrg# that make ls -t sort them differently when they have equal
8638b5ec993Smrg# timestamps than when they have distinct timestamps, keeping
8648b5ec993Smrg# in mind that ls -t prints the *newest* file first.
8658b5ec993Smrgrm -f conftest.ts?
8668b5ec993Smrg: > conftest.ts1
8678b5ec993Smrg: > conftest.ts2
8688b5ec993Smrg: > conftest.ts3
8698b5ec993Smrg
8708b5ec993Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8718b5ec993Smrg# clobber the current shell's arguments. (Outer-level square brackets
8728b5ec993Smrg# are removed by m4; they're present so that m4 does not expand
8738b5ec993Smrg# <dollar><star>; be careful, easy to get confused.)
8748b5ec993Smrgif (
8758b5ec993Smrg     set X `[ls -t conftest.ts[12]]` &&
8768b5ec993Smrg     {
8778b5ec993Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8788b5ec993Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8798b5ec993Smrg     }
8808b5ec993Smrg); then :; else
8818b5ec993Smrg  # If neither matched, then we have a broken ls.  This can happen
8828b5ec993Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8838b5ec993Smrg  # broken ls alias from the environment.  This has actually
8848b5ec993Smrg  # happened.  Such a system could not be considered "sane".
8858b5ec993Smrg  _AS_ECHO_UNQUOTED(
8868b5ec993Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8878b5ec993Smrg    [AS_MESSAGE_LOG_FD])
8888b5ec993Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8898b5ec993SmrgMake sure there is not a broken ls alias in your environment.])
8908b5ec993Smrgfi
8918b5ec993Smrg
8928b5ec993Smrgfor am_try_res in $am_try_resolutions; do
8938b5ec993Smrg  # Any one fine-grained sleep might happen to cross the boundary
8948b5ec993Smrg  # between two values of a coarser actual resolution, but if we do
8958b5ec993Smrg  # two fine-grained sleeps in a row, at least one of them will fall
8968b5ec993Smrg  # entirely within a coarse interval.
8978b5ec993Smrg  echo alpha > conftest.ts1
8988b5ec993Smrg  sleep $am_try_res
8998b5ec993Smrg  echo beta > conftest.ts2
9008b5ec993Smrg  sleep $am_try_res
9018b5ec993Smrg  echo gamma > conftest.ts3
9028b5ec993Smrg
9038b5ec993Smrg  # We assume that 'ls -t' will make use of high-resolution
9048b5ec993Smrg  # timestamps if the operating system supports them at all.
9058b5ec993Smrg  if (set X `ls -t conftest.ts?` &&
9068b5ec993Smrg      test "$[]2" = conftest.ts3 &&
9078b5ec993Smrg      test "$[]3" = conftest.ts2 &&
9088b5ec993Smrg      test "$[]4" = conftest.ts1); then
9098b5ec993Smrg    #
9108b5ec993Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9118b5ec993Smrg    # because we don't need to test make.
9128b5ec993Smrg    make_ok=true
9138b5ec993Smrg    if test $am_try_res != 1; then
9148b5ec993Smrg      # But if we've succeeded so far with a subsecond resolution, we
9158b5ec993Smrg      # have one more thing to check: make. It can happen that
9168b5ec993Smrg      # everything else supports the subsecond mtimes, but make doesn't;
9178b5ec993Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9188b5ec993Smrg      # released under GPLv2). https://bugs.gnu.org/68808
9198b5ec993Smrg      # 
9208b5ec993Smrg      # We test $MAKE if it is defined in the environment, else "make".
9218b5ec993Smrg      # It might get overridden later, but our hope is that in practice
9228b5ec993Smrg      # it does not matter: it is the system "make" which is (by far)
9238b5ec993Smrg      # the most likely to be broken, whereas if the user overrides it,
9248b5ec993Smrg      # probably they did so with a better, or at least not worse, make.
9258b5ec993Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9268b5ec993Smrg      #
9278b5ec993Smrg      # Create a Makefile (real tab character here):
9288b5ec993Smrg      rm -f conftest.mk
9298b5ec993Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9308b5ec993Smrg      echo '	touch conftest.ts2' >>conftest.mk
9318b5ec993Smrg      #
9328b5ec993Smrg      # Now, running
9338b5ec993Smrg      #   touch conftest.ts1; touch conftest.ts2; make
9348b5ec993Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9358b5ec993Smrg      # but most often, it will fail if make's support is insufficient. So
9368b5ec993Smrg      # test for several consecutive successes.
9378b5ec993Smrg      #
9388b5ec993Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
9398b5ec993Smrg      # files, not create new ones, per above.)
9408b5ec993Smrg      n=0
9418b5ec993Smrg      make=${MAKE-make}
9428b5ec993Smrg      until test $n -eq 3; do
9438b5ec993Smrg        echo one > conftest.ts1
9448b5ec993Smrg        sleep $am_try_res
9458b5ec993Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9468b5ec993Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9478b5ec993Smrg          make_ok=false
9488b5ec993Smrg          break # out of $n loop
9498b5ec993Smrg        fi
9508b5ec993Smrg        n=`expr $n + 1`
9518b5ec993Smrg      done
9528b5ec993Smrg    fi
9538b5ec993Smrg    #
9548b5ec993Smrg    if $make_ok; then
9558b5ec993Smrg      # Everything we know to check worked out, so call this resolution good.
9568b5ec993Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9578b5ec993Smrg      break # out of $am_try_res loop
9588b5ec993Smrg    fi
9598b5ec993Smrg    # Otherwise, we'll go on to check the next resolution.
9608b5ec993Smrg  fi
9618b5ec993Smrgdone
9628b5ec993Smrgrm -f conftest.ts?
9638b5ec993Smrg# (end _am_filesystem_timestamp_resolution)
9648b5ec993Smrg])])
9658b5ec993Smrg
9669f1d9476Smrg# AM_SANITY_CHECK
9679f1d9476Smrg# ---------------
9689f1d9476SmrgAC_DEFUN([AM_SANITY_CHECK],
9698b5ec993Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9708b5ec993Smrg# This check should not be cached, as it may vary across builds of
9718b5ec993Smrg# different projects.
9728b5ec993SmrgAC_MSG_CHECKING([whether build environment is sane])
9739f1d9476Smrg# Reject unsafe characters in $srcdir or the absolute working directory
9749f1d9476Smrg# name.  Accept space and tab only in the latter.
9759f1d9476Smrgam_lf='
9769f1d9476Smrg'
9779f1d9476Smrgcase `pwd` in
9789f1d9476Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9799f1d9476Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9809f1d9476Smrgesac
9819f1d9476Smrgcase $srcdir in
9829f1d9476Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9839f1d9476Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9849f1d9476Smrgesac
9859f1d9476Smrg
9869f1d9476Smrg# Do 'set' in a subshell so we don't clobber the current shell's
9879f1d9476Smrg# arguments.  Must try -L first in case configure is actually a
9889f1d9476Smrg# symlink; some systems play weird games with the mod time of symlinks
9899f1d9476Smrg# (eg FreeBSD returns the mod time of the symlink's containing
9909f1d9476Smrg# directory).
9918b5ec993Smrgam_build_env_is_sane=no
9928b5ec993Smrgam_has_slept=no
9938b5ec993Smrgrm -f conftest.file
9948b5ec993Smrgfor am_try in 1 2; do
9958b5ec993Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9968b5ec993Smrg  if (
9978b5ec993Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9988b5ec993Smrg    if test "$[]*" = "X"; then
9998b5ec993Smrg      # -L didn't work.
10008b5ec993Smrg      set X `ls -t "$srcdir/configure" conftest.file`
10018b5ec993Smrg    fi
10028b5ec993Smrg    test "$[]2" = conftest.file
10038b5ec993Smrg  ); then
10048b5ec993Smrg    am_build_env_is_sane=yes
10058b5ec993Smrg    break
10068b5ec993Smrg  fi
10078b5ec993Smrg  # Just in case.
10088b5ec993Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
10098b5ec993Smrg  am_has_slept=yes
10108b5ec993Smrgdone
10118b5ec993Smrg
10128b5ec993SmrgAC_MSG_RESULT([$am_build_env_is_sane])
10138b5ec993Smrgif test "$am_build_env_is_sane" = no; then
10148b5ec993Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
10159f1d9476SmrgCheck your system clock])
1016f33d31a3Smrgfi
10178b5ec993Smrg
10189f1d9476Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10199f1d9476Smrg# generated files are strictly newer.
10209f1d9476Smrgam_sleep_pid=
10218b5ec993SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10228b5ec993Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10239f1d9476Smrg  am_sleep_pid=$!
10248b5ec993Smrg])
10259f1d9476SmrgAC_CONFIG_COMMANDS_PRE(
10269f1d9476Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10279f1d9476Smrg   if test -n "$am_sleep_pid"; then
10289f1d9476Smrg     # Hide warnings about reused PIDs.
10299f1d9476Smrg     wait $am_sleep_pid 2>/dev/null
10309f1d9476Smrg   fi
10319f1d9476Smrg   AC_MSG_RESULT([done])])
10329f1d9476Smrgrm -f conftest.file
10339f1d9476Smrg])
1034f33d31a3Smrg
10358b5ec993Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
1036f33d31a3Smrg#
10379f1d9476Smrg# This file is free software; the Free Software Foundation
10389f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
10399f1d9476Smrg# with or without modifications, as long as this notice is preserved.
1040f33d31a3Smrg
10418b5ec993Smrg# _AM_SILENT_RULES
10428b5ec993Smrg# ----------------
10438b5ec993Smrg# Enable less verbose build rules support.
10448b5ec993SmrgAC_DEFUN([_AM_SILENT_RULES],
10458b5ec993Smrg[AM_DEFAULT_VERBOSITY=1
10468b5ec993SmrgAC_ARG_ENABLE([silent-rules], [dnl
10479f1d9476SmrgAS_HELP_STRING(
10489f1d9476Smrg  [--enable-silent-rules],
10499f1d9476Smrg  [less verbose build output (undo: "make V=1")])
10509f1d9476SmrgAS_HELP_STRING(
10519f1d9476Smrg  [--disable-silent-rules],
10529f1d9476Smrg  [verbose build output (undo: "make V=0")])dnl
10539f1d9476Smrg])
10549f1d9476Smrgdnl
10559f1d9476Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10569f1d9476Smrgdnl do not support nested variable expansions.
10579f1d9476Smrgdnl See automake bug#9928 and bug#10237.
10589f1d9476Smrgam_make=${MAKE-make}
10599f1d9476SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10609f1d9476Smrg   [am_cv_make_support_nested_variables],
10619f1d9476Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10629f1d9476SmrgBAR0=false
10639f1d9476SmrgBAR1=true
10649f1d9476SmrgV=1
10659f1d9476Smrgam__doit:
10669f1d9476Smrg	@$(TRUE)
10679f1d9476Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10689f1d9476Smrg  am_cv_make_support_nested_variables=yes
1069f33d31a3Smrgelse
10709f1d9476Smrg  am_cv_make_support_nested_variables=no
10719f1d9476Smrgfi])
10729f1d9476SmrgAC_SUBST([AM_V])dnl
10739f1d9476SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10749f1d9476SmrgAC_SUBST([AM_DEFAULT_V])dnl
10759f1d9476SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10769f1d9476SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10779f1d9476SmrgAM_BACKSLASH='\'
10789f1d9476SmrgAC_SUBST([AM_BACKSLASH])dnl
10799f1d9476Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10808b5ec993Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10818b5ec993Smrgdnl to AM_SILENT_RULES to change the default value.
10828b5ec993SmrgAC_CONFIG_COMMANDS_PRE([dnl
10838b5ec993Smrgcase $enable_silent_rules in @%:@ (((
10848b5ec993Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
10858b5ec993Smrg   no) AM_DEFAULT_VERBOSITY=1;;
10868b5ec993Smrgesac
10878b5ec993Smrgif test $am_cv_make_support_nested_variables = yes; then
10888b5ec993Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10898b5ec993Smrg  AM_V='$(V)'
10908b5ec993Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10918b5ec993Smrgelse
10928b5ec993Smrg  AM_V=$AM_DEFAULT_VERBOSITY
10938b5ec993Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10948b5ec993Smrgfi
10958b5ec993Smrg])dnl
10969f1d9476Smrg])
1097f33d31a3Smrg
10988b5ec993Smrg# AM_SILENT_RULES([DEFAULT])
10998b5ec993Smrg# --------------------------
11008b5ec993Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11018b5ec993Smrg# empty being verbose).
11028b5ec993SmrgAC_DEFUN([AM_SILENT_RULES],
11038b5ec993Smrg[AC_REQUIRE([_AM_SILENT_RULES])
11048b5ec993SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11058b5ec993Smrg
11068b5ec993Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
1107f33d31a3Smrg#
11089f1d9476Smrg# This file is free software; the Free Software Foundation
11099f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
11109f1d9476Smrg# with or without modifications, as long as this notice is preserved.
1111f33d31a3Smrg
11129f1d9476Smrg# AM_PROG_INSTALL_STRIP
11139f1d9476Smrg# ---------------------
11149f1d9476Smrg# One issue with vendor 'install' (even GNU) is that you can't
11159f1d9476Smrg# specify the program used to strip binaries.  This is especially
11169f1d9476Smrg# annoying in cross-compiling environments, where the build's strip
11179f1d9476Smrg# is unlikely to handle the host's binaries.
11189f1d9476Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11199f1d9476Smrg# always use install-sh in "make install-strip", and initialize
11209f1d9476Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
11219f1d9476SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
11229f1d9476Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11239f1d9476Smrg# Installed binaries are usually stripped using 'strip' when the user
11249f1d9476Smrg# run "make install-strip".  However 'strip' might not be the right
11259f1d9476Smrg# tool to use in cross-compilation environments, therefore Automake
11269f1d9476Smrg# will honor the 'STRIP' environment variable to overrule this program.
11279f1d9476Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
11289f1d9476Smrgif test "$cross_compiling" != no; then
11299f1d9476Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130f33d31a3Smrgfi
11319f1d9476SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
11329f1d9476SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133f33d31a3Smrg
11348b5ec993Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
1135f33d31a3Smrg#
11369f1d9476Smrg# This file is free software; the Free Software Foundation
11379f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
11389f1d9476Smrg# with or without modifications, as long as this notice is preserved.
1139f33d31a3Smrg
11409f1d9476Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
11419f1d9476Smrg# ---------------------------
11429f1d9476Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
11439f1d9476Smrg# This macro is traced by Automake.
11449f1d9476SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1145f33d31a3Smrg
11469f1d9476Smrg# AM_SUBST_NOTMAKE(VARIABLE)
11479f1d9476Smrg# --------------------------
11489f1d9476Smrg# Public sister of _AM_SUBST_NOTMAKE.
11499f1d9476SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150f33d31a3Smrg
11519f1d9476Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152f33d31a3Smrg
11538b5ec993Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
1154f33d31a3Smrg#
11559f1d9476Smrg# This file is free software; the Free Software Foundation
11569f1d9476Smrg# gives unlimited permission to copy and/or distribute it,
11579f1d9476Smrg# with or without modifications, as long as this notice is preserved.
11589f1d9476Smrg
11599f1d9476Smrg# _AM_PROG_TAR(FORMAT)
11609f1d9476Smrg# --------------------
11619f1d9476Smrg# Check how to create a tarball in format FORMAT.
11629f1d9476Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1163f33d31a3Smrg#
11649f1d9476Smrg# Substitute a variable $(am__tar) that is a command
11659f1d9476Smrg# writing to stdout a FORMAT-tarball containing the directory
11669f1d9476Smrg# $tardir.
11679f1d9476Smrg#     tardir=directory && $(am__tar) > result.tar
1168f33d31a3Smrg#
11699f1d9476Smrg# Substitute a variable $(am__untar) that extract such
11709f1d9476Smrg# a tarball read from stdin.
11719f1d9476Smrg#     $(am__untar) < result.tar
1172f33d31a3Smrg#
11739f1d9476SmrgAC_DEFUN([_AM_PROG_TAR],
11749f1d9476Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11759f1d9476Smrg# in the wild :-(  We should find a proper way to deprecate it ...
11769f1d9476SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1177f33d31a3Smrg
11789f1d9476Smrg# We'll loop over all known methods to create a tar archive until one works.
11799f1d9476Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180f33d31a3Smrg
11819f1d9476Smrgm4_if([$1], [v7],
11829f1d9476Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183f33d31a3Smrg
11849f1d9476Smrg  [m4_case([$1],
11859f1d9476Smrg    [ustar],
11869f1d9476Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11879f1d9476Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11889f1d9476Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11899f1d9476Smrg      # and bug#13588).
11909f1d9476Smrg      am_max_uid=2097151 # 2^21 - 1
11919f1d9476Smrg      am_max_gid=$am_max_uid
11929f1d9476Smrg      # The $UID and $GID variables are not portable, so we need to resort
11939f1d9476Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11949f1d9476Smrg      # below are definitely unexpected, so allow the users to see them
11959f1d9476Smrg      # (that is, avoid stderr redirection).
11969f1d9476Smrg      am_uid=`id -u || echo unknown`
11979f1d9476Smrg      am_gid=`id -g || echo unknown`
11989f1d9476Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11998b5ec993Smrg      if test x$am_uid = xunknown; then
12008b5ec993Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12018b5ec993Smrg      elif test $am_uid -le $am_max_uid; then
12028b5ec993Smrg        AC_MSG_RESULT([yes])
12039f1d9476Smrg      else
12048b5ec993Smrg        AC_MSG_RESULT([no])
12058b5ec993Smrg        _am_tools=none
12069f1d9476Smrg      fi
12079f1d9476Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12088b5ec993Smrg      if test x$gm_gid = xunknown; then
12098b5ec993Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12108b5ec993Smrg      elif test $am_gid -le $am_max_gid; then
12118b5ec993Smrg        AC_MSG_RESULT([yes])
12129f1d9476Smrg      else
12139f1d9476Smrg        AC_MSG_RESULT([no])
12149f1d9476Smrg        _am_tools=none
12159f1d9476Smrg      fi],
1216f33d31a3Smrg
12179f1d9476Smrg  [pax],
12189f1d9476Smrg    [],
1219f33d31a3Smrg
12209f1d9476Smrg  [m4_fatal([Unknown tar format])])
1221f33d31a3Smrg
12229f1d9476Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223f33d31a3Smrg
12249f1d9476Smrg  # Go ahead even if we have the value already cached.  We do so because we
12259f1d9476Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12269f1d9476Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227f33d31a3Smrg
12289f1d9476Smrg  for _am_tool in $_am_tools; do
12299f1d9476Smrg    case $_am_tool in
12309f1d9476Smrg    gnutar)
12319f1d9476Smrg      for _am_tar in tar gnutar gtar; do
12329f1d9476Smrg        AM_RUN_LOG([$_am_tar --version]) && break
12339f1d9476Smrg      done
12349f1d9476Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12359f1d9476Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12369f1d9476Smrg      am__untar="$_am_tar -xf -"
12379f1d9476Smrg      ;;
12389f1d9476Smrg    plaintar)
12399f1d9476Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12409f1d9476Smrg      # ustar tarball either.
12419f1d9476Smrg      (tar --version) >/dev/null 2>&1 && continue
12429f1d9476Smrg      am__tar='tar chf - "$$tardir"'
12439f1d9476Smrg      am__tar_='tar chf - "$tardir"'
12449f1d9476Smrg      am__untar='tar xf -'
12459f1d9476Smrg      ;;
12469f1d9476Smrg    pax)
12479f1d9476Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
12489f1d9476Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
12499f1d9476Smrg      am__untar='pax -r'
12509f1d9476Smrg      ;;
12519f1d9476Smrg    cpio)
12529f1d9476Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12539f1d9476Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12549f1d9476Smrg      am__untar='cpio -i -H $1 -d'
12559f1d9476Smrg      ;;
12569f1d9476Smrg    none)
12579f1d9476Smrg      am__tar=false
12589f1d9476Smrg      am__tar_=false
12599f1d9476Smrg      am__untar=false
12609f1d9476Smrg      ;;
12619f1d9476Smrg    esac
1262f33d31a3Smrg
12639f1d9476Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
12649f1d9476Smrg    # and am__untar set.
12659f1d9476Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266f33d31a3Smrg
12679f1d9476Smrg    # tar/untar a dummy directory, and stop if the command works.
12689f1d9476Smrg    rm -rf conftest.dir
12699f1d9476Smrg    mkdir conftest.dir
12709f1d9476Smrg    echo GrepMe > conftest.dir/file
12719f1d9476Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12729f1d9476Smrg    rm -rf conftest.dir
12739f1d9476Smrg    if test -s conftest.tar; then
12749f1d9476Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
12759f1d9476Smrg      AM_RUN_LOG([cat conftest.dir/file])
12769f1d9476Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12779f1d9476Smrg    fi
12789f1d9476Smrg  done
12799f1d9476Smrg  rm -rf conftest.dir
1280f33d31a3Smrg
12819f1d9476Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12829f1d9476Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283f33d31a3Smrg
12849f1d9476SmrgAC_SUBST([am__tar])
12859f1d9476SmrgAC_SUBST([am__untar])
12869f1d9476Smrg]) # _AM_PROG_TAR
1287f33d31a3Smrg
12888b5ec993Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12898b5ec993Smrg#
12908b5ec993Smrg# This file is free software; the Free Software Foundation
12918b5ec993Smrg# gives unlimited permission to copy and/or distribute it,
12928b5ec993Smrg# with or without modifications, as long as this notice is preserved.
12938b5ec993Smrg
12948b5ec993Smrg# _AM_PROG_XARGS_N
12958b5ec993Smrg# ----------------
12968b5ec993Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12978b5ec993Smrg# is not optimized at all as we never expect to use it.
12988b5ec993SmrgAC_DEFUN([_AM_PROG_XARGS_N],
12998b5ec993Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13008b5ec993SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13018b5ec993Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13028b5ec993SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13038b5ec993Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13048b5ec993Smrg])dnl
13058b5ec993SmrgAC_SUBST(am__xargs_n)
13068b5ec993Smrg])
13078b5ec993Smrg
13089f1d9476Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
13099f1d9476Smrgdnl serial 11 (pkg-config-0.29)
13109f1d9476Smrgdnl
13119f1d9476Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
13129f1d9476Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
13139f1d9476Smrgdnl
13149f1d9476Smrgdnl This program is free software; you can redistribute it and/or modify
13159f1d9476Smrgdnl it under the terms of the GNU General Public License as published by
13169f1d9476Smrgdnl the Free Software Foundation; either version 2 of the License, or
13179f1d9476Smrgdnl (at your option) any later version.
13189f1d9476Smrgdnl
13199f1d9476Smrgdnl This program is distributed in the hope that it will be useful, but
13209f1d9476Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
13219f1d9476Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13229f1d9476Smrgdnl General Public License for more details.
13239f1d9476Smrgdnl
13249f1d9476Smrgdnl You should have received a copy of the GNU General Public License
13259f1d9476Smrgdnl along with this program; if not, write to the Free Software
13269f1d9476Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
13279f1d9476Smrgdnl 02111-1307, USA.
13289f1d9476Smrgdnl
13299f1d9476Smrgdnl As a special exception to the GNU General Public License, if you
13309f1d9476Smrgdnl distribute this file as part of a program that contains a
13319f1d9476Smrgdnl configuration script generated by Autoconf, you may include it under
13329f1d9476Smrgdnl the same distribution terms that you use for the rest of that
13339f1d9476Smrgdnl program.
1334f33d31a3Smrg
13359f1d9476Smrgdnl PKG_PREREQ(MIN-VERSION)
13369f1d9476Smrgdnl -----------------------
13379f1d9476Smrgdnl Since: 0.29
13389f1d9476Smrgdnl
13399f1d9476Smrgdnl Verify that the version of the pkg-config macros are at least
13409f1d9476Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
13419f1d9476Smrgdnl installed version of pkg-config, this checks the developer's version
13429f1d9476Smrgdnl of pkg.m4 when generating configure.
13439f1d9476Smrgdnl
13449f1d9476Smrgdnl To ensure that this macro is defined, also add:
13459f1d9476Smrgdnl m4_ifndef([PKG_PREREQ],
13469f1d9476Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
13479f1d9476Smrgdnl
13489f1d9476Smrgdnl See the "Since" comment for each macro you use to see what version
13499f1d9476Smrgdnl of the macros you require.
13509f1d9476Smrgm4_defun([PKG_PREREQ],
13519f1d9476Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
13529f1d9476Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
13539f1d9476Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
13549f1d9476Smrg])dnl PKG_PREREQ
1355f33d31a3Smrg
13569f1d9476Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
13579f1d9476Smrgdnl ----------------------------------
13589f1d9476Smrgdnl Since: 0.16
13599f1d9476Smrgdnl
13609f1d9476Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
13619f1d9476Smrgdnl first found in the path. Checks that the version of pkg-config found
13629f1d9476Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
13639f1d9476Smrgdnl used since that's the first version where most current features of
13649f1d9476Smrgdnl pkg-config existed.
13659f1d9476SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
13669f1d9476Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
13679f1d9476Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
13689f1d9476Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
13699f1d9476SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
13709f1d9476SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
13719f1d9476SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372f33d31a3Smrg
13739f1d9476Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
13749f1d9476Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1375f33d31a3Smrgfi
13769f1d9476Smrgif test -n "$PKG_CONFIG"; then
13779f1d9476Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
13789f1d9476Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
13799f1d9476Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
13809f1d9476Smrg		AC_MSG_RESULT([yes])
13819f1d9476Smrg	else
13829f1d9476Smrg		AC_MSG_RESULT([no])
13839f1d9476Smrg		PKG_CONFIG=""
13849f1d9476Smrg	fi
13859f1d9476Smrgfi[]dnl
13869f1d9476Smrg])dnl PKG_PROG_PKG_CONFIG
1387f33d31a3Smrg
13889f1d9476Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
13899f1d9476Smrgdnl -------------------------------------------------------------------
13909f1d9476Smrgdnl Since: 0.18
13919f1d9476Smrgdnl
13929f1d9476Smrgdnl Check to see whether a particular set of modules exists. Similar to
13939f1d9476Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
13949f1d9476Smrgdnl
13959f1d9476Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13969f1d9476Smrgdnl only at the first occurence in configure.ac, so if the first place
13979f1d9476Smrgdnl it's called might be skipped (such as if it is within an "if", you
13989f1d9476Smrgdnl have to call PKG_CHECK_EXISTS manually
13999f1d9476SmrgAC_DEFUN([PKG_CHECK_EXISTS],
14009f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14019f1d9476Smrgif test -n "$PKG_CONFIG" && \
14029f1d9476Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
14039f1d9476Smrg  m4_default([$2], [:])
14049f1d9476Smrgm4_ifvaln([$3], [else
14059f1d9476Smrg  $3])dnl
14069f1d9476Smrgfi])
14079f1d9476Smrg
14089f1d9476Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
14099f1d9476Smrgdnl ---------------------------------------------
14109f1d9476Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
14119f1d9476Smrgdnl pkg_failed based on the result.
14129f1d9476Smrgm4_define([_PKG_CONFIG],
14139f1d9476Smrg[if test -n "$$1"; then
14149f1d9476Smrg    pkg_cv_[]$1="$$1"
14159f1d9476Smrg elif test -n "$PKG_CONFIG"; then
14169f1d9476Smrg    PKG_CHECK_EXISTS([$3],
14179f1d9476Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
14189f1d9476Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
14199f1d9476Smrg		     [pkg_failed=yes])
14209f1d9476Smrg else
14219f1d9476Smrg    pkg_failed=untried
14229f1d9476Smrgfi[]dnl
14239f1d9476Smrg])dnl _PKG_CONFIG
14249f1d9476Smrg
14259f1d9476Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14269f1d9476Smrgdnl ---------------------------
14279f1d9476Smrgdnl Internal check to see if pkg-config supports short errors.
14289f1d9476SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14299f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14309f1d9476Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14319f1d9476Smrg        _pkg_short_errors_supported=yes
1432f33d31a3Smrgelse
14339f1d9476Smrg        _pkg_short_errors_supported=no
14349f1d9476Smrgfi[]dnl
14359f1d9476Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436f33d31a3Smrg
1437f33d31a3Smrg
14389f1d9476Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
14399f1d9476Smrgdnl   [ACTION-IF-NOT-FOUND])
14409f1d9476Smrgdnl --------------------------------------------------------------
14419f1d9476Smrgdnl Since: 0.4.0
14429f1d9476Smrgdnl
14439f1d9476Smrgdnl Note that if there is a possibility the first call to
14449f1d9476Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
14459f1d9476Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
14469f1d9476SmrgAC_DEFUN([PKG_CHECK_MODULES],
14479f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14489f1d9476SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
14499f1d9476SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450f33d31a3Smrg
14519f1d9476Smrgpkg_failed=no
14529f1d9476SmrgAC_MSG_CHECKING([for $1])
1453f33d31a3Smrg
14549f1d9476Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
14559f1d9476Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456f33d31a3Smrg
14579f1d9476Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
14589f1d9476Smrgand $1[]_LIBS to avoid the need to call pkg-config.
14599f1d9476SmrgSee the pkg-config man page for more details.])
1460f33d31a3Smrg
14619f1d9476Smrgif test $pkg_failed = yes; then
14629f1d9476Smrg   	AC_MSG_RESULT([no])
14639f1d9476Smrg        _PKG_SHORT_ERRORS_SUPPORTED
14649f1d9476Smrg        if test $_pkg_short_errors_supported = yes; then
14659f1d9476Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
14669f1d9476Smrg        else 
14679f1d9476Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
14689f1d9476Smrg        fi
14699f1d9476Smrg	# Put the nasty error message in config.log where it belongs
14709f1d9476Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471f33d31a3Smrg
14729f1d9476Smrg	m4_default([$4], [AC_MSG_ERROR(
14739f1d9476Smrg[Package requirements ($2) were not met:
1474f33d31a3Smrg
14759f1d9476Smrg$$1_PKG_ERRORS
14769f1d9476Smrg
14779f1d9476SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
14789f1d9476Smrginstalled software in a non-standard prefix.
14799f1d9476Smrg
14809f1d9476Smrg_PKG_TEXT])[]dnl
14819f1d9476Smrg        ])
14829f1d9476Smrgelif test $pkg_failed = untried; then
14839f1d9476Smrg     	AC_MSG_RESULT([no])
14849f1d9476Smrg	m4_default([$4], [AC_MSG_FAILURE(
14859f1d9476Smrg[The pkg-config script could not be found or is too old.  Make sure it
14869f1d9476Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
14879f1d9476Smrgpath to pkg-config.
14889f1d9476Smrg
14899f1d9476Smrg_PKG_TEXT
14909f1d9476Smrg
14919f1d9476SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
14929f1d9476Smrg        ])
1493f33d31a3Smrgelse
14949f1d9476Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
14959f1d9476Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
14969f1d9476Smrg        AC_MSG_RESULT([yes])
14979f1d9476Smrg	$3
14989f1d9476Smrgfi[]dnl
14999f1d9476Smrg])dnl PKG_CHECK_MODULES
1500f33d31a3Smrg
1501f33d31a3Smrg
15029f1d9476Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15039f1d9476Smrgdnl   [ACTION-IF-NOT-FOUND])
15049f1d9476Smrgdnl ---------------------------------------------------------------------
15059f1d9476Smrgdnl Since: 0.29
15069f1d9476Smrgdnl
15079f1d9476Smrgdnl Checks for existence of MODULES and gathers its build flags with
15089f1d9476Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
15099f1d9476Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
15109f1d9476Smrgdnl
15119f1d9476Smrgdnl Note that if there is a possibility the first call to
15129f1d9476Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
15139f1d9476Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
15149f1d9476Smrgdnl configure.ac.
15159f1d9476SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
15169f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15179f1d9476Smrg_save_PKG_CONFIG=$PKG_CONFIG
15189f1d9476SmrgPKG_CONFIG="$PKG_CONFIG --static"
15199f1d9476SmrgPKG_CHECK_MODULES($@)
15209f1d9476SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
15219f1d9476Smrg])dnl PKG_CHECK_MODULES_STATIC
1522f33d31a3Smrg
1523f33d31a3Smrg
15249f1d9476Smrgdnl PKG_INSTALLDIR([DIRECTORY])
15259f1d9476Smrgdnl -------------------------
15269f1d9476Smrgdnl Since: 0.27
15279f1d9476Smrgdnl
15289f1d9476Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
15299f1d9476Smrgdnl should install pkg-config .pc files. By default the directory is
15309f1d9476Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
15319f1d9476Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
15329f1d9476Smrgdnl parameter.
15339f1d9476SmrgAC_DEFUN([PKG_INSTALLDIR],
15349f1d9476Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
15359f1d9476Smrgm4_pushdef([pkg_description],
15369f1d9476Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
15379f1d9476SmrgAC_ARG_WITH([pkgconfigdir],
15389f1d9476Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
15399f1d9476Smrg    [with_pkgconfigdir=]pkg_default)
15409f1d9476SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
15419f1d9476Smrgm4_popdef([pkg_default])
15429f1d9476Smrgm4_popdef([pkg_description])
15439f1d9476Smrg])dnl PKG_INSTALLDIR
15449f1d9476Smrg
15459f1d9476Smrg
15469f1d9476Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
15479f1d9476Smrgdnl --------------------------------
15489f1d9476Smrgdnl Since: 0.27
15499f1d9476Smrgdnl
15509f1d9476Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
15519f1d9476Smrgdnl module should install arch-independent pkg-config .pc files. By
15529f1d9476Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
15539f1d9476Smrgdnl changed by passing DIRECTORY. The user can override through the
15549f1d9476Smrgdnl --with-noarch-pkgconfigdir parameter.
15559f1d9476SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
15569f1d9476Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
15579f1d9476Smrgm4_pushdef([pkg_description],
15589f1d9476Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
15599f1d9476SmrgAC_ARG_WITH([noarch-pkgconfigdir],
15609f1d9476Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
15619f1d9476Smrg    [with_noarch_pkgconfigdir=]pkg_default)
15629f1d9476SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
15639f1d9476Smrgm4_popdef([pkg_default])
15649f1d9476Smrgm4_popdef([pkg_description])
15659f1d9476Smrg])dnl PKG_NOARCH_INSTALLDIR
15669f1d9476Smrg
1567f33d31a3Smrg
15689f1d9476Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
15699f1d9476Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
15709f1d9476Smrgdnl -------------------------------------------
15719f1d9476Smrgdnl Since: 0.28
15729f1d9476Smrgdnl
15739f1d9476Smrgdnl Retrieves the value of the pkg-config variable for the given module.
15749f1d9476SmrgAC_DEFUN([PKG_CHECK_VAR],
15759f1d9476Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15769f1d9476SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577f33d31a3Smrg
15789f1d9476Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
15799f1d9476SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580f33d31a3Smrg
15819f1d9476SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
15829f1d9476Smrg])dnl PKG_CHECK_VAR
1583f33d31a3Smrg
15849f1d9476Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15859f1d9476Smrgdnl
15868b5ec993Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15879f1d9476Smrgdnl
15889f1d9476Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15899f1d9476Smrgdnl copy of this software and associated documentation files (the "Software"),
15909f1d9476Smrgdnl to deal in the Software without restriction, including without limitation
15919f1d9476Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15929f1d9476Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
15939f1d9476Smrgdnl Software is furnished to do so, subject to the following conditions:
15949f1d9476Smrgdnl
15959f1d9476Smrgdnl The above copyright notice and this permission notice (including the next
15969f1d9476Smrgdnl paragraph) shall be included in all copies or substantial portions of the
15979f1d9476Smrgdnl Software.
15989f1d9476Smrgdnl
15999f1d9476Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16009f1d9476Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16019f1d9476Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16029f1d9476Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16039f1d9476Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16049f1d9476Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16059f1d9476Smrgdnl DEALINGS IN THE SOFTWARE.
1606f33d31a3Smrg
16079f1d9476Smrg# XORG_MACROS_VERSION(required-version)
16089f1d9476Smrg# -------------------------------------
1609f33d31a3Smrg# Minimum version: 1.1.0
1610f33d31a3Smrg#
16119f1d9476Smrg# If you're using a macro added in Version 1.1 or newer, include this in
16129f1d9476Smrg# your configure.ac with the minimum required version, such as:
16139f1d9476Smrg# XORG_MACROS_VERSION(1.1)
1614f33d31a3Smrg#
16159f1d9476Smrg# To ensure that this macro is defined, also add:
16169f1d9476Smrg# m4_ifndef([XORG_MACROS_VERSION],
16179f1d9476Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1618f33d31a3Smrg#
16199f1d9476Smrg#
16209f1d9476Smrg# See the "minimum version" comment for each macro you use to see what
16219f1d9476Smrg# version you require.
16229f1d9476Smrgm4_defun([XORG_MACROS_VERSION],[
16238b5ec993Smrgm4_define([vers_have], [1.20.2])
16249f1d9476Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16259f1d9476Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16269f1d9476Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16279f1d9476Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16289f1d9476Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16299f1d9476Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16309f1d9476Smrgm4_undefine([vers_have])
16319f1d9476Smrgm4_undefine([maj_have])
16329f1d9476Smrgm4_undefine([maj_needed])
16339f1d9476Smrg]) # XORG_MACROS_VERSION
1634f33d31a3Smrg
16359f1d9476Smrg# XORG_PROG_RAWCPP()
16369f1d9476Smrg# ------------------
16379f1d9476Smrg# Minimum version: 1.0.0
16389f1d9476Smrg#
16399f1d9476Smrg# Find cpp program and necessary flags for use in pre-processing text files
16409f1d9476Smrg# such as man pages and config files
16419f1d9476SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16429f1d9476SmrgAC_REQUIRE([AC_PROG_CPP])
16439f1d9476SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16449f1d9476Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645f33d31a3Smrg
16469f1d9476Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16479f1d9476Smrg# which is not the best choice for supporting other OS'es, but covers most
16489f1d9476Smrg# of the ones we need for now.
16499f1d9476SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
16509f1d9476SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16519f1d9476Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16529f1d9476Smrg	AC_MSG_RESULT([no])
16539f1d9476Smrgelse
16549f1d9476Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16559f1d9476Smrg		RAWCPPFLAGS=-undef
16569f1d9476Smrg		AC_MSG_RESULT([yes])
16579f1d9476Smrg	# under Cygwin unix is still defined even with -undef
16589f1d9476Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16599f1d9476Smrg		RAWCPPFLAGS="-undef -ansi"
16609f1d9476Smrg		AC_MSG_RESULT([yes, with -ansi])
16619f1d9476Smrg	else
16629f1d9476Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16639f1d9476Smrg	fi
1664f33d31a3Smrgfi
16659f1d9476Smrgrm -f conftest.$ac_ext
1666f33d31a3Smrg
16679f1d9476SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
16689f1d9476SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16698b5ec993Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16709f1d9476Smrg	AC_MSG_RESULT([no])
16719f1d9476Smrgelse
16728b5ec993Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16739f1d9476Smrg		TRADITIONALCPPFLAGS="-traditional"
16749f1d9476Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16759f1d9476Smrg		AC_MSG_RESULT([yes])
16769f1d9476Smrg	else
16779f1d9476Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16789f1d9476Smrg	fi
16799f1d9476Smrgfi
16809f1d9476Smrgrm -f conftest.$ac_ext
16819f1d9476SmrgAC_SUBST(RAWCPPFLAGS)
16829f1d9476SmrgAC_SUBST(TRADITIONALCPPFLAGS)
16839f1d9476Smrg]) # XORG_PROG_RAWCPP
1684f33d31a3Smrg
16859f1d9476Smrg# XORG_MANPAGE_SECTIONS()
16869f1d9476Smrg# -----------------------
16879f1d9476Smrg# Minimum version: 1.0.0
1688f33d31a3Smrg#
16899f1d9476Smrg# Determine which sections man pages go in for the different man page types
16909f1d9476Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16919f1d9476Smrg# Not sure if there's any better way than just hardcoding by OS name.
16929f1d9476Smrg# Override default settings by setting environment variables
16939f1d9476Smrg# Added MAN_SUBSTS in version 1.8
16949f1d9476Smrg# Added AC_PROG_SED in version 1.8
1695f33d31a3Smrg
16969f1d9476SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16979f1d9476SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16989f1d9476SmrgAC_REQUIRE([AC_PROG_SED])
1699f33d31a3Smrg
17009f1d9476Smrgcase $host_os in
17019f1d9476Smrg    solaris*)
17029f1d9476Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
17039f1d9476Smrg        # check for a man page file found in later versions that use
17049f1d9476Smrg        # traditional section numbers instead
17059f1d9476Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
17069f1d9476Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
17079f1d9476Smrg        ;;
17089f1d9476Smrg    *) SYSV_MAN_SECTIONS=false ;;
17099f1d9476Smrgesac
1710f33d31a3Smrg
17119f1d9476Smrgif test x$APP_MAN_SUFFIX = x    ; then
17129f1d9476Smrg    APP_MAN_SUFFIX=1
17139f1d9476Smrgfi
17149f1d9476Smrgif test x$APP_MAN_DIR = x    ; then
17159f1d9476Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17169f1d9476Smrgfi
1717f33d31a3Smrg
17189f1d9476Smrgif test x$LIB_MAN_SUFFIX = x    ; then
17199f1d9476Smrg    LIB_MAN_SUFFIX=3
17209f1d9476Smrgfi
17219f1d9476Smrgif test x$LIB_MAN_DIR = x    ; then
17229f1d9476Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17239f1d9476Smrgfi
1724f33d31a3Smrg
17259f1d9476Smrgif test x$FILE_MAN_SUFFIX = x    ; then
17269f1d9476Smrg    case $SYSV_MAN_SECTIONS in
17279f1d9476Smrg	true)				FILE_MAN_SUFFIX=4  ;;
17289f1d9476Smrg	*)				FILE_MAN_SUFFIX=5  ;;
17299f1d9476Smrg    esac
17309f1d9476Smrgfi
17319f1d9476Smrgif test x$FILE_MAN_DIR = x    ; then
17329f1d9476Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1733f33d31a3Smrgfi
1734f33d31a3Smrg
17359f1d9476Smrgif test x$MISC_MAN_SUFFIX = x    ; then
17369f1d9476Smrg    case $SYSV_MAN_SECTIONS in
17379f1d9476Smrg	true)				MISC_MAN_SUFFIX=5  ;;
17389f1d9476Smrg	*)				MISC_MAN_SUFFIX=7  ;;
17399f1d9476Smrg    esac
17409f1d9476Smrgfi
17419f1d9476Smrgif test x$MISC_MAN_DIR = x    ; then
17429f1d9476Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1743f33d31a3Smrgfi
1744f33d31a3Smrg
17459f1d9476Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
17469f1d9476Smrg    case $SYSV_MAN_SECTIONS in
17479f1d9476Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
17489f1d9476Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
17499f1d9476Smrg    esac
17509f1d9476Smrgfi
17519f1d9476Smrgif test x$DRIVER_MAN_DIR = x    ; then
17529f1d9476Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
17539f1d9476Smrgfi
1754f33d31a3Smrg
17559f1d9476Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
17569f1d9476Smrg    case $SYSV_MAN_SECTIONS in
17579f1d9476Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
17589f1d9476Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
17599f1d9476Smrg    esac
17609f1d9476Smrgfi
17619f1d9476Smrgif test x$ADMIN_MAN_DIR = x    ; then
17629f1d9476Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17639f1d9476Smrgfi
1764f33d31a3Smrg
1765f33d31a3Smrg
17669f1d9476SmrgAC_SUBST([APP_MAN_SUFFIX])
17679f1d9476SmrgAC_SUBST([LIB_MAN_SUFFIX])
17689f1d9476SmrgAC_SUBST([FILE_MAN_SUFFIX])
17699f1d9476SmrgAC_SUBST([MISC_MAN_SUFFIX])
17709f1d9476SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
17719f1d9476SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
17729f1d9476SmrgAC_SUBST([APP_MAN_DIR])
17739f1d9476SmrgAC_SUBST([LIB_MAN_DIR])
17749f1d9476SmrgAC_SUBST([FILE_MAN_DIR])
17759f1d9476SmrgAC_SUBST([MISC_MAN_DIR])
17769f1d9476SmrgAC_SUBST([DRIVER_MAN_DIR])
17779f1d9476SmrgAC_SUBST([ADMIN_MAN_DIR])
1778f33d31a3Smrg
17799f1d9476SmrgXORG_MAN_PAGE="X Version 11"
17809f1d9476SmrgAC_SUBST([XORG_MAN_PAGE])
17819f1d9476SmrgMAN_SUBSTS="\
17829f1d9476Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17839f1d9476Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17849f1d9476Smrg	-e 's|__xservername__|Xorg|g' \
17859f1d9476Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
17869f1d9476Smrg	-e 's|__projectroot__|\$(prefix)|g' \
17879f1d9476Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
17889f1d9476Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
17899f1d9476Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
17909f1d9476Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
17919f1d9476Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
17929f1d9476Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
17939f1d9476Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
17949f1d9476SmrgAC_SUBST([MAN_SUBSTS])
1795f33d31a3Smrg
17969f1d9476Smrg]) # XORG_MANPAGE_SECTIONS
1797f33d31a3Smrg
17989f1d9476Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
17999f1d9476Smrg# ------------------------
18009f1d9476Smrg# Minimum version: 1.7.0
1801f33d31a3Smrg#
18029f1d9476Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
18039f1d9476Smrg# provided by xorg-sgml-doctools, if installed.
18049f1d9476SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
18059f1d9476SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
18069f1d9476SmrgXORG_SGML_PATH=
18079f1d9476SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
18089f1d9476Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
18099f1d9476Smrg    [m4_ifval([$1],[:],
18109f1d9476Smrg        [if test x"$cross_compiling" != x"yes" ; then
18119f1d9476Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
18129f1d9476Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
18139f1d9476Smrg         fi])
18149f1d9476Smrg    ])
18159f1d9476Smrg
18169f1d9476Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
18179f1d9476Smrg# the path and the name of the doc stylesheet
18189f1d9476Smrgif test "x$XORG_SGML_PATH" != "x" ; then
18199f1d9476Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
18209f1d9476Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
18219f1d9476Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18229f1d9476Smrgelse
18239f1d9476Smrg   AC_MSG_RESULT([no])
18249f1d9476Smrgfi
18259f1d9476Smrg
18269f1d9476SmrgAC_SUBST(XORG_SGML_PATH)
18279f1d9476SmrgAC_SUBST(STYLESHEET_SRCDIR)
18289f1d9476SmrgAC_SUBST(XSL_STYLESHEET)
18299f1d9476SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
18309f1d9476Smrg]) # XORG_CHECK_SGML_DOCTOOLS
18319f1d9476Smrg
18329f1d9476Smrg# XORG_CHECK_LINUXDOC
18339f1d9476Smrg# -------------------
18349f1d9476Smrg# Minimum version: 1.0.0
1835f33d31a3Smrg#
18369f1d9476Smrg# Defines the variable MAKE_TEXT if the necessary tools and
18379f1d9476Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
18389f1d9476Smrg# Whether or not the necessary tools and files are found can be checked
18399f1d9476Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
18409f1d9476SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
18419f1d9476SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18429f1d9476SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843f33d31a3Smrg
18449f1d9476SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1845f33d31a3Smrg
18469f1d9476SmrgAC_MSG_CHECKING([whether to build documentation])
18479f1d9476Smrg
18489f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
18499f1d9476Smrg   BUILDDOC=yes
1850f33d31a3Smrgelse
18519f1d9476Smrg   BUILDDOC=no
1852f33d31a3Smrgfi
1853f33d31a3Smrg
18549f1d9476SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855f33d31a3Smrg
18569f1d9476SmrgAC_MSG_RESULT([$BUILDDOC])
1857f33d31a3Smrg
18589f1d9476SmrgAC_MSG_CHECKING([whether to build pdf documentation])
18599f1d9476Smrg
18609f1d9476Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
18619f1d9476Smrg   BUILDPDFDOC=yes
18629f1d9476Smrgelse
18639f1d9476Smrg   BUILDPDFDOC=no
18649f1d9476Smrgfi
18659f1d9476Smrg
18669f1d9476SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
18679f1d9476Smrg
18689f1d9476SmrgAC_MSG_RESULT([$BUILDPDFDOC])
18699f1d9476Smrg
18709f1d9476SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
18719f1d9476SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
18729f1d9476SmrgMAKE_PDF="$PS2PDF"
18739f1d9476SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
18749f1d9476Smrg
18759f1d9476SmrgAC_SUBST(MAKE_TEXT)
18769f1d9476SmrgAC_SUBST(MAKE_PS)
18779f1d9476SmrgAC_SUBST(MAKE_PDF)
18789f1d9476SmrgAC_SUBST(MAKE_HTML)
18799f1d9476Smrg]) # XORG_CHECK_LINUXDOC
18809f1d9476Smrg
18819f1d9476Smrg# XORG_CHECK_DOCBOOK
18829f1d9476Smrg# -------------------
18839f1d9476Smrg# Minimum version: 1.0.0
18849f1d9476Smrg#
18859f1d9476Smrg# Checks for the ability to build output formats from SGML DocBook source.
18869f1d9476Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
18879f1d9476Smrg# indicates whether the necessary tools and files are found and, if set,
18889f1d9476Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
18899f1d9476SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
18909f1d9476SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18919f1d9476Smrg
18929f1d9476SmrgBUILDTXTDOC=no
18939f1d9476SmrgBUILDPDFDOC=no
18949f1d9476SmrgBUILDPSDOC=no
18959f1d9476SmrgBUILDHTMLDOC=no
18969f1d9476Smrg
18979f1d9476SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
18989f1d9476SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
18999f1d9476SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
19009f1d9476SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901f33d31a3Smrg
19029f1d9476SmrgAC_MSG_CHECKING([whether to build text documentation])
19039f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
19049f1d9476Smrg   test x$BUILD_TXTDOC != xno; then
19059f1d9476Smrg	BUILDTXTDOC=yes
19069f1d9476Smrgfi
19079f1d9476SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
19089f1d9476SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909f33d31a3Smrg
19109f1d9476SmrgAC_MSG_CHECKING([whether to build PDF documentation])
19119f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
19129f1d9476Smrg   test x$BUILD_PDFDOC != xno; then
19139f1d9476Smrg	BUILDPDFDOC=yes
19149f1d9476Smrgfi
19159f1d9476SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
19169f1d9476SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917f33d31a3Smrg
19189f1d9476SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
19199f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
19209f1d9476Smrg   test x$BUILD_PSDOC != xno; then
19219f1d9476Smrg	BUILDPSDOC=yes
1922f33d31a3Smrgfi
19239f1d9476SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
19249f1d9476SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925f33d31a3Smrg
19269f1d9476SmrgAC_MSG_CHECKING([whether to build HTML documentation])
19279f1d9476Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
19289f1d9476Smrg   test x$BUILD_HTMLDOC != xno; then
19299f1d9476Smrg	BUILDHTMLDOC=yes
19309f1d9476Smrgfi
19319f1d9476SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
19329f1d9476SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933f33d31a3Smrg
19349f1d9476SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
19359f1d9476SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
19369f1d9476SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
19379f1d9476SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
19389f1d9476Smrg
19399f1d9476SmrgAC_SUBST(MAKE_TEXT)
19409f1d9476SmrgAC_SUBST(MAKE_PS)
19419f1d9476SmrgAC_SUBST(MAKE_PDF)
19429f1d9476SmrgAC_SUBST(MAKE_HTML)
19439f1d9476Smrg]) # XORG_CHECK_DOCBOOK
19449f1d9476Smrg
19459f1d9476Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19469f1d9476Smrg# ----------------
19479f1d9476Smrg# Minimum version: 1.5.0
19489f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1949f33d31a3Smrg#
19509f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
19519f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
19529f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19538b5ec993Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19549f1d9476Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19559f1d9476Smrg# --with-xmlto assumes 'auto'.
1956f33d31a3Smrg#
19579f1d9476Smrg# Interface to module:
19589f1d9476Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
19599f1d9476Smrg# XMLTO:	returns the path of the xmlto program found
19609f1d9476Smrg#		returns the path set by the user in the environment
19619f1d9476Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
19629f1d9476Smrg#		'no' user instructs the module not to use xmlto
1963f33d31a3Smrg#
19649f1d9476Smrg# Added in version 1.10.0
19659f1d9476Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
19669f1d9476Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1967f33d31a3Smrg#
19689f1d9476Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1969f33d31a3Smrg#
19709f1d9476SmrgAC_DEFUN([XORG_WITH_XMLTO],[
19719f1d9476SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19729f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
19739f1d9476SmrgAC_ARG_WITH(xmlto,
19749f1d9476Smrg	AS_HELP_STRING([--with-xmlto],
19759f1d9476Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19769f1d9476Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19779f1d9476Smrgm4_undefine([_defopt])
1978f33d31a3Smrg
19799f1d9476Smrgif test "x$use_xmlto" = x"auto"; then
19809f1d9476Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19819f1d9476Smrg   if test "x$XMLTO" = "x"; then
19829f1d9476Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
19839f1d9476Smrg	have_xmlto=no
19849f1d9476Smrg   else
19859f1d9476Smrg        have_xmlto=yes
19869f1d9476Smrg   fi
19879f1d9476Smrgelif test "x$use_xmlto" = x"yes" ; then
19889f1d9476Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19899f1d9476Smrg   if test "x$XMLTO" = "x"; then
19909f1d9476Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
19919f1d9476Smrg   fi
19929f1d9476Smrg   have_xmlto=yes
19939f1d9476Smrgelif test "x$use_xmlto" = x"no" ; then
19949f1d9476Smrg   if test "x$XMLTO" != "x"; then
19959f1d9476Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
19969f1d9476Smrg   fi
19979f1d9476Smrg   have_xmlto=no
19989f1d9476Smrgelse
19999f1d9476Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20009f1d9476Smrgfi
2001f33d31a3Smrg
20029f1d9476Smrg# Test for a minimum version of xmlto, if provided.
20039f1d9476Smrgm4_ifval([$1],
20049f1d9476Smrg[if test "$have_xmlto" = yes; then
20059f1d9476Smrg    # scrape the xmlto version
20069f1d9476Smrg    AC_MSG_CHECKING([the xmlto version])
20079f1d9476Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
20089f1d9476Smrg    AC_MSG_RESULT([$xmlto_version])
20099f1d9476Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
20109f1d9476Smrg        [if test "x$use_xmlto" = xauto; then
20119f1d9476Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
20129f1d9476Smrg            have_xmlto=no
20139f1d9476Smrg        else
20149f1d9476Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
20159f1d9476Smrg        fi])
20169f1d9476Smrgfi])
2017f33d31a3Smrg
20189f1d9476Smrg# Test for the ability of xmlto to generate a text target
20199f1d9476Smrg#
20209f1d9476Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
20219f1d9476Smrg# following test for empty XML docbook files.
20229f1d9476Smrg# For compatibility reasons use the following empty XML docbook file and if
20239f1d9476Smrg# it fails try it again with a non-empty XML file.
20249f1d9476Smrghave_xmlto_text=no
20259f1d9476Smrgcat > conftest.xml << "EOF"
20269f1d9476SmrgEOF
20279f1d9476SmrgAS_IF([test "$have_xmlto" = yes],
20289f1d9476Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20299f1d9476Smrg             [have_xmlto_text=yes],
20309f1d9476Smrg             [# Try it again with a non-empty XML file.
20319f1d9476Smrg              cat > conftest.xml << "EOF"
20329f1d9476Smrg<x></x>
20339f1d9476SmrgEOF
20349f1d9476Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20359f1d9476Smrg                    [have_xmlto_text=yes],
20369f1d9476Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
20379f1d9476Smrgrm -f conftest.xml
20389f1d9476SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
20399f1d9476SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
20409f1d9476Smrg]) # XORG_WITH_XMLTO
2041f33d31a3Smrg
20429f1d9476Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
20439f1d9476Smrg# --------------------------------------------
20449f1d9476Smrg# Minimum version: 1.12.0
20459f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.12.0
20469f1d9476Smrg#
20479f1d9476Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
20489f1d9476Smrg# XML-based language used for the transformation of XML documents.
20499f1d9476Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
20509f1d9476Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
20519f1d9476Smrg# The XSLT processor is often used as a standalone tool for transformations.
20529f1d9476Smrg# It should not be assumed that this tool is used only to work with documnetation.
20539f1d9476Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20549f1d9476Smrg#
20559f1d9476Smrg# Interface to module:
20569f1d9476Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
20579f1d9476Smrg# XSLTPROC:	 returns the path of the xsltproc program found
20589f1d9476Smrg#		 returns the path set by the user in the environment
20599f1d9476Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
20609f1d9476Smrg#		  'no' user instructs the module not to use xsltproc
20619f1d9476Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20629f1d9476Smrg#
20639f1d9476Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
20649f1d9476Smrg#
20659f1d9476SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
20669f1d9476SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
20679f1d9476Smrg# Preserves the interface, should it be implemented later
20689f1d9476Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
20699f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
20709f1d9476SmrgAC_ARG_WITH(xsltproc,
20719f1d9476Smrg	AS_HELP_STRING([--with-xsltproc],
20729f1d9476Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
20739f1d9476Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
20749f1d9476Smrgm4_undefine([_defopt])
2075f33d31a3Smrg
20769f1d9476Smrgif test "x$use_xsltproc" = x"auto"; then
20779f1d9476Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20789f1d9476Smrg   if test "x$XSLTPROC" = "x"; then
20799f1d9476Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
20809f1d9476Smrg	have_xsltproc=no
20819f1d9476Smrg   else
20829f1d9476Smrg        have_xsltproc=yes
20839f1d9476Smrg   fi
20849f1d9476Smrgelif test "x$use_xsltproc" = x"yes" ; then
20859f1d9476Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20869f1d9476Smrg   if test "x$XSLTPROC" = "x"; then
20879f1d9476Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
20889f1d9476Smrg   fi
20899f1d9476Smrg   have_xsltproc=yes
20909f1d9476Smrgelif test "x$use_xsltproc" = x"no" ; then
20919f1d9476Smrg   if test "x$XSLTPROC" != "x"; then
20929f1d9476Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
20939f1d9476Smrg   fi
20949f1d9476Smrg   have_xsltproc=no
20959f1d9476Smrgelse
20969f1d9476Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097f33d31a3Smrgfi
2098f33d31a3Smrg
20999f1d9476SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
21009f1d9476Smrg]) # XORG_WITH_XSLTPROC
21019f1d9476Smrg
21029f1d9476Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
21039f1d9476Smrg# ----------------------------------------
21049f1d9476Smrg# Minimum version: 1.15.0
2105f33d31a3Smrg#
21069f1d9476Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
21079f1d9476Smrg# scanning arbitrary text files, extracting information from those text files,
21089f1d9476Smrg# and printing reports based on that information.
2109f33d31a3Smrg#
21109f1d9476Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2111f33d31a3Smrg#
21129f1d9476Smrg# Interface to module:
21139f1d9476Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
21149f1d9476Smrg# PERL:	     returns the path of the perl program found
21159f1d9476Smrg#	     returns the path set by the user in the environment
21169f1d9476Smrg# --with-perl: 'yes' user instructs the module to use perl
21179f1d9476Smrg#	       'no' user instructs the module not to use perl
21189f1d9476Smrg# have_perl: returns yes if perl found in PATH or no
2119f33d31a3Smrg#
21209f1d9476Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21219f1d9476Smrg#
21229f1d9476SmrgAC_DEFUN([XORG_WITH_PERL],[
21239f1d9476SmrgAC_ARG_VAR([PERL], [Path to perl command])
21249f1d9476Smrg# Preserves the interface, should it be implemented later
21259f1d9476Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
21269f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
21279f1d9476SmrgAC_ARG_WITH(perl,
21289f1d9476Smrg	AS_HELP_STRING([--with-perl],
21299f1d9476Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
21309f1d9476Smrg	   [use_perl=$withval], [use_perl=]_defopt)
21319f1d9476Smrgm4_undefine([_defopt])
2132f33d31a3Smrg
21339f1d9476Smrgif test "x$use_perl" = x"auto"; then
21349f1d9476Smrg   AC_PATH_PROG([PERL], [perl])
21359f1d9476Smrg   if test "x$PERL" = "x"; then
21369f1d9476Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
21379f1d9476Smrg	have_perl=no
21389f1d9476Smrg   else
21399f1d9476Smrg        have_perl=yes
21409f1d9476Smrg   fi
21419f1d9476Smrgelif test "x$use_perl" = x"yes" ; then
21429f1d9476Smrg   AC_PATH_PROG([PERL], [perl])
21439f1d9476Smrg   if test "x$PERL" = "x"; then
21449f1d9476Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
21459f1d9476Smrg   fi
21469f1d9476Smrg   have_perl=yes
21479f1d9476Smrgelif test "x$use_perl" = x"no" ; then
21489f1d9476Smrg   if test "x$PERL" != "x"; then
21499f1d9476Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
21509f1d9476Smrg   fi
21519f1d9476Smrg   have_perl=no
21529f1d9476Smrgelse
21539f1d9476Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21549f1d9476Smrgfi
2155f33d31a3Smrg
21569f1d9476SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
21579f1d9476Smrg]) # XORG_WITH_PERL
2158f33d31a3Smrg
21599f1d9476Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2160f33d31a3Smrg# ----------------
21619f1d9476Smrg# Minimum version: 1.5.0
21629f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2163f33d31a3Smrg#
21649f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
21659f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
21669f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21678b5ec993Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21689f1d9476Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21699f1d9476Smrg# --with-asciidoc assumes 'auto'.
2170f33d31a3Smrg#
21719f1d9476Smrg# Interface to module:
21729f1d9476Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
21739f1d9476Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
21749f1d9476Smrg#		 returns the path set by the user in the environment
21759f1d9476Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
21769f1d9476Smrg#		  'no' user instructs the module not to use asciidoc
2177f33d31a3Smrg#
21789f1d9476Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2179f33d31a3Smrg#
21809f1d9476SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
21819f1d9476SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21829f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
21839f1d9476SmrgAC_ARG_WITH(asciidoc,
21849f1d9476Smrg	AS_HELP_STRING([--with-asciidoc],
21859f1d9476Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21869f1d9476Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21879f1d9476Smrgm4_undefine([_defopt])
2188f33d31a3Smrg
21899f1d9476Smrgif test "x$use_asciidoc" = x"auto"; then
21909f1d9476Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21919f1d9476Smrg   if test "x$ASCIIDOC" = "x"; then
21929f1d9476Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
21939f1d9476Smrg	have_asciidoc=no
21949f1d9476Smrg   else
21959f1d9476Smrg        have_asciidoc=yes
21969f1d9476Smrg   fi
21979f1d9476Smrgelif test "x$use_asciidoc" = x"yes" ; then
21989f1d9476Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21999f1d9476Smrg   if test "x$ASCIIDOC" = "x"; then
22009f1d9476Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
22019f1d9476Smrg   fi
22029f1d9476Smrg   have_asciidoc=yes
22039f1d9476Smrgelif test "x$use_asciidoc" = x"no" ; then
22049f1d9476Smrg   if test "x$ASCIIDOC" != "x"; then
22059f1d9476Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
22069f1d9476Smrg   fi
22079f1d9476Smrg   have_asciidoc=no
22089f1d9476Smrgelse
22099f1d9476Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22109f1d9476Smrgfi
22119f1d9476Smrgm4_ifval([$1],
22129f1d9476Smrg[if test "$have_asciidoc" = yes; then
22139f1d9476Smrg    # scrape the asciidoc version
22149f1d9476Smrg    AC_MSG_CHECKING([the asciidoc version])
22159f1d9476Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
22169f1d9476Smrg    AC_MSG_RESULT([$asciidoc_version])
22179f1d9476Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
22189f1d9476Smrg        [if test "x$use_asciidoc" = xauto; then
22199f1d9476Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
22209f1d9476Smrg            have_asciidoc=no
22219f1d9476Smrg        else
22229f1d9476Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
22239f1d9476Smrg        fi])
22249f1d9476Smrgfi])
22259f1d9476SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
22269f1d9476Smrg]) # XORG_WITH_ASCIIDOC
2227f33d31a3Smrg
22289f1d9476Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22299f1d9476Smrg# -------------------------------------------
22309f1d9476Smrg# Minimum version: 1.5.0
22319f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22329f1d9476Smrg# Minimum version for optional DOT checking: 1.18.0
2233f33d31a3Smrg#
22349f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
22359f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
22369f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22378b5ec993Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22389f1d9476Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22399f1d9476Smrg# --with-doxygen assumes 'auto'.
2240f33d31a3Smrg#
22419f1d9476Smrg# Interface to module:
22429f1d9476Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
22439f1d9476Smrg# DOXYGEN:	 returns the path of the doxygen program found
22449f1d9476Smrg#		 returns the path set by the user in the environment
22459f1d9476Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
22469f1d9476Smrg#		  'no' user instructs the module not to use doxygen
2247f33d31a3Smrg#
22489f1d9476Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2249f33d31a3Smrg#
22509f1d9476SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
22519f1d9476SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22529f1d9476SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22539f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
22549f1d9476SmrgAC_ARG_WITH(doxygen,
22559f1d9476Smrg	AS_HELP_STRING([--with-doxygen],
22569f1d9476Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22579f1d9476Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22589f1d9476Smrgm4_undefine([_defopt])
2259f33d31a3Smrg
22609f1d9476Smrgif test "x$use_doxygen" = x"auto"; then
22619f1d9476Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22629f1d9476Smrg   if test "x$DOXYGEN" = "x"; then
22639f1d9476Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
22649f1d9476Smrg	have_doxygen=no
22659f1d9476Smrg   else
22669f1d9476Smrg        have_doxygen=yes
22679f1d9476Smrg   fi
22689f1d9476Smrgelif test "x$use_doxygen" = x"yes" ; then
22699f1d9476Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22709f1d9476Smrg   if test "x$DOXYGEN" = "x"; then
22719f1d9476Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
22729f1d9476Smrg   fi
22739f1d9476Smrg   have_doxygen=yes
22749f1d9476Smrgelif test "x$use_doxygen" = x"no" ; then
22759f1d9476Smrg   if test "x$DOXYGEN" != "x"; then
22769f1d9476Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
22779f1d9476Smrg   fi
22789f1d9476Smrg   have_doxygen=no
2279f33d31a3Smrgelse
22809f1d9476Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2281f33d31a3Smrgfi
22829f1d9476Smrgm4_ifval([$1],
22839f1d9476Smrg[if test "$have_doxygen" = yes; then
22849f1d9476Smrg    # scrape the doxygen version
22859f1d9476Smrg    AC_MSG_CHECKING([the doxygen version])
22869f1d9476Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
22879f1d9476Smrg    AC_MSG_RESULT([$doxygen_version])
22889f1d9476Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
22899f1d9476Smrg        [if test "x$use_doxygen" = xauto; then
22909f1d9476Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
22919f1d9476Smrg            have_doxygen=no
22929f1d9476Smrg        else
22939f1d9476Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
22949f1d9476Smrg        fi])
22959f1d9476Smrgfi])
2296f33d31a3Smrg
22979f1d9476Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22989f1d9476Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22999f1d9476Smrgdnl 	HAVE_DOT = @HAVE_DOT@
23009f1d9476SmrgHAVE_DOT=no
23019f1d9476Smrgif test "x$have_doxygen" = "xyes"; then
23029f1d9476Smrg  AC_PATH_PROG([DOT], [dot])
23039f1d9476Smrg    if test "x$DOT" != "x"; then
23049f1d9476Smrg      HAVE_DOT=yes
23059f1d9476Smrg    fi
23069f1d9476Smrgfi
2307f33d31a3Smrg
23089f1d9476SmrgAC_SUBST([HAVE_DOT])
23099f1d9476SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
23109f1d9476SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
23119f1d9476Smrg]) # XORG_WITH_DOXYGEN
2312f33d31a3Smrg
23139f1d9476Smrg# XORG_WITH_GROFF([DEFAULT])
23149f1d9476Smrg# ----------------
23159f1d9476Smrg# Minimum version: 1.6.0
23169f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2317f33d31a3Smrg#
23189f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
23199f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
23209f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23218b5ec993Smrg# the --with-groff option, it allows maximum flexibility in making decisions
23229f1d9476Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
23239f1d9476Smrg# --with-groff assumes 'auto'.
23249f1d9476Smrg#
23259f1d9476Smrg# Interface to module:
23269f1d9476Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
23279f1d9476Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
23289f1d9476Smrg# HAVE_GROFF_MS: the -ms macros package
23299f1d9476Smrg# GROFF:	 returns the path of the groff program found
23309f1d9476Smrg#		 returns the path set by the user in the environment
23319f1d9476Smrg# --with-groff:	 'yes' user instructs the module to use groff
23329f1d9476Smrg#		 'no' user instructs the module not to use groff
23339f1d9476Smrg#
23349f1d9476Smrg# Added in version 1.9.0:
23359f1d9476Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
23369f1d9476Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
23379f1d9476Smrg#		   psselect from the psutils package.
23389f1d9476Smrg#		   the ghostcript package. Refer to the grohtml man pages
23399f1d9476Smrg#
23409f1d9476Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
23419f1d9476Smrg#
23429f1d9476Smrg# OS and distros often splits groff in a basic and full package, the former
23439f1d9476Smrg# having the groff program and the later having devices, fonts and macros
23449f1d9476Smrg# Checking for the groff executable is not enough.
23459f1d9476Smrg#
23469f1d9476Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
23479f1d9476Smrg# unset HAVE_GROFF or GROFF env variables.
23489f1d9476Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23499f1d9476Smrg#
23509f1d9476SmrgAC_DEFUN([XORG_WITH_GROFF],[
23519f1d9476SmrgAC_ARG_VAR([GROFF], [Path to groff command])
23529f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
23539f1d9476SmrgAC_ARG_WITH(groff,
23549f1d9476Smrg	AS_HELP_STRING([--with-groff],
23559f1d9476Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23569f1d9476Smrg	   [use_groff=$withval], [use_groff=]_defopt)
23579f1d9476Smrgm4_undefine([_defopt])
2358f33d31a3Smrg
23599f1d9476Smrgif test "x$use_groff" = x"auto"; then
23609f1d9476Smrg   AC_PATH_PROG([GROFF], [groff])
23619f1d9476Smrg   if test "x$GROFF" = "x"; then
23629f1d9476Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
23639f1d9476Smrg	have_groff=no
23649f1d9476Smrg   else
23659f1d9476Smrg        have_groff=yes
23669f1d9476Smrg   fi
23679f1d9476Smrgelif test "x$use_groff" = x"yes" ; then
23689f1d9476Smrg   AC_PATH_PROG([GROFF], [groff])
23699f1d9476Smrg   if test "x$GROFF" = "x"; then
23709f1d9476Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
23719f1d9476Smrg   fi
23729f1d9476Smrg   have_groff=yes
23739f1d9476Smrgelif test "x$use_groff" = x"no" ; then
23749f1d9476Smrg   if test "x$GROFF" != "x"; then
23759f1d9476Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
23769f1d9476Smrg   fi
23779f1d9476Smrg   have_groff=no
23789f1d9476Smrgelse
23799f1d9476Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23809f1d9476Smrgfi
2381f33d31a3Smrg
23829f1d9476Smrg# We have groff, test for the presence of the macro packages
23839f1d9476Smrgif test "x$have_groff" = x"yes"; then
23849f1d9476Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
23859f1d9476Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
23869f1d9476Smrg        groff_ms_works=yes
23879f1d9476Smrg    else
23889f1d9476Smrg        groff_ms_works=no
2389f33d31a3Smrg    fi
23909f1d9476Smrg    AC_MSG_RESULT([$groff_ms_works])
23919f1d9476Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
23929f1d9476Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
23939f1d9476Smrg        groff_mm_works=yes
23949f1d9476Smrg    else
23959f1d9476Smrg        groff_mm_works=no
23969f1d9476Smrg    fi
23979f1d9476Smrg    AC_MSG_RESULT([$groff_mm_works])
23989f1d9476Smrgfi
2399f33d31a3Smrg
24009f1d9476Smrg# We have groff, test for HTML dependencies, one command per package
24019f1d9476Smrgif test "x$have_groff" = x"yes"; then
24029f1d9476Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
24039f1d9476Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
24049f1d9476Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
24059f1d9476Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
24069f1d9476Smrg      have_groff_html=yes
24079f1d9476Smrg   else
24089f1d9476Smrg      have_groff_html=no
24099f1d9476Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
24109f1d9476Smrg   fi
24119f1d9476Smrgfi
24129f1d9476Smrg
24139f1d9476Smrg# Set Automake conditionals for Makefiles
24149f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
24159f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
24169f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
24179f1d9476SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
24189f1d9476Smrg]) # XORG_WITH_GROFF
24199f1d9476Smrg
24209f1d9476Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
24219f1d9476Smrg# ---------------------------------------
24229f1d9476Smrg# Minimum version: 1.6.0
24239f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24249f1d9476Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
24259f1d9476Smrg#
24269f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
24279f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
24289f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24298b5ec993Smrg# the --with-fop option, it allows maximum flexibility in making decisions
24309f1d9476Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
24319f1d9476Smrg# --with-fop assumes 'auto'.
24329f1d9476Smrg#
24339f1d9476Smrg# Interface to module:
24349f1d9476Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
24359f1d9476Smrg# FOP:	 	returns the path of the fop program found
24369f1d9476Smrg#		returns the path set by the user in the environment
24379f1d9476Smrg# --with-fop: 	'yes' user instructs the module to use fop
24389f1d9476Smrg#		'no' user instructs the module not to use fop
24399f1d9476Smrg#
24409f1d9476Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
24419f1d9476Smrg#
24429f1d9476SmrgAC_DEFUN([XORG_WITH_FOP],[
24439f1d9476SmrgAC_ARG_VAR([FOP], [Path to fop command])
24449f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
24459f1d9476SmrgAC_ARG_WITH(fop,
24469f1d9476Smrg	AS_HELP_STRING([--with-fop],
24479f1d9476Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24489f1d9476Smrg	   [use_fop=$withval], [use_fop=]_defopt)
24499f1d9476Smrgm4_undefine([_defopt])
24509f1d9476Smrg
24519f1d9476Smrgif test "x$use_fop" = x"auto"; then
24529f1d9476Smrg   AC_PATH_PROG([FOP], [fop])
24539f1d9476Smrg   if test "x$FOP" = "x"; then
24549f1d9476Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
24559f1d9476Smrg	have_fop=no
24569f1d9476Smrg   else
24579f1d9476Smrg        have_fop=yes
24589f1d9476Smrg   fi
24599f1d9476Smrgelif test "x$use_fop" = x"yes" ; then
24609f1d9476Smrg   AC_PATH_PROG([FOP], [fop])
24619f1d9476Smrg   if test "x$FOP" = "x"; then
24629f1d9476Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
24639f1d9476Smrg   fi
24649f1d9476Smrg   have_fop=yes
24659f1d9476Smrgelif test "x$use_fop" = x"no" ; then
24669f1d9476Smrg   if test "x$FOP" != "x"; then
24679f1d9476Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
24689f1d9476Smrg   fi
24699f1d9476Smrg   have_fop=no
2470f33d31a3Smrgelse
24719f1d9476Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2472f33d31a3Smrgfi
2473f33d31a3Smrg
24749f1d9476Smrg# Test for a minimum version of fop, if provided.
24759f1d9476Smrgm4_ifval([$1],
24769f1d9476Smrg[if test "$have_fop" = yes; then
24779f1d9476Smrg    # scrape the fop version
24789f1d9476Smrg    AC_MSG_CHECKING([for fop minimum version])
24799f1d9476Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
24809f1d9476Smrg    AC_MSG_RESULT([$fop_version])
24819f1d9476Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
24829f1d9476Smrg        [if test "x$use_fop" = xauto; then
24839f1d9476Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
24849f1d9476Smrg            have_fop=no
24859f1d9476Smrg        else
24869f1d9476Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
24879f1d9476Smrg        fi])
24889f1d9476Smrgfi])
24899f1d9476SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
24909f1d9476Smrg]) # XORG_WITH_FOP
24919f1d9476Smrg
24929f1d9476Smrg# XORG_WITH_M4([MIN-VERSION])
24939f1d9476Smrg# ---------------------------
24949f1d9476Smrg# Minimum version: 1.19.0
24959f1d9476Smrg#
24969f1d9476Smrg# This macro attempts to locate an m4 macro processor which supports
24979f1d9476Smrg# -I option and is only useful for modules relying on M4 in order to
24989f1d9476Smrg# expand macros in source code files.
24999f1d9476Smrg#
25009f1d9476Smrg# Interface to module:
25019f1d9476Smrg# M4:	 	returns the path of the m4 program found
25029f1d9476Smrg#		returns the path set by the user in the environment
25039f1d9476Smrg#
25049f1d9476SmrgAC_DEFUN([XORG_WITH_M4], [
25059f1d9476SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25069f1d9476Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25079f1d9476Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25089f1d9476Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25099f1d9476Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25109f1d9476Smrg   [$PATH:/usr/gnu/bin])])
2511f33d31a3Smrg
25129f1d9476SmrgAC_SUBST([M4], [$ac_cv_path_M4])
25139f1d9476Smrg]) # XORG_WITH_M4
2514f33d31a3Smrg
25159f1d9476Smrg# XORG_WITH_PS2PDF([DEFAULT])
25169f1d9476Smrg# ----------------
25179f1d9476Smrg# Minimum version: 1.6.0
25189f1d9476Smrg# Minimum version for optional DEFAULT argument: 1.11.0
25199f1d9476Smrg#
25209f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
25219f1d9476Smrg# not at the appropriate level. This macro enables a module to test for the
25229f1d9476Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25238b5ec993Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25249f1d9476Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25259f1d9476Smrg# --with-ps2pdf assumes 'auto'.
25269f1d9476Smrg#
25279f1d9476Smrg# Interface to module:
25289f1d9476Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
25299f1d9476Smrg# PS2PDF:	returns the path of the ps2pdf program found
25309f1d9476Smrg#		returns the path set by the user in the environment
25319f1d9476Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
25329f1d9476Smrg#		 'no' user instructs the module not to use ps2pdf
25339f1d9476Smrg#
25349f1d9476Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
25359f1d9476Smrg#
25369f1d9476SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
25379f1d9476SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25389f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
25399f1d9476SmrgAC_ARG_WITH(ps2pdf,
25409f1d9476Smrg	AS_HELP_STRING([--with-ps2pdf],
25419f1d9476Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25429f1d9476Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25439f1d9476Smrgm4_undefine([_defopt])
2544f33d31a3Smrg
25459f1d9476Smrgif test "x$use_ps2pdf" = x"auto"; then
25469f1d9476Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25479f1d9476Smrg   if test "x$PS2PDF" = "x"; then
25489f1d9476Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
25499f1d9476Smrg	have_ps2pdf=no
25509f1d9476Smrg   else
25519f1d9476Smrg        have_ps2pdf=yes
25529f1d9476Smrg   fi
25539f1d9476Smrgelif test "x$use_ps2pdf" = x"yes" ; then
25549f1d9476Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25559f1d9476Smrg   if test "x$PS2PDF" = "x"; then
25569f1d9476Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
25579f1d9476Smrg   fi
25589f1d9476Smrg   have_ps2pdf=yes
25599f1d9476Smrgelif test "x$use_ps2pdf" = x"no" ; then
25609f1d9476Smrg   if test "x$PS2PDF" != "x"; then
25619f1d9476Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
25629f1d9476Smrg   fi
25639f1d9476Smrg   have_ps2pdf=no
25649f1d9476Smrgelse
25659f1d9476Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566f33d31a3Smrgfi
25679f1d9476SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
25689f1d9476Smrg]) # XORG_WITH_PS2PDF
2569f33d31a3Smrg
25709f1d9476Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
25719f1d9476Smrg# ----------------
25729f1d9476Smrg# Minimum version: 1.6.0
2573f33d31a3Smrg#
25749f1d9476Smrg# Documentation tools are not always available on all platforms and sometimes
25759f1d9476Smrg# not at the appropriate level. This macro enables a builder to skip all
25769f1d9476Smrg# documentation targets except traditional man pages.
25779f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25788b5ec993Smrg# maximum flexibility in controlling documentation building.
25799f1d9476Smrg# Refer to:
25809f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
25819f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25829f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
25839f1d9476Smrg# XORG_WITH_FOP           --with-fop
25849f1d9476Smrg# XORG_WITH_GROFF         --with-groff
25859f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
25869f1d9476Smrg#
25879f1d9476Smrg# Interface to module:
25889f1d9476Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
25899f1d9476Smrg# --enable-docs: 'yes' user instructs the module to generate docs
25909f1d9476Smrg#		 'no' user instructs the module not to generate docs
25919f1d9476Smrg# parm1:	specify the default value, yes or no.
25929f1d9476Smrg#
25939f1d9476SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
25949f1d9476Smrgm4_define([docs_default], m4_default([$1], [yes]))
25959f1d9476SmrgAC_ARG_ENABLE(docs,
25969f1d9476Smrg	AS_HELP_STRING([--enable-docs],
25979f1d9476Smrg	   [Enable building the documentation (default: ]docs_default[)]),
25989f1d9476Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
25999f1d9476Smrgm4_undefine([docs_default])
26009f1d9476SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
26019f1d9476SmrgAC_MSG_CHECKING([whether to build documentation])
26029f1d9476SmrgAC_MSG_RESULT([$build_docs])
26039f1d9476Smrg]) # XORG_ENABLE_DOCS
2604f33d31a3Smrg
26059f1d9476Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
26069f1d9476Smrg# ----------------
26079f1d9476Smrg# Minimum version: 1.6.0
26089f1d9476Smrg#
26099f1d9476Smrg# This macro enables a builder to skip all developer documentation.
26109f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26118b5ec993Smrg# maximum flexibility in controlling documentation building.
26129f1d9476Smrg# Refer to:
26139f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
26149f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26159f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26169f1d9476Smrg# XORG_WITH_FOP           --with-fop
26179f1d9476Smrg# XORG_WITH_GROFF         --with-groff
26189f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
26199f1d9476Smrg#
26209f1d9476Smrg# Interface to module:
26219f1d9476Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
26229f1d9476Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
26239f1d9476Smrg#			'no' user instructs the module not to generate developer docs
26249f1d9476Smrg# parm1:		specify the default value, yes or no.
26259f1d9476Smrg#
26269f1d9476SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26279f1d9476Smrgm4_define([devel_default], m4_default([$1], [yes]))
26289f1d9476SmrgAC_ARG_ENABLE(devel-docs,
26299f1d9476Smrg	AS_HELP_STRING([--enable-devel-docs],
26309f1d9476Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26319f1d9476Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26329f1d9476Smrgm4_undefine([devel_default])
26339f1d9476SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
26349f1d9476SmrgAC_MSG_CHECKING([whether to build developer documentation])
26359f1d9476SmrgAC_MSG_RESULT([$build_devel_docs])
26369f1d9476Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637f33d31a3Smrg
26389f1d9476Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
26399f1d9476Smrg# ----------------
26409f1d9476Smrg# Minimum version: 1.6.0
26419f1d9476Smrg#
26429f1d9476Smrg# This macro enables a builder to skip all functional specification targets.
26439f1d9476Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26448b5ec993Smrg# maximum flexibility in controlling documentation building.
26459f1d9476Smrg# Refer to:
26469f1d9476Smrg# XORG_WITH_XMLTO         --with-xmlto
26479f1d9476Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26489f1d9476Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26499f1d9476Smrg# XORG_WITH_FOP           --with-fop
26509f1d9476Smrg# XORG_WITH_GROFF         --with-groff
26519f1d9476Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
26529f1d9476Smrg#
26539f1d9476Smrg# Interface to module:
26549f1d9476Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
26559f1d9476Smrg# --enable-specs:	'yes' user instructs the module to generate specs
26569f1d9476Smrg#			'no' user instructs the module not to generate specs
26579f1d9476Smrg# parm1:		specify the default value, yes or no.
26589f1d9476Smrg#
26599f1d9476SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26609f1d9476Smrgm4_define([spec_default], m4_default([$1], [yes]))
26619f1d9476SmrgAC_ARG_ENABLE(specs,
26629f1d9476Smrg	AS_HELP_STRING([--enable-specs],
26639f1d9476Smrg	   [Enable building the specs (default: ]spec_default[)]),
26649f1d9476Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
26659f1d9476Smrgm4_undefine([spec_default])
26669f1d9476SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
26679f1d9476SmrgAC_MSG_CHECKING([whether to build functional specifications])
26689f1d9476SmrgAC_MSG_RESULT([$build_specs])
26699f1d9476Smrg]) # XORG_ENABLE_SPECS
2670f33d31a3Smrg
26719f1d9476Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
26729f1d9476Smrg# ----------------------------------------------
26739f1d9476Smrg# Minimum version: 1.13.0
2674f33d31a3Smrg#
26759f1d9476Smrg# This macro enables a builder to enable/disable unit testing
26769f1d9476Smrg# It makes no assumption about the test cases implementation
26779f1d9476Smrg# Test cases may or may not use Automake "Support for test suites"
26789f1d9476Smrg# They may or may not use the software utility library GLib
26799f1d9476Smrg#
26809f1d9476Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
26819f1d9476Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
26829f1d9476Smrg# The variable enable_unit_tests is used by other macros in this file.
26839f1d9476Smrg#
26849f1d9476Smrg# Interface to module:
26859f1d9476Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
26869f1d9476Smrg# enable_unit_tests:    used in configure.ac for additional configuration
26879f1d9476Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
26889f1d9476Smrg#			'no' user instructs the module not to build tests
26899f1d9476Smrg# parm1:		specify the default value, yes or no.
26909f1d9476Smrg#
26919f1d9476SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
26929f1d9476SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
26939f1d9476SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
26949f1d9476SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26959f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
26969f1d9476SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
26979f1d9476Smrg	[Enable building unit test cases (default: ]_defopt[)]),
26989f1d9476Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
26999f1d9476Smrgm4_undefine([_defopt])
27009f1d9476SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27019f1d9476SmrgAC_MSG_CHECKING([whether to build unit test cases])
27029f1d9476SmrgAC_MSG_RESULT([$enable_unit_tests])
27039f1d9476Smrg]) # XORG_ENABLE_UNIT_TESTS
2704f33d31a3Smrg
27059f1d9476Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27069f1d9476Smrg# ------------------------------------------------------
27079f1d9476Smrg# Minimum version: 1.17.0
27089f1d9476Smrg#
27099f1d9476Smrg# This macro enables a builder to enable/disable integration testing
27109f1d9476Smrg# It makes no assumption about the test cases' implementation
27119f1d9476Smrg# Test cases may or may not use Automake "Support for test suites"
27129f1d9476Smrg#
27139f1d9476Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27149f1d9476Smrg# usually requires less dependencies and may be built and run under less
27159f1d9476Smrg# stringent environments than integration tests.
27169f1d9476Smrg#
27179f1d9476Smrg# Interface to module:
27189f1d9476Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
27199f1d9476Smrg# enable_integration_tests:   used in configure.ac for additional configuration
27209f1d9476Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
27219f1d9476Smrg#                             'no' user instructs the module not to build tests
27229f1d9476Smrg# parm1:                      specify the default value, yes or no.
27239f1d9476Smrg#
27249f1d9476SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
27259f1d9476SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27269f1d9476Smrgm4_define([_defopt], m4_default([$1], [auto]))
27279f1d9476SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
27289f1d9476Smrg	[Enable building integration test cases (default: ]_defopt[)]),
27299f1d9476Smrg	[enable_integration_tests=$enableval],
27309f1d9476Smrg	[enable_integration_tests=]_defopt)
27319f1d9476Smrgm4_undefine([_defopt])
27329f1d9476SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
27339f1d9476Smrg	[test "x$enable_integration_tests" != xno])
27349f1d9476SmrgAC_MSG_CHECKING([whether to build unit test cases])
27359f1d9476SmrgAC_MSG_RESULT([$enable_integration_tests])
27369f1d9476Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737f33d31a3Smrg
27389f1d9476Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
27399f1d9476Smrg# ----------------------------------------
27409f1d9476Smrg# Minimum version: 1.13.0
27419f1d9476Smrg#
27429f1d9476Smrg# GLib is a library which provides advanced data structures and functions.
27439f1d9476Smrg# This macro enables a module to test for the presence of Glib.
27449f1d9476Smrg#
27459f1d9476Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
27469f1d9476Smrg# Otherwise the value of $enable_unit_tests is blank.
27479f1d9476Smrg#
27489f1d9476Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
27499f1d9476Smrg# test support usually requires less dependencies and may be built and run under
27509f1d9476Smrg# less stringent environments than integration tests.
2751f33d31a3Smrg#
27529f1d9476Smrg# Interface to module:
27539f1d9476Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
27549f1d9476Smrg# with_glib: used in configure.ac to know if GLib has been found
27559f1d9476Smrg# --with-glib:	'yes' user instructs the module to use glib
27569f1d9476Smrg#		'no' user instructs the module not to use glib
27579f1d9476Smrg#
27589f1d9476SmrgAC_DEFUN([XORG_WITH_GLIB],[
27599f1d9476SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
27609f1d9476Smrgm4_define([_defopt], m4_default([$2], [auto]))
27619f1d9476SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
27629f1d9476Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
27639f1d9476Smrg	[with_glib=$withval], [with_glib=]_defopt)
27649f1d9476Smrgm4_undefine([_defopt])
2765f33d31a3Smrg
27669f1d9476Smrghave_glib=no
27679f1d9476Smrg# Do not probe GLib if user explicitly disabled unit testing
27689f1d9476Smrgif test "x$enable_unit_tests" != x"no"; then
27699f1d9476Smrg  # Do not probe GLib if user explicitly disabled it
27709f1d9476Smrg  if test "x$with_glib" != x"no"; then
27719f1d9476Smrg    m4_ifval(
27729f1d9476Smrg      [$1],
27739f1d9476Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
27749f1d9476Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
27759f1d9476Smrg    )
2776f33d31a3Smrg  fi
2777f33d31a3Smrgfi
2778f33d31a3Smrg
27799f1d9476Smrg# Not having GLib when unit testing has been explicitly requested is an error
27809f1d9476Smrgif test "x$enable_unit_tests" = x"yes"; then
27819f1d9476Smrg  if test "x$have_glib" = x"no"; then
27829f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2783f33d31a3Smrg  fi
2784f33d31a3Smrgfi
2785f33d31a3Smrg
27869f1d9476Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
27879f1d9476Smrgif test "x$enable_unit_tests" = x"no"; then
27889f1d9476Smrg  if test "x$with_glib" = x"yes"; then
27899f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27909f1d9476Smrg  fi
27919f1d9476Smrgfi
2792f33d31a3Smrg
27939f1d9476Smrg# Not having GLib when it has been explicitly requested is an error
27949f1d9476Smrgif test "x$with_glib" = x"yes"; then
27959f1d9476Smrg  if test "x$have_glib" = x"no"; then
27969f1d9476Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
27979f1d9476Smrg  fi
27989f1d9476Smrgfi
2799f33d31a3Smrg
28009f1d9476SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28019f1d9476Smrg]) # XORG_WITH_GLIB
2802f33d31a3Smrg
28039f1d9476Smrg# XORG_LD_WRAP([required|optional])
28049f1d9476Smrg# ---------------------------------
28059f1d9476Smrg# Minimum version: 1.13.0
28069f1d9476Smrg#
28079f1d9476Smrg# Check if linker supports -wrap, passed via compiler flags
28089f1d9476Smrg#
28099f1d9476Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28109f1d9476Smrg# Otherwise the value of $enable_unit_tests is blank.
28119f1d9476Smrg#
28129f1d9476Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
28139f1d9476Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
28149f1d9476Smrg# available, an argument of "optional" allows use when some unit tests require
28159f1d9476Smrg# ld -wrap and others do not.
28169f1d9476Smrg#
28179f1d9476SmrgAC_DEFUN([XORG_LD_WRAP],[
28189f1d9476SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
28199f1d9476Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
28209f1d9476Smrg                      void __wrap_exit(int status) { return; }],
28219f1d9476Smrg                     [exit(0);])])
28229f1d9476Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
28239f1d9476Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
28249f1d9476Smrg  if test "x$have_ld_wrap" = x"no"; then
28259f1d9476Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
28269f1d9476Smrg  fi
28279f1d9476Smrgfi
28289f1d9476SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
28299f1d9476Smrg#
28309f1d9476Smrg]) # XORG_LD_WRAP
2831f33d31a3Smrg
28329f1d9476Smrg# XORG_CHECK_LINKER_FLAGS
28339f1d9476Smrg# -----------------------
28349f1d9476Smrg# SYNOPSIS
28359f1d9476Smrg#
28369f1d9476Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
28379f1d9476Smrg#
28389f1d9476Smrg# DESCRIPTION
28399f1d9476Smrg#
28409f1d9476Smrg#   Check whether the given linker FLAGS work with the current language's
28419f1d9476Smrg#   linker, or whether they give an error.
28429f1d9476Smrg#
28439f1d9476Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
28449f1d9476Smrg#   success/failure.
28459f1d9476Smrg#
28469f1d9476Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
28479f1d9476Smrg#
28489f1d9476Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
28499f1d9476Smrg#
28509f1d9476Smrg# LICENSE
28519f1d9476Smrg#
28529f1d9476Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
28539f1d9476Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
28549f1d9476Smrg#   Copyright (c) 2009 Matteo Frigo
28559f1d9476Smrg#
28569f1d9476Smrg#   This program is free software: you can redistribute it and/or modify it
28579f1d9476Smrg#   under the terms of the GNU General Public License as published by the
28589f1d9476Smrg#   Free Software Foundation, either version 3 of the License, or (at your
28599f1d9476Smrg#   option) any later version.
28609f1d9476Smrg#
28619f1d9476Smrg#   This program is distributed in the hope that it will be useful, but
28629f1d9476Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
28639f1d9476Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28649f1d9476Smrg#   Public License for more details.
28659f1d9476Smrg#
28669f1d9476Smrg#   You should have received a copy of the GNU General Public License along
28679f1d9476Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
28689f1d9476Smrg#
28699f1d9476Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
28709f1d9476Smrg#   gives unlimited permission to copy, distribute and modify the configure
28719f1d9476Smrg#   scripts that are the output of Autoconf when processing the Macro. You
28729f1d9476Smrg#   need not follow the terms of the GNU General Public License when using
28739f1d9476Smrg#   or distributing such scripts, even though portions of the text of the
28749f1d9476Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
28759f1d9476Smrg#   all other use of the material that constitutes the Autoconf Macro.
28769f1d9476Smrg#
28779f1d9476Smrg#   This special exception to the GPL applies to versions of the Autoconf
28789f1d9476Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
28799f1d9476Smrg#   modified version of the Autoconf Macro, you may extend this special
28809f1d9476Smrg#   exception to the GPL to apply to your modified version as well.#
28819f1d9476SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
28829f1d9476Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
28839f1d9476Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
28849f1d9476SmrgAS_LITERAL_IF([$1],
28859f1d9476Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
28869f1d9476Smrg      ax_save_FLAGS=$LDFLAGS
28879f1d9476Smrg      LDFLAGS="$1"
28889f1d9476Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
28899f1d9476Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28909f1d9476Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28919f1d9476Smrg      LDFLAGS=$ax_save_FLAGS])],
28929f1d9476Smrg  [ax_save_FLAGS=$LDFLAGS
28939f1d9476Smrg   LDFLAGS="$1"
28949f1d9476Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
28959f1d9476Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28969f1d9476Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28979f1d9476Smrg   LDFLAGS=$ax_save_FLAGS])
28989f1d9476Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
28999f1d9476SmrgAC_MSG_RESULT($xorg_check_linker_flags)
29009f1d9476Smrgif test "x$xorg_check_linker_flags" = xyes; then
29019f1d9476Smrg	m4_default([$2], :)
29029f1d9476Smrgelse
29039f1d9476Smrg	m4_default([$3], :)
29049f1d9476Smrgfi
29059f1d9476Smrg]) # XORG_CHECK_LINKER_FLAGS
2906f33d31a3Smrg
29079f1d9476Smrg# XORG_MEMORY_CHECK_FLAGS
29089f1d9476Smrg# -----------------------
29099f1d9476Smrg# Minimum version: 1.16.0
29109f1d9476Smrg#
29119f1d9476Smrg# This macro attempts to find appropriate memory checking functionality
29129f1d9476Smrg# for various platforms which unit testing code may use to catch various
29139f1d9476Smrg# forms of memory allocation and access errors in testing.
29149f1d9476Smrg#
29159f1d9476Smrg# Interface to module:
29169f1d9476Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
29179f1d9476Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
29189f1d9476Smrg#
29199f1d9476Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
29209f1d9476Smrg#
29219f1d9476SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922f33d31a3Smrg
29239f1d9476SmrgAC_REQUIRE([AC_CANONICAL_HOST])
29249f1d9476SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
29259f1d9476Smrg           [Environment variables to enable memory checking in tests])
2926f33d31a3Smrg
29279f1d9476Smrg# Check for different types of support on different platforms
29289f1d9476Smrgcase $host_os in
29299f1d9476Smrg    solaris*)
29309f1d9476Smrg        AC_CHECK_LIB([umem], [umem_alloc],
29319f1d9476Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
29329f1d9476Smrg        ;;
29339f1d9476Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
29349f1d9476Smrg        # both directly and inverted, so should not be 0 or 255.
29359f1d9476Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
29369f1d9476Smrg        ;;
29379f1d9476Smrg    darwin*)
29389f1d9476Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
29399f1d9476Smrg        ;;
29409f1d9476Smrg    *bsd*)
29419f1d9476Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
29429f1d9476Smrg        ;;
29439f1d9476Smrgesac
2944f33d31a3Smrg
29459f1d9476Smrg# User supplied flags override default flags
29469f1d9476Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
29479f1d9476Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948f33d31a3Smrgfi
2949f33d31a3Smrg
29509f1d9476SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
29519f1d9476Smrg]) # XORG_WITH_LINT
2952f33d31a3Smrg
29539f1d9476Smrg# XORG_CHECK_MALLOC_ZERO
29549f1d9476Smrg# ----------------------
29559f1d9476Smrg# Minimum version: 1.0.0
2956f33d31a3Smrg#
29579f1d9476Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
29589f1d9476Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
29599f1d9476Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29608b5ec993Smrg#
29618b5ec993Smrg# No longer actually tests since there is no guarantee applications will
29628b5ec993Smrg# run with the same malloc implementation we tested against, and the cost
29638b5ec993Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29648b5ec993Smrg# Still allows builders to override when they have complete control over
29658b5ec993Smrg# which malloc implementation will be used.
29669f1d9476SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
29679f1d9476SmrgAC_ARG_ENABLE(malloc0returnsnull,
29689f1d9476Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29698b5ec993Smrg		       [assume malloc(0) can return NULL (default: yes)]),
29709f1d9476Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29718b5ec993Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29728b5ec993Smrg
29738b5ec993SmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
29749f1d9476SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975f33d31a3Smrg
29769f1d9476Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
29779f1d9476Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
29789f1d9476Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
29799f1d9476Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2980f33d31a3Smrgelse
29819f1d9476Smrg	MALLOC_ZERO_CFLAGS=""
29829f1d9476Smrg	XMALLOC_ZERO_CFLAGS=""
29839f1d9476Smrg	XTMALLOC_ZERO_CFLAGS=""
2984f33d31a3Smrgfi
2985f33d31a3Smrg
29869f1d9476SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
29879f1d9476SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
29889f1d9476SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
29899f1d9476Smrg]) # XORG_CHECK_MALLOC_ZERO
2990f33d31a3Smrg
29919f1d9476Smrg# XORG_WITH_LINT()
29929f1d9476Smrg# ----------------
29939f1d9476Smrg# Minimum version: 1.1.0
2994f33d31a3Smrg#
29959f1d9476Smrg# This macro enables the use of a tool that flags some suspicious and
29969f1d9476Smrg# non-portable constructs (likely to be bugs) in C language source code.
29979f1d9476Smrg# It will attempt to locate the tool and use appropriate options.
29989f1d9476Smrg# There are various lint type tools on different platforms.
2999f33d31a3Smrg#
30009f1d9476Smrg# Interface to module:
30019f1d9476Smrg# LINT:		returns the path to the tool found on the platform
30029f1d9476Smrg#		or the value set to LINT on the configure cmd line
30039f1d9476Smrg#		also an Automake conditional
30049f1d9476Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
30059f1d9476Smrg#
30069f1d9476Smrg# --with-lint:	'yes' user instructs the module to use lint
30079f1d9476Smrg#		'no' user instructs the module not to use lint (default)
30089f1d9476Smrg#
30099f1d9476Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
30109f1d9476Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
30119f1d9476Smrg#
30129f1d9476SmrgAC_DEFUN([XORG_WITH_LINT],[
3013f33d31a3Smrg
30149f1d9476SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
30159f1d9476SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
30169f1d9476SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
30179f1d9476Smrg		[Use a lint-style source code checker (default: disabled)])],
30189f1d9476Smrg		[use_lint=$withval], [use_lint=no])
3019f33d31a3Smrg
30209f1d9476Smrg# Obtain platform specific info like program name and options
30219f1d9476Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
30229f1d9476Smrgcase $host_os in
30239f1d9476Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
30249f1d9476Smrg	lint_name=splint
30259f1d9476Smrg	lint_options="-badflag"
30269f1d9476Smrg	;;
30279f1d9476Smrg  *freebsd* | *netbsd*)
30289f1d9476Smrg	lint_name=lint
30299f1d9476Smrg	lint_options="-u -b"
30309f1d9476Smrg	;;
30319f1d9476Smrg  *solaris*)
30329f1d9476Smrg	lint_name=lint
30339f1d9476Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
30349f1d9476Smrg	;;
30359f1d9476Smrgesac
30369f1d9476Smrg
30379f1d9476Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
30389f1d9476Smrgif test "x$use_lint" = x"yes" ; then
30399f1d9476Smrg   AC_PATH_PROG([LINT], [$lint_name])
30409f1d9476Smrg   if test "x$LINT" = "x"; then
30419f1d9476Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
30429f1d9476Smrg   fi
30439f1d9476Smrgelif test "x$use_lint" = x"no" ; then
30449f1d9476Smrg   if test "x$LINT" != "x"; then
30459f1d9476Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
30469f1d9476Smrg   fi
3047f33d31a3Smrgelse
30489f1d9476Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3049f33d31a3Smrgfi
3050f33d31a3Smrg
30519f1d9476Smrg# User supplied flags override default flags
30529f1d9476Smrgif test "x$LINT_FLAGS" != "x"; then
30539f1d9476Smrg   lint_options=$LINT_FLAGS
30549f1d9476Smrgfi
3055f33d31a3Smrg
30569f1d9476SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
30579f1d9476SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058f33d31a3Smrg
30599f1d9476Smrg]) # XORG_WITH_LINT
3060f33d31a3Smrg
30619f1d9476Smrg# XORG_LINT_LIBRARY(LIBNAME)
30629f1d9476Smrg# --------------------------
30639f1d9476Smrg# Minimum version: 1.1.0
3064f33d31a3Smrg#
30659f1d9476Smrg# Sets up flags for building lint libraries for checking programs that call
30669f1d9476Smrg# functions in the library.
30679f1d9476Smrg#
30689f1d9476Smrg# Interface to module:
30699f1d9476Smrg# LINTLIB		- Automake variable with the name of lint library file to make
30709f1d9476Smrg# MAKE_LINT_LIB		- Automake conditional
30719f1d9476Smrg#
30729f1d9476Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
30739f1d9476Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3074f33d31a3Smrg
30759f1d9476SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
30769f1d9476SmrgAC_REQUIRE([XORG_WITH_LINT])
30779f1d9476SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
30789f1d9476Smrg	[Create lint library (default: disabled)])],
30799f1d9476Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
30809f1d9476Smrg
30819f1d9476Smrgif test "x$make_lint_lib" = x"yes" ; then
30829f1d9476Smrg   LINTLIB=llib-l$1.ln
30839f1d9476Smrg   if test "x$LINT" = "x"; then
30849f1d9476Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
30859f1d9476Smrg   fi
30869f1d9476Smrgelif test "x$make_lint_lib" != x"no" ; then
30879f1d9476Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088f33d31a3Smrgfi
3089f33d31a3Smrg
30909f1d9476SmrgAC_SUBST(LINTLIB)
30919f1d9476SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3092f33d31a3Smrg
30939f1d9476Smrg]) # XORG_LINT_LIBRARY
3094f33d31a3Smrg
30959f1d9476Smrg# XORG_COMPILER_BRAND
3096f33d31a3Smrg# -------------------
30979f1d9476Smrg# Minimum version: 1.14.0
3098f33d31a3Smrg#
30999f1d9476Smrg# Checks for various brands of compilers and sets flags as appropriate:
31009f1d9476Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31019f1d9476Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31029f1d9476Smrg#   clang compiler - sets CLANGCC to "yes"
31039f1d9476Smrg#   Intel compiler - sets INTELCC to "yes"
31049f1d9476Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31059f1d9476Smrg#
31069f1d9476SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
31079f1d9476SmrgAC_LANG_CASE(
31089f1d9476Smrg	[C], [
31098b5ec993Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31108b5ec993Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31118b5ec993Smrg		m4_version_prereq([2.70],
31128b5ec993Smrg			[AC_REQUIRE([AC_PROG_CC])],
31138b5ec993Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31149f1d9476Smrg	],
31159f1d9476Smrg	[C++], [
31169f1d9476Smrg		AC_REQUIRE([AC_PROG_CXX])
31179f1d9476Smrg	]
31189f1d9476Smrg)
31199f1d9476SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
31209f1d9476SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
31219f1d9476SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
31229f1d9476Smrg]) # XORG_COMPILER_BRAND
3123f33d31a3Smrg
31249f1d9476Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3125f33d31a3Smrg# ---------------
31269f1d9476Smrg# Minimum version: 1.16.0
31279f1d9476Smrg#
31289f1d9476Smrg# Test if the compiler works when passed the given flag as a command line argument.
31298b5ec993Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
31309f1d9476Smrg# next flag in the list until there are no more options.
31319f1d9476Smrg#
31329f1d9476Smrg# Note that this does not guarantee that the compiler supports the flag as some
31339f1d9476Smrg# compilers will simply ignore arguments that they do not understand, but we do
31349f1d9476Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
31359f1d9476Smrg# -Werror=unused-command-line-argument
31369f1d9476Smrg#
31379f1d9476SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
31389f1d9476Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31399f1d9476Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140f33d31a3Smrg
31419f1d9476SmrgAC_LANG_COMPILER_REQUIRE
3142f33d31a3Smrg
31439f1d9476SmrgAC_LANG_CASE(
31449f1d9476Smrg	[C], [
31458b5ec993Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31468b5ec993Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31478b5ec993Smrg		m4_version_prereq([2.70],
31488b5ec993Smrg			[AC_REQUIRE([AC_PROG_CC])],
31498b5ec993Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31509f1d9476Smrg		define([PREFIX], [C])
31519f1d9476Smrg		define([CACHE_PREFIX], [cc])
31529f1d9476Smrg		define([COMPILER], [$CC])
31539f1d9476Smrg	],
31549f1d9476Smrg	[C++], [
31559f1d9476Smrg		define([PREFIX], [CXX])
31569f1d9476Smrg		define([CACHE_PREFIX], [cxx])
31579f1d9476Smrg		define([COMPILER], [$CXX])
31589f1d9476Smrg	]
31599f1d9476Smrg)
31609f1d9476Smrg
31619f1d9476Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
31629f1d9476Smrg
31639f1d9476Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
31649f1d9476Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31659f1d9476Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
31669f1d9476Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
31679f1d9476Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31689f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
31699f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
31709f1d9476Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
31719f1d9476Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172f33d31a3Smrgfi
31739f1d9476Smrg
31749f1d9476Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
31759f1d9476Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
31769f1d9476Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31779f1d9476Smrg	fi
31789f1d9476Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31799f1d9476Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
31809f1d9476Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
31819f1d9476Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31829f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
31839f1d9476Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
31849f1d9476Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
31859f1d9476Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31869f1d9476Smrgfi
31879f1d9476Smrg
31889f1d9476Smrgfound="no"
31899f1d9476Smrgm4_foreach([flag], m4_cdr($@), [
31909f1d9476Smrg	if test $found = "no" ; then
31919f1d9476Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
31929f1d9476Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31939f1d9476Smrg		fi
31949f1d9476Smrg
31959f1d9476Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
31969f1d9476Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31979f1d9476Smrg		fi
31989f1d9476Smrg
31999f1d9476Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
32009f1d9476Smrg
32019f1d9476Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32029f1d9476Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32039f1d9476Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32049f1d9476Smrg		AC_CACHE_VAL($cacheid,
32059f1d9476Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32069f1d9476Smrg					     [eval $cacheid=yes],
32079f1d9476Smrg					     [eval $cacheid=no])])
32089f1d9476Smrg
32099f1d9476Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
32109f1d9476Smrg
32119f1d9476Smrg		eval supported=\$$cacheid
32129f1d9476Smrg		AC_MSG_RESULT([$supported])
32139f1d9476Smrg		if test "$supported" = "yes" ; then
32149f1d9476Smrg			$1="$$1 ]flag["
32159f1d9476Smrg			found="yes"
32169f1d9476Smrg		fi
32179f1d9476Smrg	fi
3218f33d31a3Smrg])
32199f1d9476Smrg]) # XORG_TESTSET_CFLAG
3220f33d31a3Smrg
32219f1d9476Smrg# XORG_COMPILER_FLAGS
32229f1d9476Smrg# ---------------
32239f1d9476Smrg# Minimum version: 1.16.0
3224f33d31a3Smrg#
32259f1d9476Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
32269f1d9476Smrg# arguments supported by the selected compiler which do NOT alter the generated
32279f1d9476Smrg# code.  These arguments will cause the compiler to print various warnings
32289f1d9476Smrg# during compilation AND turn a conservative set of warnings into errors.
32299f1d9476Smrg#
32309f1d9476Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
32319f1d9476Smrg# future versions of util-macros as options are added to new compilers.
32329f1d9476Smrg#
32339f1d9476SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
32349f1d9476SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235f33d31a3Smrg
32369f1d9476SmrgAC_ARG_ENABLE(selective-werror,
32379f1d9476Smrg              AS_HELP_STRING([--disable-selective-werror],
32389f1d9476Smrg                             [Turn off selective compiler errors. (default: enabled)]),
32399f1d9476Smrg              [SELECTIVE_WERROR=$enableval],
32409f1d9476Smrg              [SELECTIVE_WERROR=yes])
32419f1d9476Smrg
32429f1d9476SmrgAC_LANG_CASE(
32439f1d9476Smrg        [C], [
32449f1d9476Smrg                define([PREFIX], [C])
32459f1d9476Smrg        ],
32469f1d9476Smrg        [C++], [
32479f1d9476Smrg                define([PREFIX], [CXX])
32489f1d9476Smrg        ]
32499f1d9476Smrg)
32509f1d9476Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
32519f1d9476Smrgif test "x$SUNCC" = "xyes"; then
32529f1d9476Smrg    [BASE_]PREFIX[FLAGS]="-v"
3253f33d31a3Smrgelse
32549f1d9476Smrg    [BASE_]PREFIX[FLAGS]=""
3255f33d31a3Smrgfi
3256f33d31a3Smrg
32579f1d9476Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
32589f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
32599f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
32609f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
32619f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262f33d31a3Smrg
32639f1d9476SmrgAC_LANG_CASE(
32649f1d9476Smrg	[C], [
32659f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
32669f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
32679f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
32689f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32699f1d9476Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
32709f1d9476Smrg	]
32719f1d9476Smrg)
3272f33d31a3Smrg
32739f1d9476Smrg# This chunk adds additional warnings that could catch undesired effects.
32749f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
32759f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
32769f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
32779f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
32789f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
32799f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32809f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281f33d31a3Smrg
32829f1d9476Smrg# These are currently disabled because they are noisy.  They will be enabled
32839f1d9476Smrg# in the future once the codebase is sufficiently modernized to silence
32849f1d9476Smrg# them.  For now, I don't want them to drown out the other warnings.
32859f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
32869f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32879f1d9476Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288f33d31a3Smrg
32898b5ec993Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
32909f1d9476Smrg# when there are problems that should be fixed.
3291f33d31a3Smrg
32929f1d9476Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
32939f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
32949f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
32959f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
32969f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
32979f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
32989f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
32999f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33009f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33019f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33029f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33039f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33049f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33059f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
33069f1d9476Smrgelse
33079f1d9476SmrgAC_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])
33089f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33099f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33109f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33119f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33129f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33139f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
33149f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
33159f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
33169f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
33179f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
33189f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
33199f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
33209f1d9476SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33219f1d9476Smrgfi
3322f33d31a3Smrg
33239f1d9476SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33249f1d9476Smrg]) # XORG_COMPILER_FLAGS
3325f33d31a3Smrg
33269f1d9476Smrg# XORG_CWARNFLAGS
33279f1d9476Smrg# ---------------
33289f1d9476Smrg# Minimum version: 1.2.0
33299f1d9476Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3330f33d31a3Smrg#
33319f1d9476Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3332f33d31a3Smrg#
33339f1d9476Smrg# This function is deprecated because it defines -fno-strict-aliasing
33349f1d9476Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
33359f1d9476Smrg# is needed, then it should be added explicitly in the module when
33369f1d9476Smrg# it is updated to use BASE_CFLAGS.
3337f33d31a3Smrg#
33389f1d9476SmrgAC_DEFUN([XORG_CWARNFLAGS], [
33399f1d9476SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33409f1d9476SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33419f1d9476SmrgAC_LANG_CASE(
33429f1d9476Smrg	[C], [
33439f1d9476Smrg		CWARNFLAGS="$BASE_CFLAGS"
33449f1d9476Smrg		if  test "x$GCC" = xyes ; then
33459f1d9476Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
33469f1d9476Smrg		fi
33479f1d9476Smrg		AC_SUBST(CWARNFLAGS)
33489f1d9476Smrg	]
33499f1d9476Smrg)
33509f1d9476Smrg]) # XORG_CWARNFLAGS
3351f33d31a3Smrg
33529f1d9476Smrg# XORG_STRICT_OPTION
33539f1d9476Smrg# -----------------------
33549f1d9476Smrg# Minimum version: 1.3.0
33559f1d9476Smrg#
33569f1d9476Smrg# Add configure option to enable strict compilation flags, such as treating
33579f1d9476Smrg# warnings as fatal errors.
33589f1d9476Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
33599f1d9476Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33609f1d9476Smrg#
33619f1d9476Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
33629f1d9476Smrg# when strict compilation is unconditionally desired.
33639f1d9476SmrgAC_DEFUN([XORG_STRICT_OPTION], [
33649f1d9476SmrgAC_REQUIRE([XORG_CWARNFLAGS])
33659f1d9476SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366f33d31a3Smrg
33679f1d9476SmrgAC_ARG_ENABLE(strict-compilation,
33689f1d9476Smrg			  AS_HELP_STRING([--enable-strict-compilation],
33699f1d9476Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33709f1d9476Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371f33d31a3Smrg
33729f1d9476SmrgAC_LANG_CASE(
33739f1d9476Smrg        [C], [
33749f1d9476Smrg                define([PREFIX], [C])
33759f1d9476Smrg        ],
33769f1d9476Smrg        [C++], [
33779f1d9476Smrg                define([PREFIX], [CXX])
33789f1d9476Smrg        ]
33799f1d9476Smrg)
3380f33d31a3Smrg
33819f1d9476Smrg[STRICT_]PREFIX[FLAGS]=""
33829f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
33839f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384f33d31a3Smrg
33859f1d9476Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
33869f1d9476Smrg# activate it with -Werror, so we add it here explicitly.
33879f1d9476SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388f33d31a3Smrg
33899f1d9476Smrgif test "x$STRICT_COMPILE" = "xyes"; then
33909f1d9476Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
33919f1d9476Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33929f1d9476Smrgfi
33939f1d9476SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
33949f1d9476SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33959f1d9476SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33969f1d9476Smrg]) # XORG_STRICT_OPTION
3397f33d31a3Smrg
33988b5ec993Smrg# XORG_DEFAULT_NOCODE_OPTIONS
33998b5ec993Smrg# ---------------------------
34008b5ec993Smrg# Minimum version: 1.20.0
34018b5ec993Smrg#
34028b5ec993Smrg# Defines default options for X.Org modules which don't compile code,
34038b5ec993Smrg# such as fonts, bitmaps, cursors, and docs.
34048b5ec993Smrg#
34058b5ec993SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34068b5ec993SmrgAC_REQUIRE([AC_PROG_INSTALL])
34078b5ec993SmrgXORG_RELEASE_VERSION
34088b5ec993SmrgXORG_CHANGELOG
34098b5ec993SmrgXORG_INSTALL
34108b5ec993SmrgXORG_MANPAGE_SECTIONS
34118b5ec993Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34128b5ec993Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34138b5ec993Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34148b5ec993Smrg
34159f1d9476Smrg# XORG_DEFAULT_OPTIONS
34169f1d9476Smrg# --------------------
34179f1d9476Smrg# Minimum version: 1.3.0
34189f1d9476Smrg#
34198b5ec993Smrg# Defines default options for X.Org modules which compile code.
34209f1d9476Smrg#
34219f1d9476SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
34229f1d9476SmrgAC_REQUIRE([AC_PROG_INSTALL])
34239f1d9476SmrgXORG_COMPILER_FLAGS
34249f1d9476SmrgXORG_CWARNFLAGS
34259f1d9476SmrgXORG_STRICT_OPTION
34268b5ec993SmrgXORG_DEFAULT_NOCODE_OPTIONS
34279f1d9476Smrg]) # XORG_DEFAULT_OPTIONS
3428f33d31a3Smrg
34299f1d9476Smrg# XORG_INSTALL()
34309f1d9476Smrg# ----------------
34319f1d9476Smrg# Minimum version: 1.4.0
34329f1d9476Smrg#
34339f1d9476Smrg# Defines the variable INSTALL_CMD as the command to copy
34349f1d9476Smrg# INSTALL from $prefix/share/util-macros.
34359f1d9476Smrg#
34369f1d9476SmrgAC_DEFUN([XORG_INSTALL], [
34379f1d9476SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
34389f1d9476Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
34399f1d9476SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
34409f1d9476Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
34419f1d9476Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
34429f1d9476Smrgtouch \$(top_srcdir)/INSTALL; \
34439f1d9476Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
34449f1d9476SmrgAC_SUBST([INSTALL_CMD])
34459f1d9476Smrg]) # XORG_INSTALL
34469f1d9476Smrgdnl Copyright 2005 Red Hat, Inc
34479f1d9476Smrgdnl
34489f1d9476Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
34499f1d9476Smrgdnl documentation for any purpose is hereby granted without fee, provided that
34509f1d9476Smrgdnl the above copyright notice appear in all copies and that both that
34519f1d9476Smrgdnl copyright notice and this permission notice appear in supporting
34529f1d9476Smrgdnl documentation.
34539f1d9476Smrgdnl
34549f1d9476Smrgdnl The above copyright notice and this permission notice shall be included
34559f1d9476Smrgdnl in all copies or substantial portions of the Software.
34569f1d9476Smrgdnl
34579f1d9476Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34589f1d9476Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34599f1d9476Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34609f1d9476Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
34619f1d9476Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34629f1d9476Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34639f1d9476Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
34649f1d9476Smrgdnl
34659f1d9476Smrgdnl Except as contained in this notice, the name of the copyright holders shall
34669f1d9476Smrgdnl not be used in advertising or otherwise to promote the sale, use or
34679f1d9476Smrgdnl other dealings in this Software without prior written authorization
34689f1d9476Smrgdnl from the copyright holders.
34699f1d9476Smrgdnl
3470f33d31a3Smrg
34719f1d9476Smrg# XORG_RELEASE_VERSION
34729f1d9476Smrg# --------------------
34739f1d9476Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3474f33d31a3Smrg
34759f1d9476SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
34769f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
34779f1d9476Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
34789f1d9476Smrg		[Major version of this package])
34799f1d9476Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
34809f1d9476Smrg	if test "x$PVM" = "x"; then
34819f1d9476Smrg		PVM="0"
34829f1d9476Smrg	fi
34839f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
34849f1d9476Smrg		[$PVM],
34859f1d9476Smrg		[Minor version of this package])
34869f1d9476Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
34879f1d9476Smrg	if test "x$PVP" = "x"; then
34889f1d9476Smrg		PVP="0"
34899f1d9476Smrg	fi
34909f1d9476Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
34919f1d9476Smrg		[$PVP],
34929f1d9476Smrg		[Patch version of this package])
34939f1d9476Smrg])
3494f33d31a3Smrg
34959f1d9476Smrg# XORG_CHANGELOG()
34969f1d9476Smrg# ----------------
34979f1d9476Smrg# Minimum version: 1.2.0
34989f1d9476Smrg#
34999f1d9476Smrg# Defines the variable CHANGELOG_CMD as the command to generate
35009f1d9476Smrg# ChangeLog from git.
35019f1d9476Smrg#
35029f1d9476Smrg#
35039f1d9476SmrgAC_DEFUN([XORG_CHANGELOG], [
35049f1d9476SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
35059f1d9476Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
35069f1d9476Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
35079f1d9476Smrgtouch \$(top_srcdir)/ChangeLog; \
35089f1d9476Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
35099f1d9476SmrgAC_SUBST([CHANGELOG_CMD])
35109f1d9476Smrg]) # XORG_CHANGELOG
3511f33d31a3Smrg
3512